Importing Oyster Card records into Google Calendar

This is a code post – I’m sharing some code I wrote for importing Oyster card information into Google calendar in case other people might enjoy it.  The github is here. As I’ve posted about before in various places, I’ve got an interest in self-tracking. I think that humans are adept at telling themselves lies about their lives and data is a good way of finding out the truth about yourself. I’d like to think I strive to be a better person, and collecting a small amount of data can do that, I’m in. Generally I like my tracking ‘set up once and look at periodically’. I’ve shared how I keep track of my inbox, and a few other bits of code, today we are going to look at transport. I live in centralish London – anywhere I’m going (with maybe three exceptions in the last year) involves me using my oyster card. Even when I’m leaving the city my oyster card is what gets me to places like Kings Cross and Euston where I generally collect my long distance tickets. This means that the records that Transport for London have are generally a pretty accurate record of where I am in the world.  I dislike the idea of TfL having that data without me being able to access it, so I wrote some code that converts the TfL format into a proper calendar format. Let me take you though the process. Once a month I download my Oyster Travel statement from the TfL website (I use contactless payment now because I can have one less thing to carry around – the code works with both the old and the new way of keeping records)

Screen Shot 2014-11-12 at 09.29.38
Using the java code that you will find at this git repository I run the command:
 java createcalendarevents/OysterProcessor
I select the file I downloaded:Screen Shot 2014-11-12 at 09.32.05
…save the output to a *.ics file and then open it with iCal on my mac. I get to choose the calendar I want to add it to:
Screen Shot 2014-11-12 at 09.33.09

This syncs up nicely with Google Calendar and ta-dah! I know where I was for a month.  Here, for an example, is the journeys I took for in a random week last year.  It might look like a diversion, but it’s a nice way of avoiding a bunch of the ways you might lie to yourself “I always leave in plenty of time”, “I go to the gym twice a week”, “I’m always home in time to see the kids before I they go to bed.  Worth finding out these things about yourself.

Screen Shot 2014-11-12 at 09.36.27

One thought on “Importing Oyster Card records into Google Calendar

Leave a Reply