# yasir-ansari88/crop-yield-prediction-risk-scoring architecture

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

- Interactive diagram: https://gitdiagram.com/yasir-ansari88/crop-yield-prediction-risk-scoring
- Repository: https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring

## Overview

Crop Yield Estimation is a Streamlit application and notebook-based ML project for estimating crop yields and analyzing yield drivers and low-yield risk. The dashboard workflow starts with a user exploring performance or entering crop, location, season, year, and input conditions; its core builds predictions, ranges, and risk estimates for display. Notebooks document the broader data-understanding-to-evaluation workflow, plus range and risk analysis. The dashboard source excerpts are partial, so the app-to-core call is shown as unverified; notebook sequencing follows the README.

Main entry points: [`dashboard/core.py`](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py) (Core services), [`dashboard/app.py`](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/app.py) (Streamlit interface), [`notebook/2. eda.ipynb`](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/2.%20eda.ipynb) (Exploratory analysis), [`notebook/3. data_preprocessing.ipynb`](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/3.%20data_preprocessing.ipynb) (Data preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Streamlit interface<br/>[app.py]"]
end

subgraph group_engine["Prediction engine"]
  node_core["Core services<br/>[core.py]"]
  node_features["Feature building<br/>[core.py]"]
  node_prediction["Yield prediction<br/>[core.py]"]
  node_ranges["Prediction ranges<br/>[core.py]"]
  node_risk["Low-yield risk<br/>[core.py]"]
  node_evaluation["Performance metrics<br/>[core.py]"]
end

subgraph group_analysis["Analysis notebooks"]
  node_understanding["Data understanding"]
  node_eda["Exploratory analysis<br/>[2. eda.ipynb]"]
  node_preprocessing["Data preprocessing"]
  node_engineering["Feature engineering"]
  node_training["Model training"]
  node_evaluation_nb["Model evaluation"]
  node_range_nb["Prediction ranges"]
  node_risk_nb["Low-yield risk analysis"]
end

subgraph group_artifacts["Data and models"]
  node_data[("Crop yield data")]
  node_models[("Saved model artifacts")]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_app
node_app -.->|"uses services"| node_core
node_core -->|"loads data"| node_data
node_core -->|"loads artifacts"| node_models
node_core -->|"builds features"| node_features
node_core -->|"predicts yield"| node_prediction
node_core -->|"computes ranges"| node_ranges
node_core -->|"scores risk"| node_risk
node_core -->|"computes metrics"| node_evaluation
node_understanding -->|"followed by"| node_eda
node_eda -->|"followed by"| node_preprocessing
node_preprocessing -->|"followed by"| node_engineering
node_engineering -->|"followed by"| node_training
node_training -->|"followed by"| node_evaluation_nb

click node_app "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/app.py"
click node_core "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py"
click node_features "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py"
click node_prediction "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py"
click node_ranges "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py"
click node_risk "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py"
click node_evaluation "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py"
click node_models "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/tree/main/models"
click node_understanding "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/1.%20data_understanding.ipynb"
click node_eda "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/2.%20eda.ipynb"
click node_preprocessing "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/3.%20data_preprocessing.ipynb"
click node_engineering "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/4.%20feature_engineering.ipynb"
click node_training "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/5.%20model_training.ipynb"
click node_evaluation_nb "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/6.%20model_evaluation.ipynb"
click node_range_nb "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/7.%20Prediction_range.ipynb"
click node_risk_nb "https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/8-%20Low%20yield%20risk%20analysis.ipynb"

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_user toneBlue
class node_core,node_features,node_prediction,node_ranges,node_risk,node_evaluation toneAmber
class node_understanding,node_eda,node_preprocessing,node_engineering,node_training,node_evaluation_nb,node_range_nb,node_risk_nb toneMint
class node_data,node_models toneRose
```

## Components

### Dashboard

- [Streamlit interface](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/app.py): `dashboard/app.py`

### Prediction engine

- [Core services](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py): `dashboard/core.py`
- [Feature building](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py): `dashboard/core.py`
- [Yield prediction](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py): `dashboard/core.py`
- [Prediction ranges](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py): `dashboard/core.py`
- [Low-yield risk](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py): `dashboard/core.py`
- [Performance metrics](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/dashboard/core.py): `dashboard/core.py`

### Analysis notebooks

- [Data understanding](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/1.%20data_understanding.ipynb): `notebook/1. data_understanding.ipynb`
- [Exploratory analysis](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/2.%20eda.ipynb): `notebook/2. eda.ipynb`
- [Data preprocessing](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/3.%20data_preprocessing.ipynb): `notebook/3. data_preprocessing.ipynb`
- [Feature engineering](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/4.%20feature_engineering.ipynb): `notebook/4. feature_engineering.ipynb`
- [Model training](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/5.%20model_training.ipynb): `notebook/5. model_training.ipynb`
- [Model evaluation](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/6.%20model_evaluation.ipynb): `notebook/6. model_evaluation.ipynb`
- [Prediction ranges](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/7.%20Prediction_range.ipynb): `notebook/7. Prediction_range.ipynb`
- [Low-yield risk analysis](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/blob/main/notebook/8-%20Low%20yield%20risk%20analysis.ipynb): `notebook/8- Low yield risk analysis.ipynb`

### Data and models

- **Crop yield data**
- [Saved model artifacts](https://github.com/yasir-ansari88/crop-yield-prediction-risk-scoring/tree/main/models): `models`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit interface: uses (evidence: `README.md`)
- Streamlit interface → Core services: uses services (evidence: `dashboard/app.py`)
- Core services → Crop yield data: loads data (evidence: `dashboard/core.py`)
- Core services → Saved model artifacts: loads artifacts (evidence: `dashboard/core.py`)
- Core services → Feature building: builds features (evidence: `dashboard/core.py`)
- Core services → Yield prediction: predicts yield (evidence: `dashboard/core.py`)
- Core services → Prediction ranges: computes ranges (evidence: `dashboard/core.py`)
- Core services → Low-yield risk: scores risk (evidence: `dashboard/core.py`)
- Core services → Performance metrics: computes metrics (evidence: `dashboard/core.py`)
- Data understanding → Exploratory analysis: followed by (evidence: `README.md`)
- Exploratory analysis → Data preprocessing: followed by (evidence: `README.md`)
- Data preprocessing → Feature engineering: followed by (evidence: `README.md`)
- Feature engineering → Model training: followed by (evidence: `README.md`)
- Model training → Model evaluation: followed by (evidence: `README.md`)
