Real-time validation

Add real-time human-in-the-loop validation to predictions.

How it works

Getting started

To upload documents under the conditional validation workflow, a few changes to the standard fileupload form-data parameters are required:

  • Specify the validation workflow type by setting: workflowId=validate

  • Specify the fieldSet or fieldSets parameter to predict against

  • Configure the workflowOptions according to the required validation rules

Validation workflows are a BETA feature and subject to change. This guide is under-construction.

Sample Postman configuration for a file-upload with the validate workflow

Validation Parameters

Workflow options are strings which contain a JSON-formatted object that controls how the steps in the validation workflow are executed. Here's a sample workflowOptions string which validates the confidence of the bpay.crn field:

{
"prediction":{
"fieldset": "sypht.bpay",
"conditions":[
{
"type": "field-confidence-range",
"field": "bpay.crn",
"min": 0.5
}
],
"createTask":{
"submit": true,
"priority": 1
}
}
}

For the sample above, extractions which include a bpay.crn with confidence less than 0.5 will produce a validation task for the sypht.bpay specification.

The fieldset specified to validate in the workflowOptions should be contained in the fieldSets requested to predict against on the base /fileupload/ request

The full set of validation conditions includes:

  • field-confidence-range

    • Validates whether a given field's prediction condidence value falls within an expected range.

    • Predictions with values outside the allowed range will trigger validation of the field.

    • Typically used to identify and review low confidence predictions.

    • Required

      • field - Id of the field to validate

    • Options

      • min - The minimum value for the predicted field confidence

        • Inclusive

        • Default = null for no minimum

      • max - The maximum value for the predicted field confidence

        • Inclusive

        • Default = null for no maximum

  • field-value-range

    • Validates whether a given field's normalised value falls within an expected range.

    • Predictions with values outside the allowed range will trigger validation of the field.

    • Required

      • field - Id of the field to validate

    • Options

      • min - The minimum value for the predicted field confidence

        • Inclusive

        • Default = null for no minimum

      • max - The maximum value for the predicted field confidence

        • Inclusive

        • Default = null for no maximum

  • field-present

    • Verifies the presence of a value for a field on a document.

    • Documents missing values for this field will trigger validation of the field.

    • Required

      • field - Id of the field to validate

Response
{
"fileId": "815c63f6-6152-467c-9182-f07223d057cb",
"uploadedAt": "2020-08-20T03:19:07.319Z",
"status": "RECEIVED"
}

Tasks

https://app.sypht.com/tasks

Collecting results

While tasks are in progress, the results endpoint will block requests for up-to 30 seconds and return an IN PROGRESS status.

GET https://api.sypht.com/result/final/815c63f6-6152-467c-9182-f07223d057cb
Response
{
"fileId": "1111111-6152-467c-9182-f07223d057cb",
"status": "IN PROGRESS"
}

One complete, results will be returned normally.

Response (once prediction/ is complete)
{
"fileId": "1111111-6152-467c-9182-f07223d057cb",
"status": "FINALISED",
"results": {
"timestamp": "2020-08-20T03:30:09.703Z",
"fields": [
{
"name": "vehicle.odometerKm",
"value": "148500",
"confidence": 0.9958282699555642,
...
},
...
]
}
}