From 4f9ab10edd32001074bf3549d14b7d2922414653 Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Thu, 17 Oct 2024 13:58:07 +0200 Subject: [PATCH] automatically convert VAR TYPE column to uppercase --- backend/src/upload.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/upload.py b/backend/src/upload.py index e34c8ad..a1d6c03 100644 --- a/backend/src/upload.py +++ b/backend/src/upload.py @@ -208,6 +208,9 @@ def load_cohort_dict_file(dict_path: str, cohort_id: str) -> Dataset: g.add((cohort_uri, RDF.type, ICARE.Cohort, cohort_uri)) g.add((cohort_uri, DC.identifier, Literal(cohort_id), cohort_uri)) + # Make sure variable types are all uppercase + df["VAR TYPE"] = df.apply(lambda row: str(row["VAR TYPE"]).upper(), axis=1) + for i, row in df.iterrows(): # Check if required columns are present if not row["VARIABLE NAME"] or not row["VARIABLE LABEL"] or not row["VAR TYPE"] or not row["COUNT"]: