Skip to content
OnlyProjects
B.Tech / B.E. · Artificial Intelligence & Machine LearningFor educational purposes only
Code included

District-Level Crop Yield Forecasting & Sowing Advisory for Karnataka (Python ML + MySQL + React)

Forecasts kharif yield for Karnataka districts from six decades of ICRISAT district data and tells extension officers which crops look safe this season

Mapped to your syllabusVTU 2022 Scheme (OBE/CBCS) · BCS685 Major Project Phase-I · Semester 6

Overview

1 min read

District-Level Crop Yield Forecasting & Sowing Advisory is a machine-learning project that predicts kharif-season yield (kg/hectare) for major Karnataka crops — ragi, jowar, maize, groundnut and red gram — one to three months before harvest, and turns each forecast into a plain-language advisory: safe to plan for normal yield, below-normal expected, or high risk — review alternate crop.

The data comes from the ICRISAT District Level Database (DLD), an open research dataset that carries season-wise crop area, production, yield, irrigation, rainfall and agricultural-credit variables for about 570 Indian districts going back to 1966. We build a clean district-year panel for 30 Karnataka districts, engineer agronomic features (monsoon rainfall and its lags, irrigated-area share, crop mix), and train baseline linear models against ridge/lasso regression and random-forest / gradient-boosting regressors in scikit-learn, validated with walk-forward (year-based) splits so no future year ever leaks into training.

Forecasts, model metadata and metrics are stored in MySQL, served through a small Express REST API, and shown on a React dashboard where an extension officer or student can pick a district and crop, compare this season's forecast with the five-year average, and export the advisory as CSV.

The project runs as BCS685 Major Project Phase-I (Sem 6) and continues into BCS786 Phase-II (Sem 7); the work split below gives each of the four members an individually examinable module.

Relevant for
Karnataka
Level
Intermediate · 14 weeks · team of 4
Common at
Visvesvaraya Technological University, Anna University, JNTU Hyderabad
Updated
Nov 2026

Syllabus alignment

VTU · 2022 Scheme (OBE/CBCS)

BCS685 · Major Project Phase-I · Semester 6 · 2 credits · CIE 100

Subjects this project applies
  • BCS602 Machine Learning
  • BCSL606 Machine Learning Lab (scikit-learn / Python)
  • BCS403 Database Management Systems (MySQL)
  • BCSL504 Web Technology Lab
  • BCSL657B React
How it is evaluated

Team: individual or group ≤ 4

report : presentation : Q&A = 50 : 25 : 25; report marks identical for all batch-mates; SEE by two university examiners

Also fits: Anna University Regulation 2021, JNTUH R22.

What's in the box

11 parts · 5 free · 2 previewed · 4 unlock for ₹2,000

Problem & synopsis

5 min read

Problem statement

Farmers and district agriculture officers in Karnataka decide sowing mix, input purchase and contingency plans in May–June, but the only district yield figures they can consult are at least a season old. Rainfall bulletins tell whether the monsoon has started, not what it will do to ragi in Mandya versus groundnut in Chitradurga. Research-grade yield models rely on satellite imagery and farm surveys that a student team cannot procure or defend.

Meanwhile the ICRISAT District Level Database — decades of district-wise area, production, yield, irrigation and rainfall — sits unused by the people making these decisions. There is a need for a transparent regression system that learns the historical relationship between season rainfall, irrigation and district-crop yield, forecasts the coming kharif yield per district and crop, classifies the outlook into plain advisory bands, and shows its own measured error so users know how much to trust it. The system must be reproducible, data-leakage-free and defensible in a university viva.

Synopsis

Abstract

Karnataka's farm economy swings with the monsoon: a ragi crop in Mandya and a groundnut crop in Anantapur-side Chitradurga respond very differently to the same rainfall season. District-level yield numbers exist — ICRISAT and the Ministry of Agriculture publish them — but they arrive months after harvest, and no simple tool tells a krishi-panchayat or extension officer before harvest whether the coming season looks normal or stressed. This project builds a reproducible regression pipeline that forecasts district-crop yield for the kharif season from historical area, production, irrigation and rainfall data, and packages it behind a small web dashboard.

Introduction

The ICRISAT District Level Database is a 74-dataset research collection covering roughly 571 districts across 20 states, with about 1,030 variables — season-wise area, production and yield per crop, irrigation, rainfall, night lights and credit. For Karnataka it gives an unbroken district-year record from 1966 to recent years. That is exactly the shape of data classical machine-learning regression needs: many rows (district × crop × year), a modest number of well-understood features, and one continuous target (yield). The project applies what the VTU 2022 scheme teaches in BCS602/BCSL606 — regression, ensembles, cross-validation, feature analysis — to a real, citable Indian dataset instead of a toy one.

