Supply Chain & Cold Chain
Post-Harvest Loss Modeling, Cold Chain IoT, and Farm-to-Fork Traceability in India
The 30-40% Problem
India loses 30-40% of its fruit and vegetable production post-harvest. ICAR estimates this at ₹92,000 crore annually — more than the combined capex of all Mega Food Parks sanctioned under PM Kisan SAMPADA. The loss is not uniformly distributed: it spikes at three nodes where temperature, time, and handling quality break down simultaneously — at the farm gate (lack of precooling), at mandi loading/unloading (mechanical damage + delays), and at the retail last mile (inadequate cold storage).
AI supply chain models attack all three nodes, but the highest ROI is at mandi and retail, where data infrastructure already exists (eNAM transaction records, APEDA cold store registrations, 3PL GPS tracking) and where small interventions produce large loss reductions.
Open data/post-harvest-loss-model.csv — it contains loss-rate observations across 18 commodities (tomato, onion, banana, mango, potato, leafy greens, grapes, pomegranate) for 200+ supply chain legs, linked to temperature excursion frequency, transit time, handling score (assessed by field agents), and mandi origin. The target: predict loss rate (% weight loss + quality downgrade rate) for a given shipment configuration before dispatch.
Cold Chain IoT: Sensor Architecture and Anomaly Detection
A modern Indian cold chain instrumentation stack for a Ninjacart or DeHaat refrigerated truck:
| Sensor | Measurement | Placement | Alert Threshold |
|---|---|---|---|
| Wireless temperature logger | Ambient air temp (±0.5°C) | 4 corners of cargo area | >4°C for fresh produce, >-18°C for frozen |
| Product-contact probe | Pulp temperature | Representative cartons | 2°C above ambient setpoint |
| Door open sensor | Binary + duration | Cargo door | >2 min at temperatures >25°C ambient |
| Humidity sensor | RH% | Evaporator coil exit | <85% RH for leafy greens |
| GPS + accelerometer | Location + G-force events | OBD port | G > 2.5g = rough handling event |
| Fuel/compressor current | Refrigeration system health | Power line | Anomalous current draw → compressor fault |
Open data/cold-chain-iot.json — it contains temperature logger data from 500 reefer truck trips across India's major produce corridors: Nashik → Mumbai (onions, grapes), Kolar → Bengaluru (tomatoes), Shimla → Delhi (apples), and Coimbatore → Chennai (bananas). Temperature excursions, door open events, and GPS deviations are labeled. The modeling task: predict delivery quality score (Brix, firmness, color grade) from the IoT trajectory.
Cold chain anomaly detection uses two complementary approaches:
# 1. Rule-based CCP alerts (immediate, interpretable)
def check_temperature_excursion(readings: list[float], ccp_limit: float,
duration_threshold_min: int = 30) -> dict:
consecutive_violations = 0
max_consecutive = 0
for temp in readings: # 5-min interval readings
if temp > ccp_limit:
consecutive_violations += 1
max_consecutive = max(max_consecutive, consecutive_violations)
else:
consecutive_violations = 0
excursion_duration_min = max_consecutive * 5
return {
"excursion": excursion_duration_min > duration_threshold_min,
"max_excursion_min": excursion_duration_min,
"estimated_shelf_life_reduction": excursion_duration_min * 0.8 # hours lost per min excursion
}
# 2. ML-based predictive quality degradation
# XGBoost model trained on historical IoT + quality lab data
# Features: mean_temp, temp_std, max_excursion_min, n_door_opens,
# total_transit_hours, g_force_events, origin_precool_temp
# Target: delivery_quality_score (0-100)Perishable Demand Forecasting
The core challenge in Indian fresh produce forecasting is the interaction between weather-driven supply shocks and elastic urban demand. Onion price in Mumbai has swung from ₹8/kg to ₹120/kg within a single season — a 15x swing that destroys retailer margins and triggers political crises. The forecasting problem has two layers:
Supply forecasting (what will arrive at mandi):
Demand forecasting (what will the terminal market absorb):
Prompt: "Using the attached eNAM arrival and price data [enam-arrivals-2023-24.csv] for onion at
Lasalgaon, Pimpalgaon, and Pune APMCs, and NDVI trend data from Nashik district for the Nov-Jan
Rabi onion season, forecast: (1) weekly arrivals for the next 8 weeks, (2) price range (modal,
low, high) with 80% confidence interval, (3) probability of price spike >₹80/kg, (4) optimal
procurement quantity for a retailer wanting to minimize stockout probability while limiting
cold store inventory to 200 tonnes. Assume current cold store utilization 65%, holding cost
₹2.50/kg/day, and stockout penalty equivalent to 3× margin loss."Farm-to-Fork Traceability: eNAM Integration and Blockchain
FSSAI's Food Safety Mitra scheme and APEDA's TraceNet require batch-level traceability for exports. The technical infrastructure for Indian farm-to-fork traceability is maturing rapidly, anchored on three government systems:
| System | Coverage | Data Available | API Access |
|---|---|---|---|
| eNAM (National Agriculture Market) | 1,100+ mandis, 22 states | Arrival quantity, grade, price, buyer-seller IDs | Open REST API |
| APEDA's TraceNet | Export-oriented horticulture | Farm registration, FPO details, packing house records | Registered user API |
| Horticultural Produce Grading and Marking | Graded produce | Grade, packing date, packing house registration | Inspection records |
| PM Kisan SAMPADA MIDH | Processing units | Plant registration, production capacity | Portal integration |
AI adds value at the data reconciliation layer: matching eNAM lot IDs with cold store inward records (often manual and inconsistent), reconciling weight discrepancies between farm gate and mandi arrival, and flagging lots where origin claims cannot be verified (adulteration risk for GI-tagged products like Alphonso mango or Darjeeling tea).
# Traceability record structure
lot_record = {
"lot_id": "MH_NASHIK_20240315_0042",
"commodity": "onion",
"variety": "N-2-4-1",
"farm_origin": {"village": "Niphad", "tehsil": "Niphad", "district": "Nashik",
"farmer_id": "PM_KISAN_MH_4421982"},
"harvest_date": "2024-03-12",
"enam_transaction": {"mandi_code": "MH001", "arrival_date": "2024-03-14",
"modal_price": 1850, "quantity_kg": 2200, "grade": "A"},
"cold_store_entry": {"store_id": "APEDA_CS_MH_0084", "entry_time": "2024-03-14T16:30:00",
"entry_temp": 2.1, "entry_quality_score": 88},
"iot_telemetry_hash": "sha256:a4f9c2...", # Immutable hash of sensor log
"dispatch": {"destination": "DEL_INA_MARKET", "vehicle": "MH04CG4521",
"dispatch_date": "2024-03-16"}
}Mandi Price Prediction
Mandi price prediction is a high-stakes forecasting problem: FPOs, processors, and large retailers use it for procurement planning; small farmers use it to decide whether to sell immediately or store. The data infrastructure is now sufficient for reliable models:
Features that dominate mandi price prediction (in order of importance from eNAM historical analysis):
Prompt: "I have eNAM transaction data for tomato at Kolar APMC for the past 36 months [attached].
Build a price forecasting model that predicts: (1) next week's modal price with 70/90% PI,
(2) next month's average price, (3) the key drivers of price movement for this week's forecast
(SHAP-based explanation in plain terms for FPO committee members who are not data scientists).
Highlight any model uncertainty flags — periods where the model should not be trusted due to
out-of-distribution conditions like COVID-era lockdowns or floods."Key Takeaways
This is chapter 3 of AI for Food Processing & Agri.
Get the full hands-on course — free during early access. Build the complete system. Your projects become your portfolio.
View course details