Systems and records
Dataset sample delivery consistency: passing examples, failing packs
By SourceX Editorial · Updated
9 sections
Short answer
Dataset sample delivery consistency means the example file and the full pack pass one versioned check suite, and each pass is tested for whether the example could have failed. We ran 12 checks on the gapminder package's 1,704-row excerpt and its 3,313-row unfiltered table: the excerpt passed all 12, the fuller table 7. The rule that cut the excerpt had removed every failing row.
Document stack
Dataset sample delivery
Key takeaways
- One unchanged 12-check suite passed the gapminder excerpt (1,704 rows) on all 12 checks and its unfiltered table (3,313 rows) on 7.
- The excerpt's cut rule, five-year grid years and complete countries only, removed every row that fails the year, completeness and continent checks.
- Two of the five failures are not explained by the fuller table's documentation: an undefined continent code on 139 rows and a colour lookup documented only for the excerpt's 142 countries.
- Checksums and snapshot tests pass both files; they prove a file arrived intact, not that it matches its documentation.
- A manifest that records the selection rule, per-check counts, value coverage and a declared-exceptions register turns acceptance into a mechanical decision.
What does dataset sample delivery consistency require?
It requires three things: the example file and the full pack run the same check suite at the same version, every check reports how many records it examined and how many failed in each file, and every difference the full pack is allowed to have is declared in advance as a named exception. Without the declared exceptions, a reviewer cannot tell an allowed difference from a defect. Without the per-check counts, a pass on the example can mean the check never met a record that could fail it.
SourceX's existing guide to sample and full package consistency covers the structural contract: field names, types, missing-value codes, keys and hashes, checked by one validator. This page takes the next question, which a schema contract leaves open: could the example have failed the checks at all? An example cut by a filter can satisfy every rule simply because the filter removed the records that break them.
That failure is easy to show on public data, so we ran it. The gapminder data package, a teaching dataset distributed for R, ships a documented excerpt and a fuller table side by side, which makes it a clean test of what an example's pass is worth.
One suite, two files: what 12 checks found in gapminder
The excerpt passed all 12 checks; the fuller table passed 7. The gapminder repository (jennybc/gapminder, commit 391b5a4, CC0 license) ships gapminder.tsv, 1,704 rows documented as 142 countries, a continent factor with 5 levels and years from 1952 to 2007 in steps of five, and gapminder-unfiltered.tsv, 3,313 rows that its documentation says were not filtered on year or for complete data, with everything else as documented for the excerpt. We wrote 12 checks from that documentation and the package's shipped lookup files and ran one script, unchanged, on both files.
The two files agree wherever they overlap: all 1,704 excerpt rows appear unchanged in the fuller table, and no shared country-year pair carries different values. The differences are all in what the excerpt leaves out. In the fuller table, 1,300 of 3,313 rows fall off the five-year grid (58 distinct years from 1950 to 2007, with 63 rows before 1952); 139 rows carry a continent value, FSU, that is not in the shipped five-name list; 456 rows from 45 countries have no entry in the shipped colour lookup; 83 of 187 countries do not have exactly the 12 grid years (45 miss one or more; the other 38 add off-grid years); and the table holds 187 countries against a documented 142.
The table lists the five checks whose results differ between the files, then the seven that agree:
| Check | Excerpt, 1,704 rows | Unfiltered, 3,313 rows | Explained by the unfiltered table's documentation? |
|---|---|---|---|
| Year on the 1952 to 2007 five-year grid | Pass | 1,300 rows fail | Yes: not filtered on year |
| Continent in the shipped five-name list | Pass | 139 rows fail (FSU) | No: five levels are documented |
| Country in the shipped colour lookup | Pass | 456 rows from 45 countries fail | No; the lookup's own page says 142 countries |
| Each country has exactly the 12 grid years | Pass | 83 of 187 countries fail | Yes: not filtered on year or for complete data |
| Documented count of 142 countries | Pass | 187 countries | Yes, implied: incomplete countries were kept |
| Header, empty cells, types, unique key, ISO lookup, one continent per country, value ranges | Pass (7 checks) | Pass (7 checks) | Not needed |
Why the excerpt could not fail: the cut removed the failures
The excerpt was cut by a rule, and the rule is what made it pass. The package's build script keeps rows whose year leaves a remainder of 2 when divided by 5 and then keeps only countries with all 12 such years. Off-grid rows cannot survive the first step, countries with gaps cannot survive the second, and all 139 FSU rows belong to nine countries that each have at most 9 of the 12 grid years, so none survived. Re-applying those two steps to the fuller table in our own code reproduces the excerpt's rows exactly, compared as a set: the first step removes the 1,300 off-grid rows, leaving 2,013, and the second removes 309 rows from 45 countries; the FSU rows go 93 in the first step and 46 in the second. For the year, completeness and continent checks, the excerpt was incapable of failing.
Coverage shows the same thing without any modeling. The excerpt contains 142 of the fuller table's 187 countries, 5 of its 6 continent values and 12 of its 58 years. A check on a value list is only exercised by the values present, so the excerpt never tested the sixth continent or 46 of the years at all.
A random example would have behaved differently. If the excerpt had been a simple random sample of the same size, 1,704 rows drawn without replacement from 3,313, the chance of it containing none of the 139 FSU rows is about 1.02e-45, and of containing no off-grid year about 2.22e-622, both computed exactly from binomial coefficients. The point is not that examples must be random; a curated example is fine when its cut rule is declared and the checks it makes unfailable are named.
Business data has the same trap with different names. An example limited to closed tickets, complete customer histories or the last 12 months removes exactly the open cases, partial records and legacy codes most likely to break a buyer's pipeline.
Documented exception or defect? Reading the five failures
Three of the five failures are explained by the fuller table's documentation and two are not. Off-grid years, incomplete countries and the larger country count all follow from the statement that the fuller table was not filtered on year or for complete data, so a reviewer holding that sentence can accept them.
The continent failure is different. The fuller table's documentation says everything else is as documented for the excerpt, which describes continent as a factor with five levels, yet the fuller table carries a sixth value on 139 rows. Its meaning is recorded only in the package's build log, where the author works out that FSU stands for Former Soviet Union. A buyer reading the user-facing documentation would meet an undefined code.
The colour lookup is a scope mismatch that only the lookup's own page discloses. Its documentation says it holds colours for the 142 countries, so it was built for the excerpt and shipped beside a table it does not cover. The ISO country-code lookup, by contrast, is documented to include the unfiltered table's countries and passes on both files. The working rule: a failure on the full pack is either a declared exception with a pointer to the sentence that allows it, or it is a defect.
Checksums and snapshot tests pass both files and prove neither
Integrity checks answer whether a file is the file that was sent, not whether it means what its documentation says. The package's own test file runs snapshot tests asserting that its data objects are unchanged, including both tables; a snapshot catches change and is silent about meaning. A manifest listing the two files' SHA-256 digests (f74275b4 for the excerpt and 845a21e5 for the fuller table, first eight hex characters) would verify both byte for byte while five meaning checks still fail on one of them.
That is the strongest alternative explanation to rule out, and it fails on this evidence: a loadable file with a valid checksum can still carry an undefined code and a lookup that does not cover it. The opposite objection, that a bigger pack is expected to differ, holds only for differences declared in advance. Keep checksums for integrity and run the meaning checks every time.
The sample parity checklist for a versioned delivery manifest
The checklist below is the original asset: the fields a versioned delivery manifest needs so that an example and a full pack can be compared mechanically, each tied to a step in the gapminder run. A manifest that records all ten lets a reviewer reproduce both runs without asking the supplier anything:
At a glance
The sample parity checklist for a versioned delivery manifest
Checklist · 10 items
- Validator identity: script name, version and SHA-256, run unchanged on the example and on the full pack.
- Check list with units: for each check, whether it counts cells, rows or entities, so the two files' counts compare like with like.
- Example selection rule: a random draw with its seed and draw order, or the exact filter; for a filter, the checks it makes impossible to fail.
- Per-check results for both files: units examined, failures and the pass flag.
- Coverage of value domains: distinct values present in the example over those in the full pack, here 142 of 187 countries, 5 of 6 continents and 12 of 58 years.
- Overlap parity: every example row present unchanged in the full pack, here 1,704 of 1,704, with any shared key that changed value listed.
- Declared exceptions register: each allowed difference, the sentence that allows it and the person who approved it.
- Code lists and lookups with scope: which file each lookup was built from and which entities it covers.
- Build log pointer: where codes such as FSU are defined, so meaning travels with the data.
- Integrity: SHA-256 and row count per file, recorded as necessary evidence, never as acceptance on its own.
0 of 10 ticked. Tick each item as you go.
Accept, re-cut or re-version: deciding after a failed parity run
Decide from the register, not from the example's clean run. Each failure pattern from the gapminder run maps to one action:
- Every full-pack failure maps to a declared exception: accept, and file both reports with the validator version.
- An undeclared code appears in the full pack, as FSU did: stop, have the supplier define it and add it to the shipped code list, or remove it, then rerun both files.
- A lookup covers only the example's entities: ship a lookup built from the full pack, or declare the gap with its count.
- Coverage of a value domain is below 100 percent: ask for a second example drawn at random with a stated seed, or stratified to include the missing values, and run the suite on it.
- Integrity passes and meaning checks fail: do not accept on the checksum; the file arrived intact and is still wrong for the documentation it came with.
Writing the check suite into a data request
When data is sourced for a specific request, the suite can be agreed before a single record is extracted. SourceX's request form asks for scope, volume, language, format, timing and licensing, and says datasets are sourced on request, not held in stock. A buyer can put the check list, the example selection rule and the exceptions register into that request, so the example and the full pack are judged by the same code from the start.
SourceX also publishes an illustrative package summary and field guide for a fictional company on its sample manifest page, which shows the kind of summary a package carries; the parity fields above are what a buyer would add to it. Nothing here describes SourceX's own delivery tooling, formats or timing.
Methods note: data, checks and limits of the gapminder run
Data: jennybc/gapminder at commit 391b5a40d3574c3b89d889dd7d72f7f3fdb4a70c (committed June 12, 2025), read October 28, 2026; only the files in inst/extdata were read, and no repository code, including the package's tests, was run. Files are read as UTF-8 with a byte-order mark tolerated, tab-separated, header on the first line; country and continent names are compared as exact, case-sensitive strings, and the script reports no case-insensitive collisions.
Checks, identical for both files: header equals the six documented columns in order; no cell empty or NA; year and pop are integers and lifeExp and gdpPercap parse as numbers; country and year unique together; year between 1952 and 2007 with year minus 1952 divisible by 5; continent in continent-colors.tsv; country in country-codes.tsv; country in country-colors.tsv; one continent per country; each country has exactly the 12 grid years; 0 < lifeExp <= 100 with pop and gdpPercap above zero; 142 distinct countries. Row checks count rows; the one-continent and 12-year checks count countries, and countries failing the 12-year check are split into those missing at least one grid year and those holding all 12 plus other years.
The re-cut applies the build script's two steps in Python (keep rows whose year divided by 5 leaves 2, then keep countries with more than 11 remaining rows) and compares the result with the excerpt as a set of rows. Coverage counts distinct country, continent and year values present in both files over those in the fuller table. Overlap parity compares all six values of each excerpt row, as strings, with the fuller table's rows and checks shared country-year keys for changed values; the FSU figures count, per country, how many of the 12 grid years the fuller table holds. The random-draw figures are exact ratios of binomial coefficients, C(3313 - k, 1704) / C(3313, 1704), with k = 139 and 1,300 failing rows, shown to two decimals. The script also computes each file's SHA-256 and prints its own SHA-256 as the validator version. Limits: one public teaching dataset, not business records; the checks come from the package's own documentation and could be extended; the build log was read only for the FSU definition; the source data at gapminder.org was not compared. Script and outputs: bin/sample_parity.py, sample_parity.txt and sample_parity.json in our scratch folder, and bin/sample_parity_v2.py with its outputs for the 12-year split.
Frequently asked questions
What is dataset sample delivery consistency?
It is the property that a dataset's example file and its full delivery pass the same versioned check suite, with each check's counts reported for both files and every allowed difference declared in advance. Structural agreement alone is not enough, because an example can pass checks it was never able to fail.
Why can a sample pass validation while the full dataset fails?
Usually because the sample was cut by a rule that removed the failing records. In the gapminder package, the excerpt keeps only five-year grid years and countries with all 12 of them, which also removed every row with the undocumented continent code FSU, so the excerpt passed checks the fuller table failed.
Does a matching checksum prove the full pack matches its sample?
No. A checksum proves the file arrived unchanged, not that its values match the documentation; the gapminder fuller table would verify byte for byte against its digest while failing five meaning checks. Record checksums, then run the meaning checks on every delivery.
Should dataset samples always be random?
Not necessarily. A curated example is useful when its selection rule is declared and the checks it makes unfailable are named; when coverage of codes or years falls short, add a random or stratified example with a stated seed and run the same suite on it.
What should a delivery manifest record about the sample?
At minimum: the validator version and hash, the example's selection rule, per-check counts for the example and the full pack, value-domain coverage, a declared exceptions register, the scope of every lookup and code list, and per-file checksums and row counts.
Sources
- The gapminder package documents its main table as 1,704 rows with country as a factor of 142 levels, continent as a factor of 5 levels and years from 1952 to 2007 in increments of 5. Source
- The package documents gapminder_unfiltered as not filtered on year or for complete data, with 3,313 rows and everything else as documented for gapminder. Source
- The package's build script keeps years with a remainder of 2 when divided by 5 and then keeps only countries with data for all 12 such years. Source
- The package's continent build log identifies the FSU continent code as Former Soviet Union. Source
- The package's tests include snapshot tests that its data objects, both tables included, are unchanged. Source
- The extdata folder at commit 391b5a4 holds the two tables and three lookup files that the article's 12-check run reads. Source
- The package documents its country colour scheme as colours for the 142 countries. Source
- The package documents its country codes table as also including the countries covered by gapminder_unfiltered. Source
- The package DESCRIPTION calls the data an excerpt of the data available at Gapminder.org and gives the license as CC0. Source
- SourceX's request form asks buyers for scope, volume, language, format, timing and licensing and says datasets are sourced on request, not held in stock. Source
- SourceX publishes an illustrative package summary and field guide for a fictional company, with every number and name fictional. Source
Tell us what data you need
Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.