diff --git a/pynxtools/dataconverter/helpers.py b/pynxtools/dataconverter/helpers.py index 8a6842788..377f4f12e 100644 --- a/pynxtools/dataconverter/helpers.py +++ b/pynxtools/dataconverter/helpers.py @@ -383,11 +383,14 @@ def is_valid_data_field(value, nxdl_type, path): return value -def path_in_data_dict(nxdl_path: str, data: dict) -> Tuple[bool, str]: +def path_in_data_dict(nxdl_path: str, hdf_path: str, data: dict) -> Tuple[bool, str]: """Checks if there is an accepted variation of path in the dictionary & returns the path.""" accepted_unfilled_key = None for key in data.keys(): - if nxdl_path == convert_data_converter_dict_to_nxdl_path(key): + if ( + nxdl_path == convert_data_converter_dict_to_nxdl_path(key) + or convert_data_dict_path_to_hdf5_path(key) == hdf_path + ): if data[key] is None: accepted_unfilled_key = key continue @@ -438,7 +441,12 @@ def all_required_children_are_set(optional_parent_path, data, nxdl_root): if ( nxdl_key[0 : nxdl_key.rfind("/")] == optional_parent_path and is_node_required(nxdl_key, nxdl_root) - and data[path_in_data_dict(nxdl_key, data)[1]] is None + and data[ + path_in_data_dict( + nxdl_key, convert_data_dict_path_to_hdf5_path(key), data + )[1] + ] + is None ): return False @@ -500,7 +508,9 @@ def ensure_all_required_fields_exist(template, data, nxdl_root, logger=pynx_logg if entry_name == "@units": continue nxdl_path = convert_data_converter_dict_to_nxdl_path(path) - is_path_in_data_dict, renamed_path = path_in_data_dict(nxdl_path, data) + is_path_in_data_dict, renamed_path = path_in_data_dict( + nxdl_path, convert_data_dict_path_to_hdf5_path(path), data + ) renamed_path = path if renamed_path is None else renamed_path if path in template["lone_groups"]: