Repository navigation
Read Schedule A line 14 at Historic Table 2's US rows (TY2022 and TY2023) - #461
Draft
juaristi22 wants to merge 2 commits into
Draft
juaristi22 wants to merge 2 commits into
juaristi22 wants to merge 2 commits into
Conversation
soi-historic-table-2 (TY2022) and soi-historic-table-2-2023 (TY2023) now read N19700/A19700, "Total charitable contributions" (Schedule A line 14) in the IRS guides of both years, at the US row of all 11 AGI classes: 22 facts per package, 605 -> 627. The measures take the ids, concepts and labels that Table 2.1 and the state broad packages already use for the same line (charitable_returns, charitable_amount), so the 51 state rows of each edition have a US total from the same file. The TY2023 twin gets the same two measures, as test_packages_mirror_their_2022_twins requires. The new measures come after the 55 existing ones (ordinals 55 and 56), so the existing facts keep their keys. The packages already parse every cell of the US rows, so the source cell counts do not move. New tests/test_chronicle_soi_ht2_us_charitable.py checks, for both years, each new fact against its cell read with the csv module, the AGI classes against the all-returns fact, the 51 states plus OA and PR against the new US fact, and the ratio to Table 2.1's line 14 for the same tax year (0.9931/0.9937 for TY2022, 0.9842/0.9950 for TY2023). The count pins of the package, guide and single-source bundle tests move by 22. Microcosm's US target nesting (PolicyEngine/microcosm#1760) needs the TY2022 US total to give the Historic Table 2 state rows of this line their shares. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Full-bundle pins (tests/test_chronicle_bundle.py), measured with the 34 IRS SOI packages built at bundle year 2023 on 13294b9 and on this branch: fact count, irs_soi, country:0100000US and tax_unit +44, tax_year:2022 and tax_year:2023 +22 each. No new geography, period or entity key, semantic duplicate key (95 IRS keys before and after) or warning. chronicle#449's district totals rule: the district files' United States totals of line 14 now share a semantic key with the new Historic Table 2 facts, so the first rule removes them and their Publication 1304 pair is no longer needed. PUBLICATION_1304_LINES drops the two charitable pairs (17 -> 15, eight Schedule A items in Table 2.1), and the district packages' comments say so. Counted with the test's rules: same key 3,571 and 3,468 (were 3,569 and 3,466), same column 1,030 and 979, declared pairs 15; the removed totals stay 4,616 and 4,462, so no district fact changes. Judge notes answered: the count bounds of the new test allow for the rounded total (5 x 11 and 5 x 54), the test builds each package at its tax year and drops an unused constant, the changelog fragment describes the US row as the file's all-returns total and gives the new chronicle#449 counts, and the legacy ETL doc says the two national series of line 14 differ. The first commit's message says the guide pin moves by 22; it moves by 2 (55 -> 57 measures). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
soi-historic-table-2(TY2022,22in55cmcsv.csv) andsoi-historic-table-2-2023(TY2023,23in55cmcsv.csv) now read the contributions deduction,N19700/A19700, at the US row of all 11 AGI classes: 22 facts per package (605 -> 627). The IRS documentation guides of both years define the pair as "Total charitable contributions", Schedule A line 14. Every value is a publisher cell.Since #350 the state broad packages read this pair for each state, and Table 2.1 reads the same line for the nation. The US row of Historic Table 2, the file's total for all returns, had no fact for it. That row includes the file's other-areas and Puerto Rico rows as well as the 50 states and DC.
charitable_returnsN19700(CP)irs_soi.returns_with_contributions_deductioncharitable_amountA19700(CQ)irs_soi.contributions_deductionvalue_scale: 1000test_schedule_a_lines_shared_across_grains_carry_table_2_1_idschecks every package that reads these columns.test_packages_mirror_their_2022_twinsrequires. Both files have the pair at columns CP and CQ, and each measure guards its header.layout.record_set_spec_hashmoves, because it hashes the whole record set, and it enters no key. The packages already parse every cell of the US rows, so the source cell counts (1,956 and 1,980) do not move.Values
The US row for all returns. Amounts are in thousands of dollars, as the IRS publishes them.
N19700A19700Ratios, computed from the repo's publisher files:
On the US row, the neighbouring pairs
N19570/A19570andN20950/A20950are 7% to 25% of these totals, so a read one column over would fail the Table 2.1 check.The 51 state rows hold 0.9987 of the TY2022 US row's returns and 0.9950 of its amount (TY2023: 0.9988 and 0.9966). The file's other-areas and Puerto Rico rows hold the rest.
The district files' United States totals (chronicle#449's rule)
The district files' United States totals of line 14 were already not facts: chronicle#449's third rule paired them with Table 2.1. They now share a semantic key with the new Historic Table 2 facts, so the first rule removes them and the declared pair is no longer needed.
PUBLICATION_1304_LINESintests/test_chronicle_soi_district_agi_classes.pydrops the two charitable pairs (17 -> 15; eight Schedule A items in Table 2.1, not ten), and the district packages' comments say so. Counted with that test's rules on this branch:No district fact changes. The changelog fragment gives the new counts next to chronicle#449's fragment.
Checks
tests/test_chronicle_soi_ht2_us_charitable.py, for both tax years, with each package built at its tax year:csvmodule;A19570;value_scale;N20950.build-suitefor both packages at year 2023: valid, 627 facts each, agent acceptance clean, lineage coverage 1.0.test_chronicle_soi_ht2_us_charitable.py,test_chronicle_soi_ht2_2023.py,test_chronicle_soi_ht2_state_schedule_a.py,test_chronicle_soi_doc_guide_columns.py,test_chronicle_soi_district_agi_classes.py,test_chronicle_soi_capital_gain_concepts.py,test_issue_376_one_label_per_value.py,test_chronicle_boundaries.py; and intest_chronicle_source_package.pyandtest_chronicle_bundle.py, the tests that pin these packages' counts and values.test_build_bundle_writes_merged_consumer_contract, about an hour). CI runs it.Bundle (default, year 2023)
I built the 34 IRS SOI packages at bundle year 2023 with and without this change (base
13294b93). Only these counts moved, each by the new facts:fact_counttax_year:2022,tax_year:2023country:0100000UStax_unitirs_soiThere is no new geography, period or entity key, no new semantic duplicate key (95 IRS keys before and after) and no new warning. The full-bundle pins in
tests/test_chronicle_bundle.pymove by the same amounts: fact count 2,416,365 -> 2,416,409,irs_soi146,622 -> 146,666,country:0100000US10,840 -> 10,884 andtax_unit147,927 -> 147,971.Consumer note (Microcosm)
Chronicle stores the 44 values as publisher facts and activates none of them. Microcosm's US feed selects (record set, period) pairs (
us/chronicle_feed_scope.json). Its scope holdsirs_soi.ty2022.historic_table_2.usfor tax year 2022 and not the TY2023 US record set. So a Microcosm re-pin to a Chronicle commit with this change adds the 22 TY2022 facts to its feed and none of the TY2023 facts, and the 605 existing TY2022 US rows change only theirlayout.record_set_spec_hash. PolicyEngine/microcosm#1760 needs the TY2022 US total.Chronicle Governance
ledger-source-ingestor. Paths outside its allowed paths:docs/us-legacy-etl-cleanup.md(the national sources of line 14, and a clause that they differ) andchangelog.d/irs-soi-ht2-us-charitable.added.md.build-suite, thevalidate_source_packagecounts), source-cell preservation (the per-cell tests; lineage coverage 1.0), consumer-contract validation (build-suiteconsumer facts; the IRS SOI bundle build), raw-facts boundary validation (tests/test_chronicle_boundaries.py).e2817442. Two Opus 5.5 agents that wrote none of the commits judged the change. Each had the code and the criteria in.github/chronicle-agents.yml, not the author's conclusions.ledger-source-fidelityledger-contractledger-boundaryWhat the judges checked:
csvmodule; the files' sha256 and sizes equal the manifest; both guides defineN19700/A19700as Schedule A line 14; every other package that reads the pair declares the same id, concept, label and unit; the 605 existing facts of each package keep their values, keys, cells and lineage; every publisher value and relation the diff states is true.assertion: observationand the publisher's tax year; the YAML adds only measure declarations; no consumer selection, activation, binding, alignment or solver construction moves into Chronicle; the tests compare publisher tables and store or select nothing.How the findings were answered in
39830e91:test_a_total_stays_only_where_no_other_package_gives_itfailed, because the line 14 pair ofPUBLICATION_1304_LINESis no longer needed. The list now has 15 pairs (see above).soi-historic-table-2-2023, as that PR added it; this fragment gives 57 and 627.39830e91changes test pins, comments and text only. Its test files pass.Not in this PR
N19300/A19300(home mortgage interest paid to financial institutions), which the state package also reads.🤖 Generated with Claude Code