# shekhar-commit/multiple_crop_recommendation_system_ architecture

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

- Interactive diagram: https://gitdiagram.com/shekhar-commit/multiple_crop_recommendation_system_
- Repository: https://github.com/shekhar-commit/multiple_crop_recommendation_system_

## Overview

This Flask crop-advisory application takes soil and climate inputs, validates and averages climate ranges, predicts three crop options, and presents available profitability estimates. A selected crop can then be viewed on a detail page. The graph separates request handling, prediction and profit calculations, and the model/data assets. Source excerpts show the route and data relationships; template contents were not sampled, so their internal interactions are not inferred.

Main entry points: [`app.py`](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py) (Prediction route), [`templates/index.html`](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/index.html) (Home page), [`templates/select_crop.html`](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/select_crop.html) (Crop options), [`templates/crop_detail.html`](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/crop_detail.html) (Crop detail page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflow"]
  node_home["Home route<br/>[app.py]"]
  node_home_view["Home page<br/>[index.html]"]
  node_prediction["Prediction route<br/>[app.py]"]
  node_selection_view["Crop options<br/>[select_crop.html]"]
  node_detail_route["Detail route<br/>[app.py]"]
  node_detail_view["Crop detail page<br/>[crop_detail.html]"]
end

subgraph group_logic["Recommendation logic"]
  node_input_prep["Input validation<br/>[app.py]"]
  node_predictor["Crop predictor<br/>[app.py]"]
  node_profit_calc["Profit calculator<br/>[app.py]"]
end

subgraph group_assets["Models and crop data"]
  node_classifier["Crop classifier<br/>[model_gbc.pkl]"]
  node_feature_scaler["Feature scaler<br/>[scaler.pkl]"]
  node_crop_encoder["Crop encoder<br/>[encoder.pkl]"]
  node_profit_data[("Profit data<br/>[crop_data.json]")]
  node_crop_info[("Crop information")]
end

node_farmer(("Farmer"))

node_farmer -->|"opens"| node_home
node_home -->|"renders"| node_home_view
node_farmer -->|"submits inputs"| node_prediction
node_prediction -->|"validates and averages"| node_input_prep
node_prediction -->|"requests predictions"| node_predictor
node_predictor -->|"scales features"| node_feature_scaler
node_predictor -->|"predicts probabilities"| node_classifier
node_predictor -->|"decodes crops"| node_crop_encoder
node_prediction -->|"calculates options"| node_profit_calc
node_profit_calc -->|"reads economics"| node_profit_data
node_prediction -->|"renders options"| node_selection_view
node_farmer -->|"selects crop"| node_detail_route
node_detail_route -->|"reads details"| node_crop_info
node_detail_route -->|"renders details"| node_detail_view

click node_home "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py"
click node_home_view "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/index.html"
click node_prediction "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py"
click node_selection_view "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/select_crop.html"
click node_detail_route "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py"
click node_detail_view "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/crop_detail.html"
click node_input_prep "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py"
click node_predictor "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py"
click node_profit_calc "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py"
click node_classifier "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/models/model_gbc.pkl"
click node_feature_scaler "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/models/scaler.pkl"
click node_crop_encoder "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/models/encoder.pkl"
click node_profit_data "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/crop_data.json"
click node_crop_info "https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/crop_agriculture_data.json"

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_home,node_home_view,node_prediction,node_selection_view,node_detail_route,node_detail_view toneBlue
class node_input_prep,node_predictor,node_profit_calc toneAmber
class node_classifier,node_feature_scaler,node_crop_encoder,node_profit_data,node_crop_info toneMint
class node_farmer toneIndigo
```

## Components

### Web workflow

- [Home route](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py): `app.py`
- [Home page](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/index.html): `templates/index.html`
- [Prediction route](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py): `app.py`
- [Crop options](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/select_crop.html): `templates/select_crop.html`
- [Detail route](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py): `app.py`
- [Crop detail page](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/templates/crop_detail.html): `templates/crop_detail.html`

### Recommendation logic

- [Input validation](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py): `app.py`
- [Crop predictor](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py): `app.py`
- [Profit calculator](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/app.py): `app.py`

### Models and crop data

- [Crop classifier](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/models/model_gbc.pkl): `models/model_gbc.pkl`
- [Feature scaler](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/models/scaler.pkl): `models/scaler.pkl`
- [Crop encoder](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/models/encoder.pkl): `models/encoder.pkl`
- [Profit data](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/crop_data.json): `crop_data.json`
- [Crop information](https://github.com/shekhar-commit/multiple_crop_recommendation_system_/blob/master/crop_agriculture_data.json): `crop_agriculture_data.json`

### Other components

- **Farmer**

## Connections

- Farmer → Home route: opens (evidence: `app.py`)
- Home route → Home page: renders (evidence: `app.py`)
- Farmer → Prediction route: submits inputs (evidence: `app.py`)
- Prediction route → Input validation: validates and averages (evidence: `app.py`)
- Prediction route → Crop predictor: requests predictions (evidence: `app.py`)
- Crop predictor → Feature scaler: scales features (evidence: `app.py`)
- Crop predictor → Crop classifier: predicts probabilities (evidence: `app.py`)
- Crop predictor → Crop encoder: decodes crops (evidence: `app.py`)
- Prediction route → Profit calculator: calculates options (evidence: `app.py`)
- Profit calculator → Profit data: reads economics (evidence: `app.py`)
- Prediction route → Crop options: renders options (evidence: `app.py`)
- Farmer → Detail route: selects crop (evidence: `app.py`)
- Detail route → Crop information: reads details (evidence: `app.py`)
- Detail route → Crop detail page: renders details (evidence: `app.py`)
