@@ -98,7 +98,7 @@ def get_execution_status(results):
9898
9999
100100def get_standard_codelist_cache_key (standard : str , version : str ) -> str :
101- standard , version = normalize_adam_input (standard , version )
101+ standard , version = normalize_standard_input (standard , version )
102102 return f"{ standard .lower ()} -{ version .replace ('.' , '-' )} -codelists"
103103
104104
@@ -115,7 +115,7 @@ def get_library_variables_metadata_cache_key(
115115 standard_type : str , standard_version : str , standard_substandard : str
116116) -> str :
117117 if not standard_substandard :
118- standard_type , standard_version = normalize_adam_input (
118+ standard_type , standard_version = normalize_standard_input (
119119 standard_type , standard_version
120120 )
121121 return f"library_variables_metadata/{ standard_type } /{ standard_version } "
@@ -126,7 +126,7 @@ def get_library_variables_metadata_cache_key(
126126def get_standard_details_cache_key (
127127 standard_type : str , standard_version : str , standard_substandard : str = None
128128) -> str :
129- standard_type , standard_version = normalize_adam_input (
129+ standard_type , standard_version = normalize_standard_input (
130130 standard_type , standard_version
131131 )
132132 if not standard_substandard :
@@ -135,24 +135,32 @@ def get_standard_details_cache_key(
135135 return f"standards/{ standard_type } /{ standard_version } /{ standard_substandard .lower ()} "
136136
137137
138- def normalize_adam_input (standard : str , version : str ) -> tuple :
138+ def normalize_standard_input (standard : str , version : str ) -> tuple :
139139 """
140- Normalizes ADAM user input to the expected internal format.
141- Args:
142- standard: User input like 'adamig', 'adam-adae'
143- version: User input like '1-0'
144- Returns:
145- Tuple of (normalized_standard, normalized_version)
146- Examples:
147- - ('adamig', '1-0') -> ('adam', 'adamig-1-0')
148- - ('adam-adae', '1-0') -> ('adam', 'adam-adae-1-0')
149- - ('sdtm', '3-4') -> ('sdtm', '3-4')
140+ Normalizes user CLI input for standards that have sub-variant prefixes,
141+ translating them into the internal library path format used in the cache.
142+
143+ The CDISC Library API stores sub-variants with the variant name folded
144+ into the version field.
145+
146+ Examples:
147+ ('adamig', '1-3') -> ('adam', 'adamig-1-3')
148+ ('adam-adae', '1-0') -> ('adam', 'adam-adae-1-0')
149+ ('sendig-dart', '1-1') -> ('sendig', 'dart-1-1')
150+ ('sendig-ar', '1-0') -> ('sendig', 'ar-1-0')
151+ ('sendig-genetox', '1-0') -> ('sendig', 'genetox-1-0')
152+ ('sdtmig-ap', '1-0') -> ('sdtmig', 'ap-1-0')
153+ ('sdtmig-md', '1-0') -> ('sdtmig', 'md-1-0')
150154 """
151- if standard :
152- standard_lower = standard .lower ()
153- if standard_lower in ADAM_PRODUCTS :
154- return "adam" , f"{ standard_lower } -{ version } "
155- # Non-ADAM standard - keep as is
155+ if not standard :
156+ return standard , version
157+ standard_lower = standard .lower ()
158+ if standard_lower in ADAM_PRODUCTS :
159+ return "adam" , f"{ standard_lower } -{ version } "
160+ for base in ("sendig" , "sdtmig" ):
161+ if standard_lower .startswith (f"{ base } -" ):
162+ sub = standard_lower [len (base ) + 1 :]
163+ return base , f"{ sub } -{ version } "
156164 return standard , version
157165
158166
@@ -242,7 +250,7 @@ def get_variable_codelist_map_cache_key(standard: str, version: str, subversion)
242250 if subversion :
243251 return f"{ standard } -{ version } -{ subversion } -codelists"
244252 else :
245- standard , version = normalize_adam_input (standard , version )
253+ standard , version = normalize_standard_input (standard , version )
246254 return f"{ standard } -{ version } -codelists"
247255
248256
0 commit comments