# satyasahu8317/heatgaurd architecture

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

- Interactive diagram: https://gitdiagram.com/satyasahu8317/heatgaurd
- Repository: https://github.com/satyasahu8317/heatgaurd

## Overview

HeatGuard presents heat-risk forecasts and safety guidance for Indian locations. Users choose a location or scan the map; the map can request a forecast, while the backend prediction endpoint fetches hourly weather, computes WBGT and daily heat indicators, applies prediction models, and returns a typed forecast for display. The graph preserves the major forecast, map, chart, and safety-view branches. Some frontend-to-backend wiring and unsampled component relationships are not shown in the excerpts, so uncertain links are omitted.

Main entry points: [`heatguard-frontend/src/routes/index.jsx`](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/routes/index.jsx) (Forecast dashboard), [`SIH-main/backend/prediction_services.py`](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/prediction_services.py) (Forecast assembly), [`SIH-main/backend/main.py`](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/main.py) (Prediction API), [`heatguard-frontend/src/main.jsx`](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/main.jsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Forecast experience"]
  node_app["React entry<br/>[main.jsx]"]
  node_dashboard["Forecast dashboard<br/>[index.jsx]"]
  node_map["State risk map<br/>[StateRiskMap.jsx]"]
  node_api_client["Forecast client<br/>[api.js]"]
  node_forecast_views["Forecast summaries<br/>[ForecastList.jsx]"]
  node_charts["Forecast charts<br/>[Charts.jsx]"]
  node_safety["Safety guidance<br/>[SafetySection.jsx]"]
end

subgraph group_backend["Forecast API"]
  node_backend_app["Prediction API<br/>[main.py]"]
  node_contracts["Response schemas<br/>[schemas.py]"]
end

subgraph group_weather["Weather input"]
  node_weather_fetch["Hourly weather fetch"]
end

subgraph group_prediction["Risk computation"]
  node_pipeline["Forecast assembly"]
  node_wbgt["Hourly WBGT<br/>[wbgt_services.py]"]
  node_daily_indicators["Daily indicators<br/>[wbgt_services.py]"]
  node_heatwave_rule["Heatwave rule<br/>[wbgt_services.py]"]
  node_ml_risk["ML risk predictions"]
end

node_user(("Location explorer"))
node_open_meteo["Open-Meteo"]

node_user -->|"opens"| node_app
node_app -->|"renders"| node_dashboard
node_dashboard -.->|"renders"| node_map
node_map -->|"requests forecasts"| node_api_client
node_dashboard -->|"renders"| node_forecast_views
node_dashboard -->|"renders"| node_charts
node_dashboard -.->|"renders"| node_safety
node_backend_app -->|"fetches weather"| node_weather_fetch
node_backend_app -->|"builds forecast"| node_pipeline
node_backend_app -->|"validates response"| node_contracts
node_weather_fetch -->|"requests hourly data"| node_open_meteo
node_pipeline -->|"calculates WBGT"| node_wbgt
node_pipeline -.->|"derives indicators"| node_daily_indicators
node_pipeline -.->|"applies rule"| node_heatwave_rule
node_pipeline -->|"runs predictions"| node_ml_risk

click node_app "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/main.jsx"
click node_dashboard "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/routes/index.jsx"
click node_map "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/StateRiskMap.jsx"
click node_api_client "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/lib/api.js"
click node_forecast_views "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/ForecastList.jsx"
click node_charts "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/Charts.jsx"
click node_safety "https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/SafetySection.jsx"
click node_backend_app "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/main.py"
click node_contracts "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/schemas.py"
click node_weather_fetch "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/weather_services.py"
click node_pipeline "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/prediction_services.py"
click node_wbgt "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/wbgt_services.py"
click node_daily_indicators "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/wbgt_services.py"
click node_heatwave_rule "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/wbgt_services.py"
click node_ml_risk "https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/prediction_services.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_app,node_dashboard,node_map,node_api_client,node_forecast_views,node_charts,node_safety toneBlue
class node_backend_app,node_contracts toneAmber
class node_weather_fetch toneMint
class node_pipeline,node_wbgt,node_daily_indicators,node_heatwave_rule,node_ml_risk toneRose
class node_user,node_open_meteo toneIndigo
```

## Components

### Forecast experience

- [React entry](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/main.jsx): `heatguard-frontend/src/main.jsx`
- [Forecast dashboard](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/routes/index.jsx): `heatguard-frontend/src/routes/index.jsx`
- [State risk map](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/StateRiskMap.jsx): `heatguard-frontend/src/components/heatguard/StateRiskMap.jsx`
- [Forecast client](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/lib/api.js): `heatguard-frontend/src/lib/api.js`
- [Forecast summaries](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/ForecastList.jsx): `heatguard-frontend/src/components/heatguard/ForecastList.jsx`
- [Forecast charts](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/Charts.jsx): `heatguard-frontend/src/components/heatguard/Charts.jsx`
- [Safety guidance](https://github.com/satyasahu8317/heatgaurd/blob/main/heatguard-frontend/src/components/heatguard/SafetySection.jsx): `heatguard-frontend/src/components/heatguard/SafetySection.jsx`

### Forecast API

- [Prediction API](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/main.py): `SIH-main/backend/main.py`
- [Response schemas](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/schemas.py): `SIH-main/backend/schemas.py`

### Weather input

- [Hourly weather fetch](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/weather_services.py): `SIH-main/backend/weather_services.py`

### Risk computation

- [Forecast assembly](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/prediction_services.py): `SIH-main/backend/prediction_services.py`
- [Hourly WBGT](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/wbgt_services.py): `SIH-main/backend/wbgt_services.py`
- [Daily indicators](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/wbgt_services.py): `SIH-main/backend/wbgt_services.py`
- [Heatwave rule](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/wbgt_services.py): `SIH-main/backend/wbgt_services.py`
- [ML risk predictions](https://github.com/satyasahu8317/heatgaurd/blob/main/SIH-main/backend/prediction_services.py): `SIH-main/backend/prediction_services.py`

### Other components

- **Location explorer**
- **Open-Meteo**

## Connections

- Location explorer → React entry: opens (evidence: `heatguard-frontend/src/main.jsx`)
- React entry → Forecast dashboard: renders (evidence: `heatguard-frontend/src/main.jsx`)
- Forecast dashboard → State risk map: renders
- State risk map → Forecast client: requests forecasts (evidence: `heatguard-frontend/src/components/heatguard/StateRiskMap.jsx`)
- Forecast dashboard → Forecast summaries: renders (evidence: `heatguard-frontend/src/routes/index.jsx`)
- Forecast dashboard → Forecast charts: renders (evidence: `heatguard-frontend/src/routes/index.jsx`)
- Forecast dashboard → Safety guidance: renders
- Prediction API → Hourly weather fetch: fetches weather (evidence: `SIH-main/backend/main.py`)
- Prediction API → Forecast assembly: builds forecast (evidence: `SIH-main/backend/main.py`)
- Prediction API → Response schemas: validates response (evidence: `SIH-main/backend/main.py`)
- Hourly weather fetch → Open-Meteo: requests hourly data (evidence: `SIH-main/backend/weather_services.py`)
- Forecast assembly → Hourly WBGT: calculates WBGT (evidence: `SIH-main/backend/prediction_services.py`)
- Forecast assembly → Daily indicators: derives indicators (evidence: `SIH-main/backend/prediction_services.py`)
- Forecast assembly → Heatwave rule: applies rule (evidence: `SIH-main/backend/prediction_services.py`)
- Forecast assembly → ML risk predictions: runs predictions (evidence: `SIH-main/backend/prediction_services.py`)
