feat(activity): add an activity calendar with personal baseline and goals

A week or month of steps, active minutes, workouts by sport and training
load, each day placed against the person's own spread over the 84 days
before the period and each period against the median of the twelve weeks
or six months before it. Optional weekly and monthly goals live on the
account (activity_goals_json), travel with the backup and are cleared by
a data wipe. The calendar sits on the workouts page; the steps page links
to it. Computed server-side without AI.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 21:38:32 +02:00
1 parent e1b70537cc
commit 5eb7caebae
40 files changed
+4172 -6

No files matched your search

@@ -0,0 +1,9 @@
-- Optional per-user activity goals for the activity calendar: workouts,
-- active minutes and steps per week, steps per month.
--
-- Nullable, no default, no backfill: null reads as "no goal set", which is
-- every account's state today.
--
-- Reversibility: dropping the column removes the goals; nothing else reads it.
ALTER TABLE "users" ADD COLUMN "activity_goals_json" JSONB;
+6
View File
@@ -380,6 +380,12 @@ model User {
/// Settings > System through `/api/settings/preview-features`.
/// @pending-consumer(topics preview) the `topics` flag is stored and shown, but no surface reads it yet; the topic overview pages will.
previewFeaturesJson Json? @map("preview_features_json")
/// Optional activity goals the person set for themselves: workouts, active
/// minutes and steps per week, steps per month. Null or an absent key = no
/// goal. Parsed by `src/lib/validations/activity-goals.ts`, written through
/// `/api/activity/goals`, read by the activity calendar
/// (`/api/activity/calendar`), which reports progress against each goal set.
activityGoalsJson Json? @map("activity_goals_json")
// Blood-glucose display unit preference. Canonical storage is mg/dL.
glucoseUnit String? @map("glucose_unit") // "mg/dL" | "mmol/L" | null = default "mg/dL"
// v1.18.6 — explicit "I have diabetes / clinician glucose targets" opt-in.