Skip to main content

Radiology Service — Application Logic

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


1. Use Cases

Commands

Use caseCommandActor
Register PACS endpointRegisterPacsEndpointCommandRadiology admin
Register imaging study from orderRegisterImagingStudyCommandSystem (order event) / integration
Sync study metadata from PACSSyncStudyMetadataCommandSystem (scheduled / webhook)
Ingest radiology reportIngestRadiologyReportCommandSystem (HL7 ORU / API) / radiologist
Sign radiology reportSignRadiologyReportCommandRadiologist
Amend radiology reportAmendRadiologyReportCommandRadiologist
Generate viewer launch tokenGenerateViewerLaunchTokenCommandClinician (viewer launch request)
Flag critical findingFlagCriticalFindingCommandSystem (automated) / Radiologist

Queries

Use caseQueryReturns
Get studies for patientGetPatientImagingStudiesQueryPaginated ImagingStudyRef list
Get study detailGetImagingStudyDetailQueryStudy + PACS metadata + report list
Get radiologist worklistGetRadiologistWorklistQueryStudies pending reporting
Get reportGetRadiologyReportQueryReport with version history
Search PACS endpointsGetPacsEndpointsQueryTenant/facility endpoint list

2. Orchestration Flows

2.1 Order → Study Registration Flow

2.2 Report Lifecycle Flow

2.3 Viewer Launch Flow


3. Ports

PortDirectionAdapter
IOrdersPortInboundNATS inbox consumer for clinical.orders.placed
IDicomWebPortOutboundHTTP adapter → PACS DICOMweb (QIDO-RS/WADO-RS)
IFhirPortOutboundHTTP adapter → interop-service FHIR gateway
IEventPublisherOutboundNATS JetStream publisher
IRadiologyRepositoryOutboundDrizzle ORM → PostgreSQL
IAbacPortOutboundaccess-policy-service for viewer launch authorization
IAuditPortOutboundNATS event → audit-service

4. Outbox Pattern

All domain events are written atomically with state changes. FHIR ImagingStudy resource creation is similarly queued in the outbox and published to the FHIR gateway on success.


5. Error Handling

ScenarioStrategy
PACS QIDO-RS returns 503Retry with exponential backoff (max 3); study remains in registered state; alert if PACS unreachable > 5 min
Viewer launch ABAC denialReturn 403 with RAD_ACCESS_DENIED; log audit event
Report ingestion with no matching studyStore as unlinked_report with patient ID + study UID; raise admin alert
Duplicate ORU study notificationDedup by (tenant_id, pacs_study_uid); idempotent upsert
Amendment without prior finalReturn RAD_REPORT_NOT_FINAL 409