feat(doctor-report): put emergency data on page one

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.
This commit is contained in:
Marc-André Bombeck committed 2026-08-10 05:32:59 +02:00
1 parent 6770bf3b7f
commit 310a9a4690
14 files changed
+311 -17

No files matched your search

@@ -187,7 +187,7 @@ describe("<HealthRecordExportPanel> — the first run", () => {
// These six carry the standard template's leaves. On a first run they read
// 0/n like every other group: the template is a button, not a starting
// state.
expect(groupChip(html, "identity")).toBe("0/2");
expect(groupChip(html, "identity")).toBe("0/3");
expect(groupChip(html, "vitals")).toBe("0/7");
expect(groupChip(html, "body")).toBe("0/12");
expect(groupChip(html, "labs")).toBe("0/1");
@@ -62,15 +62,16 @@ describe("share-link create form — re-mint seeding", () => {
const html = render(<ShareLinkCreateForm />);
expect(html).toContain('data-testid="report-scope-picker-share"');
expect(html).toContain('data-testid="report-group-row-identity-share"');
// The server refuses the leaf with a 422; a control that cannot be
// honoured has no business rendering, so the identity group is one leaf
// wide here and two wide in the export panel. Nothing in it is on: a new
// link starts with an empty scope on every surface.
// The server refuses the insurance leaf with a 422; a control that cannot
// be honoured has no business rendering, so the identity group is two
// leaves wide here (patient identity + emergency) and three wide in the
// export panel. Nothing in it is on: a new link starts with an empty scope
// on every surface.
const row = html.match(
/data-testid="report-group-row-identity-share"[\s\S]*?<\/div>/,
)?.[0];
expect(row).toBeDefined();
expect(row).toContain(">0/1<");
expect(row).toContain(">0/2<");
// The fenced tier renders its leaves unconditionally; none is checked.
expect(html).toContain('data-testid="report-leaf-MOOD-share"');
expect(html).not.toContain('data-testid="report-leaf-INSURANCE-share"');