# wwwsshivadas053-source/crop_yield_vision architecture

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

- Interactive diagram: https://gitdiagram.com/wwwsshivadas053-source/crop_yield_vision
- Repository: https://github.com/wwwsshivadas053-source/crop_yield_vision

## Overview

This is a Flask crop-yield prediction and farming-advice application. Farmers register or sign in, submit crop and environmental inputs, receive a model-based yield estimate, and can access recommendations and history; administrators review users, predictions, feedback, and dashboard analytics. The sampled source shows database writes, model invocation, and mail sending, while several route details and the Gemini integration are documented but not present in the excerpts, so those links are shown only where documentation supports them.

Main entry points: [`app.py`](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py) (Flask routes), [`database.db`](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/database.db) (Application database), [`templates/index.html`](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/index.html) (Site pages), [`templates/dashboard.html`](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/dashboard.html) (User dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask routes<br/>[app.py]"]
  node_site_pages["Site pages<br/>[index.html]"]
  node_dashboard_page["User dashboard<br/>[dashboard.html]"]
  node_feedback_page["Feedback<br/>[feedback.html]"]
end

subgraph group_accounts["Accounts and support"]
  node_auth["Registration and login<br/>[app.py]"]
  node_recovery["OTP password recovery<br/>[app.py]"]
end

subgraph group_agriculture["Prediction and advice"]
  node_prediction_form["Prediction form<br/>[prediction.html]"]
  node_yield_model["Yield regression model<br/>[model.pkl]"]
  node_encoders["Feature encoders<br/>[crop_encoder.pkl]"]
  node_recommendation["Farming recommendations"]
  node_history["Prediction history<br/>[app.py]"]
end

subgraph group_operations["Administration and data"]
  node_admin_login["Admin login<br/>[admin_login.html]"]
  node_admin_dashboard["Admin analytics"]
  node_admin_users["User management view<br/>[admin_users.html]"]
  node_admin_predictions["Prediction monitoring"]
  node_admin_feedback["Feedback management"]
  node_sqlite[("Application database<br/>[database.db]")]
end

node_farmer(("Farmer"))
node_admin_actor(("Administrator"))
node_mail["Email delivery"]
node_gemini["Gemini AI"]

node_farmer -->|"submits requests"| node_flask
node_admin_actor -->|"submits requests"| node_flask
node_flask -->|"renders pages"| node_site_pages
node_flask -->|"handles account routes"| node_auth
node_auth -->|"reads and writes"| node_sqlite
node_flask -->|"handles recovery routes"| node_recovery
node_recovery -->|"looks up and updates"| node_sqlite
node_recovery -->|"sends OTP"| node_mail
node_mail -->|"delivers reset email"| node_farmer
node_flask -->|"renders form"| node_prediction_form
node_farmer -->|"submits inputs"| node_flask
node_flask -->|"uses encodings"| node_encoders
node_flask -->|"predicts yield"| node_yield_model
node_flask -->|"stores prediction"| node_sqlite
node_flask -->|"renders advice page"| node_recommendation
node_flask -.->|"requests recommendations"| node_gemini
node_flask -->|"serves history"| node_history
node_history -->|"reads predictions"| node_sqlite
node_flask -->|"renders dashboard"| node_dashboard_page
node_flask -->|"renders and handles feedback"| node_feedback_page
node_flask -->|"stores feedback"| node_sqlite
node_flask -->|"renders admin login"| node_admin_login
node_flask -->|"renders analytics"| node_admin_dashboard
node_flask -->|"renders user list"| node_admin_users
node_flask -->|"renders predictions"| node_admin_predictions
node_flask -->|"renders feedback"| node_admin_feedback
node_flask -->|"queries admin data"| node_sqlite

click node_flask "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py"
click node_site_pages "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/index.html"
click node_dashboard_page "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/dashboard.html"
click node_auth "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py"
click node_recovery "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py"
click node_prediction_form "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/prediction.html"
click node_yield_model "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/model.pkl"
click node_encoders "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/crop_encoder.pkl"
click node_recommendation "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/recommendation.html"
click node_history "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py"
click node_feedback_page "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/feedback.html"
click node_admin_login "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_login.html"
click node_admin_dashboard "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_dashboard.html"
click node_admin_users "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_users.html"
click node_admin_predictions "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_predictions.html"
click node_admin_feedback "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_feedback.html"
click node_sqlite "https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/database.db"

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_site_pages,node_dashboard_page,node_feedback_page toneBlue
class node_auth,node_recovery toneAmber
class node_prediction_form,node_yield_model,node_encoders,node_recommendation,node_history toneMint
class node_admin_login,node_admin_dashboard,node_admin_users,node_admin_predictions,node_admin_feedback,node_sqlite toneRose
class node_farmer,node_admin_actor,node_mail,node_gemini toneIndigo
```

## Components

### Web application

- [Flask routes](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py): `app.py`
- [Site pages](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/index.html): `templates/index.html`
- [User dashboard](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Feedback](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/feedback.html): `templates/feedback.html`

### Accounts and support

- [Registration and login](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py): `app.py`
- [OTP password recovery](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py): `app.py`

### Prediction and advice

- [Prediction form](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/prediction.html): `templates/prediction.html`
- [Yield regression model](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/model.pkl): `model.pkl`
- [Feature encoders](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/crop_encoder.pkl): `crop_encoder.pkl`
- [Farming recommendations](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/recommendation.html): `templates/recommendation.html`
- [Prediction history](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/app.py): `app.py`

### Administration and data

- [Admin login](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_login.html): `templates/admin_login.html`
- [Admin analytics](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_dashboard.html): `templates/admin_dashboard.html`
- [User management view](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_users.html): `templates/admin_users.html`
- [Prediction monitoring](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_predictions.html): `templates/admin_predictions.html`
- [Feedback management](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/templates/admin_feedback.html): `templates/admin_feedback.html`
- [Application database](https://github.com/wwwsshivadas053-source/crop_yield_vision/blob/main/database.db): `database.db`

### Other components

- **Farmer**
- **Administrator**
- **Email delivery**
- **Gemini AI**

## Connections

- Farmer → Flask routes: submits requests
- Administrator → Flask routes: submits requests
- Flask routes → Site pages: renders pages
- Flask routes → Registration and login: handles account routes
- Registration and login → Application database: reads and writes
- Flask routes → OTP password recovery: handles recovery routes
- OTP password recovery → Application database: looks up and updates
- OTP password recovery → Email delivery: sends OTP
- Email delivery → Farmer: delivers reset email
- Flask routes → Prediction form: renders form
- Farmer → Flask routes: submits inputs
- Flask routes → Feature encoders: uses encodings
- Flask routes → Yield regression model: predicts yield
- Flask routes → Application database: stores prediction
- Flask routes → Farming recommendations: renders advice page
- Flask routes → Gemini AI: requests recommendations
- Flask routes → Prediction history: serves history
- Prediction history → Application database: reads predictions
- Flask routes → User dashboard: renders dashboard
- Flask routes → Feedback: renders and handles feedback
- Flask routes → Application database: stores feedback
- Flask routes → Admin login: renders admin login
- Flask routes → Admin analytics: renders analytics
- Flask routes → User management view: renders user list
- Flask routes → Prediction monitoring: renders predictions
- Flask routes → Feedback management: renders feedback
- Flask routes → Application database: queries admin data
