A while ago I bought myself a FitBit One to keep an eye on exactly how much I walk, it is a little expensive for a pedometer, but I liked the fact it syncs via Bluetooth 4 to a supplied dongle or to an iPhone. The data can be viewed on the dashboard on their site but also – and this is one of the things which attracted me to the FitBit – via an API. I’ve had it for a good while now and figured it was time to start looking into the API.
The first thing I wanted to do was get the historic data and save it somehow. I’ve got that bit working, I have a php script which is authenticated against my account and requests a given days data which is then saved as raw json to a text file.
I’ve no plans to do anything with this data yet, so json in a text file suits me fine. I can read it with pretty much anything and it is easy to backup.
I’ve put the initial simple code up on GitHub which you can see here.
Phil Gyford recently had a lovely idea of collating all the things geo tagged each day into a map for that day. It didnt take me long before I thought I’d have a go at doing this myself, it also gave me another reason to finally sit down and arrange some sort of backup of my Tweets and my FourSquare checkins.
This is all written in PHP, because well, that is what I know best. I write code very rarely, probably no more than once every year or two so I wasn’t up for learning a new language at the same time. The underpinnings of it all are a couple of scripts which get run every day and pull all of my tweets and checkins and store them locally. So most of what drives this map is actually just reading local files, rather than making API calls to the various services.
The first map below is from 2010-08-31 which is when I was down on the Isle of Wight.
Improvements I’d like to make
- The marker icons ought to differentiate between checkins and tweets
- More info shown in the boxes which appear when you click the markers, date/text maybe a thumb of an image if I included one in a tweet
- This uses the Google maps API V2, which is deprecated, I need to update it to use V3 at some point.
- Possibly have something automatically add a post to WordPress everyday. Although that might be a bit much for the front page. I’ll have to investigate options there I think.
I’d like to be able to add these enhancements soonish, free time permitting. And