Coding Small-Scale Projects with Big Impact: Part 2

An under-the-hood look at developing an automated LibGuide.

In my previous post, I discussed what I called library “microservices”: small, custom, librarian-built programming projects. My suggestion was that coding small projects is a great way for librarians to do impactful work in their departments. I recommended taking on a realizable programming project and puzzling through the code to make it happen. In my opinion, this is a challenging, interesting, useful, and satisfying thing to do. 

In this post I’ll describe an example of a successful microservice that we built at our library. This is not sophisticated stuff, but it made an outsized impact on our workflows.

Specifically, our acquisitions librarian wanted to create a public-facing LibGuide that showed the new books that we received each month. Doing this required writing some not-very-complicated HTML to paste into the guide. The problem was that—because we receive so many new books each month—it required a lot of not-very-complicated HTML! Hand-coding all of that HTML was prohibitively time consuming. There was no way we could commit to it every month.

This was an excellent moment for a bit of opportunistic coding. Our hypothesis was that we could download a .CSV of new books from our vendor and convert it into HTML programmatically. Taking a plain-text format (like CSV) and marking it up as HTML only requires basic programming knowledge. In the jargon of programmers, it’s just string interpolation. After some fussing to accommodate all of the idiosyncrasies of the vendor-provided data, it turned out to be very doable!

Our first attempt is here. This original version of the code was written at low intensity in my spare time over the course of about a month. Our acquisitions librarian helpfully provided batches of test data to help debug the script.

While this first iteration was super simple, one problem that we faced was that it needed to be run from the command line. This is fine, but most librarians do not want to muck around with running scripts directly. To get around this, our acquisitions librarian emailed me the CSV each month and then I ran the script on my machine and sent back the resulting HTML. It was an acceptable workflow, and we did this for several months.

But one of the great things about small projects is that you can always build on them later. We quickly realized that we could improve the workflow by eliminating the need to email files back and forth. If we had a desktop version, our acquisitions librarian would not have to wait for me to process the files. Making a desktop application was the obvious next step.

This was new territory for me. But thankfully, with programming, you almost never have to start from scratch. In this case, there were numerous existing tools for turning Python scripts into desktop applications. I tried several of them over the subsequent months, and after some fiddling, we had a working desktop version. It looked like the image below. If you’re curious, you can also see the code for the desktop version. So from our initial idea to a working graphical user interface, it took several months of (admittedly very infrequent) coding.

Image showing what the user interface looks like
The user interface for the desktop application.

The workflow improvements were substantial. It was now possible for our acquisitions librarian to produce the new books LibGuide every month. A process that took several hours by hand was accomplished in a few seconds with the desktop app. It was a big victory for our library, and it ultimately saved much more time than it cost.

It’s not a groundbreaking example, but that’s kind of the point. We picked a mundane library task and made it better through scripting. Over the long term, the time savings are enormous. Most importantly, there are lots of library tasks that can benefit from this kind of attention. So I encourage you to pick a small project and get out there and write some code to tackle it!

Dimensions logo. "Dimensions Part of DIGITAL SCIENCE" written in black text next to a rainbow geometric shape.

Choice and LibTech Insights gratefully acknowledge our launch sponsor, Dimensions, a part of Digital Science.  Dimensions, is the largest linked research database available and provides a unique view across the whole research ecosystem from idea to impact.

Sign up for LibTech Insights (LTI) new post notifications and updates.

Interested in contributing to LTI? Send an email to Deb V. at Choice with your topic idea.