Repository navigation
feat: weekly recap / trends screen (TASK-028) - #12
Merged
Merged
Conversation
…ator testing Add a compile-time OG_DEMO build flag (--dart-define=OG_DEMO=true) so native/simulator builds run the in-memory DemoCgmDriver instead of the real BLE Aidex driver, and auto-scan + auto-connect on launch so the app lands directly on the populated dashboard. The iOS simulator has no Bluetooth, so this unblocks simulator-based feature verification. When the flag is false (the default), behavior is unchanged: production builds keep using the real AidexSensorDriver and the manual scan flow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add pure-Dart glucose analytics in cgm_core (glucose_analytics.dart): time-in-range / below / above, average, SD, CV, estimated GMI-style indicator, and spike count over 24h/7d/14d windows with configurable range bounds (default 70-180 mg/dL). Fully unit-tested with synthetic readings. Render these in a new explainable, wellness-framed "Patterns" section on the dashboard (metrics_section.dart) with a timeframe selector, a one-line plain-language explanation per metric, and unit-pref-aware formatting. Edits to main.dart are minimal and clearly delimited. Wellness/self-experimentation framing only: observations and patterns, not medical metrics or diagnosis. Refs: TASK-012 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
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