06 / Geospatial product / React + FastAPI Nov 2025 - Feb 2026

KrushiMitra Yield Service

A mobile-first crop-yield scenario prototype for Odisha farmers. The public build demonstrates an accessible React interface and FastAPI service boundary; its prediction output is illustrative while a validated dataset and benchmark remain future work.

ReactTypeScript · typed form state
PydanticValidated request schema
FastAPIScenario service boundary
PrototypeMock output · benchmark pending
Prototype · No live demo GitHub ↗
Overview

KrushiMitra explores how a farmer-facing yield tool could collect district, crop, rainfall, and temperature context without demanding specialist hardware or a desktop workflow.

The engineering contribution is a versioned service boundary: typed React form → Pydantic validation → FastAPI scenario service → structured response. A benchmarked model can replace the current adapter without changing the interface contract. The public path still uses illustrative output, so this case study makes no accuracy claim.

Tech Stack

TSReact 18 + TypeScript + Vite — typed component tree
UIRadix UI + Tailwind CSS — accessible form components
APIFastAPI + Pydantic — validated request/response schema
DBPyMySQL — crop dataset queries
GEOLeaflet + Esri imagery — farm boundary capture
MLscikit-learn artifacts and training scripts — promotion pending benchmark
Product surfaces

Geospatial setup and typed scenario input

KrushiMitra farm setup interface with satellite map and farm boundary controls
Farm geometry. Leaflet captures a named polygon and stores the boundary as product state before the user enters the dashboard.
KrushiMitra yield prediction form with district, crop, season, and variety inputs
Scenario request. District, crop, season, and variety are constrained controls that map directly to the FastAPI request schema.
System architecture

How the System is Built

GEO
Farm context
Boundary · district · crop · season · variety
→
API
FastAPI Service
Validation · routing · response contract
→
ADP
Scenario Adapter
Mock output · model interface boundary
→
UI
Prediction Output
Yield (T/acre) · Comparison · Tips
QA
Validation Work Still Required

Curated historical records → leakage-safe temporal split → baseline comparison → calibrated uncertainty → agronomic review.

WEB
Mobile-First Frontend

Typed form state → API request → response card with a predicted range, historical comparison, and explanatory factors.

Runtime sequence

From farm context to response contract

01

Capture farm and categorical context

The React application records a farm polygon, district, crop, season, and variety through constrained components instead of free-form model parameters.

farm_geometry + district + crop + season + variety
02

Validate a typed request

FastAPI receives the scenario, validates numeric ranges and categorical inputs, and converts the frontend payload into a stable service contract.

React form → Pydantic schema → scenario service
03

Return an illustrative scenario

The current public implementation uses mock prediction logic to exercise the end-to-end interaction. It is an interface prototype, not a validated agricultural model.

Current status: product prototype · benchmark pending
04

Contextualised Output

The response contract reserves fields for an estimate, interval, historical comparison, explanatory factors, and model status so future validation does not require an interface rewrite.

{ estimate, range, comparison, factors, model_status }
Implementation map

A replaceable prediction adapter behind a stable interface

SubsystemSource areaResponsibilityCurrent state
Farm boundaryMapPicker.tsxCapture and persist polygon coordinatesInteractive Leaflet map
Scenario formYieldPredictionPage.tsxConstrain district, crop, season, and varietyTyped React state
API clientshared/api/api.tsSerialize requests and normalize failuresFastAPI adapter
Model artifactsmodels/*.pklPersist estimator, encoders, and feature orderRepository artifacts; benchmark not frozen
Data servicesbackend/*engine.pyWeather, market, and database contextIntegration modules under development
Engineering Problems Solved

Challenges & Solutions

Problem

Prediction claims arrived before validation

The interface made it easy to present model-like output before a trustworthy dataset, temporal evaluation, and calibrated uncertainty were in place.

Solution

Made model status explicit

The portfolio and case study now label the project as a prototype. A future promotion requires a documented dataset, reproducible baselines, and out-of-time validation.

Problem

Complex inputs for a broad audience

Weather and crop context can quickly become an intimidating form, especially on a small screen.

Solution

Mobile-first component flow

Used React, TypeScript, Radix primitives, and constrained controls to keep the scenario workflow responsive and understandable.

Problem

A future model must generalize across time

Random splitting would overstate performance when weather patterns and agricultural practices drift across seasons.

Solution

Define a temporal benchmark first

The next validation milestone is an out-of-time comparison against district and crop baselines, followed by uncertainty calibration and agronomic review.