# boopathi0910/weather-advisory-agent architecture

> Architecture diagram of the GitHub repository boopathi0910/weather-advisory-agent, 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/boopathi0910/weather-advisory-agent
- Repository: https://github.com/boopathi0910/weather-advisory-agent

## Overview

Weather Advisory Agent serves users searching city weather and receiving safety alerts and recommendations; users can also manage favorites and review dashboard data. Weather retrieval uses a recent cache, live provider data or mock data, then the request handler composes advisories and a response. Separate capabilities include authentication, forecasts, admin monitoring, and scheduled favorite-city alerting. The graph reflects README claims and the supplied source index/excerpts; unsampled implementation details are linked only where documented or indexed.

Main entry points: [`src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/WeatherController.java) (Weather search), [`src/main/java/com/weatheradvisor/agent/service/AutomationService.java`](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/AutomationService.java) (Scheduled refresh), [`src/main/java/com/weatheradvisor/agent/service/WeatherService.java`](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/WeatherService.java) (Weather retrieval), [`src/main/java/com/weatheradvisor/agent/controller/AuthController.java`](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/AuthController.java) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth["Authentication"]
  node_user_service["User service<br/>[UserService.java]"]
  node_jwt["JWT security<br/>[JwtUtil.java]"]
end

subgraph group_weather["Weather experience"]
  node_dashboard["Dashboard"]
  node_weather_request["Weather search"]
  node_weather_service["Weather retrieval"]
  node_weather_data[("Weather cache<br/>[Weather.java]")]
  node_forecast["Forecast"]
  node_forecast_route["Forecast endpoint"]
  node_history[("Search history")]
  node_frontend["Web interface<br/>[main.js]"]
end

subgraph group_advisory["Advisories and alerts"]
  node_advisory_service["Advisory service"]
  node_recommendations["Recommendation engine"]
  node_gemini["AI recommendations<br/>[GeminiService.java]"]
  node_farmer_advice["Farmer advice"]
end

subgraph group_automation["Automation"]
  node_favorites[("Favorites")]
  node_automation["Scheduled refresh"]
  node_scheduler["Weather scheduler"]
  node_notifications["Alert notifications"]
  node_email["Email delivery<br/>[EmailService.java]"]
end

subgraph group_operations["Admin and telemetry"]
  node_admin["Admin dashboard"]
  node_api_client["HTTP client<br/>[ApiClient.java]"]
  node_api_logs[("API logs")]
end

node_user(("User"))
node_weather_provider["Weather provider"]
node_ai_provider["Gemini API"]
node_database[("MySQL database")]

node_user -->|"signs in"| node_auth
node_auth -->|"authenticates"| node_user_service
node_auth -->|"issues token"| node_jwt
node_user -->|"opens"| node_dashboard
node_dashboard -->|"displays"| node_frontend
node_user -->|"searches city"| node_weather_request
node_weather_request -->|"gets weather"| node_weather_service
node_weather_service -->|"reads/writes cache"| node_weather_data
node_weather_service -->|"fetches data"| node_api_client
node_api_client -->|"requests weather"| node_weather_provider
node_weather_request -->|"records search"| node_history
node_user -->|"requests forecast"| node_forecast_route
node_forecast_route -->|"delegates"| node_forecast
node_weather_request -->|"requests advice"| node_advisory_service
node_advisory_service -->|"delegates"| node_recommendations
node_recommendations -->|"requests AI advice"| node_gemini
node_gemini -->|"sends prompt"| node_ai_provider
node_recommendations -->|"returns alerts"| node_weather_request
node_weather_request -->|"gets farm guidance"| node_farmer_advice
node_scheduler -.->|"triggers cycle"| node_automation
node_automation -->|"loads cities"| node_favorites
node_automation -->|"refreshes weather"| node_weather_service
node_automation -->|"triggers alerts"| node_notifications
node_notifications -->|"sends email"| node_email
node_admin -->|"manages users"| node_user_service
node_admin -->|"reads telemetry"| node_api_logs
node_api_client -->|"records calls"| node_api_logs
node_user_service -.->|"persists users"| node_database
node_weather_data -.->|"stored in"| node_database

click node_auth "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/AuthController.java"
click node_user_service "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/UserService.java"
click node_jwt "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/security/JwtUtil.java"
click node_dashboard "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/DashboardController.java"
click node_weather_request "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/WeatherController.java"
click node_weather_service "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/WeatherService.java"
click node_weather_data "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/model/Weather.java"
click node_forecast "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/ForecastService.java"
click node_forecast_route "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/ForecastController.java"
click node_history "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/repository/SearchHistoryRepository.java"
click node_favorites "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/repository/FavoriteRepository.java"
click node_advisory_service "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/AdvisoryService.java"
click node_recommendations "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/ai/RecommendationEngine.java"
click node_gemini "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/ai/GeminiService.java"
click node_farmer_advice "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/FarmerAdvisoryService.java"
click node_automation "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/AutomationService.java"
click node_scheduler "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/scheduler/WeatherScheduler.java"
click node_notifications "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/NotificationService.java"
click node_email "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/EmailService.java"
click node_admin "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/AdminController.java"
click node_api_client "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/util/ApiClient.java"
click node_api_logs "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/repository/ApiLogRepository.java"
click node_frontend "https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/resources/static/js/main.js"

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_auth,node_user_service,node_jwt,node_user toneBlue
class node_dashboard,node_weather_request,node_weather_service,node_weather_data,node_forecast,node_forecast_route,node_history,node_frontend,node_database toneAmber
class node_advisory_service,node_recommendations,node_gemini,node_farmer_advice,node_ai_provider toneMint
class node_favorites,node_automation,node_scheduler,node_notifications,node_email toneRose
class node_admin,node_api_client,node_api_logs,node_weather_provider toneIndigo
```

## Components

### Identity and access

- [Authentication](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/AuthController.java): `src/main/java/com/weatheradvisor/agent/controller/AuthController.java`
- [User service](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/UserService.java): `src/main/java/com/weatheradvisor/agent/service/UserService.java`
- [JWT security](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/security/JwtUtil.java): `src/main/java/com/weatheradvisor/agent/security/JwtUtil.java`

### Weather experience

- [Dashboard](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/DashboardController.java): `src/main/java/com/weatheradvisor/agent/controller/DashboardController.java`
- [Weather search](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/WeatherController.java): `src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`
- [Weather retrieval](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/WeatherService.java): `src/main/java/com/weatheradvisor/agent/service/WeatherService.java`
- [Weather cache](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/model/Weather.java): `src/main/java/com/weatheradvisor/agent/model/Weather.java`
- [Forecast](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/ForecastService.java): `src/main/java/com/weatheradvisor/agent/service/ForecastService.java`
- [Forecast endpoint](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/ForecastController.java): `src/main/java/com/weatheradvisor/agent/controller/ForecastController.java`
- [Search history](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/repository/SearchHistoryRepository.java): `src/main/java/com/weatheradvisor/agent/repository/SearchHistoryRepository.java`
- [Web interface](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/resources/static/js/main.js): `src/main/resources/static/js/main.js`

### Advisories and alerts

- [Advisory service](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/AdvisoryService.java): `src/main/java/com/weatheradvisor/agent/service/AdvisoryService.java`
- [Recommendation engine](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/ai/RecommendationEngine.java): `src/main/java/com/weatheradvisor/agent/ai/RecommendationEngine.java`
- [AI recommendations](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/ai/GeminiService.java): `src/main/java/com/weatheradvisor/agent/ai/GeminiService.java`
- [Farmer advice](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/FarmerAdvisoryService.java): `src/main/java/com/weatheradvisor/agent/service/FarmerAdvisoryService.java`

### Automation

- [Favorites](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/repository/FavoriteRepository.java): `src/main/java/com/weatheradvisor/agent/repository/FavoriteRepository.java`
- [Scheduled refresh](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/AutomationService.java): `src/main/java/com/weatheradvisor/agent/service/AutomationService.java`
- [Weather scheduler](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/scheduler/WeatherScheduler.java): `src/main/java/com/weatheradvisor/agent/scheduler/WeatherScheduler.java`
- [Alert notifications](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/NotificationService.java): `src/main/java/com/weatheradvisor/agent/service/NotificationService.java`
- [Email delivery](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/service/EmailService.java): `src/main/java/com/weatheradvisor/agent/service/EmailService.java`

### Admin and telemetry

- [Admin dashboard](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/controller/AdminController.java): `src/main/java/com/weatheradvisor/agent/controller/AdminController.java`
- [HTTP client](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/util/ApiClient.java): `src/main/java/com/weatheradvisor/agent/util/ApiClient.java`
- [API logs](https://github.com/boopathi0910/weather-advisory-agent/blob/main/src/main/java/com/weatheradvisor/agent/repository/ApiLogRepository.java): `src/main/java/com/weatheradvisor/agent/repository/ApiLogRepository.java`

### Other components

- **User**
- **Weather provider**
- **Gemini API**
- **MySQL database**

## Connections

- User → Authentication: signs in (evidence: `README.md`)
- Authentication → User service: authenticates (evidence: `src/main/java/com/weatheradvisor/agent/controller/AuthController.java`)
- Authentication → JWT security: issues token (evidence: `src/main/java/com/weatheradvisor/agent/controller/AuthController.java`)
- User → Dashboard: opens (evidence: `README.md`)
- Dashboard → Web interface: displays (evidence: `README.md`)
- User → Weather search: searches city (evidence: `README.md`)
- Weather search → Weather retrieval: gets weather (evidence: `src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`)
- Weather retrieval → Weather cache: reads/writes cache (evidence: `src/main/java/com/weatheradvisor/agent/service/WeatherService.java`)
- Weather retrieval → HTTP client: fetches data (evidence: `src/main/java/com/weatheradvisor/agent/service/WeatherService.java`)
- HTTP client → Weather provider: requests weather (evidence: `README.md`)
- Weather search → Search history: records search (evidence: `src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`)
- User → Forecast endpoint: requests forecast (evidence: `README.md`)
- Forecast endpoint → Forecast: delegates (evidence: `src/main/java/com/weatheradvisor/agent/controller/ForecastController.java`)
- Weather search → Advisory service: requests advice (evidence: `src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`)
- Advisory service → Recommendation engine: delegates (evidence: `src/main/java/com/weatheradvisor/agent/service/AdvisoryService.java`)
- Recommendation engine → AI recommendations: requests AI advice (evidence: `src/main/java/com/weatheradvisor/agent/ai/RecommendationEngine.java`)
- AI recommendations → Gemini API: sends prompt (evidence: `src/main/java/com/weatheradvisor/agent/ai/GeminiService.java`)
- Recommendation engine → Weather search: returns alerts (evidence: `src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`)
- Weather search → Farmer advice: gets farm guidance (evidence: `src/main/java/com/weatheradvisor/agent/controller/WeatherController.java`)
- Weather scheduler → Scheduled refresh: triggers cycle (evidence: `src/main/java/com/weatheradvisor/agent/scheduler/WeatherScheduler.java`)
- Scheduled refresh → Favorites: loads cities (evidence: `src/main/java/com/weatheradvisor/agent/service/AutomationService.java`)
- Scheduled refresh → Weather retrieval: refreshes weather (evidence: `src/main/java/com/weatheradvisor/agent/service/AutomationService.java`)
- Scheduled refresh → Alert notifications: triggers alerts (evidence: `src/main/java/com/weatheradvisor/agent/service/AutomationService.java`)
- Alert notifications → Email delivery: sends email (evidence: `src/main/java/com/weatheradvisor/agent/service/NotificationService.java`)
- Admin dashboard → User service: manages users (evidence: `src/main/java/com/weatheradvisor/agent/controller/AdminController.java`)
- Admin dashboard → API logs: reads telemetry (evidence: `src/main/java/com/weatheradvisor/agent/controller/AdminController.java`)
- HTTP client → API logs: records calls (evidence: `src/main/java/com/weatheradvisor/agent/util/ApiClient.java`)
- User service → MySQL database: persists users
- Weather cache → MySQL database: stored in
