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