cdapython 2.0.14__tar.gz → 2.2.0__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.
@@ -0,0 +1,27 @@
1
+ 2026-08-25: 2.2.0: add support for harmonized controlled-vocabulary metadata retrieval (slims, synonyms, containing terms); see help text for the `add_extras` flag in the `get\_data()` and `summarize()` functions
2
+
3
+ 2026-04-07: 2.1.0: add `search_terms` support; obsolesce `disease_slims` POC in deference to upcoming full version
4
+
5
+ 2025-12-09: 2.0.14: add sort postproc to POC `disease_slims` return column
6
+
7
+ 2025-12-09: 2.0.13: add POC `include_disease_slims` Boolean flag to `get_data()`
8
+
9
+ 2025-10-31: 2.0.12: standardize debug-layer SQL echo; adjust `column_values()` to handle known pathologies
10
+
11
+ 2025-10-27: 2.0.11: _cough_ bugfix for previous
12
+
13
+ 2025-10-27: 2.0.10: integrate `column_values()` parameter validation with shared validation library; expand support for `column_values( data_source )` to accept list values in addition to single strings
14
+
15
+ 2025-10-22: 2.0.9: parametrize `data_source` check in `column_values()`
16
+
17
+ 2025-10-20: 2.0.8: rename CDS to GC throughout
18
+
19
+ 2025-10-08: 2.0.7: fix malformed column metadata selector inside `collate=True` provenance management in `get_data()`
20
+
21
+ 2025-09-17: 2.0.6: update ternary numeric comparison handling for latest API ternary operator syntax support
22
+
23
+ 2025-08-18: 2.0.2: update PyYAML build dependency
24
+
25
+ 2025-08-18: 2.0.1: update default API URL
26
+
27
+ 2025-08-18: 2.0.0: initial public release to PyPI
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdapython
3
- Version: 2.0.14
3
+ Version: 2.2.0
4
4
  Summary: NCI CRDC CDA front-end user interface library
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.9,<4.0
@@ -11,10 +11,10 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Python :: 3.14
14
- Requires-Dist: cda-client (>=2.0.0)
15
- Requires-Dist: pandas (>=2.2.3)
14
+ Requires-Dist: cda-client (>=2.1.0)
15
+ Requires-Dist: pandas (>=2.2.3,<3.0.0)
16
16
  Requires-Dist: pyyaml (>=6.0.0)
17
- Requires-Dist: tabulate (>=0.9.0)
17
+ Requires-Dist: tabulate (>=0.10.0)
18
18
  Description-Content-Type: text/markdown
19
19
 
20
20
  # cdapython
@@ -1,5 +1,4 @@
1
- from cdapython.application_utilities import get_api_url, set_api_url
2
- from cdapython.discover import cda_functions, column_values, columns, release_metadata, tables
1
+ from cdapython.discover import cda_extra_metadata_columns, cda_functions, column_values, columns, get_api_url, release_metadata, set_api_url, tables
3
2
  from cdapython.summarize import expand_file_results, expand_subject_results, intersect_file_results, intersect_subject_results, summarize_files, summarize_subjects
4
3
  from cdapython.get_data import get_file_data, get_subject_data
5
4
 
@@ -8,7 +8,6 @@ import cda_client.api.columns.columns_endpoint_columns_get
8
8
  import cda_client.api.release_metadata.release_metadata_endpoint_release_metadata_get
9
9
  import cda_client.api.column_values.column_values_endpoint_column_values_column_post
10
10
 
11
- from cdapython.application_utilities import get_api_url
12
11
  from cda_client.errors import UnexpectedStatus
13
12
  from cdapython.logging_wrappers import get_logger
14
13
 
@@ -22,6 +21,47 @@ from cdapython.logging_wrappers import get_logger
22
21
  #############################################################################################################################
23
22
 
24
23
 
