A Python email automation system for sending customizable reminders to participants at different timepoints throughout a study
MIT License
AutoRemind is a Python email automation system for sending customizable reminders to participants at different timepoints throughout a study.
Check out AutoCalendar too!
This code was written for a very specific study protocol after a personally exasperating experience of manually emailing participants 😄 This system will be useful if your study is longitudinal and comprises of
autoremind.py
has this as an email reminder to complete a health and travel declaration form on the morning of the experiment.The example csv files in this repository are meant to facilitate trial-and-error with AutoRemind. Simply change the email
entries in the csv files to your own email address to receive templates of the messages as laid out in autoremind.py
. You would also need to have a secret.py
file containing your gmail credentials. If an authentication error occurs, it is most likely because you have to change the settings in your gmail account to allow access to less secure apps.
Two separate files containing information of participants who are eligibile vs. ineligible (example_eligible.csv
and example_ineligible.csv
respectively)
One file containing information of scheduled participants:
If you have more than two sessions in your experiment, you can customize your own code to include them.
get_new()
: extracts email addresses of unread emailsget_participants()
: imports csv files for eligible, non-eligible, and scheduled participantstarget_eligibility()
identifies participants to be informed for being eligibility or non-eligible, with the ability to exclude participants who were already informed before.target_confirmation()
identifies participants who have been scheduled and need to be confirmed of their slots (if the column Timeslots Confirmed is No)target_participants()
identifies participants that need to be sent reminders today or tomorrow.send_research_info()
: send emails to new email addresses regarding research participation informationsend_inform_eligible()
: send emails to participants based on whether they were eligible or notsend_session_confirmation()
: send emails to seek confirmation of session slots from participantssend_session_reminder()
: send reminder email one day before respective sessions (for now, the code accommodates only Session 1 and Session 2)send_declaration_form()
: send health and travel (for COVID-19) declaration forms on the day of the sessionThese functions are then wrapped in autoremind()
, which you can choose to control the sending of a certain type of emails.
Running autoremind.py
will mass send the desired mails to your participants together with printed feedback on how many subjects and exactly who were contacted, like so:
send_reminders
, send_eligible
and send_forms
to True
. Once you're happy with the customization, you can execute the sending.autoremind(participants_list, silent=False, send_research=False, send_eligible=True, send_reminders=True, send_forms=True)
### Printed feedback ###
2 eligible participants contacted.
3 ineligible participants contacted.
Sending successful eligibility outcome to: ['Subject11', 'Subject12']
Sending unsuccessful eligibility outcome to: ['Subject19', 'Subject20', 'Subject21']
one day before: No session 1 participants to be contacted.
one day before: 1 participants to be contacted for session 2.
Sending reminder emails to: ['Subject_3'].
experiment day: No session 1 participants to be contacted.
experiment day: 2 participants to be contacted for session 2.
Sending health and travel declaration forms to: ['Subject_1', 'Subject_2']
send_research=True
.
autoremind(participants_list, silent=False, send_research=True, send_eligible=False, send_reminders=False, send_forms=False)
### Printed feedback ###
Retrieving unread emails
Sending research recruitment information to: ['[email protected]', '[email protected]']
True
or False
to activate only certain types of email actions. Defaults to False
otherwise.