cdapython 2.0.6__tar.gz → 2.0.8__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,7 @@
1
+ 2025-10-20: 2.0.8: rename CDS to GC throughout
2
+
3
+ 2025-10-08: 2.0.7: fix malformed column metadata selector inside `collate=True` provenance management in get\_data()
4
+
1
5
  2025-09-17: 2.0.6: update ternary numeric comparison handling for latest API ternary operator syntax support
2
6
 
3
7
  2025-08-18: 2.0.2: update PyYAML build dependency
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdapython
3
- Version: 2.0.6
3
+ Version: 2.0.8
4
4
  Summary: NCI CRDC CDA front-end user interface library
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.9,<4.0
@@ -788,7 +788,7 @@ def column_values(
788
788
 
789
789
  data_source ( string; optional ):
790
790
  Restrict returned values to the given upstream data source. Current
791
- valid values are 'GDC', 'PDC', 'IDC', 'CDS' and 'ICDC'.
791
+ valid values are 'GC', 'GDC', 'PDC', 'IDC' and 'ICDC'.
792
792
  Defaults to '' (no filter).
793
793
 
794
794
  force( boolean; optional ):
@@ -839,15 +839,15 @@ def column_values(
839
839
  # This should be replaced ASAP with a fetch from the /release_metadata endpoint.
840
840
 
841
841
  allowed_data_source_values = {
842
+ 'GC',
842
843
  'GDC',
843
844
  'PDC',
844
845
  'IDC',
845
- 'CDS',
846
846
  'ICDC'
847
847
  }
848
848
 
849
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 [ 'GDC', 'PDC', 'IDC', 'CDS', 'ICDC' ]. You supplied '{data_source}', which is not." )
850
+ log.error( f"The 'data_source' parameter must be one of [ 'GC', 'GDC', 'PDC', 'IDC', 'ICDC' ]. You supplied '{data_source}', which is not." )
851
851
  return
852
852
 
853
853
  #############################################################################################################################
@@ -68,8 +68,8 @@ def get_file_data(
68
68
 
69
69
  data_source ( string or list of strings; optional ):
70
70
  Restrict results to those deriving from the given upstream
71
- data source(s). Current valid values are 'GDC', 'IDC', 'PDC',
72
- 'CDS' and 'ICDC'. (Default: no filter.)
71
+ data source(s). Current valid values are 'GC', 'GDC', 'IDC',
72
+ 'PDC' and 'ICDC'. (Default: no filter.)
73
73
 
74
74
  add_columns ( string or list of strings; optional ):
75
75
  One or more columns from a second table to add to result data.
@@ -185,8 +185,8 @@ def get_subject_data(
185
185
 
186
186
  data_source ( string or list of strings; optional ):
187
187
  Restrict results to those deriving from the given upstream
188
- data source(s). Current valid values are 'GDC', 'IDC', 'PDC',
189
- 'CDS' and 'ICDC'. (Default: no filter.)
188
+ data source(s). Current valid values are 'GC', 'GDC', 'IDC',
189
+ 'PDC' and 'ICDC'. (Default: no filter.)
190
190
 
191
191
  add_columns ( string or list of strings; optional ):
192
192
  One or more columns from a second table to add to result data.
@@ -311,8 +311,8 @@ def get_data(
311
311
 
312
312
  data_source ( string or list of strings; optional ):
313
313
  Restrict results to those deriving from the given upstream
314
- data source(s). Current valid values are 'GDC', 'IDC', 'PDC',
315
- 'CDS' and 'ICDC'. (Default: no filter.)
314
+ data source(s). Current valid values are 'GC', 'GDC', 'IDC',
315
+ 'PDC' and 'ICDC'. (Default: no filter.)
316
316
 
317
317
  add_columns ( string or list of strings; optional ):
318
318
  One or more columns from a second table to add to result data from `table`.
@@ -609,7 +609,7 @@ def get_data(
609
609
  # Ignore requests for columns that are already present by default, and don't add columns twice.
610
610
  if column_to_add not in source_table_columns_in_order and column_to_add not in columns_to_add:
611
611
  # If collate == True, we'll need to ask for provenance information from this column's
612
- # home table, if we haven't yet done so.
612
+ # home table, if we haven't yet done so. This info is returned by default only for `file` and `subject`.
613
613
  if collate_results:
614
614
  # Identify this column's home table.
615
615
  foreign_table_name = ''
@@ -629,7 +629,8 @@ def get_data(
629
629
 
630
630
  if collate_results:
631
631
  # Be sure to include requests for provenance information about foreign tables
632
- # included only implicitly (by filters, not by add_columns).
632
+ # included only implicitly (by filters, not by add_columns). Such info is
633
+ # only included by default from `file` and `subject`.
633
634
 
634
635
  for filter_query in set( queries_for_match_all ) | set( queries_for_match_any ):
635
636
  # TO DO: Compartmentalize/parametrize this conditional check better: it repeats much that is already made explicit in validation.py.
@@ -648,13 +649,17 @@ def get_data(
648
649
  column_to_add = column_name
649
650
  if not filter_is_ternary:
650
651
  column_to_add = re.search( r'^(\S+)\s', filter_query ).group(1)
651
- foreign_table_name = cached_column_metadata.query( f"column == '{column_to_add}'" )['table'].iloc[0]
652
- # Check to see if we're already asking for provenance info from that table: if not, do, unless {table} is 'upstream_identifiers'.
653
- if foreign_table_name != 'upstream_identifiers':
654
- for data_source in [ source_label.lower() for source_label in sorted( valid_data_sources ) ]:
655
- provenance_field = f"{foreign_table_name}_data_at_{data_source}"
656
- if provenance_field not in columns_to_add:
657
- columns_to_add.append( provenance_field )
652
+ # The user-exposed `data_source` parameter can add filters on e.g. `subject_data_at_pdc` -- don't bother with these.
653
+ # They won't be in the reference structure we're about to search, and they don't on their own indicate
654
+ # a need for any extra provenance info.
655
+ if re.search( r'_data_at_', column_to_add ) is None:
656
+ foreign_table_name = cached_column_metadata.query( f"column == '{column_to_add}'" )['table'].iloc[0]
657
+ # Check to see if we're already asking for provenance info from that table: if not, do, unless {table} is 'upstream_identifiers'.
658
+ if foreign_table_name != 'upstream_identifiers':
659
+ for data_source in [ source_label.lower() for source_label in sorted( valid_data_sources ) ]:
660
+ provenance_field = f"{foreign_table_name}_data_at_{data_source}"
661
+ if provenance_field not in columns_to_add:
662
+ columns_to_add.append( provenance_field )
658
663
 
659
664
  columns_to_exclude = list()
660
665
 
@@ -754,7 +759,7 @@ def get_data(
754
759
  # "ethnicity": null,
755
760
  # "subject_data_at_gdc": true,
756
761
  # "subject_data_at_idc": true,
757
- # "subject_data_at_cds": false,
762
+ # "subject_data_at_gc": false,
758
763
  # "subject_data_at_pdc": true,
759
764
  # "subject_data_at_icdc": false,
760
765
  # "subject_data_source_count": 3,
@@ -544,8 +544,8 @@ def summarize_files(
544
544
 
545
545
  data_source ( string or list of strings; optional ):
546
546
  Restrict results to those deriving from the given upstream
547
- data source(s). Current valid values are 'GDC', 'IDC', 'PDC',
548
- 'CDS' and 'ICDC'. (Default: no filter.)
547
+ data source(s). Current valid values are 'GC', 'GDC', 'IDC',
548
+ 'PDC' and 'ICDC'. (Default: no filter.)
549
549
 
550
550
  add_columns ( string or list of strings; optional ):
551
551
  One or more columns from a second table to add to summary output.
@@ -686,8 +686,8 @@ def summarize_subjects(
686
686
 
687
687
  data_source ( string or list of strings; optional ):
688
688
  Restrict results to those deriving from the given upstream
689
- data source(s). Current valid values are 'GDC', 'IDC', 'PDC',
690
- 'CDS' and 'ICDC'. (Default: no filter.)
689
+ data source(s). Current valid values are 'GC', 'GDC', 'IDC',
690
+ 'PDC' and 'ICDC'. (Default: no filter.)
691
691
 
692
692
  add_columns ( string or list of strings; optional ):
693
693
  One or more columns from a second table to add to summary output.
@@ -832,8 +832,8 @@ def summarize(
832
832
 
833
833
  data_source ( string or list of strings; optional ):
834
834
  Restrict results to those deriving from the given upstream
835
- data source(s). Current valid values are 'GDC', 'IDC', 'PDC',
836
- 'CDS' and 'ICDC'. (Default: no filter.)
835
+ data source(s). Current valid values are 'GC', 'GDC', 'IDC',
836
+ 'PDC' and 'ICDC'. (Default: no filter.)
837
837
 
838
838
  add_columns ( string or list of strings; optional ):
839
839
  One or more columns from a second table to add to summary output for `table`.
@@ -1338,37 +1338,37 @@ def summarize(
1338
1338
  # }
1339
1339
  # ],
1340
1340
  # "data_source": {
1341
- # "cds_exclusive": 235,
1341
+ # "gc_exclusive": 235,
1342
1342
  # "gdc_exclusive": 351,
1343
1343
  # "icdc_exclusive": 0,
1344
1344
  # "idc_exclusive": 0,
1345
1345
  # "pdc_exclusive": 6,
1346
- # "cds_gdc_exclusive": 0,
1347
- # "cds_icdc_exclusive": 0,
1348
- # "cds_idc_exclusive": 898,
1349
- # "cds_pdc_exclusive": 0,
1346
+ # "gc_gdc_exclusive": 0,
1347
+ # "gc_icdc_exclusive": 0,
1348
+ # "gc_idc_exclusive": 898,
1349
+ # "gc_pdc_exclusive": 0,
1350
1350
  # "gdc_icdc_exclusive": 0,
1351
1351
  # "gdc_idc_exclusive": 4544,
1352
1352
  # "gdc_pdc_exclusive": 7,
1353
1353
  # "icdc_idc_exclusive": 0,
1354
1354
  # "icdc_pdc_exclusive": 0,
1355
1355
  # "idc_pdc_exclusive": 0,
1356
- # "cds_gdc_icdc_exclusive": 0,
1357
- # "cds_gdc_idc_exclusive": 574,
1358
- # "cds_gdc_pdc_exclusive": 1,
1359
- # "cds_icdc_idc_exclusive": 0,
1360
- # "cds_icdc_pdc_exclusive": 0,
1361
- # "cds_idc_pdc_exclusive": 0,
1356
+ # "gc_gdc_icdc_exclusive": 0,
1357
+ # "gc_gdc_idc_exclusive": 574,
1358
+ # "gc_gdc_pdc_exclusive": 1,
1359
+ # "gc_icdc_idc_exclusive": 0,
1360
+ # "gc_icdc_pdc_exclusive": 0,
1361
+ # "gc_idc_pdc_exclusive": 0,
1362
1362
  # "gdc_icdc_idc_exclusive": 0,
1363
1363
  # "gdc_icdc_pdc_exclusive": 0,
1364
1364
  # "gdc_idc_pdc_exclusive": 205,
1365
1365
  # "icdc_idc_pdc_exclusive": 0,
1366
- # "cds_gdc_icdc_idc_exclusive": 0,
1367
- # "cds_gdc_icdc_pdc_exclusive": 0,
1368
- # "cds_gdc_idc_pdc_exclusive": 83,
1369
- # "cds_icdc_idc_pdc_exclusive": 0,
1366
+ # "gc_gdc_icdc_idc_exclusive": 0,
1367
+ # "gc_gdc_icdc_pdc_exclusive": 0,
1368
+ # "gc_gdc_idc_pdc_exclusive": 83,
1369
+ # "gc_icdc_idc_pdc_exclusive": 0,
1370
1370
  # "gdc_icdc_idc_pdc_exclusive": 0,
1371
- # "cds_gdc_icdc_idc_pdc": 0
1371
+ # "gc_gdc_icdc_idc_pdc": 0
1372
1372
  # },
1373
1373
  # "sex": [
1374
1374
  # {
@@ -1386,7 +1386,7 @@ def summarize(
1386
1386
  # ]
1387
1387
  # }
1388
1388
  # ],
1389
- # "query_sql": "WITH subject_preselect AS (SELECT subject.id AS subject_id, subject.id_alias AS subject_id_alias, [...these are very long!...] AS cds_gdc_icdc_idc_pdc) AS subquery) AS data_source, (SELECT observation_columns.sex FROM observation_columns) AS sex) AS json_result"
1389
+ # "query_sql": "WITH subject_preselect AS (SELECT subject.id AS subject_id, subject.id_alias AS subject_id_alias, [...these are very long!...] AS gc_gdc_icdc_idc_pdc) AS subquery) AS data_source, (SELECT observation_columns.sex FROM observation_columns) AS sex) AS json_result"
1390
1390
  # }
1391
1391
 
1392
1392
  # Report some metadata about the results we got back.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cdapython"
3
- version = "2.0.6"
3
+ version = "2.0.8"
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