A Dashboard for your Life - a minimal goal tracker using org-mode, go and git19 Jul 2014
One of the most powerful motivators to keep on track with goals and to keep from getting discouraged is the humble progress bar. This is a simple and intuitive indicator of progress used in many day to day situations. Though lack of accuracy can be a downside, the advantage is that it can be intuited at a glace - making it easy to get an overview of a situation by a brief glance.
When I set out to design a dashboard for my personal life I had a few goals from the outset. First of all I don’t want to reinvent the wheel, I already have a perfectly good todo-list/organizer with Emacs org-mode. It suits me well to be able to edit a simple text file anywhere I have Emacs installed and sync up with git. The fact that it isn’t 100% ubiquitous on every platform, to me, is a feature. I normally use scratch paper, emails, etc. as a buffer and then later in the day store and organize these in org-mode. I find that many of my musings end up being not as critical to actually do as I originally felt. I like that lag so I can have a bit of perspective when planning my tasks and projects.
The second objective was “no effort”, clearly I didn’t want to reinvent the wheel but also I didn’t want this to feel like a process or something extra I need to do. If my org-mode notes are the “model”, I want this to just be the “view”.
Getting Started with Org-Mode
Org-Mode is an “add on” to Emacs that is specifically tuned to organizing your life. I’m not going to go into advanced detail on this since there are already some great tutorials out there. I’d encourage you to check out the following links first to get yourself familiar with the software
The “Guide” - http://orgmode.org/guide/
List of tutorials on the org-mode site - http://orgmode.org/worg/org-tutorials/
Sacha Chua (Emacs Guru!) tips on learning org-mode - http://sachachua.com/blog/2014/01/tips-learning-org-mode-emacs/
Google Tech Talk on Org-Mode - https://www.youtube.com/watch?v=oJTwQvgfgMM
Once your warmed up to org-mode, it’s time to move on…
Tracking your goals
Now that you are comfortable with some of the possibilities of org-mode we are going to extend things a bit and create our own “system” within org-mode to track our goals. The power of org-mode (and Emacs itself) is the key philosophy that “everything is text”. Building off of this simple idea we can use a few consistent rules of our own to build up a format that we can parse with an external tool further down the road. This will allow us to “scrape” the notes we are keeping in Emacs/org-mode and create a html dashboard. Even though I use Emacs constantly every day, I’ve found it very helpful to have a web accessible quick view of where i’m at with all of my goals - keeping an eye on the bigger picture.
Org-Mode formatting “rules”
”* Long Term” - This is one of the ‘categories’ i am using to track multiple goals/projects you can adjust the code and wording as needed
”* Epic Goals” - This is one of the ‘categories’ i am using to track multiple goals/projects you can adjust the code and wording as needed
”* Study Goals” - This is one of the ‘categories’ i am using to track multiple goals/projects you can adjust the code and wording as needed
** + % = percent complete
** DONE = completed task (note that we are using “**”. In org-mode this is a sub-heading, this allows us to group multiple “todos” in a single category)
- [X] = completed task
** TODO = unfinished task (note that we are using “**”. In org-mode this is a sub-heading, this allows us to group multiple “todos” in a single category)
- [ ] = unfinished task
To help put all of these rules in context, here is a sample of what your org file might look like
* Epic Goals [0/2] ** TODO build a 3d printer ** TODO Run in a marathon [12%] - [X] 1 k - [ ] 3 k - [ ] 5 k - [ ] 10 k - [ ] 15 k - [ ] 20 k - [ ] 30 k - [ ] 42 k * Long Term Goals [1/2] ** DONE Wedding [100%] - State "DONE" from "IN PROGRESS" [2014-04-02 Wed 09:42] - [X] date 26th - [X] proposal - [X] rings - [X] decide where to do ceremony - [X] invites ** TODO Hobbies - Reading - one book per month 2014 [58%] - [X] Jan - Tampa - [X] Feb - map head - [X] Mar david and goliath - [X] Apr - fail - [X] May - fail - [X] June - american gods - [X] July - Stuff Matters: Exploring the Marvelous Materials That Shape.. Mark Miodownik - [ ] Aug - [ ] Sept - [ ] Oct - [ ] Nov - [ ] Dec
Processing our goals file
Now that we have our file created and have some goals entered we need some way to “scrape” that file. I’ve created a mini parser called “GoalTracker” that is written in Go. The code is free to use and very easy to get started with ( https://github.com/zpeters/GoalTracker ). Simply clone from github. Next install the Go programming language ( http://golang.org/doc/install ). To compile the code just type “go build goals.go”, this will result in a binary for whatever OS you are using. Once the binary is created you can issue the following command “goals -dataPath=/my/path/to/my/org-mode-files/ -templatePath=/path/to/the/template/file/included/with/the/code > /var/www/html/goals.html”. Looking in the code you will see that by default it is looking for a file called “TODO.org” in your dataPath and a file called “Template” in your templatePath.
The resulting html file looks something like this:
Automating Dashboard Updates
Finally, we can automate the update of our dashboard with a simple git-hook. This allows you to run the dashboard update code in the background every time you commit your updated org-mode files. The following code should be placed in your _post-receive _file
rm -rf /tmp/Organizer cd /tmp git clone /storage/GIT-REPO/Organizer.git /home/zach/src/go/bin/go run /home/zach/Projects/Goals/goals.go -dataPath=/tmp/Organizer/Organizer/ -templatePath=/home/zach/Projects/Goals/Template > /var/www/html/goals.htm
This is one of my more popular articles. If you have any suggestions for updates or new articles like this please don’t hesitate to leave a comment below, or email me directly at email@example.com