This is a guest post from Setric Breeze J, a Certified RPA Developer with over 6 years of IT Experience. If you have an idea for a blog post or tutorial that you think would benefit the Automation Anywhere developer community, let us know at developer@automationanywhere.com.
In this tutorial, we will look at how you can create a custom domain to be used in IQ Bot.
Let's first try to understand what a domain is and why a custom domain is required before we proceed to create a custom domain.
A Domain contains information about the language of the documents and the fields that the system extracts from the documents.
Creating a custom domain is highly recommended when one or more of the following conditions are met:
- The fields of interest are unique to the use case
- Inbuilt/system domain doesn’t contain minimum required fields to aid document classification
- Inbuilt/system domain doesn’t have the required language listed for selection
Here are the sample documents we need to complete this tutorial.
- Custom Domain Template - CSV File
- Custom Domain Template - JSON structure
- Custom Domain Sample PDF - attached
When the attached PDF file document is pushed into IQ Bot by choosing one of the standard domains listed in Document type while creating learning instance, this document will be shown with status as Unclassified since the labels in the documents are unique to this use case.
But when you create a custom domain and push the same document to the IQ bot, the document will get classified and create a new group because we have provided the required aliases to the IQ Bot to classify the document.
Here are the pre-requisites to creating a Custom Domain in IQ Bot:
- Make a list of fields that are to be extracted from the document:
- Form Field – Non-Repetitive like Invoice No, Invoice Date etc.,
- Table Field – Repetitive like Goods Description, Goods Total, Unit Price etc., (One Invoice can have multiple lines of goods description)
- **If any field that may come both as Repetitive or Non-Repetitive, then we can create 1 form Field and 1 table field for the same.
- Identify and list all the possible keywords/labels for all the Form and table fields that come in the document to identify the respective field values. For example, Invoice Number can be available in the document with the label as either Invoice #, Invoice No, Invoice Number, Invoice No: etc.,
Refer to the screenshot below with Sample of FormField “Invoice Number”
- Likewise you can list all the required Forms and table fields in the CSV template file attached.
- Convert the CSV file into JSON – JSON will be used as input to create Custom Domain.
- You can also create a JSON file directly as below and can be used as input. (Sample attached)
Now let's start with the steps to create a custom domain:
Step 1: Generate API Key:
- From the drop-down select “Post”
- Enter the URL in the mentioned format: https://ControlRoomURL/v1/authentication
Click on Headers Tab:
- In the Key Column Enter as Content-Type
- In the Value Column provide value as “application/json”
Click on Body Tab:
{
"username": "logistics\CR_Username",
"password": "********"
}
API Key Token Generated:
- Then click on Send Button.
- The API Token gets generated as below.
Step 2: Upload custom domain via JSON
- From the drop-down select “Post”
- Enter the URL in the below-mentioned format
https://ControlRoomURL/:9997/domains/import
http://localhost:9997/domains/import - If accessed via Server use this URL
Click on Headers Tab:
- In the Key Column Enter as x-authorization
- In the Value Column provide value as “Copy and Paste the Generated API Token"
Click on Body Tab:
- Select Raw radio button
- Choose JSON from drop down
- Paste JSON data in body
- Then click on Send Button.
- Below are the status Code, Reason and Description of HTTP Request Response
Now you have successfully created a custom domain that you can use while creating a learning instance. Time to pat on your back, Good job!
Before I sign off for this article, I would like to share some of the best practices to be followed while creating a custom domain.
- Domain name should be unique and cannot be duplicated with the existing one.
- Language specified must be one of the languages supported by the underlying OCR engine of IQ Bot.
- Language name is sensitive. If the IQ Bot portal has a language name as Chinese-simplified, the same must be mentioned in the JSON file.
- Field names should be unique and cannot be duplicated.
- Field Names should not have accented characters.
- Field name should not have special characters. Only Alphanumeric and space is allowed.
- Field name will be displayed on the UI when a custom domain is selected on the LI creation page. The field name will not assist in classification.
- Aliases cannot be duplicated in the same field or between multiple fields.
- Aliases can have special characters.
- Do not add a blank alias either in the JSON file.
- Do not use a comma (,) in the aliases for the table fields.
- IQ Bot Custom Domains use a minimum of 4 fields for classification: this means that custom domains should be created with at least 4 fields, otherwise all files would fall into "unclassified".
- Best practice is to create more than 25 to 30 fields to achieve accurate grouping of layouts and to avoid mixed layouts getting classified in a single group.
- Always create custom domain on sandbox environment as testing of the custom domain will lead to multiple versions of the domain and if not imported in the correct sequence can lead to files getting unclassified in the target environment.
- After testing the classification on a decent volume of files, check if a particular group does not have multiple layouts that are not trainable. In the case of multiple layouts falling into one group, try to create a custom domain with dummy fields specific to those layouts. IQ Bot will find them in one and not in others and if the similarity between multiple layouts is less than 65% then a new group will be created thus splitting those into individual groups.
- After finalizing a custom domain version that needs to be used across all environments, create the same domain in the actual DEV environment.
- As the sequence of the domain created/imported plays an internal role in a learning instance execution, a wise method to keep all the environments aligned is to create a finalized version of the custom domain in all the DEV, UAT and PROD environments at the same time.
Conclusion
Hopefully, you enjoyed learning how to create a custom domain. With this tutorial, you should be able to work with documents that could not be processed with IQ Bot earlier.
Setric Breeze J He is a Certified RPA Developer with 6 years of IT Experience in which 3+ years of experience in Process Automation. He is a quick learner with expertise in Automating applications like Web, Excel, Oracle, IBM Control and has excellent knowledge of IQ Bot.
When he’s not building bots, you can find Setric on LinkedIn.