# yakshith45/smart-ai-crop-advisory architecture

> Architecture diagram of the GitHub repository yakshith45/smart-ai-crop-advisory, 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/yakshith45/smart-ai-crop-advisory
- Repository: https://github.com/yakshith45/smart-ai-crop-advisory

## Overview

Smart AI-Based Crop Advisory is a Flask platform for farmer operations and agricultural decisions. Farmers register and maintain farm/soil profiles, then request crop, disease, fertilizer, irrigation, or weather guidance; they can also manage activities and review dashboard alerts. Administrators govern accounts and agricultural catalogs. The graph reflects documented blueprint registration and route-to-service dependencies; several model and service connections are supported by the source index rather than complete excerpts, so uncertain runtime links are omitted. Training scripts are not shown as runtime components.

Main entry points: [`app/routes/advisory.py`](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/advisory.py) (Advisory workflows), [`app/__init__.py`](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/__init__.py) (Flask app), [`app/services/weather_service.py`](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/weather_service.py) (Weather intelligence), [`app/routes/auth.py`](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/auth.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web application"]
  node_flask["Flask app<br/>[__init__.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_authforms["Auth forms<br/>[auth_forms.py]"]
end

subgraph group_farm["Farm operations"]
  node_farms["Farm profiles<br/>[farm.py]"]
  node_farmforms["Farm forms<br/>[farm_forms.py]"]
  node_activities["Activity planner<br/>[activity.py]"]
  node_dashboard["Dashboard and alerts<br/>[dashboard.py]"]
  node_adminroutes["Administration<br/>[admin.py]"]
  node_notifications["Notification service"]
end

subgraph group_advisory["Agronomic advice"]
  node_advisoryroutes["Advisory workflows<br/>[advisory.py]"]
  node_advisoryforms["Advisory forms<br/>[advisory_forms.py]"]
  node_cropservice["Crop recommendation<br/>[crop_service.py]"]
  node_disease["Disease diagnosis<br/>[disease_service.py]"]
  node_filehandler["Image handling<br/>[file_handler.py]"]
  node_fertilizer["Fertilizer guidance"]
  node_irrigation["Irrigation guidance"]
  node_weather["Weather intelligence<br/>[weather_service.py]"]
end

subgraph group_data["Persistence and identity"]
  node_models["Domain records<br/>[advisory.py]"]
  node_userfarmmodels["User and farm records<br/>[farm.py]"]
  node_store[("Relational database")]
end

node_farmer(("Farmer"))
node_admin(("Administrator"))
node_weatherapi{{"OpenWeatherMap"}}

node_farmer -->|"uses"| node_flask
node_admin -->|"uses"| node_flask
node_flask -->|"registers"| node_auth
node_flask -->|"registers"| node_farms
node_flask -->|"registers"| node_activities
node_flask -->|"registers"| node_dashboard
node_flask -->|"registers"| node_advisoryroutes
node_flask -->|"registers"| node_adminroutes
node_auth -->|"validates with"| node_authforms
node_farms -->|"validates with"| node_farmforms
node_advisoryroutes -->|"validates with"| node_advisoryforms
node_advisoryroutes -->|"requests prediction"| node_cropservice
node_advisoryroutes -->|"requests diagnosis"| node_disease
node_advisoryroutes -->|"stores image"| node_filehandler
node_advisoryroutes -->|"calculates nutrients"| node_fertilizer
node_advisoryroutes -->|"calculates water"| node_irrigation
node_advisoryroutes -->|"requests conditions"| node_weather
node_farms -->|"requests conditions"| node_weather
node_dashboard -->|"requests conditions"| node_weather
node_weather -->|"fetches forecasts"| node_weatherapi
node_dashboard -->|"loads alerts"| node_notifications
node_auth -->|"creates notifications"| node_models
node_activities -->|"reads farm"| node_userfarmmodels
node_adminroutes -->|"governs records"| node_userfarmmodels
node_advisoryroutes -->|"records advice"| node_models
node_cropservice -.->|"uses crop catalog"| node_store
node_flask -.->|"initializes ORM"| node_store
node_models -.->|"persists records"| node_store
node_userfarmmodels -.->|"persists profiles"| node_store

click node_flask "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/__init__.py"
click node_auth "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/auth.py"
click node_authforms "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/forms/auth_forms.py"
click node_farms "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/farm.py"
click node_farmforms "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/forms/farm_forms.py"
click node_activities "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/activity.py"
click node_dashboard "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/dashboard.py"
click node_adminroutes "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/admin.py"
click node_advisoryroutes "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/advisory.py"
click node_advisoryforms "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/forms/advisory_forms.py"
click node_cropservice "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/crop_service.py"
click node_disease "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/disease_service.py"
click node_filehandler "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/utils/file_handler.py"
click node_fertilizer "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/fertilizer_service.py"
click node_irrigation "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/irrigation_service.py"
click node_weather "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/weather_service.py"
click node_notifications "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/notification_service.py"
click node_models "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/models/advisory.py"
click node_userfarmmodels "https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/models/farm.py"

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_flask,node_auth,node_authforms toneBlue
class node_farms,node_farmforms,node_activities,node_dashboard,node_adminroutes,node_notifications toneAmber
class node_advisoryroutes,node_advisoryforms,node_cropservice,node_disease,node_filehandler,node_fertilizer,node_irrigation,node_weather toneMint
class node_models,node_userfarmmodels,node_store toneRose
class node_farmer,node_admin,node_weatherapi toneIndigo
```

## Components

### Web application

- [Flask app](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/__init__.py): `app/__init__.py`
- [Authentication](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/auth.py): `app/routes/auth.py`
- [Auth forms](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/forms/auth_forms.py): `app/forms/auth_forms.py`

### Farm operations

- [Farm profiles](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/farm.py): `app/routes/farm.py`
- [Farm forms](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/forms/farm_forms.py): `app/forms/farm_forms.py`
- [Activity planner](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/activity.py): `app/routes/activity.py`
- [Dashboard and alerts](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/dashboard.py): `app/routes/dashboard.py`
- [Administration](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/admin.py): `app/routes/admin.py`
- [Notification service](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/notification_service.py): `app/services/notification_service.py`

### Agronomic advice

- [Advisory workflows](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/routes/advisory.py): `app/routes/advisory.py`
- [Advisory forms](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/forms/advisory_forms.py): `app/forms/advisory_forms.py`
- [Crop recommendation](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/crop_service.py): `app/services/crop_service.py`
- [Disease diagnosis](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/disease_service.py): `app/services/disease_service.py`
- [Image handling](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/utils/file_handler.py): `app/utils/file_handler.py`
- [Fertilizer guidance](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/fertilizer_service.py): `app/services/fertilizer_service.py`
- [Irrigation guidance](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/irrigation_service.py): `app/services/irrigation_service.py`
- [Weather intelligence](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/services/weather_service.py): `app/services/weather_service.py`

### Persistence and identity

- [Domain records](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/models/advisory.py): `app/models/advisory.py`
- [User and farm records](https://github.com/yakshith45/smart-ai-crop-advisory/blob/main/app/models/farm.py): `app/models/farm.py`
- **Relational database**

### Other components

- **Farmer**
- **Administrator**
- **OpenWeatherMap**

## Connections

- Farmer → Flask app: uses (evidence: `README.md`)
- Administrator → Flask app: uses (evidence: `README.md`)
- Flask app → Authentication: registers (evidence: `app/__init__.py`)
- Flask app → Farm profiles: registers (evidence: `app/__init__.py`)
- Flask app → Activity planner: registers (evidence: `app/__init__.py`)
- Flask app → Dashboard and alerts: registers (evidence: `app/__init__.py`)
- Flask app → Advisory workflows: registers (evidence: `app/__init__.py`)
- Flask app → Administration: registers (evidence: `app/__init__.py`)
- Authentication → Auth forms: validates with (evidence: `app/routes/auth.py`)
- Farm profiles → Farm forms: validates with (evidence: `app/routes/farm.py`)
- Advisory workflows → Advisory forms: validates with (evidence: `app/routes/advisory.py`)
- Advisory workflows → Crop recommendation: requests prediction (evidence: `app/routes/advisory.py`)
- Advisory workflows → Disease diagnosis: requests diagnosis (evidence: `app/routes/advisory.py`)
- Advisory workflows → Image handling: stores image (evidence: `app/routes/advisory.py`)
- Advisory workflows → Fertilizer guidance: calculates nutrients (evidence: `app/routes/advisory.py`)
- Advisory workflows → Irrigation guidance: calculates water (evidence: `app/routes/advisory.py`)
- Advisory workflows → Weather intelligence: requests conditions (evidence: `app/routes/advisory.py`)
- Farm profiles → Weather intelligence: requests conditions (evidence: `app/routes/farm.py`)
- Dashboard and alerts → Weather intelligence: requests conditions (evidence: `app/routes/dashboard.py`)
- Weather intelligence → OpenWeatherMap: fetches forecasts (evidence: `app/services/weather_service.py`)
- Dashboard and alerts → Notification service: loads alerts (evidence: `app/routes/dashboard.py`)
- Authentication → Domain records: creates notifications (evidence: `app/routes/auth.py`)
- Activity planner → User and farm records: reads farm (evidence: `app/routes/activity.py`)
- Administration → User and farm records: governs records (evidence: `app/routes/admin.py`)
- Advisory workflows → Domain records: records advice (evidence: `app/routes/advisory.py`)
- Crop recommendation → Relational database: uses crop catalog (evidence: `app/services/crop_service.py`)
- Flask app → Relational database: initializes ORM (evidence: `README.md`)
- Domain records → Relational database: persists records (evidence: `README.md`)
- User and farm records → Relational database: persists profiles (evidence: `README.md`)
