-
Notifications
You must be signed in to change notification settings - Fork 113
Description
📝 Description
FireForm currently fills text-based PDF fields correctly but provides no support for checkbox or radio button field types. These fields are left blank in the output PDF regardless of what the LLM extracts from the transcript.
This is a gap in the core PDF filling pipeline — the extraction layer already works correctly, making this a targeted and isolated fix in src/filler.py.
💡 Rationale
Emergency response forms commonly include checkbox and radio button fields — for example:
- "Was medical assistance required?" → checkbox
- "Incident type: Fire / Medical / Hazmat" → radio button
Leaving these blank produces incomplete, unusable output PDFs that fail real-world filing requirements. Fixing this is essential for FireForm to serve its stated purpose of automating form completion for firefighters and emergency responders.
🛠️ Proposed Solution
In src/filler.py, add field-type detection and value mapping for /Btn field types:
# Detect field type
field_type = field.get("/FT")
if field_type == "/Btn":
# Map extracted string value to PDF boolean value
val = str(value).strip().lower()
if val in ("yes", "true", "1", "checked"):
field.update(pdfrw.PdfDict(V=pdfrw.PdfName("Yes"), AS=pdfrw.PdfName("Yes")))
else:
field.update(pdfrw.PdfDict(V=pdfrw.PdfName("Off"), AS=pdfrw.PdfName("Off")))✅ Acceptance Criteria
- Checkbox fields correctly set to
/Yesor/Offbased on transcript content - Radio button group selections correctly applied
- Existing text field behavior is completely unchanged
- Unit tests cover checkbox (
/Yes) and checkbox (/Off) cases - Unit tests cover radio button selection
📌 Additional Context
- The LLM extraction layer (
src/llm.py) already extracts boolean and choice values correctly — this issue is purely afiller.pymapping problem pdfrwsupports/Btnfield type natively — no new dependencies required- Related to the broader goal of full PDF field type coverage