Skip to content

Commit

Permalink
🐛 Reference participant in specimen service plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fiendish committed Dec 7, 2020
1 parent f519be3 commit 79cf784
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class Family:
@classmethod
def get_key_components(cls, record, get_target_id_from_record):
return {
"study_id": not_none(record[CONCEPT.STUDY.TARGET_SERVICE_ID]),
"external_id": not_none(record[CONCEPT.FAMILY.ID]),
}

Expand Down Expand Up @@ -332,6 +333,9 @@ class Biospecimen:
@classmethod
def get_key_components(cls, record, get_target_id_from_record):
return {
"participant_id": not_none(
get_target_id_from_record(Participant, record)
),
"external_aliquot_id": not_none(record[CONCEPT.BIOSPECIMEN.ID]),
"external_sample_id": (
record.get(CONCEPT.BIOSPECIMEN_GROUP.ID)
Expand All @@ -347,7 +351,6 @@ def query_target_ids(cls, host, key_components):
def build_entity(cls, record, get_target_id_from_record):
secondary_components = {
"kf_id": get_target_id_from_record(cls, record),
"participant_id": get_target_id_from_record(Participant, record),
"sequencing_center_id": record.get(
CONCEPT.SEQUENCING.CENTER.TARGET_SERVICE_ID
),
Expand Down Expand Up @@ -406,7 +409,10 @@ class GenomicFile:
@classmethod
def get_key_components(cls, record, get_target_id_from_record):
# FIXME: Temporary until KFDRC file hashes are reliably stable
return {"external_id": not_none(record[CONCEPT.GENOMIC_FILE.ID])}
return {
"study_id": not_none(record[CONCEPT.STUDY.TARGET_SERVICE_ID]),
"external_id": not_none(record[CONCEPT.GENOMIC_FILE.ID]),
}

@classmethod
def query_target_ids(cls, host, key_components):
Expand Down Expand Up @@ -457,6 +463,7 @@ class ReadGroup:
@classmethod
def get_key_components(cls, record, get_target_id_from_record):
return {
"study_id": not_none(record[CONCEPT.STUDY.TARGET_SERVICE_ID]),
"external_id": record.get(CONCEPT.READ_GROUP.ID),
"flow_cell": not_none(record[CONCEPT.READ_GROUP.FLOW_CELL]),
"lane_number": not_none(record[CONCEPT.READ_GROUP.LANE_NUMBER]),
Expand Down

0 comments on commit 79cf784

Please sign in to comment.