Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Mandi Fair Price Guardian

Razorpay AI Buildathon — Open Track submission

A voice-first negotiation co-pilot for farmers. It doesn't just show a price on a dashboard — it helps a farmer in the exact moment a trader is lowballing them, tracks traders who do this repeatedly, and turns that evidence into an actionable complaint report.

The problem

Small farmers routinely get paid 30–50% less than fair mandi price because a trader offers a price on the spot, with a truck waiting, and the farmer has no way to check or push back in that moment. Existing price-transparency apps (eNAM, Kisan Suvidha) fail in practice because farmers don't check them at the moment of sale — and even when a farmer is shortchanged, there's no record and no consequence for the trader.

What this builds

One pipeline, three outputs, all from the same transaction dataset:

  1. Live advice — farmer describes the offer (voice, Hinglish), agent replies with the fair price and an exact counter-offer line to say out loud.
  2. Pattern detection — flags traders who repeatedly underpay (3+ incidents) and detects timing patterns (e.g. certain weekdays with worse pricing).
  3. Accountability report — auto-generates a formal complaint report for a flagged trader, ready to send to an FPO / mandi committee.
  4. Evidence of value — measured across a 45-transaction simulated batch: underpayment rate, average ₹/kg recoverable, and flagged trader list.

Repo structure

mandi-guardian/
├── data/
│   └── generate_dataset.py    # generates the simulated transaction dataset
│   └── transactions.csv       # 45 simulated mandi transactions
├── analysis/
│   └── analyze.py             # scoring + pattern detection + evidence metrics
│   └── summary.json           # output of the analysis
├── app/
│   └── index.html             # the interactive demo (open directly in a browser)
└── README.md

Running it

  1. Regenerate the dataset (optional, already included):
    python3 data/generate_dataset.py
    
  2. Run the analysis:
    python3 analysis/analyze.py
    
  3. Open the demo: just open app/index.html in any browser. No build step, no server needed.

Notes on the LLM integration

The demo calls the Anthropic API (claude-sonnet-4-6) directly from the browser for two things: drafting the live Hinglish negotiation advice, and drafting the formal complaint report. If you're running this outside the Claude preview environment, you'll need to either:

  • Swap in your own API key and proxy the request through a small backend (recommended — never expose a raw API key in client-side JS in production), or
  • Use a free-tier LLM (Groq, for example) with the same prompt structure.

Both fallback templates are included in the code so the demo still works end-to-end even without a live LLM call.

Data sources — what's real vs simulated

Being upfront about this matters for the pitch:

  • Fair prices for 10 transactions are REAL — sourced from Agmarknet (data.gov.in), the Government of India's official daily mandi price reporting portal. These are actual modal (most common) prices reported by real APMC markets in Karnataka in late August 2026: Gowribidanoor APMC, Ramanagara APMC, Mysore (Bandipalya) APMC, Shimoga APMC, Davangere APMC, Bangarpet APMC, Kolar APMC, and T. Narasipura APMC. See data/generate_real_transactions.py for the exact sourced values and dates.
  • Fair prices for the other 45 transactions are simulated — generated to give the pattern-detection engine enough sample size to demonstrate repeat-offender detection.
  • The "offered price" for every transaction is simulated, real or not — this is intentional and unavoidable: no public dataset anywhere records what individual traders privately offer individual farmers. That data only exists if farmers report it themselves, which is exactly the gap this product is meant to eventually fill (real farmer-reported offers, over time, would replace this simulated field).

This is disclosed directly in the app (each transaction is tagged "✓ REAL PRICE" or "simulated") and should be stated plainly in the pitch — don't imply the offered-price side is real.

Evidence (from the combined dataset)

  • 55 transactions total: 10 anchored to real Agmarknet prices, 45 simulated
  • 43.6% of transactions were underpaid by more than 15%
  • 2 traders automatically flagged as repeat offenders (11/11 underpaid transactions each)
  • Timing pattern detected: Thursdays and Tuesdays show the highest underpayment rate

What broke / what we'd improve with more time

  • The current dataset is simulated, not scraped from real eNAM/mandi records — a production version would pull live daily prices.
  • The demo uses browser speech synthesis for output; real voice input transcription (Hinglish speech-to-text) would need a proper STT pipeline (e.g. Whisper), not built here due to time constraints.
  • Collective bargaining (pooling multiple farmers hit by the same trader on the same day) was considered but scoped out to keep the core pipeline tight and demo-able in time.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages