Rossum and UiPath: Invoice extraction in 15 minutes (source code provided)
Many organizations today are evaluating the opportunity to automate Accounts Payable processes with UiPath robots. But the key part to achieve the automation benefits is to deal with the human effort associated with data capture from invoices, so that the UiPath robot can then manage the workflow and postings. Obviously, we do not want the robot to be “front-ended” by a human for invoice data capture. We are in the 21st century!
An RPA<>AP automation project needs an invoice data capture process that keeps up with the robots: reliable, accurate, scalable, layout-independent, rapid to implement and easy to integrate. Traditional OCR-based systems just will not fit this bill.
Rossum’s cognitive platform is able to capture invoice information without any template setup, and UiPath robots bring the ease of integration to the extreme. In this example, we provide all the source codes that you will need to automate invoice processing in 15 minutes.
What you will learn
A typical accounts payable process consists of the following steps:
- Gathering invoices from multiple sources
- Extracting data from invoices (optional 2-way, 3-way or vendor-list matching)
- Posting invoice data into an ERP/DMS system
- Invoice approval workflow for non-PO invoices.
In this article, we will address step 2. Why? Because that’s the most challenging subprocess from the whole list. Other steps can be automated pretty easily by using RPA like UiPath. However, the dynamic nature of invoice layouts requires a different, cognitive approach that is brought by Rossum. We will show you how to simply capture the data from the invoices using a UiPath script that encapsulates the Rest API calls.
What you will need
UiPath studio: if you don’t have UiPath studio installed on your computer, you can use the community version for testing purposes. Download here.
Source codes: Download UiPath workflows for this demo here.
Basic Plug & Play example
In this demo, you can find two sample workflows that connect UiPath robot to the cognitive platform. The basic version of the data processing workflow is depicted below and contains 4 steps:
- Send documents from a local folder to Rossum.
- Rossum processes the documents (it can take several minutes)
- Rossum online user interface is used for human verification (this step can be skipped by using Optional_AutomatedVerification workflow, more information here)
- Receive data from Rossum and store the results in .xlsx file
Step 1: Decompress the source code file
First, you need to decompress the provided .zip file. It has the following structure:
Important files are:
- a_Input files – Folder for PDFs that will be sent to Rossum cognitive platform (it contains an example file already)
- b_Processing files – PDF files in this folder have already been imported to Rossum cognitive platform and are pending review
- c_Processed files – PDF files in this folder have been successfully processed and reviewed in Rossum cognitive platform
- d_Output data – results will be stored here
- 01_Import, 02_Export, Optional_AutomatedVerification.xaml – UiPath source files needed for importing documents, exporting the data and automating human verification
- Credentials.json – json file where you need to fill your Rossum credentials before you start
- License file – includes licensing details for this example
Step 2: Insert your Rossum credentials
Before you start using the workflows, you have to fill your username and password in the credentials.json file. This file is used by all UiPath activities to authenticate your account. When you open credentials.json in your favorite text editor, you’ll see the default content:
Replace the username and password placeholders with credentials that you have used during your account creation (if you don’t have an account, create it here). Your file should look like the one below (with different credentials):
Step 3: Send documents
If you have already set up your credentials file, you can start sending documents to Rossum. Workflow 01_Import is prebuilt for you and it automatically sends PDFs and images that are stored in a_Input files folder. This example includes an example file but feel free to test the app with your own invoices.
- Open the 01_Import file in UiPath (it may take a while to automatically download all dependencies)
- Run the workflow by pressing ([wp-svg-icons icon=”play-3″ wrap=”i”]) or F5 on your keyboard. Documents start to upload automatically
- If everything goes well, you should see a dialog window that confirms successful upload
Step 4: Human verification
Now, documents are being processed by Rossum Artificial Intelligence engine. You can see them in the user interface after you login at https://elis.rossum.ai.
You’ll see a list of documents that need to be verified (please note that it may take a while until the AI engine processes the uploaded documents).
Next, you can quickly and efficiently verify the extracted data by clicking the “Start processing” button.
When you verify all the extracted data you can download it by running the second UiPath workflow.
Step 5: Export data
In order to download the final verified data, open 02_Export workflow and run it by pressing ([wp-svg-icons icon=”play-3″ wrap=”i”]) or F5 on your keyboard. It simply downloads the extracted data and stores it in the excel file in “d_Output data” folder.
Please note: This example workflow downloads and stores only the following fields: Invoice ID, Order ID, Date Issue, Total Tax, Net amount, Vendor name, Vendor VAT number, Recipient name. If you want to download different fields you need to edit the fieldsToExtract variable in 02_Export workflow.
In the previous steps, we’ve implemented a very basic flow with human verification. However, it is possible to implement custom logic that allows you to skip the manual check.
We provide UiPath workflow Optional_AutomatedVerification that can be inserted before human verification. It extracts data from Rossum and your custom logic verifies the extracted data instead of a human (ex. PO matching, Vendor matching, etc.).
How does it work? In the image below, you can see a sample UiPath sequence – it accesses the data extracted by Rossum in the “Extract values” subsequence and it needs to decide whether the document can be verified automatically. You should customize this decision process by replacing subsequences in the red rectangle. If you decide that the document should skip human verification, you need to set the “ConfirmDoc” variable to True.
As you can see, this toy does not include any complex code and simply automates all the documents. However, we are sure you will build more complex logic 🙂 Good luck!
Want to automate your invoice capture process? Start extracting your first invoice in 30 seconds in our free trial.
How to extract other entities from the documents?