(doc, key, cfg, transform)
| 181 | |
| 182 | |
| 183 | def _normalise(doc, key, cfg, transform): |
| 184 | doc.setdefault("dataset", key) |
| 185 | if cfg.get("doc_type"): |
| 186 | doc.setdefault("type", cfg["doc_type"]) |
| 187 | if transform: |
| 188 | doc = transform(doc) or doc |
| 189 | if "_id" not in doc: |
| 190 | _id = _make_id(key, cfg, doc) |
| 191 | if _id is not None: |
| 192 | doc["_id"] = _id |
| 193 | return doc |
| 194 | |
| 195 | |
| 196 | # --------------------------------------------------------------------------- # |
no test coverage detected