smlc-features / data_dictionary.md
TomMoeras's picture
Add edition-level musical_director + md_status columns (Sanremo conductor / Mello kapellmästare), sourced from Wikipedia
f333d16 verified
|
Raw History Blame Contribute Delete
11.1 kB

Spine data dictionary

Storage encoding (fix round 2, N2): the list- and dict-typed columns below (age_band_points, artists, composers, jury_rank, lyricists, source_urls) are stored as JSON text in BOTH spine.csv and spine.parquet, not as parquet's own native list/struct types. Always read them with schema.read_csv/schema.read_parquet, never pd.read_csv/pd.read_parquet directly -- the schema.* readers decode the JSON text back into a Python list/dict; a bare pd.read_parquet call returns the raw JSON string for these columns instead.

column type description
song_id str Stable slug: <san|mel>--, numeric suffix on collision
contest str sanremo | mello
year int Edition year
edition_number int Ordinal edition number
title str Song title as in the universe source
artist str Display artist string
artists list Individual performers
stage str sanremo: campioni | nuove_proposte. mello: heat | andra_chansen | final
heat_number int Mello heat number, null otherwise
running_order int Start number in the stage
lyricists list Lyric credits
composers list Music credits
songwriters_raw str Verbatim credit string from the source
credit_split_known bool True only where the source marks text against music
reached_final bool Entry competed in the final
final_rank int Rank in the stage's final ranking, null if the entry did not reach it
stage_rank int Rank in the stage's final ranking, null if the entry did not reach it (equal to final_rank for a Sanremo row, since a Sanremo stage's final ranking is its only ranking)
outcome str winner | finalist | eliminated_heat | eliminated_andra_chansen | withdrawn
is_winner bool Won the edition
televote_count int Raw televote count where published
televote_points int Televote points where published
age_band_points dict Mello age-band points, JSON object
jury_rank dict Sanremo jury component ranks, JSON object keyed by component
televote_rank int Sanremo televote rank where published
vote_detail_available bool Any vote detail present
went_to_eurovision bool Represented the country at Eurovision. Null means unknown: no entrant-level source item exists for that country's edition to match against, not a known non-participation. False for a cancelled edition too (2020: a country's own selected entrant is known but the contest itself was never held, so nothing actually represented anyone). Review fix round 1, I6: the link can rest on ARTIST evidence alone for a national-final winner (no matching title candidate, but the same performer is confirmed to have represented the country that year) -- in that shape eurovision_rank/eurovision_year/wikidata_qid_song describe THAT Eurovision entry, which is not always the same song as this row's own title (e.g. an act winning the national final one year and being sent to Eurovision with a newly written song instead of their winning entry). A handful of confirmed cases of the latter are corrected to False via data/review/overrides.csv (reason=no_eurovision) rather than left silently wrong; a title-verified link does not have this caveat.
eurovision_year int Eurovision year. See went_to_eurovision's own caveat: for an artist-level link, this describes the artist's real Eurovision entry, which is not guaranteed to be this row's own song
eurovision_rank int Eurovision final placement. See went_to_eurovision's own caveat: for an artist-level link, this is the real entry's placement, not necessarily this row's own song's
wikidata_qid_edition str QID of the edition
wikidata_qid_artist str QID of the main performer. Always null in v1 -- population deferred, not yet built
wikidata_qid_song str QID of the song, usually null. See went_to_eurovision's own artist-level-link caveat
isrc str ISRC from Deezer or iTunes. Identifies a RECORDING of the song, not necessarily the exact performance from the contest -- a remaster, radio edit, live recording, instrumental, or later re-recording under the same title can all be the recording an isrc/preview_url points at (review fix round 1, I1/I2). Always cross-check preview_url/duration against the expected recording before using either for anything sensitive to the specific master (e.g. audio feature extraction)
deezer_id int Deezer track id
itunes_id int iTunes track id
preview_url str 30 s preview URL. Expires (hdnea token in the Deezer URL, an Apple CDN URL for iTunes) -- re-resolve via deezer_id/itunes_id before use, do not store or rely on the URL itself past the run that produced it. See isrc's own caveat: may be a different recording (remaster/edit/live/instrumental/re-recording) of the same song
streaming_match_confidence str high | medium | reviewed | isrc, null if unmatched. high/medium: best_match's own algorithmic floors (title >= 85 always; high additionally needs both title and artist >= 90). reviewed: a human decision recorded in data/review/streaming_matches.csv, or the narrow safe-suffix-variant class auto-accepted from the near-miss band (title 60-85, artist near-certain) -- weaker title evidence than high/medium, confirmed correct per-row rather than by the algorithm's own strict floor (review fix round 1, Minor 5). isrc: deezer_id/preview_url were back-filled by smlc.enrich.spotify's cross-fill pass, which resolves Deezer's own ISRC endpoint for an isrc that came from Spotify (a Spotify search hit's own external_ids.isrc, for a row Deezer/iTunes never matched at all) -- an exact isrc match, not a fuzzy title/artist one, so treated as at least as strong as high
spotify_id str Spotify track id, resolved via the Web API client-credentials flow (smlc.enrich.spotify). ISRC-first: for a row that already has an isrc (from Deezer, see isrc above), resolved by an exact isrc: search against Spotify's own catalogue -- Spotify's catalogue is not identical to Deezer's, so this can legitimately fail even for a row Deezer matched. Every other row (no isrc, or a failed isrc lookup) falls back to a title+artist search scored by the same streaming.best_match floors (title >= 85, artist >= 70) used for deezer_id/itunes_id. Carries the same isrc/preview_url caveat: identifies a RECORDING, not necessarily the exact contest performance
spotify_match_confidence str isrc | high | medium, null if unmatched. isrc: resolved by an exact isrc: search, the strongest evidence available (not a fuzzy title/artist match at all). high/medium: streaming.best_match's own floors, exactly as documented under streaming_match_confidence -- a separate value space from that column, since a row can be isrc-confident on Spotify while only medium (or unmatched) on Deezer/iTunes, or vice versa
source_primary str Universe source for the row
source_urls list All source URLs that contributed
match_confidence str exact | fuzzy_reviewed
notes str Free text, verbatim anomalies

Lyrics artifacts data dictionary

lyrics_manifest.csv

column type description
song_id str Spine song_id this row documents (1:1 with spine.parquet)
source str Lyrics source module that supplied this row: leparoledisanremo | lyricstranslate | letras | eurovisionworld | none (no source had a candidate)
url str Source URL the text was fetched from, empty for missing/ambiguous rows
retrieved_at str UTC ISO-8601 timestamp of the fetch, or of the most recent rebuild attempt for a still-missing/ambiguous row
sha256 str SHA-256 of the stored text file's bytes, empty unless status is found
source_language_label str Language label as stated by the source page. Often empty -- see caveats below
status str found | missing | ambiguous
char_count int Character count of the normalised stored text, 0 unless found
line_count int Line count of the normalised stored text, 0 unless found

lyrics_coverage.csv

column type description
contest str sanremo | mello
year int Edition year
stage str Same stage vocabulary as the spine (see the stage row above)
n_entries int Spine entries in this (contest, year, stage) group
found int Entries with a stored lyrics text
missing int Entries with no lyrics recovered
ambiguous int Entries where multiple candidates were found and no single one was confirmed correct
coverage float found / n_entries

lyrics_run_log.csv

column type description
timestamp str UTC ISO-8601 timestamp of this build_all() run
found int Rows newly recorded status=found in this run
missing int Rows newly recorded status=missing in this run
ambiguous int Rows newly recorded status=ambiguous in this run
title_mismatch int Fetched pages this run whose own title failed verification against the spine title (see reconcile/store's _verified_title)

Known caveats

  • 164 of 948 Mello found rows have an empty source_language_label (all 140 letras rows, which never populate this field, plus 24 lyricstranslate rows where the source page itself didn't declare a language). Downstream language-regime analysis should not rely on this field alone for those rows and will need its own language detection pass.
  • 27 of 3145 stored texts contain a standalone bracketed section-label line left in the body (e.g. [Refräng], [Vers 1], [Jojk], (Chorus)), mostly from lyricstranslate and leparoledisanremo. These will inflate token counts slightly if not filtered before use.
  • Sanremo texts carry essentially no stanza structure (2109 of 2197 have no blank-line break at all) while Mello texts mostly do (5 of 948 lack one). Confirmed against the raw leparoledisanremo cache to be a genuine source-side property, not an extraction defect. Any stanza-level or line-block feature is reliably measurable on the Mello half of the corpus and not on the Sanremo half -- this asymmetry should be a documented caveat wherever such a feature is computed.

Edition-level enrichment (added 2026-09)

column type description
musical_director str Orchestra conductor / musical director of the edition (Sanremo "direttore d'orchestra / direzione musicale", Melodifestivalen "kapellmästare"). Edition-level, repeated on every entry of that edition. Null unless a single/principal edition-level director is named. Sourced from Italian (Sanremo) and Swedish (Melodifestivalen) Wikipedia edition articles.
md_status str Coverage flag for musical_director: named (a single/principal edition director is documented), per_song (each song had its own conductor, no single edition director), no_orchestra (playback, no live orchestra that edition), not_stated (the source does not report it).