Skip to content

Imaging Integration Use Cases (IMG)

Purpose: Resolve patientId + studyId into a canonical ImagingStudy entry and prepare it for bundle insertion.

Property Value
Actor Imaging Correlation Worker
Trigger Job from pacs_resolution_results
Priority P0

Main Success Scenario:

1. Read metadata from PACS resolution job (studyId, modality, date, assetManifest, completeness)
2. Resolve patient using normalized ABHA-style ID
3. If encounter timestamp exists, map study to Encounter; else create standalone imaging episode
4. Construct internal `ImagingStudyDTO` with:
   - `patientId`
   - `encounterId`
   - `modality`
   - `bodySite` (if provided)
   - `studyDate`
   - `completenessStatus`
   - `assetManifest`
   - `provenance` (source, timestamps, jobId)
5. Enqueue DTO to `pacs_bundle_update` queue

Acceptance Criteria: 1. [ ] Patient resolution MUST be deterministic 2. [ ] All imaging studies mapped to correct encounter window when possible 3. [ ] Prohibit silent failures — DLQ for mapping errors


UC-IMG-010: Update Patient Bundle (Imaging)

Purpose: Append or update imaging studies inside the canonical patient bundle.

Property Value
Actor Patient Bundle Service
Trigger ImagingStudyDTO in pacs_bundle_update
Priority P0

Main Success Scenario:

1. Load canonical `bundle.json` for the patient
2. Insert a new imaging event into `imaging[]` array with:
   - `studyId`
   - `modality`
   - `date`
   - `description`
   - `completeness`
   - asset links
   - provenance
3. Update cached `processed_patients.json`
4. Persist bundle atomically
5. Emit `imaging_study_ingested` event

Alternative Flows:

Alt-1: Bundle Load Failure - Retry + move to DLQ after max attempts

Acceptance Criteria: 1. [ ] Imaging tab in UI reflects new study within ingestion SLA (~15 minutes) 2. [ ] No duplicate studyIds 3. [ ] Bundles remain FHIR-generatable post-update


UC-IMG-011: Generate Viewer Artifacts

Purpose: Prepare artifacts for the UI / radiologist viewer.

Property Value
Actor Viewer Prep Service
Trigger Bundle Update Success
Priority P1

Main Success Scenario:

1. Generate Viewer URL (WADO-RS or vendor-neutral path)
2. Generate Thumbnails / Keyframes for study list
3. Calculate Series/Instance counts for display
4. Update `ImagingStudy` metadata with viewer links

Acceptance Criteria: 1. [ ] Thumbnails generated < 2s per study 2. [ ] Viewer links are valid and accessible


UC-IMG-012: DICOM Metadata Extraction

Purpose: Extract study metadata from DICOM headers for indexing.

Property Value
Actor DICOM Parser Service
Trigger DICOM files detected in asset manifest
Priority P1

Main Success Scenario:

1. Read DICOM headers from file (SeriesInstanceUID, StudyDate, Modality, etc.)
2. Extract patient demographics (Name, DOB, Sex) for cross-verification
3. Parse acquisition parameters (Slice Thickness, kVp, mAs)
4. Build `DICOMMetadata` object
5. Persist to imaging index for search/retrieval

Acceptance Criteria: 1. [ ] Handles multi-frame DICOM files 2. [ ] Extracts patient orientation correctly 3. [ ] Supports all standard DICOM tags


UC-IMG-013: Publish Imaging Study Event

Purpose: Notify downstream systems (viewer, AI models) of new studies.

Property Value
Actor Event Publisher Service
Trigger Imaging study added to bundle
Priority P1

Main Success Scenario:

1. Build event payload with studyId, modality, patientId
2. Publish to `imaging_study_available` topic
3. Subscribers: Viewer (prefetch), AI Inference (schedule), Analytics
4. Include asset locations and completeness status

Acceptance Criteria: 1. [ ] Event published < 1s after bundle update 2. [ ] Includes presigned URLs for asset access 3. [ ] Event schema versioned


UC-IMG-014: Radiology Report Linking

Purpose: Link HL7 ORU / FHIR DiagnosticReport to imaging studies.

Property Value
Actor Report Correlation Service
Trigger Radiology report (ORU) received
Priority P0

Main Success Scenario:

1. Extract Accession Number from HL7 OBR-18
2. Query imaging index for matching study (by AccessionNumber + Date)
3. If found, attach report text to ImagingStudy.report
4. Update bundle with linked report
5. Emit `radiology_report_linked` event

Alternative Flows:

Alt-1: No Matching Study - Report arrives before imaging study - Queue report for 24h retry window - If still no match, create standalone report entry

Acceptance Criteria: 1. [ ] Links report within 60s of arrival 2. [ ] Handles multiple reports per study (addenda) 3. [ ] Supports both HL7 ORU and FHIR DiagnosticReport


UC-IMG-015: AI Inference Scheduling

Purpose: Trigger AI models (e.g., CT anomaly detection) on new studies.

Property Value
Actor AI Scheduler Service
Trigger imaging_study_available event
Priority P2

Main Success Scenario:

1. Read study modality from event
2. Lookup inference rules: "CT Chest -> Lung Nodule Detection"
3. If rule matches, enqueue job to `ai_inference_queue`
4. Job payload includes study paths, model config
5. Track inference status on ImagingStudy record

Acceptance Criteria: 1. [ ] Supports rule-based scheduling (modality, body part) 2. [ ] Does not run inference on incomplete studies 3. [ ] Inference results linked back to study