GSoC 2019: Bookshelf in bookbrainz for user data collection

bookbrainz
gsoc-2019
Tags: #<Tag:0x00007f8d647f2968> #<Tag:0x00007f8d647f2828>
#1

Personal information

Name: Bhaskar kumar singh
Nickname: BhaskarSingh
IRC nick: BhaskarSingh
Email: allstarbhaskarkumar@gmail.com
GitHub: https://github.com/bhaskarSingh
Linkedin: https://www.linkedin.com/in/bhaskar-singh-55a535b9/

Proposal

I plan on making a bookshelf where users can see the kind of books they are currently reading, want to read, already read, there favorites and also can create their own collections keeping in mind to limit it to one kind of entity only & allowing user to either make it public or private according to the preference.The purpose behind collection of user data is for building a recommendation system in the future by doing so we can give personalized book recommendations to users on the basis of their favorite books and the book they are either reading or want to read or have already read or their collections.

Why store favorite books ?
It will be helpful while building the recommendation system, giving more weightage to favorite books than the books that the users might be currently reading or have already read or want to read because user will be more inclined toward reading the type of books that user loves very much rather than the book that they just recently read thus helping us build a more personalized experience for the users.

Backend
Three new tables will be needed to be created named: bookshelf, user_collection_group, user_collection_list

 `CREATE TABLE bookbrainz.bookshelf(
    Id SERIAL PRIMARY KEY,
    editor_id INT NOT NULL,
    alias_id INT NOT NULL,
    work_header INT NOT NULL,
    already_read BOOLEAN DEFAULT false,
    want_to_read BOOLEAN DEFAULT false,
    currently_reading BOOLEAN DEFAULT false,
    favorite BOOLEAN DEFAULT false );`

ALTER TABLE bookbrainz.bookshelf ADD FOREIGN KEY (editor_id) REFERENCES bookbrainz.editor (id);

ALTER TABLE bookbrainz.bookshelf ADD FOREIGN KEY (alias_id) REFERENCES
bookbrainz.alias (id);

`CREATE TABLE bookbrainz.user_collection_group(
        Id SERIAL PRIMARY KEY,
        entity_type varchar(64) NOT NULL,
        name varchar(100) NOT NULL,
        description varchar(255) NOT NULL,
        public_access BOOLEAN DEFAULT false,
        date TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now()) );`


`CREATE TABLE bookbrainz.user_collection_list(
        Id INT NOT NULL,
        entity_data_id INT NOT NULL,
        entity_header_id INT NOT NULL,
        date TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now()) );`

ALTER TABLE bookbrainz.user_collection_list ADD FOREIGN KEY (id) REFERENCES
bookbrainz.user_collection_group (id);


(Note: data type for column work_header_bbid(bookshelf table) will be uuid)

36%20PM

Frontend
UI is just for presentation only, UI style will be according to the metabrainz react design system.
New Pages that will be created: bookshelf page, public collections page & collection_list page.

UI & workflow for data collection of users(Bookshelf - favorites, want to read, already read & currently reading)

Here if the user has already select a option or added book to favorite show the saved state other wise show default options

UI & workflow for users to add item to their collections
Here to make sure that when user clicks on add to collection, at the end of opened modal show text message saying “A collection can contain one type of entity only” and from all the previously created collections disable the ones which are not of the type of entity opened currently.

Bookshelf UI and workflow
For favorites, option menu will only show option to remove favorites
For currently reading, want to read, already read option menu will show option to move to different state between the three & also option to remove the item from bookshelf.


User collection creation UI & workflow
User will not be allowed to edit entity type after creation of a collection to keep the one entity type for a collection state in sync.

Public collection page UI & workflow
Public collections will show all the public collections created by user having option to filter by latest updates, oldest & entity type

Search view UI

(Note: I have never work with postgresql database as backend but I know sql & have experience working with mysql, I am a quick learner and with little help will get comfortable with codebase in no time)

Timeline
Community bonding(May 27 - June 24)
During this time, I will get more comfortable with the codebase(and specially will spend time understanding how database i.e postgresql is connected & working of backend) and will discuss design decisions & backend structure with mentor.

Phase 1(May 27 - June 25)
Using test-driven development environment methodology, I will work on backend (create table & build endpoint api) & frontend for buidling bookshelf UI & it’s workflow & easier way for adding books to bookshelf.

Phase 2(June 26 - July 30)
In this phase I will build the user collection feature, where I will work on both backend & frontend to create this feature for users to easily create their own collections & view it.

Phase 3(August 1 - August 27)
In this phase I will build the public collections page where users can access other users public collections & I will also add add to collection component in search view so that it’s easier for user to add item to a collection, document the backend apis, work on final submission & make sure every everything works correctly.

Detailed week by week timeline for gsoc coding period to keep myself focused and on the track.

  • Week 1:
    Update my repository with master & make sure everything is up to-date, start with creating required new table for bookshelf & using test-driven development methodology create endpoint API for adding book to bookshelf & marking it as favorite.

  • Week 2:
    Create select & like component, then link the frontend page to backend making sure adding book to bookshelf & adding to favorites is functioning correctly.

  • Week 3:
    Using test-driven technology create endpoint API for bookshelf page.

  • Week 4:
    Build UI components for bookshelf & linking backend to frontend making sure every functionailty is working correctly.

1st evaluation

  • Week 5:
    Using test-driven development methodology build endpoint API for users to add item to their collections or create one for adding the item.

  • Week 6:
    Create component for adding entity to a collection previously created or create a new one keeping in mind that each entity type should have it’s own separate collection.

  • Week 7:
    Using test-driven development methodology build endpoint API for showing created user collections in bookshelf.

  • Week 8:
    Build components for showing user created collections & functionality for creating one.

