Populate a document using the response from Azure AI Document Intelligence

Azure AI offers a Document Intelligence service as part of its cloud offerings.

Document Intelligence offers several pre-built models that are specifically designed to extract different types of data from various document types. It also supports custom models.

The OCR response contains a collection of named fields specific to the processor and what it was able to detect.

Import the sample package, Azure AI Document Intelligence Package.zip, available at \\TotalAgilityInstall\Sample Processes\Third Party Data Extraction into your TotalAgility Designer.

The sample package includes the following items.

Category

Data Extraction > Azure AI Document Intelligence

Everything in the package is added to this category.

Processes

  • Two sample processes: Azure AI Receipt and AzureAI Driving License.

  • Supporting processes to get the fields and the field location and update the document with the data.

Extraction group ThirdPartyExtraction: This extraction group contains several example document types.
Classification group ThirdPartyExtractionCG
Scan/VRS profile Third Party Data Extraction Profile
Global data models

  • AzureAIReceipt_Global: This model is generated using a sample response from the prebuilt-receipt model using API version 3.1

  • AzureAIDriverLicense_Global: This model was created using a sample response of the prebuilt-idDocument model from Azure AI Document Intelligence v3.1

  • DocumentFields: This model is used to hold the collection of transformed JSON.

Forms Scan create new job and Validation forms.

Sample process: AzureAI Receipt

This sample process shows how to populate fields that are returned using the prebuilt-receipt model using API version 3.1 2023-07-31. Refer to Receipt data extraction - Document Intelligence (formerly Form Recognizer) - Azure AI services | Microsoft Learn. AzureAI Receipt process

This sample process includes the following activities.

Activity Description
Azure AI Extraction Sets a data object using JSON in the process. The JSON corresponds to the sample response from AzureAI for the coffee-chain-receipt-sample.jpg image. (In a real work scenario this would make a call to Azure AI)
Process Receipt Extraction Results Gets the receipt data from the JSON and populates the fields in the TotalAgility document.
Clear down raw data Clears down the raw JSON and data object, as they are no longer required.
Validate Validates the document.

To try this at run time, do the following:

  1. Browse to AzureAI Receipt_Scan.form.

  2. Scan the coffee-chain-receipt-sample.jpg image.

    This sample process is configured to work with this image only.

  3. Create a job for the process.

  4. Select the work queue and click on the Validation activity.

    The data for the document fields is displayed. Clicking on a field highlights the area on the document image.

  5. You can validate each field of the document wherever required.

  6. Click Yes to complete the validation.

Sample process: AzureAI Driving License

This process is similar to the Azure AI Receipt process; however, the fields are different as per the driving license document type. AzureAI Driving License process

The Scan form is AzureAI Driving License_Scan.form and the image to scan is laura-wilson-driving-license-sample.jpg.

This sample process is configured to work with this image only.