Skip to content

Commit

Permalink
Merge pull request #122 from c3g/fixes-to-ingest
Browse files Browse the repository at this point in the history
Fixes to ingest
  • Loading branch information
zxenia committed May 19, 2020
2 parents 6a4c301 + 8b73561 commit 5cf5495
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chord_metadata_service/chord/views_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ def ingest(request):

def _query_and_check_nulls(obj: dict, key: str, transform: Callable = lambda x: x):
value = obj.get(key, None)
return {f"{key}__isnull": True} if value is None else {key: transform(value)}
return {f"{key}__isnull": True} if value is None or value == "" else {key: transform(value)}


def ingest_phenopacket(phenopacket_data, table_id):
""" Ingests one phenopacket. """

new_phenopacket_id = str(uuid.uuid4()) # TODO: Is this provided?
new_phenopacket_id = phenopacket_data.get("id", str(uuid.uuid4()))

subject = phenopacket_data.get("subject", None)
phenotypic_features = phenopacket_data.get("phenotypic_features", [])
Expand Down Expand Up @@ -222,7 +222,7 @@ def ingest_phenopacket(phenopacket_data, table_id):
term=disease["term"],
disease_stage=disease.get("disease_stage", []),
tnm_finding=disease.get("tnm_finding", []),
**_query_and_check_nulls(disease, "onset")
onset=disease.get("onset", None)
)
diseases_db.append(d_obj.id)

Expand Down

0 comments on commit 5cf5495

Please sign in to comment.