# Accuracy Rules

{% hint style="success" %}

#### Accuracy Rules

In this series of detailed workshops we're going to:

* Understand the business value and ROI of implementing business rules
* Master the 7 Data Quality Dimensions in PDC
* Create and configure business rules with detailed step-by-step guidance
* Implement rule actions (Status, Tags, Webhooks) and understand their purpose
* Organize rules using rule groups for operational efficiency
* Monitor and interpret rule execution results for continuous improvement

Accuracy rules verify that data correctly represents reality. This is different from completeness (data exists) or validity (data follows format rules). Accuracy asks: "Is this information TRUE?"
{% endhint %}

x

***

{% hint style="info" %}

#### Accessing your Catalog

To get started using the Data Catalog, log in using the address and credentials provided by your Data Catalog service user or administrator.
{% endhint %}

To access your catalog, please follow these steps:

1. Open **Google Chrome** web browser.
2. Navigate to:

{% embed url="<https://pdc.pentaho.lab>" %}

3. Enter following email and password, then click **Sign In**.

Username: <david.park@adventureworks.com> (mapped to Business Steward role)

Password: Welcome123!

***

x

x

{% tabs %}
{% tab title="Valid Email" %}
{% hint style="info" %}

#### Valid Email Addresses

**Scenario:** Email addresses must follow standard format patterns.
{% endhint %}

**Business Rule Configuration:**

```
Rule Name: Email_Format_Accuracy
Description: Validates email addresses follow RFC-compliant format
Data Quality Dimension: Accuracy
Schedule: Daily
Target: Person.EmailAddress
```

**SQL Query:**

```sql
SELECT 
    COUNT(*) AS total_count,
    SUM(CASE 
        WHEN EmailAddress LIKE '%_@__%.__%' 
        AND EmailAddress NOT LIKE '%[^a-zA-Z0-9.@_-]%'
        THEN 1 ELSE 0 
    END) AS scopeCount,
    SUM(CASE 
        WHEN EmailAddress NOT LIKE '%_@__%.__%' 
        OR EmailAddress LIKE '%[^a-zA-Z0-9.@_-]%'
        THEN 1 ELSE 0 
    END) AS nonCompliant
FROM Person.EmailAddress
```

***

x
{% endtab %}

{% tab title="Order SubTotal Calculation" %}
{% hint style="info" %}

#### Incomplete Product Information

**Scenario:** Verify that order SubTotal matches sum of line items.
{% endhint %}

**Business Rule Configuration:**

```
Rule Name: Order_SubTotal_Calculation_Accuracy
Description: Validates SubTotal equals sum of all order line items
Data Quality Dimension: Accuracy
Schedule: Daily
Target: Sales.SalesOrderHeader
```

**SQL Query:**

```sql
SELECT 
    COUNT(*) AS total_count,
    SUM(CASE 
        WHEN ABS(h.SubTotal - COALESCE(d.LineTotal, 0)) < 0.01 
        THEN 1 ELSE 0 
    END) AS scopeCount,
    SUM(CASE 
        WHEN ABS(h.SubTotal - COALESCE(d.LineTotal, 0)) >= 0.01 
        THEN 1 ELSE 0 
    END) AS nonCompliant
FROM Sales.SalesOrderHeader h
LEFT JOIN (
    SELECT SalesOrderID, SUM(LineTotal) AS LineTotal
    FROM Sales.SalesOrderDetail
    GROUP BY SalesOrderID
) d ON h.SalesOrderID = d.SalesOrderID
WHERE h.OnlineOrderFlag = 1
```

**Hands-On Task:**

1. Create this rule in PDC
2. Run the rule immediately
3. Review results on the History tab
4. Identify which product categories have the most incomplete data

***

x

{% endtab %}
{% endtabs %}

x

x

{% tabs %}
{% tab title="First Tab" %}
x
{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

x


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.pentaho.com/pentaho-data-catalog-en/data-catalog/business-rules/accuracy-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
