nci-cidc-api-modules 1.2.12__py3-none-any.whl → 1.2.14__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.

@@ -108,5 +108,9 @@ else:
108
108
  IS_EMAIL_ON = environ.get("IS_EMAIL_ON")
109
109
 
110
110
 
111
+ # notification emails
112
+ CIDC_CLINICAL_DATA_EMAIL = environ.get("CIDC_CLINICAL_DATA_EMAIL")
113
+ CIDC_ADMIN_EMAIL = environ.get("CIDC_ADMIN_EMAIL")
114
+
111
115
  # Accumulate all constants defined in this file in a single dictionary
112
116
  SETTINGS = {k: v for k, v in globals().items() if k.isupper()}
@@ -0,0 +1,258 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title>Manifest Status Notification</title>
6
+ <meta charset="utf-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
10
+ <style type="text/css">
11
+ /* CLIENT-SPECIFIC STYLES */
12
+ body,
13
+ table,
14
+ td,
15
+ a {
16
+ -webkit-text-size-adjust: 100%;
17
+ -ms-text-size-adjust: 100%;
18
+ }
19
+
20
+ /* Prevent WebKit and Windows mobile changing default text sizes */
21
+ table,
22
+ td {
23
+ mso-table-lspace: 0pt;
24
+ mso-table-rspace: 0pt;
25
+ }
26
+
27
+ /* Remove spacing between tables in Outlook 2007 and up */
28
+ img {
29
+ -ms-interpolation-mode: bicubic;
30
+ }
31
+
32
+ /* Allow smoother rendering of resized image in Internet Explorer */
33
+
34
+ /* RESET STYLES */
35
+ img {
36
+ border: 0;
37
+ height: auto;
38
+ line-height: 100%;
39
+ outline: none;
40
+ text-decoration: none;
41
+ }
42
+
43
+ table {
44
+ border-collapse: collapse !important;
45
+ }
46
+
47
+ body {
48
+ height: 100% !important;
49
+ margin: 0 !important;
50
+ padding: 0 !important;
51
+ width: 100% !important;
52
+ }
53
+
54
+ /* iOS BLUE LINKS */
55
+ a[x-apple-data-detectors] {
56
+ color: inherit !important;
57
+ text-decoration: none !important;
58
+ font-size: inherit !important;
59
+ font-family: inherit !important;
60
+ font-weight: inherit !important;
61
+ line-height: inherit !important;
62
+ }
63
+
64
+ /* MOBILE STYLES */
65
+ @media screen and (max-width: 525px) {
66
+
67
+ /* ALLOWS FOR FLUID TABLES */
68
+ .wrapper {
69
+ width: 100% !important;
70
+ max-width: 100% !important;
71
+ }
72
+
73
+ /* ADJUSTS LAYOUT OF LOGO IMAGE */
74
+ .logo img {
75
+ margin: 0 auto !important;
76
+ }
77
+
78
+ /* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */
79
+ .mobile-hide {
80
+ display: none !important;
81
+ }
82
+
83
+ .img-max {
84
+ max-width: 100% !important;
85
+ width: 100% !important;
86
+ height: auto !important;
87
+ }
88
+
89
+ /* FULL-WIDTH TABLES */
90
+ .responsive-table {
91
+ width: 100% !important;
92
+ }
93
+
94
+ /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */
95
+ .padding {
96
+ padding: 10px 5% 15px 5% !important;
97
+ }
98
+
99
+ .padding-meta {
100
+ padding: 30px 5% 0px 5% !important;
101
+ text-align: center;
102
+ }
103
+
104
+ .padding-copy {
105
+ padding: 10px 5% 10px 5% !important;
106
+ text-align: center;
107
+ }
108
+
109
+ .no-padding {
110
+ padding: 0 !important;
111
+ }
112
+
113
+ .section-padding {
114
+ padding: 50px 15px 50px 15px !important;
115
+ }
116
+
117
+ /* ADJUST BUTTONS ON MOBILE */
118
+ .mobile-button-container {
119
+ margin: 0 auto;
120
+ width: 100% !important;
121
+ }
122
+
123
+ .mobile-button {
124
+ padding: 15px !important;
125
+ border: 0 !important;
126
+ font-size: 16px !important;
127
+ display: block !important;
128
+ }
129
+
130
+ }
131
+
132
+ /* ANDROID CENTER FIX */
133
+ div[style*="margin: 16px 0;"] {
134
+ margin: 0 !important;
135
+ }
136
+
137
+ a {
138
+ color: white;
139
+ text-decoration: underline;
140
+ }
141
+
142
+ .blue-link {
143
+ color: #1B6B82;
144
+ }
145
+ </style>
146
+ </head>
147
+
148
+ <body style="margin: 0 !important; padding: 0 !important; background-color:#F5F5F5;">
149
+
150
+ <!-- ONE COLUMN SECTION -->
151
+ <table bgcolor="#F5F5F5" border="0" cellpadding="0" cellspacing="0" width="100%">
152
+
153
+ <tr>
154
+ <td align="center" style="padding: 60px 16px 16px; margin-top: -32px;" class="section-padding">
155
+ <!--[if (gte mso 9)|(IE)]>
156
+ <table align="center" border="0" cellspacing="0" cellpadding="0" width="500">
157
+ <tr>
158
+ <td align="center" valign="top" width="500">
159
+ <![endif]-->
160
+ <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 520px;"
161
+ class="responsive-table">
162
+ <tr>
163
+ <td>
164
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
165
+ <tr>
166
+ <td>
167
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
168
+ <tr>
169
+ <td align="center"
170
+ style="padding: 32px 0 0 0; font-size: 18px; line-height: 25px; font-family: Helvetica, Arial, sans-serif; color: #3F414F;"
171
+ class="padding-copy">
172
+ Cancer Immunologic Data Center (CIDC)</td>
173
+ </tr>
174
+ <tr>
175
+ <td align="center"
176
+ style="padding: 50px 32px 0 32px; line-height: 42px; font-family: Helvetica, Arial, sans-serif; color: #666666;">
177
+ <h1 style="margin:0; mso-line-height-rule:exactly; padding: 0 32px 0 32px">
178
+ $HEADING
179
+ </h1>
180
+ </td>
181
+ </tr>
182
+ <tr>
183
+ <td align="center"
184
+ style="padding: 40px 40px 40px 40px; font-size: 16px; line-height: 25px; font-family: Helvetica, Arial, sans-serif; color: #666666;"
185
+ class="padding-copy">
186
+ $CONTENT
187
+ </td>
188
+ </tr>
189
+ </table>
190
+ </td>
191
+ </tr>
192
+ </table>
193
+ </td>
194
+ </tr>
195
+ </table>
196
+ <!--[if (gte mso 9)|(IE)]>
197
+ </td>
198
+ </tr>
199
+ </table>
200
+ <![endif]-->
201
+ </td>
202
+ </tr>
203
+ <tr>
204
+ <td align="center" style="padding: 20px 0px;">
205
+ <!--[if (gte mso 9)|(IE)]>
206
+ <table align="center" border="0" cellspacing="0" cellpadding="0" width="500">
207
+ <tr>
208
+ <td align="center" valign="top" width="500">
209
+ <![endif]-->
210
+ <table bgcolor="#1B6B82" width="100%" border="0" cellspacing="0" cellpadding="0" align="center"
211
+ style="max-width: 520px; " class="responsive-table">
212
+ <tr>
213
+ <td align="center"
214
+ style="padding: 20px 0 0 0; font-size: 18px; line-height: 18px; font-family: Helvetica, Arial, sans-serif; color:#fff; text-align: center">
215
+ Need help?
216
+ </td>
217
+ </tr>
218
+ <tr>
219
+ <td align="center"
220
+ style="padding: 10px 0 20px 0; font-size: 14px; line-height: 18px; font-family: Helvetica, Arial, sans-serif; color:#fff; text-align: center">
221
+ Send us an email at <a href="mailto:ncicidcadmin@mail.nih.gov">ncicidcadmin@mail.nih.gov</a>
222
+ </td>
223
+ </tr>
224
+ </table>
225
+ <!--[if (gte mso 9)|(IE)]>
226
+ </td>
227
+ </tr>
228
+ </table>
229
+ <![endif]-->
230
+ </td>
231
+ </tr>
232
+ <tr>
233
+ <td align="center" style="padding: 20px 0px;">
234
+ <!--[if (gte mso 9)|(IE)]>
235
+ <table align="center" border="0" cellspacing="0" cellpadding="0" width="500">
236
+ <tr>
237
+ <td align="center" valign="top" width="500">
238
+ <![endif]-->
239
+ <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="max-width: 520px; "
240
+ class="responsive-table">
241
+ <tr>
242
+ <td align="center"
243
+ style="padding: 10px 0 20px 0; font-size: 14px; line-height: 18px; font-family: Helvetica, Arial, sans-serif; color:#666666;">
244
+ National Cancer Institute at the National institutes of Health
245
+ </td>
246
+ </tr>
247
+ </table>
248
+ <!--[if (gte mso 9)|(IE)]>
249
+ </td>
250
+ </tr>
251
+ </table>
252
+ <![endif]-->
253
+ </td>
254
+ </tr>
255
+ </table>
256
+ </body>
257
+
258
+ </html>
cidc_api/shared/emails.py CHANGED
@@ -1,11 +1,12 @@
1
1
  """Template functions for CIDC email bodies."""
