My plain-text reading list

Now with statistics, and feature-complete!

July 17, 2023 Ā· Felipe Vogel Ā·

Iā€™ve added a new page to this site, Reading Statistics, thanks to a new version of my Reading Ruby gem, which has been the force behind my Reading List page.

This post is mostly a recap of how the Reading gem came to be, as a way to celebrate it now being feature-complete. But first, hereā€™s a glimpse into the new feature.

The new statistics feature

At its core are strings containing statistics queries. For example, to get the data for the charts that you see on the Reading Statistics page, I pass these query strings into the Reading::stats method (along with the items previously parsed by Reading::parse):

The last chart (ā€œMost annotated itemsā€) is an example of a DIY query that doesnā€™t call Reading::stats but instead manipulates the array of Items directly:

items
  .map { |item|
    notes_word_count = item
      .notes
      .sum { |note|
        note.content.scan(/[\w-]+/).size
      }

    [item, notes_word_count]
  }
  .max_by(10, &:last)

After each of these queries, in order to get the data ready to pass into the charts, a few lines of data manipulation are needed (which you can see here in the code for my siteā€™s reading list builder). But the real work of parsing and analyzing the reading log has already been done by the Reading gem.

So thatā€™s the new feature. Itā€™s more thoroughly documented in the gemā€™s README.

This is the last feature that Iā€™d planned, and itā€™s done! šŸŽ‰ To celebrate the gem being feature-complete, hereā€™s the story of how it came to be.

Flashback to summer 2020

Iā€™d just quit my teaching career. I was learning programming while working in e-commerce customer support, to pay the bills. My wife and I had just lost our first baby early in the pregnancy, and in the process she got so sick that she was bedridden for a month. And because the pandemic was in full swing, we were alone.

It was a rough time.

But there were bright spots. One of them was having more time to read now that I wasnā€™t an English teacher (ironically).

I also spent more time reflecting on my reading: not just tracking what books I was reading (which Iā€™d been doing for a few years already on Goodreads), but now I started taking notes on the books that I wanted to engage with more deeply.

I soon realized I needed a single place to store my notes, or else Iā€™d lose them. Ideally Iā€™d keep my notes in the same place where I tracked my reading, so that I wouldnā€™t have to keep two separate lists. But taking notes in Goodreads is surprisingly unintuitive. On top of that, I didnā€™t love Goodreads even for tracking my reading.

So I decided to ditch Goodreads. I exported my Goodreads data and converted it into a plain-text reading log in a CSV file, which I wrote about in a blog post.

I found that using a plain-text reading log was actually delightful, thanks to the Rainbow CSV extension for VS Code. Itā€™s also nice to have a keyboard shortcut that adds a row template, to reduce boilerplate typing. I made that with an AutoHotkey script and later with a Ruby script.

The one problem with my new approach was that I didnā€™t have a way to see a list of my top-rated books and share it with friends (the single benefit I got from Goodreads). Manually keeping a separate list of my favorites would take too much time and would be error-prone, and so my next thought was, to quote an xkcd comic, ā€œI should write a program automating this!ā€

Over the following months I wrote a parser for my reading log in Ruby, which Iā€™d just started learning in my nascent career switch. It morphed into a nifty CLI app for showing reading statistics, which you can see in action in its GitHub repo.

Next came the Reading gem

In 2021 when I discovered Bridgetown and rejoiced that I didnā€™t have to dive into Ruby on Rails quite yet, I used Bridgetown to build this site and finally realized my dream of sharing my favorite reads by making a Reading List page thatā€™s automatically updated by my CSV parser.

In the process, I rewrote the CSV parser and split it out from my statistics CLI app, which Iā€™d never ended up using because itā€™s too much effort to fire up a terminal and write out a bunch of queries just to satisfy my curiosity about my reading habits.

Then I wondered, could more automation solve that problem? What if I had a separate page on my site with charts showing my reading statistics, which was automatically updated in the same way as my Reading List page?

As much as I liked the idea, I reluctantly shelved it because I had to get on with life: for the next two years I was busy learning Rails, getting my first developer job, moving into our first house, and having a baby.

But now Iā€™ve circled back and re-written the statistics part of my old CLI app, integrated it into the Reading gem, and finally added the Reading Statistics page. The quest is now completed šŸ§™

Why Iā€™m so glad to have finished this project

Sticking it to my teenage self

All my life Iā€™ve found it easy to start projects, but tremendously difficult to finish them.

In fact, I learned some coding way back in high school, but never got anywhere close to finishing a project, due to my lack of discipline. So now itā€™s as if Iā€™m vindicating myself, proving to myself that Iā€™m not that aimless teenager anymore. It feels great to finish a major effort that I started three years ago, even going beyond what I originally envisioned.

Building something new

It also feels good to have built something that is genuinely new, that no one else has built in quite the same way. Yeah, itā€™s extremely niche: my gem has only 3 stars on GitHub, compared to the 300+ stars of my ā€œLearn Rubyā€ list. But itā€™s original, and in my head that adds some imaginary stars to the total (as well as the fact that I use the gem a lot myself).

Itā€™s true that some other projects overlap with my efforts:

But even if Iā€™d known of these projects three years ago, I still wouldā€™ve gone ahead with this project because I track and annotate my reading in ways that would be more complicated if I were to use these other approaches.

Moving on

And of course, itā€™s nice to move on to other projects after three years working on this one. Iā€™ve been thinking about making a game, as I recently wrote about. That would be another way to show up my teenage self, because back then my dream was to make a game, but really all I did was play games šŸ™„

I still plan giving the Reading gem a 1.0 release after (presumably) bug fixes and code cleanup. And eventually I might integrate it with a social network, maybe BookWyrm (the Fediverse alternative to Goodreads) once it has a public API. (Even if I wanted to integrate with Goodreads, at this point I couldnā€™t because the Goodreads public API has been largely discontinuedā€¦)

But those goals are not urgent, and for now Iā€™m enjoying the feeling of freedom after finishing a years-long project.

šŸ‘‰ Newer: Solo RPGs as a creative practice šŸ‘ˆ Older: Building a text-based game šŸš€ Back to top