Quality Rules
Quality Rules help ensure that your collected data is accurate, consistent, and reliable. By applying quality rules, you can automatically detect errors, maintain high-quality data, and make better decisions based on validated information.
You have two options for creating and applying rules:
-
Create custom rules
-
Generate AI suggested rules
The system sends 10 random records as a sample data to the AI. It analyzes the selected run, generates rules and applies them to subsequent runs. This ensures that similar patterns and issues are automatically monitored and validated in future data collection.
Types of Rules
| Type | Description |
|---|---|
| Custom Rule | - Provides complete control over your data validation logic. - Allows you to manually create and configure rules to meet your specific needs. - Ideal when you have known criteria or business rules that must be enforced consistently. |
| Generate Suggested Rule | - Leverages AI to analyze data patterns and suggest rules automatically. - Helps identify potential issues that may not be obvious manually. - You can choose to apply a specific rule or select all suggested rules to ensure comprehensive coverage. |
Quality Rule Steps
- Step 1: Navigate to the Datasets section.
- Step 2: Select the run for which you want to set a rule.
- Step 3: Click on Set QA Rule.
- Step 4: You will be directed to the Generate Rule section, where you can select the page to which you want to apply the rule.
- Step 5: You can either choose to create custom rules or ask AI to generate rules.
- Step 6: When the rule is applied, view the quality status for the run.
Managing Quality Rules
All applied rules can be accessed and managed in the Quality Rules section of the platform. Here, you can:
-
View a list of all active and inactive rules.
-
View the columns and pages that you have selected for each rule.
-
Activate or deactivate rules depending on project needs.
-
Edit existing rules to fine-tune their logic.
-
Delete rules that are no longer relevant.
By actively managing quality rules, you can ensure that your data remains accurate, consistent and aligned with the business objectives. This feature provides flexibility, whether you prefer full manual control or want to leverage AI for smarter rule suggestions.
Types of Quality status
| Type | Description |
|---|---|
| Not Started | Displayed when the run has not started yet and is still getting ready to begin processing. |
| Processing | Displayed when the run is actively validating the data and processing is in progress. |
| Skipped | Displayed when no rule is set for the run, when the run is merged or imported or when it contains JSON-formatted data. Also used as the default status when no other status applies. |
| Success | Displayed when all applied rules have been successfully validated. |
| Failed | Displayed when any one of the applied rules fails, even if the others have passed. |
Limitations
- Quality Rules can be applied only to standard runs and JSON-formatted data. Runs that are **imported or merged do not support rule creation.
- Runs larger than 4GB can have rules applied, but only if the QUALITY_RULE_USE_SAMPLE report parameter is set. Once set, QA validation will be performed only on the specified number of rows.
Copy Rules
It allows users to copy one or multiple rules from one report to another. This can be within the same account or across different accounts, providing flexibility in reusing configurations and reducing the need to recreate rules manually.
You can copy rules in the following ways:
-
From one report to another within the same account
-
From one account’s report to another account’s report
Note
- This feature is available only for users with the Admin role.
Rule Compatibility Conditions
The system validates compatibility between source and destination before allowing rules to be copied. There are two possible conditions:
1. Exact Match
- The column name, page ID/name, and count are identical between source and destination.
- In this case, selected or all rules can be copied directly.
2. Partial Match
- At least one column matches between the source and destination.
- The system categorizes columns as:
| Category | Description |
|---|---|
| Matched | Columns that are identical and allow rule copying. |
| Mismatch | Coulmns that do not match and cannot be copied. |
- Only rules associated with matched columns can be successfully copied.
Creating Quality rules for JSON data
Quality rules can be created for data in JSON format. Depending on the JSON structure, rules can be created for the following:
- Simple Value
- Array
- Object
Simple Value
A Simple Value is a JSON key that stores a single value, such as a string, number or boolean. Rules can be created directly on these keys.
Example JSON
{
"batch_id": "2",
"status": "Completed"
}
Example Rule
batch_id must not be empty
This rule validates that the batch_id field always contains a value.
Array
When a JSON key contains an array, rules can only be created on the entire array.
✅ Valid
Select the complete array key to create a rule.
Example JSON
{
"intercepted_requests": [
{
"category": "Internet",
"status": "Available"
}
]
}
Example Rule
intercepted_requests must not be empty
❌ Invalid
The following actions are not supported:
- Creating rules on a partial selection of the array.
- Creating a rule for a specific array index or nested key without using Regular Expression (Regex).
Note
- To validate specific elements or nested keys within an array, create the rule using Regular Expression (Regex).
Object
When a JSON key contains an object, rules cannot be created using only the object name because the object itself is a container and does not represent a single value.
To create a valid rule, specify both the object and the nested key.
❌ Invalid
parsed_address must not be empty
The rule above is invalid because parsed_address is an object.
✅ Valid
parsed_address.formatted_address must not be empty
This rule validates that the formatted_address field within the parsed_address object contains a value.
Example JSON
{
"parsed_address": {
"formatted_address": "123 Robbins Rest, Davenport, FL 32296",
"city": "Davenport",
"state": "FL"
}
}
Categories of Rules
| Category | Rule | Description |
|---|---|---|
| Value Set Comparisons | expect_column_distinct_values_to_be_in_set(column, value_set) |
All distinct column values must exist within a given set. |
expect_column_distinct_values_to_contain_set(column, value_set) |
Column must contain all values from the given set (but may have extra values). | |
expect_column_distinct_values_to_equal_set(column, value_set) |
Column’s distinct values must exactly match the given set. |
| Category | Rule | Description |
|---|---|---|
| Value Checks | expect_column_values_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Each value should lie within a specified range. |
expect_column_values_to_be_in_set(column, value_set) |
Each value must be one of the specified set. | |
expect_column_values_to_be_null(column) |
Values must be null. | |
expect_column_values_to_be_of_type(column, type_) |
Values must match the specified data type. | |
expect_column_values_to_be_unique(column) |
Values in the column must not repeat. | |
expect_column_values_to_not_be_in_set(column, value_set) |
Values should not appear in the given set. | |
expect_column_values_to_not_be_null(column) |
Values must not be null. |
| Category | Rule | Description |
|---|---|---|
| String Operations | expect_column_value_lengths_to_be_between(column, min_value, max_value, strict_min, strict_max) |
String lengths must be within the given range. |
expect_column_value_lengths_to_equal(column, value) |
String length must equal the given value. | |
expect_column_values_to_match_regex(column, regex) |
Values must match the specified regex pattern. | |
expect_column_values_to_match_regex_list(column, regex_list, match_on) |
Values must match at least one regex from a list. | |
expect_column_values_to_not_match_regex(column, regex) |
Values must not match the regex. | |
expect_column_values_to_not_match_regex_list(column, regex_list) |
Values must not match any regex in the list. |
| Category | Rule | Description |
|---|---|---|
| Multi-Column Expectations | expect_column_pair_values_a_to_be_greater_than_b(column_A, column_B, or_equal) |
Column A’s value should be greater (or equal) than Column B’s value. |
expect_column_pair_values_to_be_equal(column_A, column_B) |
Values in both columns must match exactly. | |
expect_column_pair_values_to_be_in_set(column_A, column_B, value_pairs_set) |
Column pairs must exist in a specified set of pairs. | |
expect_compound_columns_to_be_unique(column_list) |
Combination of values across multiple columns must be unique. | |
expect_multicolumn_sum_to_equal(column_list, sum_total) |
Sum of specified columns must equal a given total. | |
expect_select_column_values_to_be_unique_within_record(column_list) |
Values across selected columns in a row must be unique. |
| Category | Rule | Description |
|---|---|---|
| Table-Level Expectations | expect_column_to_exist(column) |
The column must exist in the table. |
expect_table_column_count_to_be_between(min_value, max_value) |
Number of columns must fall within a range. | |
expect_table_column_count_to_equal(value) |
Table must have exactly this many columns. | |
expect_table_columns_to_match_ordered_list(column_list) |
Columns must match the specified list in the given order. | |
expect_table_columns_to_match_set(column_set, exact_match) |
Table columns must match a set (order doesn’t matter). | |
expect_table_row_count_to_be_between(min_value, max_value, strict_min, strict_max) |
Number of rows must be within a range. | |
expect_table_row_count_to_equal(value) |
Table must have exactly this many rows. |
| Category | Rule | Description |
|---|---|---|
| Statistical Measures | expect_column_kl_divergence_to_be_less_than(column, partition_object, threshold, ...) |
KL divergence from reference distribution must be below threshold. |
expect_column_max_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Maximum value must be within a range. | |
expect_column_median_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Median value must be within a range. | |
expect_column_min_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Minimum value must be within a range. | |
expect_column_stdev_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Standard deviation must be within a range. | |
expect_column_sum_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Sum of column values must be within a range. |
| Category | Rule | Description |
|---|---|---|
| Value Distribution | expect_column_most_common_value_to_be_in_set(column, value_set, ties_okay) |
Most frequent value(s) should be in the given set. |
expect_column_proportion_of_non_null_values_to_be_between(column, min_value, max_value, ...) |
Percentage of non-null values must be within range (0–1). | |
expect_column_proportion_of_unique_values_to_be_between(column, min_value, max_value, ...) |
Percentage of unique values must be within range (0–1). | |
expect_column_quantile_values_to_be_between(column, quantile_ranges, allow_relative_error) |
Specific quantiles must fall within given ranges. | |
expect_column_unique_value_count_to_be_between(column, min_value, max_value, strict_min, strict_max) |
Number of unique values must be within a range. |
| Category | Rule | Description |
|---|---|---|
| Statistical Outliers | expect_column_value_z_scores_to_be_less_than(column, threshold, double_sided) |
Z-scores of values must be below a threshold (detect outliers). |