Saturday 13 January 2018

Automating e-mail report

The Requirement:

So I am a core team member of a soon to start local running event and when people reach a certain number of events they are able to get a special mention for reaching a target. Turns out that there is no built in functionality on the standard website to tell us who is about to reach this milestone. as it stands it is a manual process to work out who is going to be celebrating. 

The Solution

Now their data cannot be scraped but as I am only using this for the good of the event and in terms of data protection it is just a bunch of name that is all publicly available on the internet.  

So I developed a process where by all I have to do it copy the data from the internet to a spreadsheet and it will.

  1. Load the data into a dataframe 
  2. Load the dataframe into SQL Server 
  3. Process the data in SQL server adding it to the historic results table
  4. Extract the latest runs for all runners 
  5. Filter the latest runs to just those who are a single run away from a target run. 
  6. Extract this list to an e-mail and send to the relevant core team members 
There is also functionality to ignore certain results so that if someone visits our run on the run before their target run we won't keep getting them in an e-mail every week.

The conclusion

So basically what for other events is a manual process that is open to error I have now automated for us so that I have to do 30 seconds work each week and we can make sure that everyone gets to celebrate their special run. 

No comments:

Post a Comment