Systems and records
Dataset unit provenance at delivery: round-trip every normalized value
By SourceX Editorial · Updated
9 sections
Short answer
Dataset unit provenance at delivery means every normalized quantity arrives with its source text, the unit as written, how that unit was decided and the factor applied, so a buyer can convert back and land on the original. Run on a public coffee grading dataset, that round trip and three flags put 49 of 1,109 normalized altitudes in a review queue, including 190,164 m made from 1901.64.
Provenance trail
Dataset unit provenance
Key takeaways
- Ship five things per normalized quantity: source text, unit as written, unit decision, factor with its standard, and the normalized value.
- A round trip back to the source unit catches conversions that load, pass type checks and survive a checksum.
- In a public coffee grading dataset, 49 of 1,109 normalized altitudes failed the round trip or a flag, including 190,164 m made from 1901.64.
- Of 1,339 delivered rows, 940 had no unit word in the source, so a default or a rule decided their unit; one rule fired below its own cutoff.
- Record which foot a factor uses: NIST made the international foot of 0.3048 m the U.S. standard from January 1, 2023.
What does dataset unit provenance at delivery require?
It requires five things for every normalized quantity: the source text exactly as the system held it, the unit as written there, how the delivered unit was decided (read from the text, defaulted, or inferred by a named rule), the conversion factor with the standard it comes from, and the normalized value. With those, a buyer can convert back and confirm that the result is a number the source actually contains.
Without them, a normalized column is a list of claims nobody can audit. Even the factor is less settled than it looks. UCUM, a published code system for units, defines two different feet: the international foot of 12 inches of 2.54 cm, which is 0.3048 m, and the U.S. survey foot of 1200/3937 m. NIST made the international foot the standard for all U.S. applications from January 1, 2023 and kept the survey foot for historic and legacy use, so a factor needs its standard and its date.
Numbers are written differently too. The General Conference on Weights and Measures resolved in 2003 that the decimal marker may be the point or the comma on the line, and that digit groups may be separated by spaces but never by points or commas. Business records ignore the second half all the time, which is how 1.872 can mean one thousand eight hundred seventy-two meters in one row while 1.2 means something else in the next.
Why a normalized column fails acceptance on its own
Because every normalized value hides a decision, and wrong decisions look like ordinary numbers. A conversion that read a thousands separator as a decimal point, applied a regional default or overrode a unit written in the text still yields a clean number that loads, passes type checks and survives a checksum.
The strongest alternative is to normalize everything and unit-test the converter. That catches bugs in code, not in decisions: a converter can be flawless and still be handed the wrong unit by a default or a rule. The opposite alternative, shipping only the source text and leaving normalization to each buyer, throws away what the supplier knows about its own records and makes every buyer repeat the work in a different way.
Delivering both columns, with the decision between them recorded, is the only version a buyer can audit. Plausibility ranges help, but they catch only extremes, and many wrong conversions land inside any sensible range.
The paired-unit manifest: six fields and the check each enables
Declare these six fields for every normalized quantity in the delivery manifest. Each enables one acceptance check, and the last column states when a delivery fails it:
| Field | Holds | Check it enables | Fails when |
|---|---|---|---|
| source_text | The quantity exactly as the source system held it | Byte comparison against a sample of source exports | Any case change, deleted separator or blanked value |
| unit_written | The unit token found in the source text, or none | Cross-tabulation of written units against delivered units | The text names one unit and the delivery uses another |
| unit_decision | read, default or rule, plus the rule's identifier | Re-test of each rule against its own stated condition | A rule fired where its condition is false |
| factor and factor_source | Multiplier, standard and version, such as the international foot at 0.3048 m | Recomputation of normalized values from source numbers | The factor is missing, undated or from an unnamed table |
| normalized_value | The converted number in one declared unit | Round trip back to the source unit, then a plausibility range | No source number matches, or the value falls outside the range |
| review_flag | A reason code for every row a person must check | Queue size and reason counts at acceptance | A row that fails a check carries no flag |
Running the checks on a public coffee grading dataset
We ran the manifest's checks on Coffee Quality Institute grading records that a public GitHub repository, jldbc/coffee-quality-database, scraped in January 2018 and published in raw and cleaned form. The cleaned files are a delivery in miniature: they keep a copy of the altitude text, add a unit column (m or ft) and three normalized columns (low, high and mean altitude in meters), and the repository includes the R script that made them. Its README says the raw data is exactly as it was found on the CQI site. Of 1,340 raw rows (1,312 arabica, 28 robusta), 1,339 were delivered; the dropped row was a test entry.
Source text first. In 1,124 delivered rows the altitude text matches the raw text byte for byte. Another 176 were lowercased, 33 were lowercased with commas deleted, and 6 placeholders such as n/a and unkown were blanked: 215 rows where the column a buyer would treat as the original is already a transformed copy.
Unit words next. Using the fixed word lists in the methods note, 352 raw altitude strings name a meter unit (m, msnm, masl, metros, mts and others), 47 name a foot unit (ft, feet, pies, psnm and others), 940 name none, and no string names both. For those 940 rows the delivered unit was decided without any word in the source: 812 received meters by default and 128 received feet by rule, 71 of them Hawaii records with no altitude at all and 57 of them Guatemala records.
That Guatemala group is where a rule shows its edges. The cleaning script assigns feet to Guatemala altitudes above 3,500, noting that most Guatemalan points are below 3,500 m. Three Guatemala rows reading 518 were delivered in feet as 157.9 m, which is 518 times 0.3048, even though 518 is far below the cutoff. The script compares the altitude text with 3500, and R compares a string with a number as strings, so 518 sorts above 3500.
What the round trip and the flags caught
The round trip converts each delivered low and high value back into the delivered unit and looks for both numbers in the source text. Of 1,109 rows with a normalized altitude, 1,080 pass under the ordinary reading (comma as thousands separator, point as decimal marker), 27 pass only if a point between digits is read as a thousands separator, and 2 fail under either reading. A typical passing row reads 1950-2200 in meters: both numbers come back unchanged and the delivered mean is 2,075 m.
The 27 split cleanly. Seventeen have three-digit groups, such as 1.872 or DE 1.600 A 1.950 MSNM, where the thousands reading is plausible. The other ten include 1.2 delivered as 12 m, 16.8 as 168 m, 1,100.00 mosl as 110,000 m and 1901.64 as 190,164 m: the cleaning step deleted every point, which suits the first group and corrupts the second. The two outright failures read approx. 1'500 metres a.s.l., where an apostrophe used as a thousands separator split the number and the delivery shows a range from 1 m to 500 m with a mean of 250.5 m.
Two flags complete the queue. Ten rows have a mean above 3,500 m, the cutoff the script itself uses; the highest, 190,164 m, appears twice, once typed that way in the source and once manufactured from 1901.64. Nine rows contradict their own source text: eight Guatemala rows say METROS and were delivered as feet (5600-5760 METROS became 1,731 m), and one says PSN, an abbreviation the script's notes read as feet, and was delivered as meters. Adding the three rule misfires, 49 of the 1,109 rows land in the review queue, two of them for two reasons, and 1,060 pass.
The checks have a blind spot. One row reads 12OO, with capital letters O in place of zeros; it was delivered as 12 m and passes every check, because the round trip trusts the digits it can read. Only a person reading the source text catches it, which is the case for delivering that text at all. Bag weights show the reverse gap: the files keep the bag-weight text unchanged in all 1,339 rows and add no normalized weight, so for the 2 rows that name both kg and lbs and the 27 that give a bare number, a buyer has the original but no decision.
Accept, hold or return: unit provenance decision rules
Apply these rules at acceptance; each states the action on failure. Agree the review-queue threshold in the request, before anyone has seen the data.
At a glance
Accept, hold or return: unit provenance decision rules
- Source text differs from the source export in any sampled row: return the batch; the original column must be byte-identical.
- A unit word in the source contradicts the delivered unit: hold those rows until a decision is written per row.
- A unit decided by rule: the manifest names the rule and its condition, and a re-test of the condition passes on every row the rule touched. Any misfire: return.
- Round trip fails under the declared number reading: return the rows for correction.
- Round trip passes only under a second number reading: require the decimal and grouping convention per source or field, then rerun.
- Normalized value outside the declared plausibility range: review it against the source text before accepting.
- A factor without a standard and version, such as ft with no statement of international or survey foot: hold.
- Review queue above the agreed threshold: return the batch with the reason counts.
Standards already keep the verbatim unit beside the coded one
Keeping both is already codified elsewhere. The OMOP Common Data Model, maintained in OHDSI's CommonDataModel repository, defines unit_source_value as the exact value from the source data representing the unit, keeps it beside the standardized unit_concept_id, and says the original code is retained for reference. In its version 5.4 field-level specification, 47 of 432 fields are verbatim source-value fields across 18 of 39 tables, and the measurement, observation, specimen and device_exposure tables each pair a standardized unit concept with a verbatim unit source value.
Business deliveries can borrow the convention without the clinical context: one standardized field for analysis, one verbatim field for audit, and a rule that the verbatim field is never edited. The factor deserves the same discipline. UCUM's two feet differ by about two parts per million (1200/3937 m is 0.3048006 m against 0.3048 m), too small to see in altitudes and large enough to matter in surveyed coordinates.
Writing unit provenance into a SourceX data request
Put unit provenance into the acceptance test you send with the request. SourceX sources datasets on request from U.S. businesses instead of holding stock, and buyers describe scope, volume, language, format, timing and licensing needs in the request form; adding the six manifest fields and the decision rules above tells the supply side, before any preparation, that originals must survive beside normalized values.
The supplier company approves the scope and terms and signs before anything is delivered, so the requirement belongs in the scope rather than in a complaint after delivery. SourceX's sample manifest page shows a fictional field guide for a help desk package; a buyer who needs unit provenance can ask for source text, unit decision and factor columns next to any quantity in a guide like that.
The limits of this test are worth stating plainly. The word lists are ours, the plausibility cutoff borrows the cleaning script's own number, and the source is a 2018 copy of pages we could not reopen. A passing round trip proves the columns agree with each other, not that the source was right.
Methods note: join rule, word lists and limits
Repository: github.com/jldbc/coffee-quality-database at commit e3b22b2b1e597887188b97c2ada7f745e1914ec7 (2018-06-16). Files read with git show, never executed: data/arabica_ratings_raw.csv, data/arabica_data_cleaned.csv, data/robusta_ratings_raw.csv, data/robusta_data_cleaned.csv and clean_coffee_data.R. The repository is a third-party scrape of the Coffee Quality Institute's review pages; the institute's own records were not compared.
Join: a cleaned row with id N matches the raw row at position N minus 1, header excluded, and the script stops unless every pair has equal quality score and total cup points as numbers. Source-text classes: identical; identical after lowercasing; identical after lowercasing and deleting commas; other. Unit tokens are runs of letters with internal points and one optional trailing point, lowercased. Meter words: m, msnm, meters, masl, metros, mts, m.s.n.m, m.s.n.m., msm, meter, msn, metres, a.s.l., mals, m.s.l, mtr, msnn, mtrs., mts., m.o.s.l., mosl, 公尺 and m公尺. Foot words: ft, ft., feet, psnm, psn, p.s.n.m., p.s.n.m, pies and f. All other tokens are ignored.
Round trip: for rows with a delivered mean, low and high are divided by 0.3048 when the delivered unit is ft and must each equal, within 0.01, a number in the raw text. The ordinary reading deletes commas and apostrophes between digits and treats a point as a decimal marker; the thousands reading also deletes points between digits. A three-digit group means every point between digits is followed by exactly three digits and then a non-digit. Means equal the midpoint of low and high in every row, and no low exceeds its high.
Flags: mean above 3,500 m; a meter word with a delivered ft, or a foot word with a delivered m; Guatemala rows with no unit word, delivered in feet, whose largest number under the ordinary reading is at most 3,500. The review queue is the union of round-trip failures, thousands-only passes, both flags and that rule re-test. Bag-weight units are counted by the set of letter tokens in each row. The saved snapshot keeps species, row id, country, altitude and bag-weight text and the derived classes, with no names or contact details.
OMOP count: in inst/csv/OMOP_CDMv5.4_Field_Level.csv of github.com/OHDSI/CommonDataModel at commit f6d2738, read by bin/omop_source_values.py, a field counts as a source-value field when its name ends in "_source_value", which gives 47 of 432 fields in 18 of 39 tables.
Frequently asked questions
Should a delivered dataset keep the original units or only normalized ones?
Keep both, plus the decision that links them. The normalized value serves analysis; the source text and unit as written let a buyer audit the conversion. In the coffee data, the original text was the only way to see that 12OO, delivered as 12 m, was a typing problem.
How can a buyer test a unit conversion without the supplier's code?
Run a round trip: divide each normalized value by its declared factor and check that the result appears in the source text. Add a cross-tabulation of unit words against delivered units and a re-test of every inference rule. None of this needs the conversion code.
What is a unit decision code?
A per-row field saying how the delivered unit was chosen: read from the source text, applied as a default, or inferred by a named rule. It turns an invisible assumption into something a buyer can count and test. In the coffee data, 940 of 1,339 rows had no unit word, so every one of them depended on a default or a rule.
Which foot equals 0.3048 meters?
The international foot, defined as 12 inches of 2.54 cm. The U.S. survey foot is 1200/3937 m, and NIST deprecated it for new use from January 1, 2023, keeping it for historic and legacy applications. A manifest should say which one a factor uses.
Can a plausibility range replace a round-trip test?
No. In the coffee data a 3,500 m ceiling flagged 10 rows, while the round trip, the unit-word conflicts and the rule re-test found 39 more, many with ordinary-looking values such as 168 m or 1,731 m. Ranges catch extremes; round trips catch wrong decisions.
Sources
- The coffee-quality-database README: 1,312 arabica and 28 robusta reviews from the Coffee Quality Institute, scraped in January 2018, with raw data described as exactly as found on the CQI site. Source
- The cleaning script: lowercases altitude text, deletes commas and points, defaults the unit to meters, assigns feet by word, by U.S. state or territory and for Guatemala altitudes above 3500, and converts feet at 0.3048. Source
- The raw and cleaned arabica and robusta files analyzed in this article (1,340 raw rows, 1,339 delivered rows). Source
- UCUM defines the international foot as 12 international inches of 2.54 cm and the U.S. survey foot as 1200/3937 m. Source
- NIST: from January 1, 2023 the international foot of exactly 0.3048 m is the standard for all U.S. applications, and the survey foot is kept for historic and legacy use. Source
- CGPM Resolution 10 (2003): the decimal marker is the point or the comma on the line, and digit groups may be separated by spaces, never by points or commas. Source
- OMOP CDM v5.4 defines unit_source_value as the exact source value for the unit, retained beside the standardized unit_concept_id; the specification has 47 source-value fields among 432 fields in 39 tables. Source
- R's relational operators coerce mixed types with character taking precedence, and compare strings lexicographically in the locale's collating sequence. Source
Tell us what data you need
Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.