Data Action
Data Actions are a core concept in Grooper’s data processing framework, enabling powerful, reusable, and configurable operations for manipulating, transforming, and validating extracted document data. They are the building blocks for data normalization, business rule enforcement, and data model conversion throughout Grooper’s workflow.
What Are Data Actions?
A Data Action is a discrete operation that acts on document data. Data Actions can:
- Assign or transform field values
- Parse and distribute values to other fields
- Copy or move data between elements
- Perform lookups and validations
- Execute custom logic as part of a data processing pipeline
Data Actions are designed to be modular and reusable. With Data Rules, they can be combined into hierarchies allowing complex, multi-step data transformation and validation logic to be built from simple, focused operations.
Why Use Data Actions?
Data Actions provide a clear separation between data extraction (locating data in documents) and data normalization or transformation (making data fit business requirements). This separation offers several benefits:
- Simplified Extraction: Keep extractors focused on finding data, not transforming it.
- Reusability: Common transformations (such as splitting a full name or normalizing phone numbers) can be reused across multiple rules and workflows.
- Maintainability: Changes to business logic or data mapping can be made in one place, without modifying extraction logic.
- Advanced Scenarios: Enable complex data mapping, conditional logic, and multi-stage processing.
Where Are Data Actions Used?
Data Actions are used in several key areas of Grooper:
1. Data Rules
A Data Rule defines logic to be applied to document data, such as normalization, validation, or business rule enforcement. Each Data Rule can have one or more Data Actions assigned to its "True Action" or "False Action" properties. When a Data Rule is executed (for example, by the Apply Rules activity), its Data Actions are applied to the relevant data instances.
- Example: A Data Rule might check if a "Full Name" field is populated. If so, a Data Action can split it into "First Name" and "Last Name" fields.
2. Activities: Convert Data and Route
Some Grooper activities use Data Actions to perform data mapping and transformation as part of broader workflow steps:
- Convert Data
- The Convert Data activity transforms a document from one Content Type (data model) to another. The "Actions" property is a collection of Data Actions that define how data is copied, mapped, or transformed from the source to the target type. This is essential for data normalization, especially when consolidating data from multiple document types into a single export format.
- Route
- The Route activity can move or clone documents into different batch processes based on classification or business rules. When routing between different Content Types, Data Actions can be defined to map, copy, or transform data fields as part of the routing process, ensuring that data fits the requirements of the target workflow.
How Data Actions Are Applied
Data Rules
When a Data Rule is executed (such as by the Apply Rules activity), its Data Actions are applied to the document’s data instance. The process is as follows:
- The Data Rule evaluates its trigger condition.
- If the condition is met, the "True Action" (a Data Action or hierarchy of Data Actions) is executed.
- If the condition is not met and a "False Action" is defined, it is executed instead.
- Each Data Action manipulates the data as configured—assigning values, performing calculations, or raising issues.
This approach is ideal for normalization, validation, and enforcing business logic after extraction.
Convert Data and Route Activities
In activities like Convert Data and Route, Data Actions are used to map and transform data between different Content Types:
- In Convert Data, the "Actions" collection specifies the sequence of Data Actions to execute. These actions define how each field or group of fields is copied, transformed, or calculated in the target data model.
- In Route, Data Actions can be part of the routing definition, ensuring that when a document is moved or cloned into a new process (potentially with a different Content Type), its data is mapped and transformed appropriately.
This enables advanced scenarios such as:
- Data normalization from multiple source types to a single output type
- Conditional data mapping based on business rules
- Multi-stage processing where data is transformed at each step
Types of Data Actions
Grooper provides a variety of built-in Data Actions, including:
- Set Field Value: Assigns or calculates a value for a field.
- Copy Base: Copies groups of fields or hierarchical data.
- Parse Value: Splits or parses a field into multiple outputs.
- Raise Issue: Flags data issues for review.
- And many more, including custom actions for advanced scenarios.
Each Data Action can be configured with properties such as "Display Name" and "Remarks" for documentation and clarity.
Best Practices
- Use Data Actions to keep extraction logic simple and focused.
- Group related Data Actions into Data Rules for maintainability.
- Use the "Actions" collection in Convert Data to centralize data mapping and transformation.
- Document your Data Actions with clear display names and remarks.
- Test Data Actions in isolation before integrating them into larger workflows.
Summary Table: Data Actions in Context
| Context | How Data Actions Are Used | Typical Use Cases |
|---|---|---|
| Data Rules (e.g., via Apply Rules) | Applied as "True Action" or "False Action" for normalization, validation, or business logic | Splitting fields, enforcing required values, raising issues |
| Convert Data activity | "Actions" collection defines mapping/transformation from source to target Content Type | Data normalization, output formatting, multi-stage processing |
| Route activity | Data Actions map/transform data when routing between Content Types | Workflow branching, exception handling, parallel processing |