Skip to content

Commit

Permalink
fix biosample ingestion
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Oct 12, 2023
1 parent 60cb02c commit bb3c426
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chord_metadata_service/chord/ingest/phenopackets.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ def get_or_create_biosample(bs: dict) -> pm.Biosample:
id=bs["id"],
description=bs.get("description", ""),
procedure=procedure,
derived_from_id=bs.get("derived_from_id", ""),
sample_type=bs.get("sample_type", {}),
measurements=bs.get("measurements", []),
pathological_stage=bs.get("pathological_stage", {}),
is_control_sample=bs.get("is_control_sample", False),
diagnostic_markers=bs.get("diagnostic_markers", []),
extra_properties=bs.get("extra_properties", {}),
Expand Down Expand Up @@ -292,7 +296,7 @@ def ingest_phenopacket(phenopacket_data: dict[str, Any],
# explicitly says of the biosamples field:
# "This field describes samples that have been derived from the patient who is the object of the Phenopacket"
biosamples = [
{**bs, "individual_id": subject["id"]} if subject else bs
{**bs, "individual_id": subject["id"]} if "individual_id" not in bs and subject else bs
for bs in phenopacket_data.get("biosamples", [])
]

Expand Down

0 comments on commit bb3c426

Please sign in to comment.