Project Ook: My Library Management tool

My latest side project - A tool to manage a collection of books.

Project Ook: My Library Management tool
Photo by Jaredd Craig / Unsplash

In this post, I want to show off my latest side project - Project Ook. A tool to manage my collection of books with some help from GoodReads. It is not feature complete, but it is functional. Also, heads up, I am going to refrain from using the word "Library" often because it means something else when talking in context about code.

What I am trying to solve?

Three weeks ago, I was talking to a friend, and they said they wanted to start reading Agatha Christie novels. They never asked for suggestions but having read several, I wanted to chime in.

I wanted to provide a list of books I enjoyed. Given that, I log everything I read on Goodreads, the simplest thing for me to do is filter, sort and make a shareable list. But they don't use Goodreads, and creating a list is not an intuitive process on there.  

The next reasonable thing to do is just type it out. That was easy enough, since I wanted to suggest only 4 books. What if it was an extensive list of maybe 10–15 books? And text messages tend to get lost in the shuffle.

Another issue is that what if Goodreads decides to shut down a year from now? What's the point of just backing up my data if I can't make use of it? These are the questions I try to answer.

Features (As of writing)

At present, my tool is capable of doing the following

  • Importing Data from Goodreads into a Postgres DB
  • Querying the Data
  • Creating Shareable Lists

The first step I wanted to do was ensure I could import my data into a Postgres db. Goodreads has shut its API service down. And the only option given is to export my data to a CSV file. I could feed the CSV to my tool, and it will assimilate the data to a local Postgres DB.

Once in the DB, I could query by writing SQL queries. That is not my preferred way. So I implemented a way to query the database by feeding in json query. Below is an input example.

{
  "date_added": {
    "lower": "2022/12/01",
    "higher": "2023/04/24"
  },
  "author": "Agatha"
}
Input Query

The result is a bit long to share here, but a truncated one should give you an idea. This query tool helps me create lists at ease. I could create lists based on author, or title, or tags I have used, my ratings or a combination of these parameters.

{
  "A Deadly Affair": {
    "author": "Agatha Christie",
    "author_adds": "",
    "author_lf": "Christie, Agatha",
    "avg_rating": 3.91,
    "binding": "Kindle Edition",
    "book_id": 60028686,
    "date_added": "2023-02-05",
    "date_read": null,
    "id": 150,
    "isbn": "=''",
    "isbn_13": "=''",
    "my_rating": null,
    "my_review": "",
    "number_of_pages": 271,
    "og_year_pub": 2022,
    "owned_copies": null,
    "private_notes": "",
    "publisher": "William Morrow Paperbacks",
    "read_count": null,
    "sha": "8681814e0127170945df756f3414f9bb3aaf9ed0",
    "spoiler": false,
    "status": "to-read",
    "tags": [
      "to-read"
    ],
    "tags_with_ranks": [
      "to-read (#19)"
    ],
    "title": "A Deadly Affair",
    "year_pub": 2022
  }
}
Output Json

Now, this output JSON is good for manipulating, but this is not shareable. There is too much information which is not needed. Keeping only the important information, I used Rich to create a shareable SVG.

Example screenshot

Now, the above is shareable. I could create various lists, but there are limitations which I want to iron out in the future. For example, I am doing a substring search on the author's name. That way, I could key in Agatha and not the full name. But this means, I can't currently do a multi author search. There is room for such improvements.

Conclusion

Did I spend several hours on something trivial? Yes. Was it worthwhile? No one is going to ask me for my book suggestions. Even the circumstance that led me to this idea, my friend didn't ask for my suggestion. But yes, it was worthwhile. I like to back up my data and make use of my data. Though I may not have a proper use case, I might in the future. Who knows, this tool might help me in blog.

Thank you for reading. If you have any suggestions or would like to take a look at the source code, the github link once again.

Stay in the Loop: Sign up Now!