The Value Mapping extension is a dynamic tool within Rossum that allows you to map values from one field to specific, predefined values in another field. This extension is particularly useful for standardizing data formats, aligning data with external systems, or transforming extracted data into more useful representations.
In this article we will cover:
Configuration Basics
Once activated, configuring the Value Mapping extension involves defining a ‘source field’, a ‘target field’, and a ‘values_mapping’ dictionary. This dictionary maps each source value to a corresponding target value, with the option to apply conditions in the form of Python expressions to control when the mapping occurs.
Example Configurations
These examples illustrate how the Value Mapping extension can be utilized for various data mapping needs.
Example 1: Basic value mapping
Maps values of document_type
to new values in document_type_calculated
. This becomes useful when your target system requires different values of document types than the ones predicted by Rossum.
{
"operations": [
{
"source_field": "document_type",
"target_field": "document_type_calculated",
"values_mapping": {
"tax_invoice": "10",
"credit_note": "20"
}
}
]
}
Example 2: Conditional value mapping
Applies mapping only if a certain condition is met.
{
"operations": [
{
"condition": "{document_type} == 'invoice'",
"source_field": "terms",
"target_field": "payment_code",
"values_mapping": {
"net 30": "30D",
"net 60": "60D"
}
}
]
}
Example 3: Complex mapping with multiple conditions
Involves multiple conditions and mappings for comprehensive data transformation.
{
"operations": [
{
"condition": "{region} == 'EU'",
"source_field": "vat_rate",
"target_field": "vat_code",
"values_mapping": {
"standard": "ST",
"reduced": "RD"
}
},
{
"condition": "{region} == 'US'",
"source_field": "tax_rate",
"target_field": "tax_code",
"values_mapping": {
"state": "STX",
"federal": "FTX"
}
}
]
}
Conclusion
The Value Mapping extension offers a powerful solution for transforming and standardizing data in Rossum. By customizing your data mappings, you can ensure data compatibility and consistency with various systems and processes. If you require assistance or have any questions regarding this extension, Rossum support is always available to help you make the most out of your document processing tasks.