Email Notifications
Stakeholders are interested in the progress of samples as they move through a workflow. E-mail alerts of events can provide them with real-time notifications.
Some possible uses of notifications include the following:
Completion of a workflow for billing department
Manager review requests
Notice of new files added via the Collaborations Lablink Interface
Updates on samples that are not following a standard path through a workflow
Clarity LIMS provides a simple way of accomplishing this using a combination of the Clarity LIMS API, EPP / automation triggers, and Simple Mail Transfer Protocol (SMTP).
Solution
The send_email() method uses the Python smptlib module to create a Simple Mail Transfer Protocol (SMPT) object to build and send the email. The attached script does the following:
Gathers relevant data from the Clarity LIMS API endpoints.
Generates an email body according to a template.
Calls the send_email() function.
Mail Server Configuration
Connect to Clarity SMTP with:
host='localhost', port=25
Because of server restrictions, the script can send emails from only:
noreply.clarity@illumina.com
Automation Parameters
The automation / EPP command is configured to pass the following parameters:
-u
The username of the current user (Required)
-p
The password of the current user (Required)
-s
The URI of the step that launches the script (Required)
Example command line:
User Interaction
The script can be executed using a Clarity LIMS automation / EPP command, and trigged by one of the following methods:
Manually, via a button on the Record Details screen.
Automatically, at a step milestone (on entry to or exit from a screen).
The script can also be triggered outside of a Clarity LIMS workflow, using a time-based job scheduler such as cron.
Assumptions and Notes
You are running a version of Python that is supported by Clarity LIMS, as documented in the Clarity LIMS Technical Requirements.
The example code is provided for illustrative purposes only. It does not contain sufficient exception handling for use 'as is' in a production environment.
Attachments
emails_from_clarity.py:
emails_attachmentPOC.py:
Last updated