Rossum and UiPath: Invoice extraction in 15 minutes enhanced (source code provided)
Acknowledgement: This improved plug&play open-source example was built by InnovationPath.
Note: This article succeeds a previous post about invoice extraction using UiPath. It is a new, improved version reflecting major and minor Rossum enhancements. You can also find them listed at the end of the article.
Many organizations today are evaluating the opportunity to automate accounts payable processes with UiPath robots. To achieve automation benefits, it is necessary to reduce or eliminate 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, after all….
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 Rossum 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.
NEW 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 Rossum. The basic version of the data processing workflow is depicted below and contains 4 steps:
- Send documents from the local folder to Rossum.
- Rossum processes 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 (it contains an example document already)
- b_Processing files – PDF files in this folder have already been imported to Rossum and are pending review
- c_Processed files – PDF files in this folder have been successfully processed and reviewed in Rossum
- d_Output data – results will be stored here
- 01_Import_v2.xaml, 02_Export_v2.xaml, Optional_AutomatedVerification_v2.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 Rossum username and password in the credentials.json file. This file is used by all UiPath activities to authenticate your Rossum account. When you open credentials.json in your favorite text editor, you’ll see the default content:
Replace the email and password placeholders with credentials that you have used during your Rossum account creation (if you don’t have a Rossum 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 Rossum with your own invoices.
- Open the 01_Import_v2 file in UiPath (it may take a while to automatically download all dependencies)
- Run the workflow by pressing (►) 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://app.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_v2 workflowand run it by pressing (►) or F5 on your keyboard. It simply downloads the extracted data and stores it in the excel file in “d_Output data” folder.
This example workflow automatically downloads and stores invoice data from all the labels that are visible in Rossum user interface. If you want to prevent some field values from being exported, you can do so easily by modifying the setup in Settings -> Your queue -> Fields to capture.
For the Rossum setup where tab “Confirmed” is enabled, invoice in Rossum is then automatically moved from “Confirmed” tab to “Exported” tab. In order to do this, set the argument “TabConfirmedEnabled” to True in the workflow. If the “Confirmed” tab is not enabled, the argument is by default set to Falseand therefore resembles the workflow in the previous version, in which the document in Rossum was automatically moved from “Exported” tab to “Deleted” tab.
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_v2 that can be inserted before human verification. It extracts data from Rossum and your custom logic verifies 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 then 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. If the tab “Confirmed” is enabled change the argument “TabConfirmedEnabled” value to True in the workflow (same as for Export, described in Step 5: Export).
As you can see, this toy does not include any complex code and simply automates all the documents. However, we are sure you can build more complex logic 🙂 Good luck!
List of improvements:
- If the “Confirmed” tab is enabled in Rossum, change the workflow argument “TabConfirmedEnabled” to True and exported documents will now be located in “Exported” tab (vs “Deleted” in previous version).
- Data extracted from Rossum are saved in a XLSX file – one XLSX file per document.
- Headers of data exported from Rossum match the field labels in Rossum user interface.
- In the workflow for Automated human verification, a document which is not to be exported, is moved to the “Postponed” tab.