nci-cidc-api-modules 1.1.31__tar.gz → 1.1.33__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.
- {nci_cidc_api_modules-1.1.31/nci_cidc_api_modules.egg-info → nci_cidc_api_modules-1.1.33}/PKG-INFO +3 -3
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/models.py +21 -7
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33/nci_cidc_api_modules.egg-info}/PKG-INFO +3 -3
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/nci_cidc_api_modules.egg-info/requires.txt +2 -2
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/requirements.modules.txt +2 -2
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/tests/test_api.py +4 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/LICENSE +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/MANIFEST.in +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/README.md +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/config/__init__.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/config/db.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/config/logging.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/config/secrets.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/config/settings.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/__init__.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/files/__init__.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/files/details.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/files/facets.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/migrations.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/schemas.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/__init__.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/auth.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/emails.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/gcloud_client.py +2 -2
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/jose.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/rest_utils.py +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/nci_cidc_api_modules.egg-info/SOURCES.txt +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/nci_cidc_api_modules.egg-info/dependency_links.txt +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/nci_cidc_api_modules.egg-info/not-zip-safe +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/nci_cidc_api_modules.egg-info/top_level.txt +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/pyproject.toml +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/setup.cfg +0 -0
- {nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/setup.py +0 -0
{nci_cidc_api_modules-1.1.31/nci_cidc_api_modules.egg-info → nci_cidc_api_modules-1.1.33}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nci_cidc_api_modules
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.33
|
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
|
@@ -25,10 +25,10 @@ Requires-Dist: pyarrow==14.0.1
|
|
25
25
|
Requires-Dist: numpy<2,>=1.16.5
|
26
26
|
Requires-Dist: pandas==1.5.3
|
27
27
|
Requires-Dist: python-dotenv==0.10.3
|
28
|
-
Requires-Dist: requests==2.32.
|
28
|
+
Requires-Dist: requests==2.32.4
|
29
29
|
Requires-Dist: jinja2==3.1.6
|
30
30
|
Requires-Dist: certifi==2024.7.4
|
31
|
-
Requires-Dist: nci-cidc-schemas==0.27.
|
31
|
+
Requires-Dist: nci-cidc-schemas==0.27.24
|
32
32
|
Dynamic: description
|
33
33
|
Dynamic: description-content-type
|
34
34
|
Dynamic: home-page
|
@@ -3229,18 +3229,21 @@ class PreprocessedFiles(CommonColumns):
|
|
3229
3229
|
@classmethod
|
3230
3230
|
@with_default_session
|
3231
3231
|
def archive_current_files(cls, file_category: str, session: Session = None):
|
3232
|
-
"""Update any 'current' files in the given category to 'archived'."""
|
3232
|
+
"""Update any 'current' files in the given category to 'archived'. Returns latest existing version number."""
|
3233
|
+
current_version = 0
|
3233
3234
|
current_files = cls.get_files_by_category_and_status(file_category, "current", session=session)
|
3234
3235
|
for file in current_files:
|
3235
3236
|
file.status = "archived"
|
3236
3237
|
file._updated = datetime.now()
|
3238
|
+
current_version = file.version if file.version > current_version else current_version
|
3237
3239
|
session.commit()
|
3240
|
+
return current_version
|
3238
3241
|
|
3239
3242
|
@classmethod
|
3240
3243
|
@with_default_session
|
3241
|
-
def delete_pending_files_by_category(cls, file_category: str, session: Session = None):
|
3242
|
-
"""Delete all pending files matching given file_category."""
|
3243
|
-
records = cls.get_files_by_category_and_status(file_category, "pending", session=session)
|
3244
|
+
def delete_pending_files_by_category(cls, file_category: str, trial_id: str = None, session: Session = None):
|
3245
|
+
"""Delete all pending files matching given file_category and optional trial_id."""
|
3246
|
+
records = cls.get_files_by_category_and_status(file_category, "pending", trial_id=trial_id, session=session)
|
3244
3247
|
for record in records:
|
3245
3248
|
session.delete(record)
|
3246
3249
|
session.commit()
|
@@ -3248,7 +3251,18 @@ class PreprocessedFiles(CommonColumns):
|
|
3248
3251
|
@classmethod
|
3249
3252
|
@with_default_session
|
3250
3253
|
def get_files_by_category_and_status(
|
3251
|
-
cls, file_category: str, status: str, session: Session = None
|
3254
|
+
cls, file_category: str, status: str, trial_id: str = None, session: Session = None
|
3252
3255
|
) -> list["PreprocessedFiles"]:
|
3253
|
-
"""Return all files matching given file_category and status."""
|
3254
|
-
|
3256
|
+
"""Return all files matching given file_category and status, optionally filtered by trial_id."""
|
3257
|
+
query = session.query(cls).filter_by(file_category=file_category, status=status)
|
3258
|
+
if trial_id:
|
3259
|
+
query = query.filter_by(trial_id=trial_id)
|
3260
|
+
return query.all()
|
3261
|
+
|
3262
|
+
@classmethod
|
3263
|
+
@with_default_session
|
3264
|
+
def get_file_by_category_and_version(
|
3265
|
+
cls, file_category: str, version: int, session: Session = None
|
3266
|
+
) -> Optional["PreprocessedFiles"]:
|
3267
|
+
"""Return the file matching the given category and version number."""
|
3268
|
+
return session.query(cls).filter_by(file_category=file_category, version=version).one_or_none()
|
{nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33/nci_cidc_api_modules.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nci_cidc_api_modules
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.33
|
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
|
@@ -25,10 +25,10 @@ Requires-Dist: pyarrow==14.0.1
|
|
25
25
|
Requires-Dist: numpy<2,>=1.16.5
|
26
26
|
Requires-Dist: pandas==1.5.3
|
27
27
|
Requires-Dist: python-dotenv==0.10.3
|
28
|
-
Requires-Dist: requests==2.32.
|
28
|
+
Requires-Dist: requests==2.32.4
|
29
29
|
Requires-Dist: jinja2==3.1.6
|
30
30
|
Requires-Dist: certifi==2024.7.4
|
31
|
-
Requires-Dist: nci-cidc-schemas==0.27.
|
31
|
+
Requires-Dist: nci-cidc-schemas==0.27.24
|
32
32
|
Dynamic: description
|
33
33
|
Dynamic: description-content-type
|
34
34
|
Dynamic: home-page
|
@@ -410,8 +410,12 @@ def test_endpoint_urls(cidc_api):
|
|
410
410
|
"""
|
411
411
|
expected_endpoints = {
|
412
412
|
"/",
|
413
|
+
"/clinical_data/files/master_appendix_a/current",
|
413
414
|
"/clinical_data/files/master_appendix_a/pending",
|
415
|
+
"/clinical_data/files/master_appendix_a/versions",
|
416
|
+
"/clinical_data/files/master_appendix_a/versions/<int:version>",
|
414
417
|
"/clinical_data/jobs",
|
418
|
+
"/clinical_data/trials/<string:trial_id>/files/trial_appendix_a/pending",
|
415
419
|
"/downloadable_files/",
|
416
420
|
"/downloadable_files/filelist",
|
417
421
|
"/downloadable_files/compressed_batch",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/files/__init__.py
RENAMED
File without changes
|
{nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/models/files/details.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{nci_cidc_api_modules-1.1.31 → nci_cidc_api_modules-1.1.33}/cidc_api/shared/gcloud_client.py
RENAMED
@@ -237,7 +237,6 @@ def upload_file_to_gcs(file: FileStorage, bucket_name: str, gcs_folder: str) ->
|
|
237
237
|
|
238
238
|
def move_gcs_file(bucket_name: str, existing_path: str, to_folder: str, append_timestamp: bool = True) -> str:
|
239
239
|
"""Move a file within a GCS bucket to a new folder, optionally appending a timestamp to the filename."""
|
240
|
-
bucket = _get_bucket(bucket_name)
|
241
240
|
filename = os.path.basename(existing_path)
|
242
241
|
if append_timestamp:
|
243
242
|
filename = _append_iso_timestamp_to_filename(filename)
|
@@ -250,6 +249,7 @@ def move_gcs_file(bucket_name: str, existing_path: str, to_folder: str, append_t
|
|
250
249
|
logger.info(f"Would've moved {existing_path} to {new_gcs_file_path} in {bucket_name}")
|
251
250
|
return new_gcs_file_path
|
252
251
|
|
252
|
+
bucket = _get_bucket(bucket_name)
|
253
253
|
source_blob = bucket.blob(existing_path)
|
254
254
|
if not source_blob.exists():
|
255
255
|
raise Exception("Expected file not found in GCS")
|
@@ -263,10 +263,10 @@ def move_gcs_file(bucket_name: str, existing_path: str, to_folder: str, append_t
|
|
263
263
|
|
264
264
|
def delete_items_from_folder(bucket_name: str, folder: str):
|
265
265
|
"""Deletes all blobs from the specified folder in the specified bucket."""
|
266
|
-
bucket = _get_bucket(bucket_name)
|
267
266
|
if ENV == "dev" and not DEV_USE_GCS:
|
268
267
|
logger.info(f"Would've deleted file(s) from {folder} in {bucket_name}")
|
269
268
|
return
|
269
|
+
bucket = _get_bucket(bucket_name)
|
270
270
|
existing_blobs = bucket.list_blobs(prefix=folder)
|
271
271
|
for blob in existing_blobs:
|
272
272
|
blob.delete()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|