Data validation
Data validation is the testing of data against agreed rules, such as format, range, allowed lists and consistency between fields, to decide whether values are acceptable. Eurostat defines it as verifying whether a combination of values belongs to a set of acceptable combinations.
What it is
Data validation is the testing of data against a set of rules to decide whether it is acceptable. The Eurostat data validation page defines it as an activity that verifies whether or not a combination of values is a member of a set of acceptable combinations.
Each rule is a test with a clear result. The common types are:
- Format: a date, code or identifier has the expected structure and length.
- Range: a value lies between agreed limits, for example an amount above zero.
- List: a value belongs to an agreed set, such as a currency code.
- Consistency: two fields agree, for example an end date after a start date.
- Completeness: required fields are present.
- Uniqueness: each identifier appears only once.
- Plausibility: a value is reasonable against history or a related figure.
The European Commission statistical portal describes validation rules as jointly designed and agreed by the experts of each statistical domain, and names the Validation and Transformation Language as a standard notation for writing them. It also treats structural validation, which checks that a file has the declared structure, as a separate step.
A failed rule usually returns one of two results. An error blocks the record, and a warning sends it for a query without blocking it.
Why it matters
Errors caught at the point of entry or receipt cost less to correct than errors found in a published figure. Validation also gives a repeatable test, so that two people checking the same file reach the same result.
Any process that receives data from another party, such as a return to a supervisor or a file from a counterparty, depends on validation to decide whether the data can be accepted.
Worked example
Illustrative numbers. A file of 500 loan records is checked against three rules.
- Rule 1: the amount is above zero. 5 records fail.
- Rule 2: the currency code is on the agreed list. 10 records fail.
- Rule 3: the end date is after the start date. 20 records fail.
The 35 failures fall on 32 records, because 3 records fail two rules. The 32 records are rejected with the failed rule named for each. The other 468 records pass and move on.
Assumptions
- The rules reflect the agreed definitions of each field, which a data dictionary records.
- Passing all rules shows that the data is acceptable under the rules, not that it is true.
- Rules are reviewed when definitions change, or they reject good data and accept bad.
Who uses it
- Data analysts design and run validation checks on the data they receive.
- Regulatory reporting analysts run the validation rules attached to a return before submission.
- Data governance analysts agree the rules with data owners and track failure rates.
- Master data specialists validate added and changed records before they enter shared data sets.
Common confusions
- Validation versus cleaning: validation detects and reports a failure, while cleaning corrects it.
- Validation versus truth: a value can satisfy every rule and still be wrong, for example a valid currency code that is the wrong one.
- Data validation versus model validation: data validation tests values against rules, while model validation is an independent review of a model.
- Error versus warning: an error blocks a record, while a warning flags it for a decision.