Skip to content

Commit

Permalink
Look for dcids in dc responses if values are not present. (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyurva authored Jul 30, 2024
1 parent 880f07a commit e9c94fe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions simple/util/dc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ async def _get_property_of_entities_chunk(client: AsyncClient,
result_chunk: dict[str, str] = {}
for entity_dcid, entity_data in response.get("data", {}).items():
nodes = entity_data.get("arcs", {}).get(property_name, {}).get("nodes", [])
# Look for "value", then "dcid".
values = [node.get("value") for node in nodes if node.get("value")]
if not values:
values = [node.get("dcid") for node in nodes if node.get("dcid")]
if values:
result_chunk[entity_dcid] = values[0]

Expand Down

0 comments on commit e9c94fe

Please sign in to comment.