nci-cidc-api-modules 1.2.10__py3-none-any.whl → 1.2.12__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.
Potentially problematic release.
This version of nci-cidc-api-modules might be problematic. Click here for more details.
- cidc_api/config/settings.py +1 -0
- cidc_api/shared/file_handling.py +15 -5
- cidc_api/shared/gcloud_client.py +1 -0
- {nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/METADATA +1 -1
- {nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/RECORD +8 -8
- {nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/WHEEL +0 -0
- {nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/licenses/LICENSE +0 -0
- {nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/top_level.txt +0 -0
cidc_api/config/settings.py
CHANGED
|
@@ -83,6 +83,7 @@ GOOGLE_EMAILS_TOPIC = environ["GOOGLE_EMAILS_TOPIC"]
|
|
|
83
83
|
GOOGLE_ARTIFACT_UPLOAD_TOPIC = environ["GOOGLE_ARTIFACT_UPLOAD_TOPIC"]
|
|
84
84
|
GOOGLE_GRANT_DOWNLOAD_PERMISSIONS_TOPIC = environ["GOOGLE_GRANT_DOWNLOAD_PERMISSIONS_TOPIC"]
|
|
85
85
|
GOOGLE_HL_CLINICAL_VALIDATION_TOPIC = environ["GOOGLE_HL_CLINICAL_VALIDATION_TOPIC"]
|
|
86
|
+
GOOGLE_DL_CLINICAL_VALIDATION_TOPIC = environ["GOOGLE_DL_CLINICAL_VALIDATION_TOPIC"]
|
|
86
87
|
GOOGLE_AND_OPERATOR = " && "
|
|
87
88
|
GOOGLE_OR_OPERATOR = " || "
|
|
88
89
|
|
cidc_api/shared/file_handling.py
CHANGED
|
@@ -8,22 +8,31 @@ from ..config.settings import GOOGLE_CLINICAL_DATA_BUCKET
|
|
|
8
8
|
from ..models import PreprocessedFiles
|
|
9
9
|
from ..shared.auth import get_current_user
|
|
10
10
|
from ..shared.gcloud_client import upload_file_to_gcs, move_gcs_file
|
|
11
|
+
from sqlalchemy.orm.session import Session
|
|
11
12
|
|
|
12
13
|
logger = get_logger(__name__)
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
def set_current_file(
|
|
16
|
+
def set_current_file(
|
|
17
|
+
file: FileStorage, file_category: str, gcs_folder: str, session: Session, uploader_email: str, job_id: int = None
|
|
18
|
+
) -> PreprocessedFiles:
|
|
16
19
|
"""
|
|
17
20
|
Archives any existing 'current' files for the given category and job,
|
|
18
21
|
then uploads the new file as the latest 'current' version.
|
|
19
22
|
"""
|
|
20
|
-
latest_version = PreprocessedFiles.archive_current_files(file_category, job_id=job_id)
|
|
21
|
-
latest_file = create_file(file, gcs_folder, file_category, job_id, latest_version + 1)
|
|
23
|
+
latest_version = PreprocessedFiles.archive_current_files(file_category, job_id=job_id, session=session)
|
|
24
|
+
latest_file = create_file(file, gcs_folder, file_category, session, uploader_email, job_id, latest_version + 1)
|
|
22
25
|
return latest_file
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
def create_file(
|
|
26
|
-
file: FileStorage,
|
|
29
|
+
file: FileStorage,
|
|
30
|
+
gcs_folder: str,
|
|
31
|
+
file_category: str,
|
|
32
|
+
session: Session,
|
|
33
|
+
uploader_email: str,
|
|
34
|
+
job_id: int = None,
|
|
35
|
+
version: int = None,
|
|
27
36
|
) -> PreprocessedFiles:
|
|
28
37
|
"""Upload file to GCS and create corresponding metadata record in the database."""
|
|
29
38
|
status = "pending" if gcs_folder.endswith("pending/") else "current"
|
|
@@ -36,10 +45,11 @@ def create_file(
|
|
|
36
45
|
file_name=file.filename,
|
|
37
46
|
object_url=gcs_file_path,
|
|
38
47
|
file_category=file_category,
|
|
39
|
-
uploader_email=
|
|
48
|
+
uploader_email=uploader_email,
|
|
40
49
|
status=status,
|
|
41
50
|
job_id=job_id,
|
|
42
51
|
version=version,
|
|
52
|
+
session=session,
|
|
43
53
|
)
|
|
44
54
|
return file
|
|
45
55
|
|
cidc_api/shared/gcloud_client.py
CHANGED
|
@@ -2,7 +2,7 @@ cidc_api/config/__init__.py,sha256=5mX8GAPxUKV84iS-aGOoE-4m68LsOCGCDptXNdlgvj0,1
|
|
|
2
2
|
cidc_api/config/db.py,sha256=eFCkJDeykRIJZ25kePVjRNrZcrcKTc1s2K0yErr46LI,1683
|
|
3
3
|
cidc_api/config/logging.py,sha256=abhVYtn8lfhIt0tyV2WHFgSmp_s2eeJh7kodB6LH4J0,1149
|
|
4
4
|
cidc_api/config/secrets.py,sha256=jRFj7W43pWuPf9DZQLCKF7WPXf5cUv-BAaS3ASqhV_Q,1481
|
|
5
|
-
cidc_api/config/settings.py,sha256=
|
|
5
|
+
cidc_api/config/settings.py,sha256=v8PmdR_MSmizuV1VaEX24QR0XHzIZ4jn69r6PwxAxV8,4512
|
|
6
6
|
cidc_api/models/__init__.py,sha256=bl445G8Zic9YbhZ8ZBni07wtBMhLJRMBA-JqjLxx2bw,66
|
|
7
7
|
cidc_api/models/migrations.py,sha256=gp9vtkYbA9FFy2s-7woelAmsvQbJ41LO2_DY-YkFIrQ,11464
|
|
8
8
|
cidc_api/models/models.py,sha256=b7HWj8uOD_xdv7p3WkrhRODauLCVGvSLQsSbJGUmr9Q,146956
|
|
@@ -13,12 +13,12 @@ cidc_api/models/files/facets.py,sha256=RZoe0FadRGJw8_-jzJQkc4dIVSuaYlunNrsopb2dY
|
|
|
13
13
|
cidc_api/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
cidc_api/shared/auth.py,sha256=PHqmVGkqDjbmUofytVFwD_9ssgUomESl3fFtFHPwZYQ,9062
|
|
15
15
|
cidc_api/shared/emails.py,sha256=HQIixEUsR8yyu7Iv8S81RjtvEQeGuzQHzBfGsWIfP7k,4961
|
|
16
|
-
cidc_api/shared/file_handling.py,sha256=
|
|
17
|
-
cidc_api/shared/gcloud_client.py,sha256=
|
|
16
|
+
cidc_api/shared/file_handling.py,sha256=4xkekdrzxWsfmfBtWpylyDMT98ICjQwx1meqqh1FAis,4103
|
|
17
|
+
cidc_api/shared/gcloud_client.py,sha256=BaoYv-lWWLwdZvyRjCWCyAyZMXtqlT8IPJpw9XDODCY,37210
|
|
18
18
|
cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
|
|
19
19
|
cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
|
|
20
|
-
nci_cidc_api_modules-1.2.
|
|
21
|
-
nci_cidc_api_modules-1.2.
|
|
22
|
-
nci_cidc_api_modules-1.2.
|
|
23
|
-
nci_cidc_api_modules-1.2.
|
|
24
|
-
nci_cidc_api_modules-1.2.
|
|
20
|
+
nci_cidc_api_modules-1.2.12.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
|
|
21
|
+
nci_cidc_api_modules-1.2.12.dist-info/METADATA,sha256=cYaS5WnYnxEjX8tg7GNIwanF5Gy0nUCwV4DiGeCfBq4,39539
|
|
22
|
+
nci_cidc_api_modules-1.2.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
23
|
+
nci_cidc_api_modules-1.2.12.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
|
|
24
|
+
nci_cidc_api_modules-1.2.12.dist-info/RECORD,,
|
|
File without changes
|
{nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{nci_cidc_api_modules-1.2.10.dist-info → nci_cidc_api_modules-1.2.12.dist-info}/top_level.txt
RENAMED
|
File without changes
|