Managing Templates

The Template action column provides different actions to manage the created template. 

Working with Adapters

Smart Bot extracts data from the uploaded document with its default competencies. The extracted data may require some formatting or corrections on default extracted values. In such cases, you need an adapter to update the extracted value. 

Adapter helps to write custom logic for value correction. Adapter is template specific, so you can have a separate adapter for each template and after data extraction an adapter can be called.

For checking the data extraction accuracy, see the Extracting Data from Templates section.

You can download an adapter of a template, make changes to it, and upload it to the template again. Adapters can be used in scenarios such as formatting the value, correcting the value, and calculating the value based on other extracted values. 

Downloading the Default Adapter

After you detect an error in data extraction, you can download the skeleton or format of an adapter, for a specific template and update it to map the corrected values.

To download an adapter:

  1. Select the required template and click the icon. You are prompted for confirmation.
  2. Click OK. The adapter is downloaded as a <template name>.py file.

The adapter skeleton looks like a default structure with all the arguments such as result_json, template_json. roi_df, and ml_predict_json.

You can write the code to extract correct information, or you can change the entry which comes under the result_json argument by putting correction logic. You can not change the default adapter skeleton.

You can update the adapter code for the result_json argument and upload the adapter. See Uploading an Adapter.

Updating an Adapter

If the selected fields and values are not properly extracted, you can create an adapter to correct the wrong entries. 

Creating an adapter requires Python programming knowledge. 

To update an adapter:

  1. Download an adapter for the selected template. It contains a skeleton of the method with its signature (Default structure of adapter with arguments).
  2. Write a python code based on the requirement. Several system variables are available with respective values which are helpful for further logic and for updating the field values.
  3. Specify the exact coordinates or values for the field in the result_json argument and save the adapter. After the adapter is updated, you need to upload an updated adapter to the same template.

Data is extracted from both the Form and Table fields. While creating an adapter, you can mention these parameters in the code, so it becomes easy to understand and helps to extract the data accurately. 

In this example, let us see the adapter creation for correcting the Delivery Location field value.

  1. Upload the document to the template and select the Delivery Location field.

The value for Delivery Location is in three lines. But from the Maker Checker screen, only one line is displayed for this field.

The extracted data can be checked through the maker checker screen after uploading the template through the Template extraction action. See the Extracting Data from Templates section.

  1. Download the default adapter for the template.
  2. To change the value for Delivery location, write the code for obtaining the field coordinates from roi_df, update the result_json with the coordinates for the extracted field, and update the adapter.

  1. Save the adapter and upload to the template.
  2. From the Maker Checker screen, all three values for the Delivery Location field are displayed. 

Uploading an Adapter

After an adapter is updated, upload the adapter from the Templates section. An adapter is template-specific and should be uploaded to a specific template only.

To upload an adapter:

  1. Select the required template and click the icon   The Upload Adapter window is displayed.

  1. Click Choose file and select the adapter.
  2. Click Upload.

The latest adapter is uploaded and applied for the template.

Removing an Adapter from a Template

To remove an existing adapter:

  1. Select the required template and click. A pop-up window is displayed prompting for confirmation.
  2. Click OK.

The adapter is removed for a template.

Deleting an existing Template

To delete an existing template:

  1. Select the required template and click. A pop-up window is displayed prompting for confirmation.
  2. Click OK.

The template is deleted from the Templates section.

Editing Template

Edit Template action helps to make changes related to selected fields from the created template. 

To Edit an existing template:

  1. Select the required template and click

The CV Template Details page is displayed. 

  1. You can change the Value type for the selected field from the drop-down list.
  2. From the Add/Remove Field section, you can remove fields which are not required for mapping. 
  3. From the Advanced Configuration section, you can change the field level configuration and mapping. 

Cloning Template

Clone template action helps to create a replica of an existing template. When you need to apply the same post processing logic to another template you can clone an existing template. All the field related mapping, configuration is cloned as per the existing template.

To Clone an existing template:

  1. Select the required template and click .

Clone Template pop up window is displayed. 

  1. Enter the New Template Name for the cloned template and click Clone.

The clone is created in the template section and the CV Template Details page is displayed. 

  1. From the Add/Remove Field section, you can add required fields and/or remove fields which are not required for mapping. 
  2. You can change the Field type for the selected field from the drop-down list.
  3. You can change the Value type for the selected field from the drop-down list.
  4. From the Advanced Configuration section, you can change the field level configuration and mapping. 
  5. From the File option, you can delete previous documents and upload another document.