Monday, 5 August 2024

Integrating Microsoft Azure Document Intelligence Receipt Model with PeopleSoft

 

Integrating Microsoft Azure Document Intelligence Receipt Model with PeopleSoft

As the digital transformation wave continues to sweep across industries, leveraging AI and machine learning in enterprise applications has become increasingly pivotal. PeopleSoft, a robust enterprise resource planning (ERP) system, is well-equipped to adapt to these advancements. This post explores how to integrate Microsoft Azure Document Intelligence Receipt Model with PeopleSoft to demonstrate its capabilities in embracing AI solutions.

Please note, this is only to showcase how the integration can be done between Azure Document Intelligence AI services and PeopleSoft system. 

Understanding the Azure Document Intelligence Receipt Model

Microsoft Azure Document Intelligence, formerly known as Form Recognizer, offers a Receipt Model that extracts information from receipts. This model uses AI to analyze and extract key data, such as merchant name, transaction date, total amount, and more, from receipts in various formats.


Step-by-Step Guide to Integration

Prerequisites

  1. Microsoft Azure Account: Ensure you have an active Azure account with access to the Document Intelligence service.

  2. PeopleSoft Environment: A working instance of PeopleSoft with access to customization capabilities.

  3. API Integration Knowledge: Basic understanding of API integration within PeopleSoft.

Step 1: Set Up the Azure Document Intelligence Receipt Model

  1. Have a free trial account in MS Azure.

  2. Create a Azure AI services multi service account 

.


  1. Obtain API Keys and Endpoint: After creating the resource, navigate to the 'Keys and Endpoint' section to get the API keys and endpoint URL required for making API calls.

Imp - Please make a note of the KEY1 and Endpoint as these will be used throughout this POC.

Step 2: Test in Microsoft Azure Document Intelligence Studio

  1. Access Document Intelligence Studio: Navigate to the Azure Document Intelligence Studio from the Azure portal.

  2. Upload Receipt for Testing: Use the interface to upload a sample receipt image or PDF.

  3. Analyze Receipt: Once uploaded, the model will process the receipt and display the extracted information. Verify the accuracy of the extracted data.

Testing via direct image url - https://makereceipt.com/images/receipt-with-calculated-tip-sample-min.jpg

Results in PeopleSoft

Testing Via directly uploading a file:

Using the url - https://media-cdn.tripadvisor.com/media/photo-s/08/93/33/eb/super-reasonable-for.jpg

Save it locally on your machine and then upload in Document Intelligence Studio

Results from PeopleSoft


Step 3: Test the API using Postman


Before using the REST API’s of Receipt Model, first test it in Postman.


