Friday, July 10, 2009

Personal Stats

The recent popular trend in keeping stats on yourself seems to be peaking with a recent issue of Wired magazine focused on the topic.

Whether it be the Hawthorne effect or the Prius effect, I believe that using feedback in the form of personal stats can have a positive effect on your ability to control and understand your own behavior.

To me Buster Benson appears to be right on the leading edge of this whole field, with stats (and lovely charts) tracking many, many aspects of his life. I'm using his google spreadsheet to track my Infinite Summer. Matt Haughey also wrote a blog post that brought this into focus for me recently.

I've experimented with this stuff in various ways myself. In college I made a big chart on poster-board to track my sleep. More recently I tried using daytum to track my caffeine intake.

All these things are inspiring me to begin working again on an idea that i first had way back in '06.

I'm a big fan of Lifehacker - in particular the work of Gina Trapani and Adam Pash. Gina has written a nifty set of tools for todo tracking. One of those tools is an AIMbot that can interact with her todo.txt files. Adam later modified this bot to be a personal budget tracker.

I actually ran the budgetbot tool for a short time, but ultimately didn't use it enough. Later I modified it to be a gas mileage tracking bot. I sent it SMS messages everytime I filled up my tank, and a page on my website showed a nifty little graph of my MPG over time. Eventually I moved hosts or something and the code was lost.

Ever since that time I've had more and more ideas for ways to modify the bot to track various stats. I've never sat down and actually done it though. I'm putting this idea out there so that maybe I'll either do it finally, or inspire someone else to do it.

I'm imagining a general-purpose bot/service that can track all these different stats. I could of course just write one big uber-bot by continually hacking the existing bot, but the software engineer in me wants to break it up into a core with many plugins. And instead of simply using sms/AIM, it would have a trendy REST/XML/JSON API or something. Or maybe that would all be overkill.

Here are the ideas for "plugins" that I can see being useful and probably easy to implement:

TodoBot: The original. This is obivously the most mature, since it's already been done for several years.

BudgetBot: Also well defined due to being already done.


gas gallons miles [price] - adds an entry to the db
mpg - returns your most recent miles per gallon or maybe your current average mpg
bestmpg [n] - returns the all time best mpg you got in the last [n] months, default n=12
worstmpg [n] - returns the all time worst mpg you got in the last [n] days, default n=12



weight pounds - adds an entry to the db
weightavg [n] - returns your average weight over the last [n] days, default n=30
hiwieght [n] - returns your highest weight in the last [n] days, default n=alltime
loweight [n] - returns your lowest weight in the last [n] days, default n=alltime
trend - returns whether your weight trendline is pointing downward or upward


game score - adds a game's score to the db
gameavg [n] - returns your average score over the last [n] games
hiscore [n] - returns your best score in the last [n] days, default n=alltime
loscore [n] - returns your worst score in the last [n] days, default n=alltime
handicap - returns your calculated handicap

I think there is a general structure emerging (addnew, best, worst, average), but each one is slightly different.

I'm envisioning a basic storage structure (the existing bots use .txt files, but a real DB may be in order) that can be accessed in various ways. Building one generic interface to the data store allows the ability to put data into it and get data out of it in many different ways. I'm picturing everything from simple websites with forms and Google Charts, to Ubiquity/Quicksilver commands, to fancy Android apps.

I have a hunch that most of this can be accomplished using existing web services, but I need to research it more.