diff --git a/changelog.d/fix-school-meals-head-start-enrollment.fixed.md b/changelog.d/fix-school-meals-head-start-enrollment.fixed.md new file mode 100644 index 00000000000..5ef69675c16 --- /dev/null +++ b/changelog.d/fix-school-meals-head-start-enrollment.fixed.md @@ -0,0 +1 @@ +Limited Head Start, foster care, migrant, runaway and child-level homeless school-meal eligibility to each qualifying child, and required Head Start enrollment. Counted current foster care from October 2010 in place of past foster care, and added an is_homeless_child input and a child_categorical_eligibility parameter list. diff --git a/policyengine_us/parameters/gov/usda/school_meals/categorical_eligibility.yaml b/policyengine_us/parameters/gov/usda/school_meals/categorical_eligibility.yaml index 4b84f6d69aa..a998d2ca0b4 100644 --- a/policyengine_us/parameters/gov/usda/school_meals/categorical_eligibility.yaml +++ b/policyengine_us/parameters/gov/usda/school_meals/categorical_eligibility.yaml @@ -1,4 +1,4 @@ -description: Program participation that qualifies families for free school meals. +description: USDA extends free school meals to every child in a family that receives one of these benefits or whose household lacks a fixed nighttime residence. values: 2009-09-01: @@ -7,11 +7,10 @@ values: - tanf # Temporary Assistance to Needy Families. Currently only available in CA and IL. - receives_tanf # Reported TANF receipt, for households the model gives a $0 benefit. - fdpir # Food Distribution Program on Indian Reservations. - - was_in_foster_care + # Congress defines a homeless child as one who lacks a fixed, regular and + # adequate nighttime residence (42 U.S.C. 11434a(2)(A)), so each child in + # a household that lacks one qualifies under 42 U.S.C. 1758(b)(12)(A)(iv). - is_homeless - - is_runaway_child - - is_migratory_child - - is_head_start_eligible metadata: unit: list @@ -19,6 +18,10 @@ metadata: label: Free school meals qualifying programs reference: - title: 7 CFR § 245.2 - Definitions - href: https://www.law.cornell.edu/cfr/text/7/245.2 - - title: 42 U.S. Code § 1758 - Program requirements - href: https://www.law.cornell.edu/uscode/text/42/1758#b_5 + href: https://www.ecfr.gov/current/title-7/section-245.2 + - title: 7 CFR § 245.6(b)(7)-(8) - Household and child categorical eligibility + href: https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(7) + - title: 42 U.S.C. 1758(b)(12)(A) - Categorical eligibility for free meals + href: https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A + - title: 42 U.S.C. 11434a(2) - Homeless children and youths + href: https://uscode.house.gov/us/usc/119-124/t42/s11434a/#2 diff --git a/policyengine_us/parameters/gov/usda/school_meals/child_categorical_eligibility.yaml b/policyengine_us/parameters/gov/usda/school_meals/child_categorical_eligibility.yaml new file mode 100644 index 00000000000..9d44af59c3a --- /dev/null +++ b/policyengine_us/parameters/gov/usda/school_meals/child_categorical_eligibility.yaml @@ -0,0 +1,31 @@ +description: USDA extends free school meals to a child who meets one of these conditions, without extending them to other children in the household. + +values: + # Clauses (iii) to (vi) predate this list's first date: Congress added + # clauses (iv) to (vi) in Pub. L. 108-265, section 107(a), effective + # July 1, 2004. + 2009-09-01: + - is_enrolled_in_head_start # 42 U.S.C. 1758(b)(12)(A)(iii). + - is_homeless_child # 42 U.S.C. 1758(b)(12)(A)(iv). + - is_runaway_child # 42 U.S.C. 1758(b)(12)(A)(v). + - is_migratory_child # 42 U.S.C. 1758(b)(12)(A)(vi). + # Congress added clause (vii) for foster children in Pub. L. 111-296, + # section 102(b), effective October 1, 2010 under section 445. + 2010-10-01: + - is_enrolled_in_head_start # 42 U.S.C. 1758(b)(12)(A)(iii). + - is_homeless_child # 42 U.S.C. 1758(b)(12)(A)(iv). + - is_runaway_child # 42 U.S.C. 1758(b)(12)(A)(v). + - is_migratory_child # 42 U.S.C. 1758(b)(12)(A)(vi). + - is_in_foster_care # 42 U.S.C. 1758(b)(12)(A)(vii). + +metadata: + unit: list + period: year + label: Free school meals child-specific categories + reference: + - title: 42 U.S.C. 1758(b)(12)(A) - Categorical eligibility for free meals + href: https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A + - title: 7 CFR § 245.6(b)(8) - Child-specific categorical eligibility + href: https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(8) + - title: "Pub. L. 111-296, sections 102(b) and 445 #page 5-6,84" + href: https://www.govinfo.gov/content/pkg/PLAW-111publ296/pdf/PLAW-111publ296.pdf#page=5 diff --git a/policyengine_us/tests/core/test_school_meal_categorical_eligibility_invariants.py b/policyengine_us/tests/core/test_school_meal_categorical_eligibility_invariants.py new file mode 100644 index 00000000000..a5e7e240160 --- /dev/null +++ b/policyengine_us/tests/core/test_school_meal_categorical_eligibility_invariants.py @@ -0,0 +1,488 @@ +"""Check categorical eligibility across generated sibling configurations. + +Each draw runs independent SPM units together, reusing one read-only system. +We vary siblings, income tiers, enrollment, K-12 attendance and receipt months. +The paired units hold their poverty ratios and poverty guidelines fixed +when a child joins them. An explicit example covers every state and DC. +With computed common tiers, household categories give every child free meals. +The last test reads each child's own category from a six-person +Microsimulation, which the YAML runner cannot build. +""" + +import numpy as np +import pandas as pd +import pytest +from hypothesis import HealthCheck, example, given, settings +from hypothesis import strategies as st + +from policyengine_us import Microsimulation, Simulation +from policyengine_us.data.dataset_schema import USSingleYearDataset + +YEAR = 2025 +MONTHS = tuple(f"{YEAR}-{month:02d}" for month in range(1, 13)) +CHILD_CATEGORIES = ( + "is_enrolled_in_head_start", + "is_in_foster_care", + "is_homeless_child", + "is_runaway_child", + "is_migratory_child", +) +SPM_UNIT_CATEGORIES = ("snap", "receives_snap", "tanf", "receives_tanf", "fdpir") +# Each child in a household without a fixed nighttime residence counts as a +# homeless child (42 USC 11434a(2)(A)), so the household qualifies them all. +HOUSEHOLD_CATEGORIES = (*SPM_UNIT_CATEGORIES, "is_homeless") +POVERTY_RATIOS = (1.0, 1.5, 3.0) +STATES = ( + "AL", + "AK", + "AZ", + "AR", + "CA", + "CO", + "CT", + "DE", + "FL", + "GA", + "HI", + "ID", + "IL", + "IN", + "IA", + "KS", + "KY", + "LA", + "ME", + "MD", + "MA", + "MI", + "MN", + "MS", + "MO", + "MT", + "NE", + "NV", + "NH", + "NJ", + "NM", + "NY", + "NC", + "ND", + "OH", + "OK", + "OR", + "PA", + "RI", + "SC", + "SD", + "TN", + "TX", + "UT", + "VT", + "VA", + "WA", + "WV", + "WI", + "WY", + "DC", +) +# USDA's SY 2024-25 rates apply on January 1, 2025. Lunch uses the +# under-60-percent rate; breakfast uses the non-severe-need rate. +# https://www.govinfo.gov/content/pkg/FR-2024-07-10/pdf/2024-15175.pdf#page=4 +RATES = { + "CONTIGUOUS_US": { + "breakfast": {"FREE": 2.37, "REDUCED": 2.07, "PAID": 0.39}, + "lunch": {"FREE": 4.43, "REDUCED": 4.03, "PAID": 0.42}, + }, + "AK": { + "breakfast": {"FREE": 3.80, "REDUCED": 3.50, "PAID": 0.60}, + "lunch": {"FREE": 7.18, "REDUCED": 6.78, "PAID": 0.69}, + }, + "HI": { + "breakfast": {"FREE": 3.06, "REDUCED": 2.76, "PAID": 0.49}, + "lunch": {"FREE": 5.76, "REDUCED": 5.36, "PAID": 0.55}, + }, +} +SCHOOL_DAYS = 180 +ALL_STATES_EXAMPLE = [ + { + "state": state, + "ages": [8, 15], + "ratio": 1.5, + "month": f"{YEAR}-07", + "amount": 100, + "added_in_k12": True, + } + for state in STATES +] + + +@pytest.fixture(scope="module") +def school_meal_system(): + return Simulation.default_tax_benefit_system_instance + + +@st.composite +def units(draw): + return { + "state": draw(st.sampled_from(STATES)), + "ages": draw(st.lists(st.integers(6, 17), min_size=1, max_size=3)), + "ratio": draw(st.sampled_from(POVERTY_RATIOS)), + "month": draw(st.sampled_from(MONTHS)), + "amount": draw(st.integers(1, 5_000)), + "added_in_k12": draw(st.booleans()), + } + + +def _person(age, in_k12): + return { + "age": {YEAR: age}, + "is_in_k12_school": {YEAR: in_k12}, + "is_head_start_eligible": {YEAR: False}, + "was_in_foster_care": {YEAR: False}, + **{ + name: {YEAR: False} + for name in CHILD_CATEGORIES + if name != "is_in_foster_care" + }, + "is_in_foster_care": dict.fromkeys(MONTHS, False), + } + + +def _situation(drawn_units): + people = {} + groups = {"spm_units": {}, "tax_units": {}, "families": {}, "households": {}} + records = [] + for unit_number, unit in enumerate(drawn_units): + variants = ( + "base", + "added", + *CHILD_CATEGORIES, + *HOUSEHOLD_CATEGORIES, + "is_head_start_eligible", + "was_in_foster_care", + ) + for variant in variants: + prefix = f"unit_{unit_number}_{variant}" + parent = f"{prefix}_parent" + people[parent] = _person(35, False) + members = [parent] + siblings = [] + for index, age in enumerate(unit["ages"]): + child = f"{prefix}_sibling_{index}" + people[child] = _person(age, True) + members.append(child) + siblings.append(child) + added = None + if variant != "base": + added = f"{prefix}_added" + people[added] = _person(5, unit["added_in_k12"]) + members.append(added) + if variant in CHILD_CATEGORIES or variant in ( + "is_head_start_eligible", + "was_in_foster_care", + ): + period = unit["month"] if variant == "is_in_foster_care" else YEAR + people[added][variant][period] = True + spm_unit = { + "members": members, + "school_meal_fpg_ratio": {YEAR: unit["ratio"]}, + "spm_unit_fpg": {YEAR: 10_000}, + "snap": dict.fromkeys(MONTHS, 0), + "tanf": {YEAR: 0}, + "fdpir": {YEAR: 0}, + "receives_snap": dict.fromkeys(MONTHS, False), + "receives_tanf": dict.fromkeys(MONTHS, False), + } + if variant in SPM_UNIT_CATEGORIES: + if variant.startswith("receives_"): + # Core reads December for monthly stock inputs in annual + # calculations. Report receipt throughout the year. + spm_unit[variant] = dict.fromkeys(MONTHS, True) + else: + period = YEAR if variant in ("tanf", "fdpir") else unit["month"] + spm_unit[variant][period] = unit["amount"] + groups["spm_units"][prefix] = spm_unit + groups["tax_units"][prefix] = {"members": members} + groups["families"][prefix] = {"members": members} + groups["households"][prefix] = { + "members": members, + "state_code": {YEAR: unit["state"]}, + "is_homeless": {YEAR: variant == "is_homeless"}, + } + records.append( + { + "unit": unit, + "number": unit_number, + "variant": variant, + "members": members, + "siblings": siblings, + "added": added, + } + ) + return {"people": people, **groups}, records + + +def _check(drawn_units, system): + situation, records = _situation(drawn_units) + simulation = Simulation(situation=situation, tax_benefit_system=system) + person_index = {name: index for index, name in enumerate(situation["people"])} + categorical = np.asarray( + simulation.calculate("is_school_meal_categorically_eligible", YEAR), + dtype=bool, + ) + household_categorical = np.asarray( + simulation.calculate("meets_school_meal_categorical_eligibility", YEAR), + dtype=bool, + ) + tiers = { + meal: simulation.calculate( + f"school_meal_child_{meal}_tier", YEAR + ).decode_to_str() + for meal in ("breakfast", "lunch") + } + # These common SPM-unit tiers retain main's formulas for each state's + # income limits, universal meals and coverage of either meal's copay. + common_tiers = { + meal: simulation.calculate(f"school_meal_{meal}_tier", YEAR).decode_to_str() + for meal in ("breakfast", "lunch") + } + values = { + name: np.asarray(simulation.calculate(name, YEAR), dtype=float) + for name in ( + "school_meal_daily_subsidy", + "school_meal_net_subsidy", + "free_school_meals", + "reduced_price_school_meals", + ) + } + np.testing.assert_allclose( + values["free_school_meals"] + values["reduced_price_school_meals"], + values["school_meal_net_subsidy"], + atol=0.01, + rtol=0, + ) + sibling_results = {} + for index, record in enumerate(records): + unit = record["unit"] + variant = record["variant"] + context = ( + f"{unit['state']} unit={record['number']} variant={variant} " + f"month={unit['month']} ratio={unit['ratio']}" + ) + household = variant in HOUSEHOLD_CATEGORIES + assert household_categorical[index] == household, ( + f"{context}: household eligibility={household_categorical[index]}, " + f"expected={household}" + ) + region = unit["state"] if unit["state"] in ("AK", "HI") else "CONTIGUOUS_US" + rates = RATES[region] + daily_total = 0 + net = free = reduced = 0 + school_children = 0 + for name in record["members"]: + person = person_index[name] + own_category = name == record["added"] and variant in CHILD_CATEGORIES + assert categorical[person] == (household or own_category), ( + f"{context} person={name}: eligibility={categorical[person]}, " + f"expected={household or own_category}" + ) + expected_tiers = { + meal: "FREE" if household or own_category else common_tiers[meal][index] + for meal in tiers + } + for meal in tiers: + assert tiers[meal][person] == expected_tiers[meal], ( + f"{context} person={name} meal={meal}: " + f"tier={tiers[meal][person]}, expected={expected_tiers[meal]}" + ) + if not situation["people"][name]["is_in_k12_school"][YEAR]: + continue + school_children += 1 + for meal, expected_tier in expected_tiers.items(): + daily = rates[meal][expected_tier] + daily_total += daily + # Subtract the paid reimbursement once per child per meal. + annual = (daily - rates[meal]["PAID"]) * SCHOOL_DAYS + net += annual + free += annual if expected_tier == "FREE" else 0 + reduced += annual if expected_tier == "REDUCED" else 0 + expected = { + "school_meal_daily_subsidy": daily_total / school_children, + "school_meal_net_subsidy": net, + "free_school_meals": free, + "reduced_price_school_meals": reduced, + } + for name, amount in expected.items(): + np.testing.assert_allclose( + values[name][index], + amount, + atol=0.01, + rtol=0, + err_msg=context, + ) + siblings = [person_index[name] for name in record["siblings"]] + sibling_results[record["number"], variant] = ( + categorical[siblings], + tiers["breakfast"][siblings], + tiers["lunch"][siblings], + ) + for unit_number in range(len(drawn_units)): + base = sibling_results[unit_number, "base"] + for variant in ( + "added", + *CHILD_CATEGORIES, + "is_head_start_eligible", + "was_in_foster_care", + ): + for before, after in zip(base, sibling_results[unit_number, variant]): + np.testing.assert_array_equal( + before, + after, + err_msg=f"unit={unit_number} variant={variant} sibling invariance", + ) + + +@settings( + max_examples=6, + deadline=None, + derandomize=True, + suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large], +) +@given(drawn_units=st.lists(units(), min_size=1, max_size=3)) +@example(drawn_units=ALL_STATES_EXAMPLE) +def test_school_meal_categorical_eligibility_invariants( + school_meal_system, drawn_units +): + _check(drawn_units, school_meal_system) + + +@settings(max_examples=6, deadline=None, derandomize=True) +@given( + breakfast=st.sampled_from(("FREE", "REDUCED", "PAID")), + lunch=st.sampled_from(("FREE", "REDUCED", "PAID")), +) +@example(breakfast="PAID", lunch="REDUCED") +def test_explicit_common_meal_tier_inputs_preserve_individual_overrides( + school_meal_system, breakfast, lunch +): + # Explicit common tier inputs override the household calculation. + # Individual categories still override those inputs for that child. + situation, records = _situation( + [ + { + "state": "AL", + "ages": [8, 15], + "ratio": 3.0, + "month": f"{YEAR}-07", + "amount": 100, + "added_in_k12": True, + } + ] + ) + common_tiers = {"breakfast": breakfast, "lunch": lunch} + for spm_unit in situation["spm_units"].values(): + spm_unit["meets_school_meal_categorical_eligibility"] = {YEAR: True} + for meal, tier in common_tiers.items(): + spm_unit[f"school_meal_{meal}_tier"] = {YEAR: tier} + simulation = Simulation(situation=situation, tax_benefit_system=school_meal_system) + categorical = np.asarray( + simulation.calculate("is_school_meal_categorically_eligible", YEAR), + dtype=bool, + ) + assert categorical.all() + person_index = {name: index for index, name in enumerate(situation["people"])} + for meal, common_tier in common_tiers.items(): + child_tiers = simulation.calculate( + f"school_meal_child_{meal}_tier", YEAR + ).decode_to_str() + for record in records: + for name in record["members"]: + own_category = ( + name == record["added"] and record["variant"] in CHILD_CATEGORIES + ) + expected = "FREE" if own_category else common_tier + assert child_tiers[person_index[name]] == expected, ( + f"meal={meal} common_tier={common_tier} " + f"variant={record['variant']} person={name}: " + f"tier={child_tiers[person_index[name]]}, expected={expected}" + ) + + +def _three_family_dataset(): + """Three Alabama families, each with one parent and one ten-year-old. + + Head Start enrolls the second family's child for the year. No family + receives SNAP, TANF or FDPIR, and each has income at 300% of the poverty + guideline, so a child without a category pays for meals. + """ + family_ids = np.arange(1, 4) + person_ids = np.arange(1, 7) + family_of = np.repeat(family_ids, 2) + person = pd.DataFrame( + { + "person_id": person_ids, + "person_household_id": family_of, + "person_tax_unit_id": family_of, + "person_spm_unit_id": family_of, + "person_family_id": family_of, + "person_marital_unit_id": person_ids, + "age": np.tile([35.0, 10.0], 3), + "is_enrolled_in_head_start": [False, False, False, True, False, False], + } + ) + spm_unit = pd.DataFrame( + { + "spm_unit_id": family_ids, + "snap": np.zeros(3), + "tanf": np.zeros(3), + "fdpir": np.zeros(3), + "school_meal_fpg_ratio": np.full(3, 3.0), + } + ) + household = pd.DataFrame( + { + "household_id": family_ids, + "state_fips": np.full(3, 1), + "household_weight": np.ones(3), + } + ) + return USSingleYearDataset( + person=person, + household=household, + tax_unit=pd.DataFrame({"tax_unit_id": family_ids}), + spm_unit=spm_unit, + family=pd.DataFrame({"family_id": family_ids}), + marital_unit=pd.DataFrame({"marital_unit_id": person_ids}), + time_period=YEAR, + ) + + +def test_child_categories_qualify_each_child_in_a_microsimulation(): + """A Microsimulation gives each child the result a household simulation gives. + + Core routes a formula's variable calls through Microsimulation's own + methods, and the cases above build household simulations. A foster + placement covers July and no other month for the third family's child, + and an annual read of the monthly input returns December's value. + """ + simulation = Microsimulation(dataset=_three_family_dataset(), dataset_end_year=YEAR) + simulation.set_input( + "is_in_foster_care", + f"{YEAR}-07", + np.array([False, False, False, False, False, True]), + ) + # Core carries the latest earlier monthly input forward, so the test sets + # August to false. + simulation.set_input("is_in_foster_care", f"{YEAR}-08", np.zeros(6, dtype=bool)) + eligible = simulation.calculate("is_school_meal_categorically_eligible", YEAR) + assert np.asarray(eligible).tolist() == [False, False, False, True, False, True] + for meal in ("breakfast", "lunch"): + tiers = simulation.calculate(f"school_meal_child_{meal}_tier", YEAR) + assert np.asarray(tiers).tolist() == [ + "PAID", + "PAID", + "PAID", + "FREE", + "PAID", + "FREE", + ], meal diff --git a/policyengine_us/tests/policy/baseline/gov/usda/school_meals/is_school_meal_categorically_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/usda/school_meals/is_school_meal_categorically_eligible.yaml new file mode 100644 index 00000000000..3fbc5877021 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/usda/school_meals/is_school_meal_categorically_eligible.yaml @@ -0,0 +1,758 @@ +# 42 USC 1758(b)(12)(A)(iii); 7 CFR 245.6(b)(7)-(8): +# Head Start enrollment qualifies that child; SNAP qualifies every child. +# https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(8) +# The income ratio stays fixed to isolate categorical eligibility. +# At 300% FPG, a sibling pays; at 100% FPG, a sibling qualifies by income. +# Calendar 2026 contiguous rates, USDA SY 2025-26: +# https://www.govinfo.gov/content/pkg/FR-2025-07-24/pdf/2025-13879.pdf +# Free value per K12 child = (2.46 + 4.60 - 0.40 - 0.44) * 180 = 1,119.60. +# A four-year-old defaults outside K12, so contributes no school-meal value. +# A five-year-old defaults in K12. Each child counts once in the unit total. +# Mixed free/reduced annual value = 1,119.60 + 993.60 = 2,113.20. +# PolicyEngine's Head Start eligibility counts SSI receipt, but +# 42 USC 1758(b)(12)(A)(iii) qualifies a child only through enrollment. +- name: Head Start enrollment qualifies a preschooler without changing an older sibling. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 4 + is_enrolled_in_head_start: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 0.0 + free_school_meals: 0.0 + reduced_price_school_meals: 0 +- name: Head Start enrollment qualifies only the enrolled school child at high income. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 5 + is_enrolled_in_head_start: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 1119.6 + free_school_meals: 1119.6 + reduced_price_school_meals: 0 +- name: A sibling still gets free meals through the income test. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 5 + is_enrolled_in_head_start: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 1 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - FREE + - FREE + - FREE + school_meal_child_lunch_tier: + - FREE + - FREE + - FREE + school_meal_net_subsidy: 2239.2 + free_school_meals: 2239.2 + reduced_price_school_meals: 0 +- name: SNAP qualifies every child even when only one enrolls in Head Start. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 5 + is_enrolled_in_head_start: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 1 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - true + - true + - true + school_meal_child_breakfast_tier: + - FREE + - FREE + - FREE + school_meal_child_lunch_tier: + - FREE + - FREE + - FREE + school_meal_net_subsidy: 2239.2 + free_school_meals: 2239.2 + reduced_price_school_meals: 0 +- name: SNAP qualifies every child without Head Start enrollment. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + is_enrolled_in_head_start: false + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 1 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - true + - true + - true + school_meal_child_breakfast_tier: + - FREE + - FREE + - FREE + school_meal_child_lunch_tier: + - FREE + - FREE + - FREE + school_meal_net_subsidy: 2239.2 + free_school_meals: 2239.2 + reduced_price_school_meals: 0 +- name: An enrolled child gets free meals while a sibling pays the reduced price. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 5 + is_enrolled_in_head_start: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 1.6 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - REDUCED + - FREE + - REDUCED + school_meal_child_lunch_tier: + - REDUCED + - FREE + - REDUCED + school_meal_net_subsidy: 2113.2 + free_school_meals: 1119.6 + reduced_price_school_meals: 993.6 + school_meal_daily_subsidy: 6.71 +- name: is_in_foster_care qualifies only the child with that status. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + is_in_foster_care: + 2026-12: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 1119.6 + free_school_meals: 1119.6 + reduced_price_school_meals: 0 +# A foster placement covers March 2026 and no other month, and one month of +# is_in_foster_care qualifies the child for the year. Core carries the latest +# earlier monthly input forward, so the case sets April to false. +# Free value = (2.46 + 4.60 - 0.40 - 0.44) * 180 = 6.22 * 180 = 1,119.60. +- name: One month of foster care before December qualifies the child for the year. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + is_in_foster_care: + 2026-03: true + 2026-04: false + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 1119.6 + free_school_meals: 1119.6 + reduced_price_school_meals: 0 +- name: is_homeless_child qualifies only the child with that status. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + is_homeless_child: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 1119.6 + free_school_meals: 1119.6 + reduced_price_school_meals: 0 +- name: is_runaway_child qualifies only the child with that status. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + is_runaway_child: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 1119.6 + free_school_meals: 1119.6 + reduced_price_school_meals: 0 +- name: is_migratory_child qualifies only the child with that status. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + is_migratory_child: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + school_meal_net_subsidy: 1119.6 + free_school_meals: 1119.6 + reduced_price_school_meals: 0 +- name: Modeled Head Start eligibility through SSI does not qualify an unenrolled child. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + employment_income: 60000 + receives_ssi: + 2026-01: true + ssi: 0 + participant: + age: 4 + ssi: 0 + sibling: + age: 10 + ssi: 0 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_head_start_eligible: + - false + - true + - false + is_school_meal_categorically_eligible: + - false + - false + - false + school_meal_child_breakfast_tier: + - PAID + - PAID + - PAID + school_meal_child_lunch_tier: + - PAID + - PAID + - PAID + free_school_meals: 0 + reduced_price_school_meals: 0 + +# 42 USC 1758(b)(12)(A)(vii) covers qualifying foster placement. +# Prior placement alone supplies no current foster category. +- name: Historical foster care alone does not qualify a child or sibling. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + participant: + age: 10 + was_in_foster_care: true + sibling: + age: 10 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_school_meal_categorically_eligible: + - false + - false + - false + school_meal_child_breakfast_tier: + - PAID + - PAID + - PAID + school_meal_child_lunch_tier: + - PAID + - PAID + - PAID + free_school_meals: 0 + reduced_price_school_meals: 0 + +# 42 USC 11434a(2)(A) defines a homeless child as one who lacks a fixed, +# regular and adequate nighttime residence, so every child in a household +# that lacks one qualifies at any income (1758(b)(12)(A)(iv)). +# At 300% FPG both children would otherwise pay. +# Daily subsidy per child = 2.46 + 4.60 = 7.06. +# Free value = 2 children * (2.46 + 4.60 - 0.40 - 0.44) * 180 +# = 2 * 6.22 * 180 = 2,239.20. +- name: A homeless household gives every child free meals above the income limits. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + first_child: + age: 10 + second_child: + age: 12 + spm_units: + unit: + members: + - parent + - first_child + - second_child + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - first_child + - second_child + state_code: AL + is_homeless: true + output: + meets_school_meal_categorical_eligibility: true + school_meal_tier: FREE + is_school_meal_categorically_eligible: + - true + - true + - true + school_meal_child_breakfast_tier: + - FREE + - FREE + - FREE + school_meal_child_lunch_tier: + - FREE + - FREE + - FREE + school_meal_daily_subsidy: 7.06 + free_school_meals: 2239.2 + reduced_price_school_meals: 0 + +# 42 USC 9840(a)(1)(B)(iii)(I) lets a program enroll children above the +# income limit, and 1758(b)(12)(A)(iii) covers every child enrolled under +# 9840(a)(1)(B). Alabama, three people, 2026: FPG = 15,960 + 2 * 5,680 +# = 27,320. Wages of 100,000 exceed it, so the five-year-old fails the +# Head Start income test, and no family member receives public assistance. +# The fixed 300% FPG ratio leaves the sibling paying. +# Free value = (2.46 + 4.60 - 0.40 - 0.44) * 180 = 1,119.60. +- name: Head Start enrollment qualifies a child above the Head Start income limit. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + employment_income: 100_000 + ssi: 0 + participant: + age: 5 + is_enrolled_in_head_start: true + ssi: 0 + sibling: + age: 10 + ssi: 0 + spm_units: + unit: + members: + - parent + - participant + - sibling + snap: 0 + tanf: 0 + fdpir: 0 + school_meal_fpg_ratio: 3 + households: + home: + members: + - parent + - participant + - sibling + state_code: AL + output: + is_head_start_eligible: + - false + - false + - false + school_meal_tier: PAID + is_school_meal_categorically_eligible: + - false + - true + - false + school_meal_child_breakfast_tier: + - PAID + - FREE + - PAID + school_meal_child_lunch_tier: + - PAID + - FREE + - PAID + free_school_meals: 1119.6 + reduced_price_school_meals: 0 + +# Pub. L. 111-296, section 102(b), added 42 USC 1758(b)(12)(A)(vii) for +# foster children, and section 445 makes it effective October 1, 2010. +# Calendar 2010 reads the list in force on January 1, 2010. +- name: Foster care does not qualify a child before the foster clause took effect. + period: 2010 + input: + age: 10 + is_in_foster_care: + 2010-12: true + snap: 0 + tanf: 0 + fdpir: 0 + output: + is_school_meal_categorically_eligible: false + +- name: Foster care qualifies a child once the foster clause took effect. + period: 2011 + input: + age: 10 + is_in_foster_care: + 2011-12: true + snap: 0 + tanf: 0 + fdpir: 0 + output: + is_school_meal_categorically_eligible: true diff --git a/policyengine_us/tests/policy/baseline/gov/usda/school_meals/meets_school_meal_categorical_eligibility.yaml b/policyengine_us/tests/policy/baseline/gov/usda/school_meals/meets_school_meal_categorical_eligibility.yaml index 1a8805c24b9..7db98697bb1 100644 --- a/policyengine_us/tests/policy/baseline/gov/usda/school_meals/meets_school_meal_categorical_eligibility.yaml +++ b/policyengine_us/tests/policy/baseline/gov/usda/school_meals/meets_school_meal_categorical_eligibility.yaml @@ -26,7 +26,9 @@ output: meets_school_meal_categorical_eligibility: true -- name: Is homeless and is migratory child. +# Each child in a household without a fixed nighttime residence counts as a +# homeless child (42 USC 11434a(2)(A)), so every child qualifies. +- name: Household homelessness qualifies every child. period: 2022 input: snap: 0 @@ -39,8 +41,36 @@ is_head_start_eligible: false output: meets_school_meal_categorical_eligibility: true + is_school_meal_categorically_eligible: true -- name: Is runaway child. +- name: Migrant status qualifies the child separately. + period: 2022 + input: + snap: 0 + tanf: 0 + fdpir: 0 + was_in_foster_care: false + is_homeless: false + is_runaway_child: false + is_migratory_child: true + is_head_start_eligible: false + output: + meets_school_meal_categorical_eligibility: false + is_school_meal_categorically_eligible: true + +- name: A homeless child qualifies separately from a housed household. + period: 2022 + input: + snap: 0 + tanf: 0 + fdpir: 0 + is_homeless: false + is_homeless_child: true + output: + meets_school_meal_categorical_eligibility: false + is_school_meal_categorically_eligible: true + +- name: Runaway status qualifies the child separately. period: 2022 input: snap: 0 @@ -52,9 +82,10 @@ is_migratory_child: false is_head_start_eligible: false output: - meets_school_meal_categorical_eligibility: true + meets_school_meal_categorical_eligibility: false + is_school_meal_categorically_eligible: true -- name: Is Head Start child. +- name: Head Start enrollment qualifies the child separately. period: 2022 input: snap: 0 @@ -62,11 +93,12 @@ fdpir: 0 was_in_foster_care: false is_homeless: false - is_runaway_child: true + is_runaway_child: false is_migratory_child: false - is_head_start_eligible: true + is_enrolled_in_head_start: true output: - meets_school_meal_categorical_eligibility: true + meets_school_meal_categorical_eligibility: false + is_school_meal_categorically_eligible: true - name: No participation in any programs. period: 2022 @@ -90,6 +122,7 @@ is_homeless: [False, False, True, True, False, False, False, False] output: meets_school_meal_categorical_eligibility: [True, True, True, True, False, False, False, False] + is_school_meal_categorically_eligible: [True, True, True, True, False, False, False, False] - name: Reported SNAP receipt qualifies even when the modeled allotment is zero. period: 2022 @@ -120,3 +153,45 @@ is_head_start_eligible: false output: meets_school_meal_categorical_eligibility: true + +# 42 USC 1758(b)(12)(A)(iii) requires Head Start enrollment. +# 7 CFR 245.6(b)(8) limits that category to the enrolled child. +# Alabama, three people, 2026: FPG = 15,960 + 2 * 5,680 = 27,320. +# Head Start counts 26,000 in wages, below 27,320, so the preschooler +# meets its income test. School meals count 26,000 + 20,000 rent = 46,000. +# ceil(1.30 * 27,320) = 35,516 < 46,000 <= 50,542 = ceil(1.85 * 27,320). +# The older child qualifies for reduced-price meals through income alone. +- name: A preschooler's Head Start eligibility does not give a sibling free meals. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + parent: + age: 35 + employment_income: 26_000 + rental_income: 20_000 + ssi: 0 + preschooler: + age: 4 + ssi: 0 + sibling: + age: 10 + ssi: 0 + spm_units: + unit: + members: [parent, preschooler, sibling] + snap: 0 + tanf: 0 + fdpir: 0 + households: + household: + members: [parent, preschooler, sibling] + state_code: AL + output: + is_head_start_eligible: [false, true, false] + school_meal_countable_income: 46_000 + meets_school_meal_categorical_eligibility: false + school_meal_tier: REDUCED + # (SBP 2.16 + NSLP 4.20 - paid 0.84) * 180 * 1 = 993.60. + free_school_meals: 0 + reduced_price_school_meals: 993.60 diff --git a/policyengine_us/variables/gov/usda/school_meals/free_school_meals.py b/policyengine_us/variables/gov/usda/school_meals/free_school_meals.py index edc77291533..6dc9e7d5b8d 100644 --- a/policyengine_us/variables/gov/usda/school_meals/free_school_meals.py +++ b/policyengine_us/variables/gov/usda/school_meals/free_school_meals.py @@ -1,4 +1,7 @@ from policyengine_us.model_api import * +from policyengine_us.variables.gov.usda.school_meals.school_meal_daily_subsidy import ( + school_meal_daily_rate, +) class free_school_meals(Variable): @@ -18,26 +21,11 @@ class free_school_meals(Variable): ) def formula(spm_unit, period, parameters): - # Split the net subsidy by each meal's value above the paid rate, so - # each meal counts here only when its own tier is FREE. - state_group = spm_unit.household("state_group_str", period) - breakfast_tier = spm_unit("school_meal_breakfast_tier", period) - lunch_tier = spm_unit("school_meal_lunch_tier", period) - p_amount = parameters(period).gov.usda.school_meals.amount - breakfast_value = ( - p_amount.sbp[state_group][breakfast_tier.decode_to_str()] - - p_amount.sbp[state_group]["PAID"] + # Weight each school child's free meals by their value above paid. + free_value = school_meal_daily_rate( + spm_unit, period, parameters, net=True, tier="FREE" ) - lunch_value = ( - p_amount.nslp[state_group][lunch_tier.decode_to_str()] - - p_amount.nslp[state_group]["PAID"] - ) - free_breakfast = breakfast_tier == breakfast_tier.possible_values.FREE - free_lunch = lunch_tier == lunch_tier.possible_values.FREE - free_value = where(free_breakfast, breakfast_value, 0) + where( - free_lunch, lunch_value, 0 - ) - total_value = breakfast_value + lunch_value + total_value = school_meal_daily_rate(spm_unit, period, parameters, net=True) free_share = np.divide( free_value, total_value, diff --git a/policyengine_us/variables/gov/usda/school_meals/is_school_meal_categorically_eligible.py b/policyengine_us/variables/gov/usda/school_meals/is_school_meal_categorically_eligible.py new file mode 100644 index 00000000000..4607b148951 --- /dev/null +++ b/policyengine_us/variables/gov/usda/school_meals/is_school_meal_categorically_eligible.py @@ -0,0 +1,51 @@ +from policyengine_us.model_api import * + + +def _school_meal_child_categorical_eligibility(person, period, parameters): + """Return this person's individual school meal categorical eligibility.""" + # Congress qualifies a child whom Head Start enrolls under 42 U.S.C. + # 9840(a)(1)(B) (42 U.S.C. 1758(b)(12)(A)(iii)). Programs may enroll + # children above the income limit under 9840(a)(1)(B)(iii), so + # enrollment qualifies the child here without an income test. + # Congress also qualifies a foster child whom a title IV-B or IV-E agency + # or a court has placed (1758(b)(12)(A)(vii)). The monthly input + # is_in_foster_care stands in for that placement, and one month of it + # qualifies the child for the year. + p = parameters(period).gov.usda.school_meals + # Core returns December's value when a formula asks for a monthly + # true-or-false input over a year, so this loop reads each input in its + # own periods and counts every month. + qualifying_periods = 0 + for variable in p.child_categorical_eligibility: + definition_period = person.entity.get_variable( + variable, check_existence=True + ).definition_period + for subperiod in period.get_subperiods(definition_period): + qualifying_periods = qualifying_periods + person(variable, subperiod) + return qualifying_periods > 0 + + +class is_school_meal_categorically_eligible(Variable): + value_type = bool + entity = Person + label = "Categorically eligible for free school meals" + definition_period = YEAR + documentation = ( + "Whether this person qualifies through the SPM unit's SNAP, TANF or " + "FDPIR participation or the household's homelessness, or through their " + "own Head Start enrollment, foster care, homelessness, migrant status " + "or runaway status. School meal values also require K-12 attendance." + ) + reference = ( + "https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A", + "https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(7)", + "https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(8)", + ) + + def formula(person, period, parameters): + household_category = person.spm_unit( + "meets_school_meal_categorical_eligibility", period + ) + return household_category | _school_meal_child_categorical_eligibility( + person, period, parameters + ) diff --git a/policyengine_us/variables/gov/usda/school_meals/meets_school_meal_categorical_eligibility.py b/policyengine_us/variables/gov/usda/school_meals/meets_school_meal_categorical_eligibility.py index 7076727c35f..fd71529f579 100644 --- a/policyengine_us/variables/gov/usda/school_meals/meets_school_meal_categorical_eligibility.py +++ b/policyengine_us/variables/gov/usda/school_meals/meets_school_meal_categorical_eligibility.py @@ -4,8 +4,16 @@ class meets_school_meal_categorical_eligibility(Variable): value_type = bool entity = SPMUnit - label = "School meal categorical eligibility" - documentation = "Whether this SPM unit is eligible for free school meal via participation in other programs" + label = "Household-wide school meal categorical eligibility" + documentation = ( + "Whether SNAP, TANF or FDPIR participation, or the household's lack of " + "a fixed nighttime residence, qualifies every child in this SPM unit. " + "Child-specific categories also apply through " + "is_school_meal_categorically_eligible." + ) definition_period = YEAR - reference = "https://www.law.cornell.edu/cfr/text/7/245.2" + reference = ( + "https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(7)", + "https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A", + ) adds = "gov.usda.school_meals.categorical_eligibility" diff --git a/policyengine_us/variables/gov/usda/school_meals/reduced_price_school_meals.py b/policyengine_us/variables/gov/usda/school_meals/reduced_price_school_meals.py index c6eef52021b..009b5dcc515 100644 --- a/policyengine_us/variables/gov/usda/school_meals/reduced_price_school_meals.py +++ b/policyengine_us/variables/gov/usda/school_meals/reduced_price_school_meals.py @@ -1,4 +1,7 @@ from policyengine_us.model_api import * +from policyengine_us.variables.gov.usda.school_meals.school_meal_daily_subsidy import ( + school_meal_daily_rate, +) class reduced_price_school_meals(Variable): @@ -17,26 +20,11 @@ class reduced_price_school_meals(Variable): ) def formula(spm_unit, period, parameters): - # Split the net subsidy by each meal's value above the paid rate, so - # each meal counts here only when its own tier is REDUCED. - state_group = spm_unit.household("state_group_str", period) - breakfast_tier = spm_unit("school_meal_breakfast_tier", period) - lunch_tier = spm_unit("school_meal_lunch_tier", period) - p_amount = parameters(period).gov.usda.school_meals.amount - breakfast_value = ( - p_amount.sbp[state_group][breakfast_tier.decode_to_str()] - - p_amount.sbp[state_group]["PAID"] + # Weight each school child's reduced-price meals by their net value. + reduced_value = school_meal_daily_rate( + spm_unit, period, parameters, net=True, tier="REDUCED" ) - lunch_value = ( - p_amount.nslp[state_group][lunch_tier.decode_to_str()] - - p_amount.nslp[state_group]["PAID"] - ) - reduced_breakfast = breakfast_tier == breakfast_tier.possible_values.REDUCED - reduced_lunch = lunch_tier == lunch_tier.possible_values.REDUCED - reduced_value = where(reduced_breakfast, breakfast_value, 0) + where( - reduced_lunch, lunch_value, 0 - ) - total_value = breakfast_value + lunch_value + total_value = school_meal_daily_rate(spm_unit, period, parameters, net=True) reduced_share = np.divide( reduced_value, total_value, diff --git a/policyengine_us/variables/gov/usda/school_meals/school_meal_child_breakfast_tier.py b/policyengine_us/variables/gov/usda/school_meals/school_meal_child_breakfast_tier.py new file mode 100644 index 00000000000..1880f602d92 --- /dev/null +++ b/policyengine_us/variables/gov/usda/school_meals/school_meal_child_breakfast_tier.py @@ -0,0 +1,30 @@ +from policyengine_us.model_api import * +from policyengine_us.variables.gov.usda.school_meals.is_school_meal_categorically_eligible import ( + _school_meal_child_categorical_eligibility, +) +from policyengine_us.variables.gov.usda.school_meals.school_meal_tier import ( + SchoolMealTier, +) + + +class school_meal_child_breakfast_tier(Variable): + value_type = Enum + entity = Person + possible_values = SchoolMealTier + default_value = SchoolMealTier.PAID + label = "School breakfast tier for this child" + definition_period = YEAR + documentation = ( + "The SPM unit's breakfast tier, including household categorical " + "eligibility, with free breakfast for this child's own categorical " + "eligibility. Explicit SPM-unit tier inputs apply to children " + "without an individual category." + ) + reference = "https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(8)" + + def formula(person, period, parameters): + tier = person.spm_unit("school_meal_breakfast_tier", period) + categorical = _school_meal_child_categorical_eligibility( + person, period, parameters + ) + return where(categorical, SchoolMealTier.FREE.index, tier) diff --git a/policyengine_us/variables/gov/usda/school_meals/school_meal_child_lunch_tier.py b/policyengine_us/variables/gov/usda/school_meals/school_meal_child_lunch_tier.py new file mode 100644 index 00000000000..a3a7d2ab80a --- /dev/null +++ b/policyengine_us/variables/gov/usda/school_meals/school_meal_child_lunch_tier.py @@ -0,0 +1,30 @@ +from policyengine_us.model_api import * +from policyengine_us.variables.gov.usda.school_meals.is_school_meal_categorically_eligible import ( + _school_meal_child_categorical_eligibility, +) +from policyengine_us.variables.gov.usda.school_meals.school_meal_tier import ( + SchoolMealTier, +) + + +class school_meal_child_lunch_tier(Variable): + value_type = Enum + entity = Person + possible_values = SchoolMealTier + default_value = SchoolMealTier.PAID + label = "School lunch tier for this child" + definition_period = YEAR + documentation = ( + "The SPM unit's lunch tier, including household categorical " + "eligibility, with free lunch for this child's own categorical " + "eligibility. Explicit SPM-unit tier inputs apply to children " + "without an individual category." + ) + reference = "https://www.ecfr.gov/current/title-7/section-245.6#p-245.6(b)(8)" + + def formula(person, period, parameters): + tier = person.spm_unit("school_meal_lunch_tier", period) + categorical = _school_meal_child_categorical_eligibility( + person, period, parameters + ) + return where(categorical, SchoolMealTier.FREE.index, tier) diff --git a/policyengine_us/variables/gov/usda/school_meals/school_meal_daily_subsidy.py b/policyengine_us/variables/gov/usda/school_meals/school_meal_daily_subsidy.py index 75dce29cd57..f24930f5103 100644 --- a/policyengine_us/variables/gov/usda/school_meals/school_meal_daily_subsidy.py +++ b/policyengine_us/variables/gov/usda/school_meals/school_meal_daily_subsidy.py @@ -1,6 +1,39 @@ from policyengine_us.model_api import * +def school_meal_daily_rate(spm_unit, period, parameters, *, net=False, tier=None): + """Average each school child's meal rates, optionally net of paid rates.""" + state_group = spm_unit.household("state_group_str", period) + child_state_group = spm_unit.project(state_group) + in_school = spm_unit.members("is_in_k12_school", period) + children = spm_unit.sum(in_school) + p_amount = parameters(period).gov.usda.school_meals.amount + result = 0 + for meal, program in (("breakfast", "sbp"), ("lunch", "nslp")): + rates = p_amount[program] + common_tier = spm_unit(f"school_meal_{meal}_tier", period).decode_to_str() + child_tier = spm_unit.members( + f"school_meal_child_{meal}_tier", period + ).decode_to_str() + common_rate = rates[state_group][common_tier] + child_rate = rates[child_state_group][child_tier] + if net: + common_rate = common_rate - rates[state_group]["PAID"] + child_rate = child_rate - rates[child_state_group]["PAID"] + if tier is not None: + common_rate = where(common_tier == tier, common_rate, 0) + child_rate = where(child_tier == tier, child_rate, 0) + # Preserve the common per-child rate for units without schoolchildren; + # their annual benefit remains zero. Inputs can still override it. + result = result + np.divide( + spm_unit.sum(where(in_school, child_rate, 0)), + children, + out=common_rate.copy(), + where=children > 0, + ) + return result + + class school_meal_daily_subsidy(Variable): value_type = float entity = SPMUnit @@ -8,9 +41,9 @@ class school_meal_daily_subsidy(Variable): label = "School meal subsidies per child per day" unit = USD documentation = ( - "Value of school meal subsidies per child per day: the School Breakfast " - "Program rate at the breakfast tier plus the National School Lunch " - "Program rate at the lunch tier." + "Average subsidy per K-12 child per day, using each child's breakfast " + "and lunch tiers. Units without schoolchildren retain their common " + "per-child rate and receive no annual school-meal value." ) reference = ( "https://www.law.cornell.edu/uscode/text/42/1773#e_1_A", @@ -18,11 +51,4 @@ class school_meal_daily_subsidy(Variable): ) def formula(spm_unit, period, parameters): - # Get state group and per-meal tiers for SPM unit. - state_group = spm_unit.household("state_group_str", period) - breakfast_tier = spm_unit("school_meal_breakfast_tier", period).decode_to_str() - lunch_tier = spm_unit("school_meal_lunch_tier", period).decode_to_str() - p_amount = parameters(period).gov.usda.school_meals.amount - nslp_per_child = p_amount.nslp[state_group][lunch_tier] - sbp_per_child = p_amount.sbp[state_group][breakfast_tier] - return nslp_per_child + sbp_per_child + return school_meal_daily_rate(spm_unit, period, parameters) diff --git a/policyengine_us/variables/gov/usda/school_meals/school_meal_tier.py b/policyengine_us/variables/gov/usda/school_meals/school_meal_tier.py index 30a3f124b66..3845b20014b 100644 --- a/policyengine_us/variables/gov/usda/school_meals/school_meal_tier.py +++ b/policyengine_us/variables/gov/usda/school_meals/school_meal_tier.py @@ -48,7 +48,7 @@ class school_meal_tier(Variable): entity = SPMUnit definition_period = YEAR documentation = ( - "School meal tier that applies to both breakfast and lunch: federal " + "Common SPM-unit tier for both breakfast and lunch: federal " "eligibility plus state coverage of both meals (universal free meals, " "reduced-price copay coverage and free-meal income limits above the " "federal limit). The federal free (130%) and reduced-price (185%) " @@ -59,7 +59,9 @@ class school_meal_tier(Variable): "exactly. State policies that cover only one meal apply in " "school_meal_breakfast_tier and school_meal_lunch_tier. FREE " "describes no family charge; it does not change the student's " - "federal reimbursement category." + "federal reimbursement category. Child-specific categorical " + "eligibility applies in school_meal_child_breakfast_tier and " + "school_meal_child_lunch_tier." ) reference = ( "https://www.law.cornell.edu/uscode/text/42/1758#b_1_A", diff --git a/policyengine_us/variables/household/demographic/person/is_enrolled_in_head_start.py b/policyengine_us/variables/household/demographic/person/is_enrolled_in_head_start.py index d17298976d4..1316ccb9942 100644 --- a/policyengine_us/variables/household/demographic/person/is_enrolled_in_head_start.py +++ b/policyengine_us/variables/household/demographic/person/is_enrolled_in_head_start.py @@ -6,3 +6,11 @@ class is_enrolled_in_head_start(Variable): entity = Person label = "Enrolled in a Head Start or Early Head Start program" definition_period = YEAR + documentation = ( + "Whether this person enrolls in Head Start or Early Head Start. " + "Enrollment differs from modeled eligibility and hypothetical take-up." + ) + reference = ( + "https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A-iii", + "https://uscode.house.gov/us/usc/119-124/t42/s9840/#a-1-B", + ) diff --git a/policyengine_us/variables/household/demographic/person/is_homeless_child.py b/policyengine_us/variables/household/demographic/person/is_homeless_child.py new file mode 100644 index 00000000000..c8a6d4df211 --- /dev/null +++ b/policyengine_us/variables/household/demographic/person/is_homeless_child.py @@ -0,0 +1,21 @@ +from policyengine_us.model_api import * + + +class is_homeless_child(Variable): + value_type = bool + entity = Person + default_value = False + label = "Child qualifies as homeless for school meals" + definition_period = YEAR + documentation = ( + "Whether a school liaison, shelter director or other authorized " + "official has identified this child as homeless under the " + "McKinney-Vento definition for school meal certification. This input " + "identifies one child when the whole household is not homeless; " + "is_homeless covers a household without a fixed nighttime residence." + ) + reference = ( + "https://www.ecfr.gov/current/title-7/section-245.2", + "https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A-iv", + "https://uscode.house.gov/us/usc/119-124/t42/s11434a/#2", + ) diff --git a/source_conflicts/candidates.yaml b/source_conflicts/candidates.yaml index 9d02eda84fd..f3ca1b9810e 100644 --- a/source_conflicts/candidates.yaml +++ b/source_conflicts/candidates.yaml @@ -13780,6 +13780,68 @@ candidates: state: ruled note: Ruled October 2026; verify the worksheet version and whether claiming the rebate defeats the refund-only joint-return exception. +- id: us:school-meals-head-start-categorical-basis + program: school-meals + years: + from: 2007 + type: calendar + question: Does every child enrolled in a Head Start program qualify for free school meals (7 CFR 245.2), or only + a child whom the program enrolled on a determination under 42 U.S.C. 9840(a)(1)(B) (42 U.S.C. + 1758(b)(12)(A)(iii))? + sources: + - kind: statute + citation: 42 U.S.C. 1758(b)(12)(A)(iii) + url: https://uscode.house.gov/us/usc/119-124/t42/s1758/#b-12-A-iii + - kind: statute + citation: 42 U.S.C. 9840(a)(1)(B), (a)(2) and (d)(1) + url: https://uscode.house.gov/us/usc/119-124/t42/s9840/#a-1-B + - kind: statute + citation: Pub. L. 118-47, div. D, title II, sections 238 and 239 (42 U.S.C. 9840 note) + url: https://uscode.house.gov/us/usc/119-124/t42/s9840/#miscellaneous-note + - kind: regulation + citation: 7 CFR 245.2, definitions of "Categorically eligible" and "Head Start child" + url: https://www.ecfr.gov/current/title-7/section-245.2 + - kind: rulemaking + citation: 76 FR 22785, 22791 (April 25, 2011), interim rule, "Children Enrolled in Head Start Programs" + url: https://www.govinfo.gov/content/pkg/FR-2011-04-25/html/2011-9457.htm + readings: + statute: Congress makes a child automatically eligible when a Head Start program enrolls the child "on the basis + of a determination that the child meets the eligibility criteria prescribed under section 645(a)(1)(B) of the + Head Start Act". A child whom a program enrolls on any other basis gets no free meals through Head Start. + other: USDA defines a Head Start child as "a child enrolled as a participant in a Head Start program authorized + under the Head Start Act", with no condition on the basis of enrollment. Its definition of "Categorically + eligible" lists a Head Start child. In the preamble to the 2011 interim rule, USDA says section 29(c) of Pub. + L. 110-134 amended clause (iii) "to extend categorical eligibility for free meals and free milk to all Head + Start enrollees". + example: In is_school_meal_categorically_eligible.yaml, a five-year-old enrollee in a family at 300% of the + poverty guideline gets the free tier in 2026 and free meals worth (2.46 + 4.60 - 0.40 - 0.44) x 180 = + $1,119.60. If a program in a community of 1,000 or fewer people enrolled that child under its own criteria + (9840(a)(2)), the child would get the paid tier and $0 under the statute's reading. + pe_us: + follows: conflicting-source + code: + - policyengine_us/parameters/gov/usda/school_meals/child_categorical_eligibility.yaml + - policyengine_us/variables/gov/usda/school_meals/is_school_meal_categorically_eligible.py + - policyengine_us/variables/household/demographic/person/is_enrolled_in_head_start.py + prs: + - https://github.com/PolicyEngine/policyengine-us/pull/10838 + state: open + note: PE-US counts every Head Start enrollee as categorically eligible. child_categorical_eligibility.yaml lists + is_enrolled_in_head_start, and is_school_meal_categorically_eligible.py qualifies a person when that input is + true, with no income test. is_enrolled_in_head_start.py records enrollment in Head Start or Early Head Start. + The model has no input for the basis of enrollment, so the statute's reading would need one. Under 42 U.S.C. + 9840(a)(1)(B), programs enroll children whose families have income below the poverty line or qualify for public + assistance, homeless children and, within the shares clause (iii) allows, children who meet neither test. A + program can also enroll a child outside (a)(1)(B). Under 9840(a)(2), a program in a community of 1,000 or fewer + people sets its own criteria. Under 9840(d)(1), a tribe that enrolls every low-income child in its community + may enroll children who do not meet the low-income criteria. Under Pub. L. 118-47, div. D, sections 238 and + 239, enacted on March 23, 2024, a tribe or a migrant or seasonal program sets its own selection criteria. + Congress wrote the (a)(1)(B) basis into clause (iii) on December 12, 2007 (Pub. L. 110-134, section 29(c)(1)), + and the clause named the low-income criteria of section 645(a)(1)(A) before then. USDA added both 245.2 + definitions in the interim rule, effective June 24, 2011. is_school_meal_categorically_eligible.yaml pins the + model's reading for an enrollee at high income and for an enrollee above the Head Start income limit. An answer + should say whether the model keeps counting every enrollee, or takes a new input for enrollment on the (a)(1)(B) + basis and counts only those children. - id: us:se-plan-step-2-multiple-businesses program: income-tax years: