# sandeepklr12345-gif/ai_scada architecture

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

- Interactive diagram: https://gitdiagram.com/sandeepklr12345-gif/ai_scada
- Repository: https://github.com/sandeepklr12345-gif/ai_scada

## Overview

This repository combines two analytics products—600 MW power-output forecasting and HAI 23.05 ICS anomaly detection—with Python integration code and a React thermal-plant dashboard. The documented data-to-result workflow runs from cleaned data through feature preparation and inference; available API routes expose forecast, anomaly, and decision results. The dashboard polls API health/model metadata and presents a plant visualization and panels. The README describes several workflows at a high level; unsampled implementations and unshown runtime connections are represented only where documented, or omitted.

Main entry points: [`scripts/api/main.py`](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/api/main.py) (HTTP API), [`scripts/dataset_creation`](https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/dataset_creation) (Feature preparation), [`scripts/cleaning`](https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/cleaning) (Data cleaning), [`scripts/inference/forecasting_600mw.py`](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inference/forecasting_600mw.py) (600 MW forecasting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analytics["Analytics pipelines"]
  node_cleaning["Data cleaning"]
  node_feature_prep["Feature preparation"]
  node_forecasting["600 MW forecasting"]
  node_hai_temporal["HAI temporal features"]
  node_candidate_c["Candidate C detection"]
  node_hai_classifier["HAI attack classification"]
end

subgraph group_runtime["Inference and integration"]
  node_api["HTTP API<br/>[main.py]"]
  node_integration["SCADA AI integration"]
  node_ai_runtime["AI runtime<br/>[ai_runtime.py]"]
  node_decision["Decision support<br/>[decision_engine.py]"]
end

subgraph group_interface["Operator interface"]
  node_dashboard_api["Dashboard API client<br/>[api.ts]"]
  node_dashboard_panels["Dashboard panels<br/>[Panels.tsx]"]
  node_plant_view["Thermal plant view"]
  node_plant_components["Plant visualization components"]
end

subgraph group_storage["Data access"]
  node_postgres_storage["PostgreSQL storage"]
end

node_historical_data["Historical plant and HAI data"]
node_postgres[("PostgreSQL")]
node_dashboard_user(("Dashboard user"))

node_historical_data -->|"provides data"| node_cleaning
node_cleaning -->|"prepares datasets"| node_feature_prep
node_feature_prep -->|"supplies features"| node_forecasting
node_feature_prep -->|"supplies features"| node_hai_temporal
node_hai_temporal -->|"builds detector features"| node_candidate_c
node_forecasting -->|"serves forecasts"| node_api
node_candidate_c -->|"serves anomaly results"| node_api
node_hai_classifier -->|"serves classification"| node_api
node_api -->|"evaluates decisions"| node_decision
node_integration -->|"used by runtime"| node_ai_runtime
node_ai_runtime -->|"runtime delegates"| node_integration
node_dashboard_user -->|"views"| node_dashboard_panels
node_dashboard_user -->|"explores plant"| node_plant_view
node_dashboard_panels -->|"displays snapshot"| node_dashboard_api
node_dashboard_api -->|"requests health and models"| node_api
node_plant_view -->|"renders equipment"| node_plant_components
node_postgres_storage -->|"reads and writes"| node_postgres

click node_cleaning "https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/cleaning"
click node_feature_prep "https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/dataset_creation"
click node_forecasting "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inference/forecasting_600mw.py"
click node_hai_temporal "https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/inspection/hai_23_05/22_temporal_representation"
click node_candidate_c "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inspection/hai_23_05/25_inference/candidate_C_inference_engine.py"
click node_hai_classifier "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inference/hai_attack_classifier_runtime.py"
click node_api "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/api/main.py"
click node_integration "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/integration/ai_model_integration.py"
click node_ai_runtime "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/integration/ai_runtime.py"
click node_decision "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/decision_support/decision_engine.py"
click node_postgres_storage "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/database/postgres_storage.py"
click node_dashboard_api "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/frontend/src/components/dashboard/api.ts"
click node_dashboard_panels "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/frontend/src/components/dashboard/Panels.tsx"
click node_plant_view "https://github.com/sandeepklr12345-gif/ai_scada/blob/main/frontend/src/components/plant/ThermalPowerPlant.tsx"
click node_plant_components "https://github.com/sandeepklr12345-gif/ai_scada/tree/main/frontend/src/components/plant"

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_cleaning,node_feature_prep,node_forecasting,node_hai_temporal,node_candidate_c,node_hai_classifier,node_dashboard_user toneBlue
class node_api,node_integration,node_ai_runtime,node_decision,node_postgres toneAmber
class node_dashboard_api,node_dashboard_panels,node_plant_view,node_plant_components toneMint
class node_postgres_storage toneRose
class node_historical_data toneIndigo
```

## Components

### Analytics pipelines

- [Data cleaning](https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/cleaning): `scripts/cleaning`
- [Feature preparation](https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/dataset_creation): `scripts/dataset_creation`
- [600 MW forecasting](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inference/forecasting_600mw.py): `scripts/inference/forecasting_600mw.py`
- [HAI temporal features](https://github.com/sandeepklr12345-gif/ai_scada/tree/main/scripts/inspection/hai_23_05/22_temporal_representation): `scripts/inspection/hai_23_05/22_temporal_representation`
- [Candidate C detection](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inspection/hai_23_05/25_inference/candidate_C_inference_engine.py): `scripts/inspection/hai_23_05/25_inference/candidate_C_inference_engine.py`
- [HAI attack classification](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/inference/hai_attack_classifier_runtime.py): `scripts/inference/hai_attack_classifier_runtime.py`

### Inference and integration

- [HTTP API](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/api/main.py): `scripts/api/main.py`
- [SCADA AI integration](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/integration/ai_model_integration.py): `scripts/integration/ai_model_integration.py`
- [AI runtime](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/integration/ai_runtime.py): `scripts/integration/ai_runtime.py`
- [Decision support](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/decision_support/decision_engine.py): `scripts/decision_support/decision_engine.py`

### Operator interface

- [Dashboard API client](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/frontend/src/components/dashboard/api.ts): `frontend/src/components/dashboard/api.ts`
- [Dashboard panels](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/frontend/src/components/dashboard/Panels.tsx): `frontend/src/components/dashboard/Panels.tsx`
- [Thermal plant view](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/frontend/src/components/plant/ThermalPowerPlant.tsx): `frontend/src/components/plant/ThermalPowerPlant.tsx`
- [Plant visualization components](https://github.com/sandeepklr12345-gif/ai_scada/tree/main/frontend/src/components/plant): `frontend/src/components/plant`

### Data access

- [PostgreSQL storage](https://github.com/sandeepklr12345-gif/ai_scada/blob/main/scripts/database/postgres_storage.py): `scripts/database/postgres_storage.py`

### Other components

- **Historical plant and HAI data**
- **PostgreSQL**
- **Dashboard user**

## Connections

- Historical plant and HAI data → Data cleaning: provides data (evidence: `README.md`)
- Data cleaning → Feature preparation: prepares datasets (evidence: `README.md`)
- Feature preparation → 600 MW forecasting: supplies features (evidence: `README.md`)
- Feature preparation → HAI temporal features: supplies features (evidence: `README.md`)
- HAI temporal features → Candidate C detection: builds detector features (evidence: `README.md`)
- 600 MW forecasting → HTTP API: serves forecasts (evidence: `scripts/api/main.py`)
- Candidate C detection → HTTP API: serves anomaly results (evidence: `scripts/api/main.py`)
- HAI attack classification → HTTP API: serves classification (evidence: `scripts/api/main.py`)
- HTTP API → Decision support: evaluates decisions (evidence: `scripts/api/main.py`)
- SCADA AI integration → AI runtime: used by runtime (evidence: `scripts/integration/ai_runtime.py`)
- AI runtime → SCADA AI integration: runtime delegates (evidence: `scripts/integration/ai_runtime.py`)
- Dashboard user → Dashboard panels: views
- Dashboard user → Thermal plant view: explores plant
- Dashboard panels → Dashboard API client: displays snapshot (evidence: `frontend/src/components/dashboard/Panels.tsx`)
- Dashboard API client → HTTP API: requests health and models (evidence: `frontend/src/components/dashboard/api.ts`)
- Thermal plant view → Plant visualization components: renders equipment (evidence: `frontend/src/components/plant/ThermalPowerPlant.tsx`)
- PostgreSQL storage → PostgreSQL: reads and writes (evidence: `scripts/database/postgres_storage.py`)
