bookwyrm icon indicating copy to clipboard operation
bookwyrm copied to clipboard

Proposal: Reading statistics page a la goodreads.

Open Hallicopter opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. Not related to a problem, but I am curious about the distribution of the books I read wrt to their publishing dates. Other chart could be pages read per month, books read per month etc.

Describe the solution you'd like A stats page like that in goodreads. image

Describe alternatives you've considered The page need not look like goodreads'. I haven't considered much, just putting the feature proposal here to see peoples' thoughts on it, and put it in the backlog as an idea (since I couldn't find any other proposal for this)

Additional context Just some form of basic reading statistics would be nice.

Hallicopter avatar Apr 19 '21 15:04 Hallicopter

Agreed! I think there's a lot of fun ways this could work

mouse-reeve avatar Apr 19 '21 16:04 mouse-reeve

Math :heart_eyes_cat:

I mean, I'd like to take a stab at this one this week. Reading through linked issues and familiarising myself with the respective code bits right now.

Ryuno-Ki avatar May 03 '22 19:05 Ryuno-Ki

I looked into the source code and have some questions before moving forward:

  1. Who should be able to see those stats?
  2. Where should it appear? On a user profile page? A dedicated page? Linked next to user / Your books?
  3. Would it make sense to start with some text first? This way, I can familiarise myself with the queries. From what I can tell after initial testing, it will require a few relationships. Users -> Shelves -> Books resp. User -> Status.
  4. It appears we don't have a JavaScript library for this right now. I looked into a few with respect to accessibility and would suggest to go with D3.js (unless you want to buy a license, then there are more options).

My thoughts:

  1. Start with only oneself (when logged in). This way, it is safe to gauge interest in whether it is worth putting more effort into it.
  2. I would tend towards a new page for this, because the query could quite some time and slow down the loading even further.
  3. My ideas revolve around: „Read in year X: ” and „Published in year Y: ”. Basically gathering numeric data before putting them into a chart.
  4. The process is similar to the barcode library, I guess? Shall I take another look and look closely at the license?

Ryuno-Ki avatar May 04 '22 18:05 Ryuno-Ki

@Ryuno-Ki your thoughts are excellent. Privacy-first and a separate page is smart. Could fit nicely here as another tab:

Screen Shot 2022-05-05 at 4 59 17 PM

todrobbins avatar May 05 '22 23:05 todrobbins

I looked into the source code and have some questions before moving forward:

  1. Who should be able to see those stats?

The annual review and shared lists have an option to create a revokable, sharable link. I think that would be a good pattern here too!

  1. Where should it appear? On a user profile page? A dedicated page? Linked next to user / Your books?

I agree with @todrobbins - linking from the user tabs seems like a sensible place to put it.

  1. Would it make sense to start with some text first? This way, I can familiarise myself with the queries. From what I can tell after initial testing, it will require a few relationships. Users -> Shelves -> Books resp. User -> Status.
  2. It appears we don't have a JavaScript library for this right now. I looked into a few with respect to accessibility and would suggest to go with D3.js (unless you want to buy a license, then there are more options).

Text would be a great starting place! We do already have a javascript charting library that's used in the admin dashboard: https://github.com/bookwyrm-social/bookwyrm/blob/main/bookwyrm/templates/settings/dashboard/dashboard.html#L152 -- apparently I just linked it via CDN, since it's an admin only view, but it would make sense to include it as a library.

My thoughts:

  1. Start with only oneself (when logged in). This way, it is safe to gauge interest in whether it is worth putting more effort into it.
  2. I would tend towards a new page for this, because the query could quite some time and slow down the loading even further.
  3. My ideas revolve around: „Read in year X: ” and „Published in year Y: ”. Basically gathering numeric data before putting them into a chart.
  4. The process is similar to the barcode library, I guess? Shall I take another look and look closely at the license?

These all seem like solid thoughts :)

mouse-reeve avatar May 05 '22 23:05 mouse-reeve

Okay, let me summarise that into a checklist, so I can break it up into several PRs:

  • [ ] Create a new page => URL pattern + View + Template :arrow_right: #2102
    • [ ] Clarify what to do with ActivityPub requests
    • [ ] Link from tabs (only for oneself?) :arrow_right: #2102 (for all)
  • [ ] Limit view to oneself :arrow_right: #2102 (empty content otherwise)
    • [ ] Throw permission denied for visitors?
    • [ ] Allow visits if via revocable share-link
  • [ ] For all books in all shelves count publish year by year
  • [ ] For all books in all shelves count read finished year by year
  • [ ] Add Chart.js as library
    • [ ] Upgrade to latest version while at it? (v3.7.1 - https://www.jsdelivr.com/package/npm/chart.js?version=3.5.1 - https://github.com/chartjs/Chart.js/releases)
    • [ ] Replace Admin chart with library (i.e. adjust src)
    • [ ] Render a bubble chart based on data: https://www.chartjs.org/docs/latest/samples/other-charts/bubble.html (alternative: scatter plot)
  • [ ] Test everything :)

I will edit the PRs adressing each item once it's open. Comments welcome.

Ryuno-Ki avatar May 06 '22 17:05 Ryuno-Ki

I was not able to pick it up for private reasons for several weeks, but today I studied the source code further to learn about the models.

Which „readthrough” comments are interesting for this feature? Start and finish date? Those in between? How to handle books, that were started but not finished yet? What about stopped ones? Read through a book can be tracked by pages or percentage. Don't we compare apples with pears here?

Those are questions that came up when walking through the code. Looking forward to hearing your thoughts on them.

Ryuno-Ki avatar Jul 17 '22 14:07 Ryuno-Ki