mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
feat(records): add allergy + family-history data model
Introduce two structured health-record tables, kept as reference records (not time-series signals): - `allergies` — AllergyIntolerance-style: substance + category + type + severity + status + optional onset. The substance label stays queryable plaintext; the free-text reaction and note are AES-256-GCM encrypted (`reaction_encrypted` / `notes_encrypted` BYTEA). - `family_history_entries` — one condition per relative: relationship + condition label + optional age-at-onset; the free-text note is encrypted. Both are owner-scoped and soft-deleted. Migrations 0215/0216 are additive and idempotent. The three new encrypted columns are registered in ENCRYPTED_COLUMNS and wired into the key-rotation script, so a key drop can never silently strand them undecryptable.
This commit is contained in:
1 parent
3a84a07423
commit
3ded891641
5 files changed
+306
No files matched your search
@@ -156,6 +156,14 @@ export const ENCRYPTED_COLUMNS: readonly EncryptedColumn[] = [
|
||||
{ model: "MedicationSideEffect", field: "notesEncrypted", kind: "bytes" },
|
||||
{ model: "MedicationDoseChange", field: "noteEncrypted", kind: "bytes" },
|
||||
{ model: "MedicationInventoryItem", field: "notesEncrypted", kind: "bytes" },
|
||||
|
||||
// ───── v1.25 structured health records (Bytes columns) ─────
|
||||
// Allergy free-text reaction + note, and the family-history note. The
|
||||
// structured enum/label columns stay queryable plaintext; only the
|
||||
// sensitive free-text fields are encrypted.
|
||||
{ model: "Allergy", field: "reactionEncrypted", kind: "bytes" },
|
||||
{ model: "Allergy", field: "notesEncrypted", kind: "bytes" },
|
||||
{ model: "FamilyHistoryEntry", field: "notesEncrypted", kind: "bytes" },
|
||||
] as const;
|
||||
|
||||
/** Stable `Model.field` key for a registry entry. */
|
||||
|
||||
Reference in new issue
Block a user