From f58f57b25acd1c293eb55425352527e4cad6cc77 Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Mon, 8 Apr 2024 12:39:00 +0200 Subject: [PATCH] better error msg --- backend/src/upload.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/upload.py b/backend/src/upload.py index 5cf7d87..7f9837f 100644 --- a/backend/src/upload.py +++ b/backend/src/upload.py @@ -185,7 +185,6 @@ def to_camelcase(s: str) -> str: s = sub(r"(_|-)+", " ", s).title().replace(" ", "") return "".join([s[0].lower(), s[1:]]) - def load_cohort_dict_file(dict_path: str, cohort_id: str, user_email: str) -> Dataset: """Parse the cohort dictionary uploaded as excel or CSV spreadsheet, and load it to the triplestore""" # print(f"Loading dictionary {dict_path}") @@ -277,7 +276,7 @@ def load_cohort_dict_file(dict_path: str, cohort_id: str, user_email: str) -> Da g.add((cat_uri, RDFS.label, Literal(category["label"]), cohort_uri)) try: if categories_codes: - cat_code_uri = converter.expand(categories_codes[index]) + cat_code_uri = converter.expand(str(categories_codes[index]).strip()) if not cat_code_uri: errors.append(f"Row {i+2} for variable `{row['VARIABLE NAME']}` the category concept code provided for `{categories_codes[index]}` is not valid. Use one of snomedct:, icd10:, atc: or loinc: prefixes.") else: