File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1198,19 +1198,12 @@ def get_entities_by_uuid(neo4j_driver,
11981198"""
11991199def get_batch_ids (neo4j_driver , id_list ):
12001200 query = """
1201- MATCH (e)
1202- WHERE e.uuid IN $id_list OR e.hubmap_id IN $id_list
1203- WITH e, [id IN $id_list WHERE id = e.uuid OR id = e.hubmap_id][0] AS original_id
1204- RETURN original_id, e.uuid AS uuid, e.hubmap_id AS hubmap_id
1201+ MATCH (e:Entity)
1202+ WHERE e.uuid IN $id_list
1203+ RETURN apoc.map.fromPairs(COLLECT([e.uuid, e.hubmap_id])) AS result
12051204 """
12061205
1207- result_map = {}
1208-
12091206 with neo4j_driver .session () as session :
1210- result = session .run (query , id_list = id_list )
1211- for record in result :
1212- result_map [record ['original_id' ]] = {
1213- "uuid" : record ['uuid' ],
1214- "hubmap_id" : record ['hubmap_id' ]
1215- }
1216- return result_map
1207+ record = session .run (query , id_list = id_list )
1208+ raw = record .single ()["result" ]
1209+ return {uuid : {"uuid" : uuid , "hubmap_id" : hubmap_id } for uuid , hubmap_id in raw .items ()}
You can’t perform that action at this time.
0 commit comments