From 09f8b957de857c45684cb901c7bcc776b18be27f Mon Sep 17 00:00:00 2001 From: chris-s-friedman Date: Wed, 28 Aug 2024 12:15:24 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20AD-2303=20add=20amount=20and=20amou?= =?UTF-8?q?nt=20units=20to=20sample=20and=20bs=20and=20kf=20target?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kf_lib_data_ingest/common/concept_schema.py | 6 ++++-- .../target_api_plugins/kids_first_dataservice.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/kf_lib_data_ingest/common/concept_schema.py b/kf_lib_data_ingest/common/concept_schema.py index 463eaf8b..8de8cb5a 100644 --- a/kf_lib_data_ingest/common/concept_schema.py +++ b/kf_lib_data_ingest/common/concept_schema.py @@ -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 @@ -184,8 +188,6 @@ class VOLUME(QuantityMixin): PRESERVATION_METHOD = None class BIOSPECIMEN(SAMPLE): - class QUANTITY(QuantityMixin): - pass class CONCENTRATION(QuantityMixin): pass diff --git a/kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py b/kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py index 49361212..7cd72264 100644 --- a/kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py +++ b/kf_lib_data_ingest/target_api_plugins/kids_first_dataservice.py @@ -495,6 +495,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), @@ -677,6 +685,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(