I love the idea of the Quantified Self movement. I love collecting data, trying to see connections and monitoring my self improvement process. I’ve been collecting GPX traces while running for quite a while, so it isn’t all that unexpected that the fitbit was a gadget that was right up my alley. It allows you to record the amount of steps you take like every other pedometer, but thanks to a few more sensors, it also can tell you how many floors you’ve climbed, how many kilometers ou traveled and even how often you worke up while sleeping.
It syncs wirelessly, the battery lasts a long time and it is small enough that it isn’t an annoyance to carry arround all day.
The only downside is the webservice itself. It’s not that I dislike their site itself, quite to the contrary. The annoying part is that I’d have to subscribe to their premium plan to get a hold of my raw data. I’m not actually looking to use any of the other premium features, so just paying 50$/yr because they hold my data hostage was kind of a pain.
The nice part however is, that they provide an API that allows you to programmatically grab at least an overview of activity and sleep stats. It misses the actual timeframes (“you walked 1000 steps between 3 and 3,15”, “you woke up at 3, 3:45 and 5”) but it provides you with an ok summary (steps per day, fell asleep at time x, …).
I was a bit afraid that I’d have to screen scrape their site to get to my data, but not only didn’t I have to do that, I also didn’t have to deal with the oauth stuff myself either.
Zachery Moneypenny (“whazzmaster”) had already created a client library for their API and provided a bit of sample code.
Using that library I was able to whip up a quick incremental backup script that saves the activities and sleep data as something machine readable.
This is an example of what the activity data looks like:
$ cat 2012_09_10_activities.yaml --- activities:  goals: activeScore: 1000 caloriesOut: 3092 distance: 8.05 floors: 10 steps: 10000 summary: activeScore: 762 activityCalories: 1362 caloriesOut: 2885 distances: - activity: total distance: 6.43 - activity: tracker distance: 6.43 - activity: loggedActivities distance: 0 - activity: veryActive distance: 2.25 - activity: moderatelyActive distance: 3.36 - activity: lightlyActive distance: 0.81 - activity: sedentaryActive distance: 0 elevation: 9.14 fairlyActiveMinutes: 102 floors: 3 lightlyActiveMinutes: 139 marginalCalories: 913 sedentaryMinutes: 651 steps: 8114 veryActiveMinutes: 33
And the sleep data:
$ cat 2012_09_10_sleep.yaml --- sleep: - awakeningsCount: 8 duration: 30900000 efficiency: 97 isMainSleep: true logId: 16236289 minutesAfterWakeup: 1 minutesAsleep: 471 minutesAwake: 16 minutesToFallAsleep: 27 startTime: '2012-09-10T00:56:00.000' timeInBed: 515 summary: totalMinutesAsleep: 471 totalSleepRecords: 1 totalTimeInBed: 515
You can find the script in my github repo. It’s not properly packaged and the Readme could use some polish, but this is more of a ‘scratching my own itch’ thingy that I thought might just save somebody 15 minutes.