Existing System

  • Descriptive statistics: ICRISAT's own visualisation tool and AgriX/APY dashboards report what the yield was, never a forecast.
  • Remote-sensing models in research papers (NDVI-based) are accurate but need satellite pipelines beyond a semester project.
  • Krishi-meteorological advisories exist at state level but are not district-specific for rainfed crops and are not student-reproducible.
  • Gap: a transparent, district-level, reproducible yield forecast with honest error bars, built only on tabular data a B.Tech team can actually handle and defend in a viva.

Proposed System

  • A tidy district-year-crop panel (≈ 30 districts × 5 crops × 55 years ≈ 8,000 rows) assembled from ICRISAT DLD CSVs with documented cleaning rules for district reorganisations.
  • Feature engineering: monsoon (Jun–Sep) rainfall and its 1- and 2-year lags, irrigated share of cropped area, cropping intensity, credit per hectare, and cropwise one-hot context.
  • Models: ridge/lasso linear baselines, random forest and histogram gradient boosting; evaluated with walk-forward validation by year (train on years ≤ t, test on t+1) using MAPE and R².
  • An advisory layer: forecast vs 5-year median → three bands (Normal / Below-normal / High risk), stored in MySQL and served through an Express API to a React dashboard with CSV export.

Feasibility Study

  • Technical: all components are open source and run on a 8 GB RAM laptop; the largest CSV is a few hundred MB and pandas handles it comfortably.
  • Economic: ₹0 — the dataset is open for research use, and hosting is local.
  • Operational: the dashboard needs no training for a student or extension officer; the harder operational truth — that a forecast is a probability, not a promise — is stated on every screen.

Objectives

  1. 01Assemble a clean Karnataka district-year-crop panel from ICRISAT DLD CSVs with documented rules for district reorganisations and missing years.
  2. 02Engineer agronomic features: monsoon rainfall and lags, irrigated-area share, cropping intensity and credit per hectare.
  3. 03Train ridge/lasso baselines and random-forest / histogram-gradient-boosting regressors to forecast kharif yield per district and crop.
  4. 04Evaluate all models with strict walk-forward validation by year, reporting MAPE and R² per crop to expose data leakage.
  5. 05Map forecasts to three advisory bands (Normal / Below-normal / High risk) against the trailing five-year median.
  6. 06Persist forecasts, model versions and metrics in MySQL and expose them through an Express REST API.
  7. 07Build a React dashboard with district-crop selection, five-year comparison charts and CSV export of advisories.

Scope

In scope

  • 30 Karnataka districts and 5 rainfed-dominant kharif crops (ragi, jowar, maize, groundnut, red gram) for years 1966–latest in the DLD.
  • Tabular features only (area, production, irrigation, rainfall, credit) — no satellite or sensor data in v1.
  • Yield forecast one season ahead at district × crop level; three-band advisory mapping.
  • Walk-forward evaluation, per-crop error reports, model versioning in MySQL.
  • React dashboard for desktop browsers and a CSV export matching the report tables.

Out of scope (v1)

  • Farm-level or plot-level prediction (DLD is district-level).
  • Satellite NDVI / soil-moisture ingestion — listed under future scope for Phase-II stretch.
  • Rabi crops and horticulture crops with patchy DLD coverage.
  • Automatic retraining or a production cloud deployment; the team runs the pipeline locally and demonstrates it live.
  • Price or mandi-linkage advice (covered by a separate project family).

Methodology

The project follows the iterative (incremental) SDLC model: data, model and app grow in reviewed increments so the guide always sees a runnable artefact. It is executed as Phase-I (BCS685, Sem 6) and Phase-II (BCS786, Sem 7) of the same project.

PhaseWeeksActivitiesDeliverable
P1 — Requirements & literature1–2Study 15–20 papers/reports on statistical yield forecasting; freeze scope; SRSProblem statement + literature survey (Phase-I report ch. 1–2)
P1 — Data engineering3–5Download DLD CSVs, cleaning rules for district reorganisations, build district-year panel, EDA notebookCleaned panel + EDA report
P1 — Baseline model6–9Ridge/lasso baselines, walk-forward harness, first MAPE/R² numbersBaseline results table
P1 — Review10Phase-I presentation and report to the department (CIE 100)Phase-I report + slides
P2 — Ensemble models11–12Random forest & histogram gradient boosting, feature-importance analysisModel comparison report
P2 — Advisory & app13–14Band mapping, MySQL store, Express API, React dashboardWorking end-to-end demo
P2 — Testing & SEE prep15–16Unit tests, backtest report, final report, demo rehearsal for two examinersFinal report (SEE)

