Skip to content

Add statistics data models for charts - #361

Draft
dmoo500 wants to merge 3 commits into
music-assistant:mainfrom
dmoo500:feat/statistics-models
Draft

Add statistics data models for charts#361
dmoo500 wants to merge 3 commits into
music-assistant:mainfrom
dmoo500:feat/statistics-models

Conversation

@dmoo500

@dmoo500 dmoo500 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What does this implement/fix?

Adds data models for the new Statistics Controller feature, defining the structure for playlog analytics responses (top items, distributions, time series, heatmaps, listening time).

⚠️ Note: While these models are correct, the backend statistics currently show incorrect play counts due to a playlog database design issue. See music-assistant/server#5700 for details.

Related issue (if applicable):

New Models

  • TopItemResult: Combines ItemMapping with play_count for top charts
  • DistributionItem: Name/value pairs for pie/bar charts (artists, genres, decades)
  • TimeSeriesPoint: Timestamp/value pairs for line charts (plays over time)
  • HeatmapPoint: Hour/weekday/value tuples for activity heatmaps
  • ListeningTimeItem: Name/minutes pairs for listening time charts

Types of changes

  • New feature (non-breaking change which adds functionality) — new-feature

Checklist

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • pytest passes, and tests have been added/updated under tests/ where applicable.
  • Any consumer of a changed model is updated, and the companion PR in music-assistant/server is linked.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.

Related PRs

Moos, Daniel added 2 commits August 14, 2026 22:49
- Add DistributionItem for genre/artist distribution charts
- Add TimeSeriesPoint for plays over time
- Add HeatmapPoint for listening activity heatmap
- Add ListeningTimeItem for time-based aggregations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature This implements a complete new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant