nci-cidc-api-modules 1.1.40__tar.gz → 1.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.
Files changed (36) hide show
  1. {nci_cidc_api_modules-1.1.40/nci_cidc_api_modules.egg-info → nci_cidc_api_modules-1.2.0}/PKG-INFO +26 -26
  2. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/README.md +1 -1
  3. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/models.py +35 -2
  4. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/gcloud_client.py +8 -3
  5. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0/nci_cidc_api_modules.egg-info}/PKG-INFO +26 -26
  6. nci_cidc_api_modules-1.2.0/nci_cidc_api_modules.egg-info/requires.txt +23 -0
  7. nci_cidc_api_modules-1.2.0/requirements.modules.txt +23 -0
  8. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/setup.py +1 -1
  9. nci_cidc_api_modules-1.1.40/nci_cidc_api_modules.egg-info/requires.txt +0 -23
  10. nci_cidc_api_modules-1.1.40/requirements.modules.txt +0 -23
  11. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/LICENSE +0 -0
  12. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/MANIFEST.in +0 -0
  13. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/config/__init__.py +0 -0
  14. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/config/db.py +0 -0
  15. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/config/logging.py +0 -0
  16. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/config/secrets.py +0 -0
  17. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/config/settings.py +0 -0
  18. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/__init__.py +0 -0
  19. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/files/__init__.py +0 -0
  20. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/files/details.py +0 -0
  21. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/files/facets.py +0 -0
  22. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/migrations.py +0 -0
  23. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/models/schemas.py +0 -0
  24. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/__init__.py +0 -0
  25. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/auth.py +0 -0
  26. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/emails.py +0 -0
  27. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/file_handling.py +0 -0
  28. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/jose.py +0 -0
  29. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/cidc_api/shared/rest_utils.py +0 -0
  30. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/nci_cidc_api_modules.egg-info/SOURCES.txt +0 -0
  31. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/nci_cidc_api_modules.egg-info/dependency_links.txt +0 -0
  32. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/nci_cidc_api_modules.egg-info/not-zip-safe +0 -0
  33. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/nci_cidc_api_modules.egg-info/top_level.txt +0 -0
  34. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/pyproject.toml +0 -0
  35. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/setup.cfg +0 -0
  36. {nci_cidc_api_modules-1.1.40 → nci_cidc_api_modules-1.2.0}/tests/test_api.py +0 -0
@@ -1,35 +1,35 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.1.40
3
+ Version: 1.2.0
4
4
  Summary: SQLAlchemy data models and configuration tools used in the NCI CIDC API
5
5
  Home-page: https://github.com/NCI-CIDC/cidc-api-gae
6
6
  License: MIT license
7
- Requires-Python: >=3.9
7
+ Requires-Python: >=3.13
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
- Requires-Dist: werkzeug==3.0.6
11
- Requires-Dist: flask==3.0.3
12
- Requires-Dist: flask-migrate==3.1.0
13
- Requires-Dist: flask-sqlalchemy==3.1.1
14
- Requires-Dist: sqlalchemy==2.0.41
15
- Requires-Dist: marshmallow==3.19.0
16
- Requires-Dist: marshmallow-sqlalchemy==1.4.2
17
- Requires-Dist: google-cloud-storage==2.18.0
18
- Requires-Dist: google-cloud-secret-manager==2.20.1
19
- Requires-Dist: google-cloud-pubsub==2.22.0
20
- Requires-Dist: google-cloud-bigquery==3.18.0
21
- Requires-Dist: google-api-python-client==2.64.0
22
- Requires-Dist: google-auth==2.32.0
23
- Requires-Dist: packaging>=20.0.0
24
- Requires-Dist: pyarrow==14.0.1
25
- Requires-Dist: numpy<2,>=1.16.5
26
- Requires-Dist: pandas==1.5.3
27
- Requires-Dist: python-dotenv==0.10.3
28
- Requires-Dist: requests==2.32.4
29
- Requires-Dist: jinja2==3.1.6
30
- Requires-Dist: certifi==2024.7.4
31
- Requires-Dist: cloud-sql-python-connector[pg8000]==1.18.3
32
- Requires-Dist: nci-cidc-schemas==0.27.28
10
+ Requires-Dist: werkzeug~=3.1.3
11
+ Requires-Dist: flask~=3.1.2
12
+ Requires-Dist: flask-migrate~=4.1.0
13
+ Requires-Dist: flask-sqlalchemy~=3.1.1
14
+ Requires-Dist: sqlalchemy~=2.0.43
15
+ Requires-Dist: marshmallow~=4.0.0
16
+ Requires-Dist: marshmallow-sqlalchemy~=1.4.2
17
+ Requires-Dist: google-cloud-storage~=3.3.0
18
+ Requires-Dist: google-cloud-secret-manager~=2.24.0
19
+ Requires-Dist: google-cloud-pubsub~=2.31.1
20
+ Requires-Dist: google-cloud-bigquery~=3.36.0
21
+ Requires-Dist: google-api-python-client~=2.179.0
22
+ Requires-Dist: google-auth~=2.40.3
23
+ Requires-Dist: packaging~=25.0
24
+ Requires-Dist: pyarrow~=21.0.0
25
+ Requires-Dist: numpy~=2.3.2
26
+ Requires-Dist: pandas~=2.3.1
27
+ Requires-Dist: python-dotenv~=1.1.1
28
+ Requires-Dist: requests~=2.32.5
29
+ Requires-Dist: jinja2~=3.1.6
30
+ Requires-Dist: certifi~=2025.8.3
31
+ Requires-Dist: cloud-sql-python-connector[pg8000]~=1.18.4
32
+ Requires-Dist: nci-cidc-schemas==0.28.2
33
33
  Dynamic: description
34
34
  Dynamic: description-content-type
35
35
  Dynamic: home-page
@@ -62,7 +62,7 @@ The next generation of the CIDC API, reworked to use Google Cloud-managed servic
62
62
 
63
63
  ## Install Python dependencies
64
64
 
65
- Python versions tested include 3.9 and 3.10. The current App Engine is using version 3.9 (see [app.prod.yaml](./app.prod.yaml)). You can use https://github.com/pyenv/pyenv to manage your python versions. Homebrew will also work, but you will have to be specific when you install packages with pip outside of virtual environments. On that note, it is recommended that you install your python dependencies in an isolated environment. For example,
65
+ Use Python version 3.13
66
66
 
67
67
  ```bash
68
68
  # make a virtual environment in the current direcory called "venv"
@@ -21,7 +21,7 @@ The next generation of the CIDC API, reworked to use Google Cloud-managed servic
21
21
 
22
22
  ## Install Python dependencies
23
23
 
24
- Python versions tested include 3.9 and 3.10. The current App Engine is using version 3.9 (see [app.prod.yaml](./app.prod.yaml)). You can use https://github.com/pyenv/pyenv to manage your python versions. Homebrew will also work, but you will have to be specific when you install packages with pip outside of virtual environments. On that note, it is recommended that you install your python dependencies in an isolated environment. For example,
24
+ Use Python version 3.13
25
25
 
26
26
  ```bash
27
27
  # make a virtual environment in the current direcory called "venv"
