# erickdesturi028/network-world-model architecture

> Architecture diagram of the GitHub repository erickdesturi028/network-world-model, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/erickdesturi028/network-world-model
- Repository: https://github.com/erickdesturi028/network-world-model

## Overview

This repository is a predictive network-threat monitor for financial infrastructure. Its core workflow turns packet or flow telemetry into state sequences, forecasts threat risk with an LSTM, and presents results to SOC users. It also supports offline historical analysis, model training and evaluation, and live alert/report features. The live dashboard excerpt is partial, so some live scoring-to-alert wiring is documented or implied rather than fully visible; those links are marked dashed where needed.

Main entry points: [`app.py`](https://github.com/erickdesturi028/network-world-model/blob/main/app.py) (Historical Dashboard), [`src/models/train.py`](https://github.com/erickdesturi028/network-world-model/blob/main/src/models/train.py) (Model Training), [`src/models/evaluate.py`](https://github.com/erickdesturi028/network-world-model/blob/main/src/models/evaluate.py) (Model Evaluation), [`app_live.py`](https://github.com/erickdesturi028/network-world-model/blob/main/app_live.py) (Live Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Telemetry Ingestion"]
  node_flow_parser["Flow Parser<br/>[flow_parser.py]"]
  node_state_builder["State Builder<br/>[state_builder.py]"]
  node_sequence_builder["Sequence Builder"]
  node_live_buffer["Live Packet Buffer<br/>[live_stream.py]"]
end

subgraph group_forecast["Forecasting Model"]
  node_lstm["LSTM World Model"]
  node_weights["Pretrained Weights"]
end

subgraph group_monitor["SOC Monitoring"]
  node_offline_dashboard["Historical Dashboard<br/>[app.py]"]
  node_live_dashboard["Live Dashboard<br/>[app_live.py]"]
  node_alerts_reports["Alerts and Reports<br/>[app_live.py]"]
end

subgraph group_lifecycle["Model Lifecycle"]
  node_training["Model Training<br/>[train.py]"]
  node_evaluation["Model Evaluation<br/>[evaluate.py]"]
end

node_soc(("SOC Analyst"))
node_network(("Live Network Traffic"))
node_csv["Historical Flow CSV"]

node_soc -->|"selects history"| node_offline_dashboard
node_csv -->|"provides flows"| node_flow_parser
node_offline_dashboard -->|"parses flows"| node_flow_parser
node_offline_dashboard -->|"builds states"| node_state_builder
node_offline_dashboard -->|"builds windows"| node_sequence_builder
node_offline_dashboard -->|"forecasts risk"| node_lstm
node_offline_dashboard -->|"shows risk and XAI"| node_soc
node_network -->|"supplies packets"| node_live_dashboard
node_live_dashboard -->|"processes packets"| node_live_buffer
node_live_dashboard -.->|"scores sequences"| node_lstm
node_live_dashboard -.->|"updates alerts"| node_alerts_reports
node_alerts_reports -->|"presents warnings"| node_soc
node_soc -->|"starts monitoring"| node_live_dashboard
node_training -->|"parses flows"| node_flow_parser
node_training -->|"builds states"| node_state_builder
node_training -->|"builds windows"| node_sequence_builder
node_training -->|"trains model"| node_lstm
node_training -->|"saves weights"| node_weights
node_evaluation -->|"parses flows"| node_flow_parser
node_evaluation -->|"builds states"| node_state_builder
node_evaluation -->|"builds windows"| node_sequence_builder
node_evaluation -->|"loads weights"| node_weights
node_evaluation -->|"evaluates model"| node_lstm

click node_flow_parser "https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/flow_parser.py"
click node_state_builder "https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/state_builder.py"
click node_sequence_builder "https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/sequence_builder.py"
click node_live_buffer "https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/live_stream.py"
click node_lstm "https://github.com/erickdesturi028/network-world-model/blob/main/src/models/lstm_world_model.py"
click node_weights "https://github.com/erickdesturi028/network-world-model/blob/main/models/lstm_world_model.pth"
click node_offline_dashboard "https://github.com/erickdesturi028/network-world-model/blob/main/app.py"
click node_live_dashboard "https://github.com/erickdesturi028/network-world-model/blob/main/app_live.py"
click node_alerts_reports "https://github.com/erickdesturi028/network-world-model/blob/main/app_live.py"
click node_training "https://github.com/erickdesturi028/network-world-model/blob/main/src/models/train.py"
click node_evaluation "https://github.com/erickdesturi028/network-world-model/blob/main/src/models/evaluate.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_flow_parser,node_state_builder,node_sequence_builder,node_live_buffer toneBlue
class node_lstm,node_weights toneAmber
class node_offline_dashboard,node_live_dashboard,node_alerts_reports toneMint
class node_training,node_evaluation toneRose
class node_soc,node_network,node_csv toneIndigo
```

## Components

### Telemetry Ingestion

- [Flow Parser](https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/flow_parser.py): `src/ingestion/flow_parser.py`
- [State Builder](https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/state_builder.py): `src/ingestion/state_builder.py`
- [Sequence Builder](https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/sequence_builder.py): `src/ingestion/sequence_builder.py`
- [Live Packet Buffer](https://github.com/erickdesturi028/network-world-model/blob/main/src/ingestion/live_stream.py): `src/ingestion/live_stream.py`

### Forecasting Model

- [LSTM World Model](https://github.com/erickdesturi028/network-world-model/blob/main/src/models/lstm_world_model.py): `src/models/lstm_world_model.py`
- [Pretrained Weights](https://github.com/erickdesturi028/network-world-model/blob/main/models/lstm_world_model.pth): `models/lstm_world_model.pth`

### SOC Monitoring

- [Historical Dashboard](https://github.com/erickdesturi028/network-world-model/blob/main/app.py): `app.py`
- [Live Dashboard](https://github.com/erickdesturi028/network-world-model/blob/main/app_live.py): `app_live.py`
- [Alerts and Reports](https://github.com/erickdesturi028/network-world-model/blob/main/app_live.py): `app_live.py`

### Model Lifecycle

- [Model Training](https://github.com/erickdesturi028/network-world-model/blob/main/src/models/train.py): `src/models/train.py`
- [Model Evaluation](https://github.com/erickdesturi028/network-world-model/blob/main/src/models/evaluate.py): `src/models/evaluate.py`

### Other components

- **SOC Analyst**
- **Live Network Traffic**
- **Historical Flow CSV**

## Connections

- SOC Analyst → Historical Dashboard: selects history (evidence: `README.md`)
- Historical Flow CSV → Flow Parser: provides flows (evidence: `README.md`)
- Historical Dashboard → Flow Parser: parses flows (evidence: `app.py`)
- Historical Dashboard → State Builder: builds states (evidence: `app.py`)
- Historical Dashboard → Sequence Builder: builds windows (evidence: `app.py`)
- Historical Dashboard → LSTM World Model: forecasts risk (evidence: `app.py`)
- Historical Dashboard → SOC Analyst: shows risk and XAI (evidence: `app.py`)
- Live Network Traffic → Live Dashboard: supplies packets (evidence: `README.md`)
- Live Dashboard → Live Packet Buffer: processes packets (evidence: `app_live.py`)
- Live Dashboard → LSTM World Model: scores sequences (evidence: `app_live.py`)
- Live Dashboard → Alerts and Reports: updates alerts (evidence: `app_live.py`)
- Alerts and Reports → SOC Analyst: presents warnings (evidence: `README.md`)
- SOC Analyst → Live Dashboard: starts monitoring (evidence: `README.md`)
- Model Training → Flow Parser: parses flows (evidence: `src/models/train.py`)
- Model Training → State Builder: builds states (evidence: `src/models/train.py`)
- Model Training → Sequence Builder: builds windows (evidence: `src/models/train.py`)
- Model Training → LSTM World Model: trains model (evidence: `src/models/train.py`)
- Model Training → Pretrained Weights: saves weights (evidence: `src/models/train.py`)
- Model Evaluation → Flow Parser: parses flows (evidence: `src/models/evaluate.py`)
- Model Evaluation → State Builder: builds states (evidence: `src/models/evaluate.py`)
- Model Evaluation → Sequence Builder: builds windows (evidence: `src/models/evaluate.py`)
- Model Evaluation → Pretrained Weights: loads weights (evidence: `src/models/evaluate.py`)
- Model Evaluation → LSTM World Model: evaluates model (evidence: `src/models/evaluate.py`)
