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,15 +1198,12 @@ def get_entities_by_uuid(neo4j_driver,
11981198"""
11991199def get_batch_ids (neo4j_driver , id_list ):
12001200 query = """
1201- UNWIND $id_list AS uid
1202- MATCH (e:Entity { uuid: uid})
1203- RETURN uid 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
12041204 """
12051205
1206- result_dict = {}
1207-
12081206 with neo4j_driver .session () as session :
1209- result = session .run (query , id_list = id_list )
1210- for record in result :
1211- result_dict [record ["uuid" ]] = record ["hubmap_id" ]
1212- return result_dict
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