Skip to content

feat: weekly recap / trends screen (TASK-028) - #12

Open
shroominic wants to merge 2 commits into
feat/metrics-packfrom
feat/weekly-recap
Open

feat: weekly recap / trends screen (TASK-028)#12
shroominic wants to merge 2 commits into
feat/metrics-packfrom
feat/weekly-recap

Conversation

@shroominic

Copy link
Copy Markdown
Owner

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.

Stacked PR. Rebase chain: #4#6 (feat/metrics-pack) → this. Branched off feat/metrics-pack to reuse its glucose_analytics.dart and demo mode. Merge after #4 and #6.

Aggregations (packages/cgm_core — new weekly_recap.dart)

WeeklyRecapAnalytics.recap(...) computes, over the 7-day window ending today:

  • Per-day breakdown — one DailyRecap per calendar day (TIR / average / variability), empty days included.
  • Week-over-week deltas — average, time-in-range, and variability (CV), each as a WeekDelta (current/previous/delta, null-safe when a week has no data).
  • Best / worst day — by time-in-range.
  • Top spikes — largest above-range upward swings, with peak, baseline, and amplitude (capped at 3).
  • Day-of-week patterns — reading-count-weighted average per weekday (Mon→Sun).

Values stay in mg/dL; the UI converts. Reuses GlucoseAnalytics.summarize from the metrics pack.

Screen (openhealth/lib/src/weekly_recap/weekly_recap_screen.dart)

Clean cards, each with a one-line plain-language explanation:

  • This week at a glance · Versus last week (direction-coloured deltas) · Steadiest & bumpiest day · Top spikes · Day-of-week pattern bar chart.
  • Unit-aware (mg/dL ↔ mmol/L), graceful empty / partial-week states, and the standard wellness disclaimer.
  • One entry point: a "Weekly recap" button on the dashboard (minimal, clearly delimited main.dart edit 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 analyze clean (only a pre-existing lint in an untouched file); full flutter test + dart test green.

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

shroominic and others added 2 commits June 23, 2026 20:28
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>
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