Skip to content

Add a searchable field catalog and finish the template PDF upload flow #621

Description

@chetanr25

Add a searchable field catalog and finish the template PDF upload flow

Background

Templates map their fields to the incident contract, but there was no way to search or browse the contract's fields while setting up that mapping. The template PDF upload flow also stopped at "upload and detect fields", with no way to review a draft or fetch the original source PDF back. The template schema needed to describe a bit more too: how each field gets its value, where it sits on the page, and the mapping suggestions the field catalog produces.

Proposed changes

  • Add GET /schema/fields, a search endpoint over the flattened incident contract (dotted path, type, section, description, aliases, PII flag), built from the contract at startup so it always matches the running schema. Powers the mapping picker in the template editor and the automatic mapping suggestions after commonforms field detection.
  • Add GET /templates/{template_id}/pdf to fetch a template's original source PDF back.
  • Add GET /templates/pdf/{upload_id} so an uploaded PDF's field-detection draft can be reviewed before it is registered as a template.
  • Add the template_field_detection job type to the shared async job schemas, since detecting fields on an uploaded PDF is its own background job.
  • Extend the template schema to cover each field's value source, its page layout, and the mapping suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions