Here's the geek automation of the week, its for helping creating reports from my TODO tasks list when using the amazing emacs org-mode(see here whats org-mode all about).
(simplified) Work Flow
- I get a request, add it into my todo list queue, marking it as a TODO item.
- Work, work, work, guided by the todo listed tasks, balancing priority and effort and (..add your own reason here..).
- When finished, mark an item DONE.
- Generate a report every week with the done tasks.
Generating the Report
(I use this setup on Mac, with some adaptations should also on Linux and Windows)
Every week i then generate a report of the DONE Tasks, by running:
/Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv "+TODO=\"DONE\"" org-agenda-files (quote ("/.../work.org")))' > work-done.csv
ruby format-report.rb work-done.csv
rm work-done.csv
open work.csv
(see the comments "#" to understand what it does in each step)
Then I use the format-report.rb bellow to apply formatting to the report, for example: add my own header, add/remove columns, Dates, change names, calculate values, etc, etc... see example:
flines = File.open(ARGV[0]).readlines
column_map = {
"friendly_name_i_use1" => "required_final_report_name1",
"friendly_name_i_use2" => "required_final_report_name2",
"friendly_name_i_use3" => "required_final_report_name3"
}
File.open( "work.csv","w+") do |fl|
fl.puts "header1,header2,header3,header4"
flines.each do |l|
a = l.split(",")
fl.puts Time.now.strftime("%m/%d/%Y") + "," + (column_map[a[1]] || a[1]) + "," + a[2] "," + a[3]
end
end
And voila, i run this and an excel sheet opens up with the report of the week.