# kavin553/temperature_prediction_forecast_model architecture

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

- Interactive diagram: https://gitdiagram.com/kavin553/temperature_prediction_forecast_model
- Repository: https://github.com/kavin553/temperature_prediction_forecast_model

## Overview

This Flask application serves a temperature-safety dashboard and a prediction endpoint. The main workflow is user input → timestamp/feature preparation → model forecast → unit conversion and threshold alert → dashboard results. A separate training script combines two temperature datasets, engineers features, trains XGBoost, and saves artifacts consumed by the app. README-described dashboard visualizations and risk presentation are included, but demo.html was not sampled, so their implementation details and wiring remain unverified.

Main entry points: [`app.py`](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py) (Flask Routes), [`demo.html`](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html) (Dashboard UI), [`train_xgb.py`](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/train_xgb.py) (Training Workflow), [`xgb_model_combined.joblib`](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/xgb_model_combined.joblib) (XGBoost Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard"]
  node_dashboard["Dashboard UI<br/>[demo.html]"]
  node_routes["Flask Routes<br/>[app.py]"]
  node_visualizations["Trend Visuals<br/>[demo.html]"]
end

subgraph group_forecast["Forecasting"]
  node_feature_prep["Feature Preparation<br/>[app.py]"]
  node_model["XGBoost Model"]
  node_feature_list["Model Features"]
  node_forecast_output["Temperature Forecast<br/>[app.py]"]
end

subgraph group_training["Model Training"]
  node_training["Training Workflow<br/>[train_xgb.py]"]
  node_dataset_a["Hourly Dataset<br/>[MLTempDataset1.csv]"]
  node_dataset_b["Power Dataset<br/>[MLTempDataset.csv]"]
  node_trained_model["Trained Model"]
  node_trained_features["Feature Metadata"]
end

subgraph group_safety["Safety Results"]
  node_unit_conversion["Unit Conversion<br/>[app.py]"]
  node_threshold_alert["Threshold Alert<br/>[app.py]"]
  node_risk_display["Risk Display<br/>[demo.html]"]
end

node_user(("User"))

node_user -->|"enters readings"| node_dashboard
node_dashboard -.->|"requests forecast"| node_routes
node_routes -->|"builds features"| node_feature_prep
node_routes -->|"loads model"| node_model
node_routes -->|"loads features"| node_feature_list
node_routes -->|"uses feature list"| node_feature_prep
node_routes -->|"predicts temperature"| node_forecast_output
node_forecast_output -->|"converts units"| node_unit_conversion
node_unit_conversion -->|"checks threshold"| node_threshold_alert
node_routes -.->|"returns results"| node_dashboard
node_dashboard -->|"shows risk"| node_risk_display
node_dashboard -->|"renders trends"| node_visualizations
node_training -->|"reads data"| node_dataset_a
node_training -->|"reads data"| node_dataset_b
node_training -->|"saves model"| node_trained_model
node_training -->|"saves features"| node_trained_features

click node_dashboard "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html"
click node_routes "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py"
click node_feature_prep "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py"
click node_model "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/xgb_model_combined.joblib"
click node_feature_list "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/feature_info_combined.joblib"
click node_forecast_output "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py"
click node_unit_conversion "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py"
click node_threshold_alert "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py"
click node_risk_display "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html"
click node_visualizations "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html"
click node_training "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/train_xgb.py"
click node_dataset_a "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/MLTempDataset1.csv"
click node_dataset_b "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/MLTempDataset.csv"
click node_trained_model "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/xgb_model_combined.joblib"
click node_trained_features "https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/feature_info_combined.joblib"

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_dashboard,node_routes,node_visualizations,node_user toneBlue
class node_feature_prep,node_model,node_feature_list,node_forecast_output toneAmber
class node_training,node_dataset_a,node_dataset_b,node_trained_model,node_trained_features toneMint
class node_unit_conversion,node_threshold_alert,node_risk_display toneRose
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html): `demo.html`
- [Flask Routes](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py): `app.py`
- [Trend Visuals](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html): `demo.html`

### Forecasting

- [Feature Preparation](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py): `app.py`
- [XGBoost Model](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/xgb_model_combined.joblib): `xgb_model_combined.joblib`
- [Model Features](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/feature_info_combined.joblib): `feature_info_combined.joblib`
- [Temperature Forecast](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py): `app.py`

### Model Training

- [Training Workflow](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/train_xgb.py): `train_xgb.py`
- [Hourly Dataset](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/MLTempDataset1.csv): `MLTempDataset1.csv`
- [Power Dataset](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/MLTempDataset.csv): `MLTempDataset.csv`
- [Trained Model](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/xgb_model_combined.joblib): `xgb_model_combined.joblib`
- [Feature Metadata](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/feature_info_combined.joblib): `feature_info_combined.joblib`

### Safety Results

- [Unit Conversion](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py): `app.py`
- [Threshold Alert](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/app.py): `app.py`
- [Risk Display](https://github.com/kavin553/temperature_prediction_forecast_model/blob/main/demo.html): `demo.html`

### Other components

- **User**

## Connections

- User → Dashboard UI: enters readings (evidence: `README.md`)
- Dashboard UI → Flask Routes: requests forecast
- Flask Routes → Feature Preparation: builds features (evidence: `app.py`)
- Flask Routes → XGBoost Model: loads model (evidence: `app.py`)
- Flask Routes → Model Features: loads features (evidence: `app.py`)
- Flask Routes → Feature Preparation: uses feature list (evidence: `app.py`)
- Flask Routes → Temperature Forecast: predicts temperature (evidence: `app.py`)
- Temperature Forecast → Unit Conversion: converts units (evidence: `app.py`)
- Unit Conversion → Threshold Alert: checks threshold (evidence: `app.py`)
- Flask Routes → Dashboard UI: returns results
- Dashboard UI → Risk Display: shows risk (evidence: `README.md`)
- Dashboard UI → Trend Visuals: renders trends (evidence: `README.md`)
- Training Workflow → Hourly Dataset: reads data (evidence: `train_xgb.py`)
- Training Workflow → Power Dataset: reads data (evidence: `train_xgb.py`)
- Training Workflow → Trained Model: saves model (evidence: `train_xgb.py`)
- Training Workflow → Feature Metadata: saves features (evidence: `train_xgb.py`)
