Skip to main content

Care Plan Service — Security Model

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

Authentication

  • All endpoints require a valid Keycloak-issued JWT (Authorization: Bearer).
  • tenantId is extracted exclusively from the JWT tenant_id claim — client-supplied tenantId in body/query is ignored.
  • Service-to-service calls (e.g., from patient-chart-service) use client credentials flow with scoped service account tokens.

RBAC Matrix

Rolecare_plan:readcare_plan:writecare_plan:adminNotes
clinicianCan create/update plans and goals
care_coordinatorFull care team coordination rights
nurseCan complete activities
patient_portal_user✅ (own plans only)Read via FHIR surface, constrained
adminCan close/revoke plans
service_account (internal)Used by chart and portal services

ABAC Rules

  • A patient_portal_user can only read care plans where patientId matches their own linked patient identity.
  • A clinician with restricted program access (e.g., HIV/mental health) only sees care plans in their program scope.
  • Sensitive care plan categories (mental health, HIV, substance abuse) require an additional sensitive_program:read scope.

Encryption Classes

DataAt restIn transit
Care plan records (Postgres)AES-256 via cloud KMS (tenant-level key)TLS 1.3
Outbox payloadsAES-256 same KMSTLS 1.3
NATS event payloadsEncrypted in transitTLS 1.3 (NATS mTLS)
FHIR read surfaceServed via fhir-gateway (TLS at edge)TLS 1.3

Audit Events

All events emitted to the audit-service pipeline:

EventTriggerPHI fields included
care_plan.readAny GET of a care plancarePlanId, patientId, actorId, tenantId
care_plan.createdSuccessful POSTcarePlanId, patientId, actorId
care_plan.updatedSuccessful PATCH/status changecarePlanId, previousStatus, newStatus
care_plan.reviewedReview workflowcarePlanId, reviewedBy
care_plan.closedPlan completed or revokedcarePlanId, closeReason, actorId
care_plan.goal.updatedGoal status changegoalId, carePlanId, actorId
care_plan.activity.completedActivity completedactivityId, carePlanId, actorId
care_plan.auth_failure403 returnedactorId, tenantId, requestedResource

GDPR / Data Privacy Participation

AspectHandling
Data subject access (DSAR)Care plans are PHI — included in patient data export. Export triggered via patient-portal-service or admin tooling.
Right to erasureClinical and legal retention holds apply. Erasure requests are queued; executed only after retention period per tenant configuration.
Data minimizationAPI responses scoped to patient context only; no bulk exports without bulk_export:admin scope.
Consent enforcementSensitive plan categories gated by sensitive_program:read scope; consent flags from registration-service honored.
Cross-bordertenant_id maps to a data residency region; Postgres instances deployed per-region; no cross-region query.

Data Residency

  • All Postgres data stays in the tenant's declared residency region.
  • NATS events include tenantId; consumers enforce per-tenant stream isolation.
  • No care plan data written to multi-region shared storage without explicit tenant consent.