MandiIQ
MandiIQ - Mandi Price Intelligence System v1.0

Rainfall crosses −19% →
onion prices show no jump (p = 0.28)

Automated causal inference + predictive ML + prescriptive recommendations + AI orchestration on Indian mandi prices. Data sourced daily from data.gov.in and IMD rainfall records. RDD cutoff at −19% rainfall deficiency (official IMD classification) returns +₹101, p = 0.28 on the current warehouse - no statistically significant discontinuity, and the 30-specification curve agrees (0/30 significant, verdict fragile). Fully automated, nightly, zero manual intervention. Powered by OpenRouter free-tier multi-model AI routing. Ask MandiIQ →

Regression Discontinuity Causal Inference DuckDB FastAPI XGBoost Prophet OpenRouter

The Rainfall-Deficiency Cliff

Average onion modal price (₹/quintal) by rainfall departure from normal. The −19% threshold is IMD's official classification for "deficient" rainfall - and on the current warehouse the live estimate there is +₹101 with p = 0.28: no statistically significant jump, with 0 of 30 specifications significant.

⚠ No sig. jump: ₹101 Cutoff: −19% ₹2,000 ₹1,600 ₹1,200 ₹800 −40% −30% −10% 0% +10% Avg Modal Price (₹/qtl) Rainfall Departure from Normal (%) p = 0.277 not significant Normal rainfall Deficient

Headline Findings

Finding Detail
RDD discontinuity effect (Onion at −19% cutoff)+₹101 (p = 0.28) - not significant
Specification curve (30 combos)0 / 30 significant - verdict: fragile
BH-FDR across commodity fits0 survivors after correction
Bandwidth sensitivity (15–30%)+₹81…+₹101, p = 0.42…0.27 - null in every window
Placebo tests (fake cutoffs)3 of 4 null; one spurious jump at −37%
McCrary density testNot available on the current warehouse
Covariate balancelog(observations) p = 0.04 - not clean
Forecast MAPE (Prophet winner)served by 2.4.0
Classifier ROC-AUCserved by 2.4.0
Data sourcesdata.gov.in + IMD rainfall
AI OrchestratorOpenRouter free-tier routing
Pipeline freshnessContinuous - container every 30 min, externally verified every 15

Reading the findings from the API...

Statistical Robustness Checks

Every RDD estimate is tested against the full battery before it reaches the dashboard. These are the live results, including the ones that cut against the finding.

Bandwidth Sensitivity
⚠ Null at 15 / 20 / 25 / 30
Point estimate stays positive (+₹81 … +₹101) but p ranges 0.42 … 0.27 - not significant in any window.
Placebo / Falsification
⚠ 1 of 4 spurious at −37%
Three fake cutoffs are null, but the −37% placebo returns a significant +₹297 (p = 0.006) - single-cutoff evidence is thin.
Specification Curve
⚠ Fragile (0 / 30)
Across bandwidth × kernel × polynomial combinations, 0 of 30 estimates are significant; median +₹50, sign not stable. Verdict: fragile.
Covariate Balance
⚠ Not clean
log(observations) jumps at the cutoff (p = 0.04), so a clean pre-treatment balance cannot be claimed.

Ask MandiIQ

Ask free-text procurement questions in plain English. The AI orchestrator routes across multiple free-tier OpenRouter models with automatic circuit-breaker fallback - if one model is rate-limited, the next in the chain serves the request. Answers are grounded in live tool-call results (never fabricated).

$ curl -X POST https://your-api.onrender.com/ask \
$ -H 'Content-Type: application/json' \
$ -d '{"query": "Should I lock in onion procurement in Nashik next month?", "commodity": "Onion", "district": "Nashik"}'
// Response (grounded, never fabricated):
{
  "answer": "MODERATE RISK (32%): The rainfall-threshold discontinuity is not significant on the current warehouse (+₹101, p = 0.28). Spike risk comes from the forecast and volatility stack; consider staggering procurement.",
  "model_used": "google/gemini-2.0-flash-exp:free",
  "endpoints_used": ["get_rdd_result", "get_forecast", "get_risk_score"]
}
⚡ Model auto-selected by circuit breaker · Tool-grounded

Architecture Flow

An automated ELT pipeline ingests live mandi prices and rainfall data, runs causal RDD analysis + ML forecasts, serves results through a FastAPI gateway, and renders them in an interactive Streamlit dashboard.

%%{init: {"theme": "dark", "themeVariables": { "primaryColor": "#1a1a2e", "primaryTextColor": "#fff", "lineColor": "#d7ff00", "secondaryColor": "#16213e", "tertiaryColor": "#0f3460"}}}%%
flowchart LR
    A["data.gov.in
Mandi Prices"] B["IMD Rainfall
Monthly Grids"] C["Ingestion
Pagination + Retry"] D["DuckDB
Analytical Store"] E["RDD Engine
Causal Inference"] F["ML Pipeline
XGBoost + Prophet"] G["Prescriptive
Procurement Advice"] H["FastAPI Gateway
10 Endpoints"] I["Streamlit Dashboard
5 Interactive Pages"] J["AI Orchestrator
Multi-model Router"] A --> C B --> C C --> D D --> E D --> F E --> G F --> G G --> H H --> I H --> J J --> I