Hackathon Submission – E‑Mitra (ई‑मित्र)

Inspiration

  • Migrant workers in Delhi face fragmented information about labour rights, welfare schemes, and local offices.
  • The COVID‑19 pandemic highlighted the need for a trusted, always‑available digital assistant that can speak the worker’s language and guide them through complex regulations.
  • We wanted to empower workers with instant, conversational access to legal statutes, wage rules, and nearby labour offices.

What it does

  • Multilingual conversational assistant (English + Hindi) that answers labour‑law queries using a Retrieval‑Augmented Generation (RAG) pipeline.
  • Geolocation‑aware routing – when location is allowed, it auto‑detects the nearest district office; otherwise it gracefully asks the user for their district.
  • Voice‑first UI – press‑to‑talk for hands‑free interaction, with real‑time transcription.
  • Secure API – JWT authentication, rate‑limiting, Helmet headers, and Zod validation protect the backend.
  • Offline fallback – static fixtures provide answers when Elasticsearch is unavailable.

How we built it

  • Frontend: React (Vite) with a minimalist UI, dark/light mode toggle, and a voice recorder component. State is managed with React hooks; API calls use fetch with a conditional payload to avoid sending null values.
  • Backend: Node / Express server, JWT‑protected routes, Zod schemas for strict request validation, and express-rate-limit throttling.
  • Search & RAG: Elasticsearch stores statutes, schemes, and district‑office data. Vectors are generated via Gemini embeddings; the chat route builds a context‑rich prompt and asks Gemini to return a JSON‑structured answer.
  • LLM integration: Gemini is used for language detection, translation, embedding generation, and final answer synthesis.
  • Security: Helmet CSP, compression, input sanitisation, and audit logging (fire‑and‑forget) ensure data privacy and resilience.

Challenges we ran into

  • Zod schema mismatches when the frontend sent { lat: null, lon: null }; fixed by sending only defined fields.
  • Geolocation denial – required a conversational fallback that still respects privacy while prompting the user for their district.
  • Prompt brittleness – Gemini sometimes wrapped JSON in backticks; added robust parsing and a clean‑up step.
  • Multilingual consistency – ensuring Hindi answers used common, worker‑friendly terminology rather than formal Sanskritized Hindi.

Accomplishments we’re proud of

  • End‑to‑end voice‑enabled chat that seamlessly switches between English and Hindi.
  • Dynamic office routing that works with both GPS coordinates and user‑provided district names.
  • Hardened security stack (CORS, Helmet, rate limiting, JWT) while keeping the demo lightweight for a hackathon.
  • Fully responsive UI with dark/light mode toggle and a polished micro‑animation for the microphone button.

What we learned

  • LLM‑centric design: prompting strategies and strict JSON schemas are essential for reliable integration.
  • Security‑first mindset: even in a demo, applying OWASP best practices avoids needless vulnerabilities.
  • User‑centric fallback flows – gracefully handling denied permissions preserves trust and improves experience.
  • Rapid prototyping: combining Vite, Elasticsearch, and Gemini allowed us to iterate within days.

What’s next for E‑Mitra

  • Expand the knowledge base to cover other Indian states and central labour laws.
  • Add offline caching of recent queries for low‑connectivity scenarios.
  • Introduce a progressive web‑app (PWA) install flow for easy access on feature phones.
  • Refine district‑detection with fuzzy matching and ML‑based location inference.
  • Open‑source the project and encourage community contributions via a public GitHub repo.
Share this project:

Updates

Submission history