mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
A condition (illness episode) can carry where on the body it sits, in the person's own words and encrypted at rest, plus an optional side (LEFT, RIGHT, BOTH). Same enum, codec and reasoning as the procedure's site. - migration 0354: two nullable columns on illness_episodes, reusing the laterality type from 0349 - create and edit accept bodySite and laterality; on PATCH an absent key keeps the stored value, so an edit from the shipped iPhone app, which never sends either field, leaves them untouched - GET /api/body-sites: the sites the record holds across visits and conditions, folded after the decrypt and bounded per kind; with site (and laterality) the visits and conditions there, one hop to their documents, lab results and visits. Read in the profile section; conditions only under an illness grant with the module on, and links into ungranted sections come back as unlabelled placeholders - the link service reads document and visit links from the condition's end of the two existing tables - /checkups gains a Body sites tab; the visit and condition forms share one body-site field pair that suggests sites already used; a condition's page links its site into the view - the doctor report, the clinician page and the MCP doctor-visit summary name the site on conditions; the Coach illness block carries it sanitised, and MCP get_illness_recovery returns it fenced - backup and restore carry both fields in both file kinds; the site is registered as ciphertext and rotates with the key - i18n in all seven locales, OpenAPI regenerated Refs #1025
18 lines
891 B
SQL
18 lines
891 B
SQL
-- Body site and side on conditions.
|
|
--
|
|
-- A condition (illness episode) can now carry the body site it sits on, in the
|
|
-- person's own words and encrypted at rest, plus an optional side. It reuses
|
|
-- the `laterality` type migration 0349 created for procedures, so "left knee"
|
|
-- on a condition and "left knee" on a procedure are the same pair of values.
|
|
-- The reasoning for free text and for searching after the decrypt is written
|
|
-- at `Encounter.bodySiteEncrypted` and `IllnessEpisode.bodySiteEncrypted`.
|
|
--
|
|
-- Purely additive: two nullable columns, no backfill, no row rewritten. An
|
|
-- existing condition keeps no site until the person adds one.
|
|
--
|
|
-- Reversibility: both columns can be dropped. The `laterality` type stays,
|
|
-- since `encounters.laterality` still uses it.
|
|
ALTER TABLE "illness_episodes"
|
|
ADD COLUMN "body_site_encrypted" BYTEA,
|
|
ADD COLUMN "laterality" "laterality";
|