diff --git a/changelog.d/fixed/8580.md b/changelog.d/fixed/8580.md new file mode 100644 index 00000000000..b424d2cf164 --- /dev/null +++ b/changelog.d/fixed/8580.md @@ -0,0 +1 @@ +Restricted Kansas Commodity Supplemental Food Program eligibility to covered counties. diff --git a/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/csfp/ks_dcf_csfp_county_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/csfp/ks_dcf_csfp_county_eligible.yaml new file mode 100644 index 00000000000..d5a33174d0f --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/csfp/ks_dcf_csfp_county_eligible.yaml @@ -0,0 +1,50 @@ +- name: Kansas household in a FAQ-listed CSFP county + period: 2025 + input: + people: + person: + age: 65 + spm_units: + spm_unit: + members: [person] + households: + household: + members: [person] + state_code: KS + county_str: JOHNSON_COUNTY_KS + output: + ks_dcf_csfp_county_eligible: true + +- name: Kansas household in a spreadsheet-listed CSFP county + period: 2025 + input: + people: + person: + age: 65 + spm_units: + spm_unit: + members: [person] + households: + household: + members: [person] + state_code: KS + county_str: GRANT_COUNTY_KS + output: + ks_dcf_csfp_county_eligible: true + +- name: Kansas household outside CSFP covered counties + period: 2025 + input: + people: + person: + age: 65 + spm_units: + spm_unit: + members: [person] + households: + household: + members: [person] + state_code: KS + county_str: ALLEN_COUNTY_KS + output: + ks_dcf_csfp_county_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/usda/csfp/commodity_supplemental_food_program_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/usda/csfp/commodity_supplemental_food_program_eligible.yaml index e2c29440086..67cf5032c69 100644 --- a/policyengine_us/tests/policy/baseline/gov/usda/csfp/commodity_supplemental_food_program_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/usda/csfp/commodity_supplemental_food_program_eligible.yaml @@ -169,3 +169,39 @@ state_code: TX output: commodity_supplemental_food_program_eligible: true + +- name: Kansas senior in a CSFP covered county is eligible + period: 2025 + input: + people: + person: + age: 65 + spm_units: + spm_unit: + members: [person] + school_meal_fpg_ratio: 1.4 + households: + household: + members: [person] + state_code: KS + county_str: JOHNSON_COUNTY_KS + output: + commodity_supplemental_food_program_eligible: true + +- name: Kansas senior outside CSFP covered counties is not eligible + period: 2025 + input: + people: + person: + age: 65 + spm_units: + spm_unit: + members: [person] + school_meal_fpg_ratio: 1.0 + households: + household: + members: [person] + state_code: KS + county_str: ALLEN_COUNTY_KS + output: + commodity_supplemental_food_program_eligible: false diff --git a/policyengine_us/variables/gov/states/ks/dcf/csfp/ks_dcf_csfp_county_eligible.py b/policyengine_us/variables/gov/states/ks/dcf/csfp/ks_dcf_csfp_county_eligible.py new file mode 100644 index 00000000000..a3e25c22475 --- /dev/null +++ b/policyengine_us/variables/gov/states/ks/dcf/csfp/ks_dcf_csfp_county_eligible.py @@ -0,0 +1,83 @@ +from policyengine_us.model_api import * + + +KS_CSFP_COUNTIES = [ + # Kansas DCF's FAQ jurisdiction table and linked site spreadsheet + # differ slightly, so include counties present in either DCF source. + "ANDERSON_COUNTY_KS", + "ATCHISON_COUNTY_KS", + "BARBER_COUNTY_KS", + "BARTON_COUNTY_KS", + "BOURBON_COUNTY_KS", + "BROWN_COUNTY_KS", + "BUTLER_COUNTY_KS", + "CHAUTAUQUA_COUNTY_KS", + "CHEROKEE_COUNTY_KS", + "CLAY_COUNTY_KS", + "COWLEY_COUNTY_KS", + "CRAWFORD_COUNTY_KS", + "DECATUR_COUNTY_KS", + "DONIPHAN_COUNTY_KS", + "DOUGLAS_COUNTY_KS", + "ELLIS_COUNTY_KS", + "ELLSWORTH_COUNTY_KS", + "FRANKLIN_COUNTY_KS", + "GEARY_COUNTY_KS", + "GRAHAM_COUNTY_KS", + "GRANT_COUNTY_KS", + "HARPER_COUNTY_KS", + "HARVEY_COUNTY_KS", + "HODGEMAN_COUNTY_KS", + "JACKSON_COUNTY_KS", + "JEFFERSON_COUNTY_KS", + "JOHNSON_COUNTY_KS", + "KEARNY_COUNTY_KS", + "KINGMAN_COUNTY_KS", + "KIOWA_COUNTY_KS", + "LABETTE_COUNTY_KS", + "LEAVENWORTH_COUNTY_KS", + "LYON_COUNTY_KS", + "MARION_COUNTY_KS", + "MARSHALL_COUNTY_KS", + "MIAMI_COUNTY_KS", + "MITCHELL_COUNTY_KS", + "MONTGOMERY_COUNTY_KS", + "MORRIS_COUNTY_KS", + "NEMAHA_COUNTY_KS", + "OSAGE_COUNTY_KS", + "OSBORNE_COUNTY_KS", + "PAWNEE_COUNTY_KS", + "PHILLIPS_COUNTY_KS", + "POTTAWATOMIE_COUNTY_KS", + "PRATT_COUNTY_KS", + "RENO_COUNTY_KS", + "RILEY_COUNTY_KS", + "RUSSELL_COUNTY_KS", + "SALINE_COUNTY_KS", + "SEDGWICK_COUNTY_KS", + "SEWARD_COUNTY_KS", + "SHAWNEE_COUNTY_KS", + "SHERMAN_COUNTY_KS", + "STAFFORD_COUNTY_KS", + "SUMNER_COUNTY_KS", + "THOMAS_COUNTY_KS", + "WABAUNSEE_COUNTY_KS", + "WASHINGTON_COUNTY_KS", + "WYANDOTTE_COUNTY_KS", +] + + +class ks_dcf_csfp_county_eligible(Variable): + value_type = bool + entity = Household + definition_period = YEAR + label = "Kansas DCF CSFP county eligible" + defined_for = StateCode.KS + reference = ( + "https://www.dcf.ks.gov/services/ees/pages/usda-commodity-programs/csfp/csfp-faqs.aspx", + "https://content.dcf.ks.gov/ees/KEESM/Intranet/CSFPSitesbyJurisdiction.xlsx", + ) + + def formula(household, period, parameters): + county = household("county_str", period) + return np.isin(county, KS_CSFP_COUNTIES) diff --git a/policyengine_us/variables/gov/usda/csfp/commodity_supplemental_food_program_eligible.py b/policyengine_us/variables/gov/usda/csfp/commodity_supplemental_food_program_eligible.py index a0ea9a806d4..1934095d049 100644 --- a/policyengine_us/variables/gov/usda/csfp/commodity_supplemental_food_program_eligible.py +++ b/policyengine_us/variables/gov/usda/csfp/commodity_supplemental_food_program_eligible.py @@ -19,5 +19,8 @@ def formula(person, period, parameters): tx_income_eligible = person("tx_dta_csfp_income_eligible", period) state_code = person.household("state_code", period) in_tx = state_code == StateCode.TX + in_ks = state_code == StateCode.KS income_eligible = where(in_tx, tx_income_eligible, federal_income_eligible) - return age_eligible & income_eligible + ks_county_eligible = person.household("ks_dcf_csfp_county_eligible", period) + county_eligible = where(in_ks, ks_county_eligible, True) + return age_eligible & income_eligible & county_eligible