InsightsData4 min read

Where Data Quality Rules Belong in the Data Stack

The same validation rule behaves very differently at the source, in a pipeline, or inside a dashboard. A reliable design gives each layer a distinct responsibility instead of treating one tool as the quality gate for everything.

Separate invalid data from analytical interpretation

A rule such as “order amount must not be negative” looks straightforward until refunds are represented as negative orders, a currency conversion introduces a sign error, or one source system uses a separate transaction type. Adding the rule wherever implementation is easiest can hide the real problem. Before choosing a validation tool, establish who has authority to define correctness, which system first has enough context to evaluate it, and what should happen when the rule fails.

It helps to distinguish three kinds of checks. Structural rules cover types, required fields, identifiers, and formats. Domain rules cover valid state transitions, value ranges, and relationships between fields. Analytical rules define metric eligibility, reporting windows, and other usage-specific semantics. Structural defects generally deserve early rejection. Domain rules belong near the application that understands the business process. Analytical rules often cannot be evaluated until multiple records or systems have been combined.

Source layer: prevent invalid states from being created

Put a rule at the source when it expresses something that should never be false in that system. Required identifiers, unique device serial numbers, valid order-state transitions, and referential integrity are common examples. Database constraints, API schemas, application validation, and transactional logic all contribute to this layer. They give users or calling systems immediate feedback and prevent one invalid record from spreading into an ERP, CRM, notification service, and analytics platform.

Source enforcement still requires restraint. A legacy application may be expensive to change, and a field shared by several workflows may legitimately accept values that one downstream consumer dislikes. The source also lacks context for many integration questions: whether a CRM account maps to an ERP billing entity, whether a daily exchange-rate table is complete, or whether an IoT event arrived soon enough for operational use. Before enforcing a rule at the source, check the following:

  • Domain invariance: The condition must hold regardless of how the data will later be consumed.
  • Available context: The source must have all fields and state required to make the decision.
  • Safe rejection: A user or upstream service must be able to correct the input and retry.
  • Compatibility: A new constraint must not unexpectedly break established imports or older API clients.

Pipeline layer: govern integration, transformation, and timeliness

Pipelines are the right place for conditions that no source can evaluate alone. Typical examples include schema drift, missing reference data, cross-system identity mapping, duplicate events, event ordering, and consistency after transformation. A CRM customer code can be locally valid but fail to map to the correct payer in an ERP. An IoT message can pass its schema while arriving too late for a real-time alert. These defects become visible only during extraction, combination, or transformation.

Pipeline checks should produce more than a binary pass or fail. A high-impact violation can block publication so an official dataset remains trustworthy. Recoverable row-level defects can be quarantined with the original payload and a clear reason. Freshness or volume anomalies may trigger an alert while consumers continue using the last known good version. Every check needs an owner, severity, response, and traceable result; otherwise, a large test suite simply becomes a large collection of ignored alerts.

  • Block: Use when invalid keys or missing dimensions would corrupt a broadly consumed dataset.
  • Quarantine: Isolate independently recoverable records while allowing a safe batch to complete.
  • Warn: Publish with a visible notice when freshness, completeness, or distribution is outside expectations.
  • Observe: Run a new rule without enforcement until its false-positive risk and operational impact are understood.

Reporting layer: protect metric meaning, not raw data

The reporting layer should own rules tied to a particular use of the data. A revenue metric may include only completed orders, an operations dashboard may exclude test accounts, and an inventory view may need to display the timestamp of its last successful refresh. These conditions do not necessarily indicate bad underlying records; they define how a metric should be interpreted. Centralizing them in a semantic model, governed dataset, or shared metric definition avoids slightly different filters being copied into every dashboard.

The dangerous pattern is silently repairing upstream data in report SQL, spreadsheets, or visualization formulas. Replacing nulls with zero, deleting suspicious transactions, or maintaining a manual name mapping may make one chart look reasonable, but every other consumer still receives the defect. The workaround is also likely to lack testing, ownership, and version control. When a report detects a quality failure, it should disclose the limitation or suppress the affected metric, then route the defect to the source or pipeline where it can be fixed permanently.

A durable architecture therefore uses layered defenses. Sources preserve domain integrity, pipelines verify integration and transformation, and reporting models protect analytical meaning. Critical rules may appear in more than one layer, but each copy should serve a different purpose. A source can reject an order without a customer identifier, a pipeline can quarantine historical exceptions and monitor recurrence, and a dashboard can disclose the period covered by valid data. Teams should regularly trace report-level workarounds back to their causes and move permanent controls upstream. When ownership spans ERP, CRM, cloud, and analytics systems, an integration team can help define the shared rule catalog and failure-handling contract.

This article was written automatically by AI from a topic planned by Sainso Technology. It is general guidance — assess against your own situation or talk to us before implementing.

Get started

Have a project like this?

Tell us your industry, current systems and budget range. We reply within two working days and offer a free 30-minute consultation.