# Data Quality

Quality expectations attached to schema objects and properties: library checks, SQL rules, and custom assertions.

## Data Quality {#data-quality}

type: DataQuality

| Property | Type | Required | Description |
|---|---|---|---|
| `authoritativeDefinitions` | [AuthoritativeDefinitions](/docs/reference/data-contract/authoritative-definitions/#authoritative-definitions) | No |  |
| `businessImpact` | string | No | Consequences of the rule failure. Examples: `operational`, `regulatory`. |
| `customProperties` | [CustomProperty](/docs/reference/data-contract/custom-properties/#custom-property)[] | No | Additional properties required for rule execution. |
| `description` | string | No | Describe the quality check to be completed. |
| `dimension` | string | No | The key performance indicator (KPI) or dimension for data quality. Valid values are: `accuracy`, `completeness`, `conformity`, `consistency`, `coverage`, `timeliness`, `uniqueness`. |
| `method` | string | No |  Examples: `reconciliation`. |
| `name` | string | No | Name of the data quality check. |
| `schedule` | string | No | Rule execution schedule details. Examples: `0 20 * * *`. |
| `scheduler` | string | No | The name or type of scheduler used to start the data quality check. Examples: `cron`. |
| `severity` | string | No | The severance of the quality rule. Examples: `info`, `warning`, `error`. |
| `tags` | [Tags](/docs/reference/data-contract/tags/#tags) | No |  |
| `type` | string | No | The type of quality check. 'text' is human-readable text that describes the quality of the data. 'library' is a set of maintained predefined quality attributes such as row count or unique. 'sql' is an individual SQL query that returns a value that can be compared. 'custom' is quality attributes that are vendor-specific, such as Soda or Great Expectations. Default value is: `library`. Valid values are: `text`, `library`, `sql`, `custom`. |
| `unit` | string | No | Unit the rule is using, popular values are `rows` or `percent`, but any value is allowed. Examples: `rows`, `percent`. |

### Specific `Type` Properties & Types

- `library` ([See DataQualityLibrary](#data-quality-library))
- `sql` ([See DataQualitySql](#data-quality-sql))
- `custom` ([See DataQualityCustom](#data-quality-custom))

## Data Quality Checks {#data-quality-checks}

type: DataQualityChecks

Data quality rules with all the relevant information for rule setup and execution.
Implemented as array of type [DataQuality](#data-quality)[].

## Data Quality Library {#data-quality-library}

type: DataQualityLibrary

| Property | Type | Required | Description |
|---|---|---|---|
| `mustBe` |  | No | Must be equal to the value to be valid. When using numbers, it is equivalent to '='. |
| `mustBeBetween` | number[] | No | Must be between the two numbers to be valid. Smallest number first in the array. |
| `mustBeGreaterOrEqualTo` | number | No | Must be greater than or equal to the value to be valid. It is equivalent to '&gt;='. |
| `mustBeGreaterThan` | number | No | Must be greater than the value to be valid. It is equivalent to '&gt;'. |
| `mustBeLessOrEqualTo` | number | No | Must be less than or equal to the value to be valid. It is equivalent to '&lt;='. |
| `mustBeLessThan` | number | No | Must be less than the value to be valid. It is equivalent to '&lt;'. |
| `mustNotBe` |  | No | Must not be equal to the value to be valid. When using numbers, it is equivalent to '!='. |
| `mustNotBeBetween` | number[] | No | Must not be between the two numbers to be valid. Smallest number first in the array. |
| `rule` | string | Yes | Define a data quality check based on the predefined rules as per ODCS. Examples: `duplicateCount`, `validValues`, `rowCount`. |

## Data Quality SQL {#data-quality-sql}

type: DataQualitySql

| Property | Type | Required | Description |
|---|---|---|---|
| `query` | string | Yes | Query string that adheres to the dialect of the provided server. Examples: `SELECT COUNT(*) FROM ${table} WHERE ${column} IS NOT NULL`. |

## Data Quality Custom {#data-quality-custom}

type: DataQualityCustom

| Property | Type | Required | Description |
|---|---|---|---|
| `engine` | string | Yes | Name of the engine which executes the data quality checks. Examples: `soda`, `great-expectations`, `monte-carlo`, `dbt`. |
| `implementation` | string, object | Yes |  |
