cdapython 2.0.8__tar.gz → 2.0.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ 2025-10-22: 2.0.9: parametrize data\_source check in column\_values()
2
+
1
3
  2025-10-20: 2.0.8: rename CDS to GC throughout
2
4
 
3
5
  2025-10-08: 2.0.7: fix malformed column metadata selector inside `collate=True` provenance management in get\_data()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdapython
3
- Version: 2.0.8
3
+ Version: 2.0.9
4
4
  Summary: NCI CRDC CDA front-end user interface library
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.9,<4.0
@@ -834,20 +834,36 @@ def column_values(
834
834
  # Let's not care about case, and remove any whitespace before it can do any damage.
835
835
  data_source = re.sub( r'\s+', r'', data_source ).upper()
836
836
 
837
- # TEMPORARY: enumerate valid `data_source` values and warn the user if they supplied something else.
838
- #
839
- # This should be replaced ASAP with a fetch from the /release_metadata endpoint.
840
-
841
- allowed_data_source_values = {
842
- 'GC',
843
- 'GDC',
844
- 'PDC',
845
- 'IDC',
846
- 'ICDC'
847
- }
837
+ # Cache valid labels for upstream data sources. The data structure coming back from
838
+ # release_metadata() is a list of dicts, with each dict looking like
839
+ #
840
+ # {
841
+ # 'cda_table': 'file',
842
+ # 'cda_column': 'access',
843
+ # 'data_source': 'GDC',
844
+ # 'data_source_version': 'March 2025',
845
+ # 'data_source_extraction_date': '2025-03-21',
846
+ # 'data_source_row_count': 3025352,
847
+ # 'data_source_unique_value_count': 4,
848
+ # 'data_source_null_count': 407714
849
+ # }
850
+
851
+ try:
852
+ cached_release_metadata = release_metadata()
853
+ except Exception as e:
854
+ log.critical( e )
855
+ return
856
+
857
+ valid_data_sources = set()
858
+
859
+ for column_record in cached_release_metadata:
860
+ record_data_source = column_record['data_source']
861
+ # Let's not care about case.
862
+ if record_data_source.upper() != 'CDA':
863
+ valid_data_sources.add( record_data_source.upper() )
848
864
 
849
- if data_source != '' and data_source not in allowed_data_source_values:
850
- log.error( f"The 'data_source' parameter must be one of [ 'GC', 'GDC', 'PDC', 'IDC', 'ICDC' ]. You supplied '{data_source}', which is not." )
865
+ if data_source != '' and data_source not in valid_data_sources:
866
+ log.error( f"The 'data_source' parameter must be one of { sorted( valid_data_sources ) }. You supplied '{data_source}', which is not." )
851
867
  return
852
868
 
853
869
  #############################################################################################################################
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cdapython"
3
- version = "2.0.8"
3
+ version = "2.0.9"
4
4
  description = "NCI CRDC CDA front-end user interface library"
5
5
  authors = []
6
6
  readme = "README.md"
File without changes
File without changes