From 3d616a74bd8c68ba979315d65f4781a64d2aaabf Mon Sep 17 00:00:00 2001 From: David Reinhart Date: Fri, 10 Sep 2021 10:36:24 -0700 Subject: [PATCH] Add date to sample API to be written to details Date should be included in `warehouse.sample` jsonb column `details`. Adding here to match process in manifest ETL and ensure this value is present for queries that rely on it. --- lib/id3c/api/datastore.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/id3c/api/datastore.py b/lib/id3c/api/datastore.py index 03acff48..e15890dd 100644 --- a/lib/id3c/api/datastore.py +++ b/lib/id3c/api/datastore.py @@ -424,7 +424,10 @@ def store_sample(session: DatabaseSession, sample: dict) -> Any: return result collected_date = sample.get("collection_date", None) - + + # Add date to sample so that it gets written to the 'details' column in warehouse.sample + sample["date"] = collected_date + # When updating an existing row, update the identifiers only if the record has both # the 'sample_barcode' and 'collection_barcode' keys should_update_identifiers = True if (sample_identifier and collection_identifier) else False