feat: complete frontend UI batch filling, voice transcription & multilingual support#309
Open
utkarshqz wants to merge 3 commits intofireform-core:mainfrom
Open
feat: complete frontend UI batch filling, voice transcription & multilingual support#309utkarshqz wants to merge 3 commits intofireform-core:mainfrom
utkarshqz wants to merge 3 commits intofireform-core:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
FireForm had a working backend — FastAPI endpoints, Ollama integration, PDF filling logic — but no frontend to use any of it. Officers had no way to interact with the system without writing raw API calls. This PR builds the complete interface that makes FireForm actually usable, and fixes the core extraction pipeline that was producing wrong results.
1. Complete Frontend UI
A full interface for FireForm's existing API — dark/light theme toggle, animated logo, drag-and-drop PDF upload, real-time API health indicator, session history, and responsive layout for station desk use.
SINGLE mode — select one template, describe the incident, download the filled PDF.
BATCH mode — check multiple agency templates, one transcript fills all simultaneously. Partial failures never abort the batch — each template result is independent.
Addresses: #1 #160 #173 #162
Fixes: #165 #205
2. O(M*N) → O(1) LLM Extraction
N : fields
M : Batch(multiple templates)
The original codebase called Ollama once per form field. Seven fields meant seven sequential blocking calls, ~35 seconds of wait, and hallucinations on two of seven fields. The model kept repeating the same answer because it received the same meaningless prompt seven times with no form context.
We replaced this with a single batch prompt. All fields sent simultaneously. Mistral sees the complete form structure and returns one JSON object.
Address: #69 raised by @shreyanshjain05
Fixes: #102 raised by @Acuspeedster
3. Batch Multi-Template Filling
POST /forms/fill/batch— one transcript fills every agency form simultaneously. Field discovery is dynamic: reads actual PDF annotation keys from the database. No hardcoded field lists. Works with any PDF from any agency, any country, without configuration.For five templates: one LLM call total.
Fixes: #156 raised by @Acuspeedster
Fixes: #235
4. Lightweight PDF Field Extraction
PDF annotation reading via pypdf replaces vision-model parsing. Reads
/TU(tooltip) and/T(technical name) from PDF annotations. Mistral receives"Full Name"instead of"textbox_0_0". Extraction accuracy improved without any model change.5. Voice Transcription & Multilingual Support
Voice recording built directly into the transcript area. Officer records, stops, clicks Transcribe — transcript auto-fills into the textarea.
Multilingual: Auto-detects language. Works for non-English agencies — French, Spanish, Hindi, Arabic and 90+ languages supported natively. No configuration required.
Addresses: #44 raised by @pigeio
6. Schema Validation & Hallucination Detection
Field-level validation: phone format, email format, date format. Hallucination guard: same value appearing in 3+ different fields triggers rejection. Length guard: 500 character limit per field.
Fixes: #114
7. Checkbox & Radio Button Support
PDF checkboxes require PdfName values (
/Yes,/Off) not strings. Old code wrote"yes"as a plain string — field stayed visually empty with no error. Fix reads the PDF's own appearance stream (AP.N) to find the exact on-state name per form. Works with any PDF. Properly handles grouped radio buttons with nested annotation structures, which often break when fields are treated as a flat list.Fixes: #229
8. Progress Logging & Timeout Hardening
[LOG]per-field output with elapsed time.OLLAMA_TIMEOUTenvironment variable (default 120s). Explicit timeout error handling with clear error message.Fixes: #68 #132
9. Test Suite — 70 Passing
Complete replacement of broken test suite. In-memory SQLite, proper fixtures, real HTTP client, no mocked path validation.
Fixes: #163 #182 #183 #186
Future Direction
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: