feat(mental-health): screener UI, locale-aware copy, and OpenAPI surface

Add the opt-in PHQ-9 / GAD-7 questionnaire surface at /insights/mental-wellbeing:
instrument picker, 0–3 item scale, server-scored result with the validated
severity band, the verbatim Pfizer/PHQ attribution, the screening-not-diagnosis
disclaimer, and a calm crisis-resource card on a positive item-9. The surface
deliberately does NOT mount the shared Coach-launch card — mental-health item
content stays out of the AI.

- i18n: full mentalHealth block plus the six new measurement-type labels and the
  longevity-marker catalogue names/descriptions across all six locales
  (de/en/es/fr/it/pl). Instrument item wording uses the validated German text and
  the canonical English elsewhere (re-wording invalidates the score).
- OpenAPI: regenerate the contract for /api/mental-health/assessments (response
  excludes raw item answers by construction).
- Exclude the new manual / instrument types from the HealthKit-counterpart guard.
This commit is contained in:
Marc-André Bombeck committed 2026-06-28 16:05:51 +02:00
1 parent 7575275d7e
commit c322a68d19
13 files changed
+1453 -22

No files matched your search

@@ -77,6 +77,17 @@ const MEASUREMENT_TYPES_WITHOUT_HK_COUNTERPART = new Set<MeasurementType>([
// the Oura API (source = OURA), never from HealthKit: Apple ships no
// resilience metric. No HK mapping by design.
"RESILIENCE",
// v1.25 — clinical-signals wave. The mental-health screener totals are
// derived from an in-app questionnaire, and grip strength / pain NRS / waist
// circumference + waist-to-height are manual / instrument readings — none
// ships a first-class HealthKit quantity we ingest, so they have no HK
// mapping by design.
"PHQ9_SCORE",
"GAD7_SCORE",
"GRIP_STRENGTH",
"PAIN_NRS",
"WAIST_CIRCUMFERENCE",
"WAIST_TO_HEIGHT",
]);
describe("APPLE_HEALTH_TYPE_MAP", () => {
+2 -1
View File
@@ -1222,7 +1222,8 @@ export const SIGNALS: Record<string, SignalDefinition> = {
},
fhir: {
loinc: "44261-6",
display: "Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]",
display:
"Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]",
unit: "{score}",
category: "survey",
},
+4 -1
View File
@@ -5,7 +5,10 @@
* it is narrowed from the session in the handler (CLAUDE.md convention).
*/
import { z } from "zod/v4";
import { INSTRUMENTS, type InstrumentId } from "@/lib/mental-health/instruments";
import {
INSTRUMENTS,
type InstrumentId,
} from "@/lib/mental-health/instruments";
export const assessmentInstrumentEnum = z.enum(["PHQ9", "GAD7"]);