Package cloud.ai.documentai.lab.hifia.tools.validation

Index

ValidatorInput

Definition of the validation rules. Those are the input to the validator logic and they are used to validate a document. Next ID: 3

Fields
validation_rules[]

ValidationRule

ValidationRule

Next ID: 9

Fields
rule_id

string

Unique identifier of the rule. Optional.

name

string

Name of the validation rule.

description

string

Description of the validation rule. This has no use but for documentation.

Union field validation_rule.

validation_rule can be only one of the following:

field_occurrences

FieldOccurrences

field_regex

FieldRegex

form_validation

FormValidation

child_alignment_rule

ChildAlignmentRule

entity_alignment_rule

EntityAlignmentRule

AlignmentRule

A rule for checking field alignment. Horizontal alignment checks if fields are on the same row by comparing y-coordinates of bounding box centers, while vertical alignment checks if fields are on the same column by comparing x-coordinates of bounding box centers.

Fields
alignment_type

AlignmentType

tolerance

float

The tolerance to use when comparing coordinates.

AlignmentType

Enums
ALIGNMENT_TYPE_UNSPECIFIED
ALIGNMENT_TYPE_HORIZONTAL
ALIGNMENT_TYPE_VERTICAL

ChildAlignmentRule

A rule that aligns specified child fields with a parent field.

Fields
parent_field

Field

The full path of the parent field.

child_fields[]

Field

The child fields to be aligned within the parent field.

alignment_rule

AlignmentRule

The alignment rule to apply to the child fields.

Constant

The constant value used in the validation rules.

Fields
float_value

float

EntityAlignmentRule

A rule that aligns specified fields with each other.

Fields
fields[]

Field

The fields to be aligned.

alignment_rule

AlignmentRule

The alignment rule to apply to the fields.

Field

Fields
field_name

string

The field name to validate. This can be a simple field name or a nested field one using the ':' (meant as an aggregator) or '*' (meant as foreach) operators.

default_value

Constant

Default value to use if the field is not present. If the field is missing and the default value is not set, the validation run as if the field is not present in the validation logic.

FieldOccurrences

Fields
field

Field

min_occurrences

uint32

Min and max occurrences of the field. If not set, there is limit set. The defined interval is a closed-closed interval, i.e. [min, max].

max_occurrences

uint32

FieldRegex

Fields
field

Field

pattern

string

Python regex to validate the field values.

FormValidation

Fields
left_operand

Operation

right_operand

Operation

validation_operator

RelationalOperator

The relational operator to be applied to the operands.

Operation

Fields
fields[]

Field

A list of fields to be used as operands.

constants[]

Constant

A list of constants to be used as operands.

operations[]

Operation

A list of recursive operations to be used as operands.

operation_type

OperationType

The operation type to be applied to all the operands.

OperationType

Enums
OPERATION_TYPE_UNSPECIFIED
OPERATION_TYPE_SUM
OPERATION_TYPE_SUB
OPERATION_TYPE_MUL
OPERATION_TYPE_DIV
OPERATION_TYPE_MAX
OPERATION_TYPE_MIN
OPERATION_TYPE_ABS
OPERATION_TYPE_UNIQUE
OPERATION_TYPE_COUNT

RelationalOperator

Enums
OPERATION_TYPE_UNSPECIFIED
OPERATION_TYPE_EQ
OPERATION_TYPE_NE
OPERATION_TYPE_LT
OPERATION_TYPE_LE
OPERATION_TYPE_GT
OPERATION_TYPE_GE