@@ -23,6 +23,7 @@ __all__ = [
23
23
  "ValidationMultiError",
24
24
  "with_default_session",
25
25
  "PreprocessedFiles",
26
+ "FileValidationErrors",
26
27
  "IngestionJobs",
27
28
  "JobFileCategories",
28
29
  "TRIAL_APPENDIX_A",
@@ -1344,14 +1345,14 @@ class TrialMetadata(CommonColumns):
1344
1345
  if not trial.file_bundle[assay]:
1345
1346
  del trial.file_bundle[assay]
1346
1347
  # Check if trial is ready for submission
1347
- setattr(trial, "ready_for_submission", trial.ready_for_submission())
1348
+ setattr(trial, "ready_for_submission", trial.determine_ready_for_submission())
1348
1349
 
1349
1350
  trials.append(trial)
1350
1351
 
1351
1352
  return trials
1352
1353
 
1353
1354
  @with_default_session
1354
- def ready_for_submission(self, session: Session) -> Boolean:
1355
+ def determine_ready_for_submission(self, session: Session) -> Boolean:
1355
1356
  open_job = IngestionJobs.get_open_job_by_trial(self.trial_id)
1356
1357
  if not open_job:
1357
1358
  return False
@@ -3261,6 +3262,7 @@ class PreprocessedFiles(CommonColumns):
3261
3262
  status = Column(String)
3262
3263
  version = Column(Integer)
3263
3264
  released_version = Column(String)
3265
+ error_status = Column(String)
3264
3266
 
3265
3267
  @staticmethod
3266
3268
  @with_default_session
@@ -3457,6 +3459,9 @@ class IngestionJobs(CommonColumns):
3457
3459
  categories.append(cell)
3458
3460
  elif cell == "PATIENT-LEVEL DATA":
3459
3461
  headers_ended = True
3462
+ if "Data_Dictionary" not in categories:
3463
+ # Ensure Data_Dictionary is always a required file category
3464
+ categories.append("Data_Dictionary")
3460
3465
  return categories
3461
3466
 
3462
3467
  @classmethod
@@ -3538,3 +3543,31 @@ class JobFileCategories(CommonColumns):
3538
3543
  def categories_for_job(cls, job_id: int, type: str, session: Session = None):
3539
3544
  categories = session.query(cls).filter(cls.job_id == job_id, cls.type == type).all()
3540
3545
  return [c.category for c in categories]
3546
+
3547
+
3548
+ class FileValidationErrors(CommonColumns):
3549
+ __tablename__ = "file_validation_errors"
3550
+ __table_args__ = (
3551
+ ForeignKeyConstraint(
3552
+ ["job_id"],
3553
+ ["ingestion_jobs.id"],
3554
+ ondelete="CASCADE",
3555
+ ),
3556
+ ForeignKeyConstraint(
3557
+ ["file_id"],
3558
+ ["preprocessed_files.id"],
3559
+ ondelete="CASCADE",
3560
+ ),
3561
+ )
3562
+
3563
+ error_message = Column(String, nullable=False)
3564
+ location = Column(String, nullable=True)
3565
+ job_id = Column(Integer, nullable=False)
3566
+ file_id = Column(Integer, nullable=False)
3567
+
3568
+ @staticmethod
3569
+ @with_default_session
3570
+ def create(file_id: int, job_id: int, error_message: str, location: str = None, session: Session = None):
3571
+ new_error = FileValidationErrors(file_id=file_id, job_id=job_id, error_message=error_message, location=location)
3572
+ new_error.insert(session=session)
3573
+ return new_error
@@ -421,9 +421,8 @@ def upload_xlsx_to_intake_bucket(user_email: str, trial_id: str, upload_type: st
421
421
 
422
422
 
423
423
  def gcs_xlsx_or_csv_file_to_pandas_dataframe(bucket_name: str, blob_name: str):
424
- """Reads an XLSX file from Google Cloud Storage into a Pandas DataFrame."""
425
- sheet_data = storage.Client().bucket(bucket_name).blob(blob_name).download_as_bytes()
426
- temp_file = io.BytesIO(sheet_data)
424
+ """Reads an XLSX or CSV file from Google Cloud Storage into a Pandas DataFrame."""
425
+ temp_file = get_file_bytes_from_gcs(bucket_name, blob_name)
427
426
 
428
427
  # TODO: specify sheet in xlsx file and/or accept tsv and xls files
429
428
  if blob_name[-3:] == "csv":
@@ -434,6 +433,12 @@ def gcs_xlsx_or_csv_file_to_pandas_dataframe(bucket_name: str, blob_name: str):
434
433
  raise Exception("Can only read csv or xlsx files")
435
434
 
436
435
 
436
+ def get_file_bytes_from_gcs(bucket_name: str, blob_name: str) -> io.BytesIO:
437
+ """Reads a file from Google Cloud Storage and returns it as BytesIO."""
438
+ sheet_data = storage.Client().bucket(bucket_name).blob(blob_name).download_as_bytes()
439
+ return io.BytesIO(sheet_data)
440
+
441
+
437
442
  def _execute_multiblob_acl_change(
438
443
  user_email_list: List[str],
439
444
  blob_list: List[storage.Blob],
@@ -1,35 +1,35 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.1.40
3
+ Version: 1.2.0
4
4
  Summary: SQLAlchemy data models and configuration tools used in the NCI CIDC API
5
5
  Home-page: https://github.com/NCI-CIDC/cidc-api-gae
6
6
  License: MIT license
7
- Requires-Python: >=3.9
7
+ Requires-Python: >=3.13
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
- Requires-Dist: werkzeug==3.0.6
11
- Requires-Dist: flask==3.0.3
12
- Requires-Dist: flask-migrate==3.1.0
13
- Requires-Dist: flask-sqlalchemy==3.1.1
14
- Requires-Dist: sqlalchemy==2.0.41
15
- Requires-Dist: marshmallow==3.19.0
16
- Requires-Dist: marshmallow-sqlalchemy==1.4.2
17
- Requires-Dist: google-cloud-storage==2.18.0
18
- Requires-Dist: google-cloud-secret-manager==2.20.1
19
- Requires-Dist: google-cloud-pubsub==2.22.0
20
- Requires-Dist: google-cloud-bigquery==3.18.0
21
- Requires-Dist: google-api-python-client==2.64.0
22
- Requires-Dist: google-auth==2.32.0
23
- Requires-Dist: packaging>=20.0.0
24
- Requires-Dist: pyarrow==14.0.1
25
- Requires-Dist: numpy<2,>=1.16.5
26
- Requires-Dist: pandas==1.5.3
27
- Requires-Dist: python-dotenv==0.10.3
28
- Requires-Dist: requests==2.32.4
29
- Requires-Dist: jinja2==3.1.6
30
- Requires-Dist: certifi==2024.7.4
31
- Requires-Dist: cloud-sql-python-connector[pg8000]==1.18.3
32
- Requires-Dist: nci-cidc-schemas==0.27.28
10
+ Requires-Dist: werkzeug~=3.1.3
11
+ Requires-Dist: flask~=3.1.2
12
+ Requires-Dist: flask-migrate~=4.1.0
13
+ Requires-Dist: flask-sqlalchemy~=3.1.1
14
+ Requires-Dist: sqlalchemy~=2.0.43
15
+ Requires-Dist: marshmallow~=4.0.0
16
+ Requires-Dist: marshmallow-sqlalchemy~=1.4.2
17
+ Requires-Dist: google-cloud-storage~=3.3.0
18
+ Requires-Dist: google-cloud-secret-manager~=2.24.0
19
+ Requires-Dist: google-cloud-pubsub~=2.31.1
20
+ Requires-Dist: google-cloud-bigquery~=3.36.0
21
+ Requires-Dist: google-api-python-client~=2.179.0
22
+ Requires-Dist: google-auth~=2.40.3
23
+ Requires-Dist: packaging~=25.0
24
+ Requires-Dist: pyarrow~=21.0.0
25
+ Requires-Dist: numpy~=2.3.2
26
+ Requires-Dist: pandas~=2.3.1
27
+ Requires-Dist: python-dotenv~=1.1.1
28
+ Requires-Dist: requests~=2.32.5
29
+ Requires-Dist: jinja2~=3.1.6
30
+ Requires-Dist: certifi~=2025.8.3
31
+ Requires-Dist: cloud-sql-python-connector[pg8000]~=1.18.4
32
+ Requires-Dist: nci-cidc-schemas==0.28.2
33
33
  Dynamic: description
34
34
  Dynamic: description-content-type
35
35
  Dynamic: home-page
@@ -62,7 +62,7 @@ The next generation of the CIDC API, reworked to use Google Cloud-managed servic
62
62
 
63
63
  ## Install Python dependencies
64
64
 
65
- Python versions tested include 3.9 and 3.10. The current App Engine is using version 3.9 (see [app.prod.yaml](./app.prod.yaml)). You can use https://github.com/pyenv/pyenv to manage your python versions. Homebrew will also work, but you will have to be specific when you install packages with pip outside of virtual environments. On that note, it is recommended that you install your python dependencies in an isolated environment. For example,
65
+ Use Python version 3.13
66
66
 
67
67
  ```bash
68
68
  # make a virtual environment in the current direcory called "venv"
@@ -0,0 +1,23 @@
1
+ werkzeug~=3.1.3
2
+ flask~=3.1.2
3
+ flask-migrate~=4.1.0
4
+ flask-sqlalchemy~=3.1.1
5
+ sqlalchemy~=2.0.43
6
+ marshmallow~=4.0.0
7
+ marshmallow-sqlalchemy~=1.4.2
8
+ google-cloud-storage~=3.3.0
9
+ google-cloud-secret-manager~=2.24.0
10
+ google-cloud-pubsub~=2.31.1
11
+ google-cloud-bigquery~=3.36.0
12
+ google-api-python-client~=2.179.0
13
+ google-auth~=2.40.3
14
+ packaging~=25.0
15
+ pyarrow~=21.0.0
16
+ numpy~=2.3.2
17
+ pandas~=2.3.1
18
+ python-dotenv~=1.1.1
19
+ requests~=2.32.5
20
+ jinja2~=3.1.6
21
+ certifi~=2025.8.3
22
+ cloud-sql-python-connector[pg8000]~=1.18.4
23
+ nci-cidc-schemas==0.28.2
@@ -0,0 +1,23 @@
1
+ werkzeug~=3.1.3
2
+ flask~=3.1.2
3
+ flask-migrate~=4.1.0
4
+ flask-sqlalchemy~=3.1.1
5
+ sqlalchemy~=2.0.43
6
+ marshmallow~=4.0.0
7
+ marshmallow-sqlalchemy~=1.4.2
8
+ google-cloud-storage~=3.3.0
9
+ google-cloud-secret-manager~=2.24.0
10
+ google-cloud-pubsub~=2.31.1
11
+ google-cloud-bigquery~=3.36.0
12
+ google-api-python-client~=2.179.0
13
+ google-auth~=2.40.3
14
+ packaging~=25.0
15
+ pyarrow~=21.0.0
16
+ numpy~=2.3.2
17
+ pandas~=2.3.1
18
+ python-dotenv~=1.1.1
19
+ requests~=2.32.5
20
+ jinja2~=3.1.6
21
+ certifi~=2025.8.3
22
+ cloud-sql-python-connector[pg8000]~=1.18.4
23
+ nci-cidc-schemas==0.28.2
@@ -13,7 +13,7 @@ from cidc_api import __version__
13
13
  setup(
14
14
  name="nci_cidc_api_modules",
15
15
  description="SQLAlchemy data models and configuration tools used in the NCI CIDC API",
16
- python_requires=">=3.9",
16
+ python_requires=">=3.13",
17
17
  install_requires=requirements,
18
18
  license="MIT license",
19
19
  packages=[
@@ -1,23 +0,0 @@
1
- werkzeug==3.0.6
2
- flask==3.0.3
3
- flask-migrate==3.1.0
4
- flask-sqlalchemy==3.1.1
5
- sqlalchemy==2.0.41
6
- marshmallow==3.19.0
7
- marshmallow-sqlalchemy==1.4.2
8
- google-cloud-storage==2.18.0
9
- google-cloud-secret-manager==2.20.1
10
- google-cloud-pubsub==2.22.0
11
- google-cloud-bigquery==3.18.0
12
- google-api-python-client==2.64.0
13
- google-auth==2.32.0
14
- packaging>=20.0.0
15
- pyarrow==14.0.1
16
- numpy<2,>=1.16.5
17
- pandas==1.5.3
18
- python-dotenv==0.10.3
19
- requests==2.32.4
20
- jinja2==3.1.6
21
- certifi==2024.7.4
22
- cloud-sql-python-connector[pg8000]==1.18.3
23
- nci-cidc-schemas==0.27.28
@@ -1,23 +0,0 @@
1
- werkzeug==3.0.6
2
- flask==3.0.3
3
- flask-migrate==3.1.0
4
- flask-sqlalchemy==3.1.1
5
- sqlalchemy==2.0.41
6
- marshmallow==3.19.0
7
- marshmallow-sqlalchemy==1.4.2
8
- google-cloud-storage==2.18.0
9
- google-cloud-secret-manager==2.20.1
10
- google-cloud-pubsub==2.22.0
11
- google-cloud-bigquery==3.18.0
12
- google-api-python-client==2.64.0
13
- google-auth==2.32.0
14
- packaging>=20.0.0
15
- pyarrow==14.0.1
16
- numpy>=1.16.5,<2
17
- pandas==1.5.3
18
- python-dotenv==0.10.3
19
- requests==2.32.4
20
- jinja2==3.1.6
21
- certifi==2024.7.4
22
- cloud-sql-python-connector[pg8000]==1.18.3
23
- nci-cidc-schemas==0.27.28