Skip to content

Commit 8d24ca5

Browse files
committed
Improved output.
1 parent 4ca7664 commit 8d24ca5

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

node_normalizer/normalizer.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,18 +853,22 @@ async def create_node(app, canonical_id, equivalent_ids, types_with_ancestors, i
853853
eq_item["type"] = eqid['types'][-1]
854854
node["equivalent_identifiers"].append(eq_item)
855855

856-
if clique_leaders and canonical_id in clique_leaders and eqid["i"] in clique_leaders[canonical_id]:
856+
if clique_leaders and canonical_id in clique_leaders and eqid["i"].upper() in clique_leaders[canonical_id]:
857857
clique_leader_output = {
858858
"identifier": eqid["i"],
859859
}
860860
if "label" in eq_item:
861861
clique_leader_output["label"] = eq_item["label"]
862-
if "description" in eq_item:
863-
clique_leader_output["description"] = eq_item["description"]
864-
if "taxa" in eq_item:
865-
clique_leader_output["taxa"] = eq_item["taxa"]
866-
if "type" in eq_item:
867-
clique_leader_output["type"] = eq_item["type"]
862+
863+
# For description, taxa and type, we could read them from eq_item, but that
864+
# is only set if the appropriate flag was turned on. For completeness, let's
865+
# try picking them up if they've been passed to us at all.
866+
if "d" in eqid and len(eqid["d"]) > 0:
867+
clique_leader_output["description"] = eqid["d"]
868+
if "t" in eqid and eqid["t"]:
869+
clique_leader_output["taxa"] = eqid["t"]
870+
if 'types' in eqid:
871+
clique_leader_output["type"] = eqid['types'][-1]
868872
clique_leaders_output.append(clique_leader_output)
869873

870874
if include_descriptions and descriptions:

0 commit comments

Comments
 (0)