1313 MurfeyID ,
1414 MurfeyInstanceEnvironment ,
1515)
16- from murfey .util .api import url_path_for
1716from murfey .util .client import capture_get , capture_post , get_machine_config_client
1817from murfey .util .spa_metadata import (
1918 foil_hole_data ,
@@ -227,7 +226,10 @@ def gather_metadata(
227226 binning_factor = 1
228227 if environment :
229228 server_config_response = capture_get (
230- f"{ str (environment .url .geturl ())} { url_path_for ('session_control.router' , 'machine_info_by_instrument' , instrument_name = environment .instrument_name )} "
229+ base_url = str (environment .url .geturl ()),
230+ router_name = "session_control.router" ,
231+ function_name = "machine_info_by_instrument" ,
232+ instrument_name = environment .instrument_name ,
231233 )
232234 if server_config_response is None :
233235 return None
@@ -297,7 +299,10 @@ def _position_analysis(
297299 ] = (None , None , None , None , None , None , None )
298300 data_collection_group = (
299301 capture_get (
300- f"{ environment .url .geturl ()} { url_path_for ('session_info.router' , 'get_dc_groups' , session_id = environment .murfey_session )} "
302+ base_url = str (environment .url .geturl ()),
303+ router_name = "session_info.router" ,
304+ function_name = "get_dc_groups" ,
305+ session_id = environment .murfey_session ,
301306 )
302307 .json ()
303308 .get (str (source ), {})
@@ -319,7 +324,6 @@ def _position_analysis(
319324 local_atlas_path ,
320325 grid_square = str (grid_square ),
321326 )[str (grid_square )]
322- gs_url = f"{ str (environment .url .geturl ())} { url_path_for ('session_control.spa_router' , 'register_grid_square' , session_id = environment .murfey_session , gsid = grid_square )} "
323327 gs = grid_square_data (
324328 grid_square_metadata_file ,
325329 grid_square ,
@@ -340,8 +344,12 @@ def _position_analysis(
340344 else ""
341345 )
342346 capture_post (
343- gs_url ,
344- json = {
347+ base_url = str (environment .url .geturl ()),
348+ router_name = "session_control.spa_router" ,
349+ function_name = "register_grid_square" ,
350+ session_id = environment .murfey_session ,
351+ gsid = grid_square ,
352+ data = {
345353 "tag" : str (source ),
346354 "readout_area_x" : gs .readout_area_x ,
347355 "readout_area_y" : gs .readout_area_y ,
@@ -360,7 +368,6 @@ def _position_analysis(
360368 )
361369 foil_hole = foil_hole_from_file (transferred_file )
362370 if foil_hole not in self ._foil_holes [grid_square ]:
363- fh_url = f"{ str (environment .url .geturl ())} { url_path_for ('session_control.spa_router' , 'register_foil_hole' , session_id = environment .murfey_session , gs_name = grid_square )} "
364371 if environment .murfey_session is not None :
365372 fh = foil_hole_data (
366373 grid_square_metadata_file ,
@@ -383,8 +390,12 @@ def _position_analysis(
383390 else ""
384391 )
385392 capture_post (
386- fh_url ,
387- json = {
393+ base_url = str (environment .url .geturl ()),
394+ router_name = "session_control.spa_router" ,
395+ function_name = "register_foil_hole" ,
396+ session_id = environment .murfey_session ,
397+ gs_name = grid_square ,
398+ data = {
388399 "name" : foil_hole ,
389400 "x_location" : fh .x_location ,
390401 "y_location" : fh .y_location ,
@@ -402,8 +413,12 @@ def _position_analysis(
402413 )
403414 else :
404415 capture_post (
405- fh_url ,
406- json = {
416+ base_url = str (environment .url .geturl ()),
417+ router_name = "session_control.spa_router" ,
418+ function_name = "register_foil_hole" ,
419+ session_id = environment .murfey_session ,
420+ gs_name = grid_square ,
421+ data = {
407422 "name" : foil_hole ,
408423 "tag" : str (source ),
409424 },
@@ -459,7 +474,9 @@ def post_transfer(
459474 )
460475 if not environment .movie_counters .get (str (source )):
461476 movie_counts_get = capture_get (
462- f"{ environment .url .geturl ()} { url_path_for ('session_control.router' , 'count_number_of_movies' )} " ,
477+ base_url = str (environment .url .geturl ()),
478+ router_name = "session_control.router" ,
479+ function_name = "count_number_of_movies" ,
463480 )
464481 if movie_counts_get is not None :
465482 environment .movie_counters [str (source )] = count (
@@ -473,8 +490,12 @@ def post_transfer(
473490 eer_fractionation_file = None
474491 if file_transferred_to .suffix == ".eer" :
475492 response = capture_post (
476- f"{ str (environment .url .geturl ())} { url_path_for ('file_io_instrument.router' , 'write_eer_fractionation_file' , visit_name = environment .visit , session_id = environment .murfey_session )} " ,
477- json = {
493+ base_url = str (environment .url .geturl ()),
494+ router_name = "file_io_instrument.router" ,
495+ function_name = "write_eer_fractionation_file" ,
496+ visit_name = environment .visit ,
497+ session_id = environment .murfey_session ,
498+ data = {
478499 "eer_path" : str (file_transferred_to ),
479500 "fractionation" : self .data_collection_parameters [
480501 "eer_fractionation"
@@ -503,7 +524,6 @@ def post_transfer(
503524 )
504525 foil_hole = None
505526
506- preproc_url = f"{ str (environment .url .geturl ())} { url_path_for ('workflow.spa_router' , 'request_spa_preprocessing' , visit_name = environment .visit , session_id = environment .murfey_session )} "
507527 preproc_data = {
508528 "path" : str (file_transferred_to ),
509529 "description" : "" ,
@@ -529,8 +549,12 @@ def post_transfer(
529549 "foil_hole_id" : foil_hole ,
530550 }
531551 capture_post (
532- preproc_url ,
533- json = {
552+ base_url = str (environment .url .geturl ()),
553+ router_name = "workflow.spa_router" ,
554+ function_name = "request_spa_preprocessing" ,
555+ visit_name = environment .visit ,
556+ session_id = environment .murfey_session ,
557+ data = {
534558 k : None if v == "None" else v
535559 for k , v in preproc_data .items ()
536560 },
0 commit comments