Tuesday, February 18, 2014

Working Patterns

Problem statement: María is on online Spanish teacher and she was trying to figure out the best weekly schedule to be available for her European students including when she could happily block out personal time (without losing valuable business). She had a gut feel about her busy times of the week but had done no objective analysis up until now. With a few years of data in her work Google Calendar we set about looking for plugins that would let us visualise her working patterns but to no avail.

If you use Google Calendar for your work appointments there's a quick hack below to get a distribution of your busiest times of the week we have come up with. It's not fully automated or too fine grained but hey... we'd welcome any suggestions/improvements.. (there's probably tonnes of prettier, faster, shorter and more accurate programmatic ways to do this!).

Step 1. Download your private "ICAL" .ics file via clicking your private calendar ICAL icon under calendar settings/details and then right click the URL to save the .ics file locally on your machine.

Step 2. Run this bash one liner below on a linux box (as you need to use the coreutils date for the arguments used):
grep "DTSTART:" yourcalendar_file.ics | cut -d ':' -f2 | awk '{print substr($0,1,4)"-"substr($0,5,2)"-"substr($0,7,2)" "substr($0,10,2)":"substr($0,12,2)":00"}'|while read line; do date --date="$line" "+%a %H"; done | sort | uniq -c | sort -k2,2 -k3 > results.txt
Step 3.  Manually enter the results in https://infogr.am/ using a stacked column chart to achieve the graph below!

No comments: