# prakhar28singh-creator/skyguard-ai architecture

> Architecture diagram of the GitHub repository prakhar28singh-creator/skyguard-ai, 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/prakhar28singh-creator/skyguard-ai
- Repository: https://github.com/prakhar28singh-creator/skyguard-ai

## Overview

SkyGuard combines a Python weather-station anomaly detector with two dashboards. The documented engine workflow runs readings through a five-layer detector, then produces classifications, health estimates, corrected values, explanations, and alerts. The React dashboard is a separate, locally simulated operations console—not a client of the Python engine. Its routes and the IMD weather panel are shown where supported by excerpts; other Python internals and UI data wiring are summarized only at the level documented in the README. <=

Main entry points: [`anomaly_engine.py`](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py) (Explainable fusion), [`skyguard-app/src/App.tsx`](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/App.tsx) (React route hub), [`skyguard-app/src/components/imd/imd-weather-panel.tsx`](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/components/imd/imd-weather-panel.tsx) (IMD weather panel), [`skyguard-app/src/pages/StationDetail.tsx`](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/StationDetail.tsx) (Stations and details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Detection engine"]
  node_engine["Anomaly engine<br/>[anomaly_engine.py]"]
  node_l1["Physical checks<br/>[anomaly_engine.py]"]
  node_l2["Temporal learning<br/>[anomaly_engine.py]"]
  node_l3["Spatial checks<br/>[anomaly_engine.py]"]
  node_l4["Physics checks<br/>[anomaly_engine.py]"]
  node_l5["Explainable fusion<br/>[anomaly_engine.py]"]
end

subgraph group_outputs["Analysis outputs"]
  node_cause["Root-cause classification<br/>[anomaly_engine.py]"]
  node_health["Health prediction<br/>[anomaly_engine.py]"]
  node_corrected["Corrected-value estimation<br/>[anomaly_engine.py]"]
  node_shap["SHAP-style explanations<br/>[shap_explainer.py]"]
  node_alerts["Alert delivery<br/>[alerts.py]"]
end

subgraph group_console["Operations console"]
  node_router["React route hub<br/>[App.tsx]"]
  node_overview["Overview and analytics<br/>[Overview.tsx]"]
  node_network["Network and edge nodes<br/>[Network.tsx]"]
  node_stations["Stations and details<br/>[StationDetail.tsx]"]
  node_anomalies["Anomalies and details<br/>[Anomalies.tsx]"]
  node_ops["Operations workflows<br/>[Maintenance.tsx]"]
  node_mock["Simulated dashboard data<br/>[mock-data.ts]"]
end

subgraph group_weather["IMD weather"]
  node_stationlist["IMD station catalogue<br/>[imd-stations.ts]"]
  node_weatherpanel["IMD weather panel"]
  node_imdapi["IMD weather API client<br/>[imd-api.ts]"]
end

node_aws(("AWS stream"))
node_operator(("Operator"))
node_imd(("IMD weather service"))

node_aws -->|"supplies readings"| node_engine
node_engine -->|"runs layer one"| node_l1
node_l1 -->|"then evaluates"| node_l2
node_l2 -->|"then evaluates"| node_l3
node_l3 -->|"then evaluates"| node_l4
node_l4 -->|"then fuses"| node_l5
node_l5 -->|"classifies cause"| node_cause
node_l5 -->|"estimates health"| node_health
node_l5 -->|"estimates corrections"| node_corrected
node_l5 -->|"provides attribution"| node_shap
node_l5 -->|"raises alerts"| node_alerts
node_operator -.->|"uses dashboard"| node_router
node_router -->|"routes to"| node_overview
node_router -->|"routes to"| node_network
node_router -->|"routes to"| node_stations
node_router -->|"routes to"| node_anomalies
node_router -->|"routes to"| node_ops
node_stations -->|"generates readings"| node_mock
node_mock -->|"imports catalogue"| node_stationlist
node_weatherpanel -.->|"searches stations"| node_stationlist
node_weatherpanel -->|"fetches weather"| node_imdapi
node_imdapi -.->|"requests data"| node_imd

click node_engine "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_l1 "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_l2 "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_l3 "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_l4 "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_l5 "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_cause "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_health "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_corrected "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py"
click node_shap "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/shap_explainer.py"
click node_alerts "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/alerts.py"
click node_router "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/App.tsx"
click node_overview "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Overview.tsx"
click node_network "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Network.tsx"
click node_stations "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/StationDetail.tsx"
click node_anomalies "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Anomalies.tsx"
click node_ops "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Maintenance.tsx"
click node_mock "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/lib/mock-data.ts"
click node_stationlist "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/lib/imd-stations.ts"
click node_weatherpanel "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/components/imd/imd-weather-panel.tsx"
click node_imdapi "https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/lib/imd-api.ts"

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_engine,node_l1,node_l2,node_l3,node_l4,node_l5 toneBlue
class node_cause,node_health,node_corrected,node_shap,node_alerts toneAmber
class node_router,node_overview,node_network,node_stations,node_anomalies,node_ops,node_mock toneMint
class node_stationlist,node_weatherpanel,node_imdapi toneRose
class node_aws,node_operator,node_imd toneIndigo
```

## Components

### Detection engine

- [Anomaly engine](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Physical checks](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Temporal learning](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Spatial checks](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Physics checks](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Explainable fusion](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`

### Analysis outputs

- [Root-cause classification](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Health prediction](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [Corrected-value estimation](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/anomaly_engine.py): `anomaly_engine.py`
- [SHAP-style explanations](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/shap_explainer.py): `shap_explainer.py`
- [Alert delivery](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/alerts.py): `alerts.py`

### Operations console

- [React route hub](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/App.tsx): `skyguard-app/src/App.tsx`
- [Overview and analytics](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Overview.tsx): `skyguard-app/src/pages/Overview.tsx`
- [Network and edge nodes](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Network.tsx): `skyguard-app/src/pages/Network.tsx`
- [Stations and details](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/StationDetail.tsx): `skyguard-app/src/pages/StationDetail.tsx`
- [Anomalies and details](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Anomalies.tsx): `skyguard-app/src/pages/Anomalies.tsx`
- [Operations workflows](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/pages/Maintenance.tsx): `skyguard-app/src/pages/Maintenance.tsx`
- [Simulated dashboard data](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/lib/mock-data.ts): `skyguard-app/src/lib/mock-data.ts`

### IMD weather

- [IMD station catalogue](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/lib/imd-stations.ts): `skyguard-app/src/lib/imd-stations.ts`
- [IMD weather panel](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/components/imd/imd-weather-panel.tsx): `skyguard-app/src/components/imd/imd-weather-panel.tsx`
- [IMD weather API client](https://github.com/prakhar28singh-creator/skyguard-ai/blob/main/skyguard-app/src/lib/imd-api.ts): `skyguard-app/src/lib/imd-api.ts`

### Other components

- **AWS stream**
- **Operator**
- **IMD weather service**

## Connections

- AWS stream → Anomaly engine: supplies readings (evidence: `README.md`)
- Anomaly engine → Physical checks: runs layer one (evidence: `README.md`)
- Physical checks → Temporal learning: then evaluates (evidence: `README.md`)
- Temporal learning → Spatial checks: then evaluates (evidence: `README.md`)
- Spatial checks → Physics checks: then evaluates (evidence: `README.md`)
- Physics checks → Explainable fusion: then fuses (evidence: `README.md`)
- Explainable fusion → Root-cause classification: classifies cause (evidence: `README.md`)
- Explainable fusion → Health prediction: estimates health (evidence: `README.md`)
- Explainable fusion → Corrected-value estimation: estimates corrections (evidence: `README.md`)
- Explainable fusion → SHAP-style explanations: provides attribution (evidence: `README.md`)
- Explainable fusion → Alert delivery: raises alerts (evidence: `README.md`)
- Operator → React route hub: uses dashboard
- React route hub → Overview and analytics: routes to (evidence: `skyguard-app/src/App.tsx`)
- React route hub → Network and edge nodes: routes to (evidence: `skyguard-app/src/App.tsx`)
- React route hub → Stations and details: routes to (evidence: `skyguard-app/src/App.tsx`)
- React route hub → Anomalies and details: routes to (evidence: `skyguard-app/src/App.tsx`)
- React route hub → Operations workflows: routes to (evidence: `skyguard-app/src/App.tsx`)
- Stations and details → Simulated dashboard data: generates readings (evidence: `skyguard-app/src/pages/StationDetail.tsx`)
- Simulated dashboard data → IMD station catalogue: imports catalogue (evidence: `skyguard-app/src/lib/mock-data.ts`)
- IMD weather panel → IMD station catalogue: searches stations
- IMD weather panel → IMD weather API client: fetches weather (evidence: `skyguard-app/src/components/imd/imd-weather-panel.tsx`)
- IMD weather API client → IMD weather service: requests data