24
+ #############################################################################################################################
25
+ #
26
+ # get_api_url(): Return the current system URL for the CDA REST API.
27
+ #
28
+ #############################################################################################################################
29
+
30
+ def get_api_url():
31
+ """
32
+ Return the currently-set URL pointing to the CDA REST API.
33
+ """
34
+
35
+ # System default.
36
+ default_api_url = 'https://cda.datacommons.cancer.gov'
37
+
38
+ # Has the user set a non-default URL?
39
+ local_api_url = os.environ.get( '__CDA_API_URL' )
40
+
41
+ if local_api_url is not None and len( local_api_url ) > 0:
42
+ return local_api_url
43
+ else:
44
+ return default_api_url
45
+
46
+ #############################################################################################################################
47
+ #
48
+ # set_api_url(): Set the current system URL for the CDA REST API.
49
+ #
50
+ #############################################################################################################################
51
+
52
+ def set_api_url( new_api_url ):
53
+ """
54
+ Set the current system URL for the CDA REST API.
55
+ """
56
+
57
+ # Do some basic sanity checking.
58
+ if re.search( r'^https*:\/\/', new_api_url ) is None:
59
+ raise RuntimeError( 'set_api_url(): Only HTTP and HTTPS URLs are allowed.' )
60
+ elif len( new_api_url ) > 100:
61
+ raise RuntimeError( 'set_api_url(): Whatever that was, it wasn\'t the URL of the CDA REST API.' )
62
+
63
+ os.environ['__CDA_API_URL'] = new_api_url
64
+
25
65
  #############################################################################################################################
26
66
  #
27
67
  # cda_functions(): Return a list of user-facing cdapython functions useful for both scripting and interactive data sessions.
@@ -62,6 +102,7 @@ def cda_functions():
62
102
  'disable_file_logging',
63
103
  'get_api_url',
64
104
  'set_api_url',
105
+ 'cda_extra_metadata_columns',
65
106
  'cda_functions'
66
107
  ]
67
108
 
@@ -71,6 +112,24 @@ def cda_functions():
71
112
  #
72
113
  #############################################################################################################################
73
114
 
115
+ #############################################################################################################################
116
+ #
117
+ # cda_extra_metadata_columns(): Return a list of available metadata annotations that provide context for some harmonized CDA
118
+ # fields.
119
+ #
120
+ #############################################################################################################################
121
+
122
+ def cda_extra_metadata_columns():
123
+ # extra_metadata_columns is enumerated by cda_extra_metadata_columns() in desired column-display order for return_data_as='':
124
+ extra_metadata_columns = [ 'synonym_terms', 'slim_terms', 'containing_terms' ]
125
+ return extra_metadata_columns
126
+
127
+ #############################################################################################################################
128
+ #
129
+ # END cda_extra_metadata_columns()
130
+ #
131
+ #############################################################################################################################
132
+
74
133
  #############################################################################################################################
75
134
  #
76
135
  # tables(): Return a list of all searchable CDA data tables.
@@ -866,6 +925,7 @@ def column_values(
866
925
  cached_column_metadata=cached_column_metadata,
867
926
  valid_data_sources=valid_data_sources,
868
927
  table=None,
928
+ search_list=list(),
869
929
  column=column,
870
930
  match_from_file=None,
871
931
  data_source=data_source,
@@ -875,6 +935,7 @@ def column_values(
875
935
  include_external_refs=None,
876
936
  return_data_as=return_data_as,
877
937
  output_file=output_file,
938
+ add_extras=None,
878
939
  sort_by=sort_by,
879
940
  log=log
880
941
  )
@@ -888,7 +949,7 @@ def column_values(
888
949
  # Set default sort_by value.
889
950
  if sort_by == '':
890
951
  if return_data_as in [ '', 'dataframe', 'tsv' ]:
891
- sort_by = 'count'
952
+ sort_by = 'count:desc'
892
953
  elif return_data_as in [ 'list' ]:
893
954
  sort_by = 'value'
894
955
  else: