Course contentsShow
← Data Science
Lesson 1211 of 2,14530. Exploratory Data Analysis (EDA) ProcessFree lesson

Domain Validation and Sanity Checks

Verify values align with domain knowledge, check logical consistency, and validate business rules.

Domain Validation and Sanity Checks

You'll learn: How to verify that your data makes logical sense according to real-world rules and domain expertise before proceeding with analysis.

What Are Domain Validation and Sanity Checks?

Domain validation means checking whether your data values actually make sense in the context of what they represent. While earlier validation steps confirm data types and ranges, domain validation asks: "Does this logically fit reality?"

Think of it like reviewing a restaurant bill. Range checks verify amounts are positive numbers. Domain validation asks: "Did I really order 47 pizzas?" or "Does a $3 steak make sense?"

Why This Matters

Data can pass all technical checks yet still be nonsense:

  • Ages might be positive integers but include someone "250 years old"
  • Dates could be properly formatted but show purchases before account creation
  • Percentages might sum to 100.01% due to rounding
  • Geographic codes might not match the stated country

Common Domain Validations

Business rule checks:

  • Order date ≤ Ship date ≤ Delivery date
  • Discount amount < Original price
  • Age at purchase consistent with birth year

Physical constraints:

  • Human heights between realistic bounds
  • Dates within feasible ranges for the business
  • Quantities that make sense for the product

Logical consistency:

  • If "HasChildren = No", then NumberOfChildren should be 0
  • If Status = "Cancelled", RefundDate should exist
  • Geographic hierarchy (City → State → Country) aligns

The Process

Review data with domain experts or your own knowledge of the field. Flag impossible values, investigate suspicious patterns, and document what "normal" looks like for each variable in this specific context.

Key Takeaway: Domain validation catches errors that are technically valid but logically impossible—it's your reality check before drawing conclusions from data.