From eec71dd6a1130fc05fa5768312c474dcdfb1f81f Mon Sep 17 00:00:00 2001 From: zuhdil Date: Wed, 13 May 2026 00:52:59 +0700 Subject: [PATCH 1/3] Carry new_primarycompletiondate through to the silver layer Slide-in trial detail needs primary completion date alongside the existing start/end dates. The column was previously dropped during bronze-to-silver; preserve it and rename to primarycompletiondate matching the snake-no-underscore convention of the other date columns. --- .../transformations/clinical_trials.py | 2 +- tests/unit/test_clinical_trials.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/igh_data_transform/transformations/clinical_trials.py b/src/igh_data_transform/transformations/clinical_trials.py index c360eb7..ae98003 100644 --- a/src/igh_data_transform/transformations/clinical_trials.py +++ b/src/igh_data_transform/transformations/clinical_trials.py @@ -24,7 +24,6 @@ "_owningbusinessunit_value", "new_resultsfirstposted", "versionnumber", - "new_primarycompletiondate", "new_primaryoutcomemeasures", "timezoneruleversionnumber", "new_secondaryoutcomemeasures", @@ -46,6 +45,7 @@ "vin_ctterminatedreason": "ctterminatedreason", "vin_clinicaltrialid": "clinicaltrialid", "new_locations": "locations", + "new_primarycompletiondate": "primarycompletiondate", "_vin_candidate_value": "candidate_value", "new_firstposted": "firstposted", "new_outcomemeasure_secondary": "outcomemeasure_secondary", diff --git a/tests/unit/test_clinical_trials.py b/tests/unit/test_clinical_trials.py index 6b297d7..abdcb0a 100644 --- a/tests/unit/test_clinical_trials.py +++ b/tests/unit/test_clinical_trials.py @@ -358,7 +358,7 @@ def _make_input_df(self, overrides=None): "vin_source": ["ClinicalTrials.gov", "WHO ICTRP"], "new_resultsfirstposted": [None, None], "versionnumber": [100, 200], - "new_primarycompletiondate": [None, None], + "new_primarycompletiondate": ["2024-10-28T13:00:00Z", "2025-12-31T13:00:00Z"], "new_primaryoutcomemeasures": [None, None], "timezoneruleversionnumber": [0.0, None], "vin_recentupdates": [None, None], @@ -442,7 +442,6 @@ def test_drops_metadata_and_aim1_columns(self): "_owningbusinessunit_value", "new_resultsfirstposted", "versionnumber", - "new_primarycompletiondate", "new_primaryoutcomemeasures", "timezoneruleversionnumber", "new_secondaryoutcomemeasures", @@ -455,6 +454,12 @@ def test_drops_metadata_and_aim1_columns(self): for col in dropped: assert col not in result.columns + def test_renames_primary_completion_date(self): + df = self._make_input_df() + result, _ = transform_clinical_trials(df) + assert "primarycompletiondate" in result.columns + assert "new_primarycompletiondate" not in result.columns + def test_drops_empty_columns_preserving_valid_to(self): df = self._make_input_df() result, _ = transform_clinical_trials(df) From 9948d5e578645b1e19d75e490abaffecb46bd7fd Mon Sep 17 00:00:00 2001 From: zuhdil Date: Wed, 13 May 2026 00:57:43 +0700 Subject: [PATCH 2/3] Project conditions and primary completion date onto trial fact Adds two columns to fact_clinical_trial_event so the clinical-trial slide-in can show Conditions and the Primary completion milestone in its Timeline strip. primary_completion_date_key is an FK to dim_date, matching the existing start_date_key / end_date_key pattern. --- .../transformations/silver_to_gold/config/schema_map.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/igh_data_transform/transformations/silver_to_gold/config/schema_map.py b/src/igh_data_transform/transformations/silver_to_gold/config/schema_map.py index be31be7..c649115 100644 --- a/src/igh_data_transform/transformations/silver_to_gold/config/schema_map.py +++ b/src/igh_data_transform/transformations/silver_to_gold/config/schema_map.py @@ -254,6 +254,8 @@ "collaborator": "collaborator", "funder_type": "fundertype", "interventions": "interventions", + "conditions": "conditions", + "primary_completion_date_key": "FK:dim_date.full_date|EXTRACT_DATE:primarycompletiondate", "outcome_measure": "COALESCE(outcomemeasure_primary, outcomemeasure_secondary)", "sex": "sex", "study_design": "study_design", From fa492e0bbff32da310e57e367b7f8a19cd08c339 Mon Sep 17 00:00:00 2001 From: zuhdil Date: Wed, 13 May 2026 10:59:10 +0700 Subject: [PATCH 3/3] Apply `ruff format` to the new primary-completion-date test fixture The two-element list on `new_primarycompletiondate` exceeded Ruff's print width once the date strings were filled in. Reformat to one element per line, matching the project's existing format style and the precedent set by commit 04caad6. --- tests/unit/test_clinical_trials.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_clinical_trials.py b/tests/unit/test_clinical_trials.py index abdcb0a..62c89b1 100644 --- a/tests/unit/test_clinical_trials.py +++ b/tests/unit/test_clinical_trials.py @@ -358,7 +358,10 @@ def _make_input_df(self, overrides=None): "vin_source": ["ClinicalTrials.gov", "WHO ICTRP"], "new_resultsfirstposted": [None, None], "versionnumber": [100, 200], - "new_primarycompletiondate": ["2024-10-28T13:00:00Z", "2025-12-31T13:00:00Z"], + "new_primarycompletiondate": [ + "2024-10-28T13:00:00Z", + "2025-12-31T13:00:00Z", + ], "new_primaryoutcomemeasures": [None, None], "timezoneruleversionnumber": [0.0, None], "vin_recentupdates": [None, None],