إنتقل إلى المحتوى الرئيسي

WP-07 exchange

kind is the only imaging-versus-lab split. Patient reads are WP-08, not a second store. Envelope: envelope.md.

Workflow​

  1. A caller creates an order with patientId, kind (IMAGING or LAB), and optional encounterId.
  2. The API stores one DiagnosticOrder.
  3. Imaging or lab sessions GET /api/v1/afia/worklists?kind=.
  4. Staff POSTs a result on /api/v1/afia/orders/{id}/results.
  5. The API stores one DiagnosticResult. A patient caller is rejected.
  6. 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.