User Defined Templates
User Defined Templates (UDTs) let you define custom functions once and reuse them across multiple Data Quality policies in ADOC. This avoids duplicating the same logic in different places and ensures consistency.
UDTs are a key part of Policy Management because they extend the platform with reusable, business-specific rules that can be centrally managed.
Why Use UDTs?
- Reusable logic: Write once, use across many policies.
- Flexibility: Build in SQL, Scala, Java, Python, JavaScript, or Expressions.
- Consistency: Standardize business rules across datasets.
- Maintainability: Update logic in one place instead of many.
Types of UDTs
- Transform UDT – Extracts or transforms values from records in a dataset.
- Example: Standardizing phone numbers before validation.
- Validation UDT – Applies rules to validate records in a dataset.
- Example: Ensuring no transaction has a negative amount.
Creating a UDT
- Navigate to Data Reliability > Manage Policies > User Defined Templates.
- Click Create New.
- Choose either Transform UDT or Validation UDT.
- Enter details (Name, Description, Language, Code, Reference Variables).
- (Optional) Add Labels or Metadata.
- Validate your code (see below).
- Click Save.
Validation Methods
Before saving, you should test your UDT code to ensure it works correctly. ADOC provides two ways to validate:
1. Manual Validation
Use sample data that you enter yourself.
- Select Manual from the Validate button.
- Enter your test data.
- Choose an analytics pipeline to run it.
- Provide values for any reference variables in your code.
- Click Validate.
This is useful for quick checks during development.
2. Asset Validation
Use real data from one of your connected assets.
- Select With Assets from the Validate button.
- Choose an asset using the search bar or navigation.
- Click Next to define values for reference variables.
- Click Validate.
This method is recommended for confirming that the UDT works with production-like datasets.
Managing UDTs
All created templates are listed in the User Defined Templates table, which shows:
- Name
- UDT Type (Transform or Validation)
- Language
- Labels
- Created/Updated timestamps
For each UDT, you can:
- Edit: Update logic (linked policies may be impacted).
- View: See full details.
- Linked Policies: Check which policies use it.
- Delete: Remove if no longer needed.
Example Scenario
Your company needs to validate tax calculations across multiple datasets.
- Create a Transform UDT to calculate tax for each record.
- Create a Validation UDT to ensure the tax follows country rules.
- Apply these templates across multiple policies instead of rewriting the logic each time.
This ensures consistency and makes ongoing maintenance far simpler.