mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
Largest feature delta in the v1.4.x line. Insights expands into seven dedicated metric sub-pages; GLP-1 medication tracking lands end-to-end (drug-level chart with Research Mode acknowledgment, EMA titration ladder, cadence + compliance, side-effect taxonomy, pen/vial inventory); cross-source priority becomes a two-axis resolver; per-user timezone threads through ten analytics surfaces; Withings activity + sleep v2 sync; onboarding rebuilt as a nested-route wizard; Personal Records ship end-to-end; Health Score provenance accordion; Coach runs native first-party prompts across six locales with a 1800-assertion refusal-probe matrix; OpenAPI drift gate hard-fails; multi-arch GHCR image. Migrations 0043 through 0060 are additive and forward-only. PROMPT_VERSION 4.24.0 → 4.25.0 with GROUND RULE 9 (refuses dose recommendations) and GROUND RULE 15 (refuses drug-level estimates with MDR + MDCG 2021-24 cites). See CHANGELOG.md for the full per-section delta.
26 lines
1.2 KiB
SQL
26 lines
1.2 KiB
SQL
-- v1.4.25 W5e — cross-source dedup architecture (foundation).
|
|
--
|
|
-- Adds a nullable JSON column on `users` that records per-metric-class
|
|
-- source priority. Shape matches `src/lib/validations/source-priority.ts`:
|
|
-- { "steps": ["APPLE_HEALTH", "WITHINGS", "MANUAL"],
|
|
-- "weight": ["WITHINGS", "APPLE_HEALTH", "MANUAL"],
|
|
-- ... }
|
|
-- NULL = the user has never adjusted the defaults; the analytics
|
|
-- aggregator reads `DEFAULT_SOURCE_PRIORITY` from validation code.
|
|
--
|
|
-- Why a single Json column instead of a side-table:
|
|
-- - One row per user per metric-class would mean ~15 rows per user
|
|
-- for a setting most users never touch. The Json blob keeps the
|
|
-- read-path one column lookup with no JOIN.
|
|
-- - Schema evolution is additive — adding a new metric class
|
|
-- (Apple Health workouts in v1.5, for instance) requires no
|
|
-- migration: the Zod schema gains a key, defaults carry the
|
|
-- existing priority list, and rows with the old shape continue
|
|
-- to parse with the new key falling back to its default.
|
|
--
|
|
-- Forward-only, additive. No backfill needed: existing rows keep
|
|
-- NULL and read code falls through to the documented defaults.
|
|
|
|
ALTER TABLE "users"
|
|
ADD COLUMN IF NOT EXISTS "source_priority_json" JSONB;
|