diff --git a/changelog.d/1843-snap-participant-targets.added.md b/changelog.d/1843-snap-participant-targets.added.md new file mode 100644 index 0000000000..661cad9a6c --- /dev/null +++ b/changelog.d/1843-snap-participant-targets.added.md @@ -0,0 +1 @@ +Calibrate SNAP participants to the FNS FY2024 average monthly persons, by state and nationally: the SNAP-unit members (people not excluded by `is_snap_excluded_member`) of SPM units with positive annual `snap`, the same units the household target counts (#1843). diff --git a/docs/evidence/spec-engine/us-f0-coverage.json b/docs/evidence/spec-engine/us-f0-coverage.json index c2012101c2..fc6c7843ef 100644 --- a/docs/evidence/spec-engine/us-f0-coverage.json +++ b/docs/evidence/spec-engine/us-f0-coverage.json @@ -4,7 +4,7 @@ "version": 1 }, "country": "us", - "documentation_sha256": "77ae286cf472d734a5a47ce3dcc33485193967d587e4b16e17cbe6dec1dbd306", + "documentation_sha256": "3ee49ad39540d4baa897840ae907b61352d43cb033f11abad231d4529865703f", "field_usage": { "authored_normative_field_count": 32813, "claim_count": 49, @@ -1361,12 +1361,12 @@ ], "expected": { "producer_count": 38, - "sha256": "e4b5e58718889522991895b3162de386f900b066536b95f6dbd5250922520695" + "sha256": "d30381040faf17ad521709aab4403d1ba7a7455c346cc6f97461f270bd6027e2" }, "failures": [], "observed": { "producer_count": 38, - "sha256": "e4b5e58718889522991895b3162de386f900b066536b95f6dbd5250922520695" + "sha256": "d30381040faf17ad521709aab4403d1ba7a7455c346cc6f97461f270bd6027e2" }, "status": "covered" }, @@ -1656,13 +1656,13 @@ "compiler_ir.node_slices" ], "expected": { - "map_sha256": "a8afcddb1a4f694044de7234764bd7e13d5e37bdd204b8dbc695861d0cc9eb24", - "protocol_sha256": "56eaa3e324802025fc2742bdcd53f9060f73b9ea93b94094b9905eb4b60f80d5" + "map_sha256": "41f4690cee9ea0388e52c0dc530f54ef85522ee2e5b5775b8c53614a836f97a8", + "protocol_sha256": "deaf3c80b54d1fa8929c8e6d04a95dbca0a6cae0534adcbfec083ef2dc6f48cc" }, "failures": [], "observed": { - "map_sha256": "a8afcddb1a4f694044de7234764bd7e13d5e37bdd204b8dbc695861d0cc9eb24", - "protocol_sha256": "56eaa3e324802025fc2742bdcd53f9060f73b9ea93b94094b9905eb4b60f80d5" + "map_sha256": "41f4690cee9ea0388e52c0dc530f54ef85522ee2e5b5775b8c53614a836f97a8", + "protocol_sha256": "deaf3c80b54d1fa8929c8e6d04a95dbca0a6cae0534adcbfec083ef2dc6f48cc" }, "status": "covered" }, @@ -1677,7 +1677,7 @@ "compiler_ir.seed_stream_map" ], "expected": { - "implementation_sha256": "56eaa3e324802025fc2742bdcd53f9060f73b9ea93b94094b9905eb4b60f80d5", + "implementation_sha256": "deaf3c80b54d1fa8929c8e6d04a95dbca0a6cae0534adcbfec083ef2dc6f48cc", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1698,7 +1698,7 @@ }, "failures": [], "observed": { - "implementation_sha256": "56eaa3e324802025fc2742bdcd53f9060f73b9ea93b94094b9905eb4b60f80d5", + "implementation_sha256": "deaf3c80b54d1fa8929c8e6d04a95dbca0a6cae0534adcbfec083ef2dc6f48cc", "protocol": "legacy-v1", "streams": [ "build_model", @@ -1775,12 +1775,12 @@ "legacy_adapter.imputation.late_producer_resource_semantics" ], "expected": { - "sha256": "43e50ea47dcd50e37474d2c162d7cbd19830e0d9bd4476f58cdd22d6bb6f172e", + "sha256": "dd09c324a44194e2e9c42312ee7c87352a4b449dddcd32ea3168908479fb6420", "stages": 38 }, "failures": [], "observed": { - "sha256": "43e50ea47dcd50e37474d2c162d7cbd19830e0d9bd4476f58cdd22d6bb6f172e", + "sha256": "dd09c324a44194e2e9c42312ee7c87352a4b449dddcd32ea3168908479fb6420", "stages": 38 }, "status": "covered" @@ -1887,7 +1887,7 @@ "alpha", "zeta" ], - "sha256": "3f7c45210d9bc80faa427cbe764bfecf858d091cdb0e4bf46bdfd89467e0dd28" + "sha256": "bbf9666b20a644caf868d25664e74f32e64b07d6b6215f219d3a46d51c4aef12" }, "failures": [], "observed": { @@ -1911,7 +1911,7 @@ "alpha", "zeta" ], - "sha256": "3f7c45210d9bc80faa427cbe764bfecf858d091cdb0e4bf46bdfd89467e0dd28" + "sha256": "bbf9666b20a644caf868d25664e74f32e64b07d6b6215f219d3a46d51c4aef12" }, "status": "covered" }, @@ -1975,7 +1975,7 @@ "take_up_contract", "us_qbi_reconciliation_contract" ], - "sha256": "457340a19c0a6d9351fd09ef848d7f83d765b89ac5679ae3f00080241bd25e01" + "sha256": "514e35f13f2c7fbb14c41161490dec71a4feca165acf7aa38ad2c31ef976a030" }, "status": "covered" }, @@ -2687,7 +2687,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "523f8f95eebbe1fb40c4bd82ebae9ebba14064563ce88c11ef12214ac32b24da" + "spec_sha256": "a7f07347551e35d11207e87f488bb18ef6c8a0a9c64f3fb3db1aaa2dd6bc60eb" } }, "report_schema_version": 3, @@ -2697,7 +2697,7 @@ "country": "us", "schema_id": "country_spec", "schema_version": 1, - "spec_sha256": "523f8f95eebbe1fb40c4bd82ebae9ebba14064563ce88c11ef12214ac32b24da" + "spec_sha256": "a7f07347551e35d11207e87f488bb18ef6c8a0a9c64f3fb3db1aaa2dd6bc60eb" }, "status": "pass" } diff --git a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py index be95d296ed..47f3e09b79 100644 --- a/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py +++ b/packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py @@ -362,12 +362,12 @@ "acs_person_predictors": "878c788a6f037d7aca12b3586ea034eff04f3034ffa11935a736493042551f25", "authority": "51082a05e7ff8d2c901a9c0de54fdee7378f241cb377a9c0ddeeb12b1fc2db69", "early_families": "4aa9f736fd76e83955477ad1667e58f48f264783f05bdc7f0102cd32d61323bd", - "full_checkpoint": '3f7c45210d9bc80faa427cbe764bfecf858d091cdb0e4bf46bdfd89467e0dd28', + "full_checkpoint": 'bbf9666b20a644caf868d25664e74f32e64b07d6b6215f219d3a46d51c4aef12', "gap_fill_schedule": "1c31f9868f7884347cc19cf1ff65da43f950b9114941a715bab168246db414a7", - "graph_nodes": '3c19bfdd4c690aec1e6dd1438c55675bff13f0a099f4db2f89f42d69e51adb87', + "graph_nodes": "3c19bfdd4c690aec1e6dd1438c55675bff13f0a099f4db2f89f42d69e51adb87", "geography_assignment": "44e7f5f6cd7ceeef85d532c3d46306d03de4f4ee811376e6d29920742746b65c", "late_families": "69134b2aece677e1e71d98f423f2c92e5a82380aa7ebf4d415ffba9142d0e31e", - "late_resource_semantics": 'e4b5e58718889522991895b3162de386f900b066536b95f6dbd5250922520695', + "late_resource_semantics": 'd30381040faf17ad521709aab4403d1ba7a7455c346cc6f97461f270bd6027e2', "late_schedule": "c9225891a5ce3522460d805ea047b96082f3befb704e4b8e886d27a4b73ea889", "ownership": "5f64f0aac49e2313177564f71876bffc8c81b3ded4df701e70930e60e9c98356", "primary_tuples": "dbb5314f85727d4734a37b5e2de9d775a3044e362a18d831521460e1d261ac98", @@ -438,11 +438,11 @@ # Pinning the SCF 2022 reissue and caching SCF members by digest move both # again: scf_wealth's and scf_auto_loans' attested bytes change; no draw # does. - "seed_map": 'a8afcddb1a4f694044de7234764bd7e13d5e37bdd204b8dbc695861d0cc9eb24', - "seed_protocol": '56eaa3e324802025fc2742bdcd53f9060f73b9ea93b94094b9905eb4b60f80d5', - "source_manifest": '43e50ea47dcd50e37474d2c162d7cbd19830e0d9bd4476f58cdd22d6bb6f172e', - "take_up": 'ca44532ca9e93e169e07acfd35d57efbacc1297b07006c4e546e05802efc420c', - "tail": 'f7f8282d48dbf1e01016cd551f5a0de289911140048d20812c920ace0d092936', + "seed_map": '41f4690cee9ea0388e52c0dc530f54ef85522ee2e5b5775b8c53614a836f97a8', + "seed_protocol": 'deaf3c80b54d1fa8929c8e6d04a95dbca0a6cae0534adcbfec083ef2dc6f48cc', + "source_manifest": 'dd09c324a44194e2e9c42312ee7c87352a4b449dddcd32ea3168908479fb6420', + "take_up": "ca44532ca9e93e169e07acfd35d57efbacc1297b07006c4e546e05802efc420c", + "tail": "f7f8282d48dbf1e01016cd551f5a0de289911140048d20812c920ace0d092936", } INVENTORY_REPORT_SCHEMA_VERSION = 1 diff --git a/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json b/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json index aee4995f64..5da9983ea8 100644 --- a/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json +++ b/packages/microcosm-build/src/microcosm/build/us/fiscal_target_registers.json @@ -1366,11 +1366,39 @@ "units vs the 22.20M FY2024 FNS national average (-1.4%) with no", "calibration pressure on counts.", "", - "average_monthly_persons is deliberately NOT mapped: the real SNAP", - "assistance unit is often a subset of the SPM unit (FY2024 FNS persons", - "per household is 1.88 vs 2.82 members per simulated taker unit), and", - "PolicyEngine-US does not model sub-unit participation, so a person", - "indicator overcounts by ~50% and would fight the household target." + "average_monthly_persons counts the members of these same units", + "(the entry below), so the two targets share one unit definition." + ] + }, + { + "source": "usda_snap", + "measure_id": "average_monthly_persons", + "base_variables": "is_snap_excluded_member", + "family": "usda_snap", + "metadata": { + "target_role": "snap_persons", + "fact_aggregation": "time_mean", + "measure_mode": "less_than_indicator_sum", + "indicator_less_than": "1.0", + "indicator_map_to": "person", + "indicator_filter_variable": "snap" + }, + "note": [ + "FNS average monthly persons (microcosm#1843). The count is the", + "people in SPM units with positive annual snap who are not excluded", + "from the SNAP unit (is_snap_excluded_member false: ineligible", + "students, ineligible immigrants, people failing the work", + "requirements), which is the sum of snap_unit_size over the units", + "the household target counts. snap is projected to person grain", + "(indicator_map_to), the pattern of the CMS APTC rows.", + "", + "PolicyEngine-US does not split an SPM unit into several SNAP", + "households, so where FNS counts adults sharing a home as separate", + "households the target is met by weight on small SPM units instead.", + "Before this target, the 27 November 2026 build had 2.53 SNAP-unit", + "members per recipient unit in January 2026 against 1.88 FNS persons", + "per household in FY2024; most of that gap is households with", + "children, which SNAP cannot split." ] }, { diff --git a/packages/microcosm-build/src/microcosm/build/us/source_stages.json b/packages/microcosm-build/src/microcosm/build/us/source_stages.json index 19593dcf09..7a7adc8e45 100644 --- a/packages/microcosm-build/src/microcosm/build/us/source_stages.json +++ b/packages/microcosm-build/src/microcosm/build/us/source_stages.json @@ -2307,7 +2307,7 @@ "outputs": [ "takes_up_snap_if_eligible" ], - "notes": "Anchored count-calibration to FNS state caseloads (microcosm #372), following the medicaid_take_up pattern at SPM-unit grain. Reported recipients always take up; the fill draws at an in-build state rate (FNS average-monthly household count over weighted modeled-eligible units, an assignment prior, never cited as provenance) and is greedily calibrated to the FNS FY2024 state counts among eligible non-anchored units. Caseload semantics are fiscal-year average-monthly stocks - the same rows the snap_households weight-calibration targets compile from, so the seed and the calibration objective agree. CPS receipt underreporting is strongly state-dependent, so the national snap_take_up fill leaves the worst-underreporting states short of taker households no reweighting can recover. The assign operation deliberately carries no eligibility mask: off-domain units keep a draw-based propensity so eligibility-expanding reforms do not inherit a hard-coded zero response. States whose FNS count meets or exceeds modeled eligible weight saturate (all eligible units take up) and are recorded as saturated in diagnostics, not failed. Persons caseloads are deliberately untargeted: the SNAP assistance unit is often a subset of the SPM unit, so member counts overcount FNS participants by roughly half." + "notes": "Anchored count-calibration to FNS state caseloads (microcosm #372), following the medicaid_take_up pattern at SPM-unit grain. Reported recipients always take up; the fill draws at an in-build state rate (FNS average-monthly household count over weighted modeled-eligible units, an assignment prior, never cited as provenance) and is greedily calibrated to the FNS FY2024 state counts among eligible non-anchored units. Caseload semantics are fiscal-year average-monthly stocks - the same rows the snap_households weight-calibration targets compile from, so the seed and the calibration objective agree. CPS receipt underreporting is strongly state-dependent, so the national snap_take_up fill leaves the worst-underreporting states short of taker households no reweighting can recover. The assign operation deliberately carries no eligibility mask: off-domain units keep a draw-based propensity so eligibility-expanding reforms do not inherit a hard-coded zero response. States whose FNS count meets or exceeds modeled eligible weight saturate (all eligible units take up) and are recorded as saturated in diagnostics, not failed. The stage fills to household counts only; FNS average monthly persons is a weight-calibration target (snap_persons, microcosm #1843) over the SNAP-unit members of these units, so it moves weight between taker units rather than choosing them." }, { "stage": "relationship_inputs", diff --git a/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml b/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml index 7716ba025d..b0af20fb0f 100644 --- a/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml +++ b/packages/microcosm-build/src/microcosm/build/us/spec/sources.yaml @@ -99,7 +99,7 @@ sources: stage_asset: id: source_stages path: microcosm.build.us/source_stages.json - sha256: ab7eda8ea9615bb272d5f4f8c8d5594f3ab1a4e2c4c51b8f3a4a24ed6e4b296e + sha256: 172300e085e7a977c38a02f00ba83acb03d6aee98fccdf48b77d9c67a01082bf stage_manifest: version: 1 country: us @@ -2385,8 +2385,9 @@ stages: deliberately carries no eligibility mask: off-domain units keep a draw-based propensity so eligibility-expanding reforms do not inherit a hard-coded zero response. States whose FNS count meets or exceeds modeled eligible weight saturate (all eligible units take up) and are recorded as saturated in diagnostics, - not failed. Persons caseloads are deliberately untargeted: the SNAP assistance unit is often a subset - of the SPM unit, so member counts overcount FNS participants by roughly half.' + not failed. The stage fills to household counts only; FNS average monthly persons is a weight-calibration + target (snap_persons, microcosm #1843) over the SNAP-unit members of these units, so it moves weight + between taker units rather than choosing them.' - stage: relationship_inputs survey: Census CPS ASEC source: https://www.census.gov/programs-surveys/cps.html diff --git a/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json b/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json index 8df9fec8c5..d83560080b 100644 --- a/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json +++ b/packages/microcosm-build/src/microcosm/build/us/target_parity_manifest.json @@ -8,8 +8,8 @@ "us_data_source": "retired us-data pipeline (archived): utils/loss.py (eCPS loss matrix), db/etl_national_targets.py, db/etl_*.py, utils/national_target_parity.py", "family_granularity": "namespace.concept of the ledger source_record_id (us_target_family_id)", "governing_rule": "us-data-targeted => compiled unless source-absent; every reviewed exclusion carries a Chesterton's-fence {origin, purpose, verdict_basis}", - "compiled_families": "32", - "reviewed_exclusions": "64" + "compiled_families": "34", + "reviewed_exclusions": "62" }, "families": { "bea_nipa.business_current_transfer_receipts": { @@ -772,15 +772,7 @@ "status": "compiled" }, "usda_snap.national_average_monthly_persons": { - "status": "reviewed_exclusion", - "classification": "not_modeled", - "reason": "USDA FNS SNAP average-monthly PERSONS. A person indicator overcounts FNS participants ~50% (FY2024 persons-per-household 1.88 vs 2.82 simulated members); the household caseload is the calibrated count.", - "evidence": "INDICATOR_LEDGER_TARGETS average_monthly_households comment + test_snap_person_caseload_fact_is_not_compiled", - "fence": { - "origin": "not a us-data calibration target as a persons row: us-data calibrates SNAP dollars (CBO_PROGRAMS 'snap'), and the household caseload (usda_snap.*_average_monthly_households) is compiled.", - "purpose": "n/a \u2014 the household caseload is the model counterpart, not persons.", - "verdict_basis": "not_modeled: PolicyEngine-US does not model sub-unit SNAP participation, so a person indicator overcounts ~50% vs the compiled household caseload." - } + "status": "compiled" }, "usda_snap.national_benefits": { "status": "compiled" @@ -789,15 +781,7 @@ "status": "compiled" }, "usda_snap.state_average_monthly_persons": { - "status": "reviewed_exclusion", - "classification": "not_modeled", - "reason": "USDA FNS SNAP average-monthly PERSONS. A person indicator overcounts FNS participants ~50% (FY2024 persons-per-household 1.88 vs 2.82 simulated members); the household caseload is the calibrated count.", - "evidence": "INDICATOR_LEDGER_TARGETS average_monthly_households comment + test_snap_person_caseload_fact_is_not_compiled", - "fence": { - "origin": "not a us-data calibration target as a persons row: us-data calibrates SNAP dollars (CBO_PROGRAMS 'snap'), and the household caseload (usda_snap.*_average_monthly_households) is compiled.", - "purpose": "n/a \u2014 the household caseload is the model counterpart, not persons.", - "verdict_basis": "not_modeled: PolicyEngine-US does not model sub-unit SNAP participation, so a person indicator overcounts ~50% vs the compiled household caseload." - } + "status": "compiled" }, "usda_snap.state_benefits": { "status": "compiled" diff --git a/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py b/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py index 64bd0d3899..3169a23786 100644 --- a/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py +++ b/packages/microcosm-build/src/microcosm/build/us_runtime/snap_state_take_up.py @@ -28,9 +28,10 @@ are the FNS ``average_monthly_households`` facts (the same rows the ``snap_households`` calibration targets compile from), and the taker set is the model counterpart of the average monthly caseload — the take-up flag -carries no within-year churn. Persons targets are deliberately absent: the -real SNAP assistance unit is often a subset of the SPM unit, so a person -count over taker-unit members overcounts FNS participants by roughly half. +carries no within-year churn. The stage fills to household counts only. +FNS average monthly persons is a weight-calibration target (``snap_persons``, +microcosm#1843) over the SNAP-unit members of these units, so it moves weight +between taker units rather than choosing them. Two deliberate carry-overs from the Medicaid stage: diff --git a/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py b/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py index 2f824c52c2..26ed7b5827 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_release_target_parity.py @@ -322,9 +322,11 @@ def test_manifest_header_counts_match_parsed_families(self) -> None: assert int(manifest.reference["reviewed_exclusions"]) == len( manifest.reviewed_exclusions ) - assert len(manifest.compiled_families) == 32 - # 53, plus the 11 ed_fsa families of the 41b2fb2b feed (microcosm#1074). - assert len(manifest.reviewed_exclusions) == 64 + # 32, plus the two FNS persons families (microcosm#1843). + assert len(manifest.compiled_families) == 34 + # 53, plus the 11 ed_fsa families of the 41b2fb2b feed (microcosm#1074), + # less the two FNS persons families now compiled (microcosm#1843). + assert len(manifest.reviewed_exclusions) == 62 def test_wired_nipa_and_liheap_families_are_compiled(self) -> None: manifest = load_target_parity_manifest() diff --git a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py index 1b9a83434c..314cb6b747 100644 --- a/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py +++ b/packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py @@ -49,7 +49,7 @@ def test_semantic_hash_has_golden_vector_and_surface_separation(tmp_path) -> Non # Pinning the SCF 2022 reissue and caching SCF members by digest moves it # again. assert first.spec_sha256 == ( - 'fec2cdf3774d1fe1883696c84bc61dd5ba24f55711063f00943d3f3ffbb7e17b' + '2526c713557b60385a6414dbbdea251d75cbc7cc6b64fcd65817b51a5b95612b' ) second_root = _rich_minimal(tmp_path / "xy", note="second", store="local:b") diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py b/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py index 2e17ff53e6..c7da3b6c47 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_bundle_core_contracts.py @@ -25,7 +25,7 @@ def test_source_surface_classification_is_complete() -> None: } assert normative["stage_asset"] == { "id": "source_stages", - "sha256": "ab7eda8ea9615bb272d5f4f8c8d5594f3ab1a4e2c4c51b8f3a4a24ed6e4b296e", + "sha256": "172300e085e7a977c38a02f00ba83acb03d6aee98fccdf48b77d9c67a01082bf", } assert operational["stage_asset"] == { "path": "microcosm.build.us/source_stages.json" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py index d4fffa147c..dde890a4fe 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_feed.py @@ -212,8 +212,9 @@ def test_parity_resources_and_generator_restate_the_pin() -> None: assert feed_families["feed"] == generator.DEFAULT_FEED_NAME assert manifest["reference"]["feed"] == generator.DEFAULT_FEED_NAME assert generator.DEFAULT_FEED_PATH.name == generator.DEFAULT_FEED_NAME - assert manifest["reference"]["compiled_families"] == "32" - assert manifest["reference"]["reviewed_exclusions"] == "64" + # The two FNS persons families compile since microcosm#1843. + assert manifest["reference"]["compiled_families"] == "34" + assert manifest["reference"]["reviewed_exclusions"] == "62" #: The dimension values the pinned feed labels more than one way, as the diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py index f2fafc8ca7..3f7f6976cc 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_target_registers.py @@ -48,7 +48,7 @@ "c991f34caf1e9bde876777a2785f42f736b0331013ce0a72c4e25c627863e9e5" ), ("fiscal_targets", "INDICATOR_LEDGER_TARGETS"): ( - "dbe04076e64d03cd561a0ce2087db3d36e87e93d7f7b1405633d23267e098d49" + "ab6b82de7a44ac9d41eedcd3521fffb59452d548fe50e3f0c00db40ceb22bf7e" ), ("fiscal_targets", "US_FISCAL_TARGET_SUPPORT_EXCLUSIONS"): ( "0557e4028686d83baffb643546ce607f3ccdad925fdd3069d20461fac4ef45ac" diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py index a38e8f2b61..cd37bc257c 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_fiscal_targets.py @@ -2404,11 +2404,10 @@ def test_state_snap_household_caseload_fact_compiles_with_state_fips() -> None: assert spec.metadata["state_fips"] == "36" -def test_snap_person_caseload_fact_is_not_compiled() -> None: - # The SNAP assistance unit is often a subset of the SPM unit, so a person - # indicator over taker-unit members overcounts FNS participants by ~50%. - # The persons measure must stay unmapped until sub-unit participation is - # modeled. +def test_snap_person_caseload_fact_counts_snap_unit_members() -> None: + # microcosm#1843: FNS average monthly persons counts the people in SPM + # units with positive annual snap who are not excluded from the SNAP + # unit, so the persons target shares the household target's units. registry = compile_us_fiscal_target_registry( [ *packaged_reference_facts(), @@ -2421,9 +2420,59 @@ def test_snap_person_caseload_fact_is_not_compiled() -> None: ] ) - assert not [ - spec for spec in registry.specs if "average_monthly_persons" in spec.name + specs = [spec for spec in registry.specs if "average_monthly_persons" in spec.name] + assert len(specs) == 1 + spec = specs[0] + assert spec.family == "usda_snap" + assert spec.value == 41_690_000 + assert spec.metadata["target_role"] == "snap_persons" + assert spec.metadata["base_variable"] == "is_snap_excluded_member" + assert spec.metadata["measure_mode"] == "less_than_indicator_sum" + assert spec.metadata["indicator_less_than"] == "1.0" + assert spec.metadata["indicator_map_to"] == "person" + assert spec.metadata["indicator_filter_variable"] == "snap" + assert "state_fips" not in spec.metadata + + +def test_state_snap_person_caseload_fact_compiles_with_state_fips() -> None: + registry = compile_us_fiscal_target_registry( + [ + *packaged_reference_facts(), + _usda_snap_caseload_fact( + measure_id="average_monthly_persons", + value=2_890_000, + record_set_slug="state_average_monthly_persons.nero", + value_id="ny", + geography_level="state", + geography_id="0400000US36", + entity_name="person", + ), + _usda_snap_caseload_fact( + measure_id="average_monthly_households", + value=1_507_000, + record_set_slug="state_average_monthly_households.nero", + value_id="ny", + geography_level="state", + geography_id="0400000US36", + ), + ] + ) + + specs = {spec.name: spec for spec in registry.specs} + persons = specs[ + "usda_snap.fy2024.state_average_monthly_persons.nero.ny.average_monthly_persons" + ] + households = specs[ + "usda_snap.fy2024.state_average_monthly_households.nero.ny" + ".average_monthly_households" ] + assert persons.value == 2_890_000 + assert persons.metadata["target_role"] == "snap_persons" + assert persons.metadata["state_fips"] == "36" + # Both rows compile: distinct roles and measures keep them from + # collapsing into one model target. + assert households.metadata["target_role"] == "snap_households" + assert households.metadata["state_fips"] == "36" def test_ssa_ssi_recipients_national_fact_is_a_nonbinding_reference() -> None: diff --git a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py index cd6695cb4f..609892f8f9 100644 --- a/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py +++ b/packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py @@ -381,7 +381,7 @@ def capture_equality(expected: object, actual: object) -> None: # Merging the policyengine-us 2.145.3 engine refresh (#1676) moves it again. # microcosm#1728's three declared US resources (target sets, local # target construction and compile registers) move it again. - "spec_sha256": '523f8f95eebbe1fb40c4bd82ebae9ebba14064563ce88c11ef12214ac32b24da', + "spec_sha256": 'a7f07347551e35d11207e87f488bb18ef6c8a0a9c64f3fb3db1aaa2dd6bc60eb', }, } diff --git a/test_support/microcosm_build/us_spec_bundle.py b/test_support/microcosm_build/us_spec_bundle.py index c566ffa424..2d590af840 100644 --- a/test_support/microcosm_build/us_spec_bundle.py +++ b/test_support/microcosm_build/us_spec_bundle.py @@ -199,7 +199,7 @@ def _load_generator_module(): LEGACY_COMPATIBILITY_SHA256 = { "source_stages.json": ( - "ab7eda8ea9615bb272d5f4f8c8d5594f3ab1a4e2c4c51b8f3a4a24ed6e4b296e" + "172300e085e7a977c38a02f00ba83acb03d6aee98fccdf48b77d9c67a01082bf" ), "support_spine.json": ( "68f37dc6ae6e0cde7ebccb53f88dd4a800e63456f838fa214ff98d1db8d815be" diff --git a/tools/build_us_acs_local_release.py b/tools/build_us_acs_local_release.py index c2a4953a7e..06555052da 100644 --- a/tools/build_us_acs_local_release.py +++ b/tools/build_us_acs_local_release.py @@ -7594,7 +7594,9 @@ def do_finalize(args) -> None: key = "population_state" elif name.startswith("pop_cd"): key = "population_cd" - elif name.startswith("usda_snap") and "average_monthly_households" in name: + elif name.startswith("usda_snap") and ( + "average_monthly_households" in name or "average_monthly_persons" in name + ): key = "snap_caseloads" elif name.startswith("usda_snap"): key = "snap_benefits" diff --git a/tools/build_us_target_parity_manifest.py b/tools/build_us_target_parity_manifest.py index d7c200255b..fbcf3660aa 100644 --- a/tools/build_us_target_parity_manifest.py +++ b/tools/build_us_target_parity_manifest.py @@ -210,28 +210,6 @@ def _fence(origin: str, purpose: str, verdict_basis: str) -> dict[str, str]: ), ) -_SNAP_PERSONS_EXCLUSION = ( - "not_modeled", - "USDA FNS SNAP average-monthly PERSONS. A person indicator overcounts FNS " - "participants ~50% (FY2024 persons-per-household 1.88 vs 2.82 simulated " - "members); the household caseload is the calibrated count.", - "INDICATOR_LEDGER_TARGETS average_monthly_households comment + " - "test_snap_person_caseload_fact_is_not_compiled", - _fence( - origin=( - "not a us-data calibration target as a persons row: us-data " - "calibrates SNAP dollars (CBO_PROGRAMS 'snap'), and the household " - "caseload (usda_snap.*_average_monthly_households) is compiled." - ), - purpose="n/a — the household caseload is the model counterpart, not persons.", - verdict_basis=( - "not_modeled: PolicyEngine-US does not model sub-unit SNAP " - "participation, so a person indicator overcounts ~50% vs the compiled " - "household caseload." - ), - ), -) - # (classification, reason, evidence, fence) keyed by exact family id. _JCT_OBBBA_NO_TAX_ANCHOR_EXCLUSION = ( "deferred", @@ -646,8 +624,6 @@ def _fence(origin: str, purpose: str, verdict_basis: str) -> dict[str, str]: ), ), ), - "usda_snap.national_average_monthly_persons": _SNAP_PERSONS_EXCLUSION, - "usda_snap.state_average_monthly_persons": _SNAP_PERSONS_EXCLUSION, } #: Keyed by vintage-free family id, so a repin to the next IRS diff --git a/tools/generate_us_bundle_from_constants.py b/tools/generate_us_bundle_from_constants.py index 1d6c169c67..d6fff9722a 100644 --- a/tools/generate_us_bundle_from_constants.py +++ b/tools/generate_us_bundle_from_constants.py @@ -130,7 +130,7 @@ def _domain_builders() -> dict[str, Callable[[], object]]: # frozen files, is the forward YAML -> legacy-payload path. FROZEN_LEGACY_RESOURCE_SHA256 = { "source_stages.json": ( - "ab7eda8ea9615bb272d5f4f8c8d5594f3ab1a4e2c4c51b8f3a4a24ed6e4b296e" + "172300e085e7a977c38a02f00ba83acb03d6aee98fccdf48b77d9c67a01082bf" ), "support_spine.json": ( "68f37dc6ae6e0cde7ebccb53f88dd4a800e63456f838fa214ff98d1db8d815be"