6868
6969PATHWAYS_CACHE = 'pathways.json'
7070
71- def pathways_metadata (map_uuid : str ) -> dict [str , Any ]:
72- #======================================================
71+ def pathways (map_uuid : str ) -> dict [str , Any ]:
72+ #=============================================
7373 pathways_file = pathlib .Path (settings ['FLATMAP_ROOT' ]) / map_uuid / PATHWAYS_CACHE
7474 try :
7575 with open (pathways_file ) as fp :
7676 return json .load (fp )
7777 except Exception :
7878 pass
79- metadata = json_map_metadata (map_uuid , 'pathways' )
79+ pathways = json_map_metadata (map_uuid , 'pathways' )
8080 with open (pathways_file , 'w' ) as fp :
81- json .dump (metadata , fp )
82- return metadata
81+ json .dump (pathways , fp )
82+ return pathways
8383
8484#===============================================================================
8585#===============================================================================
@@ -252,7 +252,7 @@ async def flatmap_metadata(map_uuid: str) -> dict:
252252@get ('flatmap/{map_uuid:str}/pathways' )
253253async def flatmap_pathways (map_uuid : str ) -> dict :
254254 try :
255- return pathways_metadata (map_uuid )
255+ return pathways (map_uuid )
256256 except IOError as err :
257257 raise exceptions .NotFoundException (detail = str (err ))
258258
@@ -262,10 +262,10 @@ async def flatmap_pathways(map_uuid: str) -> dict:
262262async def flatmap_connectivity (map_uuid : str , path_id : str ) -> dict :
263263 path_id = path_id [1 :] # Remove leading '/''
264264 try :
265- pathways = pathways_metadata (map_uuid )
265+ path_data = pathways (map_uuid )
266266 except IOError as err :
267267 raise exceptions .NotFoundException (detail = str (err ))
268- paths = pathways .get ('paths' , {})
268+ paths = path_data .get ('paths' , {})
269269 if not path_id .startswith ('ilxtr:' ) or path_id not in paths :
270270 raise exceptions .NotFoundException (detail = f'Unknown path: { path_id } ' )
271271 path = paths [path_id ]
0 commit comments