Validation protocol: every model change reruns the same walk-forward harness; a result is only reported if it appears in the harness output, never hand-computed.

Architecture & tech stack

3 diagrams · 8 technologies · 2 min read

  • Python
  • pandas
  • NumPy
  • scikit-learn
  • Matplotlib
  • MySQL
  • Express
  • React

The system is a pipeline plus a three-tier app. The offline pipeline (Python) ingests ICRISAT DLD exports, produces the feature panel, trains models and writes predictions into MySQL. The online part is a classic three-tier stack: React presentation tier, Express application tier with a thin validation layer, and MySQL as the data tier shared by both halves.

flowchart TD
  A["ICRISAT DLD CSV exports"] --> B["Cleaning & panel builder (pandas)"]
  B --> C["Feature engineering (lags, irrigation share)"]
  C --> D["Training harness (scikit-learn, walk-forward)"]
  D --> E["Model artefacts (joblib) + metrics"]
  E --> F["MySQL: panel, forecasts, model_runs"]
  F --> G["Express REST API"]
  G --> H["React advisory dashboard"]
  G --> I["CSV export for reports"]
  D --> J["EDA & backtest notebooks (Matplotlib)"]

ER diagram (MySQL feature store)

erDiagram
  DISTRICT ||--o{ OBSERVATION : "records per year"
  CROP ||--o{ OBSERVATION : "is observed as"
  OBSERVATION ||--o{ PREDICTION : "yields"
  MODEL_RUN ||--o{ PREDICTION : "produces"
  DISTRICT {
    int district_id PK
    string district_name
    int state_code
    date valid_from
  }
  CROP {
    int crop_id PK
    string crop_name
    string season
  }
  OBSERVATION {
    int obs_id PK
    int district_id FK
    int crop_id FK
    int year
    float yield_kg_ha
    float monsoon_rainfall_mm
    float irrigated_share
  }
  MODEL_RUN {
    int run_id PK
    string model_name
    string params_json
    float mape
    float r2
  }
  PREDICTION {
    int prediction_id PK
    int obs_id FK
    int run_id FK
    float predicted_yield
    string advisory_band
  }

DFD level 0

flowchart LR
  U(["Extension officer / student"]) -- "district, crop, season" --> SYS(("Crop Yield Advisory<br/>System"))
  SYS -- "forecast, advisory band, CSV" --> U
  D(["ICRISAT DLD export"]) -- "district-year-crop CSVs" --> SYS
  G(["Guide / examiner"]) -- "review requests" --> SYS
  SYS -- "metrics, backtest report" --> G

One request walk-through: the officer picks Mandya — ragi — kharif 2026; Express validates the query, reads the latest PREDICTION row for that OBSERVATION, joins the five-year median and returns the band; React renders the card, the comparison chart and the export button.

Modules

5 modules

  1. Module 01

    Data Engineering — ICRISAT Panel Builder (Member 1)

    Downloads the DLD crop, irrigation, rainfall and credit CSVs, standardises district names across reorganisations (Hassan split-era artifacts, 2008-era new districts), drops duplicate season rows and emits the tidy district-year-crop panel with a data-dictionary. Exposed as python -m pipeline.build_panel with a checksum log so the panel is reproducible.

  2. Module 02

    Feature Engineering & EDA (Member 2)

    Adds monsoon (Jun–Sep) rainfall, 1- and 2-year lags, irrigated share, cropping intensity and credit per hectare; writes the exploratory analysis notebook with per-crop yield trends, rainfall-yield scatter plots and a documented missing-value policy (forward-fill gaps ≤ 2 years, drop the rest). Produces the feature matrix the training harness consumes.

  3. Module 03

    Model Building & Walk-Forward Evaluation (Member 3)

    Implements the year-based walk-forward splitter, trains ridge, lasso, random forest and HistGradientBoosting regressors per crop, logs MAPE/R² per fold, tunes with nested year-based splits only, and runs permutation importance for the report. Persists each experiment as a MODEL_RUN with parameters and metrics.

  4. Module 04

    Advisory API & React Dashboard (Member 4)

    Maps forecast vs trailing five-year median into Normal / Below-normal / High-risk bands, builds the Express REST API (GET /api/districts, /api/forecast?district=&crop=&year=, /api/export.csv) with input validation, and the React dashboard with district-crop pickers, forecast-vs-median charts, band colour coding and CSV download. Writes the front-end component tests.

  5. Module 05

    Shared — Testing, Documentation & Deployment

    pytest unit tests for cleaning rules and band mapping, integration test for the API against a seeded MySQL fixture, a combined runbook (make panel && make train && make serve), the two-phase report skeleton and the final slide deck. All four members co-own the viva rehearsal.

Slides

12 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    District-Level Crop Yield Forecasting & Sowing Advisory

  2. Slide 2

    Motivation

  3. Slide 3

    Problem Statement

  4. Slide 4

    Objectives

  5. Slide 5

    Data Source — ICRISAT DLD

  6. Slide 6

    System Architecture

  7. Slide 7

    Methodology — Two-Phase Plan

  8. Slide 8

    Modelling & Validation

  9. Slide 9

    Modules & Individual Contribution

  10. Slide 10

    Demo

  11. Slide 11

    Results & Honest Limitations

  12. Slide 12

    Conclusion & Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 16 answered free · 13 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Why forecast at district level instead of farm level?

    District level is where decades of verified data exist — the ICRISAT DLD gives district-year-crop yield, rainfall and irrigation from 1966, so a model can actually learn and be validated. Farm-level prediction would need farm surveys or remote sensing we cannot collect or defend in a semester, and an unverifiable model is worse than a modest verifiable one.

  2. 02Concept

    What exactly is your target variable and why?

    The target is kharif yield in kg per hectare, computed as production divided by cropped area for each district-crop-year. We predict yield rather than production because yield normalises out area swings — a district can plant more because of a price hike, and production would then confuse area decisions with agronomic performance.

  3. 03Concept

    Why use random forest or gradient boosting at all when ridge regression already gives a baseline?

    Ridge assumes an approximately linear rainfall-yield relationship, but real crop response is nonlinear — rainfall helps until waterlogging hurts. Tree ensembles capture thresholds and interactions, like irrigated share mattering only in low-rainfall years. We keep the linear baseline anyway, because if it matches the ensemble, we prefer the simpler, more explainable model.

+13 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

Source code & how to run

8 steps · complete source code · unlocks with the project

Unlocks with the project · ₹2,000

8 steps · source code zip

Prerequisites, install, seed data and tests, written for demo day. Plus the complete source.

Unlock for ₹2,000

READMEFIRST

270 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

270 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

367 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

367 words · ~2 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

8 sources

  1. ICRISAT District Level Database (DLD) — Meso-level data for Indian districts
  2. Ministry of Agriculture & Farmers Welfare — AgriX APY (Area, Production, Yield) Reports
  3. scikit-learn User Guide — model evaluation, pipelines and ensemble methods
  4. pandas documentation
  5. MySQL 8.0 Reference Manual
  6. Leo Breiman, Random Forests, Machine Learning 45(1), 2001
  7. Pang-Ning Tan, Michael Steinbach, Anuj Karpatne, Vipin Kumar, Introduction to Data Mining, 2nd ed., Pearson
  8. Ian Sommerville, Software Engineering, 10th ed., Pearson

Cite this bundle

OnlyProjects. (2026). District-Level Crop Yield Forecasting & Sowing Advisory for Karnataka (Python ML + MySQL + React): B.Tech / B.E. Artificial Intelligence & Machine Learning project bundle [Educational resource]. https://onlyprojects.online/projects/btech-aiml-district-crop-yield-forecasting-sowing-advisory-karnataka

Future scope

1 min read

  • Add satellite features (seasonal NDVI from MODIS via Google Earth Engine) for Phase-II stretch or an M.Tech continuation.
  • Extend the panel beyond Karnataka (the DLD covers 20 states) and compare transfer-learning across states.
  • Link yield forecasts to a mandi-price module for a revenue outlook, not just a production outlook.
  • Replace the static band rule with a quantile-regression model that outputs a prediction interval.
  • Automate yearly refresh: a scheduled job re-downloads the DLD update, rebuilds features and re-scores the season.
  • Kannada-language advisory cards and an SMS digest for extension officers without regular internet.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.

B.Tech / B.E.Code included

Aerospace / Aeronautical

Low-Speed Open-Circuit Wind Tunnel with Force Balance for Aerofoil Lift-Drag Measurement

Build a subsonic test tunnel on a student budget, then trace lift and drag on a 3D-printed NACA 0012 against theory

  • C / Arduino Uno (industry-standard extra) — HX711 load-cell and serial logging firmware
  • Python (NumPy, Matplotlib) — calibration, force coefficients and plots
  • MATLAB / Scilab — thin-airfoil theory overlay and regression
  • +4

intermediate14 wk4 students