Add requires_review flag to detect incomplete LLM extraction#349
Open
Arijit429 wants to merge 6 commits intofireform-core:mainfrom
Open
Add requires_review flag to detect incomplete LLM extraction#349Arijit429 wants to merge 6 commits intofireform-core:mainfrom
Arijit429 wants to merge 6 commits intofireform-core:mainfrom
Conversation
This was referenced Apr 17, 2026
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.
Closes #450
Closes #40
Overview
This PR enhances the reliability and safety of the FireForm extraction pipeline by introducing a validation layer that detects incomplete or low-confidence LLM extraction results.
In the current workflow, form submissions proceed even when the language model fails to extract critical fields (e.g., returning placeholder values like "-1" or missing entries). This change introduces a structured mechanism to flag such cases for human review.
Key Changes
Extraction Validation Utility
src/utils/validation.py) to evaluate extracted JSON data against required template fields.requires_review Flag Integration
requires_reviewboolean after LLM-based extraction.FileManipulator.fill_form()to return both:Controller and API Flow Updates
/forms/fillroute to persist the review state alongside form submission data.Database Model and API Contract Extension
requires_reviewcolumn to theFormSubmissionmodel.FormFillResponseschema to expose review status to API consumers.Motivation
LLM-driven extraction is inherently probabilistic and may produce incomplete outputs in real-world emergency scenarios. By surfacing a review indicator, this change supports safer operational workflows and enables future human-in-the-loop validation interfaces.
Impact
Future Work