# jdpoorani33/predictive-new architecture

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

- Interactive diagram: https://gitdiagram.com/jdpoorani33/predictive-new
- Repository: https://github.com/jdpoorani33/predictive-new

## Overview

This repository is an industrial SCADA digital-twin and predictive-maintenance platform. Its primary workflow simulates or receives multi-PLC sensor telemetry, serves live status and history through a FastAPI backend, derives health/anomaly and remaining-useful-life estimates, and presents operational, analytics, maintenance, and evaluation views in a React frontend. Separate time-, frequency-, and TSFresh feature pipelines support model integration and benchmarking. The graph reflects README-documented capabilities and shown imports/calls; unsampled backend routes and model internals are represented conservatively.

Main entry points: [`main.py`](https://github.com/jdpoorani33/predictive-new/blob/main/main.py) (FastAPI Service), [`frontend/src/App.jsx`](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/App.jsx) (Web App Shell), [`simulator/simulator.py`](https://github.com/jdpoorani33/predictive-new/blob/main/simulator/simulator.py) (PLC Simulator), [`frontend/src/services/api.js`](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/services/api.js) (API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_telemetry["Telemetry Simulation"]
  node_simulator["PLC Simulator<br/>[simulator.py]"]
  node_dataset["Dataset Generator"]
end

subgraph group_backend["Backend and Inference"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_preprocess["Preprocessing<br/>[preprocessing.py]"]
  node_predict["RUL Prediction<br/>[predict.py]"]
  node_maintenance["Maintenance Policy"]
  node_validation["Model Validation<br/>[validation.py]"]
end

subgraph group_features["Feature Engineering"]
  node_timefeat["Time Features<br/>[time_features.py]"]
  node_freqfeat["FFT Features"]
  node_tsfeat["TSFresh Features"]
  node_mlpipeline["ML Integration<br/>[ml_pipeline.py]"]
end

subgraph group_frontend["SCADA Frontend"]
  node_app["Web App Shell<br/>[App.jsx]"]
  node_client["API Client<br/>[api.js]"]
  node_dashboard["Live Dashboard<br/>[Dashboard.jsx]"]
  node_livechart["Telemetry Charts<br/>[LiveChart.jsx]"]
  node_analytics["Analytics View<br/>[Analytics.jsx]"]
  node_maintenanceview["Maintenance View<br/>[Maintenance.jsx]"]
  node_evaluation["Model Evaluation"]
  node_plcvalidation["PLC ID Validation<br/>[plcValidation.js]"]
  node_alerts["Critical Alerts"]
end

node_operator(("Operator"))
node_mqtt(("MQTT Broker"))

node_operator -->|"uses dashboard"| node_app
node_simulator -->|"publishes telemetry"| node_mqtt
node_dataset -->|"uses simulation"| node_simulator
node_mqtt -.->|"supplies telemetry"| node_api
node_api -->|"initializes simulation"| node_simulator
node_api -->|"uses inference"| node_predict
node_api -->|"uses maintenance policy"| node_maintenance
node_api -->|"uses preprocessing"| node_preprocess
node_api -->|"uses validation"| node_validation
node_timefeat -->|"feeds feature fusion"| node_mlpipeline
node_freqfeat -->|"feeds feature fusion"| node_mlpipeline
node_tsfeat -->|"feeds feature fusion"| node_mlpipeline
node_operator -->|"runs digital twin"| node_simulator
node_app -->|"requests API data"| node_client
node_client -->|"calls HTTP endpoints"| node_api
node_app -->|"renders dashboard"| node_dashboard
node_app -->|"renders analytics"| node_analytics
node_app -->|"renders maintenance"| node_maintenanceview
node_dashboard -->|"renders trends"| node_livechart
node_dashboard -->|"validates PLC IDs"| node_plcvalidation
node_app -->|"renders alerts"| node_alerts
node_evaluation -->|"requests metrics"| node_client
node_livechart -->|"requests predictions"| node_client
node_operator -->|"reviews benchmarks"| node_evaluation

click node_simulator "https://github.com/jdpoorani33/predictive-new/blob/main/simulator/simulator.py"
click node_dataset "https://github.com/jdpoorani33/predictive-new/blob/main/datasets/dataset_generator.py"
click node_api "https://github.com/jdpoorani33/predictive-new/blob/main/main.py"
click node_preprocess "https://github.com/jdpoorani33/predictive-new/blob/main/preprocessing/preprocessing.py"
click node_predict "https://github.com/jdpoorani33/predictive-new/blob/main/model/predict.py"
click node_maintenance "https://github.com/jdpoorani33/predictive-new/blob/main/model/maintenance_engine.py"
click node_validation "https://github.com/jdpoorani33/predictive-new/blob/main/model/validation.py"
click node_timefeat "https://github.com/jdpoorani33/predictive-new/blob/main/time_features.py"
click node_freqfeat "https://github.com/jdpoorani33/predictive-new/blob/main/frequency_features.py"
click node_tsfeat "https://github.com/jdpoorani33/predictive-new/blob/main/tsfresh_features.py"
click node_mlpipeline "https://github.com/jdpoorani33/predictive-new/blob/main/ml_pipeline.py"
click node_app "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/App.jsx"
click node_client "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/services/api.js"
click node_dashboard "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/pages/Dashboard.jsx"
click node_livechart "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/components/LiveChart.jsx"
click node_analytics "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/pages/Analytics.jsx"
click node_maintenanceview "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/pages/Maintenance.jsx"
click node_evaluation "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/components/ModelEvaluation.jsx"
click node_plcvalidation "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/utils/plcValidation.js"
click node_alerts "https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/components/CriticalAlertModal.jsx"

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_simulator,node_dataset toneBlue
class node_api,node_preprocess,node_predict,node_maintenance,node_validation toneAmber
class node_timefeat,node_freqfeat,node_tsfeat,node_mlpipeline toneMint
class node_app,node_client,node_dashboard,node_livechart,node_analytics,node_maintenanceview,node_evaluation,node_plcvalidation,node_alerts toneRose
class node_operator,node_mqtt toneIndigo
```

## Components

### Telemetry Simulation

- [PLC Simulator](https://github.com/jdpoorani33/predictive-new/blob/main/simulator/simulator.py): `simulator/simulator.py`
- [Dataset Generator](https://github.com/jdpoorani33/predictive-new/blob/main/datasets/dataset_generator.py): `datasets/dataset_generator.py`

### Backend and Inference

- [FastAPI Service](https://github.com/jdpoorani33/predictive-new/blob/main/main.py): `main.py`
- [Preprocessing](https://github.com/jdpoorani33/predictive-new/blob/main/preprocessing/preprocessing.py): `preprocessing/preprocessing.py`
- [RUL Prediction](https://github.com/jdpoorani33/predictive-new/blob/main/model/predict.py): `model/predict.py`
- [Maintenance Policy](https://github.com/jdpoorani33/predictive-new/blob/main/model/maintenance_engine.py): `model/maintenance_engine.py`
- [Model Validation](https://github.com/jdpoorani33/predictive-new/blob/main/model/validation.py): `model/validation.py`

### Feature Engineering

- [Time Features](https://github.com/jdpoorani33/predictive-new/blob/main/time_features.py): `time_features.py`
- [FFT Features](https://github.com/jdpoorani33/predictive-new/blob/main/frequency_features.py): `frequency_features.py`
- [TSFresh Features](https://github.com/jdpoorani33/predictive-new/blob/main/tsfresh_features.py): `tsfresh_features.py`
- [ML Integration](https://github.com/jdpoorani33/predictive-new/blob/main/ml_pipeline.py): `ml_pipeline.py`

### SCADA Frontend

- [Web App Shell](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API Client](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Live Dashboard](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Telemetry Charts](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/components/LiveChart.jsx): `frontend/src/components/LiveChart.jsx`
- [Analytics View](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/pages/Analytics.jsx): `frontend/src/pages/Analytics.jsx`
- [Maintenance View](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/pages/Maintenance.jsx): `frontend/src/pages/Maintenance.jsx`
- [Model Evaluation](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/components/ModelEvaluation.jsx): `frontend/src/components/ModelEvaluation.jsx`
- [PLC ID Validation](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/utils/plcValidation.js): `frontend/src/utils/plcValidation.js`
- [Critical Alerts](https://github.com/jdpoorani33/predictive-new/blob/main/frontend/src/components/CriticalAlertModal.jsx): `frontend/src/components/CriticalAlertModal.jsx`

### Other components

- **Operator**
- **MQTT Broker**

## Connections

- Operator → Web App Shell: uses dashboard (evidence: `README.md`)
- PLC Simulator → MQTT Broker: publishes telemetry (evidence: `simulator/simulator.py`)
- Dataset Generator → PLC Simulator: uses simulation (evidence: `datasets/dataset_generator.py`)
- MQTT Broker → FastAPI Service: supplies telemetry
- FastAPI Service → PLC Simulator: initializes simulation (evidence: `main.py`)
- FastAPI Service → RUL Prediction: uses inference (evidence: `main.py`)
- FastAPI Service → Maintenance Policy: uses maintenance policy (evidence: `main.py`)
- FastAPI Service → Preprocessing: uses preprocessing (evidence: `main.py`)
- FastAPI Service → Model Validation: uses validation (evidence: `main.py`)
- Time Features → ML Integration: feeds feature fusion (evidence: `README.md`)
- FFT Features → ML Integration: feeds feature fusion (evidence: `README.md`)
- TSFresh Features → ML Integration: feeds feature fusion (evidence: `README.md`)
- Operator → PLC Simulator: runs digital twin (evidence: `README.md`)
- Web App Shell → API Client: requests API data (evidence: `frontend/src/App.jsx`)
- API Client → FastAPI Service: calls HTTP endpoints (evidence: `frontend/src/services/api.js`)
- Web App Shell → Live Dashboard: renders dashboard (evidence: `frontend/src/App.jsx`)
- Web App Shell → Analytics View: renders analytics (evidence: `frontend/src/App.jsx`)
- Web App Shell → Maintenance View: renders maintenance (evidence: `frontend/src/App.jsx`)
- Live Dashboard → Telemetry Charts: renders trends (evidence: `frontend/src/pages/Dashboard.jsx`)
- Live Dashboard → PLC ID Validation: validates PLC IDs (evidence: `frontend/src/pages/Dashboard.jsx`)
- Web App Shell → Critical Alerts: renders alerts (evidence: `frontend/src/App.jsx`)
- Model Evaluation → API Client: requests metrics (evidence: `frontend/src/components/ModelEvaluation.jsx`)
- Telemetry Charts → API Client: requests predictions (evidence: `frontend/src/components/LiveChart.jsx`)
- Operator → Model Evaluation: reviews benchmarks (evidence: `README.md`)
