Extract Document Information with a Document Understanding Action

You can use AI to extract information from invoices, receipts, passports, and drivers licenses with a document understanding action. You can classify and return the type of document (for example, an invoice). You can also create a processor job, get processor job status, and cancel a processor job.

You can optionally store and access the invoices, receipts, passports, and drivers licenses from which to exact data in Oracle Cloud Infrastructure Object Storage. See Object Storage.

Capabilities

Oracle Cloud Infrastructure Document Understanding is an AI service that enables you to extract text, tables, and other key data from PDF, PNG, and JPEG files through APIs and command line interface tools. Oracle Cloud Infrastructure Document Understanding automates repetitive business processing tasks with prebuilt AI models and customizes document extraction to satisfy your industry-specific needs. Oracle Integration supports using Oracle Cloud Infrastructure Document Understanding in an integration with the document understanding action.

See AI Document Understanding.

Prerequisites

See Prerequisites for information on the prerequisites you must satisfy in the Oracle Cloud Infrastructure Console.

Invoke Oracle Cloud Infrastructure Document Understanding from an Integration

  1. Add an OCI Document Understanding action to an integration in either of the following ways:
    • On the side of the canvas, click Actions Integration actions icon and drag the OCI Document Understanding action to the appropriate location.
    • Click Add icon at the location where you want to add the document understanding action, then select OCI Document Understanding.
  2. Enter a name and optional description.

    For the Select Categories list, Pre-trained models is the only option available and cannot be deselected.

  3. Select an action to perform, then click Continue.
    Action Description See...
    Analyze document Extracts information from a document. This action accepts an inline document in base64 format or retrieves the document from object storage, performs the extraction, and returns an immediate response. Step 4 to configure this selection in the wizard.
    Document classification Classifies and returns the type of document. For example, if you send an invoice, the document type returned is an invoice. This action accepts an inline document in base64 format or retrieves the document from object storage and returns the document type in an immediate response. Step 5 to configure this selection in the wizard.
    Create a processor job Creates a processor job. This action reads a file from object storage and provides a response with a processor job ID. Step 6 to configure this selection in the wizard.
    Get a processor job status Gets the status of the processor job. This action takes the processor job ID as a parameter from the Create a processor job action and returns the status of the processor job. Step 7. The Summary page is displayed and no further wizard configuration is required.
    Cancel a processor job Cancels the processor job submitted through a Create a processor job action. Step 7. The Summary page is displayed and no further wizard configuration is required.
  4. If you selected the Analyze document action:
    1. Select the following information, then click Continue.
      Element Description
      Compartment Name Select the Oracle Cloud Infrastructure compartment in which Oracle Integration is installed.
      Document Type
      Select the type of document from which to extract information. Key value extraction can identify values for predefined keys in a document.
      • Invoice: Identifies values for predefined keys in an invoice. For example, if an invoice includes a vendor name, total, and invoice ID, Oracle Cloud Infrastructure Document Understanding can identify these values and return them as a key-value pair.
      • Receipt: Identifies values for predefined keys in a receipt. For example, if a receipt includes a merchant name, merchant address, or merchant phone number, Oracle Cloud Infrastructure Document Understanding can identify these values and return them as a key-value pair.
      • Driver License: Identifies values for predefined keys in a US or UK driver's documentation. For example, if a driver ID includes an issue date, region, and expiry date, Oracle Cloud Infrastructure Document Understanding can identify these values and return them as a key-value pair.
      • Passport: Identifies values for predefined keys in an MRZ-supported passport. For example, if a passport includes nationality and date of issue, Oracle Cloud Infrastructure Document Understanding can identify these values and return them as a key-value pair.

      Your selection is passed into the mapper for you to map.

      Input source

      Select the source location from which to get the input document.

      • Inline: Accepts the document through base64 format in the request payload of the mapper.
      • Object storage: Reads the document from the object storage bucket.
        • Input storage bucket: Select the storage bucket from which to read the file.
        • Namespace: Select the namespace for the object storage bucket.

        After completing configuration in the wizard, you must specify the file name to read from the object storage bucket in the mapper.

  5. If you selected the Document classification action:
    1. Select the following information, then click Continue.
      Element Description
      Compartment Name Select the Oracle Cloud Infrastructure compartment in which Oracle Integration is installed.
      Input source

      Select the source location from which to get the input document.

      • Inline: Accepts the document through base64 format in the request payload of the mapper.
      • Object storage: Reads the document from the object storage bucket and returns the response based on the selected document type.
        • Input storage bucket: Select the storage bucket from which to read the file.
        • Namespace: Select the namespace for the object storage bucket.

        After completing configuration in the wizard, you must specify the file name to read from the object storage bucket in the mapper.

  6. If you selected the Create a processor job action:
    1. Select the following information, then click Continue.
      Element Description
      Compartment Name Select the Oracle Cloud Infrastructure compartment in which Oracle Integration is installed.
      Output storage bucket Specify the output storage location for the file.
      Namespace Select the namespace for the object storage bucket name.
  7. On the Summary page, click Finish.

Configure the Mapper to Read the Inline Document for the Analyze Document Action

