After the rating system being implemented in CritiqueBrainz, it is being planned to migrate the ratings which already existed on MusicBrainz to CB. This change will be more effective when all the entities existing on MB can be rated/reviewed on CB.
Presently, on CB, a user can review/rate only three entities i.e.
Places. By allowing them to rate/review more entities like
Artists, not only it will help to migrate the ratings of MB to CB but it will also target the interest of more people and engage them to use CB.
Being related to music which is an art in itself, I feel that the current UI needs to be more vibrant which will keep the existing reviewers engaged as well as attract the interest of new users.
As my Google Summer of Code project, I aim to extend the functionality of CB by adding support of reviewing more entities i.e.
Labels and migrate the ratings which existed on MB to CB as well as improve the current UI of the system.
My proposed idea is divided into two major objectives:-
- Implementation of CB-270. - Adding support for
Labelsin the current review/rating system.
- Migrate the ratings that existed on MB to CB:- This implementation is in accordance with the issue CB-245.
- Improving the UI - The present UI is very much cluttered and it needs improvement as a vibrant UI will engage the users with the project. More details are given below.
Optional Ideas - Planning to make a Statistics Page for CB based on user reviews using Data Visualization and the project will be based on d3.js.
1. Implementation of CB-270 :-
The database of MusicBrainz is already present in the docker-image
Database Query functions have to be written for getting entity info from the database for
recordings. This can be done using joins on the various tables like it is being currently implemented for the existing entities. Other relationships and related entities can be retrieved by separate query functions. After making queries, the retrieved data will be cached as it is being done presently for other entities.
The following tables have to be joined for respective entities for data to be retrieved:-
Works - For getting information like
work_typecan be joined and the data can be retrieved.
Recordings - In this case,
artist idsneed to be retrieved and this can be done by joining
artist_credit_namecan be joined and then the query can be done at once.
Labels - For Labels, tables
labels_typeneed to be joined for data retrieval.
- Artists - Queries for artists are already present in the codebase and only reviewing functionality has to be added to it.
frontend/external/musicbrainz/ the following files will be added to access data from DB:-
- label.py -
- get_label_by_id(): To fetch data of the label such as name and other details using its mbid.
- get_release_rels(): To fetch the releases by the label.
- get_multiple_rels(): To fetch various artists, work, places related to the label.
- work.py - Functions like
- get_work_by_id(): To fetch data of the place such as name and other details using its mbid.
- get_multiple_rels(): To fetch various artists, work, places related to the work.
- recording.py - Functions like
- get_recording_by_id(): To fetch data of the recording such as name, length using its mbid.
- get_multiple_rels(): To fetch various artists, work, places related to the recording.
There are examples of database queries for Recordings and Works respectively for better understanding:-
frontend/external/musicbrainz/tests/ folder various tests will be added to test the above functions.
Making changes to the UI for the new entities
- Entity Pages:- There should be entity pages for artists, labels, work, and recordings; displaying the average rating of all the reviews on that particular element. For this
viewsneed to be added in
critiquebrainz/critiquebrainz/frontend/views/to render pages related to the new entity.
The entity pages which have to be rendered will be stored in
/critiquebrainz/frontend/templates/. Following additional files have to be added to the folder:-
These pages will display the information related to that particular entity and the reviews that have been made on it.
Here are examples of entity pages as they will be shown on CB:-
Note:- The entities
work will have similar pages as shown above.
- Review Pages for new Entities:- Have to make changes in the review editor for the user to review the new entities. Inside
/frontend/templates/review/entityas well as in
/frontend/templates/review/modifyfollowing new files have to be added:-
Modifications are required in
/critiquebrainz/ws/review/views.py to facilitate the changes for new entity types.
VALID ENTITY TYPES table schema needs to be updated too.
Here are examples of review editor allowing users to review new entities:-
- Able to browse reviews by new entity types.
2. Implementation of CB-245:-
Presently on MB, five entities can be rated i.e.
work. The average ratings and rating count of each entity exist in *_meta tables. For each entity, a function can be added to their Database query files which exist in
frontend/external/musicbrainz/, which further can be used in
avg_rating.py file while calculating the average rating for a particular entity. Here is an example gist of the function that will fetch ratings of a particular recording from the recording_meta table:-
Further, the functions in the database query files can be used in
if entity_type=="release_group": rating_mb, rating_count_mb = db_release.get_rating_by_id(mbid) elif entity_type=="artist": rating_mb, rating_count_mb = db_artist.get_rating_by_id(mbid) elif entity_type=="recording": rating_mb, rating_count_mb = db_recording.get_rating_by_id(mbid) elif entity_type=="work": rating_mb, rating_count_mb = db_work.get_rating_by_id(mbid) elif entity_type=="label": rating_mb, rating_count_mb = db_label.get_rating_by_id(mbid)
rating_count can be calculated by taking the average of ratings and summing up the rating count of both CB and MB.
The data of the editors i.e. users who have rated the entities on MB can be fetched from the *_rating_raw tables. The example function to fetch editor information like name, mbid along with their individual ratings is present in the gist above in get_rating_users_by_id function.
There will be three possibilities which have to be taken into account while calculating average ratings as shown in the diagram below:-
(i). User has rated the entity on MB only:- In this case, we would take the user’s rating on MB into account while calculating the average rating.
(ii). User has rated the entity on CB only:- In this case, we would take the user’s rating on CB into account while calculating the average rating.
(iii). User has rated the entity on both CB and MB:- In this case, it would be better to give preference to the rating that existed on CB. Hence, we would take the user’s rating on CB into account while calculating the average rating.
Note:- Here, “Rated the entity on MB” means that the user has rated the entity as well as allowed other users to see their ratings.
3. Improving the UI:- The current UI needs improvement. Here are some of my ideas for homepage and user pages respectively.
- Homepage:- Presently, all the reviews are being shown in a cluttered manner. The current design doesn’t give a user a quick idea about the various features available on CB. For example:- In the present homepage design, a viewer has to go to different reviews to check their ratings.
In my proposed design, the user can view the ratings of the review on the homepage itself and he/she need not go on the review page. Moreover, a 3-D carousel will be a more attractive way of listing reviews.
This is my proposed design for Homepage:-
- User Pages:- The present UI of the user page has a tabular pagination system for User information and User reviews. The redesigned page allows everything to be on a single page. The User information can be contained inside a banner and the user reviews can be paginated below with their excerpts and ratings.
Here is the proposed design for User pages:-
While the User is not logged in:-
While the User is logged in:-
Note:- All the UI mock-ups depicted in the proposal are mere representations of how I envision the changes to be incorporated that suits the current design of the site. There may well be a better suggestion and final implementation at the completion of the project could be different.
Community Bonding (April 24 – May 13):-
In this period, getting myself familiar with the environment, I will fix existing bugs of CB. I will be in constant touch with the mentor discussing and finalizing the roadmap for the project.
Phase 1 (May 14 - June 11):-
In this period, I aim to complete the database access functions for
Labels entity type, and make necessary changes to the UI allowing users to review both of the entities. After completing their implementation I will start on with implementing review system for
Work on CB.
Phase 2 (June 12 - July 9):-
In this period, I will complete the implementation of the
Work entity as well as
Recording entity on CB. I’ll also start working on migrating the ratings from MB to CB i.e. writing database query functions.
Phase 3 (July 10 - August 6):-
In this period, I will complete migrating the ratings from MB as well as make the necessary changes in UI for it and will be making changes to the UI as per decided before. I will be working on improving user experience and I will be also spending time documenting stuff and fixing bugs.
Will continue to work on CritiqueBrainz and on other MeB projects too. Planning to make a Statistics Page for CB based on user reviews using Data Visualization and the project will be based on d3.js.
Detailed Analysis of my Timeline:-
Week 1:- Complete writing database query functions for
Artists and tests for them. Will also start making necessary changes to the UI for the new feature.
Week 2:- Will complete the changes to UI so that the review system for
Artists is ready. Will also start writing query functions for
Week 3:- Complete writing the DB query functions for
Labels as well as tests for them and will start implementing necessary changes to the UI for
Labels entity review system.
Week 4:- CUSHION WEEK: Will be completing all the stuff and fixing the bugs if any, and prepare for the Phase 1 evaluations.
Phase 1 evaluations
Week 5:- Working on the feedback from the mentors and complete integrating Frontend and Backend of the
Works entity type.
Week 6:- Complete the Database query functions along with their tests for
Recordings and start integrating it with the frontend.
Week 7:- Fixing all the bugs if any, and start writing queries for migrating ratings from MB to CB.
Week 8:- CUSHION WEEK: Complete any pending work, (if any) and Start discussing and finalizing with mentors about the New UI by making wireframes and mockups and prepare for Phase 2 evaluations.
Phase 2 evaluations
Week 9:- Complete writing queries for migrating rating from MB. Will also start making necessary changes to the UI for the new feature.
Week 10:- Complete adding support for the migrated ratings and start working on the Finalized UI mockups/wireframes as per discussed with the mentor.
Week 11:- Finish all the work on proposed UI and fix existing bugs if any.
Week 12:- Finish Documentation and start working on Optional ideas.
Week 13:- Pencils down week. Prepare for final submission making sure that everything is OK.
I am a first-year Electronics undergrad at Thapar Institute of Engineering & Technology, Patiala. I came across the world of open-source during Google Code-in 2014. In 2015, I came across MetaBrainz due to my love for music and since then, I have been contributing to various projects of this organization. I was also selected as a finalist in both Google Code-in 2015 & 2016 for my contributions. Here is my list of PRs to MusicBrainz, BookBrainz and CritiqueBrainz. I also have a blog on which I seldom post but I plan to use it regularly through the programme blogging about my progress with the project.
Question: Tell us about the computer(s) you have available for working on your SoC project!
Answer: I have an HP laptop with Intel i3 processor with 8GB Ram and 1TB HDD running a dual boot of Windows 10 and Ubuntu 16.04 LTS.
Question: When did you first start programming?
Answer: I was introduced to QBASIC in my 6th Grade in school and to JAVA in my 9th Grade. I started on with Python mostly in 10th Grade and since then I am trying to make small projects and Web applications.
Question: What type of music do you listen to?
Answer: I mostly listen to romantic Indian tracks. Arijit Singh and Atif Aslam are my favourite singers.
I also like Ed Sheeran and The Chainmokers. Here are some of my favorite albums/songs:-
Question: What aspects of CritiqueBrainz interest you the most?
Answer: I like to watch movies, read books and mostly I love to listen to music. But most of the time I find out that a person’s review about something is different from the famous critics. Here, CB makes me interested. In CB, one can write his own reviews and browse reviews written by people who have similar taste in music and this makes me love it.
Question: Have you ever used MusicBrainz to tag your files?
Answer: No, but I will definitely try it out.
Question: Have you contributed to other Open Source projects? If so, which projects and can we see some of your code?
Answer: I have made code contributions to MetaBrainz Foundation only till now about which I have written earlier but I also did some contributions to Sahana Software Foundation by reporting bugs on their tracker and by making changes to their wiki.
Question: What sorts of programming projects have you done on your own time?
Answer: I have made a small quiz game in Java and was working on a Flask based website for my school.
I also made a website which translates a webpage when its link is entered in various Indian languages in a hackathon. This project was based on Flask, BeautifulSoup of Python. Here’s the link (there may be some glitches in it).
I am also in the team working on the college’s computing society’s Flask based website. Here’s the link (This is in its initial stages).
Question: How much time do you have available, and how would you plan to use it?
Answer: I have my summer holidays during most of my GSoC period and I plan to work full time(40-50 hrs per week) on the project.
Question: Do you plan to have a job or study during the summer in conjunction with Summer of Code?
Answer: No, if selected for GSoC.