# ahamedn2023-gif/ai_driven-wether_prediction architecture

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

- Interactive diagram: https://gitdiagram.com/ahamedn2023-gif/ai_driven-wether_prediction
- Repository: https://github.com/ahamedn2023-gif/ai_driven-wether_prediction

## Overview

Trivandrum AI Weather is a map-based local forecast dashboard. Users select a preset location or drop a pin; the dashboard loads current, hourly, daily, and pin-summary weather, then requests an AI prediction with a data-driven fallback. The graph preserves those distinct weather and prediction stages plus the map and pin-list views. Sampled source supports the API and data flows shown; several display components and the map loader are represented by their exact tree paths, but their internal behavior was not inspected.

Main entry points: [`components/weather-dashboard.tsx`](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-dashboard.tsx) (Weather dashboard), [`app/api/predict/route.ts`](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/predict/route.ts) (Prediction endpoint), [`lib/weather.ts`](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/weather.ts) (Weather data client), [`app/page.tsx`](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/page.tsx) (App page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_page["App page<br/>[page.tsx]"]
  node_dashboard["Weather dashboard"]
  node_maploader["Map loader"]
  node_map["Weather map<br/>[weather-map.tsx]"]
  node_pinlist["Pin list<br/>[pin-list.tsx]"]
  node_conditions["Current conditions"]
  node_hourly["Hourly forecast<br/>[hourly-strip.tsx]"]
  node_daily["Daily forecast<br/>[forecast-list.tsx]"]
end

subgraph group_weather["Weather data"]
  node_locations["Preset locations<br/>[locations.ts]"]
  node_weatherapi["Weather endpoint<br/>[route.ts]"]
  node_snapapi["Pin snapshots endpoint<br/>[route.ts]"]
  node_weatherlib["Weather data client<br/>[weather.ts]"]
end

subgraph group_prediction["Prediction"]
  node_aiwidget["AI prediction panel<br/>[ai-prediction.tsx]"]
  node_predictapi["Prediction endpoint<br/>[route.ts]"]
  node_predictionlib["Prediction schema and estimate<br/>[prediction.ts]"]
end

subgraph group_integrations["External services"]
  node_openmeteo["Open-Meteo"]
  node_aigateway["AI Gateway model"]
  node_tileprovider["OpenStreetMap tiles"]
end

node_user(("Visitor"))

node_user -->|"opens"| node_page
node_page -->|"renders"| node_dashboard
node_dashboard -->|"initializes pins"| node_locations
node_dashboard -->|"renders map"| node_maploader
node_maploader -->|"loads"| node_map
node_dashboard -->|"renders pins"| node_pinlist
node_dashboard -->|"passes report"| node_conditions
node_dashboard -->|"passes hourly data"| node_hourly
node_dashboard -->|"passes daily data"| node_daily
node_dashboard -->|"fetches selected forecast"| node_weatherapi
node_dashboard -->|"fetches pin snapshots"| node_snapapi
node_map -->|"loads tiles"| node_tileprovider
node_weatherapi -->|"fetches report"| node_weatherlib
node_snapapi -->|"fetches snapshots"| node_weatherlib
node_weatherlib -->|"requests forecast data"| node_openmeteo
node_dashboard -->|"renders selected pin"| node_aiwidget
node_aiwidget -->|"requests prediction"| node_predictapi
node_predictapi -->|"fetches report"| node_weatherlib
node_predictapi -->|"generates prediction"| node_aigateway
node_predictapi -->|"uses schema and fallback"| node_predictionlib

click node_page "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/page.tsx"
click node_dashboard "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-dashboard.tsx"
click node_maploader "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-map-loader.tsx"
click node_map "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-map.tsx"
click node_pinlist "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/pin-list.tsx"
click node_conditions "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/current-conditions.tsx"
click node_hourly "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/hourly-strip.tsx"
click node_daily "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/forecast-list.tsx"
click node_locations "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/locations.ts"
click node_weatherapi "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/weather/route.ts"
click node_snapapi "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/snapshots/route.ts"
click node_weatherlib "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/weather.ts"
click node_aiwidget "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/ai-prediction.tsx"
click node_predictapi "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/predict/route.ts"
click node_predictionlib "https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/prediction.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_page,node_dashboard,node_maploader,node_map,node_pinlist,node_conditions,node_hourly,node_daily toneBlue
class node_locations,node_weatherapi,node_snapapi,node_weatherlib toneAmber
class node_aiwidget,node_predictapi,node_predictionlib toneMint
class node_openmeteo,node_aigateway,node_tileprovider toneRose
class node_user toneIndigo
```

## Components

### Dashboard experience

- [App page](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/page.tsx): `app/page.tsx`
- [Weather dashboard](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-dashboard.tsx): `components/weather-dashboard.tsx`
- [Map loader](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-map-loader.tsx): `components/weather-map-loader.tsx`
- [Weather map](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/weather-map.tsx): `components/weather-map.tsx`
- [Pin list](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/pin-list.tsx): `components/pin-list.tsx`
- [Current conditions](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/current-conditions.tsx): `components/current-conditions.tsx`
- [Hourly forecast](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/hourly-strip.tsx): `components/hourly-strip.tsx`
- [Daily forecast](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/forecast-list.tsx): `components/forecast-list.tsx`

### Weather data

- [Preset locations](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/locations.ts): `lib/locations.ts`
- [Weather endpoint](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/weather/route.ts): `app/api/weather/route.ts`
- [Pin snapshots endpoint](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/snapshots/route.ts): `app/api/snapshots/route.ts`
- [Weather data client](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/weather.ts): `lib/weather.ts`

### Prediction

- [AI prediction panel](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/components/ai-prediction.tsx): `components/ai-prediction.tsx`
- [Prediction endpoint](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/app/api/predict/route.ts): `app/api/predict/route.ts`
- [Prediction schema and estimate](https://github.com/ahamedn2023-gif/ai_driven-wether_prediction/blob/main/lib/prediction.ts): `lib/prediction.ts`

### External services

- **Open-Meteo**
- **AI Gateway model**
- **OpenStreetMap tiles**

### Other components

- **Visitor**

## Connections

- Visitor → App page: opens
- App page → Weather dashboard: renders
- Weather dashboard → Preset locations: initializes pins
- Weather dashboard → Map loader: renders map
- Map loader → Weather map: loads
- Weather dashboard → Pin list: renders pins
- Weather dashboard → Current conditions: passes report
- Weather dashboard → Hourly forecast: passes hourly data
- Weather dashboard → Daily forecast: passes daily data
- Weather dashboard → Weather endpoint: fetches selected forecast
- Weather dashboard → Pin snapshots endpoint: fetches pin snapshots
- Weather map → OpenStreetMap tiles: loads tiles
- Weather endpoint → Weather data client: fetches report
- Pin snapshots endpoint → Weather data client: fetches snapshots
- Weather data client → Open-Meteo: requests forecast data
- Weather dashboard → AI prediction panel: renders selected pin
- AI prediction panel → Prediction endpoint: requests prediction
- Prediction endpoint → Weather data client: fetches report
- Prediction endpoint → AI Gateway model: generates prediction
- Prediction endpoint → Prediction schema and estimate: uses schema and fallback
