A python script to process NHS Covid Test Emails and output results to a CSV. Built in a weekend to help out a friend
The script works as follows:
- Connects to an instance of Microsoft Outlook running locally via the win32com library
- Looks through email folders as specified in the configuation file "site_list.json"
- Identifies email templates (Positive + Negative Results For PCR + Lateral Flow Tests, Kit Registration Emails)
- Extracts key fields per template
- Exports results to csv file
- Download and extract the files from the github repository
- Double click the "CovidEmailProcessor.exe" file to run the script
The site_list_prod.json file is used to tell the script which outlook accounts + folders it needs to search through for Covid Test Emails.
JSON is a type of text format for transferring and storing data. The site_list.json file contains a list of configurations in the JSON format.
Each of the sets of { } brackets in the list (the [ ] brackets) contains the configuration information for a single site.
An example of a configuration file can be found below.
[ {
"Site_Name": "Reading",
"Email_Account": "[email protected]",
"Folder_Path": "Inbox/Factory Workers/Reading Central"
} ]
The Site_Name is the name of the test site the email folder corresponds to.
Email_Account is the logged in email_account containing the folder + emails.
Folder_Path is the path to the location of the folder. The folder path "Inbox/Factory Workers/Reading Central" is saying to the script. The emails to process for this site are in the "Reading Central" folder inside the "Factory Workers" folder inside the "Inbox" folder.