You send the data in base-64 format for any document type that you selected in the wizard.

  1. Expand the target Document element.
  2. Right-click Data, and select Create target node.
  3. Click Functions Mapper functions icon.
  4. Click Design View Switch view icon in the Expression Builder.
  5. In the Functions section, expand Advanced, and drag encodeReferenceToBase64 into the Expression Builder. This step is required for all document types (invoice, receipt, drivers license, and passport).
    oraext:encodeReferenceToBase64 ( )
  6. Drag Stream Reference from the Sources section into the Expression Builder.
    oraext:encodeReferenceToBase64 (/nssrcmpr:execute/ns19:streamReference )


    The Sources, Mapping canvas, and Target sections are shown. The source Stream Reference element is mapped to the target Data element.

  7. Exit the mapper.

    The document understanding action is now configured.

Configure the Mapper to Read the Document from a Storage Bucket for the Analyze Document Action

You must select the file name to read from the object storage bucket in the mapper.

  1. Drag the file name from the Sources section to the Object Name target element.

    If you also want to override other values you defined in the wizard, you can specify values for the Component id, Bucket Name, and Namespace Name target elements.


    The Sources, Mapping canvas, and Target sections are shown. The target Document element shows subelements for Bucket Name, Namespace Name, and Object Name.

  2. When complete, exit the mapper.

    The document understanding action is now configured.

Configure the Mapper to Read the Inline Document for the Document Classification Action

You send the data in base-64 format for any document type that you selected in the wizard for the Analyze document action.

  1. Expand the target Document element.
  2. Right-click Data, and select Create target node.
  3. Click Functions Mapper functions icon.
  4. Click Design View Switch view icon in the Expression Builder.
  5. In the Functions section, expand Advanced, and drag encodeReferenceToBase64 into the Expression Builder.
    oraext:encodeReferenceToBase64 ( )
  6. Drag Stream Reference from the Sources section into the Expression Builder.
    oraext:encodeReferenceToBase64 (/nssrcmpr:execute/nssrcmpr:attachments/ns19:attachment/ns20:attachmentReference )


    The Sources, Mapping canvas, and Target sections are shown. The source Stream Reference element is mapped to the target Data element. The Expression Builder shows the encodeReferenceToBase64 function configured with the stream reference.

  7. When complete, exit the mapper.

    The document understanding action is now configured.

Configure the Mapper to Read the Document from a Storage Bucket for the Document Classification Action

You must select the file name to read from the object storage bucket in the mapper.

  1. Drag the file name from the Sources section to the Target Object Name element.

    If you also want to override other values you defined in the wizard, you can specify values for the Component id, Bucket Name, and Namespace Name target elements.


    The Sources, Mapping canvas, and Target sections are shown. The target Document element shows subelements for Bucket Name, Namespace Name, and Object Name.

  2. When complete, exit the mapper.

    The document understanding action is now configured.

Configure the Mapper for the Create a Processor Job Action

This action returns a processor job ID. The input from the storage bucket is sent through the request mapper. The output is sent to the object storage bucket.

  1. Expand the Target Request Wrapper to specify the target values. Most values are optional such as Display Name, Processor Config, and Document Type (for example, an invoice). However, the following elements are mandatory:
    1. Feature Type: Specify the document analysis type (for example, TEXT_EXTRACTION or others). For a complete list of available types, see DocumentFeature Reference.
    2. Bucket Name (under Input Location): Specify the input object storage bucket from which to get the file.
    3. Namespace (under Input Location): Specify the namespace for the input object storage bucket.
    4. Prefix (under Output Location): Specify the prefix. The folder in object storage is created with the prefix that you specify. If you also want to override values you defined in the wizard, you can specify values for the Bucket Name and Namespace Name target elements under Output Location.


    The Sources, Mapping canvas, and Target sections are shown. The target Feature Type element is shown. Under the target Input Location element, the Object Locations, Bucket Name, Namespace Name, and Object Name are shown. Under the target Output Location element, the Bucket Name, Namespace Name, Prefix, and Compartment id are shown.

    The response mapper returns a job ID (id element) and a job status (Percent Complete element).


    The Sources, Mapping canvas, and Target sections are shown. The source Body element is expanded to show the available subelements.

  2. Exit the response mapper.

    The document understanding action is now configured.

Configure the Mapper for the Get a Processor Job Status Action

This action takes the job ID returned in the response mapper of the Create a processor job action. This action uses that value to get the status of the processor job. You configure this use case as follows:
  • Configure an initial OCI Document Understanding action with the Create a processor job action. This action returns the job ID.
  • Configure a second OCI Document Understanding action with the Get a processor job status action. This action gets the status of the processor job.
  1. Map the Sources Create A Processor Job id element to the Target Processor Job id element.


    The Sources, Mapping canvas, and Target sections are shown. Under the source Body element, id is mapped to the target Processor Job id.

  2. Exit the mapper.

    The document understanding action is now configured.

Configure the Mapper for the Cancel a Processor Job Action

This action takes the job ID returned in the response mapper of the Create a Processor Job action. This action uses that value to cancel the processor job. You configure this use case as follows:

  • Configure an initial OCI Document Understanding action with the Create a processor job action. This action returns the job ID.
  • Configure a second OCI Document Understanding action with the Get a processor job status action. This action gets the status of the processor job.
  • Configure a third OCI Document Understanding action with the Cancel a processor job action. This action cancels the processor job. The job status must be in progress.
  1. Map the Sources Create A Processor Job id element to the Target Processor Job id element.

A design-time to runtime use case using the document understanding action is provided. See Extract Content from an Invoice PDF Document with a Document Understanding Action.

Watch a video to learn more: