From 4f26378305349b34bd6a9ac910b6cfb9b128a340 Mon Sep 17 00:00:00 2001 From: Luca Graglia Date: Wed, 30 Apr 2025 14:22:13 -0500 Subject: [PATCH 1/2] cde_id to code, and cde_version to version --- bin/utils.py | 4 ++-- dictionaryutils/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/utils.py b/bin/utils.py index 219980f..3088618 100644 --- a/bin/utils.py +++ b/bin/utils.py @@ -30,7 +30,7 @@ def get_info(ontology, code): page = response.text ret["termDef"]["source"] = ontology - ret["termDef"]["cde_id"] = code + ret["termDef"]["code"] = code ret["termDef"]["term_url"] = url index = page.find("Preferred Name: ") @@ -61,7 +61,7 @@ def get_info(ontology, code): else: index += len("") end_index = page.index("", index) - ret["termDef"]["cde_version"] = page[index:end_index].strip() + ret["termDef"]["version"] = page[index:end_index].strip() return ret diff --git a/dictionaryutils/utils.py b/dictionaryutils/utils.py index cecbdae..4d6b5dc 100644 --- a/dictionaryutils/utils.py +++ b/dictionaryutils/utils.py @@ -45,13 +45,13 @@ def node_values_to_codes(data_dictionary_node, record_value, ontology): print("ERROR: Missing enumDef in data dictionary for value: " + value + "in variable: " + variable + " - - Returning not coded value") return_value.append((variable,value)) continue - values = [ definition for definition in data_dictionary_node["properties"][variable]["enumDef"] if definition["enumeration"] == value and "termDef" in definition and "source" in definition["termDef"] and definition["termDef"]["source"] == ontology and definition["termDef"]["cde_id"] ] + values = [ definition for definition in data_dictionary_node["properties"][variable]["enumDef"] if definition["enumeration"] == value and "termDef" in definition and "source" in definition["termDef"] and definition["termDef"]["source"] == ontology and definition["termDef"]["code"] ] if len(values) > 1 or len(values) == 0: print("ERROR: Expected only one value per ontology per value - - Returning not coded value") return_value.append((variable,value)) continue - return_value.append((variable,values[0]["termDef"]["cde_id"])) + return_value.append((variable,values[0]["termDef"]["code"])) return return_value \ No newline at end of file From f15dd5a69410346409b39f6b4a757837edd6a853 Mon Sep 17 00:00:00 2001 From: Luca Graglia Date: Wed, 30 Apr 2025 14:29:40 -0500 Subject: [PATCH 2/2] revert --- bin/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/utils.py b/bin/utils.py index 3088618..219980f 100644 --- a/bin/utils.py +++ b/bin/utils.py @@ -30,7 +30,7 @@ def get_info(ontology, code): page = response.text ret["termDef"]["source"] = ontology - ret["termDef"]["code"] = code + ret["termDef"]["cde_id"] = code ret["termDef"]["term_url"] = url index = page.find("Preferred Name: ") @@ -61,7 +61,7 @@ def get_info(ontology, code): else: index += len("") end_index = page.index("", index) - ret["termDef"]["version"] = page[index:end_index].strip() + ret["termDef"]["cde_version"] = page[index:end_index].strip() return ret