Skip to main content

Laboratory Service — Security Model

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


1. Authentication

LayerMechanism
External (Kong)JWT validated against Keycloak JWKS
Service-to-serviceJWT with service account; zero-trust internal validation
FHIR gatewayInherits Kong JWT; adds FHIR SMART scopes

2. RBAC Matrix

RoleScopesCapabilities
lab:readsvc:laboratory:readView worklist, accession detail, results, catalog
lab:technologistsvc:laboratory:write, svc:laboratory:verifyEnter results, verify results, record specimens
lab:pathologistAll technologist + svc:laboratory:releaseSign off and release results
lab:adminAll above + svc:laboratory:adminManage catalog, critical value policies, PACS endpoints
lab:cliniciansvc:laboratory:read, svc:laboratory:ackView and acknowledge results
platform:adminAll scopesPlatform-wide administration

3. ABAC Rules

RuleEnforcement
Tenant isolationEvery query filtered by tenant_id from JWT; RLS enforced at DB layer
Patient accessPatient-linked result reads check ABAC policy via access-policy-service
Module entitlementModuleEntitlementGuard validates diag.laboratory license per tenant
Correction auditCorrections require lab:pathologist role minimum; all corrections logged with actor

4. Encryption Classes

Data categoryEncryptionNotes
PII / PHI (results, specimens)AES-256 at rest (PostgreSQL tablespace encryption)Column-level encryption for value_* on sensitive tests
Event payloadsTLS in transit (NATS TLS)No PHI in event metadata fields
Audit logsImmutable append-only; AES-256 at restStored in audit-service
Analyzer raw messagesEncrypted at rest; retention per data classification policy

5. Audit Events

EventWhenCaptured fields
lab.accession.createdAccession openedactorId, patientId, accessionId, tenantId, ip
lab.result.verifiedVerification actionactorId, resultId, testCode, tenantId
lab.result.releasedRelease actionactorId, resultId, patientId, tenantId
lab.result.correctedCorrection submittedactorId, resultId, priorResultId, reason, tenantId
lab.result.viewedClinician views resultactorId, resultId, patientId, tenantId
lab.result.acknowledgedClinician ackactorId, ackType, resultId, tenantId
lab.critical.triggeredCritical value detectedresultId, patientId, testCode, tenantId

6. GDPR / Data Privacy Participation

RequirementImplementation
Data minimizationResult payloads include only clinically necessary fields
Right to accessPatient data exportable via FHIR $everything through interop-service
Right to erasureLab results flagged phi_erasure_pending; erasure workflow triggers soft-delete per retention policy
Data residencytenantId + nodeId used to enforce Afghanistan MoPH data residency constraints
Sensitive categoriesCertain test codes (HIV, substance abuse) subject to enhanced consent checks

7. Data Residency

Results data for Afghanistan tenants remains within the AFG node cluster. Cross-border replication is disabled unless explicitly configured by the tenant with MoPH approval.