Skip to content

IRS SOI measure_id net_capital_gains_* names two different measures (Form 1040 line 7 vs Table 1.4 Schedule D gain) #307

Open

Description

@MaxGhenis

docs/architecture.md says that within a source_name, measure_id must distinguish different statistical measures. Two IRS SOI measure ids break that rule:

measure_id Packages IRS measure Concept (after #304)
net_capital_gains_returns / _amount historic_table_2, historic_table_2_state_broad_2022, congressional_district_2022 (and TY2023 HT2 in #295) N01000/A01000, Form 1040 line 7 "net capital gain (less loss)": Schedule D gain, limited Schedule D loss, or distributions-only irs_soi.returns_with_form_1040_capital_gain_or_loss / irs_soi.form_1040_capital_gain_or_loss
same ids table_1_4 cols 37/38 (TY2022–23; 25/26 earlier), Schedule D "Taxable net gain" irs_soi.returns_with_taxable_net_capital_gains / irs_soi.taxable_net_capital_gains

For TY2022 the US counts are 30,465,850 and 12,915,122.

#304 fixes the concepts and leaves measure_id alone on purpose. Microcosm selects SOI facts by measure_id: fiscal_targets.py maps net_capital_gains_returns to capital_gains_gross, and the capital-gains rebase control is keyed on (measure_id, filing_status, universe). Renaming either side therefore moves Microcosm's selector. microcosm#1036 and #1040 currently tell the two apart by record-set family instead.

To do. Give one side a distinct measure_id. For example, rename the line 7 pair to form_1040_capital_gain_or_loss_returns / _amount, in the same change as a Microcosm update that maps the new ids. Then drop the shared-id pin in tests/test_chronicle_soi_capital_gain_concepts.py::test_consumer_selector_survives_the_concept_rename and add a note to docs/concept-migrations.md.

Related, same packages. Historic Table 2 and the congressional-district file still give different concepts to 10 other IRS columns they both read (N/A00900, N/A01700, N/A06500, N/A25870, N/A26270). Check each against the IRS guides. For each pair that turns out to be the same IRS variable, give it one concept. Record each rename in docs/concept-migrations.md.

Activity

  1. MaxGhenis commented on Sep 29, 2026

    @MaxGhenis
    ContributorAuthor

    Related gap from the chronicle#304 review: tests/test_chronicle_soi_capital_gain_concepts.py finds a line 7 measure through its source_column_id or expected_column_header guard. A measure that reads N01000/A01000 by column letter alone would slip past it. The national historic_table_2 package declares 13 of its 55 measures that way today, and none of them is a capital-gain measure. Closing the gap: require every irs_soi measure that reads a CSV variable to declare source_column_id plus the header guard, as the TY2023 packages in #295 already do.

  2. MaxGhenis commented on Oct 12, 2026

    @MaxGhenis
    ContributorAuthor

    Two more items for this issue, found while pinning every IRS-variable measure to its documentation-guide definition in #345:

    • charitable_* has a split concept across packages. The congressional-district file uses irs_soi.charitable_contributions_deduction / irs_soi.returns_with_charitable_contributions_deduction on A19700/N19700; the guide calls these "Total charitable contributions", Schedule A:14. Table 2.1 uses irs_soi.contributions_deduction / irs_soi.returns_with_contributions_deduction for the same measure ids.
    • ctc_* (Historic Table 2 national and state broad) reads N07225/A07225. Every TY2022/TY2023 guide defines that column as "nonrefundable child and other dependent tax credit" (1040:19), but the concept is irs_soi.child_tax_credit and the label is "Child tax credit". The column is the only one the files publish, so the fix is the concept or label, not the column.

    #345's tests/test_chronicle_soi_doc_guide_columns.py pins columns, not concepts, so it doesn't conflict with the renames tracked here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions