Repository navigation
Conversation
…#1038) 22incd.csv has no Schedule A line 10 column. Chronicle publishes its line 8a column (N19300/A19300, "Mortgage interest paid") under interest_paid_deduction_*, whose Table 2.1 rows are the line 10 total, so the district file's rows bound interest_deduction at 0.673x the national line 10 target on the full surface. Each district-file row that reads N19300/A19300 now binds deductible_mortgage_interest as its share of the file's US row times Table 2.1's home mortgage interest control (8a + 8b), keyed by column so a relabeled package compiles the same. A district interest_paid_* fact reading any other column, or none, refuses the compile. The file's US row retires; rows without an anchor are dropped. A district's share of 8a is within 2.4% of its share of 8a + 8b (median 0.45%); as a proxy for line 10 it is off by a median 7.3% and up to 54.6% (FL-21). The ACS-local state_cd surface binds these share rows as compiled instead of bridging them through itemized deductions, which would lift them a second time and dropped Wyoming and South Dakota over their charitable deductions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PolicyEngine/chronicle#345 relabels the district file's line 8a column to mortgage_interest_paid_* and adds lines 8b, 8c and 9 under Table 2.1's own ids. The column-keyed rule binds the relabeled 8a rows unchanged and the new ids stay unmapped, so nothing double-binds. Also drop an unused import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Part of #1038: the congressional-district file's interest-paid rows. Based on
main, independent of #1036, #1040 and #1224. It uses the same share declarations as #1040's capital-gains rebase, but no code from it.Methodology call, queued for Max (d1428). It binds district rows of one concept as shares of a national control rather than dropping them, the same kind of call as d539 (#1040). It changes
full-surface and ACS-localstate_cdtarget values.Summary
22incd.csvhas no Schedule A line 10 column.22incddocguide.docxlists the line's parts:Chronicle's
congressional_district_2022package publishes only line 8a, underinterest_paid_deduction_{returns,amount}. Table 2.1's rows of those ids are the line 10 total, and microcosm maps them tointerest_deduction, which in PE-US 2.2.1 isdeductible_mortgage_interest + non_mortgage_interest. On the pinned feed (51aa40f, 2024, aging, packaged crosswalk), onfull, the district file's states and its districts each summed to:This PR binds each district-file row that reads N19300/A19300 onto
deductible_mortgage_interest. Each row is its share of the file's US row, times Table 2.1's home mortgage interest control. That control is exactly 8a + 8b: $167,675,863K + $3,688,924K = $171,364,787K in TY2023.Three remedies, measured
The sha-matched
22incd.csv(137522878a…) and Historic Table 2 TY2022 (22in55cmcsv.csv) give every number here. Scripts and outputs:~/PolicyEngine/_reviews/cd-interest-paid-concept-20261012/. "Misallocated" is half the sum of absolute share differences, the share of the national total that sits in the wrong district.interest_deductiondeductible_mortgage_interestLine 8a is 85.6% of line 10 in the file's US row. Investment interest is concentrated, so the share is 38.8% in FL-21, and 44.9% and 45.0% in NY-10 and NY-12. Line 8a is 98.2% of 8a + 8b.
(b) loses real information. A district's share of line 8a differs from its share of returns by 30.3% misallocated, from AGI by 22.2%, and from total itemized deductions by 14.0%. (c)'s proxy error is 0.21% on the same scale.
Picked (c). It keeps the geography at about a twentieth of (a)'s error. It binds the concept the model and Table 2.1 both measure, and the national control already binds that concept on the same surface. The parts it leaves without district targets, points and investment interest, are 17.7% of line 10. Table 2.1's line 10 row still binds them nationally. Return counts behave the same way: at state level the file's N19300 share is within a median 0.43% (max 2.8%, ND) of HT2's N19300 + N19500 share.
The universe filters match. Every row of either variable gets
itemized_onlyfrom_SOI_ITEMIZED_ONLY_VARIABLES, so the district rows (record-set universeall_returns) and Table 2.1's rows (itemized_returns) both materialize overtax_unit_itemizestax units. Each share row declaressoi_return_universe_bridge = itemized_returns.What changes
fiscal_targets.py:_SOI_DISTRICT_COMPONENT_SHARE_COLUMNSregisters N19300 and A19300 by IRS column, so a package that relabels them (for example to Table 2.1'smortgage_interest_paid_*) compiles to the same targets._soi_reference_from_factsends them todeductible_mortgage_interest, with rolesoi_fiscal_distribution, and flags them.interest_paid_deduction_*fact that reads any other column, or none, raisesUnreviewedSoiDistrictColumnError. The file has no line 10 column, so any such fact is unreviewed._rebase_soi_district_component_sharessetscontrol x row / US row:home_mortgage_interest_*fact in the itemized universe not after the build period, from outside the district files.AmbiguousSoiDistrictComponentControlErrororAmbiguousSoiDistrictComponentShareTotalError. Feed order never decides (Capital-gains rebase control is picked by feed order and crosses IRS concepts (HT2 N01000 vs Table 1.4 col 37) #1035).soi_source_concept,soi_control_concept,soi_share_total_source_record_id,soi_source_column_id,soi_return_universe_bridgeand the usualuprating_*fields. The value lands at the control's period.tools/us_acs_local_cd_surface.py:is_national_share_spec) binds as compiled, as its districts' parent. It is not lifted by a sibling bridge: its states already sum to the control, so a bridge would lift amounts about 6% and counts about 2% a second time.STATE_CD_LEVEL_BRIDGESdropsinterest_paid_deduction_*. An interest row the compiler failed to rebase would therefore refuse the surface rather than bind unbridged.national_share_levels_by_measureand the parent basiscd_file_state_total_national_share.Docs:
docs/us-soi-interest-paid-concepts.md(new),docs/us-acs-local-soi-target-surface.md,docs/us-fact-to-target.md.Invariants
These hold for every fact set the compile accepts:
interest_deduction.state_cd, every district block sums to its parent, and a national-share state row binds at its compiled value.test_us_soi_district_interest_shares.pycovers these:test_us_acs_local_cd_properties.pyextends thestate_cdHypothesis property with a national-share measure. It adds an example for the Wyoming/South Dakota case and a fail-closed check that an unbridged, unshared district-only level refuses.Effect on the pinned feed
full, compiled at 2024 with aging and the packaged crosswalk. The dump-to-dump diff is indiff_dumps.out.interest_deduction(0.673x line 10)deductible_mortgage_interest(1.000x the national home mortgage target)national_statee1f9906bf0e0No other spec changes in name, value or metadata. The share rows age with the national row's own 2023→2024 link (1.087213).
ACS-local
state_cd(test_pinned_feed_state_cd_surface_matches_its_contract, re-pinned):interest_deduction)Wyoming and South Dakota fell out of the itemized bridge's band because of charitable giving: HT2/CD A19700 is 2.10 and 1.98. Their line 8a agrees between the two files, at 1.007 and 1.028.
Interplay
fiscal_targets.py(__all__,_soi_reference_from_fact) andus_acs_local_cd_surface.py.test_pinned_feed_national_state_surface_restores_the_fences: Drop congressional-district SALT and PTC facts read from the wrong IRS column #1224 drops the district SALT/PTC rows, and this PR retires two US rows. The second to land re-pins it on the merge.state_cdcounts move only here:state_cdalready kept SALT/PTC off.test_district_mortgage_interest_ignores_the_package_stamp). Like Rebase congressional-district capital gains onto Table 1.4 and drop mislabeled CD SALT and PTC columns on the full surface #1040's rows, these rows carrysoi_share_total_source_record_id, so Read restamped Chronicle facts at their data year before aging #1030's narrowing for rebased restamps applies to them as written.mortgage_interest_paid_*, keeping N19300/A19300. It adds lines 8b, 8c and 9 ashome_mortgage_personal_seller_*,deductible_points_*andinvestment_interest_paid_*. The rule keys on the column, so the relabeled 8a rows bind unchanged. The new ids are unmapped in microcosm (Table 2.1 binds only their total), so they stay inert (test_the_other_line_10_parts_stay_inert).interest_paid_deduction_*would refuse until reviewed.axiom: n/a: microsim target mapping only (no policy encoded)
🤖 Generated with Claude Code