# shekhar-commit/fertilizer_recommendation_system architecture

> Architecture diagram of the GitHub repository shekhar-commit/fertilizer_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/fertilizer_recommendation_system
- Repository: https://github.com/shekhar-commit/fertilizer_recommendation_system

## Overview

This is a Flask fertilizer-recommendation web app. A user submits crop, soil, and environmental inputs to the prediction route; the app converts numeric fields, encodes categorical features, predicts a fertilizer, applies quantity/timing/method rules, and renders a recommendation. The model and encoders are loaded from repository artifacts. The notebook and styling are not shown as runtime components. Source excerpts support the app’s calls and template references; template contents were not sampled, so their internal behavior is not inferred.

Main entry points: [`app.py`](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py) (Prediction route), [`templates/result.html`](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/templates/result.html) (Result page), [`encoders.pkl`](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/encoders.pkl) (Feature encoders), [`templates/index.html`](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/templates/index.html) (Input page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_home_route["Home route<br/>[app.py]"]
  node_input_page["Input page<br/>[index.html]"]
  node_predict_route["Prediction route<br/>[app.py]"]
  node_result_page["Result page<br/>[result.html]"]
end

subgraph group_prediction["Prediction"]
  node_numeric_conversion["Numeric conversion<br/>[app.py]"]
  node_feature_encoding["Feature encoding<br/>[app.py]"]
  node_encoders[("Feature encoders<br/>[encoders.pkl]")]
  node_fertilizer_model[("Fertilizer model")]
  node_fertilizer_decode["Fertilizer decoding<br/>[app.py]"]
end

subgraph group_advice["Recommendation"]
  node_recommendation_rules["Recommendation rules<br/>[app.py]"]
end

node_farmer(("Farmer"))

node_farmer -->|"submits inputs"| node_predict_route
node_home_route -->|"renders"| node_input_page
node_predict_route -->|"converts numbers"| node_numeric_conversion
node_predict_route -->|"requests recommendation"| node_recommendation_rules
node_recommendation_rules -->|"predicts fertilizer"| node_feature_encoding
node_feature_encoding -->|"transforms features"| node_encoders
node_feature_encoding -->|"predicts class"| node_fertilizer_model
node_feature_encoding -->|"decodes prediction"| node_fertilizer_decode
node_fertilizer_decode -->|"inverse transforms"| node_encoders
node_recommendation_rules -->|"renders recommendation"| node_result_page
node_predict_route -->|"renders result"| node_result_page

click node_home_route "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py"
click node_input_page "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/templates/index.html"
click node_predict_route "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py"
click node_numeric_conversion "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py"
click node_feature_encoding "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py"
click node_encoders "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/encoders.pkl"
click node_fertilizer_model "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/fertilizer_model.pkl"
click node_fertilizer_decode "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py"
click node_recommendation_rules "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py"
click node_result_page "https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/templates/result.html"

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_route,node_input_page,node_predict_route,node_result_page toneBlue
class node_numeric_conversion,node_feature_encoding,node_encoders,node_fertilizer_model,node_fertilizer_decode toneAmber
class node_recommendation_rules toneMint
class node_farmer toneIndigo
```

## Components

### Web interface

- [Home route](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py): `app.py`
- [Input page](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/templates/index.html): `templates/index.html`
- [Prediction route](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py): `app.py`
- [Result page](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/templates/result.html): `templates/result.html`

### Prediction

- [Numeric conversion](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py): `app.py`
- [Feature encoding](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py): `app.py`
- [Feature encoders](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/encoders.pkl): `encoders.pkl`
- [Fertilizer model](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/fertilizer_model.pkl): `fertilizer_model.pkl`
- [Fertilizer decoding](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py): `app.py`

### Recommendation

- [Recommendation rules](https://github.com/shekhar-commit/fertilizer_recommendation_system/blob/master/app.py): `app.py`

### Other components

- **Farmer**

## Connections

- Farmer → Prediction route: submits inputs (evidence: `app.py`)
- Home route → Input page: renders (evidence: `app.py`)
- Prediction route → Numeric conversion: converts numbers (evidence: `app.py`)
- Prediction route → Recommendation rules: requests recommendation (evidence: `app.py`)
- Recommendation rules → Feature encoding: predicts fertilizer (evidence: `app.py`)
- Feature encoding → Feature encoders: transforms features (evidence: `app.py`)
- Feature encoding → Fertilizer model: predicts class (evidence: `app.py`)
- Feature encoding → Fertilizer decoding: decodes prediction (evidence: `app.py`)
- Fertilizer decoding → Feature encoders: inverse transforms (evidence: `app.py`)
- Recommendation rules → Result page: renders recommendation (evidence: `app.py`)
- Prediction route → Result page: renders result (evidence: `app.py`)
