Skip to content

Add SSA Supplement 2025 Tables 7.B3 and 7.B7 by state - #434

Draft
MaxGhenis wants to merge 7 commits into
mainfrom
feat/ssa-ssi-tables-7b3-7b7-2024
Draft

MaxGhenis wants to merge 7 commits into
mainfrom
feat/ssa-ssi-tables-7b3-7b7-2024

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

WIP. This PR adds SSA Annual Statistical Supplement 2025 Tables 7.B3 and 7.B7 as two Chronicle packages, read from the section 7.B workbook that #294 pins, for PolicyEngine/microcosm#1558:

  • ssa-ssi-table-7b3-2024: December 2024 recipients of federal SSI and of federally administered state supplementation, with their average monthly payments, for All areas, the 50 states and DC (128 facts).
  • ssa-ssi-table-7b7-2024: calendar 2024 federal SSI and state supplementation payments (65 facts).

The plan before review: the changelog fragment, the judge record, CI, and the full description with the invariants the new test module checks. The PR stacks on #294 and targets its branch, and it moves to main when #294 merges.

🤖 Generated with Claude Code

MaxGhenis and others added 6 commits November 9, 2026 20:58
Two packages read sheets 7.B3 and 7.B7 of the section 7.B workbook that
ssa-ssi-table-7b1-2024 pins:

- ssa-ssi-table-7b3-2024 emits December 2024 recipients of federal SSI
  and of federally administered state supplementation, with their
  average monthly payments, for All areas, the 50 states and DC (128
  facts).
- ssa-ssi-table-7b7-2024 emits calendar 2024 federal SSI and state
  supplementation payments (65 facts). It leaves out the Total column,
  which repeats Table 7.B1's payment totals.

The label register lists the 52 area values the packages share, and the
7.B1 manifest's note names all three packages that read the workbook.
tests/test_source_ssa_ssi_tables_7b3_7b7.py checks each fact against the
HTML capture of the same tables, the tables' sums, and Table 7.B1. The
default bundle gains 193 facts, two packages and one duplicate semantic
key: Table 7.B3's national federal count repeats SSI Monthly Statistics
Table 1.

Refs PolicyEngine/microcosm#1558.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bundle test still pinned 443 source tables. The two packages add one
each, so the pin moves to 445, and the Chronicle bundle job would fail
without it.

Two tests in the new module pin metadata that no fact key hashes: each
record set's period and coverage (month 2024-12 for Table 7.B3, calendar
2024 for Table 7.B7), and each fact's record kind, measure label and
concept relation. For example, a February start date on Table 7.B7's
coverage passed every earlier test and fails the new one.

Reword Table 7.B7's coverage note to "Payments during calendar year
2024.", since the federal-only record set shares it. In the manifest, say
why none of the three packages emits the Northern Mariana Islands row:
all three keep the Table 7.B1 package's area set. Also say that the
workbook stores Table 7.B3's footnoted national state supplementation
cells as text, and name all three tables the HTML capture renders. No
fact key hashes period coverage or manifest notes, so no key moves. The
changelog fragment now names the national figures Table 7.B3 leaves out.

Refs PolicyEngine/microcosm#1558.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/build_ssa_ssi_7b_packages.py writes both package YAMLs from SSA's
workbook and the 7.B1 package's geography rows. Its --check flag compares
its output with the committed files, and a new test fails if a committed
YAML drifts from what the script writes.

Refs PolicyEngine/microcosm#1558.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module pinned only the semantic-key digest. The semantic key hashes no
source release, source series or observed measure, so a wrong source table,
vintage or source concept passed every test in the module.
test_aggregate_identity_digest pins the sorted
(source_record_id, aggregate_fact_key) lines, and each of those three edits
now fails it.

The changelog now says that Table 7.B7's package leaves out the Total column,
which repeats Table 7.B1's payment totals. The generator and test docstrings
now say that the 7.B1 package emits those totals for every row but the
Northern Mariana Islands', and that the generator reads row labels from the
workbook. The measure labels come from the generator itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_table_7b7_total_column_repeats_table_7b1_payment_totals now builds the
Table 7.B1 package and checks its calendar 2024 total-payment facts: one each
for All areas, the 50 states and DC, equal to Table 7.B7's Total column times
1,000. Its docstring already said so, and nothing checked it. Five edits to the
7.B1 package's facts fail the test: dropping one total, adding $1,000 to one,
duplicating one, moving one to 2023 and giving one the aged filter.

The comment on AGGREGATE_IDENTITY_DIGEST drops "also". The aggregate key hashes
each measure's source concept in place of its canonical concept, which only the
semantic pin covers, so the module needs both pins.

The generator's docstring now separates what its constants set (each measure's
column and each sheet's heading and body rows) from what the script reads from
the workbook's cells.

bc9b650's message says a wrong source table, vintage or source concept passed
every test in the module. That held when the edit went through the generator; a
hand edit of the YAML alone already failed
test_generator_reproduces_the_committed_packages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis changed the base branch from fix/ssi-table-7b1-2024-values to main November 10, 2026 14:20
@MaxGhenis MaxGhenis closed this Nov 10, 2026
@MaxGhenis MaxGhenis reopened this Nov 10, 2026
The Table 7.B7 test compares the 7.B1 package's totals with 7.B7's Total
column. It picked the totals by their filters alone, so a total that gained a
category constraint with no filter still passed. It now checks the constraints
too, and it fails when a copy of the 7.B1 YAML gives Alabama's payment total
the aged constraint.

The generator's docstring said the script reads every row number from the
workbook. The script reads each area's row from the cells, while its constants
set each sheet's body, heading and column-group rows, and the docstring now
says so. In the identity comment, "The aggregate key" replaces an "It" that
could have meant either key.

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.

1 participant