refactor(research): simplify ID extraction and normalization logic

AH
6mo ago
+169-30

This commit refines the extraction and normalization processes for track and artist IDs across various functions. The extractProviderTrackId and resolveArtist functions have been updated to exclusively use a single provider-neutral id, removing legacy fields. Additionally, normalization functions for artist and track records have been adjusted to omit SongStats-specific ID aliases, streamlining the data structure. Tests have been updated accordingly to ensure consistent behavior.


Summary by cubic

Unify research IDs to a single provider‑neutral id for tracks, artists, and albums, removing SongStats alias fields from normalized payloads and catalog results. Adds album normalization and cleans up get‑ids and catalog mapping to keep outputs consistent across endpoints.

  • Refactors

    • Apply provider‑neutral id everywhere; strip alias keys via providerIdAliases in normalizeArtistRecord, normalizeTrackRecord, normalizeAlbumRecord, normalizeTrackObject (delegates), and normalizeTrackLookupObject.
    • extractProviderTrackId and resolveArtist read id only.
    • mapSongstatsArtistPath normalizes albums with normalizeAlbumsCatalogItem and tracks with normalizeTrackRecord.
  • Migration

    • Replace any use of songstats_artist_id, artist_id, songstats_track_id, track_id, songstats_track_ids, songstats_album_id, and album_id with id.
    • For get‑ids responses, expect a single id instead of songstats_track_ids.

Summary by CodeRabbit

  • Refactors
    • Enhanced consistency in research data normalization by standardizing how identifiers are handled across tracks, artists, and albums.