Real-time validation (sypht.validate)
Add real-time human-in-the-loop validation to predictions. (coming soon to v2)
Last updated
Add real-time human-in-the-loop validation to predictions. (coming soon to v2)
Last updated
Validation workflows are a BETA
feature and subject to change.
This guide is under-construction.
Validation rules
With v2 validation rules, checks are constructed with a range of different validation conditions. Where in v1 you had a set of available condition types, such as a field-confidence-range
condition with a specified minimum; with v2 you would achieve the same result by using a less than condition comparing the prediction confidence with a constant threshold value.
For example, here is a v1 validation rule that would create a task if the bpay.crn field's confidence is below 50%:
And here is a v2 validation rule that would perform the same check:
While this may initially appear more complicated or verbose, the benefit is that simple rules can be combined with and
, or
and not
operations to build more complicated validation rules, which can then be used to get users to check one or more fields.
The rules schema consists of an array of one or more checks. Each check must contain the following properties:
condition
: the condition that determines if the check will trigger a validation task
note
: A note that will appear in the task UI, next to the fields that need to be reviewed
field_ids
: the fields that will be highlighted in task view if the conditions for the check are satisfied.
Conditions can be grouped into 2 categories: Logic operators and comparison operators.
Logic operators consist of and
, or
and not
condition types and will contain a nested array of conditions
(or a single condition
in the case of the not
type). eg:
Comparison operators consist of the greater-than
, less-than
and equal
types for comparing 2 different values, and the is-set
and has-value
types to check if a variable has been initialised and/or has a value.
In almost all cases you will want your conditions to check predicted values in a document, these will be available on the reserved $.predictions
workflow variable which is an associated array using field ids as keys. The values in the predictions array are objects that match the schema found in the results endpoint with confidence
, value
and value_norm
properties
PUT /workflows/validation_rules/{rules_id}
rules_id
is a self-assigned id for the rule, any string value is valid. Note the id for use in subsequent requests.
The post body consists of data
and schema
properties at the top level and the checks
array nested within data
:
POST /workflows/sypht.validate/jobs
file_id
is the file id returned by the file upload endpoint
product_id
is the id of the product you want to extract and validate with. Note that with the validate workflow you can only supply a single product id at a time. Product ids for subscribed products can be found in the sypht marketplace.
rules_id
is the id for a validation rules config that you have stored in sypht using the rules storage endpoint
Go to your tasks page at https://app.sypht.com/tasks. If a task has been created as per your validation rules, it will be listed here.
Click on the task to open it and in the task view screen the fields to be reviewed (as per valiation rules) will be highlighted for review
While tasks are in progress, the results endpoint will block requests for up-to 30 seconds and return an IN PROGRESS
status.
GET /result/final/{file_id}
Once the task is complete, or if the predictions passed all validation checks, results will be returned normally.