nci-cidc-api-modules 1.1.14__py3-none-any.whl → 1.1.16__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/shared/emails.py CHANGED
@@ -1,14 +1,11 @@
1
1
  """Template functions for CIDC email bodies."""
2
2
 
3
3
  import html
4
- import base64
5
4
  from functools import wraps
6
- from typing import Dict, Union
7
-
8
- from cidc_schemas.prism import generate_analysis_configs_from_upload_patch
5
+ from typing import List
9
6
 
10
7
  from . import gcloud_client
11
- from ..config.settings import ENV, GOOGLE_ACL_DATA_BUCKET
8
+ from ..config.settings import ENV
12
9
 
13
10
  # emails this list for
14
11
  # - new user registration,
@@ -87,14 +84,12 @@ def new_user_registration(email: str) -> dict:
87
84
  @sendable
88
85
  def new_upload_alert(upload, full_metadata) -> dict:
89
86
  """Alert the CIDC administrators that an upload succeeded."""
90
- pipeline_configs: Dict[str, Union[bytes, str]] = generate_analysis_configs_from_upload_patch(
91
- full_metadata,
92
- upload.metadata_patch,
93
- upload.upload_type,
94
- GOOGLE_ACL_DATA_BUCKET,
95
- )
87
+ possible_manifest_info = ""
88
+ if upload.metadata_patch and "shipments" in upload.metadata_patch and upload.metadata_patch["shipments"]:
89
+ manifest_id = upload.metadata_patch["shipments"][0].get("manifest_id")
90
+ possible_manifest_info = f" manifest {manifest_id}"
96
91
 
97
- subject = f"[UPLOAD SUCCESS]({ENV}) {upload.upload_type} uploaded to {upload.trial_id}"
92
+ subject = f"[UPLOAD SUCCESS]({ENV}) {upload.upload_type}{possible_manifest_info} uploaded to {upload.trial_id}"
98
93
 
99
94
  html_content = f"""
100
95
  <ul>
@@ -137,3 +132,21 @@ def intake_metadata(user, trial_id: str, assay_type: str, description: str, xlsx
137
132
  }
138
133
 
139
134
  return email
135
+
136
+
137
+ def notify_manifest_errors(subject_message: str, errors: List[str], send_email=True) -> dict:
138
+ """Alert the CIDC administrators of errors in an attempted upload."""
139
+ subject = f"[UPLOAD FAILURE]({ENV}) {subject_message}"
140
+ html_content = f"<ul>{''.join(f'<li>{error}</li>' for error in errors)}</ul>"
141
+ return notify_mailing_list(subject, html_content, send_email=send_email)
142
+
143
+
144
+ @sendable
145
+ def notify_mailing_list(subject: str, html_content: str) -> dict:
146
+ """Generic notification to the CIDC administrators based on info passed."""
147
+ email = {
148
+ "to_emails": CIDC_MAILING_LIST,
149
+ "subject": subject,
150
+ "html_content": html_content,
151
+ }
152
+ return email
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.1.14
3
+ Version: 1.1.16
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
@@ -26,7 +26,7 @@ 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
28
  Requires-Dist: requests==2.32.3
29
- Requires-Dist: jinja2==3.1.5
29
+ Requires-Dist: jinja2==3.1.6
30
30
  Requires-Dist: certifi==2024.7.4
31
31
  Requires-Dist: nci-cidc-schemas==0.27.09
32
32
  Dynamic: description
@@ -15,12 +15,12 @@ cidc_api/models/files/details.py,sha256=v4v_BetAOBiEq-FVcxho8lamZCRGb48oAvKk9yq4
15
15
  cidc_api/models/files/facets.py,sha256=803siMWziH5UVaF2tj49a_kJYb6CmSWHsGQJweXwyJY,28705
16
16
  cidc_api/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  cidc_api/shared/auth.py,sha256=PHqmVGkqDjbmUofytVFwD_9ssgUomESl3fFtFHPwZYQ,9062
18
- cidc_api/shared/emails.py,sha256=MG2csNhMaw3WtbUEqjMxhzV3X1pMzC8RGYBfNy_X0nc,4334
18
+ cidc_api/shared/emails.py,sha256=GY-l0EkoVU_3hjV0g-xo7N9d1iyCdluyq_arftEPPe0,4989
19
19
  cidc_api/shared/gcloud_client.py,sha256=spgH0fapO713X82eV23uLXtq4aVWJHwEDK-XDxaehJc,33088
20
20
  cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
21
21
  cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
22
- nci_cidc_api_modules-1.1.14.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
23
- nci_cidc_api_modules-1.1.14.dist-info/METADATA,sha256=RnTkbnCcd4OQLW8LiEAZupmH60EmbAgJdnOBE6u_s_0,41284
24
- nci_cidc_api_modules-1.1.14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
- nci_cidc_api_modules-1.1.14.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
26
- nci_cidc_api_modules-1.1.14.dist-info/RECORD,,
22
+ nci_cidc_api_modules-1.1.16.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
23
+ nci_cidc_api_modules-1.1.16.dist-info/METADATA,sha256=yo19-nBqPHrZoxHLujzKkP4AM8P2daE8aoKlxtgW-zk,41284
24
+ nci_cidc_api_modules-1.1.16.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
25
+ nci_cidc_api_modules-1.1.16.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
26
+ nci_cidc_api_modules-1.1.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5