Validating packets
Validation rules for cross-class fields ensure data quality and consistency across documents within a packet. While class-level validation rules verify individual field results, cross-class validation rules verify relationships between fields, selection logic, and data consistency.
Understanding cross-class validation rules
Cross-class validation rules focus on relationships and consistency across documents.
Cross-class validation rules flag results where input fields failed validation or were inconsistent across the packet.
Each cross-class validation rule must be associated with a specific cross-class field. This association determines where validation failures appear in human review and run results, making it clear which field needs attention. For referenced field rules, the associated field is the one being validated. For custom validation functions, the associated field is where failures display, though your custom function logic can validate any aspect of the packet.
Creating cross-class validation rules
Create cross-class validation rules to flag questionable results for human review.
-
From the Cross-class tab, select Validations.
-
Click Add cross-class rule.
-
Select a validation rule type.
-
Select the cross-class field that the validation rule applies to, and click Save.
Cross-class validation results arenβt automatically recalculated when you modify input field validations. To update cross-class validation results, refresh the page.
Cross-class validation rule types
Choose the validation rule type that matches how you want to validate data across classes.
-
Validate selected field β Checks that the field selected by ranking logic is valid. Applies only to ranked, not derived, fields. Use this rule type when your selection criteria is based on confidence score rather than validation status, ensuring that the final selected value meets quality standards even if it was chosen based on confidence rather than validity.
-
Validate all input fields β Checks that every input field used to calculate the cross-class field is valid. Use this rule type when you want to verify packet integrity and ensure all documents in the packet contain valid data.
-
Require matching fields β Checks that all input field results match each other exactly. Use this rule type to detect inconsistencies across documents that might indicate data entry errors, fraud, or incorrectly grouped documents.
-
Validation function β Uses a custom Python function to validate cross-class field results. Use this rule type for complex validation logic that canβt be achieved with quick validation rules. For more details, see Cross-class validation function.
Cross-class validation function
For advanced validation requirements involving complex business logic, external data verification, or mission-critical results, create a custom cross-class validation function in Python.
When creating a validation function, you first select which cross-class field the rule applies to. This determines where validation failures are displayed in human review and run results. Your custom function logic can validate any aspect of the packet, not just the selected field. To use other fields in your custom function, click + Add argument and select the field from the dropdown. A 'class_fields' argument is added to your custom function, which you can use to access the field.
For example, you might use a validation function to verify that values across multiple documents fall within acceptable ranges:
Cross-class validation functions accept these parameters:
Validation functions must return None if the validation rule passes, and an error string if the validation rule fails.
For additional guidance about custom functions, see Writing custom functions.
Best practices for packet validation
Choose validation rules that align with your quality requirements and use case.
Consider the cost of sending invalid results downstream versus the cost of human review when configuring validation rules. Stricter validation rules like Validate all input fields or Require matching fields catch more potential issues but send more packets to review. Less strict rules like Validate selected field minimize review burden but might miss edge cases. Choose validation strategies that align with your risk tolerance and review capacity.
