Skip to content

v1.37.9 — the record you want a paramedic to have - #769

Merged
MBombeck merged 6 commits into
mainfrom
release/v1.37.9
Aug 10, 2026
Merged

v1.37.9 — the record you want a paramedic to have#769
MBombeck merged 6 commits into
mainfrom
release/v1.37.9

Conversation

@MBombeck

Copy link
Copy Markdown
Owner

Assembled off origin/main. Additive only: no table drops, no restructuring.

Emergency data

  • Six fields fold into the existing 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 new GET/PATCH /api/anamnesis/emergency route. The three encrypted columns join the encrypted-column registry and the key-rotation script, and all six carry through backup and restore.
  • Migration 0331_emergency_profile is three CREATE TYPE plus six nullable ADD 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

  • The doctor report can open with a one-page emergency summary: blood type, severe allergies, current medications, chronic conditions, implants, the advance-directive and organ-donor lines, contacts and the note. It is a new EMERGENCY leaf 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

  • Watched-red proven on all four gates: the migration count of columns, the route write landing, the report-page gate withholding, and the backup round trip.
  • typecheck, lint, 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.
  • An independent review read the whole diff, ran the suites against real Postgres, and probed mass assignment, encryption fail-closed, the report gate, the enum-name match and i18n coverage. Verdict: ship. No cross-account path, no plaintext leak, no inert gate.

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.

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.
@MBombeck
MBombeck merged commit 9a74bfb into main Aug 10, 2026
23 checks passed
@MBombeck
MBombeck deleted the release/v1.37.9 branch August 10, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant