Tag Archives: critiquebrainz

GSoC 2017: Rating System in CritiqueBrainz

Hello!

I am Pinank Solanki, an undergrad at Indian Institute of Technology (IIT) Mandi, India. I worked with the MetaBrainz Foundation on one of its projects, as part of the Google Summer of Code 2017 over the last summer. It was one of the best and exciting summers I ever had.

Let me begin from the beginning. I first came to know about MusicBrainz in January and first contacted the community in February and was immediately hooked. Initially I decided to make a proposal for addition of book reviews for CritiqueBrianz, but it was not possible because the BookBrainz web service was unstable and the CritiqueBrainz’s host didn’t have direct access to BookBrainz database. So I tried to pitch my own ideas. But then, in one of the weekly meetings, I saw great support and enthusiasm among the community members for rating system for reviews —and I personally liked the idea of the project and thought it would be a great addition to CritiqueBrainz. I submitted my proposal, got accepted and a treat to the friends was due!

Overview

The aim of the project was to add support for three types of reviews: text, rating, text+rating (CB supported only-text reviews).

The schema changes and data-access functions are completed and merged. The frontend part is mainly completed including the fundamental functionality along with additional features. It took a lot of time to select and modify the rating input plugin perfectly satisfying the project’s needs. There is still some work to be done, most of which is based on the rating scale conversion in db package. Similarly, most of the web service part is completed and is held up due to the rating scale conversion PR.

Implementation

Schema changes

The schema changes done are quite different than what was mentioned in the proposal. My mentor for the project, Roman Tsukanov (Gentlecat), recommended some changes which would make keeping track of revisions a lot easier. You can see the schema here and the PR here.

Data-access functions

By the time I started working on the project, CB has migrated off the ORM. So, I wrote raw SQL queries and its tests. See the PR here. The rating scale was decided to be 1-5 but for storage a scale of 0-100 is used just like MusicBrainz keeping the possibility of migration of ratings from MB to CB in mind (more info at CB-245). This part is covered in the PR here.

Changes in user-interface

This plugin is used for rendering the rating star icons. The code can be seen in this PR. See the images below to get a good idea about the implementation.

Write review page:

cb-write-review

Review page:

cb-review

Entity page:

cb-entity-page

Revision comparison:

cb-revision-comparison

Web service

All the functionalities added to CritiqueBrainz had to be implemented in the web service (API) as well. All three types of reviews and other features are now supported via the web service. See the PR here.

Documentation

The chief part of the documentation was to update the schema. Other than that, rating parameter and several notes were added to the API documentation. See the PR here.

Other PRs relevant to the project can be found here.

Future work

First of all, I will complete the leftover work. Web service and frontend PRs are dependent on the rating scale PR. Once it gets merged, it’s 2–3 days of work to complete the rest.

Other than that, I look forward to keep contributing to CritiqueBrainz and other MetaBrainz projects. I am sure many interesting ideas will be discussed at the annual MetaBrainz Summit in Barcelona.

Conclusion

It was quite an eventful summer and GSoC was the biggest of them. Thanks to Roman for his constant help and guidance over the entire summer and also to all the other community members. It was so cool to work on an open-source project and I would definitely suggest for any music and data lover to explore the MetaBrainz projects.

GSoC 2017: Directly accessing MusicBrainz DB in CritiqueBrainz

Hello, everyone! This summer was fantastic for me!
I’m Suyash Garg, an undergraduate at National Institute of Technology, Hamirpur and I participated in Google Summer of Code 2017 contributing code to CritiqueBrainz. Alastair Porter mentored me during this GSoC programme. This post summarizes my contributions to the project and experiences that I had throughout the summer.

I started contributing to CritiqueBrainz in January, 2017 and before the start of the SoC programme, I mainly worked on writing raw SQL for retrieving data from the CB database and replacing the ORM code (CB-230). Other than that I worked on issues like CB-120, CB-235 and other minor bugs and issues. They were my first proper contributions to the open source world. Thank you MetaBrainz!!

For the Google Summer of Code 2017, my project involved retrieving data related to various entities (release-groups, artists, releases, events and places) directly from the MusicBrainz database instead of querying the MusicBrainz web service (CB-231). This became necessary as some pages on CB required to fetch too much data and thus made many requests to the MB web service. These pages were taking a long time to load. Thus, by connecting directly to the database, we could reduce the load time of these pages.

