Skip to main content

Ghasi e-Prescribing Gateway Service — Event Schemas

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD

Events Produced

All events use CloudEvents v1.0 envelope with mandatory extensions: tenantid, actorid, correlationid, prescriptionbusinessid.

Event type (NATS subject)VersionRetention classTrigger
eprescribing.medication_request.created.v1v1clinical — 10 yearsMR persisted and routed
eprescribing.medication_request.updated.v1v1clinical — 10 yearsMR status/fields changed
eprescribing.medication_request.cancelled.v1v1clinical — 10 yearsMR cancelled
eprescribing.medication_dispense.created.v1v1clinical — 10 yearsMD accepted by gateway
eprescribing.medication_dispense.updated.v1v1clinical — 10 yearsMD status/quantity updated
eprescribing.task.status_changed.v1v1clinical — 10 yearsRenewal/clarification task state change (P1)
eprescribing.subscription.delivery_failed.v1v1ops — 90 daysAfter retry exhaustion → DLQ
eprescribing.subscription.replayed.v1v1ops — 90 daysManual replay triggered

Events Consumed

Event typeSource servicePurpose
identity.user.deactivated.v1identity-serviceCheck if prescriber is deactivated (alert)
registration.patient.registered.v1registration-serviceAsync patient validation (non-blocking)

Payload Schemas

eprescribing.medication_request.created.v1

{
"specversion": "1.0",
"type": "eprescribing.medication_request.created.v1",
"source": "https://platform.ghasi.health/services/ghasi-eprescribing-gateway-service",
"id": "evt_01...",
"time": "2026-04-18T10:00:00Z",
"tenantid": "ten_01...",
"actorid": "svc_ehr_01...",
"correlationid": "req_01...",
"prescriptionbusinessid": "prx_01...",
"datacontenttype": "application/json",
"data": {
"medicationRequestId": "mr_01...",
"prescriptionBusinessId": "prx_01...",
"tenantId": "ten_01...",
"patientId": "pat_01...",
"prescriberId": "prac_01...",
"targetPharmacyOrgId": "org_01...",
"medicationCode": { "system": "http://www.whocc.no/atc", "code": "J01CA01" },
"status": "active",
"authoredOn": "2026-04-18",
"etag": "W/\"a3f9...\"",
"routingEnvelope": {
"targetOrgId": "org_01...",
"targetEndpointId": "ep_01...",
"region": "AFG"
}
}
}

eprescribing.medication_dispense.created.v1

{
"data": {
"medicationDispenseId": "md_01...",
"medicationRequestId": "mr_01...",
"prescriptionBusinessId": "prx_01...",
"tenantId": "ten_01...",
"patientId": "pat_01...",
"pharmacistId": "prac_pharm_01...",
"dispensedQuantity": { "value": 30, "unit": "tablet" },
"status": "completed",
"whenHandedOver": "2026-04-20T14:00:00Z",
"etag": "W/\"b2c8...\""
}
}

eprescribing.subscription.delivery_failed.v1

{
"data": {
"subscriptionId": "sub_01...",
"tenantId": "ten_01...",
"endpointUrl": "https://pharmacy.example.com/webhooks/...",
"eventType": "eprescribing.medication_request.created.v1",
"resourceId": "mr_01...",
"prescriptionBusinessId": "prx_01...",
"attemptCount": 5,
"lastError": "connection refused",
"firstAttemptAt": "2026-04-18T10:00:05Z",
"dlqEnqueuedAt": "2026-04-18T10:30:00Z"
}
}

NATS JetStream Configuration

StreamSubjectsRetentionMax ageReplicas
EPRESCRIBING_EVENTSeprescribing.>limits10 years (clinical), 90 days (ops)3
EPRESCRIBING_DLQeprescribing.dlq.>workqueue90 days3

Consumer groups:

  • pharmacy-serviceeprescribing.medication_request.created.v1, eprescribing.medication_request.updated.v1
  • orders-serviceeprescribing.medication_dispense.created.v1, eprescribing.medication_dispense.updated.v1
  • population-health-service — all clinical events
  • audit-service — all events (audit trail)