# katherlab/mediswarm architecture

> Architecture diagram of the GitHub repository katherlab/mediswarm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/katherlab/mediswarm
- Repository: https://github.com/katherlab/mediswarm

## Overview

##### Main Components

a) Core Infrastructure Layer:
- NVFlare Framework Integration
- Swarm Learning Controller
- Docker Containerization System

b) Application Layer:
- Medical Deep Learning Jobs (3DCNN, CIFAR10)
- Data Processing Pipeline
- Model Training Systems

c) Security & Communication Layer:
- OpenVPN Configuration
- Data Privacy Controls
- Inter-node Communication

##### Specific Implementation Details

For the Medical Imaging Components:
- 3DCNN pipeline structure
- Data augmentation flow
- Demonstrate model selection pathway

For the Federated Learning Flow:
- Model aggregation process
- Privacy-preserving data boundaries
- Validation/testing pathways

##### Technical Specifications

Hardware Requirements Section:
- GPU allocation (48GB recommended)
- RAM requirements (64GB recommended)
- Storage requirements (8TB recommended)

##### Key Elements to Emphasize

a) Privacy & Security:
- Data isolation boundaries
- Secure communication channels
- Local data processing zones

b) Scalability Features:
- Docker container orchestration
- Dynamic node addition capability
- Resource allocation management

c) Model Management:
- Model versioning system
- Training checkpoints
- Validation pipelines

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#2374f7,color:white
    classDef data fill:#4CAF50,color:white
    classDef security fill:#FFD700,color:black
    classDef critical fill:#FF4444,color:white
    classDef infra fill:#808080,color:white
    
    %% Infrastructure Layer
    subgraph Infrastructure
        Docker["Docker Container System"]
        ModelRepo["Model Repository"]
        Resources["Shared Resources"]
    end
    
    %% Swarm Controller Layer
    subgraph SwarmController
        ClientCtl["Client Controller"]
        ServerCtl["Server Controller"]
        Gatherer["Metrics Gatherer"]
        NVFlare["NVFlare Orchestrator"]
    end
    
    %% Client Nodes Layer
    subgraph Institution1
        Data1["Local Data Storage"]
        Training1["Local Training"]
        VPN1["OpenVPN Client"]
    end
    
    subgraph Institution2
        Data2["Local Data Storage"]
        Training2["Local Training"]
        VPN2["OpenVPN Client"]
    end
    
    subgraph Institution3
        Data3["Local Data Storage"]
        Training3["Local Training"]
        VPN3["OpenVPN Client"]
    end
    
    %% Medical Components
    subgraph MedicalComponents
        CNN["3DCNN Pipeline"]
        DataAug["Data Augmentation"]
        ModelSelect["Model Selection"]
    end
    
    %% Hardware Requirements
    subgraph Requirements
        GPU["GPU: 48GB"]
        RAM["RAM: 64GB"]
        Storage["Storage: 8TB"]
    end
    
    %% Relationships
    Institution1 --> VPN1
    Institution2 --> VPN2
    Institution3 --> VPN3
    
    VPN1 -.-> ClientCtl
    VPN2 -.-> ClientCtl
    VPN3 -.-> ClientCtl
    
    ClientCtl --> ServerCtl
    ServerCtl --> Gatherer
    Gatherer --> NVFlare
    
    NVFlare --> ModelRepo
    Docker --> Resources
    
    Training1 --> CNN
    Training2 --> CNN
    Training3 --> CNN
    
    CNN --> DataAug
    DataAug --> ModelSelect
    
    %% Click Events
    click ClientCtl "https://github.com/KatherLab/MediSwarm/blob/main/controller/controller/swarm_client_ctl.py"
    click ServerCtl "https://github.com/KatherLab/MediSwarm/blob/main/controller/controller/swarm_server_ctl.py"
    click Gatherer "https://github.com/KatherLab/MediSwarm/blob/main/controller/controller/gatherer.py"
    click Docker "https://github.com/KatherLab/MediSwarm/tree/main/docker_config"
    click CNN "https://github.com/KatherLab/MediSwarm/tree/main/application/jobs/3dcnn_ptl/app/custom/models"
    click Training1 "https://github.com/KatherLab/MediSwarm/blob/main/application/jobs/3dcnn_ptl/app/custom/main.py"
    click Training2 "https://github.com/KatherLab/MediSwarm/blob/main/application/jobs/3dcnn_ptl/app/custom/main.py"
    click Training3 "https://github.com/KatherLab/MediSwarm/blob/main/application/jobs/3dcnn_ptl/app/custom/main.py"
    click DataAug "https://github.com/KatherLab/MediSwarm/tree/main/application/jobs/3dcnn_ptl/app/custom/data/augmentation"
    click VPN1 "https://github.com/KatherLab/MediSwarm/tree/main/assets/openvpn_configs/good_access"
    click VPN2 "https://github.com/KatherLab/MediSwarm/tree/main/assets/openvpn_configs/good_access"
    click VPN3 "https://github.com/KatherLab/MediSwarm/tree/main/assets/openvpn_configs/good_access"
    click ModelSelect "https://github.com/KatherLab/MediSwarm/tree/main/application/jobs/3dcnn_ptl/app/custom/models"
    
    %% Style Applications
    class ClientCtl,ServerCtl,NVFlare core
    class Data1,Data2,Data3,DataAug data
    class VPN1,VPN2,VPN3 security
    class CNN,ModelSelect critical
    class Docker,Resources,ModelRepo infra
```
