End-to-End Field Mapping Wizard (Backend + Frontend)#446
Open
krrishrastogi05 wants to merge 2 commits intofireform-core:mainfrom
Open
End-to-End Field Mapping Wizard (Backend + Frontend)#446krrishrastogi05 wants to merge 2 commits intofireform-core:mainfrom
krrishrastogi05 wants to merge 2 commits intofireform-core:mainfrom
Conversation
…ireform-core#111) Introduce PDFFieldDetector class that parses PDF /Annots annotations to extract interactive form field metadata (name, type, bounding box). Changes: - Add src/field_detector.py with PDFFieldDetector class - Add api/routes/wizard.py with POST /wizard/detect-fields endpoint - Add api/schemas/wizard.py with Pydantic response models - Update src/controller.py to delegate to PDFFieldDetector - Update api/main.py to register wizard router - Add pypdf to requirements.txt (was imported but not listed) - Add tests/test_wizard.py with comprehensive test coverage Supported field types: Text (/Tx), Button (/Btn), Choice (/Ch) Returns structured JSON with field coordinates for frontend rendering. Note: Only digitally created fillable PDFs (AcroForms) are supported. Scanned/image-based PDFs would require OCR as a future enhancement. Closes fireform-core#111 (Phase 1)
…re#111) Add a new 'Field Wizard' tab to the frontend that lets users upload a PDF and instantly see all detected fillable form fields. Changes: - frontend/index.html: Add wizard tab, dropzone, detect button, results area - frontend/styles.css: Color-coded type badges (Text/Button/Choice), field cards, summary bar, loading spinner, responsive layout - frontend/app.js: Wizard file handling, API integration with /wizard/detect-fields, dynamic result rendering grouped by page The UI follows the existing tab-based panel pattern and reuses shared utilities (setStatus, formatBytes, isPdfFile, parseJsonResponse). Depends on: feat/pdf-field-detection-engine (backend PR)
8 tasks
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.
Summary
This PR implements the complete Field Mapping Wizard (#111), enabling users to upload a PDF, automatically detect all form fields, and create a template in a single flow.
It includes:
This reduces template setup time from manual effort (~30 minutes) to a few seconds.
Problem
Creating templates from fillable PDFs currently requires:
This becomes inefficient and error-prone for PDFs with many fields.
Solution
A unified wizard that:
###Screenshots and Videos
Key Features
Backend: Field Detection API
Endpoint:
POST /wizard/detect-fieldsExtracts:
Text,Button,Choice)Returns structured, page-wise metadata
Built using
pypdfExample response:
{ "filename": "fire_response_report.pdf", "total_pages": 1, "total_fields": 50, "pages": [ { "page_number": 1, "fields": [ { "field_name": "Incident_Report_Number", "field_type": "Text", "raw_type": "/Tx", "rect": { "x": 72.0, "y": 660.0, "width": 150.0, "height": 18.0 } } ] } ] }Frontend: Field Wizard UI
One-Click Template Creation
User only needs to submit the form.
Implementation Details
Backend
src/field_detector.py: Field extraction logicsrc/controller.py: Detection integrationapi/routes/wizard.py: API endpointapi/schemas/wizard.py: Response modelstests/test_wizard.py: Test coveragerequirements.txt: AddedpypdfFrontend
frontend/index.html: Wizard UIfrontend/styles.css: Layout and stylingfrontend/app.js: API integration and workflow logicRelation to Existing Code
src/filler.pyLimitations
How to Test
Backend
Run API:
Frontend
cd frontend python -m http.server 5173Open:
http://127.0.0.1:5173Flow:
Future Work
Closes Phase 1 and 2 of #111