v1.37.9 — the record you want a paramedic to have - #769
Merged
Conversation
Fold six nullable columns into user_health_profiles: three closed-set enums (blood type, organ-donor status, advance-directive status) read as plaintext, and three AES-256-GCM free-text columns (emergency contacts, implants, ICE note). Migration 0331 is additive only: three CREATE TYPE plus one ALTER TABLE with nullable ADD COLUMNs. An integration test asserts the columns and enum types exist on the migrated schema.
Register the three encrypted emergency columns in the rotation registry and the key-rotation script so a legacy-key drop cannot strand them. Carry all six new columns through the profile backup builder and restore (the enums by value, the free text as ciphertext in a DR payload or decrypted plaintext in a portable export) and extend the wire schema. The full-backup round-trip integration test seeds the six columns and asserts each survives an export and restore.
GET/PATCH /api/anamnesis/emergency, wrapped in apiHandler. The PATCH validates a partial body with per-field length caps, builds the Prisma data field-by-field from the parsed input (never a spread), narrows the user from requireAuth rather than the body, encrypts the free text on write, and audits the change. The GET decrypts fail-soft for the form prefill. Registers the OpenAPI operations and schema. An integration test reads the row back to prove the write lands.
Add an EMERGENCY leaf to the identity group of the report catalogue, default-on, no module gate. When the leaf is admitted and the profile holds emergency data, the aggregator collects it and the PDF renders an emergency sheet as page one (banner, blood type, severe allergies, active medications, chronic conditions, implants, advance directive and organ donor, contacts, notes), then breaks to send the rest of the report to page two. The section is withheld when the leaf is not admitted or no data is present. Guards updated for the new leaf counts.
Add a Notfalldaten card to the Anamnese settings section with a manager for the three enum facts and the three free-text fields, writing through the new emergency route. Add every string across the six shipped locales.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assembled off
origin/main. Additive only: no table drops, no restructuring.Emergency data
UserHealthProfile: blood type, organ-donor status and advance-directive status as plaintext enums; emergency contacts, implants or devices, and a free note as encrypted columns. Captured under Anamnese next to allergies and family history, through a newGET/PATCH /api/anamnesis/emergencyroute. The three encrypted columns join the encrypted-column registry and the key-rotation script, and all six carry through backup and restore.0331_emergency_profileis threeCREATE TYPEplus six nullableADD COLUMN. Its integration test reads the live enum members and column nullability so the schema and the database cannot drift apart.Emergency-first report page
EMERGENCYleaf in the identity group, default on. The page is withheld unless the leaf is admitted and there is data to show, so an empty profile and a report that did not select it both produce no page. It is part of the report you choose to share, which is the point: the sheet travels to the practice with the rest of the report rather than sitting somewhere separate.Verification
openapi:check(in sync, the diff is the version line plus the new route the feature adds), test (21115 passed), test:integration (migration, route, backup round trip against testcontainers Postgres), build: all green, run twice.One conscious call worth stating: emergency data is default on and rides a shared report, unlike insurance data which is held back from share links. That is deliberate. A paramedic sheet exists to be handed over, and it is always the owner's own data shared by an explicit action.