# openhealthagents/sims_rad architecture

> Architecture diagram of the GitHub repository openhealthagents/sims_rad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openhealthagents/sims_rad
- Repository: https://github.com/openhealthagents/sims_rad

## Overview

SIMS Radiology is an agentic radiology operations platform: studies enter through API workflows, are ingested and prioritized, then receive AI-assisted case context and draft reporting under clinical guardrails for radiologist review. The workbench streams agent UI updates; persisted events support downstream workflow and report delivery. The README also documents PACS/EHR integrations, SHAP explainability, auditability, and transactional outbox delivery. Some subsystems are represented from README and tree evidence; their internal call paths were not sampled, so uncertain links are omitted.

Main entry points: [`agents/radiology_orchestrator.py`](https://github.com/openhealthagents/sims_rad/blob/main/agents/radiology_orchestrator.py) (Radiology Orchestrator), [`core/application/use_cases/ingest_study.py`](https://github.com/openhealthagents/sims_rad/blob/main/core/application/use_cases/ingest_study.py) (Study Ingestion), [`core/infrastructure/persistence/outbox_worker.py`](https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/persistence/outbox_worker.py) (Outbox Dispatcher), [`apps/web/src/a2ui_engine.js`](https://github.com/openhealthagents/sims_rad/blob/main/apps/web/src/a2ui_engine.js) (A2UI Stream Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User Interfaces"]
  node_api["FastAPI Application<br/>[main.py]"]
  node_webengine["A2UI Stream Engine<br/>[a2ui_engine.js]"]
  node_workbench["Radiologist Workbench<br/>[workbench.js]"]
  node_widgets["Clinical UI Widgets"]
end

subgraph group_clinical["Clinical Workflow"]
  node_ingest["Study Ingestion<br/>[ingest_study.py]"]
  node_triage["AI Diagnostic Triage"]
  node_study["Study Entity<br/>[study.py]"]
  node_lifecycle["Lifecycle Rules<br/>[state_machine.py]"]
end

subgraph group_agents["Agent Intelligence"]
  node_orchestrator["Radiology Orchestrator"]
  node_concierge["Case Concierge<br/>[case_concierge.py]"]
  node_guardrails["Clinical Guardrails<br/>[service.py]"]
  node_clinicaltools["Clinical Tools<br/>[clinical_tools.py]"]
  node_reporttools["Reporting Tools<br/>[reporting_tools.py]"]
  node_shap["SHAP Explainability<br/>[shap_tools.py]"]
end

subgraph group_platform["Persistence &amp; Integrations"]
  node_studyrepo[("Study Repository")]
  node_outbox["Outbox Dispatcher<br/>[outbox_worker.py]"]
  node_eventstore[("Persistence Models<br/>[models.py]")]
end

node_radiologist(("Radiologist"))
node_kestra{{"Kestra Workflows"}}
node_ehr{{"Hospital EHR"}}
node_pacs{{"PACS"}}

node_api -.->|"routes studies"| node_ingest
node_api -->|"routes triage"| node_triage
node_ingest -->|"persists study"| node_studyrepo
node_ingest -->|"creates study"| node_study
node_orchestrator -->|"requests case brief"| node_concierge
node_orchestrator -->|"checks outputs"| node_guardrails
node_orchestrator -->|"uses tools"| node_clinicaltools
node_orchestrator -->|"uses tools"| node_reporttools
node_orchestrator -.->|"explains timing"| node_shap
node_webengine -->|"opens SSE stream"| node_api
node_workbench -->|"uses engine"| node_webengine
node_webengine -->|"registers widgets"| node_widgets
node_radiologist -.->|"reviews drafts"| node_workbench
node_outbox -->|"polls events"| node_eventstore
node_outbox -->|"triggers flows"| node_kestra
node_outbox -->|"delivers reports"| node_ehr
node_pacs -.->|"provides imaging"| node_ingest

click node_api "https://github.com/openhealthagents/sims_rad/blob/main/apps/api/src/main.py"
click node_ingest "https://github.com/openhealthagents/sims_rad/blob/main/core/application/use_cases/ingest_study.py"
click node_triage "https://github.com/openhealthagents/sims_rad/blob/main/core/application/use_cases/run_ai_diagnostic_triage.py"
click node_study "https://github.com/openhealthagents/sims_rad/blob/main/core/domain/entities/study.py"
click node_lifecycle "https://github.com/openhealthagents/sims_rad/blob/main/core/domain/state_machine.py"
click node_orchestrator "https://github.com/openhealthagents/sims_rad/blob/main/agents/radiology_orchestrator.py"
click node_concierge "https://github.com/openhealthagents/sims_rad/blob/main/agents/case_concierge.py"
click node_guardrails "https://github.com/openhealthagents/sims_rad/blob/main/agents/guardrails/service.py"
click node_clinicaltools "https://github.com/openhealthagents/sims_rad/blob/main/agents/tools/clinical_tools.py"
click node_reporttools "https://github.com/openhealthagents/sims_rad/blob/main/agents/tools/reporting_tools.py"
click node_shap "https://github.com/openhealthagents/sims_rad/blob/main/agents/tools/shap_tools.py"
click node_webengine "https://github.com/openhealthagents/sims_rad/blob/main/apps/web/src/a2ui_engine.js"
click node_workbench "https://github.com/openhealthagents/sims_rad/blob/main/apps/web/src/views/workbench.js"
click node_widgets "https://github.com/openhealthagents/sims_rad/tree/main/apps/web/src/components"
click node_studyrepo "https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/db/study_repository_impl.py"
click node_outbox "https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/persistence/outbox_worker.py"
click node_eventstore "https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/persistence/models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_webengine,node_workbench,node_widgets toneBlue
class node_ingest,node_triage,node_study,node_lifecycle toneAmber
class node_orchestrator,node_concierge,node_guardrails,node_clinicaltools,node_reporttools,node_shap toneMint
class node_studyrepo,node_outbox,node_eventstore toneRose
class node_radiologist,node_kestra,node_ehr,node_pacs toneIndigo
```

## Components

### User Interfaces

- [FastAPI Application](https://github.com/openhealthagents/sims_rad/blob/main/apps/api/src/main.py): `apps/api/src/main.py`
- [A2UI Stream Engine](https://github.com/openhealthagents/sims_rad/blob/main/apps/web/src/a2ui_engine.js): `apps/web/src/a2ui_engine.js`
- [Radiologist Workbench](https://github.com/openhealthagents/sims_rad/blob/main/apps/web/src/views/workbench.js): `apps/web/src/views/workbench.js`
- [Clinical UI Widgets](https://github.com/openhealthagents/sims_rad/tree/main/apps/web/src/components): `apps/web/src/components`

### Clinical Workflow

- [Study Ingestion](https://github.com/openhealthagents/sims_rad/blob/main/core/application/use_cases/ingest_study.py): `core/application/use_cases/ingest_study.py`
- [AI Diagnostic Triage](https://github.com/openhealthagents/sims_rad/blob/main/core/application/use_cases/run_ai_diagnostic_triage.py): `core/application/use_cases/run_ai_diagnostic_triage.py`
- [Study Entity](https://github.com/openhealthagents/sims_rad/blob/main/core/domain/entities/study.py): `core/domain/entities/study.py`
- [Lifecycle Rules](https://github.com/openhealthagents/sims_rad/blob/main/core/domain/state_machine.py): `core/domain/state_machine.py`

### Agent Intelligence

- [Radiology Orchestrator](https://github.com/openhealthagents/sims_rad/blob/main/agents/radiology_orchestrator.py): `agents/radiology_orchestrator.py`
- [Case Concierge](https://github.com/openhealthagents/sims_rad/blob/main/agents/case_concierge.py): `agents/case_concierge.py`
- [Clinical Guardrails](https://github.com/openhealthagents/sims_rad/blob/main/agents/guardrails/service.py): `agents/guardrails/service.py`
- [Clinical Tools](https://github.com/openhealthagents/sims_rad/blob/main/agents/tools/clinical_tools.py): `agents/tools/clinical_tools.py`
- [Reporting Tools](https://github.com/openhealthagents/sims_rad/blob/main/agents/tools/reporting_tools.py): `agents/tools/reporting_tools.py`
- [SHAP Explainability](https://github.com/openhealthagents/sims_rad/blob/main/agents/tools/shap_tools.py): `agents/tools/shap_tools.py`

### Persistence & Integrations

- [Study Repository](https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/db/study_repository_impl.py): `core/infrastructure/db/study_repository_impl.py`
- [Outbox Dispatcher](https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/persistence/outbox_worker.py): `core/infrastructure/persistence/outbox_worker.py`
- [Persistence Models](https://github.com/openhealthagents/sims_rad/blob/main/core/infrastructure/persistence/models.py): `core/infrastructure/persistence/models.py`

### Other components

- **Radiologist**
- **Kestra Workflows**
- **Hospital EHR**
- **PACS**

## Connections

- FastAPI Application → Study Ingestion: routes studies
- FastAPI Application → AI Diagnostic Triage: routes triage (evidence: `apps/api/src/main.py`)
- Study Ingestion → Study Repository: persists study (evidence: `core/application/use_cases/ingest_study.py`)
- Study Ingestion → Study Entity: creates study (evidence: `core/application/use_cases/ingest_study.py`)
- Radiology Orchestrator → Case Concierge: requests case brief (evidence: `agents/radiology_orchestrator.py`)
- Radiology Orchestrator → Clinical Guardrails: checks outputs (evidence: `agents/radiology_orchestrator.py`)
- Radiology Orchestrator → Clinical Tools: uses tools (evidence: `agents/radiology_orchestrator.py`)
- Radiology Orchestrator → Reporting Tools: uses tools (evidence: `agents/radiology_orchestrator.py`)
- Radiology Orchestrator → SHAP Explainability: explains timing
- A2UI Stream Engine → FastAPI Application: opens SSE stream (evidence: `apps/web/src/a2ui_engine.js`)
- Radiologist Workbench → A2UI Stream Engine: uses engine (evidence: `apps/web/src/main.js`)
- A2UI Stream Engine → Clinical UI Widgets: registers widgets (evidence: `apps/web/src/a2ui_engine.js`)
- Radiologist → Radiologist Workbench: reviews drafts
- Outbox Dispatcher → Persistence Models: polls events (evidence: `core/infrastructure/persistence/outbox_worker.py`)
- Outbox Dispatcher → Kestra Workflows: triggers flows (evidence: `core/infrastructure/persistence/outbox_worker.py`)
- Outbox Dispatcher → Hospital EHR: delivers reports (evidence: `core/infrastructure/persistence/outbox_worker.py`)
- PACS → Study Ingestion: provides imaging
