Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 Map Concepts between KF and FHIR #78

Closed
wants to merge 31 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cac3148
:sparkles: ignore vscode cache
liberaliscomputing Feb 13, 2020
9eaa241
::construction: map concepts
liberaliscomputing Feb 13, 2020
81638f9
:construction: update profiles against updated ig
liberaliscomputing Feb 17, 2020
16c882c
:construction: fix typo
liberaliscomputing Feb 17, 2020
bab1841
Fix syntax
fiendish Feb 17, 2020
2d18c42
Merge pull request #79 from kids-first/fixes
liberaliscomputing Feb 17, 2020
86f6cc6
:construction: import constants and concepts
liberaliscomputing Feb 17, 2020
0cae8fb
:construction: deprecate dict update
liberaliscomputing Feb 17, 2020
06d21ff
:construction: convert individual template to prototype
fiendish Feb 17, 2020
ddbcbb3
:construction: wip
fiendish Feb 18, 2020
89dbdc2
:construction: wip
fiendish Feb 19, 2020
554f71c
:construction: individuals load now
fiendish Feb 19, 2020
dee356d
:construction: samples load now
fiendish Feb 19, 2020
f4b1a0b
:construction: abort without waiting
fiendish Feb 20, 2020
90c8f41
:construction: updates + phenotype wip
fiendish Feb 21, 2020
efe586e
🚧 update readme
liberaliscomputing Feb 21, 2020
707652e
🚧 fix indentation
liberaliscomputing Feb 21, 2020
890cc8b
🚧 update readme
liberaliscomputing Feb 21, 2020
3d6f29c
🚧 fix indentation
liberaliscomputing Feb 21, 2020
a3f204c
Merge pull request #82 from kids-first/functified
liberaliscomputing Feb 25, 2020
c01eda9
:construction: change style
liberaliscomputing Feb 28, 2020
e55247c
:construction: change style and add kfid assignment
liberaliscomputing Feb 28, 2020
29b8490
:construction: functify disease
liberaliscomputing Feb 28, 2020
2252e76
:construction: add .DS_Store
liberaliscomputing Mar 4, 2020
8327509
:construction: add mappers
liberaliscomputing Mar 4, 2020
90c936e
:construction: add id max char restriction
liberaliscomputing Mar 4, 2020
38b3a1c
:construction: add resource caches
liberaliscomputing Mar 4, 2020
02e6574
:construction: add HPO ontology and code system
liberaliscomputing Mar 4, 2020
3ad4fd1
:construction: add disease terminology
liberaliscomputing Mar 6, 2020
6bba1f3
:construction: update packer
liberaliscomputing Mar 6, 2020
0098372
:construction: add loading disease and phenotypic feature
liberaliscomputing Mar 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions docs/no_peeking/mappings/biosample.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@

def yield_biosamples(eng, table, study_id, individuals):
for row in make_select(
eng, table, CONCEPT.BIOSPECIMEN.ID, CONCEPT.PARTICIPANT.ID,
CONCEPT.BIOSPECIMEN.TARGET_SERVICE_ID, CONCEPT.BIOSPECIMEN.VOLUME_UL,
CONCEPT.BIOSPECIMEN.COMPOSITION, CONCEPT.BIOSPECIMEN.VISIBLE
):
eng, table,
CONCEPT.BIOSPECIMEN.ID,
CONCEPT.BIOSPECIMEN.TARGET_SERVICE_ID,
CONCEPT.PARTICIPANT.ID,
CONCEPT.BIOSPECIMEN.COMPOSITION,
CONCEPT.BIOSPECIMEN.VOLUME_UL,
CONCEPT.BIOSPECIMEN.VISIBLE
):
id = get(row, CONCEPT.BIOSPECIMEN.ID)
subject_id = get(row, CONCEPT.PARTICIPANT.ID)
kfid = get(row, CONCEPT.BIOSPECIMEN.TARGET_SERVICE_ID)
volume_ul = get(row, CONCEPT.BIOSPECIMEN.VOLUME_UL)
subject_id = get(row, CONCEPT.PARTICIPANT.ID)
composition = get(row, CONCEPT.BIOSPECIMEN.COMPOSITION)
volume_ul = get(row, CONCEPT.BIOSPECIMEN.VOLUME_UL)
visible = get(row, CONCEPT.BIOSPECIMEN.VISIBLE)

if not id:
Expand All @@ -63,24 +67,36 @@ def yield_biosamples(eng, table, study_id, individuals):
"meta": {
"profile": ["http://ga4gh.org/fhir/phenopackets/StructureDefinition/Biosample"]
},
"identifier": [{"system": f"http://kf-api-dataservice.kidsfirstdrc.org/biospecimens?study_id={study_id}", "value": id}],
"identifier": [
{
"system": f"http://kf-api-dataservice.kidsfirstdrc.org/biospecimens?study_id={study_id}", "value": id
}
],
"status": biosample_status[visible or constants.COMMON.TRUE],
}

if kfid:
retval["identifier"].append(
{
"system": "http://kf-api-dataservice.kidsfirstdrc.org/biospecimens", "value": kfid
}
)

if subject_id:
retval["subject"] = {
"reference": f"Patient/{individuals[subject_id]['id']}"
"reference": f"Patient/{individuals[subject_id]['id']}",
"type": iRType
Copy link
Contributor

@fiendish fiendish Feb 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this type field for? "Patient" is already part of the reference url component. I think if anything the reference field should be f"{iRType}/{individuals[subject_id]['id']}". .

}

if composition:
retval["type"] = codeable_concept(
composition, [v2_0487_compositions], "Biosample Composition"
)

if volume_ul:
retval.setdefault("collection", {})["quantity"] = {
"unit": "uL",
"value": float(volume_ul),
}

if composition:
retval["type"] = codeable_concept(
composition, [v2_0487_compositions], "Biosample Composition"
)

yield retval, id