Business Rules

In order to define a Business Rule, you need to define both a Selection and one or multiple Rule(s). The Selection defines which data you want to measure and the Rule defines the rule that you want to apply to the data.

The Selection is a query that results in a dataset with the columns that you need. The Rule is a SQL query that is applied to the result of the Selection. the Rule should result in a single column where each row contains a boolean (True/False) value. When the value is True, the data meets the requirement of the rule. When the value is False, the data does not meet the requirement of the rule.

        flowchart LR;
  business_rule --> selection;
  selection --> rules;
    

YAML Example

# Example of a Business Rule in YAML format
name: "Each policy should have a single person"
selection_query: "SELECT * FROM policy LEFT JOIN person ON policy.person_id = person.id"
custom_properties: 
- application: policy_timeline
rules:
- rule: "Each policy should have a person"
  query: "person.id IS NOT NULL"
- rule: "Each policy should only contain a single person"
  query: "ROW_NUMBER() OVER (PARTITION BY policy.id) = 1"

End Points

At the following location the API references can be found: Athora Data Quality End Point Docs. For Business Rules, the following end points can be used:

Manage:
/business_rules #POST for adding a new selection
/business_rules/{id} #PUT for changing an existing selection

Find (GET):
/business_rules #For returning all selections
/business_rules/{id} #For finding a specific selection

This will result in a table that shows which policies do not meet the requirement of having a single person.

Selections

As preparations for Business Rules, a dataset can be predefined with the Selections End Points. This selection can be referenced in the Business Rule(s).

End Points

At the following location the API references can be found: https://app-dq-dev-01.azurewebsites.net/docs#/. For Selections, the following end points can be used:

Manage:
/selections #POST for adding a new selection
/selections/{id} #PUT for changing an existing selection

Find (GET):
/selections #For returning all selections
/selections/{id} #For finding a specific selection
/selections/find_one #To find specific selections without pagination
/selections/find  #To find specific selection with pagination

Custom Properties

Predefined tags can be given to multiple parts within the API. These tags can be used to e.g. group or catagorize toSelections and Business Rules.

End Points

At the following location the API references can be found: https://app-dq-dev-01.azurewebsites.net/docs#/. For Custom Properties, the following end points can be used:

Manage:
/custom_properties #POST for adding a new selection
/custom_properties/{id} #PUT for changing an existing selection

Find (GET):
/custom_properties #For returning all selections
/custom_properties/{id} #For finding a specific selection
/custom_properties/find_one #To find specific selections without pagination
/custom_properties/find  #To find specific selection with pagination