# jav1689/outrisk-utp architecture

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

- Interactive diagram: https://gitdiagram.com/jav1689/outrisk-utp
- Repository: https://github.com/jav1689/outrisk-utp

## Overview

OutRisk UTP is a weather-aware outdoor activity planning dashboard for UTP and Seri Iskandar. A user selects a location, activity and forecast hour; the dashboard requests current conditions and a seven-day risk outlook, then presents an activity assessment, precautions and safer alternative times. The API obtains and preprocesses weather and air-quality data before applying shared risk rules and optional model scores. README capabilities include historical weather, sample-weather exploration and synthetic-data model training. Some route and UI internals were not excerpted, so uncertain links are omitted.

Main entry points: [`client/src/components/Dashboard.jsx`](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/Dashboard.jsx) (Planning dashboard), [`server/data/fetch_weather.py`](https://github.com/jav1689/outrisk-utp/blob/main/server/data/fetch_weather.py) (Weather service), [`server/main.py`](https://github.com/jav1689/outrisk-utp/blob/main/server/main.py) (FastAPI application), [`server/routes/predict.py`](https://github.com/jav1689/outrisk-utp/blob/main/server/routes/predict.py) (Prediction endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Planning dashboard"]
  node_app["React app shell<br/>[App.jsx]"]
  node_dashboard_view["Planning dashboard<br/>[Dashboard.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_weather_labels["Weather and time labels<br/>[weather.js]"]
  node_conditions_view["Current conditions"]
  node_activity_form["Activity selector<br/>[ActivityForm.jsx]"]
  node_forecast_view["Forecast chart<br/>[ForecastChart.jsx]"]
  node_risk_view["Risk result<br/>[RiskResult.jsx]"]
  node_recommendation_view["Recommendations view"]
  node_visual_effects["Dashboard effects"]
  node_cursor["Custom cursor<br/>[CustomCursor.jsx]"]
end

subgraph group_api["API services"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_weather_routes["Weather endpoints<br/>[weather.py]"]
  node_prediction_routes["Prediction endpoints<br/>[predict.py]"]
  node_recommend_routes["Activity advice endpoint<br/>[recommend.py]"]
end

subgraph group_weather["Weather data"]
  node_weather_service["Weather service<br/>[fetch_weather.py]"]
  node_sample_data["Sample conditions<br/>[sample.py]"]
  node_preprocessing["Weather preprocessing<br/>[preprocess.py]"]
end

subgraph group_risk["Risk assessment"]
  node_risk_rules["Risk thresholds<br/>[rules.py]"]
  node_inference["Risk inference<br/>[predict.py]"]
end

subgraph group_model_training["Model training"]
  node_trainer["Synthetic model training<br/>[train.py]"]
  node_model_artifact["Random Forest artifact<br/>[risk_model.pkl]"]
end

node_user(("Outdoor planner"))
node_open_meteo["Open-Meteo"]
node_cams["CAMS air-quality data"]

node_user -->|"plans activity"| node_dashboard_view
node_app -->|"renders"| node_dashboard_view
node_app -->|"renders"| node_visual_effects
node_app -->|"renders"| node_cursor
node_dashboard_view -->|"requests data"| node_api_client
node_dashboard_view -->|"renders"| node_conditions_view
node_dashboard_view -->|"renders"| node_activity_form
node_dashboard_view -->|"renders"| node_forecast_view
node_dashboard_view -->|"renders"| node_risk_view
node_dashboard_view -->|"renders"| node_recommendation_view
node_dashboard_view -->|"formats dates"| node_weather_labels
node_api_client -->|"HTTP requests"| node_api_app
node_api_app -->|"registers routes"| node_weather_routes
node_api_app -->|"registers routes"| node_prediction_routes
node_api_app -->|"registers routes"| node_recommend_routes
node_api_app -->|"initializes service"| node_weather_service
node_api_app -->|"loads model"| node_inference
node_weather_routes -->|"fetches conditions"| node_weather_service
node_prediction_routes -->|"fetches forecast"| node_weather_service
node_prediction_routes -->|"scores forecast"| node_inference
node_prediction_routes -->|"validates location"| node_weather_routes
node_recommend_routes -->|"assesses activity"| node_prediction_routes
node_weather_service -->|"cleans readings"| node_preprocessing
node_weather_service -->|"requests weather"| node_open_meteo
node_weather_service -->|"gets air quality"| node_cams
node_weather_service -->|"serves sample source"| node_sample_data
node_inference -->|"applies thresholds"| node_risk_rules
node_inference -->|"prepares features"| node_preprocessing
node_trainer -->|"labels examples"| node_risk_rules
node_trainer -->|"prepares features"| node_preprocessing
node_trainer -->|"writes model"| node_model_artifact
node_inference -->|"loads model"| node_model_artifact

click node_app "https://github.com/jav1689/outrisk-utp/blob/main/client/src/App.jsx"
click node_dashboard_view "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/Dashboard.jsx"
click node_api_client "https://github.com/jav1689/outrisk-utp/blob/main/client/src/api/client.js"
click node_weather_labels "https://github.com/jav1689/outrisk-utp/blob/main/client/src/weather.js"
click node_conditions_view "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/CurrentConditions.jsx"
click node_activity_form "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/ActivityForm.jsx"
click node_forecast_view "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/ForecastChart.jsx"
click node_risk_view "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/RiskResult.jsx"
click node_recommendation_view "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/Recommendations.jsx"
click node_visual_effects "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/ThreeBackground.jsx"
click node_cursor "https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/CustomCursor.jsx"
click node_api_app "https://github.com/jav1689/outrisk-utp/blob/main/server/main.py"
click node_weather_routes "https://github.com/jav1689/outrisk-utp/blob/main/server/routes/weather.py"
click node_prediction_routes "https://github.com/jav1689/outrisk-utp/blob/main/server/routes/predict.py"
click node_recommend_routes "https://github.com/jav1689/outrisk-utp/blob/main/server/routes/recommend.py"
click node_weather_service "https://github.com/jav1689/outrisk-utp/blob/main/server/data/fetch_weather.py"
click node_sample_data "https://github.com/jav1689/outrisk-utp/blob/main/server/data/sample.py"
click node_preprocessing "https://github.com/jav1689/outrisk-utp/blob/main/server/data/preprocess.py"
click node_risk_rules "https://github.com/jav1689/outrisk-utp/blob/main/server/model/rules.py"
click node_inference "https://github.com/jav1689/outrisk-utp/blob/main/server/model/predict.py"
click node_trainer "https://github.com/jav1689/outrisk-utp/blob/main/server/model/train.py"
click node_model_artifact "https://github.com/jav1689/outrisk-utp/blob/main/server/model/risk_model.pkl"

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_view,node_api_client,node_weather_labels,node_conditions_view,node_activity_form,node_forecast_view,node_risk_view,node_recommendation_view,node_visual_effects,node_cursor toneBlue
class node_api_app,node_weather_routes,node_prediction_routes,node_recommend_routes toneAmber
class node_weather_service,node_sample_data,node_preprocessing toneMint
class node_risk_rules,node_inference toneRose
class node_trainer,node_model_artifact,node_user,node_open_meteo,node_cams toneIndigo
```

## Components

### Planning dashboard

- [React app shell](https://github.com/jav1689/outrisk-utp/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Planning dashboard](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/Dashboard.jsx): `client/src/components/Dashboard.jsx`
- [API client](https://github.com/jav1689/outrisk-utp/blob/main/client/src/api/client.js): `client/src/api/client.js`
- [Weather and time labels](https://github.com/jav1689/outrisk-utp/blob/main/client/src/weather.js): `client/src/weather.js`
- [Current conditions](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/CurrentConditions.jsx): `client/src/components/CurrentConditions.jsx`
- [Activity selector](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/ActivityForm.jsx): `client/src/components/ActivityForm.jsx`
- [Forecast chart](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/ForecastChart.jsx): `client/src/components/ForecastChart.jsx`
- [Risk result](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/RiskResult.jsx): `client/src/components/RiskResult.jsx`
- [Recommendations view](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/Recommendations.jsx): `client/src/components/Recommendations.jsx`
- [Dashboard effects](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/ThreeBackground.jsx): `client/src/components/ThreeBackground.jsx`
- [Custom cursor](https://github.com/jav1689/outrisk-utp/blob/main/client/src/components/CustomCursor.jsx): `client/src/components/CustomCursor.jsx`

### API services

- [FastAPI application](https://github.com/jav1689/outrisk-utp/blob/main/server/main.py): `server/main.py`
- [Weather endpoints](https://github.com/jav1689/outrisk-utp/blob/main/server/routes/weather.py): `server/routes/weather.py`
- [Prediction endpoints](https://github.com/jav1689/outrisk-utp/blob/main/server/routes/predict.py): `server/routes/predict.py`
- [Activity advice endpoint](https://github.com/jav1689/outrisk-utp/blob/main/server/routes/recommend.py): `server/routes/recommend.py`

### Weather data

- [Weather service](https://github.com/jav1689/outrisk-utp/blob/main/server/data/fetch_weather.py): `server/data/fetch_weather.py`
- [Sample conditions](https://github.com/jav1689/outrisk-utp/blob/main/server/data/sample.py): `server/data/sample.py`
- [Weather preprocessing](https://github.com/jav1689/outrisk-utp/blob/main/server/data/preprocess.py): `server/data/preprocess.py`

### Risk assessment

- [Risk thresholds](https://github.com/jav1689/outrisk-utp/blob/main/server/model/rules.py): `server/model/rules.py`
- [Risk inference](https://github.com/jav1689/outrisk-utp/blob/main/server/model/predict.py): `server/model/predict.py`

### Model training

- [Synthetic model training](https://github.com/jav1689/outrisk-utp/blob/main/server/model/train.py): `server/model/train.py`
- [Random Forest artifact](https://github.com/jav1689/outrisk-utp/blob/main/server/model/risk_model.pkl): `server/model/risk_model.pkl`

### Other components

- **Outdoor planner**
- **Open-Meteo**
- **CAMS air-quality data**

## Connections

- Outdoor planner → Planning dashboard: plans activity (evidence: `README.md`)
- React app shell → Planning dashboard: renders (evidence: `client/src/App.jsx`)
- React app shell → Dashboard effects: renders (evidence: `client/src/App.jsx`)
- React app shell → Custom cursor: renders (evidence: `client/src/App.jsx`)
- Planning dashboard → API client: requests data (evidence: `client/src/components/Dashboard.jsx`)
- Planning dashboard → Current conditions: renders (evidence: `client/src/components/Dashboard.jsx`)
- Planning dashboard → Activity selector: renders (evidence: `client/src/components/Dashboard.jsx`)
- Planning dashboard → Forecast chart: renders (evidence: `client/src/components/Dashboard.jsx`)
- Planning dashboard → Risk result: renders (evidence: `client/src/components/Dashboard.jsx`)
- Planning dashboard → Recommendations view: renders (evidence: `client/src/components/Dashboard.jsx`)
- Planning dashboard → Weather and time labels: formats dates (evidence: `client/src/components/Dashboard.jsx`)
- API client → FastAPI application: HTTP requests (evidence: `README.md`)
- FastAPI application → Weather endpoints: registers routes (evidence: `server/main.py`)
- FastAPI application → Prediction endpoints: registers routes (evidence: `server/main.py`)
- FastAPI application → Activity advice endpoint: registers routes (evidence: `server/main.py`)
- FastAPI application → Weather service: initializes service (evidence: `server/main.py`)
- FastAPI application → Risk inference: loads model (evidence: `server/main.py`)
- Weather endpoints → Weather service: fetches conditions (evidence: `server/routes/weather.py`)
- Prediction endpoints → Weather service: fetches forecast (evidence: `server/routes/predict.py`)
- Prediction endpoints → Risk inference: scores forecast (evidence: `server/routes/predict.py`)
- Prediction endpoints → Weather endpoints: validates location (evidence: `server/routes/predict.py`)
- Activity advice endpoint → Prediction endpoints: assesses activity (evidence: `server/routes/recommend.py`)
- Weather service → Weather preprocessing: cleans readings (evidence: `server/data/fetch_weather.py`)
- Weather service → Open-Meteo: requests weather (evidence: `README.md`)
- Weather service → CAMS air-quality data: gets air quality (evidence: `README.md`)
- Weather service → Sample conditions: serves sample source (evidence: `server/data/fetch_weather.py`)
- Risk inference → Risk thresholds: applies thresholds (evidence: `server/model/predict.py`)
- Risk inference → Weather preprocessing: prepares features (evidence: `server/model/predict.py`)
- Synthetic model training → Risk thresholds: labels examples (evidence: `server/model/train.py`)
- Synthetic model training → Weather preprocessing: prepares features (evidence: `server/model/train.py`)
- Synthetic model training → Random Forest artifact: writes model (evidence: `server/model/train.py`)
- Risk inference → Random Forest artifact: loads model (evidence: `server/model/predict.py`)