The complete documentation can be found here.

  1. Set Up Postman: Download and install Postman if you haven't already.

  2. Create a New Request: In Postman, create a new HTTP POST request.

  3. Set Request URL: Use the endpoint URL from the Azure portal (e.g., 

https://<your-end-point>.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-receipt:analyze?api-version=2024-02-29-preview

Set Headers: Add the following headers:

  • Ocp-Apim-Subscription-Key: Your subscription key from the Azure portal.

  • Content-Type: application/json

Body: In the body section, select ‘raw’' and enter the url of the image. In case you are uploading a file, then it should be a base64 string.

  1. Send Request: Click 'Send' to make the API call.

  2. Review Response Headers: Examine the Response headers and look for the parameter apim-request-id. This will be used in the next GET request to get the actual results.

Now open another tab in Postman and enter the below url

https://<your-custom-endpoint>/documentintelligence/documentModels/prebuilt-receipt/analyzeResults/<apim-request-id>?api-version=2024-02-29-preview

Set the Ocp-Apim-Subscription-Key in the Request header and click Send.


  


Step 4: Configure PeopleSoft for API Integration

  1. Ensure that PeopleSoft Integration Broker is correctly set.

  2. Create a REST consumer Service having wo Service Operations - 

POST Service Operation to Post the Request

Enter the REST base url as 

https://<your end point>/documentintelligence/documentModels/prebuilt-receipt:analyze

And in template - ?api-version=2024-02-29-preview

GET Service Operation


Enter the REST base URL as - https://<endpoint URL>/documentintelligence/

In Index template - documentModels/prebuilt-receipt/analyzeResults/{apimrequestid}?api-version=2024-02-29-preview


Step 5: Generate Bearer Token for Authorisation to Doc Intelligence REST API’s


This can be done programmatically, but for this POC I have generated it from Postman and used it in PeopleCode.

URL - https://<your azure region>.api.cognitive.microsoft.com/sts/v1.0/issueToken


In the request header, pass the content type, APIM Subscription key and region.


Step 6: Page Design and PeopleCode

Create a Simple page - to enter a URL or path to the image and a button to invoke the logic.

The code to parse the JSON and retrieve the result is from ChatGPT with little modification to it.

Complete PeopleCode can be found here.

Results

Using the image URL directly - (https://makereceipt.com/images/receipt-with-calculated-tip-sample-min.jpg)


Using File Upload and converting into base64string. Image used - https://media-cdn.tripadvisor.com/media/photo-s/08/93/33/eb/super-reasonable-for.jpg


Conclusion

Integrating Microsoft Azure Document Intelligence Receipt Model with PeopleSoft is a powerful example of how ERP systems can leverage AI to enhance operational efficiency. By automating receipt data extraction and entry, organizations can significantly reduce manual workloads, minimize errors, and streamline financial processes. Similar Document Services are provided by other providers like GCP, OCI etc. As long as they are exposed as API’s I think they can be effectively used in any ERP application.


Sunday, 14 July 2024

 How to Implement Chatbots in PeopleSoft


Please find below by LinkedIn post where I have explained step by step process to implement Chatbots in PeopleSoft

LinkedIn Article Link

Tuesday, 12 September 2017

PeopleSoft Installation Using Deployment Packages (DPK's)


Installing PeopleSoft FSCM 9.2 / 8.55 using Deployment Packages on Native OS
In the earlier examples we have seen PeopleSoft installation process on personal desktop / laptop or we can say it was on premise. Installation on on-premise definitely needs many steps to perform, starting from OS installation to installation of individual components to manual configuration of app servers / web servers and process scheduler servers.
Since PeopleTools 8.55 DPK’s (deployment packages) have been introduced to simplify the installation and configuration process.

Through DPK’s not only we can install through the default settings but we can customize the configuration to reflect or organization requirements. For example, we want only mid-tier or only app server or only web server on a machine. Or, let’s say we want to have two app server domains on a single machines. DPK’s provides the facility to achieve all these things in a very systematic and effective way.

Following table summarizes the steps required in manual installation and installation through DPK’s, which clearly shows that using DPK’s will save time and efforts.

Steps
Conventional Method
DPK’s (Native OS)
Create a machine with
supported OS installed
Yes
Yes
Install Oracle DB
Yes
No
Install Tuxedo
Yes
No
Install Weblogic
Yes
No
Install PeopleTools
Yes
No
Install PeopleTools patch if required
Yes
No
Install Application
Yes
No
Load Demo DB
Yes
No
Configure PSFT services
Yes
No
Install workstation
Yes
Yes

So, we can see the definitive benefits of using DPK’s which really reduces our time and efforts of installing a PeopleSoft system.

For the OS requirements we have used Red Hat Linux 6 on google cloud. This further reduces time as typical OS installation is not performed. Performing the installation on Windows OS is much more simpler and straight forward process.

We have distributed the installation into three parts -

  1. Part 1 - Subscribe to Google Cloud Free Trial and deploy server with Red Hat Linux
  2. Part 2 - Start the installation processes.
    1. Download the required DPK’s
    2. Invoke the bootstrap shell script.
  3. Part 3 - Open PIA and database ports to access them over internet.

We will go through each one of these in details.

We will just not stop here, rather we will go further to apply PeopleTools patches and PeopleTools upgrade using DPK’s.

So, let’s start with installation first using DPK’s.

PeopleSoft Installation Using DPK's - Part 3

Till now, we have finished all the installations and started all the services.

To access the PIA we have to open firewall port 8000

Go to cloud console.  




In the target tags mention peoplesoft. This tag we will use on the instance also.


Click on create
We can see that new firewall rule has been created.

Again open the instance


Add peoplesoft to network tags.



Save the changes.


To access the PIA we will deactivate the default domain name.

Navigate to /home/psadm2/psft/8.55/webserv/peoplesoft/applications/peoplesoft/PORTAL.war/WEB-INF

Open file weblogic.xml

sudo vi weblogic.xml




Blank out the <cookie-domain> value


To modify the above file

sudo vi weblogic.xml
Press i
Apply the changes
Press Esc key
Type :wq and hit return key

Reboot the web server and access PIA

http://<ip address>:8000/psp/ps/?cmd=login



To access the database create a new firewall rule to open port 1522.

The steps will be same as we have done above to open http port 8000.

To establish connectivity from database and application designer, get the tnsentry from the vm instance.

Navigate to /home/psft/db

View the tnsentry.ora file



Copy the tnsentry contents and paste it to your local machine

Usually it should be under F:\app\oracle\product\12.1.0\client_1\network\admin\tnsnames.ora

Modify the host to reflect the IP address of you instance.

Login to application designer. So, you should have already installed PeopleTools client to you local PC.



Remotely Accessing the VM Instance

If you want to remotely connect to your VM instance from Putty or winscp etc. then perform the following steps.

Create a public - private key pair using puttykegen

Click on the Generate button and move the cursor on the space above.

Once done, click on “Save Public key” and “Save private key” to save the keys.


Copy the public key contents as highlighted below.


Open google cloud console, click on the instance and scroll down to add the above SSH key.



Save the changes.

Now, open putty.


Save the changes.

Now, go to SSH under Connection

Enter the private key file which we have saved above.

Save the changes.


Click Open to connect.

Integrating Microsoft Azure Document Intelligence Receipt Model with PeopleSoft

  Integrating Microsoft Azure Document Intelligence Receipt Model with PeopleSoft As the digital transformation wave continues to sweep acro...