Skip to content

Commit

Permalink
Merge pull request #695 from kids-first/ad-2303
Browse files Browse the repository at this point in the history
✨ AD-2303 add amount and amount units to sample and bs and kf target
  • Loading branch information
chris-s-friedman authored Sep 10, 2024
2 parents 2abcf8b + db88f80 commit 159b4cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kf_lib_data_ingest/common/concept_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ class SAMPLE(PropertyMixin):
class EVENT_AGE(QuantityMixin):
pass

class QUANTITY(QuantityMixin):
pass

class VOLUME(QuantityMixin):
# Keeping for backwards compatability. Use QUANTITY instead.
pass

SPATIAL_DESCRIPTOR = None
Expand All @@ -186,8 +190,6 @@ class VOLUME(QuantityMixin):
EXTERNAL_COLLECTION_ID = None

class BIOSPECIMEN(SAMPLE):
class QUANTITY(QuantityMixin):
pass

class CONCENTRATION(QuantityMixin):
pass
Expand Down
16 changes: 16 additions & 0 deletions kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,14 @@ def build_entity(cls, record, get_target_id_from_record):
record.get(CONCEPT.SAMPLE.VOLUME_UL)
or record.get(CONCEPT.BIOSPECIMEN.VOLUME_UL)
),
"amount": (
record.get(CONCEPT.SAMPLE.QUANTITY.VALUE)
or record.get(CONCEPT.BIOSPECIMEN.QUANTITY.VALUE)
),
"amount_units": (
record.get(CONCEPT.SAMPLE.QUANTITY.UNITS)
or record.get(CONCEPT.BIOSPECIMEN.QUANTITY.UNITS)
),
}
return {
**cls.get_key_components(record, get_target_id_from_record),
Expand Down Expand Up @@ -689,6 +697,14 @@ def build_entity(cls, record, get_target_id_from_record):
record.get(CONCEPT.SAMPLE.VOLUME_UL)
or record.get(CONCEPT.BIOSPECIMEN.VOLUME_UL)
),
"amount": (
record.get(CONCEPT.SAMPLE.QUANTITY.VALUE)
or record.get(CONCEPT.BIOSPECIMEN.QUANTITY.VALUE)
),
"amount_units": (
record.get(CONCEPT.SAMPLE.QUANTITY.UNITS)
or record.get(CONCEPT.BIOSPECIMEN.QUANTITY.UNITS)
),
"specimen_status": (record.get(CONCEPT.BIOSPECIMEN.STATUS)),
"visible": record.get(CONCEPT.BIOSPECIMEN.VISIBLE),
"visibility_comment": record.get(
Expand Down

0 comments on commit 159b4cc

Please sign in to comment.