# manas1329/federated-learning architecture

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

- Interactive diagram: https://gitdiagram.com/manas1329/federated-learning
- Repository: https://github.com/manas1329/federated-learning

## Overview

The repository combines a federated chest-X-ray training system with a healthcare operations platform. The main workflow splits data across hospitals, trains private and quantized client models, coordinates rounds at the FL server, and supports evaluation and monitoring. The web platform provides authenticated admin and hospital workflows, process control, persistence, audit, and live dashboards. Several product modules are named in the README or SOURCE INDEX but were not excerpted; their relationships are shown only where documented or referenced by sampled source.

Main entry points: [`federated_healthcare/src/server.py`](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/server.py) (FL coordinator), [`webapp/main.py`](https://github.com/manas1329/federated-learning/blob/main/webapp/main.py) (Platform API), [`federated_healthcare/src/client.py`](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/client.py) (FL client), [`federated_healthcare/src/trust_manager.py`](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/trust_manager.py) (Trust management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and modeling"]
  node_split["Non-IID splitter<br/>[split_data.py]"]
  node_localdata[("Hospital datasets")]
  node_model["Chest CNN<br/>[model.py]"]
end

subgraph group_federated["Federated training"]
  node_client["FL client<br/>[client.py]"]
  node_quant["INT8 quantization<br/>[quantization.py]"]
  node_server["FL coordinator<br/>[server.py]"]
  node_dropout["Dropout handling<br/>[dropout_handler.py]"]
  node_trust["Trust management<br/>[trust_manager.py]"]
  node_preagg["Pre-aggregation gate<br/>[pre_agg_gate.py]"]
  node_unlearning["Unlearning workflow"]
end

subgraph group_platform["Healthcare platform"]
  node_webapp["Platform API<br/>[main.py]"]
  node_admin["Admin workflows<br/>[admin_routes.py]"]
  node_hospitalroutes["Hospital workflows<br/>[hospital_routes.py]"]
  node_process["Process manager<br/>[process_manager.py]"]
  node_auth["Authentication and roles<br/>[dependencies.py]"]
  node_audit["Audit logger<br/>[audit.py]"]
  node_dbmodels[("Platform records<br/>[db_models.py]")]
  node_db[("Database connection<br/>[connection.py]")]
end

subgraph group_observability["Monitoring and analysis"]
  node_eval["Global evaluation<br/>[evaluate.py]"]
  node_liveapi["Dashboard state API<br/>[dashboard_api.py]"]
  node_dashboardstate["Dashboard state<br/>[dashboard_state.py]"]
  node_reactapp["Operations dashboard<br/>[App.jsx]"]
  node_livehook["Live-state hook<br/>[useLiveState.js]"]
  node_metrics["Metrics reader<br/>[metrics_reader.py]"]
  node_analysis["Training analysis<br/>[graph.py]"]
end

node_hospital(("Hospital operator"))

node_hospital -->|"prepares data"| node_split
node_split -->|"creates splits"| node_localdata
node_hospital -->|"starts training"| node_client
node_client -->|"trains locally"| node_model
node_client -->|"quantizes updates"| node_quant
node_client -->|"sends updates"| node_server
node_server -->|"coordinates model"| node_model
node_server -->|"uses quantization"| node_quant
node_server -->|"handles dropout"| node_dropout
node_server -->|"checks trust"| node_trust
node_trust -->|"uses gate"| node_preagg
node_trust -->|"updates state"| node_dashboardstate
node_server -->|"invokes workflow"| node_unlearning
node_hospital -->|"uses platform"| node_webapp
node_webapp -->|"routes requests"| node_admin
node_webapp -->|"routes requests"| node_hospitalroutes
node_admin -->|"controls processes"| node_process
node_hospitalroutes -->|"controls processes"| node_process
node_admin -->|"records actions"| node_audit
node_hospitalroutes -->|"records activity"| node_audit
node_webapp -->|"serves routes"| node_auth
node_auth -->|"queries users"| node_dbmodels
node_audit -->|"creates audit records"| node_dbmodels
node_dbmodels -->|"uses database base"| node_db
node_webapp -->|"initializes database"| node_db
node_reactapp -->|"uses live state"| node_livehook
node_hospital -.->|"monitors training"| node_reactapp
node_hospital -->|"evaluates model"| node_eval
node_hospital -->|"generates graphs"| node_analysis
node_hospital -.->|"views live status"| node_liveapi
node_webapp -.->|"reads metrics"| node_metrics

click node_split "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/split_data.py"
click node_model "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/model.py"
click node_client "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/client.py"
click node_quant "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/quantization.py"
click node_server "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/server.py"
click node_dropout "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/dropout_handler.py"
click node_trust "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/trust_manager.py"
click node_preagg "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/pre_agg_gate.py"
click node_unlearning "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/unlearn_workflow.py"
click node_eval "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/evaluate.py"
click node_webapp "https://github.com/manas1329/federated-learning/blob/main/webapp/main.py"
click node_admin "https://github.com/manas1329/federated-learning/blob/main/webapp/routes/admin_routes.py"
click node_hospitalroutes "https://github.com/manas1329/federated-learning/blob/main/webapp/routes/hospital_routes.py"
click node_process "https://github.com/manas1329/federated-learning/blob/main/webapp/core/process_manager.py"
click node_auth "https://github.com/manas1329/federated-learning/blob/main/webapp/core/dependencies.py"
click node_audit "https://github.com/manas1329/federated-learning/blob/main/webapp/core/audit.py"
click node_dbmodels "https://github.com/manas1329/federated-learning/blob/main/webapp/models/db_models.py"
click node_db "https://github.com/manas1329/federated-learning/blob/main/webapp/database/connection.py"
click node_liveapi "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/dashboard_api.py"
click node_dashboardstate "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/dashboard_state.py"
click node_reactapp "https://github.com/manas1329/federated-learning/blob/main/server-dashboard/src/App.jsx"
click node_livehook "https://github.com/manas1329/federated-learning/blob/main/server-dashboard/src/hooks/useLiveState.js"
click node_metrics "https://github.com/manas1329/federated-learning/blob/main/webapp/core/metrics_reader.py"
click node_analysis "https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/graph.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_split,node_localdata,node_model toneBlue
class node_client,node_quant,node_server,node_dropout,node_trust,node_preagg,node_unlearning toneAmber
class node_webapp,node_admin,node_hospitalroutes,node_process,node_auth,node_audit,node_dbmodels,node_db toneMint
class node_eval,node_liveapi,node_dashboardstate,node_reactapp,node_livehook,node_metrics,node_analysis toneRose
class node_hospital toneIndigo
```

## Components

### Data and modeling

- [Non-IID splitter](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/split_data.py): `federated_healthcare/split_data.py`
- **Hospital datasets**
- [Chest CNN](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/model.py): `federated_healthcare/src/model.py`

### Federated training

- [FL client](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/client.py): `federated_healthcare/src/client.py`
- [INT8 quantization](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/quantization.py): `federated_healthcare/src/quantization.py`
- [FL coordinator](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/server.py): `federated_healthcare/src/server.py`
- [Dropout handling](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/dropout_handler.py): `federated_healthcare/src/dropout_handler.py`
- [Trust management](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/trust_manager.py): `federated_healthcare/src/trust_manager.py`
- [Pre-aggregation gate](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/pre_agg_gate.py): `federated_healthcare/src/pre_agg_gate.py`
- [Unlearning workflow](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/unlearn_workflow.py): `federated_healthcare/src/unlearn_workflow.py`

### Healthcare platform

- [Platform API](https://github.com/manas1329/federated-learning/blob/main/webapp/main.py): `webapp/main.py`
- [Admin workflows](https://github.com/manas1329/federated-learning/blob/main/webapp/routes/admin_routes.py): `webapp/routes/admin_routes.py`
- [Hospital workflows](https://github.com/manas1329/federated-learning/blob/main/webapp/routes/hospital_routes.py): `webapp/routes/hospital_routes.py`
- [Process manager](https://github.com/manas1329/federated-learning/blob/main/webapp/core/process_manager.py): `webapp/core/process_manager.py`
- [Authentication and roles](https://github.com/manas1329/federated-learning/blob/main/webapp/core/dependencies.py): `webapp/core/dependencies.py`
- [Audit logger](https://github.com/manas1329/federated-learning/blob/main/webapp/core/audit.py): `webapp/core/audit.py`
- [Platform records](https://github.com/manas1329/federated-learning/blob/main/webapp/models/db_models.py): `webapp/models/db_models.py`
- [Database connection](https://github.com/manas1329/federated-learning/blob/main/webapp/database/connection.py): `webapp/database/connection.py`

### Monitoring and analysis

- [Global evaluation](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/evaluate.py): `federated_healthcare/src/evaluate.py`
- [Dashboard state API](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/dashboard_api.py): `federated_healthcare/src/dashboard_api.py`
- [Dashboard state](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/dashboard_state.py): `federated_healthcare/src/dashboard_state.py`
- [Operations dashboard](https://github.com/manas1329/federated-learning/blob/main/server-dashboard/src/App.jsx): `server-dashboard/src/App.jsx`
- [Live-state hook](https://github.com/manas1329/federated-learning/blob/main/server-dashboard/src/hooks/useLiveState.js): `server-dashboard/src/hooks/useLiveState.js`
- [Metrics reader](https://github.com/manas1329/federated-learning/blob/main/webapp/core/metrics_reader.py): `webapp/core/metrics_reader.py`
- [Training analysis](https://github.com/manas1329/federated-learning/blob/main/federated_healthcare/src/graph.py): `federated_healthcare/src/graph.py`

### Other components

- **Hospital operator**

## Connections

- Hospital operator → Non-IID splitter: prepares data
- Non-IID splitter → Hospital datasets: creates splits
- Hospital operator → FL client: starts training
- FL client → Chest CNN: trains locally (evidence: `federated_healthcare/src/client.py`)
- FL client → INT8 quantization: quantizes updates (evidence: `federated_healthcare/src/client.py`)
- FL client → FL coordinator: sends updates
- FL coordinator → Chest CNN: coordinates model (evidence: `federated_healthcare/src/server.py`)
- FL coordinator → INT8 quantization: uses quantization (evidence: `federated_healthcare/src/server.py`)
- FL coordinator → Dropout handling: handles dropout (evidence: `federated_healthcare/src/server.py`)
- FL coordinator → Trust management: checks trust (evidence: `federated_healthcare/src/server.py`)
- Trust management → Pre-aggregation gate: uses gate (evidence: `federated_healthcare/src/trust_manager.py`)
- Trust management → Dashboard state: updates state (evidence: `federated_healthcare/src/trust_manager.py`)
- FL coordinator → Unlearning workflow: invokes workflow (evidence: `federated_healthcare/src/server.py`)
- Hospital operator → Platform API: uses platform (evidence: `webapp/main.py`)
- Platform API → Admin workflows: routes requests (evidence: `webapp/main.py`)
- Platform API → Hospital workflows: routes requests (evidence: `webapp/main.py`)
- Admin workflows → Process manager: controls processes (evidence: `webapp/routes/admin_routes.py`)
- Hospital workflows → Process manager: controls processes (evidence: `webapp/routes/hospital_routes.py`)
- Admin workflows → Audit logger: records actions (evidence: `webapp/routes/admin_routes.py`)
- Hospital workflows → Audit logger: records activity (evidence: `webapp/routes/hospital_routes.py`)
- Platform API → Authentication and roles: serves routes (evidence: `webapp/main.py`)
- Authentication and roles → Platform records: queries users (evidence: `webapp/core/dependencies.py`)
- Audit logger → Platform records: creates audit records (evidence: `webapp/core/audit.py`)
- Platform records → Database connection: uses database base (evidence: `webapp/models/db_models.py`)
- Platform API → Database connection: initializes database (evidence: `webapp/main.py`)
- Operations dashboard → Live-state hook: uses live state (evidence: `server-dashboard/src/App.jsx`)
- Hospital operator → Operations dashboard: monitors training
- Hospital operator → Global evaluation: evaluates model
- Hospital operator → Training analysis: generates graphs
- Hospital operator → Dashboard state API: views live status
- Platform API → Metrics reader: reads metrics
