Fitness Tracking Platform: Update on Progress
Last August, I enthusiastically blogged about an idea I had for creating a Fitness Tracking Platform; personal informatics for fitness. Since that time I’ve been gradually making progress and am getting closer to fulfilling that original vision. I figured I would do a quick writeup and share some of the progress I’ve made, and layout a simple roadmap for taking it to the next level. For right now I have some screenshots I can share. In the coming weeks I plan on putting up an actual demo application, and may release a large portion of the code as open source. Ultimately, I still need to figure out what I plan to do with it, but my immediate goal is to build something that is practical and useful for myself. The original idea started out to mainly track fitness related data (and that’s primarily what I’ve been doing), but the application for this could apply generically to any form of self tracking. It’s possible this could be one of the earliest efforts to create an open source application for personal tracking (see the Quantified Self list of software).
What’s Been Done So Far?
If you look at the original diagram I created, there where a few different components to this tracking platform (local storage, data collection scripts/api integration, and the presentation layer).
- Local Storage – Personal copy of data stored in MySQL. I created the local storage piece almost immediately after writing the article in Aug. I chose to use MySQL as a database, and created a schema that was suited towards collecting my initial data set of interest: data from my FitBit and WiThings scale. The schema accounts for storing both daily and intraday activity for calories burned/consumed, activity score (+very active, moderately active, and lightly active), total distance, steps taken, sleep, and weight. I’ve now created about a dozen or so SQL queries that will generate useful reports on this historical data.
- Data collection scripts/API Integration. I immediately leveraged the Perl FitBit API I originally wrote last April to sync data from the FitBit site to my local database. I created a nightly cron job that will request the daily + intraday stats and save to the db using Perl::DBI. I also took a similar approach with the WiThings scale. Although I haven’t created a Perl wrapper yet for Withings, they do publish and easy to use REST API for getting access to your weight. This script also runs on a nighly basis and saves weight information to the local database.
- Presentation Layer. This has been the most complicated piece so far. I’ve created a Java-based webapp using Spring 3.0/Jetty to build the analytics UI. For now the UI is built with 2 major views: a dashboard, and reporting interface. The dashboard displays both historical and daily information in a visually-pleasing format using Google Charts. You can see a daily snapshot (+ weekly, quarterly, and yearly views) and see stats on your activity, distance, steps taken, weight, sleep and intraday stats (activity and sleep level on an hourly basis). I’ve also built a light home-grown reporting interface that integrates with the Google Visualization API and easily builds dynamic tables and charts based on the provided SQL queries.
- Dashboard View
- Historical Stats – Multiple Activity Logs
- Historical Stats – Distance Bar Chart
- Daily Stats
- Intraday Stats
Immediate Next Steps?
The current code is fairly stable and mostly ready for a demo. Before I make it live I’m planning on adding a few major features:
- Geo-Location support – I’ve been tracking GPS coordinates since I purchased my QStarz device in September. I’m thinking of adding a couple Map and GPS tracklog views to the Dashboard. And, this could lead to some interesting location-based reporting as well. I have a ton of saved .gpx files, so it’s a matter of writing an integration script to parse and store in the db. And, some lightweight presentation layer to dynamically generate .KML and overlay on top of Google Maps.
- Simple mobile interface. I’d like to be able to access the interface using my iPhone and having some light interface to get quick stats and graphs would be nice.
- Come up with a catchy project name. As I stated earlier, although the original scope of this was for fitness tracking, this type of platform can be used for tracking any type of personal statistics.
- Tracking detailed sleep info from MyZeo. Since I wrote the original vision I had the chance to do a review for the MyZeo sleep device. I’ve also created a Perl API so it’s simply a matter of writing the integration script to start recording in the MySQL DB.
- Tracking workout info from my iPhone app – iFitness. I also have about 10 years worth of workout information either stored from previous products (like CrossTrainer) or written down.
- Tracking heartrate info from my Garmin heartrate monitor watch.
- Integrate with the new official Fitbit API. Since I wrote my initial (unofficial) Perl API, fitbit has embraced the developer community and released a support API (yes!)