LB-1827: Add payload documentation for year-in-music stats api#3484
LB-1827: Add payload documentation for year-in-music stats api#3484MonkeyDo merged 5 commits intometabrainz:masterfrom
Conversation
|
The documentation should ideally describe how the payload has changed over the years, not just give one example. And perhaps explicitly warn that the payload can get rather big compared to other endpoints. And if this PR could also resolve the |
hi @Zastai, thanks for pointing this out. The behavior you’re referring to is specific to the legacy
yes, I’ll address this duplication for the legacy endpoint as well in this PR. |
MonkeyDo
left a comment
There was a problem hiding this comment.
Thanks for working on this documentation !
Some improvements suggestions and small changes below
|
|
||
| - Payload structure matches the non-legacy endpoint. | ||
| - ``yim_artist_map`` is no longer present. | ||
| - Playlist cover art mappings (``playlist-*-coverart``) are still included. |
There was a problem hiding this comment.
That is incorrect, from 2023 onwards the cover art is not separated in *-coverart mappings, but instead for each track a caa_id and caa_release_mbid is included in track.extension["https://musicbrainz.org/doc/jspf#track"].additional_metadata
|
@amCap1712 There is a duplicate key in the 2022 yim payloads, UPDATE statistics.year_in_music
SET data = data - 'yim_artist_map'
WHERE year = 2022 AND data ? 'yim_artist_map';/me learns about JSONB operators in PG |
|
@MonkeyDo done with the changes, thanks! |
Edits JSON data in place to remove duplicate yim_artist_map field from 2022 data
MonkeyDo
left a comment
There was a problem hiding this comment.
Looking good, thanks for the clarifications.
I took the liberty of making a couple of changes to remove the duplicate data, hope you don't mind the intervention.
I tested my script locally on data I copied from the production database, and learned some new SQL in the process.
Will be removed with script added in 7e37ba6
For the record, I ran this update script on the production DB after extensive local testing. |
PR contains a schema update, don't forget to run the update file
Problem
The
GET /1/stats/user/{user_name}/year-in-musicendpoint is listed in the doc but does not describe the structure of its response payload.Ticket: LB-1827
Solution
Added a detailed docstring documenting the full response payload structure for the year-in-music stats api. Also included
yearas a top level property in the payload and updated the default year from 2024 to 2025.Action
No additional action required after merge.