How ahamedn2023-gif/ai_driven-wether_prediction works
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: weather-dashboard.tsx Weather dashboard · route.ts Prediction endpoint · weather.ts Weather data client · page.tsx App page
Components 19
Dashboard experience
- App page
app/page.tsx - Weather dashboard
components/weather-dashboard.tsx - Map loader
components/weather-map-loader.tsx - Weather map
components/weather-map.tsx - Pin list
components/pin-list.tsx - Current conditions
components/current-conditions.tsx - Hourly forecast
components/hourly-strip.tsx - Daily forecast
components/forecast-list.tsx
Weather data
- Preset locations
lib/locations.ts - Weather endpoint
app/api/weather/route.ts - Pin snapshots endpoint
app/api/snapshots/route.ts - Weather data client
lib/weather.ts
Prediction
- AI prediction panel
components/ai-prediction.tsx - Prediction endpoint
app/api/predict/route.ts - Prediction schema and estimate
lib/prediction.ts
External services
- Open-Meteo
- AI Gateway model
- OpenStreetMap tiles
Other components
- Visitor
Connections 20
- 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