Skip to content
JoshuaF-MLPublic

About

Voice-first complaint recorder for a police station front desk (hackathon prototype)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Bayaan (बयान)

A voice-first complaint recorder for the front desk of an Indian police station. The complainant speaks in Hindi or English, in their own words. Bayaan listens, sorts what it hears into fields (who, what, when, where, witnesses, lost property), asks spoken follow-up questions for anything missing, reads the account back so the person can correct it by voice, and lays it out as a draft First Information Report that the officer completes, confirms, prints or saves as PDF.

Built for the Scaler x Wispr Flow "India Runs on Voice" hackathon. This is a working prototype, not a full product. It uses demo data only and is not a real police record.

Live demo: https://joshuaf-ml.github.io/bayaan/ (use made-up details only).

Run it

docker compose up --build

Then open http://localhost:3000. No API keys and no .env file are needed. .env.example only shows the optional PORT setting.

Without Docker: node server.js (Node 18 or newer, no packages to install).

Try it in 30 seconds

  1. Pick हिन्दी or English and click Play demo conversation. A scripted complainant answers in that language. It needs no microphone. Watch the details fill in, the spoken correction ("the bike was black"), and then the officer review screen with the FIR draft.
  2. Or click Start complaint and speak. Chrome or Edge on localhost give you the real microphone flow. If your browser has no speech recognition, type your answers instead.

The voice flow

The screen shows one stage at a time: Statement, Check, then Officer review.

  1. Pick the complainant's language and press Start complaint.
  2. The app asks, in that language: "Please tell me what happened, in your own words."
  3. The complainant speaks. The live transcript appears and the audio is kept.
  4. The words are sorted into fields. Names, numbers, dates and places are kept exactly as spoken and are never guessed.
  5. For each missing field the app asks one spoken question ("What time did this happen?"), ending with phone number, father's or husband's name, and address.
  6. The app reads everything back. The complainant says "yes" or corrects one thing by voice, or presses the large Yes or Change button. Details turn green only after a clear yes. Otherwise they stay amber for the officer to check.
  7. The officer completes the FIR draft, confirms it, and prints it or saves it as a PDF. An edit made after confirming removes the confirmation, so the officer confirms again.

If the app did not hear something clearly, the field stays amber ("not confirmed") and it asks again. If the complainant only says "I do not know", the field is marked "Not provided" and the app moves on.

The FIR draft

The draft follows the national form I.I.F.-I under Section 173 B.N.S.S., in English, using the printed layout of a Madhya Pradesh Police copy checked against the blank national form.

  • Filled from the conversation: place, complainant, mobile, people involved, property and the complainant's own words.
  • A Hindi statement stays in Hindi, word for word: the app does not translate. Form labels and the details it works out (kind of incident, property, dates) are in English.
  • Typed by the officer: station, acts and sections, dates, diary entry, personal details and the action taken. A date and time worked out from the spoken words are offered, never filled silently.
  • Always blank: FIR number, signatures and the court despatch date.
  • Every page is marked Draft. Not registered. Demo. It is not an FIR and cannot register one.
  • To save a PDF, press Save as PDF and pick "Save as PDF" as the printer. Page numbers need a recent Chrome or Edge.

What it does not do

  • It never chooses legal sections. The officer types them.
  • It suggests a kind of incident (for example "Snatching"), and the officer decides.
  • It works in Hindi and English only. Field sorting is rule based, with no language model, so unusual phrasing can be missed; the read-back and the officer check are there to catch that.
  • Speech recognition comes from the browser, so accuracy depends on the browser and the room.
  • The app saves nothing and its server receives no complaint data. Refreshing the page clears everything.
  • It cannot promise that speech stays on the computer. The browser's speech recognition and spoken voices may send audio or text to an online service. Do not enter real complaint details. Typing with Read the questions aloud switched off does not use those speech features.
  • The shield on screen is the app's own mark. Bayaan is not connected to any police force.

What it depends on

Part Used for If it stops
Browser speech recognition (Web Speech API) Turning speech into text Typing and the demo still work
Browser speech synthesis The app speaking its questions The questions are still shown as text
Browser audio recording (MediaRecorder) Keeping the audio for each answer Text is still kept

No paid service or key is used. A production version would swap in a hosted Indian-language speech model (for example Bhashini or a self-hosted Whisper) behind the same two functions.

Project layout

server.js            tiny static server, no dependencies
public/index.html    start, statement, check and officer review screens
public/app.js        voice flow, fields, report, audio
public/extract.js    rule-based field extractor (also runs in Node for tests)
public/fir.js        FIR draft layout and mapping
public/style.css
test/extract.test.js
test/fir.test.js
test/hindi.test.js
test/server.test.js
Dockerfile, docker-compose.yml, .env.example

Tests

node --test

Licence

MIT. See LICENSE.

About

Voice-first complaint recorder for a police station front desk (hackathon prototype)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages