-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
314 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from enum import Enum | ||
from flask import render_template | ||
from werkzeug.exceptions import BadRequest | ||
from microsetta_private_api.model.log_event import EventType, EventSubtype | ||
|
||
|
||
class EmailTemplate: | ||
def __init__(self, filepath, required): | ||
self.filepath = filepath | ||
self.required = required | ||
|
||
def render(self, template_args): | ||
for key in self.required: | ||
if key not in template_args: | ||
raise BadRequest("Missing Required Argument: " + str(key)) | ||
return render_template(self.filepath, **template_args) | ||
|
||
|
||
class EmailMessage(Enum): | ||
incorrect_sample_type = ( | ||
"Incorrect Sample Type", | ||
"email/incorrect_sample_type.jinja2", | ||
"email/incorrect_sample_type.plain", | ||
("contact_name", "sample_barcode", "recorded_type", "received_type", | ||
"resolution_url"), | ||
EventType.EMAIL, | ||
EventSubtype.EMAIL_INCORRECT_SAMPLE_TYPE | ||
) | ||
missing_sample_info = ( | ||
"Missing Sample Info", | ||
"email/missing_sample_info.jinja2", | ||
"email/missing_sample_info.plain", | ||
("contact_name", "sample_barcode", "received_type", "resolution_url"), | ||
EventType.EMAIL, | ||
EventSubtype.EMAIL_MISSING_SAMPLE_INFO | ||
) | ||
|
||
def __init__(self, subject, html, plain, required, event_type, event_sub): | ||
self.subject = subject | ||
self.html = EmailTemplate(html, required) | ||
self.plain = EmailTemplate(plain, required) | ||
self.event_type = event_type | ||
self.event_subtype = event_sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
microsetta_private_api/templates/email/incorrect_sample_type.jinja2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<style type="text/css">ol{margin:0;padding:0}table td,table th{padding:0}.c2{background-color:#ffffff;margin-left:72pt;padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left;height:11pt}.c1{background-color:#ffffff;margin-left:36pt;padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left}.c3{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:11pt;font-family:"Arial";font-style:normal}.c0{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:12pt;font-family:"Arial";font-style:normal}.c6{color:#000000;font-weight:700;text-decoration:none;vertical-align:baseline;font-family:"Arial";font-style:normal}.c8{padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left}.c10{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}.c9{background-color:#ffffff;margin-left:72pt}.c7{font-weight:700}.c5{height:11pt}.c11{margin-left:36pt}.c4{font-size:12pt}.title{padding-top:0pt;color:#000000;font-size:26pt;padding-bottom:3pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}.subtitle{padding-top:0pt;color:#666666;font-size:15pt;padding-bottom:16pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}li{color:#000000;font-size:11pt;font-family:"Arial"}p{margin:0;color:#000000;font-size:11pt;font-family:"Arial"}h1{padding-top:20pt;color:#000000;font-size:20pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h2{padding-top:18pt;color:#000000;font-size:16pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h3{padding-top:16pt;color:#434343;font-size:14pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h4{padding-top:14pt;color:#666666;font-size:12pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h5{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h6{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;font-style:italic;orphans:2;widows:2;text-align:left}</style> | ||
</head> | ||
<body class="c10"> | ||
|
||
<p class="c1"> | ||
<span class="c0">Hello {{contact_name |e}},</span> | ||
</p> | ||
<p class="c1"><span class="c0"> </span></p> | ||
<p class="c8 c9"> | ||
<span class="c0">We recently received the following sample from you and noticed that the sample type may have been incorrectly assigned. To update the sample type, please click on the link below.</span> | ||
</p> | ||
<p class="c2"><span class="c0"></span></p> | ||
<p class="c8 c9"> | ||
<ul class="c8 c9"> | ||
<li><span class="c0"> <a href={{resolution_url}} target="_blank">{{sample_barcode |e}}</a> - Marked {{recorded_type |e}} but appears to be {{received_type |e}}</span></li> | ||
</ul> | ||
</p> | ||
<p class="c2"> | ||
<span class="c0"></span> | ||
</p> | ||
<p class="c8 c9"> | ||
<span class="c0">The sample type determines how the sample is handled in the lab, and ultimately how the sample results are assessed. We cannot process the sample until the sample type is verified.</span> | ||
</p> | ||
<p class="c8 c9"><span class="c0"> </span></p> | ||
<p class="c8 c9"> | ||
<span class="c4">If you believe {{received |e}} is correct, then please confirm with us at <a href = "mailto: microsetta@ucsd.edu">microsetta@ucsd.edu</a> by replying to this email. We will then update your information so the sample can be appropriately associated.</span> | ||
</p> | ||
<p class="c1 c5"><span class="c0"></span></p> | ||
<p class="c1"> | ||
<span class="c0">If you have any questions, please reply to us at <a href = "mailto: microsetta@ucsd.edu">microsetta@ucsd.edu</a>. Thank you for supporting our project.</span> | ||
</p> | ||
<p class="c1"><span class="c0"> </span></p> | ||
<p class="c1"> | ||
<span class="c0">Sincerely,</span> | ||
</p> | ||
<p class="c8 c11"> | ||
<span class="c4">The Microsetta Team</span> | ||
</p> | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
microsetta_private_api/templates/email/incorrect_sample_type.plain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Hello {{contact_name |e}}, | ||
We recently received the following sample from you and noticed that the sample type may have been incorrectly assigned. | ||
|
||
Barcode {{sample_barcode |e}} - Marked {{recorded_type |e}} but appears to be {{received_type |e}} | ||
|
||
The sample type determines how the sample is handled in the lab, and ultimately how the sample results are assessed. We cannot process the sample until the sample type is verified. If you believe {{received |e}} is correct, then please confirm with us at microsetta@ucsd.edu by replying to this email. We will then update your information so the sample can be appropriately associated. | ||
|
||
If you have any questions, please reply to us at microsetta@ucsd.edu. | ||
|
||
Thank you for supporting our project. | ||
|
||
Sincerely, | ||
The Microsetta Team |
53 changes: 53 additions & 0 deletions
53
microsetta_private_api/templates/email/missing_sample_info.jinja2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<style type="text/css">ol{margin:0;padding:0}table td,table th{padding:0}.c2{background-color:#ffffff;margin-left:72pt;padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left;height:11pt}.c1{background-color:#ffffff;margin-left:36pt;padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left}.c3{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:11pt;font-family:"Arial";font-style:normal}.c0{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:12pt;font-family:"Arial";font-style:normal}.c6{color:#000000;font-weight:700;text-decoration:none;vertical-align:baseline;font-family:"Arial";font-style:normal}.c8{padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left}.c10{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}.c9{background-color:#ffffff;margin-left:72pt}.c7{font-weight:700}.c5{height:11pt}.c11{margin-left:36pt}.c4{font-size:12pt}.title{padding-top:0pt;color:#000000;font-size:26pt;padding-bottom:3pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}.subtitle{padding-top:0pt;color:#666666;font-size:15pt;padding-bottom:16pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}li{color:#000000;font-size:11pt;font-family:"Arial"}p{margin:0;color:#000000;font-size:11pt;font-family:"Arial"}h1{padding-top:20pt;color:#000000;font-size:20pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h2{padding-top:18pt;color:#000000;font-size:16pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h3{padding-top:16pt;color:#434343;font-size:14pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h4{padding-top:14pt;color:#666666;font-size:12pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h5{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h6{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;font-style:italic;orphans:2;widows:2;text-align:left}</style> | ||
</head> | ||
<body class="c10"> | ||
<p class="c1 c5"><span class="c0"></span></p> | ||
<p class="c1"> | ||
<span class="c0">Hello {{contact_name |e}},</span> | ||
</p> | ||
<p class="c1"><span class="c0"> </span></p> | ||
<p class="c8 c9"> | ||
<span class="c4">Thank you for your interest and participation in The Microsetta Initiative. We are writing as we've encountered an issue processing your sample, and we would appreciate your assistance in helping to resolve this matter. Specifically, the following sample sent to the lab does not have </span> | ||
<span class="c4">a recorded sample type, date or time. Please click on the URL below to update the sample information.</span> | ||
</p> | ||
<p class="c2"><span class="c0"></span></p> | ||
<p class="c8 c9"> | ||
<ul class="c8 c9"> | ||
<li><span class="c0"><a href={{resolution_url}} target="_blank">{{sample_barcode |e}}</a></span></li> | ||
</ul> | ||
</p> | ||
<p class="c2"> | ||
<span class="c0"></span> | ||
</p> | ||
<p class="c8 c9"> | ||
<span class="c0">We require this information in order to process this sample in compliance with our human subjects research protocol. If you have a record of the associated sample type, date, and time for this sample, please provide us with this information. Based on what we can see, the sample type appears to be:</span> | ||
</p> | ||
<p class="c8 c9"> | ||
<span class="c0"> </span> | ||
</p> | ||
<p class="c8 c9"> | ||
<ul class="c8 c9"> | ||
<li><span class="c0"><a href={{resolution_url}} target="_blank">{{sample_barcode |e}}</a> – {{received_type |e}}</span></li> | ||
</ul> | ||
</p> | ||
<p class="c8 c9"> | ||
<span class="c0"> </span> | ||
</p> | ||
<p class="c8 c9"> | ||
<span class="c0">If you believe {{received_type |e}} is correct, then please confirm with us at <a href = "mailto: microsetta@ucsd.edu">microsetta@ucsd.edu</a> by replying to this email. And if you have an approximate date and time of sample collection, we would greatly appreciate your sharing this information. We will then update your sample's information so it can be appropriately associated. Alternatively, if you would like to update the sample information directly, please click the link above to do so.</span> | ||
</p> | ||
<p class="c1 c5"> | ||
<span class="c0"></span> | ||
</p> | ||
<p class="c1"> | ||
<span class="c0">If you have any questions, please reply to us at <a href = "mailto: microsetta@ucsd.edu">microsetta@ucsd.edu</a></span> | ||
</p> | ||
<p class="c1"><span class="c0"> </span></p> | ||
<p class="c1"><span class="c0">Thank you,</span></p> | ||
<p class="c8 c11"><span class="c0">The Microsetta Team</span></p> | ||
|
||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
microsetta_private_api/templates/email/missing_sample_info.plain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Hello {{contact_name |e}}, | ||
Thank you for your interest and participation in The Microsetta Initiative. We are writing as we've encountered an issue processing your sample, and we would appreciate your assistance in helping to resolve this matter. | ||
|
||
Specifically, the following sample sent to the lab does not have a recorded sample type, date or time: | ||
Barcode {{sample_barcode |e}} | ||
|
||
We require this information in order to process this sample in compliance with our human subjects research protocol. If you have a record of the associated sample type, date, and time for this sample, please provide us with this information. | ||
|
||
Based on what we can see, the sample type appears to be: | ||
Barcode {{sample_barcode |e}}: {{received_type |e}} | ||
|
||
If you believe {{received_type |e}} is correct, then please confirm with us at microsetta@ucsd.edu by replying to this email. And if you have an approximate date and time of sample collection, we would greatly appreciate your sharing this information. We will then update your sample's information so it can be appropriately associated. | ||
|
||
If you have any questions, please reply to us at microsetta@ucsd.edu | ||
|
||
Thank you, | ||
The Microsetta Team |
Oops, something went wrong.