WP-07 exchange
kind is the only imaging-versus-lab split. Patient reads are WP-08, not a second store. Envelope: envelope.md.
Workflow
- A caller creates an order with
patientId,kind(IMAGINGorLAB), and optionalencounterId. - The API stores one
DiagnosticOrder. - Imaging or lab sessions GET
/api/v1/afia/worklists?kind=. - Staff POSTs a result on
/api/v1/afia/orders/{id}/results. - The API stores one
DiagnosticResult. A patient caller is rejected. - The patient later reads through WP-08. Same rows. No copy.
Wire
POST /api/v1/afia/orders
req { "patientId", "kind": "IMAGING"|"LAB", "encounterId"? }
res { data: { "id", "encounterId", "patientId", "kind", "status" }, ... }
GET /api/v1/afia/worklists?kind=
res { data: [ { "id", "encounterId", "patientId", "kind", "status" } ], ... }
POST /api/v1/afia/orders/{id}/results
req { "summary", "artifactUri"? }
res { data: { "id", "orderId", "summary", "artifactUri" }, ... }
Errors: missing session, bad kind, unknown patient, patient write of a result.
Ownership
WP-07 writes health.afia.app.diagnostics and lib/*/diagnostics/. Shared language is DiagnosticKind, DiagnosticOrder, DiagnosticResult. WP-08 owns only the patient HTTP projection.
Does not do
Two public APIs for imaging and lab. Patient-owned result tables. Class internals. Invented PACS viewers.