Hacking your RunKeeper data

This week I’ve started running/jogging, and I’m using RunKeeper on my iPhone to track my progress.

RunKeeper stores all the GPS data from your runs. This data is displayed per run, including a nice map of your route. Most important data can be reached throught the web interface, things like pace (min/km or min/mile) and distance. The most rewarding thing in running is breaking your own records, and RunKeeper has a couple of records:

Longest run (distance)

Longest run (time)

Most calories burned in a run

Fastest average pace

etc

As you can see, all those statistics are about single runs, what I’m missing are the following records:

Fastest 1 KM, 3 KM, 5K, 10K etc.

For example, when I’ve run a very fast 5.5 km run, I’d love to see this reflected as my 5K personal record, but right now it is lost because I’ve already done a slow 6 km run and a very fast 1 km sprint.

Export data

But luckily RunKeeper has a very useful option for us developers: Settings > Export data.
This results in a ZIP file with GPX files, raw GPS data with time and location!

JAXB

The first thing I did was download the XSD and generate the JAXB Java code:

The next thing I did was translate the lat+long+time waypoints into ‘legs’ consisting of meters+seconds.
Those legs can be used to check for a record during longer runs, like this:

@Overridepublicvoidanalyze(List<Leg>legs){List<Leg>cache=newArrayList<Leg>();doublerunningDistance=0.0;for(Legleg:legs){//Add next leg to the tail:
cache.add(leg);runningDistance+=leg.getMeters();//If possible remove from head:
while((runningDistance-cache.get(0).getMeters())>targetDistance){runningDistance-=cache.remove(0).getMeters();}if(runningDistance>targetDistance){//Check if the current target distance time is a record:
checkTime(cache);}}}

For example using a target of 5000 meters in a 5070 meter run, this analysis finds the following 5K times:

I couldn’t believe this feature wasn’t available in RunKeeper… but after a lot of Googling it turns out a lot of other people are looking for this ‘most requested’ feature! With a little bit of Java (100 lines of code) you can get a pretty good result:

I’m now thinking of making a simple JavaScript application (no backend) that uses the RunKeeper export zip file as input and displays a lot of additional data. Are you interested in this? Please drop a comment and convince me to make this for you guys and girls!