Here is a summary of my contributions to the project during the summer:

Accessing the MusicBrainz database
New Infrastructure is allowing us to easily read data directly from the MusicBrainz database. For accessing the database in the development environment, another service running the MusicBrainz database was added which uses an existing Docker image which the MusicBrainz project was already using. This allowed us to share resources between projects. I worked on adding an option to download the database dumps and import the data into the database (see PR#523). Also, I added the service in CB docker-compose files and updated the documentation for setting up the development environment (see PR#115 and PR#92).
Fetching data using mbdata.models
After setting up the development environment, my mentor suggested to me to use the mbdata package for writing queries to fetch data from the database instead of writing raw SQL. I worked on retrieving information for the entity: places and added helpers for fetching the relationship information. Following that, I worked on retrieving information for other entities (release-groups, releases, events, and artists). Also, since SQLAlchemy makes lazy queries to the database, a number of queries were being issued to the database. This could slow things down as for each query it was going to require one trip to the SQL server (network trip in production). So, as suggested by my mentor, I also worked on reducing the number of queries made for fetching data related to each entity (see PR#135). For pages that made a number of requests to the web service, I made this PR#121 for fetching information related to multiple entities at the same time.
Testing
For testing, the database queries are mocked using the unittest.mock Python package. The tests added make sure that the code (serializing RowProxy objects to dictionaries, caching, etc.) works properly (see PR#134). Adding up a new service (as a separate Docker container) in the test environment and running tests was taking too much time (in creating the tables and truncating them). So as suggested by my mentors, mocking the database queries was the best option. Throughout my GSoC period, I learned how important it was to write tests (especially when you break things more when you fix something) and make them run fast. I learned that «If tests don’t run fast, they would be a distraction rather than a help» (quoting from the book “The Art of Agile Development” by James Shore).

Other than these, I also worked on some UI/UX issues, namely CB-80 (adding option to filter releases with reviews), CB-84 (ordering release groups according to release year) and CB-261 (authenticating requests to Spotify Web API). CB-130 (reviewing entities with MBID redirects – see PR#145) was also solved while solving a production server issue.

This summer was awesome for me. I learned a lot of new things and techniques for writing better code. Thanks to my mentors, Alastair Porter and Roman Tsukanov. Also, great thanks to the lovely MetaBrainz community and Google for this opportunity. I’m really looking forward to keep contributing to CritiqueBrainz and to dive into other MetaBrainz projects.

Wrapping up Google Code-in 2015

The Google Code-in Google Code‐in is pretty much over for this time, and we’ve had a blast in our first year with the competition in MetaBrainz with a total of 116 students completing tasks. In the end we had to pick five finalists from these, and two of these as our grand prize winners getting a trip to the Googleplex in June. It was a really, really tough decision, as we have had an amazing roster of students for our first year. In the end we picked Ohm Patel (US) and Caroline Gschwend (US) as our grand prize winners, closely followed by Stanisław Szcześniak (Poland), Divya Prakash Mittal (India), and Nurul Ariessa Norramli (Malaysia). Congratulations and thank you to all of you, as well as all our other students! We’ve been very excited to work with you and look forwards to seeing you again before, during, and after coming Google Code-ins as well! 🙂

Rayna Kanapuram MusicBrainz presentation

Indian student Rayne presenting MusicBrainz to her classmates.

In all we had 275 tasks completed during the Google Code-in. These tasks were divided among the various MetaBrainz projects as well as a few for beets. We ended up having 29 tasks done for BookBrainz, 124(!) tasks for CritiqueBrainz, 95 tasks for MusicBrainz, 1 task for Cover Art Archive, 6 tasks for MusicBrainz Picard, 3 tasks for beets, and 17 generic or MetaBrainz related tasks.

Some examples of the tasks that were done include:

Ariessa MetaBrainz infographic

Finalist Nurul Ariessa Norramli’s MetaBrainz infographic.

In all, I’m really darn happy with the outcome of this Google Code-in and how some of our finalists continue to be active on IRC and help out. Stanisław is continuing work on BookBrainz, including having started writing a Python library for BB’s API/web service, and Caroline is currently working on a new icon set for the MusicBrainz.org redesign that can currently be seen at beta.MusicBrainz.org.

Again, congratulations to our winners and finalists, and THANK YOU! to all of the students having worked on tasks for MetaBrainz. It’s really been an amazing ride and we’re definitely looking forward to our next foray into Google Code-in!

Announcing the beta launch of CritiqueBrainz

I’m proud to announce that we’ve launched a beta version of our new project: CritiqueBrainz.

CritiqueBrainz is a music review site, where anyone can write a music review for an artist or a release-group (album, single, etc). Unlike Wikipedia’s neutral point of view policy, this site is about passionate reviews about music. If an album is horrible, please write a review about why it is horrible. If it is great, please write one telling us what makes it great.

All of the reviews in CritiqueBrainz will be Creative Commons licensed. The user has a choice to license their review under CC-by-nc-sa (disallowing commercial use) or CC-by-sa (allowing commercial use). To get the site started, the BBC was kind enough to send us their collection of almost 9,000 CC licensed reviews. Go and have a look — there are a lot of reviews for you to read, right now!

CritiqueBrainz is a new web site that was originally written by Maciej Czerwiński for last year’s Summer of Code. All of the goals for the project were met last year, but that didn’t leave us with a site that was ready for deployment. For this year’s Summer of Code, Roman Tsukanov picked up the project and immediately started fixing bugs, making improvements and generally rocking the project into stability and drastically improved the look and feel of the site. On the beginning day of Summer of Code, we’re ready for a beta release!

This past weekend, I attended Music Hack Day San Francisco and worked with Roman to add Spotify integration into the site. If you have a Spotify account, you can listen to the music as you read the reviews. So far, we’ve matched 250,000 release-groups in MusicBrainz to Spotify! Even if an album doesn’t have a review, you can still browse all of MusicBrainz via CritiqueBrainz and if we have a matched Spotify album, you can listen to it by clicking the play button under the cover art.

If an album you find doesn’t have a match in Spotify, we invite you to help us find a match and submit it to Spotify. Click on the “Match this!” link, which will execute a search via Spotify’s API to try and find a matching album. Due to some limitations in the Spotify API, this doesn’t work as well as we want to — we plan to pester Spotify to improve their API to make this a better experience.

We’re hoping to make CritiqueBrainz a user site that uses more cover-art and white space to make a site that is friendlier to browse the amazing pieces of information that MusicBrainz has collected. Unlike the data nerds at MusicBrainz, not everyone loves information overload; this site should hopefully make non-data nerds happy about MusicBrainz data.

If you find a bug, or have a suggestion for improving the site, please file a bug report here and Roman will have a look at it.

Thanks to everyone who had a hand in making this project a reality and thanks to Google’s Open Source programs office for making Summer of Code happen!

Summer of Code: We’ve accepted these projects

I’m pleased to announce the following 5 projects were accepted for this round of Summer of Code:

  • A new website for Picard and its plugins by Shadab Zafar: Give Picard a new website that will be used to host everything Picard related especially its plugins. Also add an interface which can be used to download those plugins right from picard.
  • MBS-6201: Add an “event” entity by reosarevok: Finalising the basic implementation of MBS-799 by adding an event entity to MusicBrainz.
  • Finishing and deploying CritiqueBrainz by Roman Tsukanov: Last year Maciej Czerwiński started work on repository for Creative Commons-licensed reviews – CritiqueBrainz project. He implemented core functionality: storage, API, and web interface. During Google Summer of Code 2014 I’d like to continue his work, finish and deploy the project.
  • MB UI TLC by navap: Spend some major TLC on all the templates and UI of MB.
  • Move MusicBrainz Search to SOLR by Wieland Hoffmann: The goal of this project is to move the MusicBrainz Search server to use SOLR for faster and in-place index updates.

The whole MusicBrainz dev team is very excited to have students take on these projects. We’ve been waiting for events for an eternity and after 9 months of no progress, I’m stoked that soon we will release CritiqueBrainz.

Congratulations to mineo, navap, duffer, gentlecat and reosarevok. And big thanks to Google for having us in Summer of Code again.