# samirshaikh2425/crop-price-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/samirshaikh2425/crop-price-prediction
- Repository: https://github.com/samirshaikh2425/crop-price-prediction

## Overview

This is a Streamlit application for estimating crop prices, comparing mandi markets, and predicting crop yields. Users provide crop and market selections or cultivation inputs; the app combines dataset records with saved prediction models to show estimates and comparisons. A separate training script preprocesses both datasets, evaluates candidate regressors, and saves model bundles and metrics. The app excerpt supports its data/model loading and dashboard features, while README documents the broader capabilities; implementation details omitted from the excerpts are not assumed.

Main entry points: [`app.py`](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py) (Streamlit application), [`train_model.py`](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/train_model.py) (Training workflow), [`data/daily_wholesale_crop_prices.csv`](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/data/daily_wholesale_crop_prices.csv) (Mandi price records), [`data/crop_yield.csv`](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/data/crop_yield.csv) (Yield records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Streamlit experience"]
  node_app["Streamlit application<br/>[app.py]"]
  node_price_estimate["Price estimate<br/>[app.py]"]
  node_market_compare["Market comparison<br/>[app.py]"]
  node_yield_predict["Yield prediction<br/>[app.py]"]
end

subgraph group_prediction["Prediction data and models"]
  node_price_records[("Mandi price records")]
  node_yield_records[("Yield records<br/>[crop_yield.csv]")]
  node_price_model[("Price model bundle")]
  node_yield_model[("Yield model bundle")]
end

subgraph group_training["Model training"]
  node_trainer["Training workflow<br/>[train_model.py]"]
  node_price_metrics["Price evaluation metrics"]
  node_yield_metrics["Yield evaluation metrics"]
end

node_user(("Farmer or trader"))

node_user -->|"uses"| node_app
node_app -->|"loads"| node_price_records
node_app -->|"loads"| node_yield_records
node_app -->|"loads"| node_price_model
node_app -->|"loads"| node_yield_model
node_app -->|"offers"| node_price_estimate
node_app -->|"offers"| node_market_compare
node_app -->|"offers"| node_yield_predict
node_price_estimate -->|"filters records"| node_price_records
node_market_compare -->|"summarizes markets"| node_price_records
node_yield_predict -->|"uses options"| node_yield_records
node_trainer -->|"reads"| node_price_records
node_trainer -->|"reads"| node_yield_records
node_trainer -->|"saves bundle"| node_price_model
node_trainer -->|"saves bundle"| node_yield_model
node_trainer -->|"writes metrics"| node_price_metrics
node_trainer -->|"writes metrics"| node_yield_metrics

click node_app "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py"
click node_price_estimate "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py"
click node_market_compare "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py"
click node_yield_predict "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py"
click node_price_records "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/data/daily_wholesale_crop_prices.csv"
click node_yield_records "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/data/crop_yield.csv"
click node_price_model "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_price_model.pkl"
click node_yield_model "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_yield_model.pkl"
click node_trainer "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/train_model.py"
click node_price_metrics "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_price_model_evaluation.csv"
click node_yield_metrics "https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_yield_model_evaluation.csv"

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_app,node_price_estimate,node_market_compare,node_yield_predict toneBlue
class node_price_records,node_yield_records,node_price_model,node_yield_model toneAmber
class node_trainer,node_price_metrics,node_yield_metrics toneMint
class node_user toneIndigo
```

## Components

### Streamlit experience

- [Streamlit application](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py): `app.py`
- [Price estimate](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py): `app.py`
- [Market comparison](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py): `app.py`
- [Yield prediction](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/app.py): `app.py`

### Prediction data and models

- [Mandi price records](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/data/daily_wholesale_crop_prices.csv): `data/daily_wholesale_crop_prices.csv`
- [Yield records](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/data/crop_yield.csv): `data/crop_yield.csv`
- [Price model bundle](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_price_model.pkl): `models/crop_price_model.pkl`
- [Yield model bundle](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_yield_model.pkl): `models/crop_yield_model.pkl`

### Model training

- [Training workflow](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/train_model.py): `train_model.py`
- [Price evaluation metrics](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_price_model_evaluation.csv): `models/crop_price_model_evaluation.csv`
- [Yield evaluation metrics](https://github.com/samirshaikh2425/crop-price-prediction/blob/main/models/crop_yield_model_evaluation.csv): `models/crop_yield_model_evaluation.csv`

### Other components

- **Farmer or trader**

## Connections

- Farmer or trader → Streamlit application: uses (evidence: `README.md`)
- Streamlit application → Mandi price records: loads (evidence: `app.py`)
- Streamlit application → Yield records: loads (evidence: `app.py`)
- Streamlit application → Price model bundle: loads (evidence: `app.py`)
- Streamlit application → Yield model bundle: loads (evidence: `app.py`)
- Streamlit application → Price estimate: offers (evidence: `app.py`)
- Streamlit application → Market comparison: offers (evidence: `app.py`)
- Streamlit application → Yield prediction: offers (evidence: `app.py`)
- Price estimate → Mandi price records: filters records (evidence: `app.py`)
- Market comparison → Mandi price records: summarizes markets (evidence: `app.py`)
- Yield prediction → Yield records: uses options (evidence: `app.py`)
- Training workflow → Mandi price records: reads (evidence: `train_model.py`)
- Training workflow → Yield records: reads (evidence: `train_model.py`)
- Training workflow → Price model bundle: saves bundle (evidence: `train_model.py`)
- Training workflow → Yield model bundle: saves bundle (evidence: `train_model.py`)
- Training workflow → Price evaluation metrics: writes metrics (evidence: `train_model.py`)
- Training workflow → Yield evaluation metrics: writes metrics (evidence: `train_model.py`)
