This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
What I Built
In Pakistan and across South Asia, millions of micro-entrepreneurs, home bakers, and boutique craftspeople run their entire commercial life over WhatsApp. While WhatsApp is frictionless for customers, it creates operational chaos for sellers:
- Orders arrive in mixed Roman Urdu, English, and Urdu ("bhai 2 nahi 3 chocolate cake kardo").
- Customers amend orders, cancel mid-conversation, or omit delivery addresses.
- Payments arrive as bank transfer screenshot slips (Easypaisa, JazzCash, SadaPay, Nayapay, or IBFT bank slips).
- Sellers are frequently targeted with short payments, recycled duplicate transaction slips, or illegible blurry receipts.
Every evening, exhausted sellers spend 2 to 3 hours manually matching messages against screenshots, doing mental math, and handwriting dispatch sheets.
Hisaab (حساب) automates this entire headache.
Hisaab is an intelligent order reconciliation and payment verification engine built around Gemma 4 open-weight models. Sellers simply upload their exported WhatsApp chat (or directly paste copied text) along with payment screenshots and their price catalog.
Hisaab:
- Parses Conversational Chaos: Resolves multi-line Roman Urdu chat history, cancellations, and order modifications.
- Reads Payment Receipts with Vision OCR: Extracts amounts, transaction IDs, timestamps, and confidence scores from payment screenshots.
-
Applies Deterministic Math: Prices items using name and Roman Urdu alias matching (
reconcile.ts). The model is never allowed to hallucinate arithmetic. -
Flags 8 Critical Discrepancies: Highlights short payments (
SHORT_PAYMENT), duplicate transaction IDs (DUPLICATE_TXN), missing addresses (MISSING_ADDRESS), unread receipts (LOW_CONFIDENCE), and unpaid orders with red warning chips. - Drafts Polite WhatsApp Replies: Generates courteous Roman Urdu customer messages ("Salam Bilal bhai, aap k order k hawalay se...") with a 1-click clipboard copy button.
-
Exports Verified Kitchen & Dispatch Sheets: Exports
orders.csv(delivery details) andpick-list.csv(kitchen production totals) into a verified.zipbundle.
The core philosophy: AI extracts and assists; deterministic code calculates; the human seller approves.
Demo
- Live Web App: https://hack-day-2026-disrupt.vercel.app/
- Development Preview: https://hack-day-2026-disrupt.vercel.app/
Try the built-in 1-Click Sample Dataset on Step 1 to instantly see Hisaab reconcile a 3-day bakery dataset with 7 orders, 5 receipts, and 6 planted real-world edge cases!
Code
urooj-irfan02
/
Hack-Day-2026-Disrupt
Hack-Day-2026-Disrupt
Hisaab (حساب)
Your WhatsApp chaos, reconciled.
Hisaab is an intelligent order reconciliation and payment verification engine designed for Pakistani home businesses, bakeries, and social commerce sellers operating over WhatsApp.
Upload an exported WhatsApp chat (.txt) alongside payment receipts / screenshots. Hisaab parses multi-line Roman Urdu conversations, reads payment slips with Gemma vision OCR, deterministically matches catalog pricing, flags discrepancies (short payments, duplicate transaction IDs, missing delivery addresses, unreadable slips), and exports clean, verified CSV sheets for fulfillment.
The seller stays in total control: the model assists, deterministic code calculates, and the seller approves everything.
⚡ The 8 Hard Rules
-
Gemma Only: Every AI API call goes through ONE file (
server/gemma.ts). The model is a single constant:process.env.GEMMA_MODEL ?? "gemma-4-26b-a4b-it". Zerogemini-*models are used anywhere in the codebase. - Deterministic Arithmetic: All arithmetic, price lookups, matching, and flagging are executed in pure, deterministic code…
- License: Apache-2.0
- Test Suite: 28 automated tests covering chat parsing, Gemma order extraction, receipt vision OCR, catalog alias matching, and flag detection.
How I Built It
Hisaab was constructed with TypeScript, Node.js, Express, React (Vite), Tailwind CSS, Zod, and Google's open-weights Gemma models (gemma-4-26b-a4b-it and gemma-4-31b-it).
1. The Strict 8 Hard Rules
To prevent AI slop, hallucinations, and reliability failures, Hisaab enforces 8 non-negotiable architectural constraints:
-
Gemma Only: Every AI call funnels through a single gateway file (
server/gemma.ts) callingprocess.env.GEMMA_MODEL ?? "gemma-4-26b-a4b-it". Zero closed models. -
Deterministic Arithmetic: The model never calculates financial totals. Calculations and catalog lookups are handled strictly in deterministic code (
server/reconcile.ts). - Zod Validation & Auto-Retry: Every model response is strictly parsed against typed Zod schemas. If validation fails, Hisaab automatically retries once with the validation error fed back into the prompt before marking items for manual review.
- Seller Approval Guard: Nothing can be exported until the human seller inspects and checks rows in the UI.
-
Deterministic Offline Replay Mode: Every prompt, input, and model output is cryptographically hashed with SHA-256 and stored in
cache/*.json. RunningREPLAY=1allows the entire engine to run 100% offline with zero network requests. - Synthetic Privacy: Zero real customer data.
- Advisory Verification: The app never claims a screenshot represents real bank deposits; it verifies consistency and reminds sellers to check their banking apps.
- Clipboard Only: Replies are copied to clipboard; Hisaab never sends messages automatically.
2. Multi-Stage Pipeline Architecture
[ Chat (File / Paste) + Receipts + Catalog ]
│
▼
- parser.ts Android 24h/12h & iOS regex parser │ ▼
- extractOrders (Gemma) Sliding window chunks (40 msgs + 5 overlap) │ ▼
- readPayment (Gemma Vision) Slip OCR, txnId extraction & confidence │ ▼
- reconcile.ts (Code) Deterministic Roman Urdu alias matching & flags ┌──────────┴──────────┐ ▼ ▼
- draftReply (Gemma) 6. export.ts Polite Roman Urdu orders.csv & pick-list.csv
Why Does Open Innovation Matter?
Open innovation and open-weight models like Gemma fundamentally change the economics and ethics of software for small businesses:
- Local Privacy for Sensitive Financials: Micro-merchants deal with private customer addresses, phone numbers, and bank slips. Open-weight models empower developers to deploy locally or on private sovereign cloud runtimes without piping sensitive neighborhood trade data into closed proprietary silos.
-
Deterministic Reproducibility (Replay Mode): Closed APIs change versions, deprecate behavior, or alter response styles without notice. Because Gemma's weights are open and transparent, we can pair it with our SHA-256 caching architecture (
REPLAY=1) to deliver guaranteed, reproducible unit testing and auditability. - Cultural & Multilingual Fluency: Emerging markets communicate in colloquial linguistic code-switching (Roman Urdu, Hinglish, Singlish). Open models enable transparent experimentation with culturally tuned prompts and domain-specific fine-tuning that generic corporate closed APIs often overlook.
- Zero Vendor Lock-In: Running an open-source model under the Apache-2.0 license means community developers, local agencies, and sellers own their tech stack forever.
The Lazy Payoff
Before Hisaab, a Pakistani home-baking seller handling 30 orders a week had to:
- Scroll through 400+ WhatsApp messages across multiple chat threads.
- Re-read messages to verify if "2 nahi 3 kardo" was acknowledged.
- Cross-reference gallery screenshots with mobile banking apps to catch duplicate receipts.
- Hand-write a kitchen baking list and delivery rider tags. Average time spent: 12 to 14 hours per week, with frequent costly errors (baked wrong quantities or delivered unpaid cakes).
With Hisaab:
- The seller clicks 1-Click Load or pastes the chat.
- In under 15 seconds, Gemma and the deterministic reconciliation engine parse the entire chat, OCR the slips, and flag discrepancies.
- The seller reviews the red chips, copies drafted polite inquiries for short payments, clicks Approve, and downloads
orders.csvandpick-list.csv.
Total time: 2 minutes. That’s over 10 hours of manual data entry saved every single week!
Prize Categories
-
Google / Gemma Category: Built entirely with open-weight Gemma models (
gemma-4-26b-a4b-itandgemma-4-31b-it) across both text comprehension and vision OCR tasks, backed by an offline Replay engine. - General / Open-Source AI Track: Fully open-source project released under the Apache-2.0 license with zero proprietary closed model dependencies.
Acknowledgments & Setup
To run Hisaab locally:
bash
git clone https://github.com/urooj-irfan02/Hack-Day-2026.git
cd Hack-Day-2026
npm install
REPLAY=1 npm run dev # Run 100% offline!
Top comments (0)