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.

@@ -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
 
@@ -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(file: FileStorage, file_category: str, gcs_folder: str, job_id: int = None) -> PreprocessedFiles:
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, gcs_folder: str, file_category: str, job_id: int = None, version: int = None
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=get_current_user().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
 
@@ -55,6 +55,7 @@ from ..config.settings import (
55
55
  GOOGLE_ARTIFACT_UPLOAD_TOPIC,
56
56
  GOOGLE_GRANT_DOWNLOAD_PERMISSIONS_TOPIC,
57
57
  GOOGLE_HL_CLINICAL_VALIDATION_TOPIC,
58
+ GOOGLE_DL_CLINICAL_VALIDATION_TOPIC,
58
59
  TESTING,
59
60
  ENV,
60
61
  IS_EMAIL_ON,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.2.10
3
+ Version: 1.2.12
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
@@ -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=NsJbqW6Vqcz2f79xcAbk4th5tHne_I-RPCbKq_3hpz0,4427
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=l4wiRkVJLL7QbCoODsLx-uki6Km8QoMmUlRVnUV9vkk,3894
17
- cidc_api/shared/gcloud_client.py,sha256=AGF4OHvZtgvDe6_YL4gZUajBJL9nY6tjVBVkXGBEIIw,37169
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.10.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
21
- nci_cidc_api_modules-1.2.10.dist-info/METADATA,sha256=j8DWxMQLIegbilW9COrSACclr3jFDMX2YYJcLkrGLEg,39539
22
- nci_cidc_api_modules-1.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- nci_cidc_api_modules-1.2.10.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
24
- nci_cidc_api_modules-1.2.10.dist-info/RECORD,,
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,,