Oracle Document Understanding Service and Oracle Integration
In this post, I would like to share how we can use the Oracle Document Understanding service offering from Oracle Cloud Infrastructure along with Oracle Integration to inspect the files uploaded to your Object Storage bucket, classify the document, and upload the output to the Oracle Object Storage service.
We will be using the following services to implement the above
- Oracle Integration Standard Edition
- Object Storage
- Oracle Document Understanding Service REST APIs
Note: The Object Storage bucket and Document Understanding Service REST API must be of the same region.
For example, if you are using https://document.aiservice.ap-sydney-1.oci.oraclecloud.com then make sure the Object Storage bucket is also in the Sydney region.
For the first step, we will first configure the Oracle Integration Instance to invoke the Document Understanding Service REST API.
- Create a connection to the Document Understanding Service using the REST Connection type adapter
2. Create the integration to invoke the Document Understanding Service.Insert an Invoke operation to the DocumentUnderstandingService Connection created in Step 1, and configure the invoke operation as below
I am using the below sample JSON input for the request payload
{
"processorConfig" : {
"processorType" : "GENERAL",
"features" : [ {
"featureType" : "DOCUMENT_CLASSIFICATION",
"maxResults" : 5
} ],
"language" : "ENG"
},
"inputLocation" : {
"sourceType" : "OBJECT_STORAGE_LOCATIONS",
"objectLocations" : [ {
"source" : "OBJECT_STORAGE",
"namespaceName" : "axhh9gizbq5x",
"bucketName" : "demo_examples",
"objectName" : "document_classification_bank_statement.png"
} ]
},
"compartmentId" : "ocid1.compartment.oc1..aaaaaaaajizaub7xqji4f7ndxjtykyx45vfj3orr2llsbmrirstyx6ar2f5q",
"outputLocation" : {
"namespaceName" : "axhh9gizbq5x",
"bucketName" : "demo_examples",
"prefix" : "result"
}
}
4. Update the mapping to provide the values for input variables, I am providing all the values as static text for testing purposes, you can provide these values as part of your integration’s request input and map them dynamically.
5. Once mapped, we are now ready to activate the integration and test.
6. The output from the DocumentUnderstanding Service is also written to the same ObjectStorage bucket with the given Prefix — “DC”, you should see the output JSON.
We can further expand this use case to pick the Document Understanding service output from the Object Storage bucket and present the output into a defined output like tables of records in an Autonomous JSON Database
If you’ve found this useful, please share, If you have any questions you can reach out to me on LinkedIn