If your scraper returns a clean, valid record that is wrong, you have a problem validation tools cannot see. A price of 14.99 might be well-formed and float-typed, but if the actual page shows 30.99, your data is garbage. This tutorial, authored by oyedeletemitope on DEV.to, introduces a small evaluation suite that separates record coverage, missing-field rates, and field accuracy to catch these silent failures.
The Reference Set Problem
Scraping metrics need a ground truth: values a human actually read off the page. The article emphasizes that you must build a reference set by sampling pages from each template, writing a field guide first, and labeling data without seeing the extraction output. Pages change, so you must freeze snapshots and keep dates with each row. The method requires double-labeling a fifth of the records to measure agreement, using Cohen's kappa to discount chance agreement, and having a third person settle every disagreement.
Three Questions, Three Denominators
Quality numbers are only comparable if you define the denominator. The tutorial breaks outcomes into five categories: correct, wrong, missed, correct_null, and invented. Each metric names its specific denominator. Field accuracy, missing-field rate, and wrong rate share one denominator, meaning they must add up to 100%. This mathematical constraint is a useful check for your own code. End-to-end accuracy, however, counts values from missing records as missed, folding coverage into the final score.
Matching Values Like a Human
Before scoring, you must define what "the same" means for each field. Too strict, and "Ash And Ember" fails against "Ash and Ember." Too loose, and a stray currency symbol passes. The article provides helper functions for normalized text, numeric tolerance, integer matching, boolean logic, and fuzzy matching using difflib. Each field gets one rule, chosen once and published with results. For example, prices use numeric(0.005) to allow for rounding errors, while titles use normalized to ignore case and spacing.
Key Takeaways
- Validation catches malformed data, but reference sets catch well-formed errors.
- Always define your denominators explicitly to compare metrics fairly.
- Use Cohen's kappa to measure labeler agreement beyond chance.
- Assign records to dev/test splits via hashing to prevent cherry-picking.
- Publish 95% Wilson intervals for accuracy scores, especially with small samples.
The Bottom Line
Stop trusting your scraper because it doesn't crash. If you aren't measuring against a human-labeled reference set, you are flying blind, and your "clean" data is likely just confidently wrong.