Sunday, September 30, 2012

Personal analytics with Selfspy and Google Spreadsheets

In the spirit of the Quantified Self movement, this article provides steps to:
  • use an activity tracking daemon SelfSpy to capture the usage habits for all your applications and
  • Google Drive spreadsheets to store and graph productivity stats/aggregates

Start by installing SelfSpy as per instructions in the link above. SelfSpy is interesting by itself and allows you to run all kind of statistical queries against the captured data (key presses, mouse movement, active window title logs).
Don't forget to setup auto-start of selfspy on boot and make sure to check some adhoc query examples on the selfspy page, those can be pretty handy.

To get the bigger picture of our data, we will install some stuff:
sudo pip install gdata, fabric
We will then setup a cron-job (or we can just run it on shutdown or something like that) to push stat aggregates to a Google Drive spreadsheet document, using the following script:
(warning, horrible terrible hacked code incoming)

I have also prepared a spreadsheet template with matching column names and 2 charts (for productivity time and keyboard/mouse ratios). Just copy it and adjust:

Done! From this point, you can e.g. publish the charts to your blog to create an external pressure to be productive ;-) Let me know if you do!

No comments:

Post a Comment