About
## The problem it solves
Here is a clean, submission-ready **Idea Description** in Markdown for **DukaanIQ**:
---
### DukaanIQ — *Your Shop. Your Language. Your Voice.*
#### The Problem
India's 12+ million neighborhood kirana stores run on fast, informal, multilingual conversations — mixing **English, Hindi, Bengali, Hinglish, and Benglish** — yet most retail software is built around complex English-only forms, manual barcode typing, and desktop-first workflows. As a result, shopkeepers still rely on paper *kaccha* ledgers, lose money to unnoticed wholesale price hikes and expiring stock, miss out on better wholesaler deals, and struggle to track daily *udhar* (credit) and UPI collections.
#### Our Solution
**DukaanIQ** is a voice-first, bilingual **Kirana Shop Operating System & B2B Dealer Network** that lets shopkeepers run their entire store simply by speaking or snapping a photo in their own language.
#### Key Capabilities
1. **5-Language Voice & AI Intelligence Hub (`Qwen4-Max` + `Gemini 2.5 Flash` + Fast Parser):** - Speak or type naturally in **English, हिन्दी, বাংলা, Hinglish, or Benglish**. - Live speech streaming auto-sends queries and speaks answers back aloud (Google-Assistant style), with a **10-second Undo window** and explicit confirmation cards before any financial write. 2. **Smart Bill Scanner (Live Back/Front Camera + Upload OCR):** - Snap a photo of handwritten wholesale *parchis* or upload distributor GST invoices to extract items, quantities, cost/unit, and retail prices into editable rows, then stock inventory and update the ledger in one tap. 3. **Voice Udhar & Khata:** - Record customer credit by voice (*"Rahim ko 250 rupaye udhar likho"*), send 1-tap WhatsApp UPI payment reminders, record repayments, and manage or remove customer entries cleanly. 4. **Expiry Rescue & Barcode/Expiry OCR:** - Scan product barcodes and expiry labels using the device's back camera, track batches early, and generate BOGO or clearance discount offers before stock expires. 5. **Nearby Suppliers & Fair Wholesale Offer Comparison:** - Discover nearby wholesalers by GPS, area, or PIN code and compare true landed cost using `Net Cost = (Qty × Rate) − Supplier Offer Discount + Delivery Charge`, with 1-tap restock orders. 6. **Live UPI Soundbox & Hisab-Kitab Ledger:** - Real-time cash/UPI/udhar ledger with CSV export, daily profit/loss alerts, missed-demand tracking, and a live Soundbox that announces today's actual UPI collections in the shopkeeper's chosen language. 7. **B2B Dealer Portal:** - Dedicated portal for wholesale distributors to manage incoming kirana restock requests, update SKU stock and wholesale rates, broadcast price-drop alerts, and connect with nearby shops.
#### Tech Stack
* **Frontend:** Responsive HTML/Tailwind CSS/JavaScript (mobile drawer + desktop workspace) deployed on **Vercel** * **Backend:** **FastAPI** (Python, Controller → Service → Repository architecture) + **Alembic** migrations deployed via Docker on **Railway** * **Database:** **PostgreSQL** (Railway) in production / **SQLite** locally with multi-tenant `shop_id` isolation * **AI & Vision:** **Qwen4-Max** (primary intent & Q&A), **Gemini 2.5 Flash** (Vision OCR, audio transcription & fallback), plus a deterministic 5-language offline parser & Browser Web Speech API (`SpeechRecognition` + `SpeechSynthesis`)
## Challenges we ran into
Here is a ready-to-use **Challenges we ran into** section in Markdown, based directly on the real bugs and engineering hurdles we solved while building **DukaanIQ**:
---
### Challenges We Ran Into
#### 1. Multilingual NLP & Number-Word Collisions Across 5 Indian Languages * **The Hurdle:** Supporting **English, Hindi (Devanagari), Bengali, Hinglish, and Benglish** meant everyday retail speech frequently collided with parser rules. For example, the Hindi verb *"do"* (meaning *"please give"*) was misparsed as the number `2`, standard `\b` regex word boundaries failed on Devanagari and Bengali scripts (`राहुल ने`, `রহিম ২০০`), and conversational filler phrases (*"Ek customer Dove Shampoo mang raha tha par stock mein nahi tha"*) leaked into extracted product names. * **How We Got Over It:** We added context-aware lookahead checks in `backend/app/utils/number_words.py` (only converting `"do"` when followed by a unit, multiplier, or currency), replaced `\b` boundaries with Unicode-safe `(?=\s|$)` lookaheads and script-aware name extractors in `backend/app/integrations/gemini.py`, and validated the full pipeline with a **14,874-question stress test** (100% pass) alongside `pytest`.
#### 2. SQLite vs. PostgreSQL Migration Dialect Mismatch on Railway * **The Hurdle:** Local development ran smoothly on SQLite (`dukaaniq.db`), which silently accepts integer defaults (`1`/`0`) for boolean columns. When deploying to **Railway Managed PostgreSQL**, Alembic migration `44615e3beb4d` crashed with: `column "delivery_available" is of type boolean but default expression is of type integer` (`ALTER TABLE sellers ADD COLUMN delivery_available BOOLEAN DEFAULT 1 NOT NULL`). Additionally, Railway injects `DATABASE_URL` with a `postgres://` prefix, which SQLAlchemy with `psycopg` rejects. * **How We Got Over It:** We added a Pydantic `field_validator` in `backend/app/core/config.py` to normalize `postgres://` and `postgresql://` to `postgresql+psycopg://`, audited all 5 Alembic migrations, updated `delivery_available`, `is_verified`, and `is_demo` to use PostgreSQL-safe `sa.text('true')` / `sa.text('false')` (and `server_default=text("true")` / `text("false")` in `models.py`), and verified the generated DDL using `alembic upgrade head --sql`.
#### 3. Vercel Monorepo Framework Auto-Detection (`FASTAPI_ENTRYPOINT_NOT_FOUND`) * **The Hurdle:** Because the repository contains both the static `frontend/` and the FastAPI `backend/` (with `requirements.txt`), Vercel auto-detected `fastapi` and failed frontend deployments looking for a Python entrypoint. * **How We Got Over It:** We explicitly disabled framework auto-detection with `"framework": null`, `"buildCommand": ""`, and `"outputDirectory": "frontend"` in `vercel.json` (plus a dedicated `frontend/vercel.json`) so Vercel cleanly serves the static frontend while Railway hosts the FastAPI container.
#### 4. Making Browser Voice Assistant & Bill OCR Reliable for Live Demos * **The Hurdle:** Initially, clicking the mic didn't stream live interim words or auto-send/auto-speak like a real voice assistant; `SpeechSynthesis` tripped on emojis and `₹` symbols in `hi-IN`/`bn-IN` voices; the Soundbox had a hardcoded `₹250` announcement; and when the frontend ran standalone without a connected backend URL, pages spammed `"Request failed"` toasts and repeated a generic `"DukaanIQ shop data sync kar raha hai"` message. * **How We Got Over It:** We built `prepareTextForSpeech()` and `resolveTtsLocale()` for clear 5-language TTS, wired the Soundbox to live `upi_today_paise` from `/api/v1/dashboard/summary`, upgraded `toggleVoiceInput()` and `recordVoiceKhata()` to stream `interimResults` with auto-send + auto-speak (and `/api/v1/voice/transcribe` fallback), added live Back/Front camera capture + client-side OCR fallback for any uploaded grocery bill, replaced all browser `alert()`/`prompt()`/`confirm()` dialogs with keyboard-accessible in-app modals, and added a 5-language `project_knowledge.py` + demo fallback in `expiry-supplier-workflow.js`.
#### 5. AI Safety, Prompt Injection & Offline Latency Stalls * **The Hurdle:** Unfiltered inputs allowed prompt-injection strings to trigger `ADD_UDHAR` drafts, contradictory payment modes (*"cash sale on credit"*) weren't caught, raw user text risked XSS in chat bubbles, and default retries on the Qwen client caused ~2.7s stalls when offline. * **How We Got Over It:** We added pre-intent security, empty-input, and contradictory-payment guards in `gemini.py` and `voice_service.py`, added `escHtml()` XSS sanitization in `shopkeeper.html`, enforced explicit confirmation cards with a 10-second Undo window before financial writes, and configured `max_retries=0, timeout=6.0` on the Qwen client so deterministic fallbacks respond in milliseconds.
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.





