Extract Information from a Custom Document with a Document Understanding Action

You can use AI to extract information from a custom document with a document understanding action. This section provides a high-level use case on how to exact information from a custom document (for this example, extract an insurance quote from a JPG file) and convert it to key-pair values in JSON format.

Ensure that you have completed all prerequisites for using the document understanding action. See Extract Document Information with a Document Understanding Action.

  1. Create an application integration.
  2. Drag a REST Adapter into the integration canvas.
  3. Configure the REST Adapter.
    1. On the Basic Info page, enter a name.
    2. On the Resource Configuration page, specify the necessary information. For example:
      • Enter a relative resource URL: /test is used for this example.
      • Select the POST action.
      • Select the following request/response options:
        • Configure a request payload for this endpoint
        • Configure this endpoint to receive the response
    3. On the Request page, select Binary as the request payload format.
    4. On the Response page, select JSON Sample as the response payload format, and specify the content:
      { 
      "companyName":""
      }
    5. Complete the wizard.
  4. Click Actions Integration actions icon and drag the OCI Document Understanding action into the integration canvas.
  5. Enter the following information in the wizard.
    1. Enter a name and optional description.
    2. From the Select Categories list, select Custom models, then click Continue.
    3. From the Action list, note that Analyze document is the only option available and cannot be deselected, then click Continue.
    4. Select the following information, then click Continue.
      Element Description
      Compartment Select the Oracle Cloud Infrastructure compartment in which Oracle Integration is installed.
      Model Select the model ID to use that you created in Oracle Cloud Infrastructure. See Custom Models.
      Input source

      Select Inline as the location from which to get the input document.

  6. In the request mapper, expand the source and target sections. The insurance quote custom document must be sent in base-64 format.
  7. Expand the target Document element.
  8. Right-click Data, and select Create target node.
  9. In the target section, click Functions Mapper functions icon.
  10. In the Expression Builder, click Design View Switch view icon.
  11. In the Functions section, expand Advanced, and drag encodeReferenceToBase64 into the Expression Builder. This step is required for extracting data from the custom document.
  12. Map Stream Reference from the Sources section to the encodeReferenceToBase64 () function in the Expression Builder.


    The mapper shows the Sources, Mapping canvas, and Targets section. The target Functions list is shown. The encodeReferenceToBase64 function is selected. The encodeReferenceToBase64 function is shown in the Expression Builder at the bottom. The source Stream Reference has been dragged into the function.

  13. In the response mapper, expand the source and target sections.
  14. Map the target Company Name element to the source Company Name element.


    The mapper shows the Sources, Mapping canvas, and Targets section. The source Company Name is mapped to the target Company Name.

  15. Return to the integration canvas. This action validates your expression.
  16. Assign a business identifier.
  17. Save and activate the integration.


    The integration shows a trigger, request map, OCI Document Understanding action, and response map.

  18. From the Actions Actions icon menu, select Run.
  19. In the Body tab of the Request section, click File, then Browse.
  20. Upload the JPG file that includes the insurance quote.
  21. Click Run.
  22. View the companyName returned in the response.


    The Request section shows the URI parameters, Headers, Body (which is selected), cURL, and Integration properties tabs. The File radio button is selected. Next to the Browse button is the JPG file that was uploaded. At the bottom is the Response section, the status value is displayed as 200 OK. The Instance ID is also displayed. The Body (which is selected) and Headers tabs are shown. The companyName parameter and its returned value are shown.

  23. When processing completes, expand the invoke connection in the activity stream.
  24. Scroll through the payload and note that the fields from the insurance quote in the JPG file have been converted to key-pair values. Here is a partial view of the insurance quote details.


    The invoke is expanded in the activity stream to show the insurance quote parameters and their values that were included in the JPG file.