# Iowa October vs November comparison rules (v3)

v1 written Oct 29, 2026. v2 written Oct 30, 2026 after the McKay review of v1 against the saved October file. v3 written Oct 30, 2026 after checking v2's column list against the October file's header row. Status: DRAFT until Marco approves. Once approved, these rules are frozen.

What changed from v2: the column list in section 4 now uses the exact names from the October file (v2 named a "Category" column that doesn't exist and left out the report date column, which October already has); the report date column is named; the unreadable-number rule covers every number column, including age and proof; a repeated Blocked bullet in section 5 is merged; "category columns" is now "category column".

What changed from v1 (in v2): repeated item numbers (section 3), barcodes compared as exact text, zero prices, unreadable values, the named column list, spot-check sizes and the approval fingerprint.

## In short

We compare the State of Iowa's October and November liquor product lists row by row. Items are matched only by item number. An item Iowa lists once per category counts as one item with a list of categories. Every column is compared except the monthly report date. Other repeats, blank item numbers, blank required values and unreadable numbers are Blocked. Price moves of 30% or more, moves to or from a zero price, category list changes, size or strength changes, barcode changes, wording changes and removed items go to Review. Everything else is Safe. Every row in both files must be accounted for, or nothing gets published.

## 1. Why these rules are frozen

- These rules are written down and approved before the November file exists, so nobody can bend them to make the result look better.
- After approval, the rules don't change for this comparison. If one turns out to be a bad rule, we still report the result under it and say so in the write-up. Any better rule applies only to future comparisons.
- If the comparison tool has a bug, we fix the bug and run it again under these same rules, and the write-up says it was re-run and why.

## 2. The two files

- October file: the edition saved on Oct 22, 2026 (13,913 rows), kept untouched in its own folder with its fingerprint (hash) recorded.
- November file: the next monthly edition of the same list (data.iowa.gov, dataset 1029), saved the same way. Downloading it is a separate task that needs Marco's own OK.
- We work only on copies. The two saved originals are never edited.
- Stop rule 1: if the November download is identical to October (same fingerprint) or isn't a newer edition, we stop. There's nothing to compare.
- Stop rule 2: if November's columns don't match October's (a column renamed, added or removed), we stop and tell Marco. We don't adjust the rules to fit.

## 3. How items are matched

- Each item is matched by its item number only, never by name, barcode or position in the file.
- Item numbers are read as text with spaces at the ends trimmed. Nothing else is cleaned up, so "012" and "12" are different items.
- Iowa lists some items once per category. If an item number appears on more than one row and those rows are identical in every column except the category column (category_name), they count as one item with a list of categories. The order of that list doesn't matter.
- Any other repeat is never guessed. If rows that share an item number differ in anything besides the category, every row with that number is Blocked and isn't compared.
- A row with a blank item number is Blocked.
- Each row belongs to exactly one item, so results are reported both as items and as rows.

## 4. What gets compared

- The October file has these 17 columns, in this order. The names are copied exactly from the October file's header row (checked Oct 30, 2026 against the saved file):
  1. item_no: the item number (used only to match, section 3)
  2. category_name: the category
  3. im_desc: the item description
  4. vendor_no: the vendor number
  5. vendor_name: the vendor name
  6. bottle_volume_ml: the bottle volume in ml
  7. pack: bottles per case
  8. inner_pack: the inner pack
  9. age
  10. proof
  11. list_on: the listing date
  12. upc: the UPC barcode
  13. scc: the SCC case barcode
  14. state_bottle_cost
  15. state_case_cost
  16. state_bottle_retail
  17. report_as_of: the monthly report date
- Columns 2 to 16 are compared. The item number (column 1) is used only to match.
- Not compared: report_as_of (column 17), because it changes every edition by design. November must have it too. Any other extra or missing column triggers Stop rule 2.
- The three prices, bottle volume, pack, inner pack, age and proof are compared as numbers, so 19.99 and 19.990 count as the same.
- Item numbers, vendor numbers and barcodes (UPC and SCC) are compared as exact text, so a barcode or vendor number that loses a leading zero counts as changed.
- A value in any number column above that isn't a readable number (for example letters in a price) is Blocked.
- Text that differs only in capital letters or extra spaces counts as a format-only change and is Safe. Any other wording difference is a real change.
- Required values: item number, item description and state bottle retail price. A blank in any of these is Blocked.

## 5. What counts as a change, and how it's labeled

Every item gets exactly one label. If a row trips more than one rule, the strictest label wins (Blocked, then Review, then Safe), and every reason is listed.

Blocked (a hard data problem):
- The item number is blank.
- Rows sharing an item number differ in something besides the category (section 3).
- A required value is blank in the November file.
- A value in any number column (the three prices, bottle volume, pack, inner pack, age or proof) isn't a readable number.

Review (a big or unusual change a person should look at):
- Any price (bottle cost, case cost or bottle retail) moves up or down by 30% or more.
- Any price moves to zero or from zero (a 30% move can't be worked out from zero).
- The item's list of categories changes (one added or dropped).
- The November retail price is lower than the November bottle cost. One item is already like this in October, so it will land here even if nothing changes. That's expected.
- Bottle size, pack size, inner pack, proof or age changes. Under the same item number, that's really a different product.
- A barcode (UPC or SCC) changes or disappears.
- The description, category or vendor changes beyond format.
- A non-required value that October had is blank in November (a lost detail).
- Any other compared column changes in a way not covered elsewhere in this section (for example, the listing date).
- The item is in October but missing from November (removed).

Safe (passes these checks):
- Unchanged in every compared column. Reported separately as "unchanged".
- Changed only in small ways: a price move under 30%, a format-only text change, or a new value filled in where October was blank.
- Added: new in November, as long as it doesn't hit a Blocked rule.

Safe only means the row passed these checks. It says nothing about whether the State's numbers are right.

## 6. Every row accounted for

- October rows = rows of matched items + rows of removed items + Blocked October rows.
- November rows = rows of matched items + rows of added items + Blocked November rows.
- The same tie-out is reported for items.
- Both have to tie out with zero unaccounted rows. If they don't, nothing gets published until the gap is found.

## 7. What's left out

- Row order and any column that only appears in one file (that's Stop rule 2).
- Any guess at why the State changed something. We report what changed, not why.
- Any claim that these are store shelf prices. They're the State's own list prices.
- This isn't a migration and isn't a customer result.

## 8. Checking the result (Nov 5)

- The row counts in section 6 are re-added by hand.
- Every Blocked row is checked against both original files.
- 50 Review items, 50 changed Safe items and 50 unchanged items are picked at random and checked against both files. If a group has fewer than 50, all of them are checked. The random pick uses a fixed starting number (seed 20261029), so anyone can repeat it.
- If a spot check finds the tool got a row wrong, the tool is fixed and re-run under these same rules (section 1).

## 9. How the results are reported

- Summary counts: rows in each file, matched, unchanged, changed, added, removed, and Safe / Review / Blocked totals, plus the count for each reason.
- A change list spreadsheet: one line per changed, added, removed or Blocked item, with the item number, old value, new value, label and reason.
- Source details: both download dates, both file fingerprints, the dataset link, and the CC BY 4.0 credit with the license link.
- The site label and wording ("not endorsed by the State of Iowa", and so on) are approved separately in the "run, check and publish" task. Approving these rules doesn't approve that wording or the deploy.

## 10. Approval

- Drafted Oct 29, 2026 from the Oct 22 outline in Todoist (item-number matching, no guessing on duplicates, fields, price changes, added and removed items, Safe / Review / Blocked). Revised Oct 30 after the McKay review (v2), and again Oct 30 after checking the column names against the October file (v3).
- Approved by Marco: not yet.
- On approval, this file's fingerprint (SHA-256) is recorded in the task and in a short note saved next to it. Before the run on Nov 4, the fingerprint is checked again. If it doesn't match, the file was edited after approval and the run waits until the approved version is restored.
- Once approved, any edit to this document is a mistake, not a rule change. The comparison runs on the approved version.
