How to Utilize Textract Queries Confidence to be checked by a Human Review Workflow?

0

Looking into Human Review Workflows, I understand that key-value pairs can be passed for review, however is it possible to pass queries + query_results as a KV pair to be reviewed? Or is possible for a human review workflow to be triggered from the confidence value of QUERY_RESULT? For our solution we are reliant on TABLES and QUERIES but have no use for FORMS. We are scanning a specific document type that is a universal standard, however, in testing we found queries worked better than forms. Is it possible to convert queries and their answers to KV pairs?

  • Thanks Alex for the great references. I will get to work trying them out!

  • Hi Nunz - I have a similar requirement, where you able to set up your Human Review Workflows using QUERY_RESULT?

Nunz
asked 2 years ago530 views
1 Answer
1

There are 2 ways you can integrate Amazon Textract with Amazon A2I for human review:

  1. The standard instructions in the Amazon Textract developer guide use the pre-built task template for Textract K-V review, with direct integration (specifying the human loop directly in the AnalyzeDocument call).
  2. A2I also supports custom task templates, allowing you to customize the review UI and controls - which can be started by explicit API request.

Today as you saw, the pre-built/direct UI integration is focussed on K-V pairs and I believe doesn't support reviewing Queries results.

What I would recommend is to use a custom integration (2) instead of the direct/built-in one (1), which will allow you to customize the UI and/or the data structure that the UI receives. The general flow would be:

  • Call Amazon Textract without HumanLoopConfig.
  • When the result is ready (either synchronous API response, or async SNS callback gets triggered), use a Lambda function or similar to transform the Textract JSON first and then start a human review.
  • Listen to the S3 output location for your human loop, to detect the upload of a result object and resume the process flow.

If you'd like to re-use the existing UI template, you could use the pre-A2I Lambda to transform the Amazon Textract payload before forwarding to the A2I service: Perhaps editing the JSON blocks to transform the query response blocks into KEY_VALUE_SET blocks, so that the existing template can render them. Alternatively, you could create a new task template using Liquid HTML (supporting embedded JavaScript).

I don't have an example for queries in particular, but would recommend referring to:

AWS
EXPERT
Alex_T
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions