Description
Feature Request
Problem / Opportunity
We currently have /stats
which covers all books in the given “category”, e.g., https://openlibrary.org/people/freso/books/already-read/stats for all of my already-read
books.
It would be neat to be able to narrow this down on a year and month basis, e.g., to see the stats for books I finished in March 2025.
Storygraph and Goodreads both have features similar to this; Goodreads has “Year in Books” (e.g., mine for 2024: https://www.goodreads.com/user/year_in_books/2024/4511032) and Storygraph has a more involved Stats page that allows you to see a yearly overview, a monthly one, or an all-time one: https://app.thestorygraph.com/stats/freso?year=2025
This would help incentivise patrons to keep their reading logs in Open Library, making them return to us more frequently to update their reading data and/or (re)view their stats. Which in turn would help us with more/better data on book activity which we use for measuring popularity etc.
This also adds into if we ever want to make the stats shareable (which would be a separate issue from this one!), since people in bookish community are more likely to want to share stats of what they read in the last month or year than what they've read of all time. What Open Library has compared to GR and SG with the author genders/sexes, nationalities, and birth countries is data that are not at all available in Goodreads or Storygraph, and would certainly be of interest esp. to book clubs, reading circles, etc. with a more social justice oriented mindset.
It would be solved once there is a way to narrow down the stats page (at least for already-read
) by year and by month.
Proposal
https://openlibrary.org/people/freso/books/already-read/stats could have dropdowns or a calendar or other UI elements to allow users to select a specific year and possibly month.
I would also suggest that the resulting URLs should be hackable, like https://openlibrary.org/people/freso/books/already-read/stats/2025 and https://openlibrary.org/people/freso/books/already-read/stats/2025/03, to allow for intuitive “manual” construction and editing of URLs by the user.
Breakdown
Related files
Extend the readinglog_stats
endpoint to support year
ReadingLog.get_works
method already has an argument, year
, which we can use. E.g. something like this:
class readinglog_stats(delegate.page):
path = "/people/([^/]+)/books/(want-to-read|currently-reading|already-read)/stats(/\\d{4})?"
def GET(self, username, key='want-to-read', year=None):
...
if year:
# Skip the '/'
year = int(year[1:])
readlog = ReadingLog(user=user)
works = readlog.get_works(key, page=1, limit=2000, year=year).docs
Requirements Checklist
Checklist of requirements that need to be satisfied in order for this issue to be closed:
- Going to a reading stats with a year prefix should show reads filtered by year
Stakeholders
Instructions for Contributors
- Before creating a new branch or pushing up changes to a PR, please first run these commands to ensure your repository is up to date, as the pre-commit bot may add commits to your PRs upstream.