# Timeliness and Conformity Rules

{% hint style="success" %}

#### Timeliness & Conformity 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

{% 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="Recent Order Activity" %}
{% hint style="info" %}

#### Recent Order Activity

**Scenario:** Monitor that orders are being processed within expected timeframes.
{% endhint %}

**Business Rule Configuration:**

```
Rule Name: Order_Processing_Timeliness
Description: Ensures orders are shipped within 7 days of order date
Data Quality Dimension: Timeliness
Schedule: Daily
Target: Sales.SalesOrderHeader
```

**SQL Query:**

```sql
SELECT 
    COUNT(*) AS total_count,
    SUM(CASE 
        WHEN Status = 5  -- Shipped
        AND DATEDIFF(day, OrderDate, ShipDate) <= 7
        THEN 1 
        WHEN Status < 5  -- Not yet shipped
        AND DATEDIFF(day, OrderDate, GETDATE()) <= 7
        THEN 1 
        ELSE 0 
    END) AS scopeCount,
    SUM(CASE 
        WHEN Status = 5 
        AND DATEDIFF(day, OrderDate, ShipDate) > 7
        THEN 1 
        WHEN Status < 5 
        AND DATEDIFF(day, OrderDate, GETDATE()) > 7
        THEN 1 
        ELSE 0 
    END) AS nonCompliant
FROM Sales.SalesOrderHeader
WHERE OrderDate >= DATEADD(month, -1, GETDATE())  -- Last month's orders
```

***

x
{% endtab %}

{% tab title="Phone Numbers" %}
{% hint style="info" %}

#### Incomplete Product Information

**Scenario:** Enforce standard phone number format across all records.
{% endhint %}

**Business Rule Configuration:**

```
Rule Name: Phone_Number_Format_Conformity
Description: Validates phone numbers follow standard format pattern
Data Quality Dimension: Conformity
Schedule: Weekly
Target: Person.PersonPhone
```

**SQL Query:**

```sql
SELECT 
    COUNT(*) AS total_count,
    SUM(CASE 
        WHEN PhoneNumber LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
        OR PhoneNumber LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
        THEN 1 ELSE 0 
    END) AS scopeCount,
    SUM(CASE 
        WHEN PhoneNumber NOT LIKE '[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
        AND PhoneNumber NOT LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
        THEN 1 ELSE 0 
    END) AS nonCompliant
FROM Person.PersonPhone
```

***

x

{% endtab %}
{% endtabs %}

x

x

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

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

x
