Data quality
Качество данных
Data quality is how well data serves a particular purpose. An order report, for example, needs orders to arrive on time and be counted once, with amounts that match what customers actually paid.
What makes data good enough?
Start with the decision the data supports. A finance team closing last month's books can work with yesterday's snapshot if it includes all transactions for the period. A warehouse team deciding whether to accept a new order needs a much fresher inventory count. Neither team can judge quality from the table schema alone.
How teams measure it
- Completeness: Are required fields filled in, and did all expected records arrive? Those are separate questions: a file can have no missing values and still be missing an entire store's sales.
- Validity: Do values follow the allowed format, range, or set of codes? A well-formed delivery date can still be wrong.
- Accuracy: Do values reflect what happened? To check whether an order was paid, compare its recorded status with the payment processor's records.
- Uniqueness: Is there only one record where the dataset promises one? Two rows for an order are a problem in an order summary but normal in a table of order items.
- Consistency: Do values agree across records or systems once definitions, units, and time windows are aligned?
- Timeliness: Does the data reach its users before their deadline? A successful pipeline run doesn't prove the source sent fresh data.
Example: catching duplicates in a sales table
Suppose daily_sales should have one row per store per day, and both key columns are required. This query lists duplicate keys and keys with missing values:
SELECT store_id, sales_date, COUNT(*) AS row_count
FROM daily_sales
GROUP BY store_id, sales_date
HAVING COUNT(*) > 1
OR store_id IS NULL OR sales_date IS NULL;
Zero results means no key violations were found, not that every store reported. Even an empty table passes. To check coverage, compare the rows with the expected store-date pairs from a trading calendar, assuming stores must report on scheduled days even when sales are zero.
What happens when a check fails?
Choose a response based on who uses the data and what could go wrong. Duplicate keys that inflate sales totals may justify withholding a dashboard refresh and showing when the last verified data was published. A small rise in missing values in an optional field might only warrant an alert. Run checks where they can help locate the problem: at ingestion to verify what arrived, after transformations to catch changes introduced by joins, and before publication to verify what users will see.
How it comes up in interviews
An interviewer might ask why reported sales dropped by 30% overnight. Don't assume it's a data bug or a real business change. First check whether all sources delivered data by the cutoff, then break down the drop by store or channel and reconcile affected totals against the source. Explain what you'd tell dashboard users while investigating and what targeted check would catch the same failure next time.