Hello everybody! My name is Shamroy Pellew, and I am a rising sophomore at SUNY Buffalo.
This summer, as part of Google Summer of Code, I collaborated with the MetaBrainz Foundation on CritiqueBrainz, the foundation’s archive of user‐written music reviews. I have accomplished much in these past four months, and it has been a great experience working under the guidance of my mentor, Suyash Garg. Even though there is still some work to be done, most of the code I wrote has either been merged or is in code review, and I believe it is safe to say I achieved the goal of my original proposal.
Proposal
I initially planned to use the mbdata package to query the MusicBrainz database for information regarding artists, labels, recordings, and works, so I can achieve my goal of supporting reviews for these entities on CritiqueBrainz. However, I soon discovered that there exists BrainzUtils, a Python package with “common utilities used throughout MetaBrainz projects.” So it was decided that it would be best to use those utilities, instead of writing my own. Of course, a few changes had to be made. CritiqueBrainz had features that BrainzUtils was missing, so those had to be moved over and merged. The inclusion of BrainzUtils was the only real divergence between my original proposal and my actual course of action. Otherwise, everything went according to plan.
Phase 1
Adapting CritiqueBrainz code to be used in BrainzUtils was a bit of a learning curve, and took up a good majority of the first phase. I had to gain familiarity with both code bases and the difference between Python 2 and 3. I also had to write some new unit tests, to ensure everything was functioning as it should, which I’ve never done in Python before. The existing BrainzUtils code and feedback from my mentor were a great help though.
Here are the merged pull requests for this phase:
- Implemented retrieval and/or testing of additional entities (BrainzUtils)
- Added “artist_credit” and “type” to release group’s test data (BrainzUtils)
Phase 2
After I finished moving features to BrainzUtils, but before I could add support for reviewing new entities, I had to convert the existing CritiqueBrainz functionality to use BrainzUtils for data retrieval. This was a simple change, as the same code was being used, but from a different source. Once that was done, I moved on and began to work on the reviewal of new entities.
Here are the merged pull requests for this phase:
Phase 3
Adding support for reviewing of new entity types required the same simple steps for each new type. First, the new types were each added to the existing SQL script which declares entity types, and for each new type, an ALTER script was made. Then, I retrieved information about each entity through BrainzUtils, including any necessary supplementary data. The searching for the new entity types also had to be implemented, using musicbrainzngs, a Python binding for the MusicBrainz web API. So, I wrapped the musicbrainzngs searching API call in a function and created new HTML templates, using Jinja, for finding the new entities. Finally, I had to enable reviews for the new entity types. I edited the list of reviewable entity types and the existing review templates to include data about the new types.
Naturally, by this point in the project, a few bugs had popped up. There were problems with handling deleted entities, some with data not being displayed, and even cases where data was completely missing. These were solved as they appeared, and were only minor headaches.
Here are the merged pull requests for this phase:
- Implemented the reviewal of artists (CritiqueBrainz)
- Implemented the reviewal of labels (CritiqueBrainz)
- Implemented the reviewal of recordings (CritiqueBrainz)
- Implemented the reviewal of works (CritiqueBrainz)
- Implemented handling of deleted entities (CritiqueBrainz)
- Artist review creation page title does not have artist name (CritiqueBrainz)
- Added rating support for artists (CritiqueBrainz)
- Added flags to suppress exceptions from get entities (BrainzUtils)
- Updated fetch_multiple_*_empty tests to include ‘includes’ (BrainzUtils)
Overall, there was also some human error on my part that slowed things down. I could have communicated more effectively and delivered each task piece by piece, which would have resulted in better feedback from my mentor.
Conclusion
In total, I have opened a total of 17 pull requests across BrainzUtils and CritiqueBrainz. If I had more time, though I would have liked to work on my stretch goal of incorporating entity ratings from MusicBrainz into CritiqueBrainz. Although I did manage to open a BrainzUtils pull request for serializing the MusicBrainz ratings when fetching information, I did not get a chance to do anything with this data.
I’d like to thank the MetaBrainz Foundation for this amazing opportunity. Thanks to the team and thanks to Google, I was able to produce something that people everywhere will be able to use. I learned a lot about open source this summer, and I was able to polish up on my Python skills. I’m looking forward to continuing work on CritiqueBrainz and the continued support from the MetaBrainz team!
[from https://ift.tt/2lc8A0P]
No comments:
Post a Comment