# sthasis100/iiot-ids architecture

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

- Interactive diagram: https://gitdiagram.com/sthasis100/iiot-ids
- Repository: https://github.com/sthasis100/iiot-ids

## Overview

IIoT Cyber Shield is a machine-learning intrusion-detection system for IIoT traffic. Its main workflow loads and combines attack/benign CSVs, preprocesses and splits the data, trains and evaluates four detection models, then supports prediction and dashboard reporting. The graph preserves the documented dashboard analysis capabilities. Some dashboard and prediction wiring is documented in the README but not fully visible in the sampled source; those limits are reflected in the evidence citations.

Main entry points: [`dashboard/dashboard_app.py`](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py) (Streamlit dashboard), [`src/train_model.py`](https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py) (Model training), [`main.py`](https://github.com/sthasis100/iiot-ids/blob/master/main.py) (Pipeline orchestration), [`src/preprocessing.py`](https://github.com/sthasis100/iiot-ids/blob/master/src/preprocessing.py) (Feature preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Detection workflow"]
  node_orchestrator["Pipeline orchestration<br/>[main.py]"]
  node_loader["Dataset loading<br/>[data_loader.py]"]
  node_preprocess["Feature preprocessing<br/>[preprocessing.py]"]
end

subgraph group_models["Modeling and inference"]
  node_trainer["Model training<br/>[train_model.py]"]
  node_rf["Random Forest<br/>[train_model.py]"]
  node_dnn["Deep neural net<br/>[train_model.py]"]
  node_cnn["1-D CNN<br/>[train_model.py]"]
  node_autoencoder["LSTM autoencoder<br/>[train_model.py]"]
  node_artifacts[("Saved models and pipeline")]
  node_evaluation["Evaluation metrics"]
  node_predictor["Batch and live prediction<br/>[predict.py]"]
end

subgraph group_dashboard["Dashboard and analysis"]
  node_dashboard["Streamlit dashboard<br/>[dashboard_app.py]"]
  node_live["Live detection and alerts<br/>[dashboard_app.py]"]
  node_model_views["Model metrics and curves<br/>[dashboard_app.py]"]
  node_traffic_views["Traffic and feature analysis<br/>[dashboard_app.py]"]
  node_anomaly_views["Anomaly analysis<br/>[dashboard_app.py]"]
  node_performance_views["Performance and model drift<br/>[dashboard_app.py]"]
  node_intel_views["Dataset and model registry<br/>[dashboard_app.py]"]
end

node_operator(("Operator"))
node_dataset["IIoT CSVs"]

node_operator -->|"runs pipeline"| node_orchestrator
node_dataset -->|"provides traffic"| node_loader
node_orchestrator -->|"loads data"| node_loader
node_loader -->|"returns dataset"| node_preprocess
node_orchestrator -->|"preprocesses data"| node_preprocess
node_orchestrator -->|"starts training"| node_trainer
node_preprocess -->|"supplies splits"| node_trainer
node_trainer -->|"trains"| node_rf
node_trainer -->|"trains"| node_dnn
node_trainer -->|"trains"| node_cnn
node_trainer -->|"trains"| node_autoencoder
node_trainer -->|"saves models"| node_artifacts
node_preprocess -->|"saves pipeline"| node_artifacts
node_trainer -->|"writes metrics"| node_evaluation
node_operator -->|"requests predictions"| node_predictor
node_predictor -->|"loads model and pipeline"| node_artifacts
node_predictor -->|"provides inference"| node_dashboard
node_operator -->|"opens dashboard"| node_dashboard
node_dashboard -->|"renders"| node_live
node_dashboard -->|"renders"| node_model_views
node_dashboard -->|"renders"| node_traffic_views
node_dashboard -->|"renders"| node_anomaly_views
node_dashboard -->|"renders"| node_performance_views
node_dashboard -->|"renders"| node_intel_views
node_evaluation -.->|"informs reports"| node_dashboard

click node_orchestrator "https://github.com/sthasis100/iiot-ids/blob/master/main.py"
click node_loader "https://github.com/sthasis100/iiot-ids/blob/master/src/data_loader.py"
click node_preprocess "https://github.com/sthasis100/iiot-ids/blob/master/src/preprocessing.py"
click node_trainer "https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py"
click node_rf "https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py"
click node_dnn "https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py"
click node_cnn "https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py"
click node_autoencoder "https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py"
click node_artifacts "https://github.com/sthasis100/iiot-ids/tree/master/models"
click node_evaluation "https://github.com/sthasis100/iiot-ids/blob/master/models/test_evaluation.json"
click node_predictor "https://github.com/sthasis100/iiot-ids/blob/master/src/predict.py"
click node_dashboard "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py"
click node_live "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py"
click node_model_views "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py"
click node_traffic_views "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py"
click node_anomaly_views "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py"
click node_performance_views "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py"
click node_intel_views "https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.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_orchestrator,node_loader,node_preprocess toneBlue
class node_trainer,node_rf,node_dnn,node_cnn,node_autoencoder,node_artifacts,node_evaluation,node_predictor toneAmber
class node_dashboard,node_live,node_model_views,node_traffic_views,node_anomaly_views,node_performance_views,node_intel_views toneMint
class node_operator,node_dataset toneIndigo
```

## Components

### Detection workflow

- [Pipeline orchestration](https://github.com/sthasis100/iiot-ids/blob/master/main.py): `main.py`
- [Dataset loading](https://github.com/sthasis100/iiot-ids/blob/master/src/data_loader.py): `src/data_loader.py`
- [Feature preprocessing](https://github.com/sthasis100/iiot-ids/blob/master/src/preprocessing.py): `src/preprocessing.py`

### Modeling and inference

- [Model training](https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py): `src/train_model.py`
- [Random Forest](https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py): `src/train_model.py`
- [Deep neural net](https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py): `src/train_model.py`
- [1-D CNN](https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py): `src/train_model.py`
- [LSTM autoencoder](https://github.com/sthasis100/iiot-ids/blob/master/src/train_model.py): `src/train_model.py`
- [Saved models and pipeline](https://github.com/sthasis100/iiot-ids/tree/master/models): `models`
- [Evaluation metrics](https://github.com/sthasis100/iiot-ids/blob/master/models/test_evaluation.json): `models/test_evaluation.json`
- [Batch and live prediction](https://github.com/sthasis100/iiot-ids/blob/master/src/predict.py): `src/predict.py`

### Dashboard and analysis

- [Streamlit dashboard](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`
- [Live detection and alerts](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`
- [Model metrics and curves](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`
- [Traffic and feature analysis](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`
- [Anomaly analysis](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`
- [Performance and model drift](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`
- [Dataset and model registry](https://github.com/sthasis100/iiot-ids/blob/master/dashboard/dashboard_app.py): `dashboard/dashboard_app.py`

### Other components

- **Operator**
- **IIoT CSVs**

## Connections

- Operator → Pipeline orchestration: runs pipeline (evidence: `README.md`)
- IIoT CSVs → Dataset loading: provides traffic (evidence: `README.md`)
- Pipeline orchestration → Dataset loading: loads data (evidence: `main.py`)
- Dataset loading → Feature preprocessing: returns dataset (evidence: `README.md`)
- Pipeline orchestration → Feature preprocessing: preprocesses data (evidence: `main.py`)
- Pipeline orchestration → Model training: starts training (evidence: `main.py`)
- Feature preprocessing → Model training: supplies splits (evidence: `README.md`)
- Model training → Random Forest: trains (evidence: `src/train_model.py`)
- Model training → Deep neural net: trains (evidence: `src/train_model.py`)
- Model training → 1-D CNN: trains (evidence: `src/train_model.py`)
- Model training → LSTM autoencoder: trains (evidence: `src/train_model.py`)
- Model training → Saved models and pipeline: saves models (evidence: `src/train_model.py`)
- Feature preprocessing → Saved models and pipeline: saves pipeline (evidence: `README.md`)
- Model training → Evaluation metrics: writes metrics (evidence: `README.md`)
- Operator → Batch and live prediction: requests predictions (evidence: `src/predict.py`)
- Batch and live prediction → Saved models and pipeline: loads model and pipeline (evidence: `src/predict.py`)
- Batch and live prediction → Streamlit dashboard: provides inference (evidence: `README.md`)
- Operator → Streamlit dashboard: opens dashboard (evidence: `README.md`)
- Streamlit dashboard → Live detection and alerts: renders (evidence: `README.md`)
- Streamlit dashboard → Model metrics and curves: renders (evidence: `README.md`)
- Streamlit dashboard → Traffic and feature analysis: renders (evidence: `README.md`)
- Streamlit dashboard → Anomaly analysis: renders (evidence: `README.md`)
- Streamlit dashboard → Performance and model drift: renders (evidence: `README.md`)
- Streamlit dashboard → Dataset and model registry: renders (evidence: `README.md`)
- Evaluation metrics → Streamlit dashboard: informs reports (evidence: `README.md`)
