# yahyalababenah/omnidiag architecture

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

- Interactive diagram: https://gitdiagram.com/yahyalababenah/omnidiag
- Repository: https://github.com/yahyalababenah/omnidiag

## Overview

OmniDiag is a multi-disease clinical decision-support application. Clinicians enter patient data through the React interface; the FastAPI API routes it by disease to a configured model and returns risk results, with separate explanation and counterfactual capabilities. Patient records and uncertain-prediction review support clinical follow-up, while authentication, administration, monitoring, report generation, and federated learning provide distinct product branches. The README documents routing and active-learning behavior; sampled excerpts do not expose every endpoint’s full call wiring, so uncertain links are omitted.

Main entry points: [`backend/main.py`](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/main.py) (FastAPI API), [`backend/database.py`](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/database.py) (Clinical database), [`backend/router.py`](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/router.py) (Disease router), [`backend/active_learning/routes.py`](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/active_learning/routes.py) (Expert review queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Clinical interface"]
  node_app["Clinical UI<br/>[App.jsx]"]
  node_engineering["Risk workflow"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and inference"]
  node_main["FastAPI API<br/>[main.py]"]
  node_router["Disease router<br/>[router.py]"]
  node_config["Disease configuration<br/>[config_loader.py]"]
  node_features["Feature engineering"]
  node_backend_iface["Model backend<br/>[base.py]"]
  node_model["Model loading<br/>[model_loader.py]"]
  node_shap["SHAP explanations<br/>[shap_service.py]"]
  node_counterfactual["Counterfactuals"]
  node_auth["Authentication and roles<br/>[dependencies.py]"]
end

subgraph group_clinical["Clinical records"]
  node_records["Patient records<br/>[routes.py]"]
  node_review["Expert review queue<br/>[routes.py]"]
  node_db[("Clinical database<br/>[database.py]")]
  node_report["Clinical reports"]
end

subgraph group_operations["Operations and learning"]
  node_admin["Administration<br/>[routes.py]"]
  node_monitor["Monitoring<br/>[routes.py]"]
  node_retrain["Active learning retraining<br/>[retrain.py]"]
  node_federated_client["Federated site client<br/>[client.py]"]
  node_federated_agg["Federated aggregation<br/>[aggregator.py]"]
end

subgraph group_integrations["External services"]
  node_llm_service{{"LLM provider"}}
  node_prometheus{{"Prometheus"}}
  node_federated_server{{"Federated server"}}
end

node_clinician(("Clinician"))

node_clinician -->|"uses"| node_app
node_app -->|"opens workflow"| node_engineering
node_engineering -->|"submits inputs"| node_api_client
node_api_client -->|"requests prediction"| node_main
node_main -->|"routes disease"| node_router
node_router -->|"loads settings"| node_config
node_router -->|"selects backend"| node_backend_iface
node_router -->|"engineers features"| node_features
node_backend_iface -->|"delegates inference"| node_model
node_main -->|"requests explanation"| node_shap
node_main -->|"requests alternatives"| node_counterfactual
node_main -->|"persists predictions"| node_db
node_main -->|"queues uncertain results"| node_review
node_clinician -->|"manages patients"| node_records
node_records -->|"reads and writes"| node_db
node_clinician -->|"annotates cases"| node_review
node_review -->|"reads and writes"| node_db
node_main -->|"checks identity"| node_auth
node_report -.->|"requests report"| node_llm_service
node_admin -->|"queries records"| node_db
node_admin -->|"starts retraining"| node_retrain
node_monitor -->|"reads predictions"| node_db
node_monitor -->|"records drift metrics"| node_prometheus
node_federated_client -.->|"sends model updates"| node_federated_server
node_federated_agg -.->|"aggregates updates"| node_federated_server

click node_app "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/frontend/src/App.jsx"
click node_engineering "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/frontend/src/components/EngineeringMode.jsx"
click node_api_client "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/frontend/src/api.js"
click node_main "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/main.py"
click node_router "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/router.py"
click node_config "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/configs/config_loader.py"
click node_features "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/features/diabetes_features.py"
click node_backend_iface "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/model_backends/base.py"
click node_model "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/model_loader.py"
click node_shap "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/shap_service.py"
click node_counterfactual "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/counterfactual_generator.py"
click node_auth "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/auth/dependencies.py"
click node_records "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/patients/routes.py"
click node_review "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/active_learning/routes.py"
click node_db "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/database.py"
click node_report "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/llm/report_generator.py"
click node_admin "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/admin/routes.py"
click node_monitor "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/monitoring/routes.py"
click node_retrain "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/active_learning/retrain.py"
click node_federated_client "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/federated/client.py"
click node_federated_agg "https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/federated/aggregator.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_app,node_engineering,node_api_client toneBlue
class node_main,node_router,node_config,node_features,node_backend_iface,node_model,node_shap,node_counterfactual,node_auth toneAmber
class node_records,node_review,node_db,node_report toneMint
class node_admin,node_monitor,node_retrain,node_federated_client,node_federated_agg toneRose
class node_llm_service,node_prometheus,node_federated_server,node_clinician toneIndigo
```

## Components

### Clinical interface

- [Clinical UI](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Risk workflow](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/frontend/src/components/EngineeringMode.jsx): `frontend/src/components/EngineeringMode.jsx`
- [API client](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/frontend/src/api.js): `frontend/src/api.js`

### API and inference

- [FastAPI API](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/main.py): `backend/main.py`
- [Disease router](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/router.py): `backend/router.py`
- [Disease configuration](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/configs/config_loader.py): `configs/config_loader.py`
- [Feature engineering](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/features/diabetes_features.py): `features/diabetes_features.py`
- [Model backend](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/model_backends/base.py): `backend/model_backends/base.py`
- [Model loading](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/model_loader.py): `backend/model_loader.py`
- [SHAP explanations](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/shap_service.py): `backend/shap_service.py`
- [Counterfactuals](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/counterfactual_generator.py): `backend/counterfactual_generator.py`
- [Authentication and roles](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/auth/dependencies.py): `backend/auth/dependencies.py`

### Clinical records

- [Patient records](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/patients/routes.py): `backend/patients/routes.py`
- [Expert review queue](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/active_learning/routes.py): `backend/active_learning/routes.py`
- [Clinical database](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/database.py): `backend/database.py`
- [Clinical reports](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/llm/report_generator.py): `backend/llm/report_generator.py`

### Operations and learning

- [Administration](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/admin/routes.py): `backend/admin/routes.py`
- [Monitoring](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/monitoring/routes.py): `backend/monitoring/routes.py`
- [Active learning retraining](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/active_learning/retrain.py): `backend/active_learning/retrain.py`
- [Federated site client](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/federated/client.py): `backend/federated/client.py`
- [Federated aggregation](https://github.com/yahyalababenah/omnidiag/blob/deploy/v2-platform/backend/federated/aggregator.py): `backend/federated/aggregator.py`

### External services

- **LLM provider**
- **Prometheus**
- **Federated server**

### Other components

- **Clinician**

## Connections

- Clinician → Clinical UI: uses
- Clinical UI → Risk workflow: opens workflow
- Risk workflow → API client: submits inputs
- API client → FastAPI API: requests prediction
- FastAPI API → Disease router: routes disease
- Disease router → Disease configuration: loads settings
- Disease router → Model backend: selects backend
- Disease router → Feature engineering: engineers features
- Model backend → Model loading: delegates inference
- FastAPI API → SHAP explanations: requests explanation
- FastAPI API → Counterfactuals: requests alternatives
- FastAPI API → Clinical database: persists predictions
- FastAPI API → Expert review queue: queues uncertain results
- Clinician → Patient records: manages patients
- Patient records → Clinical database: reads and writes
- Clinician → Expert review queue: annotates cases
- Expert review queue → Clinical database: reads and writes
- FastAPI API → Authentication and roles: checks identity
- Clinical reports → LLM provider: requests report
- Administration → Clinical database: queries records
- Administration → Active learning retraining: starts retraining
- Monitoring → Clinical database: reads predictions
- Monitoring → Prometheus: records drift metrics
- Federated site client → Federated server: sends model updates
- Federated aggregation → Federated server: aggregates updates
