feat(etl): normalize genre on entity_manager track writes#367
Merged
Conversation
Exposes three new JSON endpoints from the explorer console layer:
GET /api/v1/events - paginated list of active events
GET /api/v1/events/:id - single event by numeric ID
GET /api/v1/events/:handle/:slug - resolve contest permalink to event
Each response includes a permalink field constructed as
/<handle>/contest/<slug> via a LEFT JOIN on the event_routes table
(added in migration 0034) and the users table for the owner handle.
New files:
pkg/etl/db/event_reads.go - hand-written db.Queries methods (GetEventByID,
GetEventBySlug, ListEvents) using the same
sqlc pattern as reads.sql.go
pkg/explorer/event_api.go - Echo handlers + eventResponse JSON type
All existing tests pass; go build ./... is clean.
Add NormalizeGenre, the canonical genre-normalization function for the Audius platform. It maps known community variants (hiphop, r and b, dnb, edm, lofi, etc.) to their canonical GenreAllowlist form and applies a title-cased baseline to anything unrecognized. Matching is case-insensitive with whitespace trimmed/collapsed. Wired into the track create and update validate paths so every genre written to PostgreSQL is normalized in place. No backfill — new writes only. GenreAllowlist is used as the canonical target set and left unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds genre normalization to the go-openaudio
entity_managerETL write path. This is intended as the canonical source of truth for genre normalization across the Audius platform.NormalizeGenre(genre string) string(inpkg/etl/processors/entity_manager/genre_normalize.go):GenreAllowlistform, e.g.:hip-hop,hiphop,hip hop,hip hop/rap,rap→Hip-Hop/Rapr&b,rnb,r and b,r&b/soul→R&B/Souldrum & bass,drum and bass,dnb→Drum & Bassedm,electronic dance music→Electroniclo-fi,lofi,lo fi→Lo-FiThe variant table is seeded from
GenreAllowlistitself, so canonical spellings are always valid targets.GenreAllowlistis left unchanged.Wiring
NormalizeGenreis called from the track create and update validate paths (track_create.go,track_update.go), normalizingparams.Metadata["genre"]in place so the canonical value is what gets inserted/merged into PostgreSQL.Notes
GenreAllowlistentry. DB-backed/integration tests skipped (Docker unavailable in this environment).go build ./...,go vet, andgo test -run TestNormalizeall pass./v1/genres/popularis handled separately in feat: normalize genre variants to a canonical form AudiusProject/api#962, which currently uses different canonical forms — to be aligned in a follow-up.🤖 Generated with Claude Code