Commit Graph
11 Commits
Author SHA1 Message Date
Marc-André Bombeck 7bb4b8d9c5 style: format the demo seed 2026-06-20 10:19:33 +02:00
Marc-André Bombeck 9b8cd819f4 fix(demo): consent the demo user and anchor today's doses to their slots
Mint an active AI-processing consent receipt for the demo user so the
Coach renders its sample conversation without a consent-accept write the
read-only tenant rejects. The receipt is kind `ai_full`, the master grant
the Coach and Insights gates both accept; the read path only checks an
active row of that kind, so a placeholder artefact suffices. Add a
consent_receipts reset to keep the seed idempotent.

Anchor every taken intake's scheduled_for on its canonical dose-slot
instant (08:00 morning, 20:00 evening, Europe/Berlin) with taken_at set
slightly later, so the row is slot-anchored and resolves its slot within
the dashboard's resolution radius. Previously today's morning rows used
scheduled_for = taken_at, which the scheduler reads as an ad-hoc take that
only resolves within a minute of its own instant, leaving the 08:00 slot
reading overdue while the take floated beside it. Today's picture now reads
on-track at any daytime clock, with the evening dose pending and not yet due.
2026-06-20 09:46:43 +02:00
Marc-André Bombeck 69d03c45c4 seed(demo): bake AI insight texts into the demo cache rows
The public demo has no live AI provider, so the Insights, daily-briefing,
and per-metric status surfaces rendered empty or prompted to connect a
provider. Pre-populate the same cache rows a real generation would write
so the demo shows finished, grounded English prose that survives every
re-seed without any outbound call:

- users.insights_cached_text: comprehensive insight + daily briefing
  (paragraph, signals of the day, key findings, trend annotations), with
  insights_cached_at refreshed so the read serves it as current.
- audit_logs: the seven per-metric status cards, stamped with today's
  Berlin day key and a real model name so the cache read treats each as a
  fresh assessment.
- insight_narratives: week and month narratives, AES-256-GCM at rest like
  every other narrative row.

All prose follows the assessment voice: second person, grounded in the
seeded numbers, autonomy-supporting, never diagnostic. English only, the
demo locale. Adds insight_narratives to the cleanup block so the seed
stays idempotent.
2026-06-19 23:49:29 +02:00
Marc-André Bombeck 1f4ba5939d style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean
baseline. Formatting only — no behaviour change. Generator-owned and
vendored artifacts stay untouched via .prettierignore.
2026-06-19 22:20:31 +02:00
Marc-André Bombeck 5ebe97d5a3 feat(seed): broaden demo coverage across every tracking domain
Extend the demo tenant so it reads as a long-term, fully engaged user
across the whole app, not a thin sample. All series span the existing
ninety-day window with the latest point on today and sit in healthy
bands:

- Body composition (fat, fat-free, lean, muscle mass, total body water,
  bone mass, visceral fat, BMI) derived from the same-day weight and
  body-fat series so the numbers reconcile with the headline tiles.
- Blood glucose in a healthy non-diabetic band — fasting, post-meal and
  bedtime readings stored in mg/dL with the glucose context tagged.
- Cardio fitness and vitals: HRV (SDNN and RMSSD), oxygen saturation,
  respiratory rate, periodic VO2 max, active energy, walking/running
  distance and flights climbed.
- WHOOP-style recovery, day strain and sleep performance/efficiency/
  consistency scores aligned with the seeded sleep nights.
- Three to four workouts a week (running, strength, cycling) with
  duration, energy, average and max heart rate, distance, a sparse
  per-workout heart-rate sample series, and per-workout strain in the
  metadata blob.

