From 27f91add336a790b31247e4b04f4b19671da3843 Mon Sep 17 00:00:00 2001 From: ehennestad Date: Thu, 25 Jul 2024 10:44:43 +0200 Subject: [PATCH] Fix bug when resolving instance names (#13) --- pipeline/translator.py | 2 +- pipeline/utils.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pipeline/translator.py b/pipeline/translator.py index 50854fce..a17528e3 100644 --- a/pipeline/translator.py +++ b/pipeline/translator.py @@ -202,7 +202,7 @@ def _extract_template_variables(self): display_label_method_expression = _get_display_label_method_expression(class_name) # TODO: Specify base class. Implement template with configurable base class. Schema or ControlledTerm? - # Or; just remove this as its not needed when using separate templates. + # Or; just remove this as it's not needed when using separate templates. if self._schema_model_name == "controlledTerms": base_class = "openminds.abstract.ControlledTerm" else: diff --git a/pipeline/utils.py b/pipeline/utils.py index c6deda4d..8ae754da 100644 --- a/pipeline/utils.py +++ b/pipeline/utils.py @@ -59,7 +59,7 @@ def get_instance_collection(self, version:str, schema_name:str) -> List[str]: # Make sure schema_name is correct casing (camel case) according to foldernames if schema_name == schema_name.upper(): pass - elif schema_name == "UBERONParcellation": + elif schema_name in ["UBERONParcellation", "MRIPulseSequence"]: # Todo: Need to find a general solution for these exceptions. pass else: @@ -87,7 +87,9 @@ def camel_case(text_string: str): def extract_filename_without_extension(path): base_name = os.path.basename(path) # Get the base name from the path - return base_name.split('.')[0] + if '.' in base_name: + return base_name.rsplit('.', 1)[0] + return base_name def save_resource_files(version, schema_path_list): """