Skip to content

[FEAT]: Add input-side incident data validation gateΒ #305

@geoffkats

Description

@geoffkats

πŸ“ Description

Add an input-side validation layer to reject incomplete incident data before PDF generation. This validates that required fields like incident_type, location, and time are present and non-empty before data proceeds further in the pipeline.

πŸ’‘ Rationale

Currently, incomplete or malformed incident data can enter the pipeline and lead to invalid PDF generation or downstream failures. Adding a validation gate improves reliability and prevents bad data from reaching the PDF filler stage.

πŸ› οΈ Proposed Solution

  • Logic change in src/
  • Update to requirements.txt
  • New prompt for Mistral/Ollama

Implementation outline:

  • Add validate_incident() in src/validator.py
  • Validate required fields before PDF filling
  • Return deterministic error messages for missing or empty fields
  • Add unit tests for valid input, missing fields, empty fields, whitespace-only fields, and invalid input type
  • Integrate validation into src/file_manipulator.py

βœ… Acceptance Criteria

  • Feature works in Docker container.
  • Documentation updated in docs/.
  • Input incident data is validated before PDF fill.

Definition of done:

  • validate_incident() returns [] for valid incident data
  • Missing required fields produce deterministic error messages
  • Empty or whitespace-only required fields produce deterministic error messages
  • Unit tests cover all validation cases and pass locally
  • Validation runs before PDF fill logic

πŸ“Œ Additional Context

PR already opened: #304

This is distinct from #114:

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