Skip to content

feat(recap): place the year's sound within the library (ADR-0156) - #423

Merged
jeffcrouse merged 1 commit into
mainfrom
feat/recap-library-percentiles
Oct 31, 2026
Merged

jeffcrouse merged 1 commit into
mainfrom
feat/recap-library-percentiles

Conversation

@jeffcrouse

Copy link
Copy Markdown
Member

Summary

For each of the year's sound medians (bpm, energy, valence, danceability), sound.library_percentile adds its percentile rank among every analysed track in the library, 0–100, with ties counted as half.

The raw medians can't stand on their own. On the NAS, the analysis scores the whole library at median energy 0.83, valence 0.85 and danceability 0.15, so "0.85 energy" means "typical", not "energetic". A slide can say "calmer than your library" from the percentile.

It's one aggregate query over track_analysis. The change is additive, the contract stays at v1, and openapi.json, contract.lock.json and the generated client are regenerated. ADR-0156's Implementation block records it.

Test plan

  • tests/test_recap.py: 21 pass. The new test pins the arithmetic: below, the track itself counted as half, everything level → 50, and no median → None.
  • ruff, mypy
  • After merge: make deploy-dev and read the percentiles for the real profile

🤖 Generated with Claude Code

The analysis scores this library high on energy and valence and low on
danceability throughout (library medians 0.83, 0.85, 0.15 on the NAS), so
a raw median of 0.85 energy says "typical", not "energetic". Each median
now also comes with its percentile rank among every analysed track, ties
counted as half, so a slide can say "calmer than your library".

Additive; contract stays at v1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeffcrouse
jeffcrouse merged commit 255624f into main Oct 31, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant