nci-cidc-api-modules 1.2.49__py3-none-any.whl → 1.2.51__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.
cidc_api/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.49"
1
+ __version__ = "1.2.51"
@@ -78,6 +78,7 @@ GOOGLE_GRANT_DOWNLOAD_PERMISSIONS_TOPIC = environ["GOOGLE_GRANT_DOWNLOAD_PERMISS
78
78
  GOOGLE_HL_CLINICAL_VALIDATION_TOPIC = environ["GOOGLE_HL_CLINICAL_VALIDATION_TOPIC"]
79
79
  GOOGLE_DL_CLINICAL_VALIDATION_TOPIC = environ["GOOGLE_DL_CLINICAL_VALIDATION_TOPIC"]
80
80
  GOOGLE_ASSAY_METADATA_VALIDATION_TOPIC = environ["GOOGLE_ASSAY_METADATA_VALIDATION_TOPIC"]
81
+ GOOGLE_CLINICAL_DATA_INGESTION_PROCESSING_TOPIC = "ingestion"
81
82
  GOOGLE_AND_OPERATOR = " && "
82
83
  GOOGLE_OR_OPERATOR = " || "
83
84
 
cidc_api/models/models.py CHANGED
@@ -36,6 +36,7 @@ __all__ = [
36
36
  "ADMIN_FILE_CATEGORIES",
37
37
  "FINAL_JOB_STATUS",
38
38
  "INGESTION_JOB_STATUSES",
39
+ "INGESTION_PHASE_STATUSES",
39
40
  "ASSAY_JOB_COLORS",
40
41
  "CLINICAL_JOB_COLORS",
41
42
  ]
@@ -1048,11 +1049,11 @@ class Permissions(CommonColumns):
1048
1049
  user_email_list.append(user.email)
1049
1050
  grant_lister_access(user.email)
1050
1051
 
1051
- if upload.upload_type in prism.SUPPORTED_SHIPPING_MANIFESTS:
1052
+ if upload.upload_type in prism.SUPPORTED_MANIFESTS:
1052
1053
  # Passed with empty user email list because they will be queried for in CFn
1053
1054
  grant_download_access([], upload.trial_id, "participants info")
1054
1055
  grant_download_access([], upload.trial_id, "samples info")
1055
- elif upload.upload_type not in prism.SUPPORTED_WEIRD_MANIFESTS:
1056
+ else:
1056
1057
  grant_download_access(user_email_list, upload.trial_id, upload.upload_type)
1057
1058
 
1058
1059
  @staticmethod
@@ -3448,6 +3449,8 @@ INGESTION_JOB_STATUSES = [
3448
3449
  "PUBLISHED",
3449
3450
  ]
3450
3451
 
3452
+ INGESTION_PHASE_STATUSES = ["NOT STARTED", "SUCCESS", "FAILED"]
3453
+
3451
3454
  # Business decision to pass hex codes from the backend though that should be done by the front end...
3452
3455
  CLINICAL_JOB_COLORS = {
3453
3456
  "DRAFT": "",
@@ -3493,6 +3496,12 @@ class IngestionJobs(CommonColumns):
3493
3496
  uploader_email = Column(String, nullable=True)
3494
3497
  is_template_downloaded = Column(Boolean, nullable=True)
3495
3498
  master_aa_version = Column(Integer, nullable=True)
3499
+ ingestion_phase_status = Column(
3500
+ "ingestion_phase_status",
3501
+ Enum(*INGESTION_PHASE_STATUSES, name="ingestion_phase_status"),
3502
+ nullable=False,
3503
+ default=INGESTION_PHASE_STATUSES[0],
3504
+ )
3496
3505
 
3497
3506
  @staticmethod
3498
3507
  @with_default_session
@@ -3503,6 +3512,7 @@ class IngestionJobs(CommonColumns):
3503
3512
  error_status: str = None,
3504
3513
  pending: Boolean = False,
3505
3514
  job_type: str = "clinical",
3515
+ ingestion_phase_status=INGESTION_PHASE_STATUSES[0],
3506
3516
  assay_type: str = None,
3507
3517
  batch_id: str = None,
3508
3518
  submission_id: str = None,
@@ -3524,6 +3534,7 @@ class IngestionJobs(CommonColumns):
3524
3534
  intake_path=intake_path,
3525
3535
  start_date=start_date,
3526
3536
  uploader_email=uploader_email,
3537
+ ingestion_phase_status=ingestion_phase_status,
3527
3538
  )
3528
3539
  new_job.insert(session=session)
3529
3540
  return new_job
@@ -61,6 +61,7 @@ from ..config.settings import (
61
61
  GOOGLE_HL_CLINICAL_VALIDATION_TOPIC,
62
62
  GOOGLE_DL_CLINICAL_VALIDATION_TOPIC,
63
63
  GOOGLE_ASSAY_METADATA_VALIDATION_TOPIC,
64
+ GOOGLE_CLINICAL_DATA_INGESTION_PROCESSING_TOPIC,
64
65
  TESTING,
65
66
  ENV,
66
67
  IS_EMAIL_ON,
@@ -486,9 +487,17 @@ async def async_gcs_files_to_pandas_dataframes(bucket_name: str, blob_names: Lis
486
487
  return dataframes
487
488
 
488
489
 
490
+ async def async_gcs_files_to_bytes(bucket_name: str, blob_names: List[str]) -> List[DataFrame]:
491
+ """Async reads a XLSX or CSV files from Google Cloud Storage into a list of raw bytes"""
492
+
493
+ all_contents = await asyncio.gather(
494
+ *[async_get_file_bytes_from_gcs(bucket_name, blob_name) for blob_name in blob_names]
495
+ )
496
+ return all_contents
497
+
498
+
489
499
  async def async_get_file_bytes_from_gcs(bucket_name: str, blob_name: str) -> io.BytesIO:
490
500
  """Async reads a file from Google Cloud Storage and returns it as BytesIO."""
491
-
492
501
  async with Storage() as client:
493
502
  sheet_data = await client.download(bucket_name, blob_name)
494
503
  return io.BytesIO(sheet_data)
@@ -1059,6 +1068,12 @@ def publish_assay_metadata_validation(job_id: int) -> None:
1059
1068
  _report = _encode_and_publish(str(job_id), GOOGLE_ASSAY_METADATA_VALIDATION_TOPIC)
1060
1069
 
1061
1070
 
1071
+ def publish_clinical_data_ingestion(job_id: int) -> None:
1072
+ """Start ingestion of clinical data job"""
1073
+ # Start asynchronously
1074
+ _report = _encode_and_publish(str(job_id), GOOGLE_CLINICAL_DATA_INGESTION_PROCESSING_TOPIC)
1075
+
1076
+
1062
1077
  def send_email(to_emails: List[str], subject: str, html_content: str, **kw) -> None:
1063
1078
  """
1064
1079
  Publish an email-to-send to the emails topic.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.2.49
3
+ Version: 1.2.51
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
@@ -43,7 +43,7 @@ Requires-Dist: opentelemetry-instrumentation-requests>=0.59b0
43
43
  Requires-Dist: opentelemetry-instrumentation-sqlalchemy>=0.59b0
44
44
  Requires-Dist: opentelemetry-exporter-gcp-trace>=1.11.0
45
45
  Requires-Dist: opentelemetry-propagator-gcp>=1.11.0
46
- Requires-Dist: nci-cidc-schemas==0.28.11
46
+ Requires-Dist: nci-cidc-schemas==0.28.12
47
47
  Dynamic: description
48
48
  Dynamic: description-content-type
49
49
  Dynamic: home-page
@@ -1,16 +1,16 @@
1
1
  boot.py,sha256=oS_16OgU34iDxyFNpJl5rb5KbfbsCXroUCNLwVPxPNg,416
2
- cidc_api/__init__.py,sha256=qkDVgmmc_W7WSA8UFQzKzULlTX27bnHrBTAlSeTYqYs,23
2
+ cidc_api/__init__.py,sha256=kgsz9u_lLDc3N0akch6v9PpMXz_PW7_aEHXRb1pWgHg,23
3
3
  cidc_api/telemetry.py,sha256=LuZWkG8CKCn23O41RTNxEOQwMmfpp-fQ6zSInZhVJg8,3333
4
4
  cidc_api/config/__init__.py,sha256=5mX8GAPxUKV84iS-aGOoE-4m68LsOCGCDptXNdlgvj0,148
5
5
  cidc_api/config/db.py,sha256=mEz8ugjvRNGylCqDYHaaMqaZfDh7sbd76BowmfBvq5c,2428
6
6
  cidc_api/config/logging.py,sha256=abhVYtn8lfhIt0tyV2WHFgSmp_s2eeJh7kodB6LH4J0,1149
7
7
  cidc_api/config/secrets.py,sha256=jRFj7W43pWuPf9DZQLCKF7WPXf5cUv-BAaS3ASqhV_Q,1481
8
- cidc_api/config/settings.py,sha256=loern8cejUrOJJAog4z0iW9EQaa0nlN0rFrFOdZ-cLE,4483
8
+ cidc_api/config/settings.py,sha256=IlOSJhSyYYK4XQQ4uBdD58kXO-a2AHPWTSN1AT95b9Y,4545
9
9
  cidc_api/models/__init__.py,sha256=bl445G8Zic9YbhZ8ZBni07wtBMhLJRMBA-JqjLxx2bw,66
10
10
  cidc_api/models/data.py,sha256=TyVXk5jJO1NN05CLqejLf5BPp6yLSNNxPmFOgXUnA1M,1313
11
11
  cidc_api/models/errors.py,sha256=UncRrh-4v0CR5mpLO0erWD1y9ctus3Nk6XOSvrTjfco,338
12
12
  cidc_api/models/migrations.py,sha256=UlS5How3J4ryaRuZT6F5VQtAKikkl0LTv9MgMO_ltiQ,11161
13
- cidc_api/models/models.py,sha256=3O0Oc_MgovrMS1qz-r3zOnPd5_41p7sXc30Qj03QJ6s,153739
13
+ cidc_api/models/models.py,sha256=RycbGNQHIud9mqCyIH_yrnN7PVSFwbUCjP6pe6sX5VA,154106
14
14
  cidc_api/models/schemas.py,sha256=6IE2dJoEMcMbi0Vr1V3cYKnPKU0hv9vRKBixOZHe88s,2766
15
15
  cidc_api/models/types.py,sha256=WVOTEH61FH5aGVwRbEcfNOce8NLjiEnl1ixtPWav2OA,30058
16
16
  cidc_api/models/db/stage1/__init__.py,sha256=zsxOSoogzL_xZ8B5OwcwLXvAmm6g2GYx1Zf6LLw8dq8,1917
@@ -156,12 +156,12 @@ cidc_api/shared/auth.py,sha256=EIP9AKokLNrI79Fkpv3P7WdzaddJIsuGGICc1W494X0,9110
156
156
  cidc_api/shared/email_layout.html,sha256=pBoTNw3ACHH-ncZFaNvcy5bXMqPwizR78usb0uCYtIc,7670
157
157
  cidc_api/shared/emails.py,sha256=8kNFEaSnKpY-GX_iE59QUhSp3c4_uzy3SpHYt2QjuqI,6121
158
158
  cidc_api/shared/file_handling.py,sha256=9MZXx5RfXO3A_pXf8Ulb7DQEuyp9j12eO9ad-PcTBXo,5908
159
- cidc_api/shared/gcloud_client.py,sha256=7q6CWpAZdqSJoAkMpm9Rw7yFwNLIk6D9WZGJeTOwo54,40113
159
+ cidc_api/shared/gcloud_client.py,sha256=EJ2ZzZ0gwDOZx18PEzXil4F-jpruacShkVIoecw8qzY,40751
160
160
  cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
161
161
  cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
162
162
  cidc_api/shared/utils.py,sha256=-gLnzxCR9E6h0plt2xrNisUG5_Y6GhhVwz3DgDIzpvs,367
163
- nci_cidc_api_modules-1.2.49.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
164
- nci_cidc_api_modules-1.2.49.dist-info/METADATA,sha256=vy1hCgQ0v8NmAfY8w71VOrXET5k9u95FmpAUJb-vxHQ,40301
165
- nci_cidc_api_modules-1.2.49.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
166
- nci_cidc_api_modules-1.2.49.dist-info/top_level.txt,sha256=BSJqF6ura8-bWCKZvarvQEKvidMM05lH0bLQsNOrI0o,14
167
- nci_cidc_api_modules-1.2.49.dist-info/RECORD,,
163
+ nci_cidc_api_modules-1.2.51.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
164
+ nci_cidc_api_modules-1.2.51.dist-info/METADATA,sha256=MCveB10mn5WAmlZX44mM0Z0BCCCu2wsttqjPitAF4Nc,40301
165
+ nci_cidc_api_modules-1.2.51.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
166
+ nci_cidc_api_modules-1.2.51.dist-info/top_level.txt,sha256=BSJqF6ura8-bWCKZvarvQEKvidMM05lH0bLQsNOrI0o,14
167
+ nci_cidc_api_modules-1.2.51.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.10.1)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5