diff --git a/docs/doctor-report.md b/docs/doctor-report.md index bb69e84b5..c3743191e 100644 --- a/docs/doctor-report.md +++ b/docs/doctor-report.md @@ -44,6 +44,25 @@ PDF in a new tab without preserving the filename or fails the blob save). `500` if rendering fails. - Audit action: `doctor-report.pdf.generate`. +## Wellness summary (derived scores) + +Since v1.10.0 the report carries a **Wellness summary** section below the +clinical content, holding the server-derived wellness scores (Recovery, +Stress, Strain) and the other derived metrics where present. It is kept +deliberately separate from the clinical vitals table: + +- Each entry is labelled **descriptive, not a clinical assessment**, and the + scores never enter the vitals table or the clinical aggregations. +- The Stress score is shown as an HRV-derived proxy, not a sensor-measured + stress value. +- In the FHIR export the same scores are emitted as `survey`-category + `Observation`s (text-only `code`, no fabricated LOINC) with a per-Observation + non-clinical note — so a downstream system never mistakes them for a vital + sign or a diagnosis. + +Each derived metric states its inputs, method, and the cited standard it is +grounded in (the same provenance the in-app explainer shows). + ## Implementation notes - `src/lib/doctor-report-pdf-core.ts` contains the isomorphic renderer. diff --git a/prisma/migrations/0106_v1100_computed_scores/migration.sql b/prisma/migrations/0106_v1100_computed_scores/migration.sql index 6ca88ebd8..3c1f9507f 100644 --- a/prisma/migrations/0106_v1100_computed_scores/migration.sql +++ b/prisma/migrations/0106_v1100_computed_scores/migration.sql @@ -13,10 +13,10 @@ -- -- 2. Three new `measurement_type` values — the server-derived wellness -- scores `RECOVERY_SCORE`, `STRESS_SCORE`, `STRAIN_SCORE` (0–100, unit --- `score`). Only RECOVERY_SCORE is computed in v1.10.0; STRESS_SCORE + --- STRAIN_SCORE are defined now so the later engines that compute them --- need no schema change. These are NOT clinical vitals — they never --- appear in the doctor-report PDF. +-- `score`), each minted nightly by its own engine. These are NOT +-- clinical vitals: they stay out of the clinical vitals table and +-- surface only in a clearly-labelled, descriptive-not-clinical wellness +-- summary (and as FHIR `survey`-category observations). -- -- Idempotent guards (`IF NOT EXISTS`) make reruns safe. Forward-only. --