Skip to main content

Orders Service — Event Schemas

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template

1. Produced Events

All events use CloudEvents 1.0 envelope. Transport: NATS JetStream. NATS subject: clinical.orders.{patientId} (patient-ordered delivery).


clinical.orders.order.created.v1

{
"specversion": "1.0",
"type": "clinical.orders.order.created.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T09:00:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"stablePatientId": "550e8400-e29b-41d4-a716-446655440000",
"encounterId": "enc_01J...",
"orderType": "medication",
"orderCode": { "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "1049502", "display": "Amoxicillin 500mg" },
"status": "draft",
"priority": "routine",
"orderedBy": "usr_01J...",
"cdsAlertCount": 0,
"tenantId": "tenant_01J..."
}
}

clinical.orders.order.activated.v1

{
"specversion": "1.0",
"type": "clinical.orders.order.activated.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T09:05:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"stablePatientId": "550e8400-e29b-41d4-a716-446655440000",
"encounterId": "enc_01J...",
"orderType": "medication",
"orderCode": { "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "1049502", "display": "Amoxicillin 500mg" },
"status": "active",
"priority": "routine",
"medicationDetail": {
"dose": 500, "doseUnit": "mg", "route": "oral", "frequency": "TDS", "durationDays": 7
},
"acknowledgedCdsAlerts": [],
"tenantId": "tenant_01J..."
}
}

clinical.orders.order.completed.v1

{
"specversion": "1.0",
"type": "clinical.orders.order.completed.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T14:00:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"stablePatientId": "550e8400-e29b-41d4-a716-446655440000",
"orderType": "medication",
"completedAt": "2026-04-18T14:00:00Z",
"completedBy": "usr_02J...",
"tenantId": "tenant_01J..."
}
}

clinical.orders.order.cancelled.v1

{
"specversion": "1.0",
"type": "clinical.orders.order.cancelled.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T10:00:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"stablePatientId": "550e8400-e29b-41d4-a716-446655440000",
"orderType": "laboratory",
"cancelReason": "Patient discharged before sample collection",
"cancelledBy": "usr_01J...",
"tenantId": "tenant_01J..."
}
}

clinical.orders.order.on-hold.v1

{
"specversion": "1.0",
"type": "clinical.orders.order.on-hold.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T11:00:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"stablePatientId": "550e8400-e29b-41d4-a716-446655440000",
"holdReason": "Patient NBM for procedure",
"tenantId": "tenant_01J..."
}
}

clinical.orders.referral.created.v1

{
"specversion": "1.0",
"type": "clinical.orders.referral.created.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T09:10:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"stablePatientId": "550e8400-e29b-41d4-a716-446655440000",
"referralDetail": {
"referralType": "internal",
"referToFacilityId": "fac_02J...",
"referToSpecialty": "Cardiology",
"urgency": "routine",
"clinicalSummary": "Suspected atrial fibrillation"
},
"tenantId": "tenant_01J..."
}
}

clinical.orders.order.corrected.v1

{
"specversion": "1.0",
"type": "clinical.orders.order.corrected.v1",
"source": "orders-service",
"id": "evt_01J...",
"time": "2026-04-18T12:00:00Z",
"tenantid": "tenant_01J...",
"datacontenttype": "application/json",
"data": {
"orderId": "ord_01J...",
"patientId": "pat_01J...",
"correctionReason": "Ordered for wrong patient",
"correctedBy": "usr_01J...",
"previousStatus": "active",
"tenantId": "tenant_01J..."
}
}

2. Consumed Events

EventSourceHandlerAction
REGISTRATION.patient.vital-status-changed.v1registration-serviceOnVitalStatusChangedHandlerBlock new orders for deceased patients; auto-cancel active orders (with audit)
REGISTRATION.allergy.recorded.v1registration-serviceOnAllergyRecordedHandlerUpdate local allergy cache for CDS
SCHEDULING.appointment.fulfilled.v1scheduling-serviceOnAppointmentFulfilledHandlerMark associated referral order as completed

3. Delivery Semantics

PropertyValue
Delivery guaranteeAt-least-once (outbox + NATS JetStream ACK)
Idempotency keyid field in CloudEvents envelope
OrderingPer-patient ordering via subject clinical.orders.{patientId}
Retention7 days on NATS stream
Dead-letterclinical.orders.dlq after 3 failed ACKs
Consumer groupPer-downstream-service durable consumer