From 46ed98b7393038a9301f004778378e70ba921bab Mon Sep 17 00:00:00 2001 From: Sally Grindstaff Date: Tue, 28 Nov 2023 14:00:54 -0800 Subject: [PATCH] Cast census tract as string in clinical parse-kp2023 --- lib/seattleflu/id3c/cli/command/clinical.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/seattleflu/id3c/cli/command/clinical.py b/lib/seattleflu/id3c/cli/command/clinical.py index f29df671..83d35ef0 100644 --- a/lib/seattleflu/id3c/cli/command/clinical.py +++ b/lib/seattleflu/id3c/cli/command/clinical.py @@ -1022,6 +1022,10 @@ def parse_kp2023(kp2023_filename: str) -> None: for col in date_cols: clinical_records[col] = pd.to_datetime(clinical_records[col]).dt.strftime('%Y-%m-%d') + # convert census_tract to string + # do this here rather than upon import with dtype, because the latter would require assuming capitalization of column name from KP + clinical_records['census_tract'] = clinical_records['census_tract'].astype('Int64').astype('str') + # ensure there are no unintended columns being kept columns_to_keep = [ '_provenance',