Systems and records
Multi-outcome dataset schema: six checks that catch a flattened status
By SourceX Editorial · Updated
9 sections
Short answer
A multi-outcome dataset schema gives each case one row, each outcome its own typed row and each link between cases an explicit ID, and derives any summary status by a rule the manifest states. Run on 97,432 Chicago food inspection rows, six checks found 11,200 visits with no inspection in the result column, 13,491 passes listing a critical- or serious-band finding, and re-inspections tied to parents only by inference.
Grader rubric
Multi outcome dataset schema
Key takeaways
- Store each case once, each separately checkable outcome as its own typed row, and each link between cases as an explicit parent ID.
- In the City of Chicago's 97,432-row inspection snapshot, 11,200 of 97,429 cases hold a visit outcome such as Out of Business in the same column as pass and fail results.
- The recorded result cannot be rebuilt from the findings: 13,491 passes list a finding numbered 1-29 and 2,568 fails list none, so ship the result as a recorded outcome beside its findings.
- Re-inspections carry no parent ID; license and date link 17,534 of 17,714, with 289 same-day clashes and 2,875 pairings of mismatched type.
- A matching hash confirms the bytes only; the manifest must pin code list versions, summary rules, empty-value meanings and row counts per table.
What should a multi-outcome dataset schema look like?
A multi-outcome dataset schema stores each case once, each outcome as its own typed row tied to that case, and each relationship between cases as an explicit ID, so that any single summary status is derived by a written rule rather than typed over the evidence. A case here is the unit a buyer reasons about: an inspection, an insurance claim, a support ticket, a purchase order. An outcome is anything about that case that can be checked on its own: whether the visit happened, what was found, what was decided, what happened at the follow-up.
A single status column cannot carry that. When one field says Pass, it cannot also say that four findings were recorded, that one of them repeats a finding from an earlier visit, and that a hearing may later dismiss it. A model trained on the status learns the summary; a model that must reproduce the work needs the parts, and an evaluator needs to know which part each label came from.
The test of a delivery is therefore not whether it loads. It is whether a buyer can count outcomes per case, rebuild any summary from its parts by a stated rule, and follow each link between cases without guessing. The six checks below test exactly that, and the manifest further down records what the checks need from the supplier.
Six acceptance checks run on 97,432 Chicago inspection rows
Run on a public file, the six checks found that one result column mixed two kinds of outcome, that the recorded result could not be rebuilt from the findings, and that re-inspections could only be tied to their parent case by inference. The file is the City of Chicago's own copy of its food inspection data, stored in the City's food-inspections-evaluation repository on GitHub: 97,432 rows dated 2010-01-04 to 2014-12-30, saved by the City's script from the data portal dataset 4ijn-s7e5.
It is a fair test because the portal describes each row as a single inspection identified by an inspection ID, with a result and the violations noted (paraphrased from the portal page). That is the classic flattened shape: one row per case, one summary field, and the case's other outcomes squeezed into a text column. The table gives each check, the rule as the script applied it and what it returned.
| Check | What it catches | Rule as run | Chicago result |
|---|---|---|---|
| 1. One row per case key | Duplicated cases that double-count outcomes | Group rows by Inspection_ID; compare all 17 columns within each group | 3 IDs appear twice; all 3 are exact copies, so 97,429 cases remain |
| 2. One kind of outcome per column | A status field mixing whether work happened with how it ended | Sort the Results values into completed-inspection results and visit outcomes | 11,200 cases (11.5%) hold a visit outcome such as Out of Business or No Entry, not an inspection result |
| 3. Components itemized against a declared code list | Findings buried in text, codes outside the expected range | Split Violations on the pipe character; read the leading number of each piece | 363,144 findings parsed; 587 carry number 70, outside the 1-44 range the City's own feature code counts |
| 4. Summary derivable from components | A status that contradicts or ignores its own evidence | Cross-tabulate each result by the most severe band among its findings | 13,491 Pass results (23.2% of passes) list a finding numbered 1-29; 2,568 Fail results list none |
| 5. Links between cases are explicit | Follow-ups that must be matched by guesswork | Match each re-inspection to the latest earlier inspection of the same license | No parent field exists; 17,534 of 17,714 re-inspections can be matched by inference, 141 have no earlier row and 39 lack a usable license |
| 6. One meaning per empty value | Blanks that mean not done in some rows and nothing found in others | Count empty Violations values by result | 20,199 empty values: 11,061 on visits with no inspection, 9,138 on completed inspections |
A matching hash proved the bytes, not the outcomes
The strongest objection to all of this is that the file is fine: it loads, its key is nearly unique, and its bytes can be pinned exactly. That is true and beside the point. The snapshot used here has the SHA-256 hash 37068d67, and the same git object has sat in the repository since the commit that added it on 2015-01-06, so anyone can confirm they hold the identical file. Every problem in the table survives that confirmation.
A checksum proves that the bytes did not change between supplier and buyer. It cannot prove that a Pass means what the buyer thinks it means, that a blank means nothing was found, or that a re-inspection belongs to the visit a script pairs it with. Loading and hashing are the first two gates of an acceptance test, not the test.
The City's own code shows the cost of skipping the rest. Its filter for the prediction model removes duplicated inspection IDs, keeps only rows typed Canvass and drops the results Out of Business, Business Not Located and No Entry before any modeling. Every consumer of the file has to rediscover and repeat that work, and each can do it slightly differently.
Visits, results and findings were packed into two columns
The file packs at least three kinds of outcome into two columns: whether an inspection took place, what the result was, and what each finding was. Separating them is the first change a delivery should make.
Visit outcomes and results share the Results column. Of the 97,429 cases, 86,229 carry one of three completed-inspection results (58,198 Pass, 8,509 Pass w/ Conditions, 19,522 Fail) and 11,200 carry a visit outcome: 9,467 Out of Business, 1,686 No Entry and 47 Business Not Located. The type column repeats the confusion from the other side: 307 rows are typed out of business in some spelling, and 288 of them record Pass or Fail, which the file never explains. The 106 spellings of Inspection_Type collapse to 95 once letter case is ignored, with seven types written in two to four casings.
Findings sit in one text field. Each piece of Violations starts with a number and a title, and 71,253 completed inspections (82.6%) list two or more findings, each of which could be checked separately. In 3,132 cases the same number appears more than once, so a buyer cannot tell a repeated finding from a duplicated line without reading the comments. The 587 findings numbered 70, titled no smoking regulations, fall outside the 1-44 bands the City's feature code counts, so any model built with that code silently drops them.
Empty values carry two meanings. Of the 20,199 cases with no listed finding, 11,061 are visits where no inspection took place and 9,138 are completed inspections where nothing was recorded. A delivery should give each meaning its own code instead of one blank.
Can the recorded result be rebuilt from the listed findings?
No. Using the severity bands written into the City's own feature code (1-14 critical, 15-29 serious, 30-44 minor), the recorded result and the listed findings fail to line up often enough that the result has to be treated as a separate outcome, recorded rather than derived.
The file carries no rule that maps findings to a result, and the bands come from the City's model code rather than from the data itself. Without that rule, 3,391 passes that list a critical-band finding and 2,568 fails that list nothing cannot be classified as errors, corrections made during the visit or findings later disputed. The City's inspection page says results reflect only what was found at the time of the inspection and that violations noted are allegations that can be disputed and dismissed at the Department of Administrative Hearings (paraphrased). That is a further outcome per finding which this file does not carry at all.
For a delivery, the decision is simple: ship the recorded result as its own outcome row, ship each finding as its own row, and state in the manifest whether any summary is derived (with the rule) or recorded (with its source). Three Pass w/ Conditions rows list only number 70 and are left out of the table below, which counts cases by result and by the most severe band among their findings:
| Recorded result | No finding listed | Minor band only (30-44) | Serious band, no critical (15-29) | Any critical band (1-14) |
|---|---|---|---|---|
| Pass (58,198) | 6,502 | 38,205 | 10,100 | 3,391 |
| Pass w/ Conditions (8,509) | 68 | 264 | 2,993 | 5,181 |
| Fail (19,522) | 2,568 | 839 | 9,266 | 6,849 |
| Visit outcomes, three values (11,200) | 11,061 | 48 | 80 | 11 |
Follow-up cases need parent IDs, not a license and a date
A follow-up case should carry the ID of the case it follows. The Chicago file has no such field, so every link has to be inferred, and the inference fails in ways a buyer cannot see from the rows alone.
The script found 17,714 re-inspections across eleven spellings of the type. Matching each to the latest earlier inspection of the same license number links 17,534 of them (99.0%). Most of those nearest predecessors are fails (16,233), but 968 are Pass w/ Conditions, 224 are passes, 75 are visits with no inspection and 34 fall on a date holding inspections with different results. A further 141 re-inspections have no earlier row for their license (86 of them dated less than 90 days after the file's first date, where the parent may predate the snapshot), and 39 have no usable license number.
Two further signs show that license and date are not a key. In 289 cases another inspection of the same license falls on the same calendar day, and the file records dates without times, so the order is unknowable. For the three main re-inspection types, 2,875 of 17,362 linked cases (16.6%) are paired with a predecessor of a different base type, for example a canvass re-inspection whose nearest earlier visit was a complaint inspection. The gap is short when the inference works (median 7 days, 90th percentile 19 days) but runs past a year in 23 cases.
Some findings point backward too. Numbers 14 and 29 are titled previous serious violation corrected and previous minor violation(s) corrected; 5,794 such findings appear in 5,568 cases, and none says which earlier inspection it refers to. A delivery should resolve each of these to a parent case ID or mark the link inferred, with the rule that produced it and a confidence flag.
The versioned manifest that ships with a multi-outcome delivery
The manifest is the contract for meaning: it names the version, the tables, the outcome kinds and their code lists, how any summary relates to the components, what each empty value means and how many rows each table holds. The Chicago values show what a filled-in manifest looks like for a source that never documented these points.
Version matters for the code lists in particular. The data portal notes that violation definitions changed on July 1, 2018 and splits its food inspection data into a view up to June 30, 2018 and one from July 1, 2018 onward, so a finding number means different things on either side of that date. A manifest that does not pin the code list version lets two deliveries with the same column names disagree on what every finding means.
The checklist below is what a supplier follows and a second reviewer reruns to reproduce the acceptance result; the table after it lists each manifest field with its value for the Chicago snapshot:
- Pin the source: repository or system, commit or export ID, file hash and the date range covered.
- Ship three tables, or three clearly keyed sections: cases, outcomes and links, each with its key written down.
- Give every outcome a kind, a value from a versioned code list, a date and the record it came from.
- State for any summary status whether it is derived (with the rule) or recorded (with its source system).
- Mark every inferred link as inferred, with the rule, the candidate count and a confidence flag.
- Code each empty value: not applicable, not done, nothing found or withheld.
- Publish row counts per table and per outcome kind, and rerun the six checks on arrival against those counts.
- Keep the check script and its printed output with the delivery so the result can be reproduced.
| Manifest field | What it fixes | Value for the Chicago snapshot |
|---|---|---|
| Source and version | Which bytes were tested | City of Chicago repository, commit 603d8db; file blob 7aa2bc6; SHA-256 37068d67 |
| Coverage window | Which cases can have parents in the file | Inspections dated 2010-01-04 to 2014-12-30 |
| Tables and keys | How cases, outcomes and links join | Case: Inspection_ID. Outcome: Inspection_ID, kind, sequence. Link: child and parent Inspection_ID |
| Outcome kinds and code lists | What each value can mean | Visit (inspected plus 3 values), result (3 values), finding (numbers 1-44 and 70, pre-July 2018 definitions) |
| Summary rule | Whether a status can be rebuilt | Result is recorded, not derived; the source gives no mapping from findings |
| Empty values | What a blank stands for | Empty Violations means no inspection on visit outcomes and nothing recorded on completed inspections |
| Row counts | What arrival checks compare against | 97,429 cases; 546,802 outcome rows (97,429 visit, 86,229 result, 363,144 finding); 17,660 inferred link rows |
| Known exceptions | What was changed before delivery | 3 exact duplicate rows removed; 141 re-inspections without a parent; 39 without a usable license |
Where the outcome inventory belongs in a request for licensed records
A buyer asking for licensed business records with several outcomes per case should name those outcomes in the request itself, together with the checks the delivery must pass. SourceX sources datasets on request rather than holding stock, and its request form asks for scope, volume, format, timeframe, licensing and de-identification needs; an outcome inventory and an acceptance test fit naturally into that request.
What to include: the case unit, each outcome kind you need and why, the links between cases that matter for the task, and which of the six checks above must pass before acceptance. Saying that a recorded status is acceptable only alongside its components, or that inferred links must carry their rule and confidence, tells a supplier what to preserve before anything is exported or de-identified.
Nothing here describes stock SourceX holds or a delivery format it uses; formats, timing and acceptance terms for any dataset are set deal by deal.
Methods note: the file, the script and every counting rule
Every count on this page comes from one script, bin/chi_multi_outcome.py in the writer's scratch folder for this batch (rerun as bin/chi_multi_outcome_v2.py, which differs only in the out-of-business spelling rule below), run on 2026-10-28 against DATA/13_food_inspections.Rds in github.com/Chicago/food-inspections-evaluation at commit 603d8dba4d2ea266aced60ac49bdd6ee96704d05. The file's git blob (7aa2bc66) is unchanged since the commit that added it on 2015-01-06 under the name DATA/food_inspections.Rds; it was renamed in 2019. Its SHA-256 is 37068d67ee120fbd06c01b6bb87873dd613eb01ee2588c1c49087c1160bb09b6. It was read with the rdata Python package (version 1.1.0); no repository code was run, and dates stored as R integer dates were converted to calendar dates.
This is the City's own copy, saved by its download script from portal dataset 4ijn-s7e5 with column names changed, not the current portal file; the portal file now runs past 2018 and uses new violation definitions from July 1, 2018. Rules as applied: rows identical on all 17 columns that share an Inspection_ID were reduced to the first row (3 IDs). Results values were grouped by exact string into completed-inspection results (Pass, Pass w/ Conditions, Fail) and visit outcomes (Out of Business, No Entry, Business Not Located); this grouping is ours, and no other values occur. Type spellings were compared after trimming spaces and ignoring letter case, and a type counts as out of business in some spelling with or without the spaces between its words (one row reads out ofbusiness).
A finding is a piece of Violations, split on the pipe character and trimmed, that starts with digits followed by a period and a whitespace character; all 363,144 pieces matched. Bands follow the City's calculate_violation_types code: 1-14, 15-29, 30-44, and anything else outside. A case's most severe band is critical if any finding is 1-14, otherwise serious if any is 15-29, otherwise minor if any is 30-44. Titles were read only for numbers 14, 29 and 70, from the text before the word Comments; comment text was not read or saved.
A re-inspection is a row whose type matches re-inspection, reinspection or re inspection as a word start, ignoring case (eleven spellings, all printed by the script). Re-inspections dated less than 90 days after 2010-01-04 are reported separately when no parent is found. A re-inspection's candidate parents are other rows with the same license number, read as an integer, with missing or zero licenses treated as unusable, dated on a strictly earlier calendar day, with no maximum gap; the nearest parent is the latest such date, and when several rows share that date each becomes a link row, which is why there are 17,660 link rows for 17,534 linked re-inspections. A same-day clash is any other row with the same usable license on the same calendar date as the re-inspection. Type alignment applies to Canvass, License and Complaint Re-Inspection and counts a link as aligned if any nearest-date row has the matching base type, ignoring case. The median gap takes the midpoint of the two middle values when the count is even, rounded half up; percentiles use the nearest-rank method. Each percentage is computed from exact counts and rounded a single time, half up, to one decimal place.
Not measured: hearing dispositions, corrections made during a visit, inspections after 2014, and whether the portal's current file reproduces these counts. The script saves counts only, with no names, addresses or comment text. Sources were read on 2026-10-28: the repository files directly from a clone, and the two City web pages through search excerpts on their own domains, which are paraphrased here.
Frequently asked questions
What is a multi-outcome case in a business dataset?
It is one unit of work, such as an inspection, a claim or a ticket, that produces several results that can each be checked on their own: whether the work happened, what was found, what was decided and what followed. Each of those deserves its own row and source, linked to the case by its key.
Should a delivery still include a single summary status?
Yes, if the buyer wants it, but only beside the components and with the manifest stating whether the status is derived by a written rule or recorded by the source system. A recorded status that the components cannot reproduce is still useful, as long as it is labeled recorded rather than presented as a summary of the evidence.
How should follow-up cases be linked when the source has no parent ID?
Infer the link with a stated rule, such as the latest earlier case for the same account, and ship it as an inferred link with the rule, the number of candidates and a confidence flag. Same-day candidates and type mismatches should be flagged rather than resolved silently, because a buyer cannot see them in the rows.
Is a valid checksum enough to accept a delivery?
No. A checksum proves that the file arrived unchanged; it says nothing about what a status means, what a blank stands for or whether two cases are related. Treat loading and hashing as the first gates and run meaning and relationship checks after them.
What if the source system only exports one status field?
Then reconstruct the other outcomes from the records that hold them, such as line items, notes, follow-up records or hearing outcomes, and say in the manifest which outcomes were reconstructed and from where. If an outcome cannot be recovered, list it as not available instead of leaving the status to stand in for it.
Sources
- The City of Chicago's stored snapshot of its food inspection data, 97,432 rows dated 2010-01-04 to 2014-12-30, which this page's checks were run on. Source
- The City's script downloads portal dataset 4ijn-s7e5 as CSV, renames columns and saves the result as DATA/13_food_inspections.Rds. Source
- The repository stores a snapshot of the portal data used in the City's inspection prediction model and joins sources on keys including inspection ID and business license. Source
- The City's model filter removes duplicated inspection IDs, keeps only Canvass inspections and drops the results Out of Business, Business Not Located and No Entry. Source
- The City's feature code counts violations 1-14 as critical, 15-29 as serious and 30-44 as minor, and expects 44 violation types. Source
- The City's code treats Violations as a collapsed list separated by a pipe and extracts the leading digits of each item as the violation number. Source
- The portal describes each row as one inspection identified by an inspection ID with its result and violations, and notes that violation definitions changed on July 1, 2018 (paraphrase). Source
- The portal publishes a separate food inspections view covering January 1, 2010 to June 30, 2018. Source
- The City says online results reflect only findings at the time of inspection and that violations noted are allegations that may be disputed and dismissed at the Department of Administrative Hearings (paraphrase). Source
Tell us what data you need
Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.