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.
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.
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.
Choose the validation rule type that matches how you want to validate data across classes.
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 table and list fields, you can use cell-level validation to flag specific cell ranges as invalid.
For additional guidance about custom functions, see Writing custom functions.
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.