Implement schema validation for extracted data and integrate into controller pipeline with unit tests#301
Open
ayushhbasu wants to merge 8 commits intofireform-core:mainfrom
Open
Conversation
Adds a function to validate required fields in extracted data.
Integrate validation into controller flow
Add unit tests for validation utility
Add a test for form validation failure in Controller. dd validation + tests
Add a test to validate form filling failure.
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.
Description
This PR introduces a validation layer for extracted form data to ensure structural correctness before downstream processing.
A new utility function
validate_extracted_datahas been implemented to validate required fields (e.g.,patient_name,age,diagnosis) and detect missing or empty values.The validation logic is integrated into the controller pipeline, ensuring invalid data is caught early and handled via explicit exceptions. This improves overall system reliability and prevents propagation of malformed data into the PDF form-filling stage.
Additionally, unit tests have been added to cover both valid and invalid scenarios, including missing fields and empty values.
Fixes # (issue)
Type of change
How Has This Been Tested?
The validation logic has been verified using unit tests covering multiple scenarios:
Steps to reproduce:
Test Configuration:
Checklist: