Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/igh_data_transform/transformations/clinical_trials.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"_owningbusinessunit_value",
"new_resultsfirstposted",
"versionnumber",
"new_primarycompletiondate",
"new_primaryoutcomemeasures",
"timezoneruleversionnumber",
"new_secondaryoutcomemeasures",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 10 additions & 2 deletions tests/unit/test_clinical_trials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [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],
Expand Down Expand Up @@ -442,7 +445,6 @@ def test_drops_metadata_and_aim1_columns(self):
"_owningbusinessunit_value",
"new_resultsfirstposted",
"versionnumber",
"new_primarycompletiondate",
"new_primaryoutcomemeasures",
"timezoneruleversionnumber",
"new_secondaryoutcomemeasures",
Expand All @@ -455,6 +457,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)
Expand Down