2nd evaluation

  • Week 9:
    Build Backend API for showing public user collection.

  • Week10
    Build public collections page showing collections created by users

  • Week11:
    Add option for add entity to a collection directly from search view results.

  • Week 12:
    Add documentation where necessary & manually testing all the endpoints with keeping important edge cases in mind and work on it if any.

  • Week 13:
    Work on final submission & make sure everything is working correctly, that is testing that adding book to book shelf, marking as favorite and creating & adding item to collection is working correctly.

Detailed information about yourself

I am currently in my 2nd year undergraduate, pursing B.com(prog) from motilal nehru college delhi unversity, I first got introduced to programming in class 11th(as optional course provided by the school) from there I got really interested in it & in February 2018 I got scholarship by google/udacity for front-end nanodegree & thanks to that I got a good start which I need to get into web development field and from that time to now I have build two personal projects of mine which I am very proud of, learned react & I have worked with nodejs and mongodb(nosql) as database for backend and and indoing so I have I have used so many open sourced libraries and understanding that it was only possible with all the hard work done by awesome developers & giving back to the community.This opportunity will give me the push needed to get into open source projects and I am super excited for this project & working with and learning from the mentor.

Tell us about the computer(s) you have available for working on your SoC project!
Macbook air with 8gb ram and 128gb ssd
When did you first start programming?
In class 11th I was introduced to programming as a additional subject(java & mysql) & from there I really got interested in programming.
What type of music do you listen to? (Please list a series of MBIDs as examples.)
Mostly youtube recommendation in loop(list goes from Punjabi, hindi to english music)
currently favorites(English):
Sunflower (Spider‐Man: Into The Spider‐Verse)
Post Malone - Better Now
If applying for a BookBrainz project: what type of books do you read? (Please list a series of BBIDs as examples. (And feel free to also list music you listen to!))
Recently I read : Rework

What aspects of the project you’re applying for (e.g., MusicBrainz, AcousticBrainz, etc.) interest you the most?
Bookbrainz project, I liked the idea behind creating a platform where anyone can find book information they might be looking for free.
Have you ever used MusicBrainz to tag your files?
Nope
Have you contributed to other Open Source projects? If so, which projects and can we see some of your code?
Not really

What sorts of programming projects have you done on your own time?
Apart from udacity frontend nanodegree projects, I have worked on two personal projects of mine, 1st beign pocketpubg where we organised pubg tournaments online, you can check the website(pocketpubg.me) where I worked on making the whole process of registration very easy(one click to enter tournament after registration) so that users can focus on playing the game rather than stuck confused & avoid repetition and the 2nd one (bookobooks.com) market place where college students can buy & sell second hand books cheaply & conveniently(still work in progress).
How much time do you have available, and how would you plan to use it?
I will be working for around 40-50 hours every week for gsoc.
Do you plan to have a job or study during the summer in conjunction with Summer of Code?
If selected for gsoc then none otherwise I intent to work on a new personal project of mine.

1 Like
#2

Hi, This is my Initial draft. I am openly looking for constructive feedback and suggestions if any.

#3

Hi @BhaskarSingh!
Thanks for your submission, you’re on a good track. I’m excited thinking about this feature :slight_smile:
Sorry to answer so late, I hadn’t seen your post go by. Could you tag it as BookBrainz please?

Before I go into details and suggestions, a general comment: The ORM (Object Relational Mapper) Bookbrainz uses is called bookshelf (not our project, the name is a coïncidence). To avoid even more confusion, let’s avoid the name bookshelf (at least in the back-end) and use the term collection.

  • Which also brings me to my first suggestion: Instead of having special types of collections (favorites, currently reading, etc), only have one generic collection model. There are ways in the UI to suggest default names when creating a collection.

  • I don’t think you need a bookshelf table in that case, only a user_collection and user_collection_list.

  • The UI will need to be adjusted accordingly to take this into account.

    • The “Add to collection” parts are well suited, but not the select component. however I do like the look and placement of that dropdown select. Perhaps they can be merged, meaning a dropdown where the user will find their existing collections, and where they can also enter a new collection name?
    • I think the like component can be dropped entirely.
    • Instead of separating favorites, currently reading, etc on the UI, separate collections by entity type (that way for each type we can more easily display details in table format)
  • For that user_collection_list table, entity_bbid would be better to store than data_id and header_id.

    • For example if a duplicate entity gets merged into another one, its bbid will redirect to the correct entity.
    • We certainly wouldn’t wan’t to update data_id every time an entity changes, in each collection where it appears !
  • Can you detail what new components are needed for the UI and where they will live?

  • Can you details what changes need to be done on the ORM (bookbrainz-data-js)?

  • You mention API endpoints, but I assume you refer to the web server routes (bookbrainz.org/collections for example)? Currently BookBrainz does not have an API

  • the timeline needs to be adjusted to reflect the comments above. I’d also like to see as much detail as possible for each week.

I fear you may underestimate the time needed to get familiar with the codebase and the tools we use. You will need to understand the ORM bookbrainz-data-js and how it is used in the backend, as well as get familiar with the front-end, redux and server-side rendering.
I would like to see you dig into the codebase and submit PRs to show your understanding of the codebase. Our issue tracker is here if you need inspiration

I’ll be checking this post regularly, but feel free to @mention me :slight_smile:
Good luck !

2 Likes
#4

Do you have any update on this @BhaskarSingh?