From 8c3c38ea953d30f765562cdd88ba788b72dad71f Mon Sep 17 00:00:00 2001
From: AndiMajore <andi.majore@googlemail.com>
Date: Thu, 20 Apr 2023 11:18:45 +0200
Subject: [PATCH] small hotfix for unmappable compact notation nodes

Former-commit-id: d708bf98b43b750fef81e64457d4dd3edd048899 [formerly 4ff82f6a4f8b181bcb66b96b9f0081946ad57998]
Former-commit-id: f377cbec079ed3d7058912b416482f1bd662a9b6
---
 drugstone/views.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drugstone/views.py b/drugstone/views.py
index e4cf1bb..89081ab 100755
--- a/drugstone/views.py
+++ b/drugstone/views.py
@@ -189,7 +189,14 @@ def map_nodes(request) -> Response:
     nodes_mapped, id_key = query_proteins_by_identifier(node_ids, identifier)
 
     # change data structure to dict in order to be quicker when merging
-    nodes_mapped_dict = {id.upper(): node for node in nodes_mapped for id in node[id_key]}
+    nodes_mapped_dict = {}
+    for node in nodes_mapped:
+        if id_key in node:
+            for id in node[id_key]:
+                nodes_mapped_dict[id.upper()] = node
+        # TODO find solution if target id space is empty
+        # else:
+        #     nodes_mapped_dict[node['id'].upper()] = node
 
     # merge fetched data with given data to avoid data loss
     for node in nodes:
-- 
GitLab