Skip to content

Add US district facts: IRS district-file extensions and ACS 2024 district tables (#447) - #448

Merged
juaristi22 merged 10 commits into
mainfrom
claude/us-district-facts-447-83bb66
Nov 26, 2026
Merged

juaristi22 merged 10 commits into
mainfrom
claude/us-district-facts-447-83bb66

Conversation

@juaristi22

@juaristi22 juaristi22 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

US district facts for Microcosm's local-area fit (PolicyEngine/microcosm#1731), items 2 and 3 of #447. One SOI package is extended and eight ACS 2024 1-year packages are added. Every value is a publisher cell; the checks below are on the publisher files.

1. IRS SOI congressional-district file (soi-congressional-district-2022: 29,760 -> 59,982 facts)

Item Content Facts
2.2 15 columns whose state twin soi-historic-table-2-state-broad-2022 reads (wages, total income, taxable income, child tax credit, real estate taxes, taxes paid, taxable state refunds, itemized returns). Each takes the twin's measure id, concept and label. +7,200
2.1 Return count (N1) and AGI (A00100) for agi_stub 1 to 9, at the 51 state and 428 district rows. One record set per class. +8,622
2.3 30 columns without a state twin (standard deduction, self-employment tax, NIIT, AMT, advance and net PTC, child care credit, education credits, saver's credit, SE health insurance and retirement deductions, IRA payments, student loan interest, total tax liability). The standard deduction amount keeps Table 1.2's id, the SE health insurance deduction Table 1.4's. +14,400
  • The 9 AGI classes are the 9 of soi-historic-table-2-state-agi-2022 (same income_range values and bounds). For TY2023 (10 classes), district class 9 = 500k_to_1m + 1m_plus.
  • The IRS guide (22incddocguide.docx, same sha256 as the repo's extract) lists 10 classes; 22incd.csv has 9. Its stub 9 is the guide's 9 and 10 together: the classes add up exactly to the all-class row, and stub 9's mean AGI is above $1,000,000 in 474 of 479 rows. tests/data/irs_soi_doc_guides/22incddocguide_agi_stub.tsv extracts the guide's list and a test pins the mapping.
  • Every new measure is pinned to the guide's wording and form line in tests/test_chronicle_soi_doc_guide_columns.py.
  • The existing record set id and its 62 measures do not change. The new selections come after the 480 existing ones, so the existing facts keep their keys, values and cells. Only layout.record_set_spec_hash moves.
  • The label register lists income_range=500k_plus, which two packages now emit.

Checks on 22incd.csv:

  • Every column the package reads nests exactly: district rows add up to their state row (43 states with more than one district), state rows to the US row, and the 9 classes to the all-class row.
  • Against Historic Table 2: the district file's US row is 0.974 to 0.989 of HT2's for the 11 new twin columns HT2 publishes. Its state rows are 0.94 to 1.0006 of HT2's for the twin columns; the refund columns vary more (South Dakota: 0.83 for returns, 0.28 for the amount). Classes 2 to 8 are 0.966 to 1.0001 of HT2's state classes.

The district file's state rows and US row cover the same quantities as Historic Table 2 under the same concepts, so the bundle gains 1,694 semantic duplicate keys (items 2.1 and 2.2). The values differ slightly (see the ratios above). Chronicle keeps both, and a consumer selects by source.

Not in this PR: MARS1, MARS2, MARS4 and ELDERLY. The guide confirms them (single; married filing jointly; head of household; primary taxpayers 60 and older), but their shape needs a decision: Table 1.3 counts filing status as return_count with a filing_status filter and pools joint returns with surviving spouses.

2. ACS 2024 1-year district tables (item 3)

From the Census Bureau's API, fetched 2026-11-25 (source_url omits the API key). Districts are the 435 of the 119th Congress, DC's delegate district and Puerto Rico's resident commissioner district (437 rows).

Package Rows Facts
census-acs1-b19001-national-2024 1 34
census-acs1-b19001-state-2024 52 1,768
census-acs1-b19001-district-2024 437 14,858
census-acs1-b11001-district-2024 437 7,866
census-acs1-b19013-state-2024 52 104
census-acs1-b19013-district-2024 437 874
census-acs1-s1701-state-2024 52 832
census-acs1-s1701-district-2024 437 6,992
  • chronicle/sources/census_acs1_household_type.py now builds B19001 and a district geography; the four existing B11001/B11003 packages regenerate byte for byte. B19001 takes the ACS 5-year county package's income_range values, household_income bounds and labels.
  • New chronicle/sources/census_acs1_income_poverty.py builds B19013 (the county package's concept, unit, median aggregation, label, filters and constraints) and S1701: the population for whom poverty status is determined and below the poverty level, for all ages, under 18, 18 to 64 and 65 and over. S1701's universe is not the resident population, so its counts take their own concept, census_acs.poverty_universe_person_count. S1701's other cells stay source cells; the generator fails on an ACS code in a declared cell.
  • The label register lists the 437 districts, 16 income brackets, poverty_status and two age_band values that two or more packages now emit.
  • The eight raw API responses are committed and uploaded to ledger-raw at their content-addressed keys; chronicle verify-raw fetched each one back (remote sha256 and size equal the manifest's).

Checks on the publisher files:

  • District rows add up exactly to their state row: B19001 (884 cells), B11001 (468), S1701 (416). The states and DC add up to the US row (B19001).
  • B19001's brackets add up to its total in every row, and its total (estimate and MOE) equals B11001's in all 490 geographies.
  • S1701's age bands add up to all ages; each state's B19013 median lies within its districts' range.
  • The district GEO_IDs are the ACS S0101 district package's.

Chronicle Governance

  • Approved Chronicle agent role:
    • ledger-source-ingestor. Paths outside its allowed paths: db/data/census/** (raw files and manifests), chronicle/dimension_values/canonical_labels.json, chronicle/source_package.py (aliases), scripts/build_dimension_value_register.py, tests/data/irs_soi_doc_guides/**, tests/test_dimension_value_register.py, docs/data-sources/irs-soi-state.md, changelog.d/**.
  • Deterministic checks run:
    • build-suite for the final soi-congressional-district-2022: valid, 59,982 facts, agent acceptance clean, lineage coverage 1.0.
    • Generator --check for the 1-year household, 1-year income and poverty, and 5-year county packages; the register static check; ruff check; chronicle verify-raw for the eight new raw files.
    • tests/test_chronicle_bundle.py::test_build_bundle_writes_merged_consumer_contract passed locally on the 2.1 commit (full build). Item 2.3's counts come from a bundle of the IRS SOI packages at year 2023 (+14,400 facts, no new duplicate key or warning). The 2023 bundle skips the eight ACS 2024 packages (28 -> 36 skipped; 517 built).
  • LLM judge verdicts (judge record):
    • ledger-source-fidelity: PASS with notes (at d68e1675; 0 must-fix)
    • ledger-contract: not applicable (no schema or identity change)
    • ledger-boundary: PASS (at d68e1675; 0 must-fix)
    • 5348d882 and c89dfe61 answer both should-fixes; they change names and text only.

Tests

  • New: tests/test_chronicle_soi_district_agi_classes.py, tests/test_chronicle_census_acs1_income_poverty.py.
  • Extended: tests/test_chronicle_soi_doc_guide_columns.py, tests/test_chronicle_census_acs1_household_type.py, tests/test_chronicle_source_package.py, tests/test_chronicle_bundle.py, tests/test_dimension_value_register.py.
  • Run locally on this branch: the files above plus the SOI capital-gain, boundary, Schedule A, county ACS and coverage tests (359 passed before the judge fixes). After the fixes, the affected test files pass (107 tests).

Not in this PR

  • Item 1.1 (carrying a90ad379 to the US feed) and item 4 (FNS county SNAP) wait for a ruling.
  • MARS1, MARS2, MARS4 and ELDERLY (see section 1).

Part of #447.

🤖 Generated with Claude Code

Maria Juaristi and others added 8 commits November 25, 2026 13:45
soi-congressional-district-2022 reads 15 more columns of 22incd.csv at all
480 rows: N00200/A00200, N02650/A02650, N04800/A04800, N07225/A07225,
N18500/A18500, N18300/A18300, N00700/A00700 and N04470. Each takes the
measure id, concept and label of the state twin that
soi-historic-table-2-state-broad-2022 already reads, so a district row can
nest under the Historic Table 2 state row.

The record set id and the 62 existing measures do not change. The new
measures take ordinals 62 to 76. Existing facts keep their keys and values;
only layout.record_set_spec_hash moves, because the record set has more
measures.

Tests: a new check pins each district twin to the state package's identity;
the US-row differential against Historic Table 2 now covers 55 pairs (all
in [0.97, 0.99] for the new 11); the package test pins four new cells. The
bundle counts move by 7,200 facts and 776 semantic duplicate keys, measured
with the IRS SOI packages at bundle year 2023.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22incd.csv publishes agi_stub 1 to 9 for its 51 state rows and 428 district
rows; its US row has stub 0 only. soi-congressional-district-2022 now reads
the return count (N1) and AGI (A00100) of each class: one record set per
class, 479 rows each, +8,622 facts.

The nine classes are the nine of soi-historic-table-2-state-agi-2022, whose
500k_plus row adds Historic Table 2's stubs 9 and 10. Each class record set
copies that package's income_range value and AGI bounds, so a district class
row can sit under the state row of the same class. The class selections come
after the 480 all-class selections, so the existing rows keep their virtual
row numbers and their 79,365 cells.

The file is additive: in all 479 rows the nine classes sum exactly to the
all-class row, and each class's mean AGI lies inside its bounds. The district
file's state class rows are 0.966 to 1.0001 of Historic Table 2's for classes
2 to 8. The edges are not yet checked against the IRS documentation guide.

The label register lists income_range=500k_plus ("$500,000 or more"), which
two packages now emit; without it the bundle refuses the conflicting label.
Bundle counts move by 8,622 facts and 918 semantic duplicate keys (the file's
state rows publish Historic Table 2's state classes), measured with the IRS
SOI packages at bundle year 2023.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…OI doc

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22incddocguide.docx (sha256 4e265d3c..., the same document as the existing
extract) lists ten AGI_STUB classes: 9 is $500,000 under $1,000,000 and 10 is
$1,000,000 or more. 22incd.csv has agi_stub 0 to 9 only. Its stub 9 is the
guide's 9 and 10 together: the nine classes add up exactly to the all-class
row in all 479 rows, and stub 9's mean AGI is above $1,000,000 in 474 of them.

tests/data/irs_soi_doc_guides/22incddocguide_agi_stub.tsv extracts the
guide's class list. A new test checks that the package's bounds for stubs 1
to 8 are the guide's, that stub 9 spans the guide's 9 and 10, and that the
file has no stub 10. Every class has at least 70 returns in every row, so the
guide's rule that combines classes with fewer than 20 returns does not touch
N1 or A00100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m 2.3)

The first candidates of item 2.3, returns and amount each, at all 480 rows
of soi-congressional-district-2022 (+14,400 facts): the total standard
deduction (N04450), self-employment tax (N09400), net investment income tax
(N85300), alternative minimum tax (N09600), advance and net premium tax
credit (N85775, N11560), child and dependent care credit (N07180),
nonrefundable and refundable education credits (N07230, N10960), retirement
savings contribution credit (N07240), self-employed health insurance and
retirement plan deductions (N03270, N03300), IRA payments (N03150), the
student loan interest deduction (N03210) and total tax liability (N10300).

GUIDE_DEFINITIONS pins each new measure id to the TY2022 guide's wording and
form line; each wording names the same variable in all four guides. The
standard deduction amount keeps Table 1.2's id, concept and label, and the
self-employed health insurance deduction Table 1.4's (same tax lines).

A new test checks that every measure of every record set nests: district
rows add up exactly to their state row in the 43 states with more than one
district, and state rows to the US row. The file publishes all 161 columns
this way.

MARS1, MARS2, MARS4 and ELDERLY are not read: their shape needs a decision
(the guide pins them; Table 1.3 pools joint returns with surviving spouses).

Bundle counts move by 14,400 facts and no duplicate key or warning, measured
with the IRS SOI packages at bundle year 2023.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…7 item 3)

Four packages from the Census Bureau's API responses, fetched 2026-11-25
with an API key that source_url omits:

- census-acs1-b19001-national-2024: 34 facts (17 cells, E and M)
- census-acs1-b19001-state-2024: 1,768 facts (50 states, DC, Puerto Rico)
- census-acs1-b19001-district-2024: 14,858 facts (437 rows: the 435
  districts of the 119th Congress, DC's delegate district, Puerto Rico's
  resident commissioner district)
- census-acs1-b11001-district-2024: 7,866 facts (437 rows, 9 cells)

chronicle/sources/census_acs1_household_type.py now builds B19001 and a
district geography. B19001 takes the ACS 5-year county package's
income_range values, household_income bounds and labels. extracted_at comes
from the manifest's fetched_at, so the four existing packages regenerate
byte for byte. The generator checks the district rows: 437 rows, every state
with one at-large row (00) or districts 01..n without a gap, DC and Puerto
Rico with code 98.

Checks on the publisher files: the district rows add up exactly to their
state row (B19001: 884 cells; B11001: 468 cells), the states and DC add up
to the US row, B19001's 16 brackets add up to its total in every row, and
B19001's total (estimate and MOE) equals B11001's in all 490 geographies.
The district GEO_IDs are the S0101 district package's.

The label register lists the 437 districts and 16 brackets that two or more
packages now emit, with the publisher's district names and the county
package's bracket labels; the register script's BUILD_YEARS lists the four
packages. The 2023 bundle skips them (28 -> 32 skipped); no fact count moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em 3)

Four packages for the district checks of PolicyEngine/microcosm#1673, from
the Census Bureau's API responses fetched 2026-11-25 (source_url omits the
API key), for the 50 states, DC and Puerto Rico and for the 437 districts
(435 of the 119th Congress, DC's delegate, Puerto Rico's resident
commissioner):

- census-acs1-b19013-state-2024: 104 facts; -district-2024: 874 facts.
  Median household income, E and M, with the ACS 5-year county package's
  concept, unit, median aggregation, label, filters and constraints.
- census-acs1-s1701-state-2024: 832 facts; -district-2024: 6,992 facts.
  The population for whom poverty status is determined (C01) and below the
  poverty level (C02), for all ages, under 18, 18 to 64 and 65 and over,
  E and M. The universe is not the resident population, so the counts take
  their own concept, census_acs.poverty_universe_person_count; poverty
  status and age_band are filters with equality constraints, and the age
  bands carry age bounds. S1701's other cells stay source cells; some carry
  ACS codes, and the generator fails on a code in a declared cell.

chronicle/sources/census_acs1_check_tables.py generates them and checks the
state and district rows. Checks on the publisher files: the age bands add up
to all ages, the S1701 district rows add up exactly to their state row (416
cells), and each state's median lies within its districts' range. The label
register lists the districts, poverty_status and two age_band values; the
2023 bundle skips the packages (32 -> 36, after the fit tables); no fact
count moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chronicle publish-raw uploaded the eight ACS 2024 1-year API responses to
ledger-raw at their content-addressed keys, and chronicle verify-raw fetched
each one back: remote sha256 and size equal the manifest's. The manifests
now say so instead of "no upload or archival completion is asserted", and
take publish-raw's YAML layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at d68e16753. This is careful source work, and the checks I re-ran match the body. Nothing blocks it from my side. The points below are mostly for the consumer side, #1731 in microcosm.

What I checked

  • The existing SOI record set is unchanged. The diff shows about 7,000 deleted lines, but that's only how git lines up the file. Comparing the YAML itself: record_sets goes from 1 to 10 (the original plus the 9 AGI classes). In the original record set, rows is identical and the first 62 of its 107 measures are identical, in the same order, with 15 twins and 30 no-twin columns added. So the existing facts keep their keys, as the body says.
  • ACS B19001 raw files. District rows sum exactly to their state row in every state and bracket cell. The states and DC sum to the US row. The 16 brackets sum to the total in all 489 district and state rows.
  • Tests. test_chronicle_soi_district_agi_classes.py and test_chronicle_census_acs1_check_tables.py pass locally (46 passed). I didn't re-check 22incd.csv itself, so the AGI-class nesting and the stub-9 mapping rest on your test and the guide extract.

Points

  1. Puerto Rico is in the state and district files but not in the US row. The state file has 52 rows and the district file has PR's resident commissioner district, while the US row is the 50 states plus DC. That's the Census convention. But a consumer that sums states, or fits districts and checks them against the national total, has to drop PR first. Microcosm's US model doesn't cover PR. A one-line note on each package's label or notes would help, and so would an explicit state != 72 filter in #1731's target compile, so this doesn't rely on someone remembering.
  2. The two district sets use different boundaries. The SOI file is TY2022 with geography_vintage: 2020_census (the 118th Congress districts). The ACS 2024 packages are the 119th Congress, geography_vintage: '2024'. Several states redrew between the two, including Alabama, Louisiana, New York and North Carolina. The packages keep the vintages apart, which is right. #1731 needs the district crosswalk (#1244's boundary-vintage handling) before it fits both sets on the same districts. Otherwise, in the redrawn states, a "district 2" in one source isn't the same area as in the other.
  3. The one-year district estimates are noisy. From the raw B19001 margins of error (CV = MOE / 1.645 / estimate): the total has a median CV of 1% and a maximum of 2%. The lowest bracket has a median of 9.5% and a maximum of 15%, and the top bracket a median of 5% and a maximum of 13%. The margins of error are carried as their own measures (*_margin_of_error), which is good. #1731 should use them to weight the loss, so the fit doesn't chase 15%-CV cells as hard as totals.
  4. Governance. ledger-source-fidelity and ledger-boundary are still "not yet run". For a PR this size, adding about 166,000 lines of facts, it's worth running both before merging. The Chronicle bundle and surface checks were still pending when I looked.
  5. The refund columns. The note on South Dakota's state refunds (0.28 of HT2 for the amount) is useful. If #1731 uses taxable_state_refunds as a target, those rows should go through the same column checks as #1224, or be left out, because the district file and HT2 disagree too much there.

Leaving MARS and ELDERLY for a separate decision is sensible, given the joint/surviving-spouse pooling in Table 1.3.

Review drafted with AI assistance and checked against the code at d68e16753.

Maria Juaristi and others added 2 commits November 25, 2026 19:34
The ledger-boundary and ledger-source-fidelity judges passed the PR with
no must-fix. This commit answers their should-fixes and two nits:

- Chronicle code and text named the consumer's fit/check split, which is
  Microcosm's decision. chronicle/sources/census_acs1_check_tables.py is
  now census_acs1_income_poverty.py, with its test renamed to match; the
  four B19013 and S1701 packages are regenerated (only generated_by and the
  header comment change); the two ACS changelog fragments and a bundle-test
  comment describe the tables, not their use.
- soi-congressional-district-2022's label and extraction_method now name
  the nine AGI classes. Over all 59,982 facts, no consumer-row field
  changes; the source row key does not read these fields.
- The nesting test's docstring and the item 2.3 changelog now say "every
  column the package reads". SCHF, which the package does not read, has
  fractional rounding: 22 state rows at agi_stub 0 differ from their
  districts' sum by less than 0.001.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit (5348d88) recorded only the four file renames; a
failed `git add` left their edits out. This commit adds them, so the
renamed module, its test and the packages agree again:

- census_acs1_income_poverty.py: neutral docstring and GENERATED_BY; the
  four B19013 and S1701 packages regenerated (generated_by and header).
- tests/test_chronicle_census_acs1_income_poverty.py imports the renamed
  module; neutral docstring and fixture names.
- The two ACS changelog fragments and a bundle-test comment describe the
  tables, not their use.
- soi-congressional-district-2022: label and extraction_method name the
  nine AGI classes (no consumer-row field changes over all 59,982 facts).
- "Every column the package reads" in the nesting test's docstring and the
  item 2.3 changelog (SCHF, which the package does not read, has
  fractional rounding in 22 state rows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juaristi22

Copy link
Copy Markdown
Collaborator Author

Chronicle judge record for head c89dfe61

Two Opus 5.5 agents that wrote none of the commits judged the PR at d68e1675. Each had the code and the criteria in .github/chronicle-agents.yml, not the author's conclusions.

Judge Head Verdict Items
ledger-source-fidelity d68e1675 PASS with notes 0 must-fix, 1 should-fix, 3 nits
ledger-boundary d68e1675 PASS 0 must-fix, 1 should-fix, 5 nits

ledger-contract: n/a. The PR changes no schema, identity construction or consumer-contract code. Its edit to chronicle/source_package.py is 8 alias entries, and labels enter no key.

What the judges checked:

  • Fidelity: each fact against its raw cell times its scale, 59,982 of 59,982 SOI facts and 33,328 of 33,328 ACS facts, with 0 mismatches. The 29,760 old SOI facts keep their values, cell keys and row keys. The sha256 and size of all 9 raw files equal their manifests. The file supports the AGI-class reading (stub 9 = $500,000 or more): the classes add up exactly in all 479 rows, and stub 9's mean AGI is at least $1M in 474 of them. An ACS table shell written independently of the generators matches the packages' labels, filters and constraints with 0 differences.
  • Boundary: both generators only declare publisher cells (no fetch, sum, crosswalk or aging), and no fact is derived. No data field carries a target role. The register adds 458 labels and changes none; three other packages that emit newly listed values give identical consumer rows with the old and the new register. The old district facts differ only in layout.record_set_spec_hash, which enters no key.

How the findings were answered (5348d882 recorded only the renames; c89dfe61 adds their content):

  • Boundary should-fix (consumer fit/check names in code and text): census_acs1_check_tables.py is now census_acs1_income_poverty.py. Docstrings, the changelog fragments and a test comment describe the tables, not their use.
  • Fidelity should-fix (the district package's label and extraction_method): both now name the nine AGI classes. No consumer-row field changes over all 59,982 facts.
  • Fidelity nit: the text now says "every column the package reads" nests exactly. SCHF, which the package does not read, has fractional values, and its districts do not add up exactly to the state row in 22 states.
  • PR body (boundary nits): it now gives the +1,694 semantic duplicate keys and the full list of paths outside ledger-source-ingestor's allowed paths.
  • Left for later PRs (nits): the ctc_* label is broader than the guide's wording (in both SOI packages); the MOE measures of all ACS packages declare sum or median aggregation; the district manifest's source_page points at the county data page.

The commits after d68e1675 change names and text only. Generator --check reproduces all 12 ACS 1-year packages, and the affected test files pass (107 tests).

@juaristi22

Copy link
Copy Markdown
Collaborator Author

Thanks, Vahid. On each point:

  1. Puerto Rico. Every ACS 1-year package already says this in its record set's period_coverage.notes ("Puerto Rico's estimate is separate from the United States total"), and the tests check the US row against the 50 states plus DC. Agreed on an explicit state != 72 filter in US local build: district targets that exist but are not in the fit microcosm#1731.
  2. Boundaries. The SOI district rows carry geography_vintage: 117th_congress; the IRS guide says "District boundaries are based on the 117th Congress". 2020_census is the record-set default, which the US and state rows keep. The ACS district rows carry 119th_congress; '2024' is the record-set default. So the crosswalk that US local build: district targets that exist but are not in the fit microcosm#1731 needs goes from 117th to 119th Congress districts, not from 118th.
  3. Noise. Agreed. The margins of error are separate measures for that use.
  4. Governance. Both judges ran; the record is in this comment. 5348d882 and c89dfe61 answer their findings.
  5. Refunds. Agreed. Chronicle keeps both publications as published; the district/HT2 gap is a consumer check.

Thanks for re-checking the B19001 sums.

@juaristi22
juaristi22 merged commit ece6bb2 into main Nov 26, 2026
3 checks passed
juaristi22 pushed a commit that referenced this pull request Nov 27, 2026
…ronicle#449)

soi-congressional-district-2023 now reads what chronicle#448 added to the
TY2022 district package, from 23incd.csv:

- 45 more columns in the all-returns record set, at its 481 rows: the 15
  columns whose state twin Historic Table 2's state package reads, and the
  30 columns without a state twin. Each keeps the TY2022 measure id, label,
  concept, unit and scale, and reads the column of the same IRS variable.
  The TY2023 guide defines all 45 the same way; for N03150 it spells out
  "Individual Retirement Account (IRA) payments", now a listed wording.
  The wage measure's legal vintage and evidence page name TY2023.
- Returns and AGI (N1, A00100) in the nine AGI classes, one record set
  each, at the 51 state and 429 district rows, with the TY2022 class
  filters and AGI bounds. Classes 1 to 8 are those of Historic Table 2's
  TY2023 state package; class 9 is its 500k_to_1m and 1m_plus together.
  The class selections come after the 481 all-class selections, so the
  existing facts keep their cells.

+30,285 facts (60,107 in all). The package label, class labels and
extraction method follow the TY2022 package.

The TY2023 guide says "District boundaries are based on the 118th
Congress." (the TY2022 guide: the 117th). The package keeps #444's
118th-Congress scheme: 5001800US GEOIDs and the 118th_congress vintage, and
its own record_set_spec_ids (all_returns and the new agi_class), so its
facts are a new series and no district key is a 117th-Congress key.
tests/data/irs_soi_doc_guides/incddocguide_district_boundaries.tsv quotes
both guides, and a test checks each package's GEOIDs, vintage and
one-district states against them.

Checks on 23incd.csv: the nine classes add up exactly to the all-class row
in all 480 rows; stub 9's mean AGI is above $1,000,000 in 470 of them (the
guide's stubs 9 and 10 together, as in TY2022); every class has 70 or more
returns in every row; every measure nests from districts (44 states with
more than one) to states to the US row. The US row is 0.949 to 1.000 of
Historic Table 2's for 54 of 55 pairs.

The 55th is the EITC amount: in every row of 23incd.csv, A59660 is the sum
of A59661 to A59664, and A59664 is in dollars while the others are in
thousands. The US EITC amount reads as $15.3 trillion (Historic Table 2:
$65.0 billion). The package still reads the cell as published; a test pins
the sum, and the question goes to María.

Tests: the AGI-class tests now run for both years; new tests check the
118th-Congress scheme and the copied identities; #444's district test
selects the all-returns record set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
juaristi22 pushed a commit that referenced this pull request Nov 27, 2026
Brings in #444 (IRS filing-season snapshots for
weeks 21 and 30 of the 2025 and 2026 seasons, TY2023 county and
congressional district data, W-2 statistics for TY2021 to TY2023). The
TY2023 district package uses the 118th Congress districts that its guide
names, as its own series, and gets the record sets that #448 gave TY2022.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants