# aekanshmohan/explainable-ai-for-cdss architecture

> Architecture diagram of the GitHub repository aekanshmohan/explainable-ai-for-cdss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aekanshmohan/explainable-ai-for-cdss
- Repository: https://github.com/aekanshmohan/explainable-ai-for-cdss

## Overview

The product is a clinical decision-support workstation. Its principal workflow is patient intake and assessment selection, followed by modality-specific analysis, composite risk review, and clinical review. The backend also exposes authentication, assessment history, audit logging, and review endpoints backed by SQLite. The README documents ECG, fracture, explainability, transparency, and signed PDF capabilities; some implementation details and frontend-to-backend calls are not shown, so those links are marked unverified or omitted.

Main entry points: [`api.py`](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py) (FastAPI Service), [`frontend/src/app/page.js`](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js) (Clinical Workstation), [`utils/xray_engine.py`](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/xray_engine.py) (X-ray Explainability), [`utils/ecg_engine.py`](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/ecg_engine.py) (ECG Explainability)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Clinical Workflow"]
  node_workstation["Clinical Workstation<br/>[page.js]"]
  node_intake["Patient Intake<br/>[page.js]"]
  node_assessment["Assessment Selection<br/>[page.js]"]
  node_risk_review["Risk Review<br/>[page.js]"]
  node_clinical_review["Clinical Review<br/>[api.py]"]
end

subgraph group_diagnostics["Diagnostic Analysis"]
  node_xray_analysis["Chest X-ray<br/>[api.py]"]
  node_fracture_analysis["Fracture Analysis<br/>[api.py]"]
  node_ecg_analysis["ECG Analysis<br/>[api.py]"]
  node_xray_engine["X-ray Explainability<br/>[xray_engine.py]"]
  node_ecg_engine["ECG Explainability<br/>[ecg_engine.py]"]
  node_dicom["DICOM Processing<br/>[dicom_handler.py]"]
end

subgraph group_backend["Backend Services"]
  node_api["FastAPI Service<br/>[api.py]"]
  node_auth["Authentication<br/>[api.py]"]
  node_assessment_store[("Assessment Records<br/>[api.py]")]
  node_audit["Audit Logging<br/>[api.py]"]
  node_history["History &amp; Statistics<br/>[api.py]"]
end

subgraph group_transparency["Transparency &amp; Reporting"]
  node_explanations["Clinical Explanations<br/>[page.js]"]
  node_model_dashboard["Model Transparency<br/>[page.js]"]
  node_pdf_export["Signed PDF Reports<br/>[page.js]"]
end

node_clinician(("Clinician"))

node_clinician -->|"uses"| node_workstation
node_workstation -->|"starts with"| node_intake
node_workstation -->|"selects"| node_assessment
node_workstation -->|"reviews risk"| node_risk_review
node_workstation -.->|"requests analysis"| node_api
node_api -->|"routes"| node_xray_analysis
node_api -->|"routes"| node_fracture_analysis
node_api -->|"routes"| node_ecg_analysis
node_api -->|"checks access"| node_auth
node_api -->|"reads and writes"| node_assessment_store
node_api -->|"records actions"| node_audit
node_api -->|"serves queries"| node_history
node_api -->|"accepts review"| node_clinical_review
node_workstation -->|"shows attribution"| node_explanations
node_workstation -->|"shows metrics"| node_model_dashboard
node_workstation -->|"exports report"| node_pdf_export
node_xray_engine -->|"produces Grad-CAM"| node_explanations
node_ecg_engine -.->|"produces saliency"| node_explanations

click node_workstation "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"
click node_intake "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"
click node_assessment "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"
click node_risk_review "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"
click node_clinical_review "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_xray_analysis "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_fracture_analysis "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_ecg_analysis "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_xray_engine "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/xray_engine.py"
click node_ecg_engine "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/ecg_engine.py"
click node_dicom "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/dicom_handler.py"
click node_api "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_auth "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_assessment_store "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_audit "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_history "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py"
click node_explanations "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"
click node_model_dashboard "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"
click node_pdf_export "https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js"

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_workstation,node_intake,node_assessment,node_risk_review,node_clinical_review toneBlue
class node_xray_analysis,node_fracture_analysis,node_ecg_analysis,node_xray_engine,node_ecg_engine,node_dicom toneAmber
class node_api,node_auth,node_assessment_store,node_audit,node_history toneMint
class node_explanations,node_model_dashboard,node_pdf_export toneRose
class node_clinician toneIndigo
```

## Components

### Clinical Workflow

- [Clinical Workstation](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Patient Intake](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Assessment Selection](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Risk Review](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Clinical Review](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`

### Diagnostic Analysis

- [Chest X-ray](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [Fracture Analysis](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [ECG Analysis](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [X-ray Explainability](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/xray_engine.py): `utils/xray_engine.py`
- [ECG Explainability](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/ecg_engine.py): `utils/ecg_engine.py`
- [DICOM Processing](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/utils/dicom_handler.py): `utils/dicom_handler.py`

### Backend Services

- [FastAPI Service](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [Authentication](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [Assessment Records](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [Audit Logging](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`
- [History & Statistics](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/api.py): `api.py`

### Transparency & Reporting

- [Clinical Explanations](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Model Transparency](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Signed PDF Reports](https://github.com/aekanshmohan/explainable-ai-for-cdss/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`

### Other components

- **Clinician**

## Connections

- Clinician → Clinical Workstation: uses (evidence: `README.md`)
- Clinical Workstation → Patient Intake: starts with (evidence: `README.md`)
- Clinical Workstation → Assessment Selection: selects (evidence: `README.md`)
- Clinical Workstation → Risk Review: reviews risk (evidence: `README.md`)
- Clinical Workstation → FastAPI Service: requests analysis
- FastAPI Service → Chest X-ray: routes (evidence: `api.py`)
- FastAPI Service → Fracture Analysis: routes (evidence: `api.py`)
- FastAPI Service → ECG Analysis: routes (evidence: `api.py`)
- FastAPI Service → Authentication: checks access (evidence: `api.py`)
- FastAPI Service → Assessment Records: reads and writes (evidence: `api.py`)
- FastAPI Service → Audit Logging: records actions (evidence: `api.py`)
- FastAPI Service → History & Statistics: serves queries (evidence: `api.py`)
- FastAPI Service → Clinical Review: accepts review (evidence: `api.py`)
- Clinical Workstation → Clinical Explanations: shows attribution (evidence: `README.md`)
- Clinical Workstation → Model Transparency: shows metrics (evidence: `README.md`)
- Clinical Workstation → Signed PDF Reports: exports report (evidence: `README.md`)
- X-ray Explainability → Clinical Explanations: produces Grad-CAM (evidence: `README.md`)
- ECG Explainability → Clinical Explanations: produces saliency
