fix(doctor-report): name a managed record by its display name

The report cover, the PDF author field, the FHIR Patient and the share
page printed `fullName ?? username`, and the collector never read the
display name. A managed record has no way to get a full name, so its
generated `managed-<hex>` login landed on every clinical document made
for it; an own account printed the login instead of its display name.

The collector now resolves the name once (`patientName()`: full name,
display name, login, never a managed record's generated handle) and the
five readers print that one field. `patient.username` and
`patient.fullName` leave the report payload; nothing else read them.
This commit is contained in:
Marc-André Bombeck committed 2026-11-11 19:42:17 +01:00
1 parent aae029d94e
commit 5cf4a7d213
30 files changed
+169 -77

No files matched your search

@@ -1,7 +1,7 @@
{
"$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.",
"count": 2892,
"total": 9220,
"total": 9216,
"entries": {
"__tests__/account-payload-consumer-guard.test.ts": 2,
"__tests__/acting-account-boundary-guard.test.ts": 7,
@@ -1963,10 +1963,10 @@
"lib/doctor-report-helpers.ts": 1,
"lib/doctor-report-pdf-core.ts": 4,
"lib/doctor-report-pdf/clinical-records-notes-section.ts": 6,
"lib/doctor-report-pdf/header-profile-section.ts": 3,
"lib/doctor-report-pdf/header-profile-section.ts": 2,
"lib/doctor-report-pdf/measurements-charts-section.ts": 3,
"lib/doctor-report-pdf/medication-mood-wellness-section.ts": 7,
"lib/doctor-report-types.ts": 21,
"lib/doctor-report-types.ts": 20,
"lib/doctor-report/__tests__/leaf-gating-sweep.test.ts": 1,
"lib/doctor-report/clinical-records.ts": 2,
"lib/doctor-report/collect.ts": 4,
@@ -59,7 +59,7 @@ function emptyReport(): DoctorReportData {
end: "2026-01-31T00:00:00.000Z",
},
patient: {
username: null,
name: null,
dateOfBirth: null,
gender: null,
heightCm: null,
@@ -156,11 +156,10 @@ const DISPOSITIONS: Record<StructuredLeafId, Disposition> = {
kind: "rendered",
data: {
patient: {
username: "shared-account",
name: "A. Patient",
dateOfBirth: "1979-04-02T00:00:00.000Z",
gender: "FEMALE",
heightCm: 171,
fullName: "A. Patient",
},
},
marker: "A. Patient",