Skip to content

feat: Predictive Mandi (Market) Price Intelligence - #1889

Merged
omroy07 merged 1 commit into
omroy07:mainfrom
Aditya8369:feat/Predictive-Mandi-(Market)-Price-Intelligence
Sep 27, 2026
Merged

omroy07 merged 1 commit into
omroy07:mainfrom
Aditya8369:feat/Predictive-Mandi-(Market)-Price-Intelligence

Conversation

@Aditya8369

Copy link
Copy Markdown
Contributor

closes #1884

Key Components Implemented

  1. Price Forecasting Engine (

backend/ml_models/price_forecast.py
)
Data Ingestion & Historical Series:
Ingests and simulates daily commodity pricing from Agmarknet & e-NAM across 15+ major Indian mandis (Azadpur, Vashi, Lasalgaon, Khanna, Guntur, Kolar, Surat, Rajkot, Indore, Jaipur, etc.) for 12+ core commodities (Tomato, Onion, Wheat, Rice, Cotton, Soybean, Potato, Maize, Mustard, Gram, Turmeric, Garlic).
Time-Series Forecasting (ARIMA / Prophet / XGBoost Principles):
Generates 7- to 14-day daily price projections.
Decomposes weekly demand cycles (Monday arrival surges, weekend adjustments) and seasonal harvesting patterns.
Computes 95% Confidence Intervals (yhat, yhat_lower, yhat_upper).
Identifies the Optimal Selling Day with expected percentage gains and outputs actionable recommendations (e.g., HOLD CROP, SELL NOW, STABLE).
2. Logistics & Net-Profit Optimizer (

backend/services/mandi_profit_optimizer.py
)
Distance Matrix & Freight Calculator:
Computes exact road distances from the farmer's GPS/district to all regional mandis using OpenStreetMap / Haversine road tortuosity calculations.
Supports 4 vehicle fleet profiles:
Pickup Truck (1.5T / ₹16/km)
Tractor Trolley (4.5T / ₹24/km)
Eicher Mini Truck (8.5T / ₹34/km)
Heavy Commercial Truck (22T / ₹54/km)
Net Realization Accounting:
Gross Revenue = Volume (Quintals) × Mandi Price (₹/Quintal)
Logistics Cost = Road Freight + Loading/Unloading Labor + APMC Mandi Cess (1.5%) + Tolls
Net Farmgate Profit = Gross Revenue - Total Logistics Cost
Arbitrage Opportunity Detection: Identifies whether traveling to a higher-paying distant mandi yields net-positive profits after deducting transport fuel and labor.
GeoJSON Price Heatmap: Generates normalized heat weights for Leaflet.js rendering.
3. Database Models & REST API (

backend/api/v1/market.py
&

backend/models/market.py
)
POST /api/v1/market/forecast – 7- to 14-day price forecasting with 95% confidence intervals.
POST /api/v1/market/optimize-profit – Computes nearby mandis, road logistics, and net profit ranking.
GET /api/v1/market/heatmap – GeoJSON FeatureCollection for Leaflet price heatmaps.

@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

@Aditya8369 is attempting to deploy a commit to the Om Roy's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@Aditya8369

Copy link
Copy Markdown
Contributor Author

@omroy07 closes #1884

@omroy07
omroy07 merged commit 48fbe10 into omroy07:main Sep 27, 2026
1 of 4 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congrats @Aditya8369 on getting your PR merged! 🙌
Thanks for the contribution — looking forward to more from you 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Predictive Mandi (Market) Price Intelligence & Net Profit Optimizer - 70

2 participants