# danishahmed600/khetkhabri architecture

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

- Interactive diagram: https://gitdiagram.com/danishahmed600/khetkhabri
- Repository: https://github.com/danishahmed600/khetkhabri

## Overview

This is a Streamlit prototype for recommending a crop and estimating its price from month, soil type, temperature, and rainfall. Its workflow loads the supplied spreadsheet, encodes fields and trains crop and price models, then accepts user inputs and displays predictions alongside evaluation metrics. The only source file shown contains the full runtime, so component boundaries here describe responsibilities within that file; no other implementation or integrations are evidenced.

Main entry points: [`main.py`](https://github.com/danishahmed600/khetkhabri/blob/main/main.py) (Train and evaluate), [`Advanced_Crop_Prediction_and_Analysis_2024.xlsx`](https://github.com/danishahmed600/khetkhabri/blob/main/Advanced_Crop_Prediction_and_Analysis_2024.xlsx) (Crop dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Input data"]
  node_workbook["Crop dataset"]
end

subgraph group_ml["Prediction pipeline"]
  node_load_encode["Load and encode<br/>[main.py]"]
  node_training["Train and evaluate<br/>[main.py]"]
  node_crop_model["Crop classifier<br/>[main.py]"]
  node_price_model["Price regressor<br/>[main.py]"]
  node_predict["Prediction function<br/>[main.py]"]
end

subgraph group_app["Streamlit interface"]
  node_interface["Streamlit interface<br/>[main.py]"]
  node_metrics["Model metrics<br/>[main.py]"]
end

node_farmer(("Farmer"))

node_workbook -->|"provides data"| node_load_encode
node_load_encode -->|"prepares data"| node_training
node_training -->|"fits and scores"| node_crop_model
node_training -->|"fits and scores"| node_price_model
node_training -->|"computes metrics"| node_metrics
node_farmer -->|"enters inputs"| node_interface
node_interface -->|"calls prediction"| node_predict
node_predict -->|"predicts crop"| node_crop_model
node_predict -->|"predicts price"| node_price_model
node_predict -->|"returns results"| node_interface
node_metrics -->|"displays metrics"| node_interface

click node_workbook "https://github.com/danishahmed600/khetkhabri/blob/main/Advanced_Crop_Prediction_and_Analysis_2024.xlsx"
click node_load_encode "https://github.com/danishahmed600/khetkhabri/blob/main/main.py"
click node_training "https://github.com/danishahmed600/khetkhabri/blob/main/main.py"
click node_crop_model "https://github.com/danishahmed600/khetkhabri/blob/main/main.py"
click node_price_model "https://github.com/danishahmed600/khetkhabri/blob/main/main.py"
click node_predict "https://github.com/danishahmed600/khetkhabri/blob/main/main.py"
click node_interface "https://github.com/danishahmed600/khetkhabri/blob/main/main.py"
click node_metrics "https://github.com/danishahmed600/khetkhabri/blob/main/main.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_workbook toneBlue
class node_load_encode,node_training,node_crop_model,node_price_model,node_predict toneAmber
class node_interface,node_metrics toneMint
class node_farmer toneIndigo
```

## Components

### Input data

- [Crop dataset](https://github.com/danishahmed600/khetkhabri/blob/main/Advanced_Crop_Prediction_and_Analysis_2024.xlsx): `Advanced_Crop_Prediction_and_Analysis_2024.xlsx`

### Prediction pipeline

- [Load and encode](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`
- [Train and evaluate](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`
- [Crop classifier](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`
- [Price regressor](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`
- [Prediction function](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`

### Streamlit interface

- [Streamlit interface](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`
- [Model metrics](https://github.com/danishahmed600/khetkhabri/blob/main/main.py): `main.py`

### Other components

- **Farmer**

## Connections

- Crop dataset → Load and encode: provides data (evidence: `main.py`)
- Load and encode → Train and evaluate: prepares data (evidence: `main.py`)
- Train and evaluate → Crop classifier: fits and scores (evidence: `main.py`)
- Train and evaluate → Price regressor: fits and scores (evidence: `main.py`)
- Train and evaluate → Model metrics: computes metrics (evidence: `main.py`)
- Farmer → Streamlit interface: enters inputs (evidence: `main.py`)
- Streamlit interface → Prediction function: calls prediction (evidence: `main.py`)
- Prediction function → Crop classifier: predicts crop (evidence: `main.py`)
- Prediction function → Price regressor: predicts price (evidence: `main.py`)
- Prediction function → Streamlit interface: returns results (evidence: `main.py`)
- Model metrics → Streamlit interface: displays metrics (evidence: `main.py`)
