cdapython 2.0.8__py3-none-any.whl → 2.0.9__py3-none-any.whl

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.
cdapython/discover.py CHANGED
@@ -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
  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
@@ -2,12 +2,12 @@ cdapython/__init__.py,sha256=5XapTJOqQ9IfFcO4UrM09teNP_xYkTR_bQTRww6e3Wk,575
2
2
  cdapython/application_utilities.py,sha256=oD8LA9N2cM8gnTx353IdEgjtcHiI1LSlKQgUtKXtANM,1615
3
3
  cdapython/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cdapython/config/logger_default_config.yml,sha256=j4kaJk0w4-xiOyCl5Ml0DhWnK6dAWy33UecLsl1vI_w,434
5
- cdapython/discover.py,sha256=89nDzR6S2LNJeYYl6COxXkv1jZI8jmTeK_LggqpsPSo,60340
5
+ cdapython/discover.py,sha256=9E4uYZRY1RJHiKFw1F5EXBU_f6YAOjz-rg0_dEhKWqU,60954
6
6
  cdapython/get_data.py,sha256=y8sCtnxLglRYgJSmCd-kppNZB6hhYhx8CBhCFaWWbKU,59368
7
7
  cdapython/logging_wrappers.py,sha256=SsgKrLh9y6RR-iAiMAm0Is9fGjLKQZ8BckA1MBCCLig,6885
8
8
  cdapython/summarize.py,sha256=Oed_HwL2ytNRYtNhs2rYtaDIN8JkEMObRMdij-pxMz0,90546
9
9
  cdapython/validation.py,sha256=za33Ca0rS7-CsnuB9pCiTqzAU4BEkkfxIo4bPqZkUwM,34050
10
- cdapython-2.0.8.dist-info/METADATA,sha256=DrXpjePQilBW92i1EWdA4mCjGRoVDCFRjSjtyH4wKiA,764
11
- cdapython-2.0.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
12
- cdapython-2.0.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
13
- cdapython-2.0.8.dist-info/RECORD,,
10
+ cdapython-2.0.9.dist-info/METADATA,sha256=Au1S4DHkb_MiNvuDGPPJuTRVjj-UQ6UkwQz8ye0I1tM,764
11
+ cdapython-2.0.9.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
12
+ cdapython-2.0.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
13
+ cdapython-2.0.9.dist-info/RECORD,,