File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,21 +56,31 @@ def _process_transform_registry(registry_path: str) -> list[dict]:
5656 registry = yaml .safe_load (f )
5757
5858 info = _registry_info (registry )
59- transforms_dir = os .path .join (os .path .dirname (registry_path ), "transforms" )
59+ base_dir = os .path .dirname (registry_path )
60+ search_dirs = ["transforms" , "mappings" ]
6061 specs = []
6162
6263 for ref in registry .get ("mapping_set_references" , []):
6364 local_name = ref .get ("local_name" )
6465 if not local_name :
6566 continue
6667
67- input_file = os .path .join (transforms_dir , local_name )
68- if not os .path .exists (input_file ):
69- click .echo (f"Transform file not found: { input_file } " , err = True )
68+ # Find the file in one of the search directories
69+ input_file = None
70+ for d in search_dirs :
71+ candidate = os .path .join (base_dir , d , local_name )
72+ if os .path .exists (candidate ):
73+ input_file = candidate
74+ break
75+ if not input_file :
76+ click .echo (f"File not found: { local_name } (searched { search_dirs } )" , err = True )
7077 continue
7178
79+ # Detect mapping type from file extension
80+ mapping_type = "sssom" if local_name .endswith (".sssom.tsv" ) else "linkml_map"
81+
7282 try :
73- spec = load_mapping (input_file , "linkml_map" )
83+ spec = load_mapping (input_file , mapping_type )
7484 spec ["registries" ] = [info ]
7585 specs .append (spec )
7686 except Exception as e :
You can’t perform that action at this time.
0 commit comments