feat(mental-health): record which wording a check-in was answered in

An administration now stores `wording`: `validated` (the published
validated version of the reader's language, the original for English),
`unvalidated_translation` (HealthLog's own translation) or `original_en`
(the English original, chosen by a reader of another language). The
client sends only `englishOriginal`; the server resolves the rest from
the wording registry, so a client cannot claim a validated wording the
registry does not hold. `locale` keeps the reader's language, which
still selects the crisis resources.

Additive migration 0475: a nullable column with no backfill, since which
text earlier rows showed depended on releases since replaced. Every read
returns the field, the OpenAPI contract carries it and `englishOriginal`,
and the disaster-recovery backup carries and restores it (the parity
goldens gain the column; their pinned timestamps move by one step
because the fill writes one more column).

The PHQ-9 item-9 crisis signpost is answered from the answers alone and
is proven in every wording through the real route.
This commit is contained in:
Marc-André Bombeck committed 2026-10-23 08:14:15 +02:00
1 parent 3843705296
commit 02cc0631fa
14 files changed
+347 -66

No files matched your search

+10 -1
View File
@@ -60,8 +60,17 @@ export const createAssessmentSchema = z
.max(64)
.refine(isValidTimezone, "Invalid IANA timezone")
.optional(),
/** Locale of the validated wording actually presented. */
/**
* The reader's app language: it selects the questionnaire text that was
* shown and the crisis resources. Defaults to the account's language.
*/
locale: z.string().max(16).optional(),
/**
* The reader switched to the English original instead of their
* language's text. The server records which wording the answers were
* given in from this and `locale`.
*/
englishOriginal: z.boolean().optional(),
/** Client provenance; defaults to WEB. */
source: assessmentSourceEnum.optional().default("WEB"),
/**