Business rules can be used to verify custom business logic like
- setting a certain static comparison for the value of an entity (e.g. require validation for invoice amount > 1000 euro)
- comparing expected metadata with extracted data (e.g. a bill of lading number vs the reference number on file)
- implementing a check on the number of pages of a document
- custom logic via an API call
In this panel you can create a business rule or edit existing ones. This list shows all business rules.
You can create a new business rule by clicking on the "+ Create" button. Give the business rule a name and choose the document type to which it applies. To delete a business rule, click on the business rule in question in the overview of business rules, and then click the Delete button.
Blocking vs non-blocking rules
In the above screen you also have the option to define this rule as blocking or non-blocking business rule. If you choose 'blocking' this means documents are automatically sent to human validation if the business rule doesn't succeed.
Invert business rule result
The toggle allows you to invert the final result of a business rule.
Business rule operands
Duco Adaptive IDP supports setting conditions that can be combined via boolean operators such as AND and OR. Using these conditions you can compare different elements (operands) with each other.
- The value of an entity extracted from a document, e.g. the net salary from the pay slip.
- How many times the entity is present the document, e.g. two signatures must be present
- The number of pages of a document
- Information from meta data from your own external data sources that can be sent along with the document, e.g. when the client, in addition to uploading his loan application document, sends information in a web form such as net wages, this information can be sent along to validate with the net wages present in his pay slip.
- An own chosen fixed value (static value)
- A regular expression for comparing text
- Detect duplicates (will show the duplicate in the business rules section as a link when viewing an upload)
- Make sure an entity text or parsed value occurs uniquely
After choosing your first operand, you choose an operator and then a second operand. You can add and combine multiple conditions using OR and AND operators.
When comparing the values of 2 entities with each other in a business rule, and one of the entities is missing from the document, the business rule will fail.
The difference between Document text regex and Regex?
Document text regex compares the given regex against your document
Regex compares against the second operand
API business rules
Sometimes, you need to do additional external validation on your business rules that require advanced custom logic, external data or custom code. To do so, choose API as the operand of your business rule, set the endpoint in the URL field and specify whether it makes use of POST or GET requests.
For every action that is taken on a document, Duco Adaptive IDP will send the appropriate request to this API call with the following JSON body:
{
"document": {
"name": str,
"language": str, // culture like nl-nl
"matchedEntityValues": [
{
// For TEXT entities
"entityId": objectid,
"entityName": str,
"text": str,
"isApproved": bool,
"isManuallyAdded": bool,
},
{
// For IMAGE entities
"entityId": objectid,
"entityName": str,
"coords": {
"x0": float,
"x1": float,
"y0": float,
"y1": float
},
"isApproved": bool,
"isManuallyAdded": bool,
}
],
"metadata": {} // if metadata is added to API input
}
Your API should return a JSON body in the format
{
"result": ...
}
The type of the result will be compared with the value of the other operand in the business rule on a best effort basis.
If you need authentication on your API, this is possible by opening a support ticket.