2
2
 
3
3
  import html
4
+ import pathlib
4
5
  from functools import wraps
5
6
  from typing import List
6
7
 
7
8
  from . import gcloud_client
8
- from ..config.settings import ENV
9
+ from ..config.settings import ENV, ALLOWED_CLIENT_URL, CIDC_CLINICAL_DATA_EMAIL, CIDC_ADMIN_EMAIL
9
10
 
10
11
  # emails this list for
11
12
  # - new user registration,
@@ -44,7 +45,7 @@ def confirm_account_approval(user) -> dict:
44
45
  html_content = f"""
45
46
  <p>Hello {user.first_n},</p>
46
47
  <p>
47
- Your CIMAC-CIDC Portal account has been approved!
48
+ Your CIMAC-CIDC Portal account has been approved!
48
49
  To begin browsing and downloading data, visit https://cidc.nci.nih.gov.
49
50
  </p>
50
51
  <p>
@@ -150,3 +151,32 @@ def notify_mailing_list(subject: str, html_content: str) -> dict:
150
151
  "html_content": html_content,
151
152
  }
152
153
  return email
154
+
155
+
156
+ with open(pathlib.Path(__file__).parent.joinpath("email_layout.html"), encoding="utf-8") as file:
157
+ EMAIL_LAYOUT = file.read()
158
+
159
+
160
+ @sendable
161
+ def new_validation_review(job: dict) -> dict:
162
+ # these two emails are set only in prod env file
163
+ if CIDC_CLINICAL_DATA_EMAIL and CIDC_ADMIN_EMAIL:
164
+ to_emails = [CIDC_CLINICAL_DATA_EMAIL, CIDC_ADMIN_EMAIL]
165
+ else:
166
+ to_emails = CIDC_MAILING_LIST
167
+
168
+ subject = f"Trial {job.trial_id} ({job.version}) Ready for Validation Review"
169
+ html_heading = "Clinical Data Upload Notification"
170
+ job_url = f"{ALLOWED_CLIENT_URL}/upload-clinical-data/{job.id}"
171
+
172
+ html_content = f"""
173
+ <b>Ready for Validation Review:</b><br>
174
+ <b><a class="blue-link" href={job_url}>Trial {job.trial_id} version {job.version} (Job ID {job.id})</a></b>
175
+ Please follow the link to access the trial's clinical data submission page.
176
+ """
177
+
178
+ return {
179
+ "to_emails": to_emails,
180
+ "subject": subject,
181
+ "html_content": EMAIL_LAYOUT.replace("$HEADING", html_heading).replace("$CONTENT", html_content),
182
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.2.12
3
+ Version: 1.2.14
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=v8PmdR_MSmizuV1VaEX24QR0XHzIZ4jn69r6PwxAxV8,4512
5
+ cidc_api/config/settings.py,sha256=ttOGvk_6zVMn4dtxIZ2-0w3wF2fpAUVfGpVZbKJ2b6s,4653
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
@@ -12,13 +12,14 @@ cidc_api/models/files/details.py,sha256=sZkGM7iEV4-J6IDQCdiMV6KBDLbPxCOqUMaU3aY9
12
12
  cidc_api/models/files/facets.py,sha256=RZoe0FadRGJw8_-jzJQkc4dIVSuaYlunNrsopb2dYho,33325
13
13
  cidc_api/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  cidc_api/shared/auth.py,sha256=PHqmVGkqDjbmUofytVFwD_9ssgUomESl3fFtFHPwZYQ,9062
15
- cidc_api/shared/emails.py,sha256=HQIixEUsR8yyu7Iv8S81RjtvEQeGuzQHzBfGsWIfP7k,4961
15
+ cidc_api/shared/email_layout.html,sha256=pBoTNw3ACHH-ncZFaNvcy5bXMqPwizR78usb0uCYtIc,7670
16
+ cidc_api/shared/emails.py,sha256=8kNFEaSnKpY-GX_iE59QUhSp3c4_uzy3SpHYt2QjuqI,6121
16
17
  cidc_api/shared/file_handling.py,sha256=4xkekdrzxWsfmfBtWpylyDMT98ICjQwx1meqqh1FAis,4103
17
18
  cidc_api/shared/gcloud_client.py,sha256=BaoYv-lWWLwdZvyRjCWCyAyZMXtqlT8IPJpw9XDODCY,37210
18
19
  cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
19
20
  cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
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,,
21
+ nci_cidc_api_modules-1.2.14.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
22
+ nci_cidc_api_modules-1.2.14.dist-info/METADATA,sha256=ZakYALmLXm_ZRvlei9iPepmlAHM57R38qKCdyeSuHyI,39539
23
+ nci_cidc_api_modules-1.2.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ nci_cidc_api_modules-1.2.14.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
25
+ nci_cidc_api_modules-1.2.14.dist-info/RECORD,,