Clear the workout tables in the same truncate pass so the seed stays
re-runnable.
2026-06-19 21:11:09 +02:00
Marc-André Bombeck 4b26e1cef9 fix(seed): point demo achievements at real registry ids
The demo seed unlocked twelve achievement ids that no longer exist in
the registry (first-measurement, week-streak-measurements,
three-month-streak, …), so the achievements surface rendered them as
unknown placeholders. Map the unlocked set to live registry keys —
first-entry badges, logging and in-range streaks, compliance and
miss-free streaks, plus the self-context and seven-night sleep badges —
each on a plausible unlock date the seeded history supports.
2026-06-19 21:10:58 +02:00
Marc-André Bombeck 431259bb06 feat(demo): reshape demo seed to read current and healthy
Tune the public demo tenant for App-Store screenshots:

- Extend the measurement loop to include today so every headline metric
  has a current reading.
- Retarget blood pressure into the optimal band (~118/76), weight to a
  stable healthy BMI, and add a clean resting-heart-rate series so the
  resting-pulse tile scores it directly instead of the spot pulse.
- Write a full week of per-stage sleep nights (awake/REM/core/deep,
  ~7.5h, source APPLE_HEALTH) including last night, in minutes, and skip
  the aggregate row for those nights to avoid double-counting.
- Schedule today's doses on-track: morning meds taken, the evening dose
  pending and never auto-missed, so today never reads overdue or 0%.
- Add Vorsorge reminders (dental check-up, annual physical), one healthy
  lab panel, one resolved illness episode, and an AI-configured Coach
  with a short encrypted sample conversation.

All dates stay relative to now so the demo refreshes on every re-seed.
2026-06-19 21:02:42 +02:00
Marc-André Bombeck f002a9d565 fix(bp): keep non-physiological readings out of the seed and the series
The demo seed's random-walk BP generator could drift below the
physiological floor and mint a systolic-0 row (iOS #33). Clamp the walk
to the same band the input validator enforces (systolic >= 40,
diastolic >= 20), reusing the VALUE_RANGES floors, so a fresh seed never
writes a sub-floor reading. Add a read-side selection guard on the blood
pressure series endpoint that excludes rows below those floors from both
the series and the implicit latest point, so a corrupt row that slipped
in before the floor was enforced can never surface as the latest
reading. Export VALUE_RANGES so both sites share one source of truth.
2026-06-19 20:34:20 +02:00
Marc-André Bombeck 65bbedd83d fix(seed): repair demo seed against the current schema
Two gaps stopped a fresh demo seed:

- medication_intake_events gained a NOT NULL updated_at column in the
  v1.7.0 sync keyset work. The raw INSERTs omitted it; set it alongside
  created_at on every intake row so the seed does not lean on the
  column's migration-only default.

- app_settings carried four columns on the schema (default_locale plus
  the telegram/ntfy/web-push global toggles) that never landed in the
  migration history — applied via db push to existing environments but
  never committed. A database built from migrations alone is missing
  them, and the admin settings read path selects default_locale, so a
  fresh deploy reports "column default_locale does not exist" on first
  read. Add an idempotent ADD COLUMN IF NOT EXISTS drift-fix migration
  mirroring 0025_user_locale_drift_fix: a no-op where the columns exist,
  a clean add on a migrations-only build.

Verified end to end against a fresh Postgres 16 built from the full
migration set: the seed completes and re-runs cleanly.
2026-06-01 17:31:45 +02:00
Marc-André BombeckandClaude Opus 4.7 02b99553b9 chore(style): repo-wide prettier sweep before v1.4.6 tag
Long-overdue prettier sweep; prettier had drifted vs. checked-in code
across ~130 files (mostly long-argument line-break wrapping in TS and
table-padding in markdown). Pure formatting — no semantic changes —
and required to clear the v1.4.6 release gate's `pnpm format:check`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 02:27:17 +02:00
Marc-André Bombeck 38309932f3 Initial release v1.0.0
HealthLog — personal health-tracking PWA with weight, blood pressure,
pulse, mood tracking, medication compliance, Withings integration,
doctor report PDF export, and Dracula-themed UI.
2026-03-10 20:14:33 +01:00