Skip to content

[REFACTOR]: Store pre-loaded fillable PDFs in src/templates/ and outputs in src/outputs/Β #236

@utkarshqz

Description

@utkarshqz

πŸ“ Description

Currently, FireForm requires users to upload a PDF via the API every session before they can fill any form. There is no persistent template storage β€” PDFs are saved to arbitrary paths and referenced by absolute path in the database.

This is a significant usability gap. In real operational use, a fire department uses the same 2–3 PDF templates repeatedly. Requiring re-upload every time creates unnecessary friction and is the root cause of the stale path bug.

πŸ’‘ Rationale

Introducing a structured directory convention solves multiple problems simultaneously:

  • Eliminates repeated PDF uploads for known agency templates
  • Enables batch multi-template filling β€” one transcript can fill Police, Fire, and Ambulance PDFs simultaneously
  • Fixes stale absolute path bug β€” relative paths from project root are stable across machines
  • Enables department profile system β€” profiles map departments to their pre-loaded templates
  • Onboarding β€” gives new contributors a clear, documented place to add their own fillable PDFs

πŸ› οΈ Proposed Solution

Introduce the following directory structure:

src/
  templates/          ← pre-stored fillable PDF templates
    fire_dept.pdf
    ambulance.pdf
    police.pdf
  outputs/            ← generated filled PDFs (gitignored)
    fire_dept_john_smith_2026-03-12.pdf
    ambulance_john_smith_2026-03-12.pdf

API changes:

  • POST /templates/register β€” registers a PDF already present in src/templates/ by filename, no upload required
  • POST /templates/upload β€” existing endpoint preserved for backwards compatibility
  • Template DB records store relative path: src/templates/fire_dept.pdf

Documentation changes:

  • SETUP.md β€” new section: "Adding your own PDF templates"
  • README.md β€” updated project structure diagram

βœ… Acceptance Criteria

  • src/templates/ directory created with at least one sample fillable PDF
  • src/outputs/ directory created with .gitkeep and added to .gitignore
  • POST /templates/register endpoint added
  • Template DB records use relative paths
  • SETUP.md documents how to add templates for new contributors
  • Batch filling ([FEAT]: Missing Batch Endpoint for Multi-Form FilingΒ #156) can reference templates by filename without upload

πŸ“Œ Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions