Skip to content

Commit f6e0591

Browse files
committed
Hotfix: fixed subject/object dict formatting issue with bagelization done by LitCoin API service
1 parent f4701e4 commit f6e0591

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

parsers/LitCoin/src/loadLitCoin.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,16 @@ def parse_data(self) -> dict:
175175
try:
176176
if LITCOIN.BAGELIZED_SUBJECT in litcoin_edge:
177177
# entities already bagelized for this edge, no need to call bagelize_entity
178-
subject_node = litcoin_edge[LITCOIN.BAGELIZED_SUBJECT]
179-
if isinstance(subject_node, str) and subject_node == LITCOIN.NOT_AVAILABLE:
178+
bagel_subject_node = litcoin_edge[LITCOIN.BAGELIZED_SUBJECT]
179+
if isinstance(bagel_subject_node, str) and bagel_subject_node == LITCOIN.NOT_AVAILABLE:
180180
subject_node = None
181+
else:
182+
# convert subject_node to required format for subsequent processing
183+
key, val = bagel_subject_node.popitem()
184+
subject_node = {
185+
"id": key,
186+
**val
187+
}
181188
else:
182189
subject_node = self.bagelize_entity(entity_name=litcoin_edge[LITCOIN.SUBJECT_NAME],
183190
abstract_id=abstract_id,
@@ -191,11 +198,18 @@ def parse_data(self) -> dict:
191198
skipped_records += 1
192199
continue
193200

194-
if LITCOIN.BAGELIZED_OBJECT in litcoin_edge:
201+
if LITCOIN.BAGELIZED_OBJECT in litcoin_edge:
195202
# entities already bagelized for this edge, no need to call bagelize_entity
196-
object_node = litcoin_edge[LITCOIN.BAGELIZED_OBJECT]
197-
if isinstance(object_node, str) and object_node == LITCOIN.NOT_AVAILABLE:
203+
bagel_object_node = litcoin_edge[LITCOIN.BAGELIZED_OBJECT]
204+
if isinstance(bagel_object_node, str) and bagel_object_node == LITCOIN.NOT_AVAILABLE:
198205
object_node = None
206+
else:
207+
# convert object_node to required format for subsequent processing
208+
key, val = bagel_object_node.popitem()
209+
object_node = {
210+
"id": key,
211+
**val
212+
}
199213
else:
200214
object_node = self.bagelize_entity(entity_name=litcoin_edge[LITCOIN.OBJECT_NAME],
201215
abstract_id=abstract_id,

0 commit comments

Comments
 (0)