Performing manual, repetitive tasks enrages me. I used to think this was a corollary of being a programmer, but I’ve come to suspect (or hope) that this behaviour is inherent in being human.
But being able to hack together scripts simply makes it much easier to go from a state of rage to a basic solution in a very small amount of time. As a side point, this is one of the reasons that teaching the basics of programming in schools is so important. It’s hard to think of any job which wouldn’t benefit from a few simple scripts to perform more automation.
When we’re hiring, even for non-developer roles, we look for this kind of mentality - it’s extremely useful, especially when building a software businesses, if costs don’t scale linearly with revenue. The more we can invest up-front in automation, the less time our team has to spend on performing stupid, manual tasks. As we add more employees, the benefits are compounded. And less rage generally makes the workplace a much happier place.
I encountered a practical example earlier this week. It was time to submit expense reports, and I could feel the rage starting to build up. For some reason, our accountant decreed that we had to fill in a spreadsheet, line-by-line, for every expense item. It looked a lot like this.
Presumably, hundreds of millions of people have to do this every month, costing millions hours of lost productivity. And in most companies, it’s because a well-meaning HR or Finance person has said that It Must Be Done. But if that Finance person had a modicum of programming experience, they might be minded to try to find a better way. That’s is what I mean by hiring people with this kind of mentality. We don’t want anyone who’ll lump some stupid task on the rest of the team because they’ve not got the mindset to think about automation in a sensible way. Even if they can’t programme the solution themselves, they need to be able to figure out pretty quickly that a better solution must exist
After briefly raging out, I decided to do something about this particular problem.
1 - quickly define the requirements;
- Record details of every expense item including date, amount & description
- Be able to query the list to produce reports (by month and/or person submitting the receipt)
- Keep copies of receipts for HMRC
2 - think about how receipts fit into our workflow at the moment, and the major problems
- Receipts can be physical (till receipt for lunch) or electronic (Rackspace email)
- They can pop up at random points in they day - not conveniently all at the same time every month
- People have to store small pieces of paper for up to 30 days. Unreliable
- People then have to spend an hour or two each month going through thousands of emails and hundreds of small pieces of paper to find the receipts, remember what they’re for, and write them down one-by-one. At least the spreadsheet auto-sums the amounts to a total… Inefficient!
3 - Apply a modicum of brainpower to automate the pain-points.
To avoid the unreliability of storing small pieces of paper and the inefficiency of examining thousands of emails, perhaps we could store them all in once place, electronically. This place could be an email account called something imaginative like “firstname.lastname@example.org”.
To avoid having to go through each receipt one-by-one, perhaps some kind of machine could parse relevant information out of each email and persist it somehow. Perhaps a database might be useful. To produce the report, perhaps the database could output certain information based on some kind of structured query language. So that the people at HRMC don’t suffer an instantaneous and fatal brain-explosion when we send them the data, perhaps we could separate values with a comma, save them all in a file and advise HRMC to open the file with their preferred Microsoft spreadsheet program.
As a side note; In the interests of not re-inventing the wheel, it’s generally a good idea to check if someone has solved this problem before. I decided to roll my own in this case because I was interested in learning about email handling after watching this great railscast from Ryan Bates. And because paying $9 per month per user for something I could probably write myself in a couple of hours seemed silly.
If you’re interested in the technical details, I used a ruby gem called Mailman, hosted on Heroku’s new cedar stack, to poll our POP3 mail server every minute. Attachments (pdfs, photos etc) are saved to AWS S3, and simple details of each receipt are stored in a postgres database. A Campfire gem called Tinder immediately alerts our company chat room that someone’s spent some of our hard-earned cash (just for amusement, really), and a very simple Rails app hosted on Heroku makes the data available in HTML or CSV, which can be queried by date-range or employee.
Emails are required to have a line similar to “Amount 12.50”. Running OCR on photos of receipts and detecting the right line to take the Bill total from seemed like too much effort. We might switch to mechanical turk if people find this step troublesome.
If there’s any interest, I’m happy to stick the code on github.
Don’t put up with repetitive, manual tasks - automate them! It’s the
jedi hacker way.
If you want to come and work at a place which encourages you to hack on cool projects to improve your colleagues’ lives, check out our jobs page