# gopu-005/farmer_app-main architecture

> Architecture diagram of the GitHub repository gopu-005/farmer_app-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gopu-005/farmer_app-main
- Repository: https://github.com/gopu-005/farmer_app-main

## Overview

This is a web application for farm management and crop-health support. Farmers can onboard plots and crops, review plot-specific dashboard information, and submit plant images for disease prediction and treatment guidance. The sampled backend also generates crop workflows and market estimates using an AI API, fetches weather data, and reads or updates per-user plot records. The templates indicate login, onboarding, dashboard, history, and prediction views. Several routes and template-to-backend connections are unsampled, so those links are not asserted.

Main entry points: [`app.py`](https://github.com/gopu-005/farmer_app-main/blob/main/app.py) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Farmer views"]
  node_login["Login view<br/>[login.html]"]
  node_onboarding_view["Onboarding view<br/>[onboarding.html]"]
  node_dashboard_view["Dashboard view<br/>[dashboard.html]"]
  node_history_view["History view<br/>[history.html]"]
  node_prediction_view["Prediction view<br/>[prediction.html]"]
end

subgraph group_core["Application workflows"]
  node_backend["Web application<br/>[app.py]"]
  node_onboarding["Plot onboarding<br/>[app.py]"]
  node_dashboard["Plot dashboard<br/>[app.py]"]
  node_diagnosis["Image diagnosis<br/>[app.py]"]
  node_ai_workflows["Crop workflows<br/>[app.py]"]
  node_ai_market["Market estimates<br/>[app.py]"]
  node_plant_model["Plant classifier<br/>[app.py]"]
end

subgraph group_integrations["External services"]
  node_plot_store[("Plot records")]
  node_ai_service["Gemini AI service"]
  node_weather_service["WeatherAPI"]
end

node_farmer(("Farmer"))

node_farmer -.->|"uses"| node_backend
node_backend -.->|"routes"| node_onboarding
node_backend -.->|"routes"| node_dashboard
node_backend -.->|"routes"| node_diagnosis
node_onboarding -.->|"writes plots"| node_plot_store
node_dashboard -->|"reads plots"| node_plot_store
node_dashboard -->|"fetches forecast"| node_weather_service
node_onboarding -->|"generates plans"| node_ai_workflows
node_ai_workflows -->|"requests generation"| node_ai_service
node_diagnosis -->|"predicts disease"| node_plant_model
node_diagnosis -->|"reads location"| node_plot_store
node_diagnosis -->|"requests estimate"| node_ai_market
node_ai_market -.->|"requests estimate"| node_ai_service

click node_login "https://github.com/gopu-005/farmer_app-main/blob/main/templates/login.html"
click node_onboarding_view "https://github.com/gopu-005/farmer_app-main/blob/main/templates/onboarding.html"
click node_dashboard_view "https://github.com/gopu-005/farmer_app-main/blob/main/templates/dashboard.html"
click node_history_view "https://github.com/gopu-005/farmer_app-main/blob/main/templates/history.html"
click node_prediction_view "https://github.com/gopu-005/farmer_app-main/blob/main/templates/prediction.html"
click node_backend "https://github.com/gopu-005/farmer_app-main/blob/main/app.py"
click node_onboarding "https://github.com/gopu-005/farmer_app-main/blob/main/app.py"
click node_dashboard "https://github.com/gopu-005/farmer_app-main/blob/main/app.py"
click node_diagnosis "https://github.com/gopu-005/farmer_app-main/blob/main/app.py"
click node_ai_workflows "https://github.com/gopu-005/farmer_app-main/blob/main/app.py"
click node_ai_market "https://github.com/gopu-005/farmer_app-main/blob/main/app.py"
click node_plant_model "https://github.com/gopu-005/farmer_app-main/blob/main/app.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_login,node_onboarding_view,node_dashboard_view,node_history_view,node_prediction_view toneBlue
class node_backend,node_onboarding,node_dashboard,node_diagnosis,node_ai_workflows,node_ai_market,node_plant_model toneAmber
class node_plot_store,node_ai_service,node_weather_service toneMint
class node_farmer toneIndigo
```

## Components

### Farmer views

- [Login view](https://github.com/gopu-005/farmer_app-main/blob/main/templates/login.html): `templates/login.html`
- [Onboarding view](https://github.com/gopu-005/farmer_app-main/blob/main/templates/onboarding.html): `templates/onboarding.html`
- [Dashboard view](https://github.com/gopu-005/farmer_app-main/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [History view](https://github.com/gopu-005/farmer_app-main/blob/main/templates/history.html): `templates/history.html`
- [Prediction view](https://github.com/gopu-005/farmer_app-main/blob/main/templates/prediction.html): `templates/prediction.html`

### Application workflows

- [Web application](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`
- [Plot onboarding](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`
- [Plot dashboard](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`
- [Image diagnosis](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`
- [Crop workflows](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`
- [Market estimates](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`
- [Plant classifier](https://github.com/gopu-005/farmer_app-main/blob/main/app.py): `app.py`

### External services

- **Plot records**
- **Gemini AI service**
- **WeatherAPI**

### Other components

- **Farmer**

## Connections

- Farmer → Web application: uses
- Web application → Plot onboarding: routes (evidence: `app.py`)
- Web application → Plot dashboard: routes (evidence: `app.py`)
- Web application → Image diagnosis: routes (evidence: `app.py`)
- Plot onboarding → Plot records: writes plots
- Plot dashboard → Plot records: reads plots (evidence: `app.py`)
- Plot dashboard → WeatherAPI: fetches forecast (evidence: `app.py`)
- Plot onboarding → Crop workflows: generates plans (evidence: `app.py`)
- Crop workflows → Gemini AI service: requests generation (evidence: `app.py`)
- Image diagnosis → Plant classifier: predicts disease (evidence: `app.py`)
- Image diagnosis → Plot records: reads location (evidence: `app.py`)
- Image diagnosis → Market estimates: requests estimate (evidence: `app.py`)
- Market estimates → Gemini AI service: requests estimate
