Document Understanding Solution Using AWS
By: Adit Modi
Tags: Analytics, AWS, Artificial Intelligence, Serverless, Big Data

[Article 5 of 6 in series Big Data Applications on AWS]

Previous Article in the Series

The Document Understanding Solution (DUS) delivers an easy-to-use web application that ingests and analyzes files, extracts text from documents, identifies structural data (tables, key value pairs), extracts critical information (entities), and creates smart search indexes from the data. Additionally, files can be uploaded directly to and analyzed files can be accessed from an Amazon Simple Storage Service (Amazon S3) bucket in your AWS account.

This solution uses AWS artificial intelligence (AI) services that address business problems that apply to various industry verticals:

Search and discovery: Search for information across multiple scanned documents, PDFs, and images

Compliance: Redact information from documents

Workflow automation: Easily plugs into your existing upstream and downstream applications

My Background: Cloud and Big Data Enthusiast | 5x AWS Certified | 3x Oracle Cloud Certified | 3x Azure Certified | Big Data Certified | AWS Community Builder.

Document Understanding Solution architecture

The AWS CloudFormation template deploys a static web application hosted on an Amazon S3 bucket and served by an Amazon CloudFront distribution. Users are authenticated using Amazon Cognito. The web application interacts with the backend using an Amazon API Gateway API, supported by an AWS Lambda function. Documents are uploaded using either the web application, or directly to a dedicated Amazon S3 bucket for bulk processing. Document processing is initiated by the API, which triggers a Lambda function to add an entry to an Amazon DynamoDB table. The table triggers a second Lambda function that supervises the processing. The file format of the upload dictates the route for processing. Amazon Textract extracts text and structural information from the files. The extracted text is then passed to Amazon Comprehend and Amazon Comprehend Medical for further analysis.

The resulting analyses are stored in an Amazon S3 bucket and the metadata is stored in a DynamoDB database. Extracted information is used to index the document in Amazon Elasticsearch Service (Amazon ES) and, if enabled, in Amazon Kendra.

Prerequisites

Verify that you have an administrator role in the AWS account where you plan to deploy this solution. To verify, access the AWS Identity and Access Management (IAM) console from the appropriate AWS account. For more information about IAM roles, refer to IAM roles in the IAM User Guide.

Deployment overview

The procedure for deploying this architecture on AWS consists of the following steps. For detailed instructions, follow the links for each step.

Step 1. Launch the stack

This automated AWS CloudFormation template deploys the Document Understanding Solution in the AWS Cloud. Review the prerequisites before launching the stack.

Sign in to the AWS Management Console and use the button to the right to launch the document-understanding-solution.template AWS CloudFormation template. Optionally, you can download the template as a starting point for your own implementation. The template launches in the US East (N. Virginia) Region by default. To launch the solution in a different AWS Region, use the Region selector in the console navigation bar. On the Create stack page, verify that the correct template URL shows in the Amazon S3 URL text box and choose Next. On the Specify stack details page, assign a name to your solution stack. Under Parameters, review the parameters for the template and modify them as necessary. This solution uses the following default values. Choose Next. On the Configure stack options page, choose Next. On the Review page, review and confirm the settings. Check the box acknowledging that the template will create AWS Identity and Access Management (IAM) resources. Choose Create stack to deploy the stack.

You can view the status of the stack in the AWS CloudFormation console, in the Status column. During deployment, two additional stacks are created, DUS and DUSClient. You should receive a CREATE_COMPLETE status in approximately 30–60 minutes, depending on the stack parameters selected.

During deployment, you may receive an email containing instructions and the Amazon CloudFront URL to access the web application. This URL will not be active until the deployment is complete. After you receive a CREATE_COMPLETE status, verify that both the DUS and DUSClient stacks also display a CREATE_COMPLETE status.

Step 2. Access the web application

From your email account, locate the Document Understanding Solution email. This email contains the Amazon CloudFront URL and your login credentials, including your username and temporary password.

The web application’s homepage displays three tracks. You can easily navigate between each track.

Discovery track: Search information across multiple scanned documents, PDFs, and images

Search information across multiple scanned documents, PDFs, and images Compliance track: Redact information from documents

Redact information from documents Workflow automation track: Upload batches of files directly into the bulk-processing Amazon S3 bucket

Discovery track

In the Discovery track, you can search through multiple documents and find information using traditional search-based technologies such as Amazon Elasticsearch Service (Amazon ES) and, if enabled, Amazon Kendra, a natural language service.

Figure 2: Web application home page

Use the Document list page to view documents that you uploaded and to also upload documents. This solution includes a preloaded set of documents that are indexed by Amazon ES, and, if enabled, Amazon Kendra. You can use the preloaded documents to explore the capabilities of this solution.

To add documents, follow these steps:

Select upload your own documents. Select the documents from your source drive or use your computer’s camera to take pictures of the documents you want to upload.

Figure 3: Upload documents page After the documents have been uploaded, search for them from the Document list page using the Search box.

Your search results show on a search results page displays one or more tabs, depending on whether Amazon Kendra is enabled. If Amazon Kendra is enabled, the search results page displays three tabs, each showing unique results: the Amazon ES results, the Amazon Kendra results, and a comparison between Amazon ES and Amazon Kendra results.

Figure 4: Amazon ES search results

Use the web application to navigate between the tracks from the document’s details page. The track menus are located on the top right corner of the webpage. You can also return to the homepage at any point to start a new activity.

The search results for Amazon Kendra offers unique interactions and filtering capabilities:

Feedback mechanism: You can provide feedback to the machine learning model using a voting mechanism to either up vote or down vote the search results.

You can provide feedback to the machine learning model using a voting mechanism to either up vote or down vote the search results. Personas-based filtering: Personas based on the healthcare industry are available to filter your search results, but are limited to the predefined queries provided in Step 2 (as shown in Figure 4). The available personas include healthcare professionals, the general public, and government officials. To access this filter, navigate to the Amazon Kendra tab, select Filter, and choose a persona.

Figure 5: Filter search results by persona

Supports Amazon Kendra FAQs: This solution supports the Amazon Kendra capability to match FAQs.

Exploring a document

To explore a document, select the document to access a Preview mode. In this mode, you can search for text within the document and download a searchable PDF version of the document to analyze the document using.

Figure 6: Document exploration capabilities

When in Preview mode, access the document’s Details page to view more information, to preview the document, search for text, forms or key-value pairs, tables, and general and industry-specific entities. You can download any or all marked information in the following formats:

PDF — a searchable or redacted version of the document

CSV — format for tables or forms that are downloaded

JSON — format for entities that are downloaded

Figure 7: Download a table as a CSV file

Compliance track

The compliance track enables you to redact information from a document. For example, you can redact protected health information (PHI), specific values in key-value pairs, and specific keywords. You can redact information in each tab that is available for a document: Preview, Raw Text, Key-Value Pairs, Tables, Entities, and Medical Entities.

Figure 8: Redacting sensitive information in a document

Workflow automation track

You can input data into the solution as well as export it for other business purposes. Use the bulk processing option to load a large volume of documents for analysis. Once analyzed, the results are available in an Amazon S3 bucket that you can export for further processing.

hope all of you Understood AWS Architecture and How to Use Big Data with AWS. If you have any doubt regarding the examples provided or are unable to understand how AWS Services make use of Big Data Applications you can contact me.

LinkedIn : https://www.linkedin.com/in/adit-modi-2a4362191/

Github : https://github.com/AditModi

You can view my badges on:

https://www.youracclaim.com/users/adit-modi/badges

Next Article in the Series