Skip to main content

Orders Service — Security Model

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

1. Authentication and Authorization

  • Authentication: Keycloak JWT (RS256). Every request must carry a valid Bearer token.
  • Authorization: RBAC via Keycloak realm roles + module entitlement guard (clinical.orders).
  • Tenant isolation: PostgreSQL RLS with app.tenant_id session variable set from JWT claim.

2. RBAC Matrix

OperationCLINICIANPRESCRIBERNURSEPHARMACISTPATIENTADMIN
Create order (any type)YesYesLab/nursing onlyNoNoNo
Activate orderYesYesNoNoNoNo
Acknowledge CDS warningYesYesNoNoNoNo
Cancel orderYesYesOwn nursingNoNoAdmin only
Hold/resume orderYesNoNoNoNoNo
Correct (enter-in-error)YesNoNoNoNoYes
Create order setYesNoNoNoNoYes
Instantiate order setYesYesNoNoNoNo
View ordersYesYesYesYes (medication)OwnYes
View CDS alertsYesYesNoNoNoYes
View referral detailYesYesYesNoOwnYes

3. CDS Override Audit

Any clinician acknowledgement of a CDS hard-stop (requires ADMIN escalation) or warning must be logged with:

  • Actor ID and role
  • Alert rule ID
  • Override reason (free text, required)
  • Timestamp

This audit record is immutable and retained for 7 years.

4. Encryption

Data classAt restIn transit
Order recordsAES-256 (PostgreSQL TDE or volume encryption)TLS 1.3
CDS alert contentStandard encryptionTLS 1.3
Referral clinical summaryAES-256TLS 1.3
Allergy cacheAES-256TLS 1.3
NATS event payloadsEncrypted at rest on JetStream volumeTLS 1.3

5. PII and Sensitive Fields

FieldClassificationMasking rule
patientIdPIIResolved to display name for NURSE; full resolution for CLINICIAN/ADMIN
referralDetail.clinicalSummaryClinical / PIIVisible to CLINICIAN only; hidden from NURSE in list views
medicationDetailClinical dataVisible to CLINICIAN, PRESCRIBER, PHARMACIST
orderedByPIIVisible to CLINICIAN, ADMIN; hidden in patient-facing views

6. Medication Order Security

  • Medication orders require PRESCRIBER or CLINICIAN role; NURSE role cannot create medication orders.
  • Controlled substance orders (where applicable) require dual-sign: second clinician acknowledgement before activation.
  • All medication order activations are captured in the audit log.

7. Module Entitlement Guard

Requests are rejected with 403 MODULE_NOT_ENTITLED if the tenant's Keycloak realm does not include the clinical.orders entitlement scope.

8. GDPR / Patient Rights

RightImplementation
Right to accessGET /v1/orders?patientId= for patient-owned orders
Right to rectificationPUT /v1/orders/:id/correction (clinical correction, not patient self-service)
Right to erasureNot applicable for clinical orders (legal hold); pseudonymization on platform delete request
Right to portabilityFHIR ServiceRequest/MedicationRequest export