Genpact AP Knowledge Center

Support

Enrichment Overview and Configuration

V1.1

Overview

Data enrichment refers to the process of adding additional data above the extraction data. You can add this enrichment data from a master database. 

You can validate and update the enrichment data in the portal on the Eyeball page.
For details, see this article.

Prerequisites

Make sure you have enrichment.yaml and InvoiceLineItem-invoice-enrichment.yaml configuration files defined in the system.

Configuration

The predefined configuration in yaml files define the criteria for deciding from where and which data is fetched for enrichment. The two sources to take data from can be the side-car or a master data.

Template

enrichment.yaml
kind: document 
metadata: 
  name: extraction/v1/document-classification 
spec:
nodes:
  - if: true
    nodes: !include priority-calculation.yaml

  - if: true
    nodes: !include target-date-calculation.yaml

  - if: true
    then:
      name: Creation_Date
      value: ': @Creation_Date'
  - if: true
    then:
      name: Image_Name
      value: ': @Image_Name +".pdf"'
  - if: true
    then:
      name: OCR_Id
      value: ': ToString(ToGuid(wf.Variables["transactionGuid"]))'
  - if: true
    then:
      name: OCR_Index_Date_Time
      value: ': wf.CreatedAt'
  - if: true
    then:
      name: currency
      value: USD
  - if: 'it["TotalTax"].Value == null'
    then:
      name: TotalTax
      value: 0
	- if: true
    then:
      name: OpcoCode
      value: ':@Data.Query("GetOpCoFromAddress", new object[] { ToString(it["BillingAddress"]?.Value), ToString(it["ShippingAddress"]?.Value), ToString(it["soldToAddress"]?.Value), ToString(it["CustomerAddress"]?.Value) }).opco_code'
	- if: true
    then:
      name: VendorUpdateRequired
      value: false
  - if: ':!string.IsNullOrWhiteSpace(it["InvoiceId"]?.Value?.ToString())'
    then:
      name: InvoiceId
      value: ':Join(it["InvoiceId"]?.Value?.ToString().ToCharArray().Where(char.IsLetterOrDigit(it)), "")'
 
ParameterDescription
If thenThe condition to execute the rule for enrichment.
If then (Priority)The condition to trigger priority-calculation.yaml file.
if then (Target Date)The condition to trigger target-date-calculation.yaml file .
NameThe name of the field.
ValueThe value of the field, based on fulfilment of the condition.

For example, in the above template:

  • If there is an OCR_Id field then the value for the field will be the workflow variable named “transactionGuid”.
  • If there is a currency field then the currency value is set to USD.
- if: true 
    then: 
      name:  OCR_Id 
      value: ': ToString(ToGuid(wf.Variables["transactionGuid"]))' 
  • the extraction returns null if it can’t find content of a field, so while enrichment the system replaces null to 0.
    In the example below, since the total tax value is ‘null’, so it is replaced and the total tax value after enrichment is 0.
- if: 'it["TotalTax"].Value == null'  
    then: 
      name:  TotalTax 
      value: 0 
  • Since the conditions for the target date and priority are set to true, so both priority-calculation.yaml and target-date-calculation.yaml files will be triggered. In addition, it is possible to configure these conditions based on specific needs.
- if: true
      nodes: !include priority-calculation.yaml

  - if: true
      nodes: !include target-date-calculation.yaml


InvoiceLineItem-invoice-enrichment.yaml
- if: true 
    then: 
      name: LineItemNumber 
      value: ': @Index' 

For example, in the above configuration, if the enrichment is enabled then the value of the LineItemNumber field will be the running number for each line item in the system.

Header level enrichment rules:

The Enrichment rules for header level field has following condition: 

  • You can add If: '@index == null' condition to every header-level enrichment rule.
  • You can update an existing condition with AND operator.
  • Replace the If 1 ==1 condition with If: '@index ==null condition. Don't keep both the conditions.

V1.0

Overview

Data enrichment refers to the process of adding additional data above the extraction data. You can add this enrichment data from a master database. 

You can validate and update the enrichment data in the portal on the Eyeball page.
For details, see this article.

Prerequisites

Make sure you have enrichment.yaml and InvoiceLineItem-invoice-enrichment.yaml configuration files defined in the system.

Configuration

The predefined configuration in yaml files define the criteria for deciding from where and which data is fetched for enrichment. The two sources to take data from can be the side-car or a master data.

Template

enrichment.yaml
kind: document 
metadata: 
  name: extraction/v1/document-classification 
spec:
  nodes:
	  - if: true
    then:
      name: Creation_Date
      value: ': @Creation_Date'
  - if: true
    then:
      name: Image_Name
      value: ': @Image_Name +".pdf"'
  - if: true
    then:
      name: OCR_Id
      value: ': ToString(ToGuid(wf.Variables["transactionGuid"]))'
  - if: true
    then:
      name: OCR_Index_Date_Time
      value: ': wf.CreatedAt'
  - if: true
    then:
      name: currency
      value: USD
  - if: 'it["TotalTax"].Value == null'
    then:
      name: TotalTax
      value: 0
	- if: true
    then:
      name: OpcoCode
      value: ':@Data.Query("GetOpCoFromAddress", new object[] { ToString(it["BillingAddress"]?.Value), ToString(it["ShippingAddress"]?.Value), ToString(it["soldToAddress"]?.Value), ToString(it["CustomerAddress"]?.Value) }).opco_code'
	- if: true
    then:
      name: VendorUpdateRequired
      value: false
  - if: ':!string.IsNullOrWhiteSpace(it["InvoiceId"]?.Value?.ToString())'
    then:
      name: InvoiceId
      value: ':Join(it["InvoiceId"]?.Value?.ToString().ToCharArray().Where(char.IsLetterOrDigit(it)), "")'
 
ParameterDescription
If thenThe condition to execute the rule for enrichment.

For example, in the above template:

  • If there is an OCR_Id field then the value for the field will be the workflow variable named “transactionGuid”.
  • If there is a currency field then the currency value is set to USD.
- if: true 
    then: 
      name:  OCR_Id 
      value: ': ToString(ToGuid(wf.Variables["transactionGuid"]))' 
  • the extraction returns null if it can’t find content of a field, so while enrichment the system replaces null to 0.
    In the example below, since the total tax value is ‘null’, so it is replaced and the total tax value after enrichment is 0.
- if: 'it["TotalTax"].Value == null'  
    then: 
      name:  TotalTax 
      value: 0 
InvoiceLineItem-invoice-enrichment.yaml
- if: true 
    then: 
      name: LineItemNumber 
      value: ': @Index' 

For example, in the above configuration, if the enrichment is enabled then the value of the LineItemNumber field will be the running number for each line item in the system.


Copyright © 2025 Genpact. All rights reserved.