feat: weekly recap / trends screen (TASK-028) - #12
Open
shroominic wants to merge 2 commits into
Open
Conversation
Add WeeklyRecapAnalytics in cgm_core computing a 7-day recap: per-day time-in-range/average/variability buckets, this-week-vs-last-week deltas (average, TIR, CV), best/worst day by time-in-range, top upward spikes, and day-of-week average patterns. Wellness framing — observations for self-experimentation, not medical metrics. Unit-agnostic (values kept in mg/dL; UI converts). Includes thorough unit tests for bucketing, deltas, best/worst, spikes, day-of-week, and empty/partial weeks. Refs: TASK-028 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a self-contained Weekly recap screen summarising the last 7 days as plain-language cards: this-week overview (TIR, average, variability, spikes), versus-last-week deltas with direction colouring, steadiest and bumpiest day, top spikes, and a day-of-week pattern bar chart. Unit-aware (mg/dL <-> mmol/L), wellness-framed with the standard disclaimer, and graceful empty/partial-week states. Reached via a single "Weekly recap" button on the dashboard. Includes widget tests for data, empty, and mmol/L rendering. Refs: TASK-028 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Weekly recap / trends screen (TASK-028)
A self-contained weekly recap screen that summarises the last 7 days of glucose readings as plain-language patterns and observations for self-experimentation — explicitly not medical metrics or advice.
Aggregations (
packages/cgm_core— newweekly_recap.dart)WeeklyRecapAnalytics.recap(...)computes, over the 7-day window ending today:DailyRecapper calendar day (TIR / average / variability), empty days included.WeekDelta(current/previous/delta, null-safe when a week has no data).Values stay in mg/dL; the UI converts. Reuses
GlucoseAnalytics.summarizefrom the metrics pack.Screen (
openhealth/lib/src/weekly_recap/weekly_recap_screen.dart)Clean cards, each with a one-line plain-language explanation:
main.dartedit so it won't conflict with sibling branches).Tests
packages/cgm_core/test/weekly_recap_test.dart— 15 tests: window bounds, per-day bucketing, best/worst, week deltas, top spikes (+ cap), day-of-week weighting, empty/partial weeks.openhealth/test/weekly_recap_screen_test.dart— 3 widget tests: data render, empty state, mmol/L.flutter analyzeclean (only a pre-existing lint in an untouched file); fullflutter test+dart testgreen.Verification
Verified on iPhone 15 Pro Max simulator in demo mode with multi-week data — overview, week-over-week deltas, best/worst day, top spikes, and the day-of-week bar chart all render correctly.
Refs: TASK-028
🤖 Generated with Claude Code