feat(extraction): add IncidentReport schema and harden LLM extraction#332
Open
Fadhili5 wants to merge 1 commit intofireform-core:mainfrom
Open
feat(extraction): add IncidentReport schema and harden LLM extraction#332Fadhili5 wants to merge 1 commit intofireform-core:mainfrom
Fadhili5 wants to merge 1 commit intofireform-core:mainfrom
Conversation
Fadhili5
commented
Mar 24, 2026
- Add src/schemas/incident_report.py: canonical Pydantic model covering all fields needed across Cal Fire FIRESCOPE, EMS, and law enforcement forms (identity, location, timestamps, personnel, casualties, wildfire, narrative, law enforcement sections)
- Add model_validator that auto-populates requires_review for any core field left null after extraction, so responders can spot gaps before PDF submission
- Add llm_schema_hint() classmethod that returns the JSON schema minus requires_review, used to build the structured Ollama system prompt
- Refactor LLM class: replace per-field prompt loop with a single structured request using Ollama format="json" and Mistral instruction format ([INST]...[/INST])
- LLM now returns IncidentReport via get_report() in addition to the existing get_data() dict accessor for backward compatibility
- Fix test_submit_form: replace stub with a working integration test that creates a template then mocks Controller to assert the full POST /forms/fill response shape
- Add src/schemas/incident_report.py: canonical Pydantic model covering all fields needed across Cal Fire FIRESCOPE, EMS, and law enforcement forms (identity, location, timestamps, personnel, casualties, wildfire, narrative, law enforcement sections) - Add model_validator that auto-populates requires_review for any core field left null after extraction, so responders can spot gaps before PDF submission - Add llm_schema_hint() classmethod that returns the JSON schema minus requires_review, used to build the structured Ollama system prompt - Refactor LLM class: replace per-field prompt loop with a single structured request using Ollama format="json" and Mistral instruction format ([INST]...[/INST]) - LLM now returns IncidentReport via get_report() in addition to the existing get_data() dict accessor for backward compatibility - Fix test_submit_form: replace stub with a working integration test that creates a template then mocks Controller to assert the full POST /forms/fill response shape
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.