diff --git a/app/biolucida_process_results.py b/app/biolucida_process_results.py index 5a9e21f..f3933f4 100644 --- a/app/biolucida_process_results.py +++ b/app/biolucida_process_results.py @@ -1,6 +1,7 @@ import re from xml.etree import ElementTree +from app.manifest_name_to_discover_name import biolucida_name_map XMP_NS = {'xmp': 'http://ns.adobe.com/xap/1.0/', 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'x': 'adobe:ns:meta/'} @@ -87,3 +88,12 @@ def process_results(data): raise NotImplementedError(f"Not able to handle XMP core meta data for version: '{version}'") raise AttributeError(f"Not able to match version from: '{xmp_version_string}'") + + +def process_result(data): + if 'name' in data: + image_name = data['name'] + if image_name in biolucida_name_map: + data['name'] = biolucida_name_map[image_name] + + return data \ No newline at end of file diff --git a/app/main.py b/app/main.py index 89b8638..945e041 100644 --- a/app/main.py +++ b/app/main.py @@ -47,7 +47,7 @@ from app.utilities import img_to_base64_str, get_path_from_mangled_list from app.osparc.osparc import start_simulation as do_start_simulation from app.osparc.osparc import check_simulation as do_check_simulation -from app.biolucida_process_results import process_results as process_biolucida_results +from app.biolucida_process_results import process_results as process_biolucida_results, process_result as process_biolucida_result logging.basicConfig() @@ -951,7 +951,7 @@ def thumbnail_by_image_id(image_id, recursive_call=False): def image_info_by_image_id(image_id): url = Config.BIOLUCIDA_ENDPOINT + "/image/{0}".format(image_id) response = requests.request("GET", url) - return response.json() + return process_biolucida_result(response.json()) @app.route("/image_search/", methods=["GET"]) diff --git a/app/manifest_name_to_discover_name.py b/app/manifest_name_to_discover_name.py index 580c27e..f65ef3a 100644 --- a/app/manifest_name_to_discover_name.py +++ b/app/manifest_name_to_discover_name.py @@ -5113,3 +5113,6 @@ 'files/derivative/sub-15\sam-3\sub-15_sam-3_ChAT_P15-3p3_20x.jp2': 'files/derivative/sub-15/sam-3/sub-15_sam-3_ChAT_P15-3p3_20x.jp2', 'files/derivative/sub-15\sam-3\sub-15_sam-3_TH_P15-3p1_20x.jp2': 'files/derivative/sub-15/sam-3/sub-15_sam-3_TH_P15-3p1_20x.jp2' } + +biolucida_name_map = { +}