Continuing with my attempt to write about some things I’m doing at work, here are two related stories from a decade ago.
In these cases, they were projects involving plenty of other people. Although I played a significant role, I didn’t initiate either, and this post is from my own lens.
Pubic Accounts
The first one was Public Accounts, i.e. the financial records that the Ontario government publishes annually. Initially I was one of a few people given the task (summer of 2015) of creating a visualization for the release of the 2013-2014 fiscal year records. This was the first time I had even heard of public accounts.
What we were given were basically 3 datasets. One was a giant PDF. We wanted to publish this as machine-readable data, in addition to any visualization.
Obviously the best way would have been for the data to have been in a machine-readable format to begin with, but no such luck, nor was it practical with the time we had to make this happen. Effectively, each government ministry was given a Microsoft Word template, which they would modify, and the whole thing had been combined to create the PDF we were working with. Maybe we could have gotten some of those Word documents, but that wouldn’t have been much better.
Because of the complicated layouts and this being pre-AI, it wasn’t automatable. By this time we had joined up with what was then the Open Data team. After understanding the data, I created a basic schema (as in, spreadsheet columns), and the Open Data team collected themselves and any other co-ops and interns they had available, to split up the work of manually copying tons and tons of numbers from the PDF into spreadsheets. It was easy for each person to have their own spreadsheet and combine them later. I think it was perhaps 8 people in total, fortunately not including me 🙂
I think it was on the way home from work, possibly the day before the manual copy-pasting started, that I conceived a tool to check for copy-paste errors. The PDF essentially listed spending hierarchically, with both the individual amounts and the totals listed. There were more than 2 levels in the hierarchy, but in all cases the (sub)totals were given. So I got home and immediately started working again. By the time I went to sleep, it was done and one could copy the digitized spreadsheet into a textarea and have it sum up each part and compare it with the stated total, flagging any mismatches.
I showed all the “volunteers” how to read the PDF, to copy-paste into the right columns, and to use the QA tool. This tool became something to use regularly, not just at the end. It was very interesting (well, to me) that in addition to finding and fixing our own errors, it found errors in the original PDF. In many cases this was due to rounding, but at any rate we were able to get the data corrected.
Once the whole thing was completed and the numbers matched up, I also ran spell check (nothing fancy, just using Excel) and found more issues that got fixed.
We were able to release all the machine-readable data alongside a visualization as part of the release of public accounts generally, data which had never been published in machine-readable format before.
Aftermath
I wasn’t highly involved, but fortunately others were able to intervene in the process itself and get the data to begin life in a machine-readable format for the following year.
I helped out again, mostly just in rerunning another script I had made to convert from csv to the format used by the D3-based visualization, but I was a little sad to see that the new data format only included the detailed amounts, not the totals and subtotals. This meant that I had no additional numbers through which to validate the data, although presumably/hopefully something like this had been done upstream.
I was involved less and less every year, but one can see from the most recent release that the data I am referring to is now a datatable, using basically the same schema, with links below it to download the whole thing.
The Gazette
Around Christmas 2015, a coworker on an adjacent team asked if I had some time to help, as they had a big new workload. Some years’s worth of back-issues of the Ontario Gazette (not all the way back to 1868) were going to get converted to HTML to publish alongside current issues to meet accessibility legislation. The PDFs had already been converted into Microsoft Word.
The process being used was to manually copy from Word into the web-based WYSIWYG editor our content management used, then edit the source to fix any issues. There were a ton of issues, as Microsoft Word generates very messy HTML, and the conversion wasn’t aware of our CSS classes that would be used to match various Gazette formatting styles.
As much as I wanted to help, it was immediately clear that the two of us could work 24/7 on this and it would take much of our career. As with the previous project, this was very much before the LLM-era. I looked to see what I could automate and ended up with two practices.
If I was just looking at the HTML source in Sublime (the text editor I was then using), I could use it’s built in find-replace function with regular expressions to take care of a lot of things. I found a Sublime extension such that I could make a huge list of find-and-replace regular expression patterns that could run one after another from a single shortcut. This saved sooo much time. You still needed to manually review the HTML, but there was so much less to fix, and every time something got fixed, we would try to add it to the replacement patterns, so eventually this method was fixing almost everything.
The other automation didn’t save nearly as much time, but when you multiply it by how often it was needed, it was still a lot in total. In our Content Management System, to create a new page, you’d have to set a lot of metadata, but most of the fields were identical for every Gazette page. I created a bookmarklet which set that metadata. Bookmarklets are such a nice little bit of functionality that doesn’t get much attention these days.
Even with both of those practices in place, the number of steps required multiplied by the number of back issues, meant this was still a huge endeavour. As it happened, I had heard that my team had some remaining budget that could be used for temporary staff, which was unusual in that I generally know nothing about our budget. So I suggested we hire some people to do this work.
I was able to choose the people (based on their resumes), and we hired eventually 5 people working at the same time. More in total (some left, and I had to let one go), and I think it took perhaps 6 months of full-time work, but it did get done. I trained the first one to start and had them train the second, and so on. I reviewed their work initially until I was satisfied that they knew what they were doing, after which I only looked in when they had questions.
Aftermath
I think it’s pretty clear from the effort involved after my two automations why I had such a reaction to the workload initially.
The work got done, and at the time, it could only have been sped up further by hiring more people at once. As it was, we were able to keep some of them after the project for other work and I’m glad to have been a part of helping a few people with their careers, even in a small way. Between the hiring, firing, training, orientation, administration, and to some extent supervision, it is still the most I’ve ever been involved in HR. Fortunately for me the hires were done through a third-party agency for temporary positions, meaning I didn’t have to deal with the usual HR complexity of the public service.
Two projects I’m proud to have worked on.