feat: add GitHub-style activity calendar heatmap to Overview - #136
Merged
Merged
Conversation
Adds get_daily_activity() (analysis_utils.py) to compute zero-filled per-day activity counts across Last.fm scrobbles and Swarm check-ins, and wires a hand-rolled go.Heatmap calendar into the Overview page with an inline source selector (All activity/Music/Check-ins). Rejected the issue's suggested plotly-calplot dependency (unmaintained) in favor of a zero-new-dependency implementation using only already-declared plotly/pandas. The selector omits Fitness/Films options since those pages have no real backing data source yet. Closes #27 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4VmTCuiAVzu9ftLjocP6d
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
get_daily_activity(df, swarm_df=None, source="all")toanalysis_utils.py— computes zero-filled per-calendar-day activity counts across Last.fm scrobbles and/or Swarm check-ins, using the exact date-normalization patterns already established elsewhere in this codebase._build_calendar_heatmap_figure()+render_activity_calendar()), with an inline source selector ("All activity" / "Music" / "Check-ins") shown only when Swarm data is actually loaded.plotly-calplotdependency — confirmed unmaintained (no repo activity in the last month, maintainer stepped away) — in favor of a hand-rolledgo.Heatmapusing onlyplotly/pandas, both already declared dependencies. Zero new packages added.pages/fitness.pyandpages/culture.pyare still stub pages with no real backing data source, so those options would be dead UI.CALENDAR_HEATMAP_SCALEconstant incomponents/theme.py(the exact 4-stop indigo→cyan scale from the issue), reused rather than hardcoded inline.0-valued cell (not a gap/NaN), so the calendar always looks complete even on sparse data.Test plan
get_daily_activity(): zero-fill across internal gaps, multi-source summation, source isolation, None/empty input handling, invalid-sourceValueError, tz-naive output guarantee (tests/test_analysis_utils.py)colorscale, zero-fillz-grid values,hovertemplate) rather than just "a chart rendered" — first such precedent in this codebase (tests/test_overview.py)st.infodegradation on an empty resultpytest -n auto→ 1048 passedpackages/localizersuite:pytest -n auto→ 431 passedruff check ./ruff format --check .— cleanmypy— cleanCloses #27