diff --git a/changelog.d/round-summed-limits.fixed.md b/changelog.d/round-summed-limits.fixed.md new file mode 100644 index 00000000000..e97e95c5393 --- /dev/null +++ b/changelog.d/round-summed-limits.fixed.md @@ -0,0 +1 @@ +Compare summed resources in whole cents for SSI, SNAP, Medicaid, Medicare Savings Programs and state and county asset tests. Preserve fractional parental shares and reform limits in SSI and medically needy Medicaid. Exempt one qualifying vehicle's net equity in Orange County, honor reported zero equity, and retain fractional vehicle equity in San Mateo. Apply Colorado Old Age Pension's strict resource limit for married and legally separated applicants, and exclude legally separated spouses' resources and income. End Idaho's non-cash SNAP categorical eligibility in July 2026. diff --git a/policyengine_us/parameters/gov/hhs/tanf/non_cash/asset_limit.yaml b/policyengine_us/parameters/gov/hhs/tanf/non_cash/asset_limit.yaml index d3a53f7674e..039c370637f 100644 --- a/policyengine_us/parameters/gov/hhs/tanf/non_cash/asset_limit.yaml +++ b/policyengine_us/parameters/gov/hhs/tanf/non_cash/asset_limit.yaml @@ -141,6 +141,8 @@ metadata: unit: currency-USD period: year reference: + - title: Idaho SNAP resource limit, IDAPA 16.03.04.305 + href: https://adminrules.idaho.gov/rules/current/16/160304.pdf#page=37 - title: "Idaho Code 56-205A(6) and (7), added by House Bill 730 (2026)" href: https://legislature.idaho.gov/statutesrules/idstat/title56/t56ch2/sect56-205a/ - title: "Idaho House Bill 730 (2026), engrossed, Section 3 (effective July 1, 2026)" diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.yaml index f322d235f81..476a1b7869f 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.yaml @@ -1605,3 +1605,277 @@ medicaid_medically_needy_income_from_spouse: [128, 0, 0] medicaid_medically_needy_income_limit: [2_599.92, 2_599.92, 1_299.96] is_medically_needy_for_medicaid: [true, false, false] + +# Hawaii's 2,000 individual asset limit: 178.57 + 1,547.79 + 273.64 = +# 2,000.00. The float32 balances add to 2,000.0001 unless rounded to cents. +- name: Three accounts that total exactly the Hawaii limit pass + period: 2026 + input: + is_disabled: true + meets_ssi_disability_criteria: true + is_in_medicaid_medically_needy_category: true + is_adult_for_medicaid: false + is_optional_senior_or_disabled_for_medicaid: false + ssi_countable_income: 0 + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.64 + state_code: HI + output: + is_medically_needy_for_medicaid: true + +# 178.57 + 1,547.79 + 273.65 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the Hawaii limit fail + period: 2026 + input: + is_disabled: true + meets_ssi_disability_criteria: true + is_in_medicaid_medically_needy_category: true + is_adult_for_medicaid: false + is_optional_senior_or_disabled_for_medicaid: false + ssi_countable_income: 0 + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.65 + state_code: HI + output: + is_medically_needy_for_medicaid: false + + +# A child's resources include the SSI parental share (Cases 5 and 6). The +# first child's own income is too high for SSI, as in Case 5, so they don't +# count in the division but are still deemed the share the three SSI-eligible +# siblings divide (SI 01330.200 B, which sets no rounding rule for a share). +# The parent's 2,100 is 100 over the SSI individual allowance, so the share +# is 100 / 3 = 33.3333. The first child's 1,966.67 in one account plus the +# share is 2,000.0033, over Massachusetts's 2,000 limit. The siblings receive +# SSI, so they qualify through that pathway instead; the parent's 80,000 of +# wages keeps the children out of the MAGI child groups. +- name: A fractional parental share counts against a disabled child's asset limit + period: 2026 + input: + people: + parent: + age: 40 + is_tax_unit_head: true + is_parent: true + employment_income_before_lsr: 80_000 + bank_account_assets: 2_100 + child1: + age: 8 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 21_358 + medicaid_medically_needy_medical_expenses: 16_000 + is_optional_senior_or_disabled_for_medicaid: false + bank_account_assets: 1_966.67 + child2: + age: 10 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child3: + age: 12 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child4: + age: 14 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + tax_units: + tax_unit: + members: [parent, child1, child2, child3, child4] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + child4_unit: + members: [child4] + households: + household: + members: [parent, child1, child2, child3, child4] + state_code: MA + output: + ssi_resources_deemed_from_ineligible_parent: + 2026-01: [0, 33.3333, 33.3333, 33.3333, 33.3333] + is_medically_needy_for_medicaid: [false, false, false, false, false] + +# With four SSI-eligible siblings the parent's 100 of excess divides as 25 +# each. The first child's 178.57 + 1,522.79 + 273.64 = 1,975.00 plus 25 is +# 2,000.00, at the limit, and income 21,358 - 16,000 = 5,358 <= 6,264 as in +# Case 5. That child's float32 balances add to 1,975.0001 unless rounded to +# cents. +- name: A child qualifies when accounts and a whole-cent parental share reach the asset limit + period: 2026 + input: + people: + parent: + age: 40 + is_tax_unit_head: true + is_parent: true + employment_income_before_lsr: 80_000 + bank_account_assets: 2_100 + child1: + age: 8 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 21_358 + medicaid_medically_needy_medical_expenses: 16_000 + is_optional_senior_or_disabled_for_medicaid: false + bank_account_assets: 178.57 + stock_assets: 1_522.79 + bond_assets: 273.64 + child2: + age: 10 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child3: + age: 12 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child4: + age: 14 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child5: + age: 16 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + tax_units: + tax_unit: + members: [parent, child1, child2, child3, child4, child5] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + child4_unit: + members: [child4] + child5_unit: + members: [child5] + households: + household: + members: [parent, child1, child2, child3, child4, child5] + state_code: MA + output: + ssi_resources_deemed_from_ineligible_parent: + 2026-01: [0, 25, 25, 25, 25, 25] + is_medically_needy_for_medicaid: [false, true, false, false, false, false] + +# The parent's 2,100.01 is 100.01 over the SSI individual allowance, all +# deemed to the only child, whose own income is too high for SSI. The +# child's 1,899.99 plus 100.01 is exactly 2,000.00, at the limit. +- name: A child qualifies when a stored parental share reaches the asset limit + period: 2026 + input: + people: + parent: + age: 40 + is_tax_unit_head: true + is_parent: true + employment_income_before_lsr: 80_000 + bank_account_assets: 2_100.01 + child1: + age: 8 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 21_358 + medicaid_medically_needy_medical_expenses: 16_000 + is_optional_senior_or_disabled_for_medicaid: false + bank_account_assets: 1_899.99 + tax_units: + tax_unit: + members: [parent, child1] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + households: + household: + members: [parent, child1] + state_code: MA + output: + ssi_resources_deemed_from_ineligible_parent: + 2026-01: [0, 100.01] + is_medically_needy_for_medicaid: [false, true] + +# (101,114.01 - 2,000) / 3 = 33,038.00333..., above the 33,038 cap. +# The first child fails the SSI income test and receives the same share. +- name: New York counts a parental share fractionally above the asset limit + period: 2026 + input: + people: + parent: + age: 40 + is_tax_unit_head: true + is_parent: true + employment_income_before_lsr: 80_000 + bank_account_assets: 101_114.01 + child1: + age: 8 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 21_358 + medicaid_medically_needy_medical_expenses: 16_000 + is_optional_senior_or_disabled_for_medicaid: false + child2: + age: 10 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child3: + age: 12 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + child4: + age: 14 + is_tax_unit_dependent: true + is_ssi_disabled: true + ssi_countable_income: 0 + is_optional_senior_or_disabled_for_medicaid: false + tax_units: + tax_unit: + members: [parent, child1, child2, child3, child4] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + child4_unit: + members: [child4] + households: + household: + members: [parent, child1, child2, child3, child4] + state_code: NY + output: + is_medically_needy_for_medicaid: [false, false, false, false, false] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.yaml index feaba98d662..fe65548cf33 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.yaml @@ -437,3 +437,116 @@ # July 2027; resources may not exceed it. msp_asset_eligible: 2027-07: [true, true] + +# 42 U.S.C. 1396d(p)(1)(C): 2,885.40 + 5,798.41 + 976.19 = 9,660.00, at the +# 2025 individual limit. +- name: Three accounts that total exactly the individual limit pass + period: 2025-01 + input: + age: 67 + bank_account_assets: 2_885.40 + stock_assets: 5_798.41 + bond_assets: 976.19 + spm_unit_is_married: false + state_code: TX + output: + msp_asset_eligible: true + +# 2,885.40 + 5,798.41 + 976.20 = 9,660.01, a cent over the limit. +- name: Three accounts a cent over the individual limit fail + period: 2025-01 + input: + age: 67 + bank_account_assets: 2_885.40 + stock_assets: 5_798.41 + bond_assets: 976.20 + spm_unit_is_married: false + state_code: TX + output: + msp_asset_eligible: false + + +# 38,164.84 + 87,274.17 + 4,560.99 = 130,000.00, the California limit. +- name: California MSP accepts split balances at the January 2026 limit + period: 2026-01 + input: + age: 70 + state_code: CA + bank_account_assets: 38_164.84 + stock_assets: 87_274.17 + bond_assets: 4_560.99 + output: + msp_asset_eligible: true + +# 87,908.16 + 14,020.12 + 28,071.73 = 130,000.01, one cent over. +- name: California MSP rejects split balances a cent over the January 2026 limit + period: 2026-01 + input: + age: 70 + state_code: CA + bank_account_assets: 87_908.16 + stock_assets: 14_020.12 + bond_assets: 28_071.73 + output: + msp_asset_eligible: false + +# The supplied SSI total of 130,000 overrides the 200,000 account balance. +- name: California MSP uses an explicitly supplied SSI resource total + period: 2026-01 + input: + age: 70 + state_code: CA + bank_account_assets: 200_000 + ssi_countable_resources: 130_000 + output: + msp_asset_eligible: true + +# 150,000.01 + 44,999.99 = 195,000.00, at the California couple limit. +- name: California MSP accepts uneven balances at the January 2026 couple limit + period: 2026-01 + input: + people: + first: + age: 70 + bank_account_assets: 150_000.01 + second: + age: 68 + bank_account_assets: 44_999.99 + marital_units: + couple: + members: [first, second] + spm_units: + unit: + members: [first, second] + spm_unit_is_married: true + households: + home: + members: [first, second] + state_code: CA + output: + msp_asset_eligible: [true, true] + +# 150,000.02 + 44,999.99 = 195,000.01. The first balance differs by one cent. +- name: California MSP rejects uneven balances one cent above the couple limit + period: 2026-01 + input: + people: + first: + age: 70 + bank_account_assets: 150_000.02 + second: + age: 68 + bank_account_assets: 44_999.99 + marital_units: + couple: + members: [first, second] + spm_units: + unit: + members: [first, second] + spm_unit_is_married: true + households: + home: + members: [first, second] + state_code: CA + output: + msp_asset_eligible: [false, false] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.yaml index 0b5a86fd80b..b8a42a19c32 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.yaml @@ -159,3 +159,44 @@ meets_tanf_non_cash_asset_test: 2026-01: true 2026-07: false + +# Idaho's 5,000 BBCE asset limit: 4,338.99 + 609.03 + 51.98 = 5,000.00. +# Idaho ends non-cash categorical eligibility on July 1, 2026. +- name: Idaho households at the resource limit pass in June but fail in July + period: 2026 + input: + state_code_str: ID + bank_account_assets: 4_338.99 + stock_assets: 609.03 + bond_assets: 51.98 + output: + meets_tanf_non_cash_asset_test: + 2026-06: true + 2026-07: false + is_tanf_non_cash_eligible: + 2026-06: true + 2026-07: false + +# 4,338.99 + 609.03 + 51.99 = 5,000.01, a cent over the limit. +- name: Three accounts a cent over the Idaho limit fail in June + period: 2026 + input: + state_code_str: ID + bank_account_assets: 4_338.99 + stock_assets: 609.03 + bond_assets: 51.99 + output: + meets_tanf_non_cash_asset_test: + 2026-06: false + +# A float32 sum of 4,338.99 + 609.03 + 51.98 can store 5,000.00048828125. +# The underlying 5,000.00 meets the June limit. July has no BBCE asset path. +- name: An Idaho SNAP asset total with float32 drift passes at the June limit + period: 2026 + input: + state_code_str: ID + snap_assets: 5_000.00048828125 + output: + meets_tanf_non_cash_asset_test: + 2026-06: true + 2026-07: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/ala/eligibility/ca_ala_general_assistance_personal_property_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/ala/eligibility/ca_ala_general_assistance_personal_property_eligible.yaml index 7121a7acd88..a33fa0b4815 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/ala/eligibility/ca_ala_general_assistance_personal_property_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/ala/eligibility/ca_ala_general_assistance_personal_property_eligible.yaml @@ -13,3 +13,39 @@ in_ala: true output: ca_ala_general_assistance_personal_property_eligible: false + +- name: Two people's property values at the limit pass + period: 2026-01 + input: + people: + person1: + personal_property: 260.1 + person2: + personal_property: 739.9 + households: + home: + members: [person1, person2] + in_ala: true + spm_units: + family: + members: [person1, person2] + output: + ca_ala_general_assistance_personal_property_eligible: true + +- name: Two people's property values a cent over the limit fail + period: 2026-01 + input: + people: + person1: + personal_property: 260.1 + person2: + personal_property: 739.91 + households: + home: + members: [person1, person2] + in_ala: true + spm_units: + family: + members: [person1, person2] + output: + ca_ala_general_assistance_personal_property_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.yaml index f1e9951ca66..73587c73aa0 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.yaml @@ -178,3 +178,31 @@ members: [person1] output: ca_cc_general_assistance_personal_property_eligible: false + +- name: Cash and personal property at the limit pass + period: 2026-01 + input: + in_cc: true + bank_account_assets: 149.24 + personal_property: 350.76 + output: + ca_cc_general_assistance_personal_property_eligible: true + +- name: Cash and personal property a cent over the limit fail + period: 2026-01 + input: + in_cc: true + bank_account_assets: 149.24 + personal_property: 350.77 + output: + ca_cc_general_assistance_personal_property_eligible: false + +- name: Property and vehicle equity above the limit by a fraction of a cent fail + period: 2026-01 + input: + in_cc: true + personal_property: 399.99 + household_vehicles_owned: 3 + household_vehicles_value: 150.02 + output: + ca_cc_general_assistance_personal_property_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/cash/la_general_relief_cash_asset_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/cash/la_general_relief_cash_asset_eligible.yaml index d1e03832490..ec87e11398b 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/cash/la_general_relief_cash_asset_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/cash/la_general_relief_cash_asset_eligible.yaml @@ -15,3 +15,89 @@ la_general_relief_cash_asset_limit: 100 output: la_general_relief_cash_asset_eligible: true + +- name: A single applicant's accounts at the limit pass + period: 2026 + input: + in_la: true + bank_account_assets: 29.54 + stock_assets: 5.73 + bond_assets: 64.73 + output: + la_general_relief_cash_asset_eligible: true + +- name: A single applicant's accounts a cent over the limit fail + period: 2026 + input: + in_la: true + bank_account_assets: 29.54 + stock_assets: 5.73 + bond_assets: 64.74 + output: + la_general_relief_cash_asset_eligible: false + +- name: A married couple's accounts at the limit pass + period: 2026 + input: + people: + person1: + bank_account_assets: 59.08 + stock_assets: 11.46 + bond_assets: 129.46 + is_tax_unit_head: true + person2: + age: 40 + is_tax_unit_spouse: true + households: + home: + members: [person1, person2] + in_la: true + spm_units: + family: + members: [person1, person2] + output: + la_general_relief_cash_asset_eligible: true + +- name: A married couple's accounts a cent over the limit fail + period: 2026 + input: + people: + person1: + bank_account_assets: 59.08 + stock_assets: 11.46 + bond_assets: 129.47 + is_tax_unit_head: true + person2: + age: 40 + is_tax_unit_spouse: true + households: + home: + members: [person1, person2] + in_la: true + spm_units: + family: + members: [person1, person2] + output: + la_general_relief_cash_asset_eligible: false + +- name: A recipient's accounts at the limit pass + period: 2026 + input: + in_la: true + bank_account_assets: 32.56 + stock_assets: 1084.18 + bond_assets: 383.26 + la_general_relief_recipient: true + output: + la_general_relief_cash_asset_eligible: true + +- name: A recipient's accounts a cent over the limit fail + period: 2026 + input: + in_la: true + bank_account_assets: 32.56 + stock_assets: 1084.18 + bond_assets: 383.27 + la_general_relief_recipient: true + output: + la_general_relief_cash_asset_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/la_general_relief_home_value_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/la_general_relief_home_value_eligible.yaml index d6293bafaec..2db130bc864 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/la_general_relief_home_value_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/la/general_relief/eligible/la_general_relief_home_value_eligible.yaml @@ -13,3 +13,41 @@ assessed_property_value: 34_001 output: la_general_relief_home_value_eligible: false + +- name: Two shares of a home's assessed value at the limit pass + period: 2026 + input: + people: + person1: + primary_residence_value: 1754.76 + person2: + primary_residence_value: 32245.24 + households: + home: + members: [person1, person2] + in_la: true + state_code: CA + spm_units: + family: + members: [person1, person2] + output: + la_general_relief_home_value_eligible: true + +- name: Two shares of a home's assessed value a cent over the limit fail + period: 2026 + input: + people: + person1: + primary_residence_value: 1754.76 + person2: + primary_residence_value: 32245.25 + households: + home: + members: [person1, person2] + in_la: true + state_code: CA + spm_units: + family: + members: [person1, person2] + output: + la_general_relief_home_value_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.yaml index bb5a88b23e9..68f11290066 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.yaml @@ -44,3 +44,23 @@ ca_marin_general_relief_liquid_asset_limit: 800 output: ca_marin_general_relief_liquid_asset_eligible: false + +- name: Three accounts at the limit pass + period: 2026-01 + input: + in_marin: true + bank_account_assets: 118.16 + stock_assets: 22.92 + bond_assets: 258.92 + output: + ca_marin_general_relief_liquid_asset_eligible: true + +- name: Three accounts a cent over the limit fail + period: 2026-01 + input: + in_marin: true + bank_account_assets: 118.16 + stock_assets: 22.92 + bond_assets: 258.93 + output: + ca_marin_general_relief_liquid_asset_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.yaml index f7f31b6c968..94aed078729 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.yaml @@ -170,3 +170,53 @@ output: # 101 + 500 = 601 (over the limit). ca_marin_general_relief_personal_property_eligible: false + +- name: A married couple's property values at the limit pass + period: 2026-01 + input: + people: + person1: + personal_property: 1178.9 + is_tax_unit_head: true + person2: + personal_property: 21.1 + is_tax_unit_spouse: true + households: + home: + members: [person1, person2] + in_marin: true + spm_units: + family: + members: [person1, person2] + output: + ca_marin_general_relief_personal_property_eligible: true + +- name: A married couple's property values a cent over the limit fail + period: 2026-01 + input: + people: + person1: + personal_property: 1178.9 + is_tax_unit_head: true + person2: + personal_property: 21.11 + is_tax_unit_spouse: true + households: + home: + members: [person1, person2] + in_marin: true + spm_units: + family: + members: [person1, person2] + output: + ca_marin_general_relief_personal_property_eligible: false + +- name: Property and vehicle equity above the limit by a fraction of a cent fail + period: 2026-01 + input: + in_marin: true + personal_property: 499.99 + household_vehicles_owned: 3 + household_vehicles_value: 150.02 + output: + ca_marin_general_relief_personal_property_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.yaml index e54f5fe65e9..cc88f101b75 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.yaml @@ -1,4 +1,4 @@ -- name: Vehicle value below the exclusion has no countable value. +- name: A vehicle at the exemption threshold is fully excluded. period: 2026 input: household_vehicles_value: 4_650 @@ -6,11 +6,33 @@ output: ca_oc_general_relief_countable_vehicle_value: 0 -- name: Vehicle value above the exclusion counts the excess. +- name: A vehicle above the exemption threshold counts in full. period: 2026 input: household_vehicles_value: 4_800 in_oc: true output: - # 4,800 - 4,650 exclusion = 150. - ca_oc_general_relief_countable_vehicle_value: 150 + # 4,800 > 4,650, so all 4,800 is countable. + ca_oc_general_relief_countable_vehicle_value: 4_800 + +# With only aggregate equity, model one vehicle worth 4,650. It is +# at the exemption threshold, so 4,650 - 4,650 = 0 is countable. +- name: A multi-vehicle total uses the aggregate exemption fallback + period: 2026 + input: + household_vehicles_owned: 2 + household_vehicles_value: 4_650 + in_oc: true + output: + ca_oc_general_relief_countable_vehicle_value: 0 + +# 4,700 in gross value minus 4,700 in secured debt leaves no net equity. +- name: A fully encumbered vehicle has no countable equity + period: 2026 + input: + household_vehicles_owned: 1 + household_vehicles_value: 4_700 + household_vehicles_debt: 4_700 + in_oc: true + output: + ca_oc_general_relief_countable_vehicle_value: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.yaml index eb968ca523d..b68b7332877 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.yaml @@ -1,10 +1,10 @@ # Resource check (Sec 60.2.a): countable personal property -- cash plus vehicle -# value above the $4,650 exclusion (Sec 60.4.c) -- must not exceed $1,000. +# value if the vehicle exceeds $4,650 (Sec 60.4.c) -- must not exceed $1,000. - name: Cash at the limit with a fully excluded vehicle passes. period: 2026-01 input: spm_unit_cash_assets: 1_000 - household_vehicles_value: 4_650 # 4,650 - 4,650 = 0 countable + household_vehicles_value: 4_650 # 4,650 is fully exempt in_oc: true output: ca_oc_general_relief_resources_eligible: true @@ -17,18 +17,193 @@ output: ca_oc_general_relief_resources_eligible: false -- name: A vehicle a little over the exclusion still passes. +- name: A $5,000 vehicle is fully countable and fails. period: 2026-01 input: - household_vehicles_value: 5_000 # 5,000 - 4,650 = 350 countable <= 1,000 + household_vehicles_value: 5_000 # 5,000 countable > 1,000 in_oc: true + output: + ca_oc_general_relief_resources_eligible: false + +- name: A $6,000 vehicle is fully countable and fails. + period: 2026-01 + input: + household_vehicles_value: 6_000 # 6,000 countable > 1,000 + in_oc: true + output: + ca_oc_general_relief_resources_eligible: false + +# 517.05 + 5,132.95 = 5,650.00 because the vehicle exceeds 4,650. +- name: Cash and a vehicle above the exemption exceed the limit + period: 2026-01 + input: + in_oc: true + bank_account_assets: 517.05 + household_vehicles_value: 5132.95 + output: + ca_oc_general_relief_resources_eligible: false + +# 517.05 + 5,132.96 = 5,650.01 of countable property. +- name: A one-cent increase in nonexempt vehicle equity still fails + period: 2026-01 + input: + in_oc: true + bank_account_assets: 517.05 + household_vehicles_value: 5132.96 + output: + ca_oc_general_relief_resources_eligible: false + + +# 8.87 + 693.71 + 297.42 = 1,000.00. The 4,650 vehicle is fully exempt. +- name: Split cash at the limit with a fully exempt vehicle passes + period: 2026-01 + input: + in_oc: true + bank_account_assets: 8.87 + stock_assets: 693.71 + bond_assets: 297.42 + household_vehicles_owned: 1 + household_vehicles_value: 4_650 output: ca_oc_general_relief_resources_eligible: true -- name: A vehicle whose value over the exclusion exceeds the limit fails. +# Exclude the 4,650 vehicle. 100 + 900 = 1,000. +- name: One of two vehicles is exempt at the property limit period: 2026-01 input: - household_vehicles_value: 6_000 # 6,000 - 4,650 = 1,350 countable > 1,000 in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_750 + ca_oc_general_relief_exempt_vehicle_equity: 4_650 + spm_unit_cash_assets: 900 + output: + ca_oc_general_relief_resources_eligible: true + +# Exclude the 4,650 vehicle. 100 + 900.01 = 1,000.01. +- name: One of two vehicles is exempt just above the property limit + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_750 + ca_oc_general_relief_exempt_vehicle_equity: 4_650 + spm_unit_cash_assets: 900.01 output: ca_oc_general_relief_resources_eligible: false + +# Exclude the 4,550 vehicle. 100 + 900 = 1,000. +- name: The second vehicle counts at the limit when both vehicles qualify + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_650 + ca_oc_general_relief_exempt_vehicle_equity: 4_550 + spm_unit_cash_assets: 900 + output: + ca_oc_general_relief_resources_eligible: true + +# Exclude the 4,550 vehicle. 100 + 900.01 = 1,000.01. +- name: The second vehicle counts when both vehicles qualify for the exemption + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_650 + ca_oc_general_relief_exempt_vehicle_equity: 4_550 + spm_unit_cash_assets: 900.01 + output: + ca_oc_general_relief_resources_eligible: false + +# 4,650 + 0.01 = 4,650.01. After the exemption, 0.01 + 999.99 = 1,000. +- name: A second vehicle with one cent of equity leaves property at the limit + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_650.01 + ca_oc_general_relief_exempt_vehicle_equity: 4_650 + spm_unit_cash_assets: 999.99 + output: + ca_oc_general_relief_resources_eligible: true + +# 4,650 + 0.01 = 4,650.01. After the exemption, 0.01 + 1,000 = 1,000.01. +- name: A second vehicle with one cent of equity takes property above the limit + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_650.01 + ca_oc_general_relief_exempt_vehicle_equity: 4_650 + spm_unit_cash_assets: 1_000 + output: + ca_oc_general_relief_resources_eligible: false + +# 2,325 + 2,325.01 = 4,650.01 too. After the exemption, 2,325 + 999.99 = 3,324.99. +- name: The same total vehicle equity can leave more countable property + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_650.01 + ca_oc_general_relief_exempt_vehicle_equity: 2_325.01 + spm_unit_cash_assets: 999.99 + output: + ca_oc_general_relief_resources_eligible: false + +# 4,650.01 - 0.01 of secured debt = 4,650 in exempt equity. +- name: A financed vehicle at the net equity threshold is exempt + period: 2026-01 + input: + in_oc: true + household_vehicles_owned: 1 + household_vehicles_value: 4_650.01 + household_vehicles_debt: 0.01 + household_vehicles_equity: 4_650 + spm_unit_cash_assets: 1_000 + output: + ca_oc_general_relief_resources_eligible: true + +# Without individual vehicle values, the 4,650 total stands in for one vehicle. +# The fallback exempts all 4,650, leaving 900 in modeled countable property. +- name: Aggregate vehicle equity at the exemption qualifies without a breakdown + period: 2026 + input: + in_oc: true + household_vehicles_owned: 2 + household_vehicles_value: 4_650 + spm_unit_cash_assets: 900 + output: + ca_oc_general_relief_resources_eligible: true + ca_oc_general_relief_countable_property: 900 + +# Reported zero equity leaves 1,000 of countable cash in the first household. +# Without net equity or debt, the other household has 5,000 + 1,000 = 6,000. +- name: Reported zero net equity is distinct from omitted equity + period: 2026 + input: + people: + first: {} + second: {} + households: + first: + members: [first] + in_oc: true + household_vehicles_owned: 1 + household_vehicles_value: 5_000 + household_vehicles_equity: 0 + second: + members: [second] + in_oc: true + household_vehicles_owned: 1 + household_vehicles_value: 5_000 + spm_units: + first: + members: [first] + spm_unit_cash_assets: 1_000 + second: + members: [second] + spm_unit_cash_assets: 1_000 + output: + ca_oc_general_relief_resources_eligible: [true, false] + ca_oc_general_relief_countable_property: [1_000, 6_000] diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.yaml index a9e5f0ca4ea..64fe99a9d66 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.yaml @@ -248,3 +248,99 @@ output: # 50 <= 50 regardless of unit size. ca_sbd_general_relief_resources_eligible: true + +- name: Three accounts at the limit pass + period: 2026-01 + input: + in_sbd: true + bank_account_assets: 38.49 + stock_assets: 0.37 + bond_assets: 11.14 + output: + ca_sbd_general_relief_resources_eligible: true + +- name: Three accounts a cent over the limit fail + period: 2026-01 + input: + in_sbd: true + bank_account_assets: 38.49 + stock_assets: 0.37 + bond_assets: 11.15 + output: + ca_sbd_general_relief_resources_eligible: false + +- name: Cash and personal property at the limit pass + period: 2026-01 + input: + people: + person1: + bank_account_assets: 38.79 + personal_property: 128.82 + person2: + personal_property: 332.39 + households: + home: + members: [person1, person2] + in_sbd: true + spm_units: + family: + members: [person1, person2] + output: + ca_sbd_general_relief_resources_eligible: true + +- name: Cash and personal property a cent over the limit fail + period: 2026-01 + input: + people: + person1: + bank_account_assets: 38.79 + personal_property: 128.82 + person2: + personal_property: 332.4 + households: + home: + members: [person1, person2] + in_sbd: true + spm_units: + family: + members: [person1, person2] + output: + ca_sbd_general_relief_resources_eligible: false + +- name: Two shares of assessed real property at the limit pass + period: 2026-01 + input: + people: + person1: + primary_residence_value: 25763.47 + person2: + primary_residence_value: 6236.53 + households: + home: + members: [person1, person2] + in_sbd: true + state_code: CA + spm_units: + family: + members: [person1, person2] + output: + ca_sbd_general_relief_resources_eligible: true + +- name: Two shares of assessed real property a cent over the limit fail + period: 2026-01 + input: + people: + person1: + primary_residence_value: 25763.47 + person2: + primary_residence_value: 6236.54 + households: + home: + members: [person1, person2] + in_sbd: true + state_code: CA + spm_units: + family: + members: [person1, person2] + output: + ca_sbd_general_relief_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/scc/ga/ca_scc_general_assistance_personal_property_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/scc/ga/ca_scc_general_assistance_personal_property_eligible.yaml index 2a362a6559f..e8bf9c88ef1 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/scc/ga/ca_scc_general_assistance_personal_property_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/scc/ga/ca_scc_general_assistance_personal_property_eligible.yaml @@ -131,3 +131,33 @@ in_scc: true output: ca_scc_general_assistance_personal_property_eligible: false + +- name: Three accounts at the limit pass + period: 2026-01 + input: + in_scc: true + bank_account_assets: 202.47 + stock_assets: 11.89 + bond_assets: 285.64 + output: + ca_scc_general_assistance_personal_property_eligible: true + +- name: Three accounts a cent over the limit fail + period: 2026-01 + input: + in_scc: true + bank_account_assets: 202.47 + stock_assets: 11.89 + bond_assets: 285.65 + output: + ca_scc_general_assistance_personal_property_eligible: false + +- name: Property and vehicle equity above the limit by a fraction of a cent fail + period: 2026-01 + input: + in_scc: true + personal_property: 399.99 + household_vehicles_owned: 3 + household_vehicles_value: 150.02 + output: + ca_scc_general_assistance_personal_property_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.yaml index 88391121f5a..ada4d0ecb44 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.yaml @@ -145,3 +145,27 @@ output: # Budget unit size 2 selects the $3,000 couple limit, so $2,500 is eligible. ca_sf_caap_personal_property_eligible: true + +- name: A single applicant's accounts at the limit pass + period: 2026-01 + input: + county_str: SAN_FRANCISCO_COUNTY_CA + age: 40 + immigration_status: CITIZEN + bank_account_assets: 1157.81 + stock_assets: 285.17 + bond_assets: 557.02 + output: + ca_sf_caap_personal_property_eligible: true + +- name: A single applicant's accounts a cent over the limit fail + period: 2026-01 + input: + county_str: SAN_FRANCISCO_COUNTY_CA + age: 40 + immigration_status: CITIZEN + bank_account_assets: 1157.81 + stock_assets: 285.17 + bond_assets: 557.03 + output: + ca_sf_caap_personal_property_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.yaml index 39cf7db02f0..57387bd8788 100644 --- a/policyengine_us/tests/policy/baseline/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.yaml @@ -29,3 +29,77 @@ ca_smc_general_assistance_countable_property: 1_463 output: ca_smc_general_assistance_property_eligible: true + +- name: Two people's accounts at the limit fail + period: 2026 + input: + people: + person1: + bank_account_assets: 259.18 + person2: + bank_account_assets: 1175.69 + stock_assets: 29.13 + households: + home: + members: [person1, person2] + in_smc: true + spm_units: + family: + members: [person1, person2] + output: + ca_smc_general_assistance_property_eligible: false + +- name: Two people's accounts a cent under the limit pass + period: 2026 + input: + people: + person1: + bank_account_assets: 259.18 + person2: + bank_account_assets: 1175.69 + stock_assets: 29.12 + households: + home: + members: [person1, person2] + in_smc: true + spm_units: + family: + members: [person1, person2] + output: + ca_smc_general_assistance_property_eligible: true + +# This case assumes the model's average-value proxy and deduction. +# 999.99 + (5,088.01 x 2/3 - 2,928) = 1,463.99666..., below 1,464. +- name: Cash and modeled vehicle equity below the limit by a fraction of a cent pass + period: 2026 + input: + in_smc: true + bank_account_assets: 999.99 + household_vehicles_owned: 3 + household_vehicles_value: 5088.01 + output: + ca_smc_general_assistance_property_eligible: true + + +# These cases use the model's combined-equity deduction. +# 1,463.87 + (5,856.26 / 2 - 2,928) = 1,464.00. The limit is strict. +- name: Cash and modeled vehicle equity at the strict property limit fail + period: 2026 + input: + in_smc: true + bank_account_assets: 1_463.87 + household_vehicles_owned: 2 + household_vehicles_value: 5_856.26 + output: + ca_smc_general_assistance_property_eligible: false + +# 1,463.86 + (5,856.26 / 2 - 2,928) = 1,463.99. +- name: Cash and modeled vehicle equity one cent below the property limit pass + period: 2026 + input: + in_smc: true + bank_account_assets: 1_463.86 + household_vehicles_owned: 2 + household_vehicles_value: 5_856.26 + output: + ca_smc_general_assistance_property_eligible: true diff --git a/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.yaml b/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.yaml index 135ef34692f..b3a09ddbd29 100644 --- a/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.yaml +++ b/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.yaml @@ -397,6 +397,346 @@ ssi_resources_deemed_from_ineligible_parent: [0, 500, 0, 500, 0, 500] meets_ssi_resource_test: [false, true, false, true, false, false] +# 20 CFR 416.1202(b)(1), 416.1205: the child's 575.52 + 570.57 + 353.91 = +# 1,500.00 plus parental excess 2,500 - 2,000 = 500 is 2,000.00, at the +# individual limit. The child's float32 balances add to 1,500.0001 unless +# rounded to cents. +- name: Child accounts plus parental excess that total exactly the limit pass + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_500 + child: + age: 16 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + tax_units: + tax_unit: + members: [parent, child] + marital_units: + parent_unit: + members: [parent] + child_unit: + members: [child] + households: + household: + members: [parent, child] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 500] + meets_ssi_resource_test: [false, true] + +# The child's 575.52 + 570.57 + 353.92 = 1,500.01 plus the same 500 is +# 2,000.01, a cent over the individual limit. +- name: Child accounts plus parental excess a cent over the limit fail + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_500 + child: + age: 16 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.92 + tax_units: + tax_unit: + members: [parent, child] + marital_units: + parent_unit: + members: [parent] + child_unit: + members: [child] + households: + household: + members: [parent, child] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 500] + meets_ssi_resource_test: [false, false] + +# POMS SI 01330.200 B: 'equally divide the value of the deemed resources +# among those children'; 20 CFR 416.1202(b)(1) sets no rounding rule for a +# child's share. The parent's 2,100 is 100 over the individual limit, so +# each of three children is deemed 100 / 3 = 33.3333. Each child holds +# 1,966.67 in one account, so the total of 2,000.0033 is over the limit. +- name: A share of parental excess counts to the fraction of a cent + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_100 + child1: + age: 8 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_966.67 + child2: + age: 10 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_966.67 + child3: + age: 12 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_966.67 + tax_units: + tax_unit: + members: [parent, child1, child2, child3] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + households: + household: + members: [parent, child1, child2, child3] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 33.3333, 33.3333, 33.3333] + meets_ssi_resource_test: [false, false, false, false] + +# SI 01330.200 B: when a child is ineligible, 'divide the value of the deemed +# resources among the remaining eligible children'. The first child's +# 1,966.67 plus the exact share of 33.3333 is over the limit, so that child +# leaves the division and keeps the share last tested; the other two +# children, who hold nothing, divide the 100 as 50 each. +- name: A child whom an unrounded share takes over the limit leaves the division + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_100 + child1: + age: 8 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_966.67 + child2: + age: 10 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + child3: + age: 12 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [parent, child1, child2, child3] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + households: + household: + members: [parent, child1, child2, child3] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 33.3333, 50, 50] + meets_ssi_resource_test: [false, false, true, true] + +# The parent's 2,100 is 100 over the individual limit, which divides among +# four children as 25 each. The first child's 178.57 + 1,522.79 + 273.64 = +# 1,975.00 plus 25 is 2,000.00, at the limit. That child's float32 balances +# add to 1,975.0001 unless rounded to cents. +- name: Child accounts plus a share of parental excess that total exactly the limit pass + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_100 + child1: + age: 8 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 178.57 + stock_assets: 1_522.79 + bond_assets: 273.64 + child2: + age: 10 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + child3: + age: 12 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + child4: + age: 14 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [parent, child1, child2, child3, child4] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + child4_unit: + members: [child4] + households: + household: + members: [parent, child1, child2, child3, child4] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 25, 25, 25, 25] + meets_ssi_resource_test: [false, true, true, true, true] + +# 20 CFR 416.1202(b)(1): the parent's 2,100.01 is 100.01 over the +# individual limit, all deemed to the only child, whose 1,899.99 brings the +# total to exactly 2,000.00. Stored as the nearest float32, the 100.01 share +# would read back as 100.010002 and push that total over the limit. +- name: A whole-cent parental share that brings a child exactly to the limit passes + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_100.01 + child: + age: 16 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_899.99 + tax_units: + tax_unit: + members: [parent, child] + marital_units: + parent_unit: + members: [parent] + child_unit: + members: [child] + households: + household: + members: [parent, child] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 100.01] + meets_ssi_resource_test: [false, true] + +# SI 01330.200 B: the parent's 2,048.30 is 48.30 over the individual limit, +# which divides among three children as 16.10 each. The first child's +# 1,983.90 plus 16.10 is exactly 2,000.00, so all three stay in the division +# and pass. In float64, 2,048.30 - 2,000 gives an excess of 48.30000000000018, +# and 1,983.90 plus a third of it gives 2,000.0000000000002, which would +# remove the first child and raise the others' shares. +- name: A child whom a share reaches exactly to the limit stays in the division + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_048.30 + child1: + age: 8 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_983.90 + child2: + age: 10 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_980 + child3: + age: 12 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [parent, child1, child2, child3] + marital_units: + parent_unit: + members: [parent] + child1_unit: + members: [child1] + child2_unit: + members: [child2] + child3_unit: + members: [child3] + households: + household: + members: [parent, child1, child2, child3] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 16.10, 16.10, 16.10] + meets_ssi_resource_test: [false, true, true, true] + +# 20 CFR 416.1202(b)(1): the child's own 178.57 + 1,547.79 + 273.64 = +# 2,000.00 is at the individual limit, so the child is deemed the parent's +# 100 of excess and fails at 2,100.00. The float32 balances add to +# 2,000.0001 unless rounded to cents, which would leave the child out of the +# deeming and pass them on their own 2,000.00. +- name: A child whose own accounts total exactly the limit is still deemed the parental excess + period: 2026-01 + input: + people: + parent: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_100 + child: + age: 16 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.64 + tax_units: + tax_unit: + members: [parent, child] + marital_units: + parent_unit: + members: [parent] + child_unit: + members: [child] + households: + household: + members: [parent, child] + output: + ssi_resources_deemed_from_ineligible_parent: [0, 100] + meets_ssi_resource_test: [false, false] + # POMS SI 01330.340 White example: parent pool1200 <=couple limit3000; child deemed0. - name: POMS White eligible parent leaves no excess resources to deem period: 2024-01 @@ -2314,3 +2654,121 @@ ssi_resources_deemed_from_ineligible_parent: 2024-01: [0, 4_000, 4_000] 2024-12: [0, 2_000, 2_000] + +# 2,500 + 2,500 - 2,999.996 = 2,000.004 for the only child, above 2,000. +- name: A fractional-cent reformed parental allowance keeps its precision + period: 2026-01 + absolute_error_margin: 0.000001 + input: + people: + parent: + age: 40 + bank_account_assets: 2_500 + is_parent: true + spouse: + age: 40 + bank_account_assets: 2_500 + is_parent: true + child: + age: 12 + is_ssi_disabled: true + tax_units: + unit: + members: [parent, spouse, child] + tax_unit_is_joint: true + marital_units: + parents: + members: [parent, spouse] + child: + members: [child] + households: + home: + members: [parent, spouse, child] + state_code: CA + gov.ssa.ssi.eligibility.resources.limit.couple: 2_999.996 + output: + ssi_resources_deemed_from_ineligible_parent: [0, 0, 2_000.004] + meets_ssi_resource_test: [false, false, false] + +# 2,500 + 2,500 - 2,999.9999 = 2,000.0001, exactly the child's reformed limit. +- name: Resources exactly at a fractional-cent reformed limit pass + period: 2026-01 + absolute_error_margin: 0.000001 + input: + people: + parent: + age: 40 + bank_account_assets: 2_500 + is_parent: true + spouse: + age: 40 + bank_account_assets: 2_500 + is_parent: true + child: + age: 12 + is_ssi_disabled: true + tax_units: + unit: + members: [parent, spouse, child] + tax_unit_is_joint: true + marital_units: + parents: + members: [parent, spouse] + child: + members: [child] + households: + home: + members: [parent, spouse, child] + state_code: CA + gov.ssa.ssi.eligibility.resources.limit.couple: 2_999.9999 + gov.ssa.ssi.eligibility.resources.limit.individual: 2_000.0001 + output: + ssi_resources_deemed_from_ineligible_parent: [0, 0, 2_000.0001] + meets_ssi_resource_test: [false, false, true] + +# (2,048.31 - 2,000.0025) / 3 = 16.1025 per child. +# 1,983.90 + 16.1025 = 2,000.0025, so all three stay in the division. +- name: Three children at a fractional-cent limit keep their equal shares + period: 2026-01 + absolute_error_margin: 0.000001 + input: + people: + parent: + age: 40 + is_tax_unit_head: true + is_parent: true + bank_account_assets: 2_048.31 + child1: + age: 8 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_983.90 + child2: + age: 10 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_983.90 + child3: + age: 12 + is_ssi_aged_blind_disabled: true + is_tax_unit_dependent: true + bank_account_assets: 1_983.90 + tax_units: + unit: + members: [parent, child1, child2, child3] + marital_units: + parent: + members: [parent] + child1: + members: [child1] + child2: + members: [child2] + child3: + members: [child3] + households: + home: + members: [parent, child1, child2, child3] + gov.ssa.ssi.eligibility.resources.limit.individual: 2_000.0025 + output: + ssi_resources_deemed_from_ineligible_parent: [0, 16.1025, 16.1025, 16.1025] + meets_ssi_resource_test: [false, true, true, true] diff --git a/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.yaml b/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.yaml index 111d5625edf..2155cebbc0c 100644 --- a/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.yaml +++ b/policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.yaml @@ -326,3 +326,341 @@ ssi_resources_deemed_from_ineligible_parent: [0, 0, 0, 0, 0, 0, 0, 0, 0] ssi_resources_deemed_from_ineligible_spouse: [3001, 0, 0, 0, 0, 0, 0, 0, 0] meets_ssi_resource_test: [true, true, true, true, true, true, true, true, true] + +# 20 CFR 416.1205: 178.57 + 1,547.79 + 273.64 = 2,000.00, at the individual +# limit. The three float32 balances add to 2,000.0001 unless rounded to cents. +- name: Three accounts that total exactly the individual limit pass + period: 2026-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.64 + output: + meets_ssi_resource_test: true + +# 178.57 + 1,547.79 + 273.65 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the individual limit fail + period: 2026-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.65 + output: + meets_ssi_resource_test: false + +# 20 CFR 416.1202(a), 416.1205: the claimant's and the ineligible spouse's +# 575.52 + 570.57 + 353.91 = 1,500.00 each add to 3,000.00, at the couple +# limit. +- name: Spousal accounts that total exactly the couple limit pass + period: 2026-01 + input: + people: + claimant: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_head: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + spouse: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_spouse: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + tax_units: + family: + members: [claimant, spouse] + marital_units: + family_couple_0: + members: [claimant, spouse] + households: + family: + members: [claimant, spouse] + output: + ssi_claim_is_joint: [false, false] + meets_ssi_resource_test: [true, true] + +# The spouse's 575.52 + 570.57 + 353.92 = 1,500.01 makes 3,000.01, a cent +# over the couple limit. The spouse, who isn't aged, blind or disabled, is +# tested alone against the individual limit and passes. +- name: Spousal accounts a cent over the couple limit fail + period: 2026-01 + input: + people: + claimant: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_head: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + spouse: + age: 40 + is_ssi_aged_blind_disabled: false + is_tax_unit_spouse: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.92 + tax_units: + family: + members: [claimant, spouse] + marital_units: + family_couple_0: + members: [claimant, spouse] + households: + family: + members: [claimant, spouse] + output: + ssi_claim_is_joint: [false, false] + meets_ssi_resource_test: [false, true] + +# Each spouse holds 575.52 + 570.57 + 353.91 = 1,500.00. +- name: Joint claim accounts that total exactly the couple limit pass + period: 2026-01 + input: + people: + claimant: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_head: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + spouse: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_spouse: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + tax_units: + family: + members: [claimant, spouse] + marital_units: + family_couple_0: + members: [claimant, spouse] + households: + family: + members: [claimant, spouse] + output: + ssi_claim_is_joint: [true, true] + meets_ssi_resource_test: [true, true] + +# The spouse's 575.52 + 570.57 + 353.92 = 1,500.01 makes 3,000.01, a cent +# over the couple limit. +- name: Joint claim accounts a cent over the couple limit fail + period: 2026-01 + input: + people: + claimant: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_head: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.91 + spouse: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_spouse: true + bank_account_assets: 575.52 + stock_assets: 570.57 + bond_assets: 353.92 + tax_units: + family: + members: [claimant, spouse] + marital_units: + family_couple_0: + members: [claimant, spouse] + households: + family: + members: [claimant, spouse] + output: + ssi_claim_is_joint: [true, true] + meets_ssi_resource_test: [false, false] + + +# (104,400.01 - 2,000) / 100 = 1,024.0001. The first child's 976 +# makes 2,000.0001, so they fail and the other 99 divide the excess. +- name: A child with resources a fraction of a cent over the limit fails + period: 2026-01 + input: + people: + parent: + age: 40 + is_parent: true + is_tax_unit_head: true + bank_account_assets: 104_400.01 + child00: + <<: &child + age: 10 + is_ssi_disabled: true + is_tax_unit_dependent: true + ssi_countable_income_monthly: 0 + bank_account_assets: 976 + child01: *child + child02: *child + child03: *child + child04: *child + child05: *child + child06: *child + child07: *child + child08: *child + child09: *child + child10: *child + child11: *child + child12: *child + child13: *child + child14: *child + child15: *child + child16: *child + child17: *child + child18: *child + child19: *child + child20: *child + child21: *child + child22: *child + child23: *child + child24: *child + child25: *child + child26: *child + child27: *child + child28: *child + child29: *child + child30: *child + child31: *child + child32: *child + child33: *child + child34: *child + child35: *child + child36: *child + child37: *child + child38: *child + child39: *child + child40: *child + child41: *child + child42: *child + child43: *child + child44: *child + child45: *child + child46: *child + child47: *child + child48: *child + child49: *child + child50: *child + child51: *child + child52: *child + child53: *child + child54: *child + child55: *child + child56: *child + child57: *child + child58: *child + child59: *child + child60: *child + child61: *child + child62: *child + child63: *child + child64: *child + child65: *child + child66: *child + child67: *child + child68: *child + child69: *child + child70: *child + child71: *child + child72: *child + child73: *child + child74: *child + child75: *child + child76: *child + child77: *child + child78: *child + child79: *child + child80: *child + child81: *child + child82: *child + child83: *child + child84: *child + child85: *child + child86: *child + child87: *child + child88: *child + child89: *child + child90: *child + child91: *child + child92: *child + child93: *child + child94: *child + child95: *child + child96: *child + child97: *child + child98: *child + child99: *child + households: + home: + members: &members [ + parent, child00, child01, child02, child03, child04, child05, child06, + child07, child08, child09, child10, child11, child12, child13, child14, + child15, child16, child17, child18, child19, child20, child21, child22, + child23, child24, child25, child26, child27, child28, child29, child30, + child31, child32, child33, child34, child35, child36, child37, child38, + child39, child40, child41, child42, child43, child44, child45, child46, + child47, child48, child49, child50, child51, child52, child53, child54, + child55, child56, child57, child58, child59, child60, child61, child62, + child63, child64, child65, child66, child67, child68, child69, child70, + child71, child72, child73, child74, child75, child76, child77, child78, + child79, child80, child81, child82, child83, child84, child85, child86, + child87, child88, child89, child90, child91, child92, child93, child94, + child95, child96, child97, child98, child99 + ] + tax_units: + unit: + members: *members + output: + meets_ssi_resource_test: [ + false, false, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true + ] + +# The float32 sum of 575.52 + 570.57 + 353.91 can store 1,500.0001220703125. +# The two underlying 1,500.00 balances add to the 3,000.00 joint limit. +- name: Joint claim totals with float32 drift pass at the couple limit + period: 2026-01 + input: + people: + claimant: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_head: true + ssi_countable_resources: 1_500.0001220703125 + spouse: + age: 40 + is_ssi_aged_blind_disabled: true + is_tax_unit_spouse: true + ssi_countable_resources: 1_500.0001220703125 + tax_units: + family: + members: [claimant, spouse] + marital_units: + family_couple_0: + members: [claimant, spouse] + households: + family: + members: [claimant, spouse] + output: + ssi_claim_is_joint: [true, true] + meets_ssi_resource_test: [true, true] diff --git a/policyengine_us/tests/policy/baseline/gov/states/ak/dpa/atap/ak_atap_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ak/dpa/atap/ak_atap_resources_eligible.yaml index 7c1b7871e76..cdf490fab39 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ak/dpa/atap/ak_atap_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ak/dpa/atap/ak_atap_resources_eligible.yaml @@ -188,3 +188,28 @@ # Elderly, limit is $3,000 # $3,000 = $3,000 = eligible ak_atap_resources_eligible: true + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: AK + output: + ak_atap_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: AK + output: + ak_atap_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ar/dhs/tea/ar_tea_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ar/dhs/tea/ar_tea_resources_eligible.yaml index 3ff73c08f4c..35116efc03b 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ar/dhs/tea/ar_tea_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ar/dhs/tea/ar_tea_resources_eligible.yaml @@ -95,3 +95,28 @@ output: ar_tea_resources_eligible: false # 10,000 > 3,000 -> ineligible + +# 798.28 + 2,187.62 + 14.10 = 3,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 3,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.10 + state_code: AR + output: + ar_tea_resources_eligible: true + +# 798.28 + 2,187.62 + 14.11 = 3,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.11 + state_code: AR + output: + ar_tea_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/az/hhs/tanf/az_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/az/hhs/tanf/az_tanf_resources_eligible.yaml index 253c6e15d87..13ad274e098 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/az/hhs/tanf/az_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/az/hhs/tanf/az_tanf_resources_eligible.yaml @@ -100,3 +100,28 @@ output: # $5,000 > $2,000 limit az_tanf_resources_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: AZ + output: + az_tanf_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: AZ + output: + az_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.yaml index e21c6962b06..2e7d8d9d241 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.yaml @@ -33,3 +33,32 @@ state_code: CA output: ca_capi_resource_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: CA + output: + ca_capi_resource_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: CA + output: + ca_capi_resource_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.yaml index 56a3befc19b..741e139b403 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.yaml @@ -143,3 +143,28 @@ # Resources: 14,000 + 501 = 14,501 exceeds the lower resource limit # but stays within the higher limit for households with an elderly member ca_tanf_resources_eligible: true + +# 8,441.48 + 8.48 + 3,687.04 = 12,137.00, at the limit. +# The float32 balances add to a fraction of a cent above 12,137 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025 + input: + age: 30 + bank_account_assets: 8_441.48 + stock_assets: 8.48 + bond_assets: 3_687.04 + state_code: CA + output: + ca_tanf_resources_eligible: true + +# 8,441.48 + 8.48 + 3,687.05 = 12,137.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025 + input: + age: 30 + bank_account_assets: 8_441.48 + stock_assets: 8.48 + bond_assets: 3_687.05 + state_code: CA + output: + ca_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_deemed_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_deemed_income.yaml index 33a76e95643..b47e078a14f 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_deemed_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_deemed_income.yaml @@ -682,3 +682,41 @@ state_code: NV output: co_oap_deemed_income: [319, 0] + +# The applicant's own 1,500 is below 2,000. The decree excludes the spouse's +# 2,000 of resources and 36,000 / 12 = 3,000 in monthly wages. With zero deemed +# and own income, the applicant receives 1,032 x 12 = 12,384 for 2026. +- name: A decree reported by the nonapplicant stops spousal income deeming + period: 2026 + input: + people: + applicant: + age: 60 + bank_account_assets: 1_500 + spouse: + age: 55 + bank_account_assets: 2_000 + employment_income: 36_000 + is_separated_under_decree: true + marital_units: + couple: + members: [applicant, spouse] + tax_units: + first: + members: [applicant] + filing_status: SEPARATE + second: + members: [spouse] + filing_status: SEPARATE + households: + first: + members: [applicant] + state_code: CO + second: + members: [spouse] + state_code: CO + output: + co_oap_eligible: [true, false] + co_oap_deemed_income: + 2026-01: [0, 0] + co_oap: [12_384, 0] diff --git a/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_eligible.yaml index 88b99f6d860..9366e9833a8 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/co/ssa/oap/co_oap_eligible.yaml @@ -38,12 +38,209 @@ output: co_oap_eligible: true -- name: Eligible couple +- name: A couple at the $3,000 limit fails period: 2023 input: age: 60 ssi_countable_resources: 3_000 ssi_claim_is_joint: true state_code: CO + output: + co_oap_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the single limit. +- name: Three accounts that total exactly the resource limit pass + period: 2025 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: CO + output: + co_oap_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: CO + output: + co_oap_eligible: false + + +# 2,607.87 + 29.87 + 362.26 + 1,000 = 4,000, above the 3,000 married limit. +- name: Spouses with combined resources above the married limit both fail + period: 2026 + input: + people: + head: + age: 70 + is_tax_unit_head: true + bank_account_assets: 2_607.87 + stock_assets: 29.87 + bond_assets: 362.26 + spouse: + age: 70 + is_tax_unit_spouse: true + bank_account_assets: 1_000 + marital_units: + couple: + members: [head, spouse] + tax_units: + couple: + members: [head, spouse] + tax_unit_is_joint: true + households: + home: + members: [head, spouse] + state_code: CO + output: + co_oap_eligible: [false, false] + +# 1,157.81 + 285.17 + 557.01 = 1,999.99, below the 2,000 single limit. +- name: Three accounts one cent below the single limit pass + period: 2025 + input: + age: 70 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.01 + state_code: CO output: co_oap_eligible: true + +# 2,499.99 + 500 = 2,999.99, below the 3,000 married limit. +- name: Intact separately filing spouses living apart pass just below the limit + period: 2026 + input: + people: + applicant: + age: 70 + bank_account_assets: 2_499.99 + spouse: + age: 55 + bank_account_assets: 500 + marital_units: + couple: + members: [applicant, spouse] + tax_units: + first: + members: [applicant] + filing_status: SEPARATE + second: + members: [spouse] + filing_status: SEPARATE + households: + first: + members: [applicant] + state_code: CO + second: + members: [spouse] + state_code: CO + output: + co_oap_eligible: [true, false] + +# 2,500 + 500 = 3,000, which equals the strict married limit. +- name: Intact separately filing spouses at the married limit fail + period: 2026 + input: + people: + applicant: + age: 70 + bank_account_assets: 2_500 + spouse: + age: 55 + bank_account_assets: 500 + marital_units: + couple: + members: [applicant, spouse] + tax_units: + first: + members: [applicant] + filing_status: SEPARATE + second: + members: [spouse] + filing_status: SEPARATE + households: + home: + members: [applicant, spouse] + state_code: CO + output: + co_oap_eligible: [false, false] + +# The applicant's 1,500 is below the 2,000 single limit. +# The legally separated spouse's 2,000 is separately owned. +- name: Legal separation excludes the nonrecipient spouse's resources + period: 2026 + input: + people: + applicant: + age: 70 + bank_account_assets: 1_500 + is_separated_under_decree: true + spouse: + age: 55 + bank_account_assets: 2_000 + is_separated_under_decree: true + marital_units: + couple: + members: [applicant, spouse] + tax_units: + first: + members: [applicant] + filing_status: SEPARATE + second: + members: [spouse] + filing_status: SEPARATE + households: + first: + members: [applicant] + state_code: CO + second: + members: [spouse] + state_code: CO + output: + co_oap_eligible: [true, false] + +# Count only the applicant's 2,000 after legal separation. That equals the +# strict unmarried limit, so neither person receives a grant. +- name: Legally separated applicant at the strict unmarried limit fails + period: 2026 + input: + people: + applicant: + age: 60 + bank_account_assets: 2_000 + is_separated_under_decree: true + spouse: + age: 55 + bank_account_assets: 2_000 + marital_units: + couple: + members: [applicant, spouse] + tax_units: + first: + members: [applicant] + filing_status: SEPARATE + second: + members: [spouse] + filing_status: SEPARATE + households: + first: + members: [applicant] + state_code: CO + second: + members: [spouse] + state_code: CO + output: + co_oap_eligible: [false, false] + co_oap: [0, 0] diff --git a/policyengine_us/tests/policy/baseline/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.yaml index a9f4e38cfe7..4b1893da68b 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.yaml @@ -247,3 +247,32 @@ 2026: CT output: ct_ssp_resource_eligible: [true, true, true] + +# 1,079.68 + 511.39 + 8.93 = 1,600.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,600 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_079.68 + stock_assets: 511.39 + bond_assets: 8.93 + state_code: CT + output: + ct_ssp_resource_eligible: true + +# 1,079.68 + 511.39 + 8.94 = 1,600.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_079.68 + stock_assets: 511.39 + bond_assets: 8.94 + state_code: CT + output: + ct_ssp_resource_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.yaml index 9fbf36fe64d..65e8bf5fdc3 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.yaml @@ -123,3 +123,28 @@ output: # $5,000 > $3,000 old limit, ineligible before 10/1/2023 ct_tfa_resources_eligible: false + +# 4,489.49 + 1,282.41 + 228.10 = 6,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 6,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_489.49 + stock_assets: 1_282.41 + bond_assets: 228.10 + state_code: CT + output: + ct_tfa_resources_eligible: true + +# 4,489.49 + 1,282.41 + 228.11 = 6,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_489.49 + stock_assets: 1_282.41 + bond_assets: 228.11 + state_code: CT + output: + ct_tfa_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.yaml index f316a3c6abd..004e26a22b4 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.yaml @@ -35,3 +35,28 @@ bank_account_assets: 2_001 output: dc_tanf_resources_eligible: false + +# 798.28 + 2,187.62 + 14.10 = 3,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 3,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.10 + state_code: DC + output: + dc_tanf_resources_eligible: true + +# 798.28 + 2,187.62 + 14.11 = 3,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.11 + state_code: DC + output: + dc_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.yaml index 42366652f8c..8a0d4c517f6 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.yaml @@ -72,3 +72,28 @@ output: # $10,001 > $10,000 limit → ineligible de_tanf_resources_eligible: false + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: DE + output: + de_tanf_resources_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: DE + output: + de_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/fl/dcf/tanf/fl_tca_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/fl/dcf/tanf/fl_tca_resources_eligible.yaml index f8b813e1729..b281102d1c2 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/fl/dcf/tanf/fl_tca_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/fl/dcf/tanf/fl_tca_resources_eligible.yaml @@ -69,3 +69,28 @@ state_code: FL output: fl_tca_resources_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: FL + output: + fl_tca_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: FL + output: + fl_tca_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.yaml index 21f0ca1b77e..da1ffd0b19d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.yaml @@ -29,3 +29,28 @@ spm_unit_cash_assets: 999 output: ga_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.90 = 1,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.90 + state_code: GA + output: + ga_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.91 = 1,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.91 + state_code: GA + output: + ga_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ia/dhs/fip/ia_fip_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ia/dhs/fip/ia_fip_resources_eligible.yaml index 5aab0ffe678..3e665e4b9cf 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ia/dhs/fip/ia_fip_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ia/dhs/fip/ia_fip_resources_eligible.yaml @@ -97,3 +97,28 @@ output: # At limit should be eligible (<=) ia_fip_resources_eligible: true + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: IA + output: + ia_fip_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: IA + output: + ia_fip_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_eligible.yaml new file mode 100644 index 00000000000..3c5c7e5b0b7 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_eligible.yaml @@ -0,0 +1,96 @@ +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: IA + output: + ia_ssa_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: IA + output: + ia_ssa_eligible: false + +# ia_ssa_resources_deemed_from_parents divides the parental excess among the +# children as SSI does, and a certified share can be entered instead. A share +# of 33.3333 (100 divided among three children) plus the child's 1,966.67 in +# one account is 2,000.0033, over the limit: the share isn't rounded to +# cents, as SSI sets no rounding rule for it (SI 01330.200 B). +- name: A fractional share of parental excess counts against the resource limit + period: 2026-01 + input: + people: + parent: + age: 40 + child: + age: 10 + bank_account_assets: 1_966.67 + ia_ssa_resources_deemed_from_parents: 33.3333 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: true + meets_ssi_disability_criteria: true + marital_units: + parent_unit: + members: [parent] + child_unit: + members: [child] + tax_units: + family: + members: [parent, child] + households: + home: + members: [parent, child] + state_code: IA + output: + ia_ssa_eligible: [false, false] + +# A share of 25 (100 divided among four children) plus the child's 178.57 + +# 1,522.79 + 273.64 = 1,975.00 is 2,000.00, at the limit. The child's float32 +# balances add to 1,975.0001 unless rounded to cents. +- name: Three accounts plus a whole-cent share of parental excess at the limit pass + period: 2026-01 + input: + people: + parent: + age: 40 + child: + age: 10 + bank_account_assets: 178.57 + stock_assets: 1_522.79 + bond_assets: 273.64 + ia_ssa_resources_deemed_from_parents: 25 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: true + meets_ssi_disability_criteria: true + marital_units: + parent_unit: + members: [parent] + child_unit: + members: [child] + tax_units: + family: + members: [parent, child] + households: + home: + members: [parent, child] + state_code: IA + output: + ia_ssa_eligible: [false, true] diff --git a/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.yaml b/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.yaml index a4329d445fe..f998bf24a8e 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.yaml @@ -422,3 +422,303 @@ ia_ssa_resources_deemed_from_parents: [0, 200] ia_ssa_eligible: [false, true] ia_ssa: [0, 400] + +# The parent's 1,805.81 + 244.12 + 50.07 = 2,100.00 is 100 over the one-parent +# allowance; the float32 balances add to 2,100.0002 unless rounded to cents. +# The child's 1,900 plus 100 is exactly the 2,000 limit. +- name: Case 8, a parent's three accounts at the allowance plus 100 deem exactly 100. + period: 2026-01 + absolute_error_margin: 0.01 + input: + people: + person1: + age: + 2026: 40 + person_id: + 2026: 1 + bank_account_assets: + 2026: 1_805.81 + stock_assets: + 2026: 244.12 + bond_assets: + 2026: 50.07 + person2: + age: + 2026: 10 + person_id: + 2026: 2 + parent_1_id: + 2026: 1 + bank_account_assets: + 2026: 1_900 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + marital_units: + person1_unit: + members: [person1] + person2_unit: + members: [person2] + families: + family: + members: [person1, person2] + tax_units: + family: + members: [person1, person2] + spm_units: + unit: + members: [person1, person2] + households: + home: + members: [person1, person2] + state_code: + 2026: IA + output: + ia_ssa_resources_deemed_from_parents: [0, 100] + ia_ssa_eligible: [false, true] + +# The parent's 2,100.01 is 100.01 over the allowance, all deemed to the only +# child, whose 1,899.99 brings the total to exactly 2,000.00. Stored as the +# nearest float32, the share would read back as 100.010002. +- name: Case 9, a whole-cent share that brings a child exactly to the limit leaves them eligible. + period: 2026-01 + absolute_error_margin: 0.01 + input: + people: + person1: + age: + 2026: 40 + person_id: + 2026: 1 + bank_account_assets: + 2026: 2_100.01 + person2: + age: + 2026: 10 + person_id: + 2026: 2 + parent_1_id: + 2026: 1 + bank_account_assets: + 2026: 1_899.99 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + marital_units: + person1_unit: + members: [person1] + person2_unit: + members: [person2] + families: + family: + members: [person1, person2] + tax_units: + family: + members: [person1, person2] + spm_units: + unit: + members: [person1, person2] + households: + home: + members: [person1, person2] + state_code: + 2026: IA + output: + ia_ssa_resources_deemed_from_parents: [0, 100.01] + ia_ssa_eligible: [false, true] + +# The parent's 100 of excess divides among four children as 25 each. The +# first child's 178.57 + 1,522.79 + 273.64 = 1,975.00 plus 25 is 2,000.00, at +# the limit; the float32 balances add to 1,975.0001 unless rounded to cents, +# which would leave the child out and deem every child 33.33. +- name: Case 10, a child whose three accounts and share total exactly the limit stays in the division. + period: 2026-01 + absolute_error_margin: 0.01 + input: + people: + person1: + age: + 2026: 40 + person_id: + 2026: 1 + bank_account_assets: + 2026: 2_100 + person2: + age: + 2026: 8 + person_id: + 2026: 2 + parent_1_id: + 2026: 1 + bank_account_assets: + 2026: 178.57 + stock_assets: + 2026: 1_522.79 + bond_assets: + 2026: 273.64 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + person3: + age: + 2026: 10 + person_id: + 2026: 3 + parent_1_id: + 2026: 1 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + person4: + age: + 2026: 12 + person_id: + 2026: 4 + parent_1_id: + 2026: 1 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + person5: + age: + 2026: 14 + person_id: + 2026: 5 + parent_1_id: + 2026: 1 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + marital_units: + person1_unit: + members: [person1] + person2_unit: + members: [person2] + person3_unit: + members: [person3] + person4_unit: + members: [person4] + person5_unit: + members: [person5] + families: + family: + members: [person1, person2, person3, person4, person5] + tax_units: + family: + members: [person1, person2, person3, person4, person5] + spm_units: + unit: + members: [person1, person2, person3, person4, person5] + households: + home: + members: [person1, person2, person3, person4, person5] + state_code: + 2026: IA + output: + ia_ssa_resources_deemed_from_parents: [0, 25, 25, 25, 25] + ia_ssa_eligible: [false, true, true, true, true] + +# The parent's 48.30 of excess divides among three children as 16.10 each. +# The first child's 1,983.90 plus 16.10 is exactly 2,000.00. In float64, +# 2,048.30 - 2,000 gives an excess of 48.30000000000018, and 1,983.90 plus a +# third of it gives 2,000.0000000000002, which would leave the first child +# out of the division. +- name: Case 11, a child whom a share reaches exactly to the limit stays in the division. + period: 2026-01 + absolute_error_margin: 0.01 + input: + people: + person1: + age: + 2026: 40 + person_id: + 2026: 1 + bank_account_assets: + 2026: 2_048.30 + person2: + age: + 2026: 8 + person_id: + 2026: 2 + parent_1_id: + 2026: 1 + bank_account_assets: + 2026: 1_983.90 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + person3: + age: + 2026: 10 + person_id: + 2026: 3 + parent_1_id: + 2026: 1 + bank_account_assets: + 2026: 1_980 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + person4: + age: + 2026: 12 + person_id: + 2026: 4 + parent_1_id: + 2026: 1 + ia_ssa_category: IN_HOME_CARE + ia_ssa_ihhrc_monthly_cost: 400 + is_disabled: + 2026: true + meets_ssi_disability_criteria: + 2026: true + marital_units: + person1_unit: + members: [person1] + person2_unit: + members: [person2] + person3_unit: + members: [person3] + person4_unit: + members: [person4] + families: + family: + members: [person1, person2, person3, person4] + tax_units: + family: + members: [person1, person2, person3, person4] + spm_units: + unit: + members: [person1, person2, person3, person4] + households: + home: + members: [person1, person2, person3, person4] + state_code: + 2026: IA + output: + ia_ssa_resources_deemed_from_parents: [0, 16.10, 16.10, 16.10] + ia_ssa_eligible: [false, true, true, true] diff --git a/policyengine_us/tests/policy/baseline/gov/states/id/tafi/id_tafi_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/id/tafi/id_tafi_resources_eligible.yaml index 451c82e2971..7bdf37bdcaa 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/id/tafi/id_tafi_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/id/tafi/id_tafi_resources_eligible.yaml @@ -101,3 +101,28 @@ output: id_tafi_resources_eligible: false # $100,000 > $5,000 -> ineligible + +# 4,211.74 + 769.20 + 19.06 = 5,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 5,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_211.74 + stock_assets: 769.20 + bond_assets: 19.06 + state_code: ID + output: + id_tafi_resources_eligible: true + +# 4,211.74 + 769.20 + 19.07 = 5,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_211.74 + stock_assets: 769.20 + bond_assets: 19.07 + state_code: ID + output: + id_tafi_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.yaml index e3f21170387..3a60f1a78e6 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.yaml @@ -33,3 +33,32 @@ state_code: IL output: il_aabd_asset_value_eligible: true + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: IL + output: + il_aabd_asset_value_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: IL + output: + il_aabd_asset_value_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/in/fssa/tanf/resources/in_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/in/fssa/tanf/resources/in_tanf_resources_eligible.yaml index 0e5da21a6d4..3f2a4f46298 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/in/fssa/tanf/resources/in_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/in/fssa/tanf/resources/in_tanf_resources_eligible.yaml @@ -58,3 +58,28 @@ output: in_tanf_resources_eligible: true # 0 <= 1_000 = true + +# 650.46 + 299.64 + 49.90 = 1,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.90 + state_code: IN + output: + in_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.91 = 1,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.91 + state_code: IN + output: + in_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/tanf/ks_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/tanf/ks_tanf_resources_eligible.yaml index 6c8dd12e410..3952e174c96 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/tanf/ks_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ks/dcf/tanf/ks_tanf_resources_eligible.yaml @@ -40,3 +40,28 @@ spm_unit_cash_assets: 10_000 output: ks_tanf_resources_eligible: false + +# 798.28 + 2,187.62 + 14.10 = 3,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 3,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.10 + state_code: KS + output: + ks_tanf_resources_eligible: true + +# 798.28 + 2,187.62 + 14.11 = 3,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.11 + state_code: KS + output: + ks_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ky/dcbs/ktap/ky_ktap_resource_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ky/dcbs/ktap/ky_ktap_resource_eligible.yaml index fd1658a596d..c0e3229af88 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ky/dcbs/ktap/ky_ktap_resource_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ky/dcbs/ktap/ky_ktap_resource_eligible.yaml @@ -102,3 +102,28 @@ output: # Not in Kentucky ky_ktap_resource_eligible: false + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: KY + output: + ky_ktap_resource_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: KY + output: + ky_ktap_resource_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/md/dhs/fia/paa/md_paa_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/md/dhs/fia/paa/md_paa_eligible.yaml index e139b19db84..827caa644a9 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/md/dhs/fia/paa/md_paa_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/md/dhs/fia/paa/md_paa_eligible.yaml @@ -386,3 +386,45 @@ state_code: MD output: md_paa_eligible: true + +# PAA Manual §500's $2,000 limit: 178.57 + 1,547.79 + 273.64 = 2,000.00, at +# the limit. The three float32 balances add to 2,000.0001 unless rounded to +# cents. +- name: Case 19, three accounts that total exactly the resource limit are eligible. + period: 2026-01 + input: + people: + person1: + age: 70 + is_disabled: true + ssi: 800 + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.64 + md_paa_living_arrangement: CARE_HOME_LEVEL_B + households: + household: + members: [person1] + state_code: MD + output: + md_paa_eligible: true + +# 178.57 + 1,547.79 + 273.65 = 2,000.01, a cent over the limit. +- name: Case 20, three accounts a cent over the resource limit are ineligible. + period: 2026-01 + input: + people: + person1: + age: 70 + is_disabled: true + ssi: 800 + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.65 + md_paa_living_arrangement: CARE_HOME_LEVEL_B + households: + household: + members: [person1] + state_code: MD + output: + md_paa_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/me/dhhs/tanf/me_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/me/dhhs/tanf/me_tanf_resources_eligible.yaml index 3024313a3a5..3574d25a15a 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/me/dhhs/tanf/me_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/me/dhhs/tanf/me_tanf_resources_eligible.yaml @@ -27,3 +27,28 @@ spm_unit_cash_assets: 0 output: me_tanf_resources_eligible: true + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: ME + output: + me_tanf_resources_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: ME + output: + me_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.yaml index 9c15f884ddd..500406f49c5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.yaml @@ -45,3 +45,28 @@ spm_unit_cash_assets: 10_000 output: mi_fip_resources_eligible: 0 + +# 8,612.82 + 6,310.95 + 76.23 = 15,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 15,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_612.82 + stock_assets: 6_310.95 + bond_assets: 76.23 + state_code: MI + output: + mi_fip_resources_eligible: true + +# 8,612.82 + 6,310.95 + 76.24 = 15,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_612.82 + stock_assets: 6_310.95 + bond_assets: 76.24 + state_code: MI + output: + mi_fip_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/mn/dcyf/mfip/mn_mfip_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/mn/dcyf/mfip/mn_mfip_resources_eligible.yaml index 10a5e6fc792..301006eec8e 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mn/dcyf/mfip/mn_mfip_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mn/dcyf/mfip/mn_mfip_resources_eligible.yaml @@ -82,3 +82,28 @@ # Limit: $10,000 # Eligible: 10,001 <= 10,000 = false mn_mfip_resources_eligible: false + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: MN + output: + mn_mfip_resources_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: MN + output: + mn_mfip_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.yaml index e079213fd8b..95dee0863a4 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.yaml @@ -385,3 +385,32 @@ # the third adult's individual living-with-others standard is 755.33. # https://www.dhs.state.mn.us/main/groups/county_access/documents/pub/mndhs-073585.pdf#page=4 mn_msa_person: [529, 529, 755.33] + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: MN + output: + mn_msa_resource_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: MN + output: + mn_msa_resource_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/mo/dss/tanf/mo_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/mo/dss/tanf/mo_tanf_resources_eligible.yaml index 6abfee83c58..50616a884c9 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mo/dss/tanf/mo_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mo/dss/tanf/mo_tanf_resources_eligible.yaml @@ -21,3 +21,28 @@ spm_unit_cash_assets: 1_001 output: mo_tanf_resources_eligible: false + +# 650.46 + 299.64 + 49.90 = 1,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.90 + state_code: MO + output: + mo_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.91 = 1,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.91 + state_code: MO + output: + mo_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ms/dhs/tanf/ms_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ms/dhs/tanf/ms_tanf_resources_eligible.yaml index f6c851d2cae..33e366dd5bb 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ms/dhs/tanf/ms_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ms/dhs/tanf/ms_tanf_resources_eligible.yaml @@ -64,3 +64,28 @@ output: # Not in MS, returns false (defined_for = MS) ms_tanf_resources_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: MS + output: + ms_tanf_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: MS + output: + ms_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.yaml index 6bcc9a817e5..d1d0a3b36f5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.yaml @@ -109,3 +109,32 @@ members: [person2] output: ms_hmw_resource_eligible: [true, true] + +# 1,843.69 + 2,145.15 + 11.16 = 4,000.00, which the limit excludes. +# The float32 balances add to a fraction of a cent below 4,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit fail + period: 2025 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_843.69 + stock_assets: 2_145.15 + bond_assets: 11.16 + state_code: MS + output: + ms_hmw_resource_eligible: false + +# 1,843.69 + 2,145.15 + 11.15 = 3,999.99, a cent under the limit. +- name: Three accounts a cent under the resource limit pass + period: 2025 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 1_843.69 + stock_assets: 2_145.15 + bond_assets: 11.15 + state_code: MS + output: + ms_hmw_resource_eligible: true diff --git a/policyengine_us/tests/policy/baseline/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.yaml index f883908a09f..8413dc1b1c0 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.yaml @@ -21,3 +21,28 @@ bank_account_assets: 0 output: mt_tanf_resources_eligible: true + +# 798.28 + 2,187.62 + 14.10 = 3,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 3,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.10 + state_code: MT + output: + mt_tanf_resources_eligible: true + +# 798.28 + 2,187.62 + 14.11 = 3,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.11 + state_code: MT + output: + mt_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nc/ncdhhs/sa/nc_sa_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nc/ncdhhs/sa/nc_sa_eligible.yaml index cfcbdb4e257..bda953e00e0 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nc/ncdhhs/sa/nc_sa_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nc/ncdhhs/sa/nc_sa_eligible.yaml @@ -189,3 +189,29 @@ # SSI eligibility when the income would qualify. nc_sa_eligible: [false, false] nc_sa: [0, 0] + +- name: A non-SSI applicant's accounts at the limit pass + period: 2026-01 + input: + state_code: NC + age: 70 + social_security_retirement: 15600 + nc_sa_care_setting: ADULT_CARE_HOME + bank_account_assets: 178.57 + stock_assets: 1547.79 + bond_assets: 273.64 + output: + nc_sa_eligible: true + +- name: A non-SSI applicant's accounts a cent over the limit fail + period: 2026-01 + input: + state_code: NC + age: 70 + social_security_retirement: 15600 + nc_sa_care_setting: ADULT_CARE_HOME + bank_account_assets: 178.57 + stock_assets: 1547.79 + bond_assets: 273.65 + output: + nc_sa_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nd/dhs/tanf/nd_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nd/dhs/tanf/nd_tanf_resources_eligible.yaml index 08bf4c5395d..8ed8999c375 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nd/dhs/tanf/nd_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nd/dhs/tanf/nd_tanf_resources_eligible.yaml @@ -237,3 +237,28 @@ # Limit: $6,000 + $25 * (10-2) = $6,000 + $200 = $6,200 # $6,200 <= $6,200 = true nd_tanf_resources_eligible: true + +# 798.28 + 2,187.62 + 14.10 = 3,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 3,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.10 + state_code: ND + output: + nd_tanf_resources_eligible: true + +# 798.28 + 2,187.62 + 14.11 = 3,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 798.28 + stock_assets: 2_187.62 + bond_assets: 14.11 + state_code: ND + output: + nd_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ne/dhhs/adc/ne_adc_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ne/dhhs/adc/ne_adc_resources_eligible.yaml index 596d450fe45..28a326e8432 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ne/dhhs/adc/ne_adc_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ne/dhhs/adc/ne_adc_resources_eligible.yaml @@ -84,3 +84,28 @@ spm_unit_size: 2 ne_adc_resources_eligible: false # Resources ($6,001) > Limit ($6,000) -> false + +# 2,286.12 + 404.84 + 1,309.04 = 4,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 4,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025 + input: + age: 30 + bank_account_assets: 2_286.12 + stock_assets: 404.84 + bond_assets: 1_309.04 + state_code: NE + output: + ne_adc_resources_eligible: true + +# 2,286.12 + 404.84 + 1,309.05 = 4,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025 + input: + age: 30 + bank_account_assets: 2_286.12 + stock_assets: 404.84 + bond_assets: 1_309.05 + state_code: NE + output: + ne_adc_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/fanf/nh_fanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/fanf/nh_fanf_resources_eligible.yaml index a64ded75848..8b2eb46310e 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/fanf/nh_fanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/fanf/nh_fanf_resources_eligible.yaml @@ -118,3 +118,28 @@ output: # $1,999 < $2,000 limit = eligible nh_fanf_resources_eligible: true + +# 719.22 + 208.18 + 72.60 = 1,000.00, which the limit excludes. +# The float32 balances add to a fraction of a cent below 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit fail + period: 2025 + input: + age: 30 + bank_account_assets: 719.22 + stock_assets: 208.18 + bond_assets: 72.60 + state_code: NH + output: + nh_fanf_resources_eligible: false + +# 719.22 + 208.18 + 72.59 = 999.99, a cent under the limit. +- name: Three accounts a cent under the resource limit pass + period: 2025 + input: + age: 30 + bank_account_assets: 719.22 + stock_assets: 208.18 + bond_assets: 72.59 + state_code: NH + output: + nh_fanf_resources_eligible: true diff --git a/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/ssp/nh_ssp_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/ssp/nh_ssp_eligible.yaml new file mode 100644 index 00000000000..894d144a8c8 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/nh/dhhs/ssp/nh_ssp_eligible.yaml @@ -0,0 +1,28 @@ +# 285.92 + 1,181.93 + 32.15 = 1,500.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,500 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 285.92 + stock_assets: 1_181.93 + bond_assets: 32.15 + state_code: NH + output: + nh_ssp_eligible: true + +# 285.92 + 1,181.93 + 32.16 = 1,500.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 70 + is_ssi_aged_blind_disabled: true + is_ssi_disabled: true + bank_account_assets: 285.92 + stock_assets: 1_181.93 + bond_assets: 32.16 + state_code: NH + output: + nh_ssp_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nj/njdhs/wfnj/nj_wfnj_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nj/njdhs/wfnj/nj_wfnj_resources_eligible.yaml index 6fc296c5bdf..992dcf63659 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nj/njdhs/wfnj/nj_wfnj_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nj/njdhs/wfnj/nj_wfnj_resources_eligible.yaml @@ -21,3 +21,28 @@ spm_unit_cash_assets: 0 output: nj_wfnj_resources_eligible: true + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: NJ + output: + nj_wfnj_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: NJ + output: + nj_wfnj_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.yaml index 13fb0f6fbcd..fcee32c4d3b 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.yaml @@ -36,3 +36,28 @@ # Liquid resources alone can fail the NM Works test even before adding any # future modeled non-liquid countable resources. nm_works_resources_eligible: false + +# 285.92 + 1,181.93 + 32.15 = 1,500.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,500 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 285.92 + stock_assets: 1_181.93 + bond_assets: 32.15 + state_code: NM + output: + nm_works_resources_eligible: true + +# 285.92 + 1,181.93 + 32.16 = 1,500.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 285.92 + stock_assets: 1_181.93 + bond_assets: 32.16 + state_code: NM + output: + nm_works_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.yaml index 9f571c0547d..a8b4ad3b553 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.yaml @@ -24,3 +24,28 @@ spm_unit_cash_assets: 10_001 output: nv_tanf_resources_eligible: false + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: NV + output: + nv_tanf_resources_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: NV + output: + nv_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ny/otda/tanf/ny_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ny/otda/tanf/ny_tanf_resources_eligible.yaml index 5fdaef1d68a..19757c115f5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ny/otda/tanf/ny_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ny/otda/tanf/ny_tanf_resources_eligible.yaml @@ -171,3 +171,28 @@ # Pre-reform: disability did NOT qualify for higher limit # Uses $2,000 limit, $2,500 > $2,000 → ineligible ny_tanf_resources_eligible: false + +# 2,105.87 + 384.60 + 9.53 = 2,500.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,500 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 2_105.87 + stock_assets: 384.60 + bond_assets: 9.53 + state_code: NY + output: + ny_tanf_resources_eligible: true + +# 2,105.87 + 384.60 + 9.54 = 2,500.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 2_105.87 + stock_assets: 384.60 + bond_assets: 9.54 + state_code: NY + output: + ny_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/dhs/tanf/ok_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/dhs/tanf/ok_tanf_resources_eligible.yaml index 38583a1f602..cac5d84846c 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ok/dhs/tanf/ok_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ok/dhs/tanf/ok_tanf_resources_eligible.yaml @@ -77,3 +77,28 @@ state_code: OK output: ok_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.90 = 1,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.90 + state_code: OK + output: + ok_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.91 = 1,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.91 + state_code: OK + output: + ok_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/or/odhs/tanf/or_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/or/odhs/tanf/or_tanf_resources_eligible.yaml index 1186d1002bf..98ca066c457 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/or/odhs/tanf/or_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/or/odhs/tanf/or_tanf_resources_eligible.yaml @@ -35,3 +35,28 @@ spm_unit_cash_assets: 10_001 output: or_tanf_resources_eligible: false + +# 8,688.73 + 9.74 + 1,301.53 = 10,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 10,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.53 + state_code: OR + output: + or_tanf_resources_eligible: true + +# 8,688.73 + 9.74 + 1,301.54 = 10,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 8_688.73 + stock_assets: 9.74 + bond_assets: 1_301.54 + state_code: OR + output: + or_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.yaml index a959a2e9858..db07aa1209f 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.yaml @@ -45,3 +45,28 @@ state_code: PA output: pa_tanf_resources_eligible: false + +# 650.46 + 299.64 + 49.90 = 1,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.90 + state_code: PA + output: + pa_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.91 = 1,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.91 + state_code: PA + output: + pa_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ri/dhs/works/ri_works_resource_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ri/dhs/works/ri_works_resource_eligible.yaml index 6c572074ff6..ba661907dce 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ri/dhs/works/ri_works_resource_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ri/dhs/works/ri_works_resource_eligible.yaml @@ -64,3 +64,28 @@ # Limit: $5,000 # $4,999 <= $5,000 = true ri_works_resource_eligible: true + +# 4,211.74 + 769.20 + 19.06 = 5,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 5,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_211.74 + stock_assets: 769.20 + bond_assets: 19.06 + state_code: RI + output: + ri_works_resource_eligible: true + +# 4,211.74 + 769.20 + 19.07 = 5,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_211.74 + stock_assets: 769.20 + bond_assets: 19.07 + state_code: RI + output: + ri_works_resource_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/sc/tanf/sc_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/sc/tanf/sc_tanf_resources_eligible.yaml index ef036df8b90..09d3821e098 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/sc/tanf/sc_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/sc/tanf/sc_tanf_resources_eligible.yaml @@ -34,3 +34,28 @@ output: sc_tanf_resources_eligible: true # 0 <= 2,500 -> eligible + +# 2,105.87 + 384.60 + 9.53 = 2,500.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,500 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 2_105.87 + stock_assets: 384.60 + bond_assets: 9.53 + state_code: SC + output: + sc_tanf_resources_eligible: true + +# 2,105.87 + 384.60 + 9.54 = 2,500.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 2_105.87 + stock_assets: 384.60 + bond_assets: 9.54 + state_code: SC + output: + sc_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.yaml index e26e7dedeb8..dfdcecd592d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.yaml @@ -102,3 +102,28 @@ # Limit: $2,000 # Eligible: $1,999 <= $2,000 = true sd_tanf_resources_eligible: true + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: SD + output: + sd_tanf_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: SD + output: + sd_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.yaml index a8bd6fe0df9..77d310f3adc 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.yaml @@ -114,3 +114,28 @@ output: # Countable: $3,000 liquid assets + ($6,600 - $4,600 vehicle exclusion) = $5,000 tn_ff_resources_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: TN + output: + tn_ff_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: TN + output: + tn_ff_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.yaml index c3a2135753c..8b11f01a5f2 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.yaml @@ -42,3 +42,28 @@ output: tx_tanf_resources_eligible: true # Resources (0) <= limit (1,000) → Pass + +# 650.46 + 299.64 + 49.90 = 1,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 1,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.90 + state_code: TX + output: + tx_tanf_resources_eligible: true + +# 650.46 + 299.64 + 49.91 = 1,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 650.46 + stock_assets: 299.64 + bond_assets: 49.91 + state_code: TX + output: + tx_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.yaml index f8905ef04be..746a2074200 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.yaml @@ -45,3 +45,28 @@ output: # Resources = 5,000 > 2,000 - ineligible ut_fep_resources_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: UT + output: + ut_fep_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: UT + output: + ut_fep_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/va/dars/ag/va_ag_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/va/dars/ag/va_ag_eligible.yaml new file mode 100644 index 00000000000..fb98c10be34 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/va/dars/ag/va_ag_eligible.yaml @@ -0,0 +1,35 @@ +# An applicant who doesn't receive SSI is tested against the SSI resource +# limits. 178.57 + 1,547.79 + 273.64 = 2,000.00, at the $2,000 individual +# limit. The three float32 balances add to 2,000.0001 unless rounded to cents. +- name: Three accounts that total exactly the individual resource limit are eligible + period: 2026-01 + input: + state_code: VA + age: 70 + is_disabled: true + is_ssi_aged_blind_disabled: true + va_ag_certified: true + ssi: 0 + social_security: 30_000 + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.64 + output: + va_ag_eligible: true + +# 178.57 + 1,547.79 + 273.65 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the individual resource limit are ineligible + period: 2026-01 + input: + state_code: VA + age: 70 + is_disabled: true + is_ssi_aged_blind_disabled: true + va_ag_certified: true + ssi: 0 + social_security: 30_000 + bank_account_assets: 178.57 + stock_assets: 1_547.79 + bond_assets: 273.65 + output: + va_ag_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/vt/dcf/reach_up/vt_reach_up_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/vt/dcf/reach_up/vt_reach_up_resources_eligible.yaml index 1072da1660a..3e503e86178 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/vt/dcf/reach_up/vt_reach_up_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/vt/dcf/reach_up/vt_reach_up_resources_eligible.yaml @@ -73,3 +73,28 @@ output: # Assets: $9,001 > $9,000 limit vt_reach_up_resources_eligible: false + +# 617.28 + 8,353.98 + 28.74 = 9,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 9,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 617.28 + stock_assets: 8_353.98 + bond_assets: 28.74 + state_code: VT + output: + vt_reach_up_resources_eligible: true + +# 617.28 + 8,353.98 + 28.75 = 9,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 617.28 + stock_assets: 8_353.98 + bond_assets: 28.75 + state_code: VT + output: + vt_reach_up_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.yaml index ee925dfa47f..c14319af143 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.yaml @@ -50,3 +50,28 @@ bank_account_assets: 1_001 output: wa_tanf_resources_eligible: false + +# 8,978.98 + 2,564.81 + 456.21 = 12,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 12,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025 + input: + age: 30 + bank_account_assets: 8_978.98 + stock_assets: 2_564.81 + bond_assets: 456.21 + state_code: WA + output: + wa_tanf_resources_eligible: true + +# 8,978.98 + 2,564.81 + 456.22 = 12,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025 + input: + age: 30 + bank_account_assets: 8_978.98 + stock_assets: 2_564.81 + bond_assets: 456.22 + state_code: WA + output: + wa_tanf_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/wi/dcf/works/wi_works_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/wi/dcf/works/wi_works_resources_eligible.yaml index 62907a62354..ee465405121 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/wi/dcf/works/wi_works_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/wi/dcf/works/wi_works_resources_eligible.yaml @@ -36,3 +36,28 @@ state_code: CA output: wi_works_resources_eligible: false + +# 2,105.87 + 384.60 + 9.53 = 2,500.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,500 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025 + input: + age: 30 + bank_account_assets: 2_105.87 + stock_assets: 384.60 + bond_assets: 9.53 + state_code: WI + output: + wi_works_resources_eligible: true + +# 2,105.87 + 384.60 + 9.54 = 2,500.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025 + input: + age: 30 + bank_account_assets: 2_105.87 + stock_assets: 384.60 + bond_assets: 9.54 + state_code: WI + output: + wi_works_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/wv/dhhr/works/wv_works_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/wv/dhhr/works/wv_works_resources_eligible.yaml index 64cb29352e1..16e4e33fab5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/wv/dhhr/works/wv_works_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/wv/dhhr/works/wv_works_resources_eligible.yaml @@ -50,3 +50,28 @@ spm_unit_cash_assets: 10_000 output: wv_works_resources_eligible: false + +# 1,157.81 + 285.17 + 557.02 = 2,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 2,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.02 + state_code: WV + output: + wv_works_resources_eligible: true + +# 1,157.81 + 285.17 + 557.03 = 2,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 1_157.81 + stock_assets: 285.17 + bond_assets: 557.03 + state_code: WV + output: + wv_works_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/wy/dfs/power/wy_power_resources_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/wy/dfs/power/wy_power_resources_eligible.yaml index e1aeccfbe8d..0f12cd002d9 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/wy/dfs/power/wy_power_resources_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/wy/dfs/power/wy_power_resources_eligible.yaml @@ -34,3 +34,28 @@ spm_unit_cash_assets: 5_001 output: wy_power_resources_eligible: false + +# 4,211.74 + 769.20 + 19.06 = 5,000.00, at the limit. +# The float32 balances add to a fraction of a cent above 5,000 unless rounded to cents. +- name: Three accounts that total exactly the resource limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_211.74 + stock_assets: 769.20 + bond_assets: 19.06 + state_code: WY + output: + wy_power_resources_eligible: true + +# 4,211.74 + 769.20 + 19.07 = 5,000.01, a cent over the limit. +- name: Three accounts a cent over the resource limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 4_211.74 + stock_assets: 769.20 + bond_assets: 19.07 + state_code: WY + output: + wy_power_resources_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/meets_snap_asset_test.yaml b/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/meets_snap_asset_test.yaml index 58a3ceb5d15..2367a19f859 100644 --- a/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/meets_snap_asset_test.yaml +++ b/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/meets_snap_asset_test.yaml @@ -78,3 +78,26 @@ # $4,000 is between the $3,000 standard and $4,500 elderly/disabled # limits, and the eligible elderly member confers the higher limit. meets_snap_asset_test: true + +# 7 U.S.C. 2014(g)(1): 2,607.87 + 29.87 + 362.26 = 3,000.00, at the FY2025 +# standard limit. The float32 balances add to 3,000.0002 unless rounded. +- name: Three accounts that total exactly the standard limit pass + period: 2025-01 + input: + age: 30 + bank_account_assets: 2_607.87 + stock_assets: 29.87 + bond_assets: 362.26 + output: + meets_snap_asset_test: true + +# 2,607.87 + 29.87 + 362.27 = 3,000.01, a cent over the limit. +- name: Three accounts a cent over the standard limit fail + period: 2025-01 + input: + age: 30 + bank_account_assets: 2_607.87 + stock_assets: 29.87 + bond_assets: 362.27 + output: + meets_snap_asset_test: false diff --git a/policyengine_us/tests/policy/baseline/gov/usda/snap/integration.yaml b/policyengine_us/tests/policy/baseline/gov/usda/snap/integration.yaml index 533961df050..1e0bf9fca2b 100644 --- a/policyengine_us/tests/policy/baseline/gov/usda/snap/integration.yaml +++ b/policyengine_us/tests/policy/baseline/gov/usda/snap/integration.yaml @@ -156,6 +156,61 @@ is_snap_eligible: false snap: 0 +# 4,338.99 + 609.03 + 51.98 = 5,000. The ordinary 3,000 cap applies in July. +- name: Idaho household at the BBCE resource limit loses SNAP eligibility in July + period: 2026 + input: + state_code: ID + age: 30 + is_snap_excluded_member: + 2026-06: false + 2026-07: false + bank_account_assets: 4_338.99 + stock_assets: 609.03 + bond_assets: 51.98 + output: + is_tanf_non_cash_eligible: + 2026-06: true + 2026-07: false + meets_snap_asset_test: + 2026-06: false + 2026-07: false + is_snap_eligible: + 2026-06: true + 2026-07: false + +# 3,000.00 equals the ordinary SNAP limit after Idaho ends BBCE. +- name: Idaho household at the ordinary resource limit qualifies in July + period: 2026-07 + input: + state_code: + 2026: ID + age: + 2026: 30 + is_snap_excluded_member: false + bank_account_assets: + 2026: 3_000 + output: + is_tanf_non_cash_eligible: false + meets_snap_asset_test: true + is_snap_eligible: true + +# 3,000.01 exceeds the ordinary SNAP limit after Idaho ends BBCE. +- name: Idaho household a cent above the ordinary resource limit fails in July + period: 2026-07 + input: + state_code: + 2026: ID + age: + 2026: 30 + is_snap_excluded_member: false + bank_account_assets: + 2026: 3_000.01 + output: + is_tanf_non_cash_eligible: false + meets_snap_asset_test: false + is_snap_eligible: false + - name: Colorado person aged 70 under 200% of the poverty level with net income above the limit is eligible in January 2024. period: 2024-01 input: diff --git a/policyengine_us/tests/unit/test_meets_limit_with_share.py b/policyengine_us/tests/unit/test_meets_limit_with_share.py new file mode 100644 index 00000000000..34f81aae681 --- /dev/null +++ b/policyengine_us/tests/unit/test_meets_limit_with_share.py @@ -0,0 +1,25 @@ +import numpy as np + +from policyengine_us.tools.general import meets_limit_with_share + + +def test_infinite_individual_limit_keeps_children_in_the_division(): + with np.errstate(invalid="raise"): + actual = meets_limit_with_share( + own=np.array([0, 1_983.90, 1_966.67]), + excess=100, + divisor=3, + limit=np.inf, + ) + np.testing.assert_array_equal(actual, [True, True, True]) + + +def test_exact_share_comparison_with_mixed_limits(): + with np.errstate(invalid="raise"): + actual = meets_limit_with_share( + own=np.array([1_899.99, 1_966.67, 1_966.67, 0, 0]), + excess=np.array([100.01, 100, 100, 0, 0]), + divisor=np.array([1, 3, 3, 1, 1]), + limit=np.array([2_000, 2_000, np.inf, -np.inf, np.nan]), + ) + np.testing.assert_array_equal(actual, [True, False, True, False, False]) diff --git a/policyengine_us/tests/unit/test_round_to_cents_properties.py b/policyengine_us/tests/unit/test_round_to_cents_properties.py new file mode 100644 index 00000000000..8dfc05b2b56 --- /dev/null +++ b/policyengine_us/tests/unit/test_round_to_cents_properties.py @@ -0,0 +1,51 @@ +"""Hypothesis check that splitting a total into cents doesn't change a limit test. + +Account balances are stored as float32, so three balances that add to a limit +in cents can sum a fraction of a cent above or below it. Asset tests round the +sum to cents before comparing it with the limit (``round_to_cents``). + +The property checks the helper alone, without a model, on both ways the model +sums inputs: float32 addition within one entity, and a float64 sum cast back +to float32 when person inputs are added up to a group entity. The YAML cases +at each fixed limit check the model. Hypothesis is a dev extra, so this module +skips without it. +""" + +import numpy as np +import pytest + +from policyengine_us.tools.general import round_to_cents + +hypothesis = pytest.importorskip("hypothesis") +st = pytest.importorskip("hypothesis.strategies") + +# Three float32 parts and two float32 additions each err by at most half a +# unit in the last place of the total. Below 2**15 dollars a half unit is at +# most 2**-10, so the sum stays within 5 / 2**10 < 0.005 of the total. +MAX_CENTS = 2**15 * 100 - 1 + + +@st.composite +def cent_split(draw, total_cents): + """Three whole-cent parts that add to total_cents.""" + cuts = sorted(draw(st.integers(0, total_cents)) for _ in range(2)) + return (cuts[0], cuts[1] - cuts[0], total_cents - cuts[1]) + + +@st.composite +def total_and_split(draw): + total = draw(st.integers(0, MAX_CENTS)) + return total, draw(cent_split(total)) + + +@hypothesis.settings(max_examples=2_000, deadline=None) +@hypothesis.given(total_and_split()) +def test_rounded_sum_of_float32_parts_is_the_total(case): + total, parts = case + values = [np.float32(part / 100) for part in parts] + # Float32 addition, as a formula adding one entity's own inputs. + float32_sum = values[0] + values[1] + values[2] + # A float64 sum stored as float32, as an aggregate to a group entity. + float64_sum = np.float32(sum(float(value) for value in values)) + for amount in (float32_sum, float64_sum): + assert round_to_cents(amount) == total / 100 diff --git a/policyengine_us/tools/general.py b/policyengine_us/tools/general.py index 66da7abf428..a2ee840092f 100644 --- a/policyengine_us/tools/general.py +++ b/policyengine_us/tools/general.py @@ -8,12 +8,101 @@ get_override_branch, ) from pathlib import Path +from fractions import Fraction import pandas as pd from policyengine_us.typing import Formula USD = "currency-USD" +def round_to_cents(amount): + """Round a dollar amount to whole cents, as a float64 array. + + Inputs are stored as float32, which holds most cent amounts only + approximately. A sum of several of them can land a fraction of a cent + above or below the whole-cent total they represent: three balances + entered as 178.57, 1,547.79 and 273.64 add to 2,000.0001 in float32. + Rounding the sum before an exact-limit comparison compares the total the + inputs represent, so a split of a total among accounts or people passes + or fails the limit as the total does. + """ + return np.round(np.asarray(amount, dtype=np.float64), 2) + + +def has_whole_cents(amount): + """Check whether each stored value represents a whole number of cents.""" + amount = np.asarray(amount) + return amount == round_to_cents(amount).astype(amount.dtype) + + +def meets_limit_with_share(own, excess, divisor, limit): + """Compare own resources plus an exact share of parental excess with a limit. + + Own resources, excess and any finite limit use whole cents. The share can + include fractions of a cent. With float64, 2,048.30 minus 2,000 gives + 48.30000000000018. Adding one third of that to 1,983.90 gives + 2,000.0000000000002. Compare divisor × own + excess with divisor × limit + in integer cents. + + Positive infinity accepts every share. Negative infinity and NaN reject + every share. + """ + own_cents = np.rint(np.asarray(own, dtype=np.float64) * 100).astype(np.int64) + excess_cents = np.rint(np.asarray(excess, dtype=np.float64) * 100).astype(np.int64) + limit = np.asarray(limit, dtype=np.float64) + finite = np.isfinite(limit) + finite_limits = np.where(finite, limit, 0) + limit_cents = np.rint(finite_limits * 100).astype(np.int64) + divisor = np.asarray(divisor).astype(np.int64) + within_limit = excess_cents <= divisor * (limit_cents - own_cents) + return np.where(finite, within_limit, np.isposinf(limit)) + + +def decimal_resource_difference(amount, deducted): + """Subtract decimal amounts exactly for fractional-cent resource reforms.""" + return np.array( + [ + Fraction(str(left)) - Fraction(str(right)) + for left, right in zip(amount, deducted) + ], + dtype=object, + ) + + +def meets_limit_after_deeming(own, deemed, limit): + """Compare an unrounded parental share with the remaining resource limit.""" + with np.errstate(invalid="ignore"): + own, limit = np.broadcast_arrays(own, limit) + finite = np.isfinite(own) & np.isfinite(limit) + whole_cent_limit = has_whole_cents(limit) + difference = limit - own + remaining = np.where(whole_cent_limit, round_to_cents(difference), difference) + fractional = finite & ~whole_cent_limit + if np.any(fractional): + remaining[fractional] = decimal_resource_difference( + limit[fractional], own[fractional] + ) + return np.where(finite, deemed <= remaining, own + deemed <= limit) + + +def float32_at_most(amount): + """The largest float32 at or below each amount. + + Float variables are stored as float32, and the nearest float32 can lie + above the amount: a share of 100.01 is stored as 100.010002, so own + resources of 1,899.99 plus that share exceed a 2,000 limit that the + exact total meets. Storing the float32 at or below the amount never + fails a total that meets the limit. A total over a whole-cent limit + exceeds it by at least a cent divided by the share's divisor, which is + more than float32's step for any share below 2**11 dollars and divisor + below 80, so there the comparison stays exact both ways. + """ + amount = np.asarray(amount, dtype=np.float64) + nearest = amount.astype(np.float32) + below = np.nextafter(nearest, np.float32(-np.inf)) + return np.where(nearest.astype(np.float64) > amount, below, nearest) + + def has_input_for_period(simulation, variable, period): """Whether the visible array for this exact period was set as an input. diff --git a/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/is_optional_senior_or_disabled_asset_eligible.py b/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/is_optional_senior_or_disabled_asset_eligible.py index 07d79a8108c..a01ae05b2ba 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/is_optional_senior_or_disabled_asset_eligible.py +++ b/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/is_optional_senior_or_disabled_asset_eligible.py @@ -70,10 +70,9 @@ def formula(person, period, parameters): & ~person("is_in_foster_care", month) ) # Inputs are stored as float32, so compare whole cents with the limit. - assets = np.round( + assets = round_to_cents( person.marital_unit.sum(personal_assets) + where(deems_parents, parental_resources, 0), - 2, ) # Maine excludes savings up to a set amount (22 M.R.S. § 3174-AA(2)). diff --git a/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.py b/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.py index 2196ec280fb..4bc82f760fb 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.py +++ b/policyengine_us/variables/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.py @@ -37,7 +37,8 @@ def formula(person, period, parameters): # includes their deemed income. SSI's allocation gates apply: a child # whose own resources exceed the SSI individual limit, or who fails # SSI's immigration test, is deemed nothing. - personal_assets = person("ssi_countable_resources", period) + person( + personal_assets = person("ssi_countable_resources", period) + deemed_assets = person( "ssi_resources_deemed_from_ineligible_parent", period.first_month ) # SSI financial responsibility rules (42 CFR 435.602): the unit is @@ -76,7 +77,11 @@ def formula(person, period, parameters): parental_expense_share, ) ) - assets = marital_unit.sum(personal_assets) + # Balances are float32 inputs, so round their sum to cents. The SSI + # parental share is an equal division with no rounding rule (SI + # 01330.200 B, 416.1202(b)(1)), so compare it with the remaining limit. + own_assets = round_to_cents(marital_unit.sum(personal_assets)) + parental_share = marital_unit.sum(deemed_assets) ma = parameters(period).gov.hhs.medicaid mn = ma.eligibility.categories.medically_needy is_joint = marital_unit.nb_persons() == 2 @@ -87,7 +92,9 @@ def formula(person, period, parameters): mn.limit.assets.couple[state], mn.limit.assets.individual[state], ) - under_limits = (income <= income_limit) & (assets <= asset_limit) + under_limits = (income <= income_limit) & meets_limit_after_deeming( + own_assets, parental_share, asset_limit + ) other_categories = [ category for category in ma.eligibility.categories.covered diff --git a/policyengine_us/variables/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.py b/policyengine_us/variables/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.py index 98455cb905b..099189df194 100644 --- a/policyengine_us/variables/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.py +++ b/policyengine_us/variables/gov/hhs/medicare/savings_programs/eligibility/msp_asset_eligible.py @@ -20,14 +20,43 @@ def formula(person, period, parameters): p = parameters(period).gov.hhs.medicare.savings_programs.eligibility state_code = person.household("state_code_str", period) # Check if asset test applies (some states have eliminated it) - asset_test_applies = p.asset.applies[state_code] + asset_test_applies = p.asset.applies[state_code].astype(bool) # If asset test doesn't apply, everyone is asset-eligible - personal_resources = person("ssi_countable_resources", period.this_year) - married = person.spm_unit("spm_unit_is_married", period.this_year) - countable_resources = where( - married, - person.marital_unit.sum(personal_resources), - personal_resources, + year = period.this_year + personal_resources = person("ssi_countable_resources", year) + california = state_code == "CA" + if np.any(california & asset_test_applies): + simulation = person.simulation + resources = simulation.tax_benefit_system.variables[ + "ssi_countable_resources" + ] + if ( + resources.adds == "gov.ssa.ssi.eligibility.resources.countable" + and resources.get_formula(year) is None + and resources.subtracts is None + and not resources.is_neutralized + and not has_input_for_period( + simulation, "ssi_countable_resources", year + ) + ): + # California's higher limits can expose a full cent of + # drift in the stored sum. Recover cents before summing. + precise_resources = np.zeros(person.count) + for source in parameters( + year + ).gov.ssa.ssi.eligibility.resources.countable: + precise_resources += round_to_cents(person(source, year)) + personal_resources = where( + california, precise_resources, personal_resources + ) + married = person.spm_unit("spm_unit_is_married", year) + # Compare whole cents after combining both spouses' resources. + countable_resources = round_to_cents( + where( + married, + person.marital_unit.sum(personal_resources), + personal_resources, + ) ) # States may set a higher limit than the federal one, never a lower one. state_limit = p.asset.state_limit diff --git a/policyengine_us/variables/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.py b/policyengine_us/variables/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.py index 7cfb1a7e15c..bd326fec4e4 100644 --- a/policyengine_us/variables/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.py +++ b/policyengine_us/variables/gov/hhs/tanf/non_cash/meets_tanf_non_cash_asset_test.py @@ -24,6 +24,7 @@ def formula(spm_unit, period, parameters): 0, ) tx_vehicle_value = max_(vehicle_value - vehicle_exemption, 0) - assets = assets + where(state == "TX", tx_vehicle_value, 0) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(assets + where(state == "TX", tx_vehicle_value, 0)) asset_limit = limits.asset_limit[state] return assets <= asset_limit diff --git a/policyengine_us/variables/gov/local/ca/ala/ga/eligibility/ca_ala_general_assistance_personal_property_eligible.py b/policyengine_us/variables/gov/local/ca/ala/ga/eligibility/ca_ala_general_assistance_personal_property_eligible.py index 63130dc355f..40cd9d1a910 100644 --- a/policyengine_us/variables/gov/local/ca/ala/ga/eligibility/ca_ala_general_assistance_personal_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/ala/ga/eligibility/ca_ala_general_assistance_personal_property_eligible.py @@ -12,4 +12,4 @@ class ca_ala_general_assistance_personal_property_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.local.ca.ala.general_assistance.personal_property personal_property = add(spm_unit, period.this_year, ["personal_property"]) - return personal_property <= p.limit + return round_to_cents(personal_property) <= p.limit diff --git a/policyengine_us/variables/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.py b/policyengine_us/variables/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.py index a889133b06a..380778db53b 100644 --- a/policyengine_us/variables/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/cc/ga/eligibility/ca_cc_general_assistance_personal_property_eligible.py @@ -21,13 +21,19 @@ def formula(spm_unit, period, parameters): # The brochure exempts only money held for property taxes and amounts # under $50, so cash counts toward the limit; spm_unit_cash_assets # aggregates it, and personal_property covers non-cash items. - countable_property = add( - spm_unit, - period.this_year, - [ - "spm_unit_cash_assets", - "personal_property", - "ca_cc_general_assistance_countable_vehicle_value", - ], + cash_and_property = add( + spm_unit, period.this_year, ["spm_unit_cash_assets", "personal_property"] + ) + vehicle_value = spm_unit( + "ca_cc_general_assistance_countable_vehicle_value", period.this_year + ) + countable_property = cash_and_property + vehicle_value + # Keep fractions of a cent from the average vehicle value. + return ( + where( + has_whole_cents(vehicle_value), + round_to_cents(countable_property), + countable_property, + ) + <= p.limit ) - return countable_property <= p.limit diff --git a/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/cash/la_general_relief_cash_asset_eligible.py b/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/cash/la_general_relief_cash_asset_eligible.py index 5e6856ad15f..1a373432a76 100644 --- a/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/cash/la_general_relief_cash_asset_eligible.py +++ b/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/cash/la_general_relief_cash_asset_eligible.py @@ -13,4 +13,4 @@ class la_general_relief_cash_asset_eligible(Variable): def formula(spm_unit, period, parameters): cash = spm_unit("spm_unit_cash_assets", period) limit = spm_unit("la_general_relief_cash_asset_limit", period) - return cash <= limit + return round_to_cents(cash) <= limit diff --git a/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/la_general_relief_home_value_eligible.py b/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/la_general_relief_home_value_eligible.py index b74c8c27269..1ce0b1767e9 100644 --- a/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/la_general_relief_home_value_eligible.py +++ b/policyengine_us/variables/gov/local/ca/la/general_relief/eligibility/la_general_relief_home_value_eligible.py @@ -13,4 +13,4 @@ class la_general_relief_home_value_eligible(Variable): def formula(spm_unit, period, parameters): home_value = add(spm_unit, period, ["assessed_property_value"]) p = parameters(period).gov.local.ca.la.general_relief.eligibility.limit - return home_value <= p.home_value + return round_to_cents(home_value) <= p.home_value diff --git a/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.py b/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.py index 2d5534debf1..81e859610d7 100644 --- a/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.py +++ b/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/liquid_assets/ca_marin_general_relief_liquid_asset_eligible.py @@ -15,4 +15,4 @@ def formula(spm_unit, period, parameters): # dividing the balance across months. cash = spm_unit("spm_unit_cash_assets", period.this_year) limit = spm_unit("ca_marin_general_relief_liquid_asset_limit", period) - return cash <= limit + return round_to_cents(cash) <= limit diff --git a/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.py b/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.py index 1c46e60bfd3..e3a277d09da 100644 --- a/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/marin/general_relief/eligibility/personal_property/ca_marin_general_relief_personal_property_eligible.py @@ -14,13 +14,18 @@ def formula(spm_unit, period, parameters): # unit at exactly the limit is eligible. Personal property is a # year-defined stock; read it with period.this_year so this month-defined # formula does not divide the balance across months. - countable_property = add( - spm_unit, - period.this_year, - [ - "personal_property", - "ca_marin_general_relief_countable_vehicle_value", - ], + personal_property = add(spm_unit, period.this_year, ["personal_property"]) + vehicle_value = spm_unit( + "ca_marin_general_relief_countable_vehicle_value", period.this_year ) + countable_property = personal_property + vehicle_value limit = spm_unit("ca_marin_general_relief_personal_property_limit", period) - return countable_property <= limit + # Keep fractions of a cent from the average vehicle value. + return ( + where( + has_whole_cents(vehicle_value), + round_to_cents(countable_property), + countable_property, + ) + <= limit + ) diff --git a/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.py b/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.py index 47716a2fecb..cfb08182a88 100644 --- a/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.py +++ b/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_countable_vehicle_value.py @@ -12,9 +12,26 @@ class ca_oc_general_relief_countable_vehicle_value(Variable): reference = "https://www.ssa.ocgov.com/sites/ssa/files/2023-04/GR%20Reg%20SECTION%2060%20-%20Approved%20-%20March%202023_0.pdf#page=2" def formula(spm_unit, period, parameters): - # The exclusion amount comes off the vehicle value; the rest counts - # (Sec 60.4.c). We use total household vehicle value as a proxy for the - # one-vehicle rule. p = parameters(period).gov.local.ca.oc.general_relief.resources - vehicle_value = spm_unit.household("household_vehicles_value", period) - return max_(vehicle_value - p.vehicle_exclusion, 0) + household = spm_unit.household + gross = round_to_cents(household("household_vehicles_value", period)) + debt = round_to_cents(household("household_vehicles_debt", period)) + reported_equity = household("household_vehicles_equity", period) + equity = max_( + 0, + where( + np.isneginf(reported_equity), + gross - debt, + round_to_cents(reported_equity), + ), + ) + exempt_equity = round_to_cents( + spm_unit("ca_oc_general_relief_exempt_vehicle_equity", period) + ) + # Use the aggregate as a proxy for one vehicle when individual + # vehicle values are unavailable. + exempt_equity = where(exempt_equity >= 0, exempt_equity, equity) + exemption = where( + exempt_equity <= p.vehicle_exclusion, min_(exempt_equity, equity), 0 + ) + return round_to_cents(equity - exemption) diff --git a/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_exempt_vehicle_equity.py b/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_exempt_vehicle_equity.py new file mode 100644 index 00000000000..5b7b8d190bc --- /dev/null +++ b/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_exempt_vehicle_equity.py @@ -0,0 +1,19 @@ +from policyengine_us.model_api import * + + +class ca_oc_general_relief_exempt_vehicle_equity(Variable): + value_type = float + entity = SPMUnit + label = "Equity of the exempt Orange County General Relief vehicle" + documentation = ( + "The largest individual net vehicle value within the exemption limit. " + "Supply zero if no vehicle qualifies. This input identifies the one " + "vehicle to exclude from total vehicle equity. A value of -1 means " + "the exempt vehicle equity is unknown." + ) + unit = USD + quantity_type = STOCK + definition_period = YEAR + defined_for = "in_oc" + default_value = -1 + reference = "https://www.ssa.ocgov.com/sites/ssa/files/2023-04/GR%20Reg%20SECTION%2060%20-%20Approved%20-%20March%202023_0.pdf#page=2" diff --git a/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.py b/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.py index 165082c8831..f7d96329385 100644 --- a/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.py +++ b/policyengine_us/variables/gov/local/ca/oc/general_relief/resources/ca_oc_general_relief_resources_eligible.py @@ -16,4 +16,4 @@ def formula(spm_unit, period, parameters): countable_property = spm_unit( "ca_oc_general_relief_countable_property", period.this_year ) - return countable_property <= p.property_limit + return round_to_cents(countable_property) <= p.property_limit diff --git a/policyengine_us/variables/gov/local/ca/riv/general_relief/eligibility/ca_riv_general_relief_property_eligible.py b/policyengine_us/variables/gov/local/ca/riv/general_relief/eligibility/ca_riv_general_relief_property_eligible.py index f0d23358da0..d752b3bf45b 100644 --- a/policyengine_us/variables/gov/local/ca/riv/general_relief/eligibility/ca_riv_general_relief_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/riv/general_relief/eligibility/ca_riv_general_relief_property_eligible.py @@ -17,4 +17,4 @@ def formula(spm_unit, period, parameters): # The fact sheet's property bullet says the total cannot exceed the # limit, so a unit holding exactly the limit is eligible. # Inputs are stored as float32, so compare whole cents with the limit. - return np.round(total_property_value, 2) <= p.limit + return round_to_cents(total_property_value) <= p.limit diff --git a/policyengine_us/variables/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.py b/policyengine_us/variables/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.py index b39e9a0df29..fb8cf0683f3 100644 --- a/policyengine_us/variables/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.py +++ b/policyengine_us/variables/gov/local/ca/sbd/general_relief/eligibility/ca_sbd_general_relief_resources_eligible.py @@ -18,15 +18,17 @@ def formula(spm_unit, period, parameters): # principal residence under this limit is not modeled — vehicles # are always evaluated under the personal property test. real_property = add(spm_unit, period.this_year, ["assessed_property_value"]) - real_property_eligible = real_property <= p.real_property_limit + real_property_eligible = round_to_cents(real_property) <= p.real_property_limit countable_resources = spm_unit( "ca_sbd_general_relief_countable_resources", period.this_year ) - personal_property_eligible = countable_resources <= p.personal_property_limit + personal_property_eligible = ( + round_to_cents(countable_resources) <= p.personal_property_limit + ) # Liquid assets (cash, bank accounts, stocks, and bonds) may not # exceed the limit, modeled as a flat per-assistance-unit amount. liquid_assets = spm_unit("spm_unit_cash_assets", period.this_year) - liquid_asset_eligible = liquid_assets <= p.liquid_asset_limit + liquid_asset_eligible = round_to_cents(liquid_assets) <= p.liquid_asset_limit return ( real_property_eligible & personal_property_eligible & liquid_asset_eligible ) diff --git a/policyengine_us/variables/gov/local/ca/scc/ga/eligibility/ca_scc_general_assistance_personal_property_eligible.py b/policyengine_us/variables/gov/local/ca/scc/ga/eligibility/ca_scc_general_assistance_personal_property_eligible.py index d7190857a09..e00302fef72 100644 --- a/policyengine_us/variables/gov/local/ca/scc/ga/eligibility/ca_scc_general_assistance_personal_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/scc/ga/eligibility/ca_scc_general_assistance_personal_property_eligible.py @@ -17,13 +17,19 @@ def formula(spm_unit, period, parameters): # The handbook counts cash on hand, bank accounts, and securities as # personal property, which spm_unit_cash_assets aggregates; # personal_property covers the remaining non-cash items. - countable_property = add( - spm_unit, - period.this_year, - [ - "spm_unit_cash_assets", - "personal_property", - "ca_scc_general_assistance_countable_vehicle_value", - ], + cash_and_property = add( + spm_unit, period.this_year, ["spm_unit_cash_assets", "personal_property"] + ) + vehicle_value = spm_unit( + "ca_scc_general_assistance_countable_vehicle_value", period.this_year + ) + countable_property = cash_and_property + vehicle_value + # Keep fractions of a cent from the average vehicle value. + return ( + where( + has_whole_cents(vehicle_value), + round_to_cents(countable_property), + countable_property, + ) + <= p.limit ) - return countable_property <= p.limit diff --git a/policyengine_us/variables/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.py b/policyengine_us/variables/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.py index f9507d7c6f9..6944e00c4bb 100644 --- a/policyengine_us/variables/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/sf/caap/eligibility/ca_sf_caap_personal_property_eligible.py @@ -21,4 +21,4 @@ def formula(spm_unit, period, parameters): # reserves; units of 3+ apply the 2-person limit. Title 22 Section 50420 # scales further for larger units, but we don't track that at the moment. limit = where(budget_unit_size >= 2, p.couple, p.single) - return cash_assets <= limit + return round_to_cents(cash_assets) <= limit diff --git a/policyengine_us/variables/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.py b/policyengine_us/variables/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.py index 38de916cf1b..111fc9579a7 100644 --- a/policyengine_us/variables/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.py +++ b/policyengine_us/variables/gov/local/ca/smc/general_assistance/eligibility/ca_smc_general_assistance_property_eligible.py @@ -16,4 +16,11 @@ class ca_smc_general_assistance_property_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.local.ca.smc.general_assistance.property countable = spm_unit("ca_smc_general_assistance_countable_property", period) - return countable < p.limit + vehicle_value = spm_unit( + "ca_smc_general_assistance_countable_vehicle_value", period + ) + # Keep fractions of a cent from the average vehicle value. + return ( + where(has_whole_cents(vehicle_value), round_to_cents(countable), countable) + < p.limit + ) diff --git a/policyengine_us/variables/gov/local/ca/smc/general_assistance/property/ca_smc_general_assistance_countable_vehicle_value.py b/policyengine_us/variables/gov/local/ca/smc/general_assistance/property/ca_smc_general_assistance_countable_vehicle_value.py index dd371f4cd10..d8fac7d4452 100644 --- a/policyengine_us/variables/gov/local/ca/smc/general_assistance/property/ca_smc_general_assistance_countable_vehicle_value.py +++ b/policyengine_us/variables/gov/local/ca/smc/general_assistance/property/ca_smc_general_assistance_countable_vehicle_value.py @@ -17,14 +17,17 @@ def formula(spm_unit, period, parameters): p = parameters(period).gov.local.ca.smc.general_assistance.property household = spm_unit.household vehicle_count = household("household_vehicles_owned", period) - vehicle_value = household("household_vehicles_value", period) + # Recover whole cents before dividing and deducting the exemption. + vehicle_value = round_to_cents(household("household_vehicles_value", period)) average_vehicle_value = where( vehicle_count > 0, - vehicle_value / vehicle_count, + vehicle_value / max_(vehicle_count, 1), 0, ) additional_vehicle_count = max_(vehicle_count - 1, 0) additional_vehicle_equity = average_vehicle_value * additional_vehicle_count + # Approximate countable equity by deducting the combined exemption + # threshold from the estimated equity of the additional vehicles. return max_( additional_vehicle_equity - p.additional_vehicle_combined_equity_limit, 0, diff --git a/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.py b/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.py index a1c99d3c6ae..336486d0ca4 100644 --- a/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.py +++ b/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/deemed/ssi_resources_deemed_from_ineligible_parent.py @@ -109,6 +109,11 @@ class ssi_resources_deemed_from_ineligible_parent(Variable): "https://secure.ssa.gov/poms.nsf/lnx/0501330340", ) + def __init__(self, baseline_variable=None): + super().__init__(baseline_variable) + # Eligibility thresholds can distinguish shares that float32 merges. + self.dtype = np.dtype(np.float64) + def formula(person, period, parameters): p = parameters(period).gov.ssa.ssi.eligibility.resources.limit # Under 416.1167 a temporarily absent person should be entered in @@ -120,11 +125,32 @@ def formula(person, period, parameters): # 'only to the extent that those resources exceed the resource limits # described in § 416.1205': use the reformable individual/couple limits. allowance = where(parent_count > 1, p.couple, p.individual) + # Balances are float32 inputs. Each deemor's are added together, then + # the deemors' totals, so the sum can land a fraction of a cent off + # the total it represents: round it to cents before the limit comes off. + parental_resources = round_to_cents(parental_resources) excess = max_(0, parental_resources - allowance) + excess_cents = np.rint(excess * 100) + whole_cent_allowance = has_whole_cents(allowance) + whole_cent_limit = has_whole_cents(p.individual) + fractional = ( + ~whole_cent_allowance + & np.isfinite(allowance) + & np.isfinite(parental_resources) + ) + # Subtract and divide decimal reform amounts before converting the + # share to float64. Binary cancellation can put equality over the limit. + fractional_excess = max_( + 0, + decimal_resource_difference( + parental_resources[fractional], allowance[fractional] + ), + ) # Do not discard ABD parents. SI 01330.310 B-C says zero if parent(s) # meets resource eligibility, usual deeming if not. The Ryder example # (.340) has an ABD mother failing the couple limit: 3100-3000=100. - own_resources = person("ssi_countable_resources", period) + # The child's own float32 balances are added together: round to cents. + own_resources = round_to_cents(person("ssi_countable_resources", period)) active = person("is_ssi_resource_deeming_child", period) & ( own_resources <= p.individual ) @@ -148,9 +174,23 @@ def formula(person, period, parameters): pool_count = int(np.max(pool, initial=-1)) + 1 for _ in range(rounds): count = np.bincount(pool[active & income_eligible], minlength=pool_count) - share = excess / max_(1, count[pool]) + divisor = max_(1, count[pool]) + # SI 01330.200 B divides the excess equally. Compute the + # baseline share from whole cents and keep any reform precision. + share = where( + whole_cent_allowance, excess_cents / (100 * divisor), excess / divisor + ) + if fractional_excess.size: + share[fractional] = fractional_excess / divisor[fractional].astype( + object + ) deemed = where(active, share, deemed) - remaining = active & (own_resources + share <= p.individual) + within_limit = where( + whole_cent_allowance & whole_cent_limit, + meets_limit_with_share(own_resources, excess, divisor, p.individual), + meets_limit_after_deeming(own_resources, share, p.individual), + ) + remaining = active & within_limit if np.array_equal(active, remaining): break active = remaining diff --git a/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.py b/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.py index 67fde62db37..ada0ef05202 100644 --- a/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.py +++ b/policyengine_us/variables/gov/ssa/ssi/eligibility/resources/meets_ssi_resource_test.py @@ -21,22 +21,17 @@ def formula(person, period, parameters): joint_claim = person("ssi_claim_is_joint", period) personal_resources = person("ssi_countable_resources", period) spousal_deeming = person("is_ssi_spousal_resource_deeming_applies", period) - deemed_resources = add( - person, - period, - [ - "ssi_resources_deemed_from_ineligible_spouse", - "ssi_resources_deemed_from_ineligible_parent", - ], - ) - # 416.1205(b): an eligible couple's combined resources. The couple - # is two spouses, so add the spouse rather than the marital unit. + spouse_resources = person("ssi_resources_deemed_from_ineligible_spouse", period) + parent_resources = person("ssi_resources_deemed_from_ineligible_parent", period) + # Count the two spouses' resources for an eligible couple (20 CFR 416.1205(b)). + # Compare parental excess separately from whole-cent own and spouse balances. spouse = np.maximum(_ssi_spouse_index(person, period), 0) - countable_resources = where( - _ssi_resource_couple(person, period), - personal_resources + personal_resources[spouse], - personal_resources + deemed_resources, + combines_spouses = _ssi_resource_couple(person, period) + own_and_spouse = round_to_cents( + personal_resources + + where(combines_spouses, personal_resources[spouse], spouse_resources) ) + parental_share = where(combines_spouses, 0, parent_resources) # 416.1205(a): an individual living with an ineligible spouse counts # 'including the resources of the spouse' against the spouse limit. # This applies even when no income is deemed or the spouse owns zero. @@ -45,4 +40,4 @@ def formula(person, period, parameters): p.eligibility.resources.limit.couple, p.eligibility.resources.limit.individual, ) - return countable_resources <= resource_limit + return meets_limit_after_deeming(own_and_spouse, parental_share, resource_limit) diff --git a/policyengine_us/variables/gov/states/ak/dpa/atap/eligibility/ak_atap_resources_eligible.py b/policyengine_us/variables/gov/states/ak/dpa/atap/eligibility/ak_atap_resources_eligible.py index 34b4fd788d9..b352a28ccb2 100644 --- a/policyengine_us/variables/gov/states/ak/dpa/atap/eligibility/ak_atap_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ak/dpa/atap/eligibility/ak_atap_resources_eligible.py @@ -14,7 +14,8 @@ class ak_atap_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ak.dpa.atap.resource_limit - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) # Higher limit if household has elderly member (age 60+) person = spm_unit.members diff --git a/policyengine_us/variables/gov/states/ar/dhs/tea/eligibility/ar_tea_resources_eligible.py b/policyengine_us/variables/gov/states/ar/dhs/tea/eligibility/ar_tea_resources_eligible.py index a9dd2f42819..3d6ecda781d 100644 --- a/policyengine_us/variables/gov/states/ar/dhs/tea/eligibility/ar_tea_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ar/dhs/tea/eligibility/ar_tea_resources_eligible.py @@ -15,5 +15,6 @@ def formula(spm_unit, period, parameters): # Per 208.00.13 Ark. Code R. Section 001, Section 3.4 p = parameters(period).gov.states.ar.dhs.tea.resources # Use federal asset calculation for SPM unit - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/az/hhs/tanf/eligibility/az_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/az/hhs/tanf/eligibility/az_tanf_resources_eligible.py index 4cdea6416b5..d7b36d6b804 100644 --- a/policyengine_us/variables/gov/states/az/hhs/tanf/eligibility/az_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/az/hhs/tanf/eligibility/az_tanf_resources_eligible.py @@ -13,5 +13,6 @@ class az_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.az.hhs.tanf.resources - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.py b/policyengine_us/variables/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.py index 89ba309b6b7..af80f3980bc 100644 --- a/policyengine_us/variables/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.py +++ b/policyengine_us/variables/gov/states/ca/cdss/capi/eligibility/ca_capi_resource_eligible.py @@ -10,7 +10,8 @@ class ca_capi_resource_eligible(Variable): reference = "https://www.cdss.ca.gov/Portals/9/CAPI/CAPI_Regulations-Accessible.pdf" def formula(spm_unit, period, parameters): - resources = spm_unit("ca_capi_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("ca_capi_resources", period)) p = parameters(period).gov.states.ca.cdss.capi.resources married = spm_unit("spm_unit_is_married", period) resource_limit = where(married, p.limit.couple, p.limit.single) diff --git a/policyengine_us/variables/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.py index 3d48ac8ead1..346d9c99fed 100644 --- a/policyengine_us/variables/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ca/cdss/tanf/cash/eligibility/ca_tanf_resources_eligible.py @@ -10,6 +10,7 @@ class ca_tanf_resources_eligible(Variable): reference = "https://my.dpss.lacounty.gov/public/en/home/epolicy/program/calworks/property/property.html" def formula(spm_unit, period, parameters): - resources = spm_unit("ca_tanf_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("ca_tanf_resources", period)) limit = spm_unit("ca_tanf_resources_limit", period) return resources <= limit diff --git a/policyengine_us/variables/gov/states/co/ssa/oap/_spouses.py b/policyengine_us/variables/gov/states/co/ssa/oap/_spouses.py index d518191f4ec..846612abd64 100644 --- a/policyengine_us/variables/gov/states/co/ssa/oap/_spouses.py +++ b/policyengine_us/variables/gov/states/co/ssa/oap/_spouses.py @@ -17,3 +17,9 @@ def co_oap_couple_total(person, year, values): def co_oap_is_married(person, year): """Marriage for OAP's shared $20 disregard (3.533(A)(2)(c)).""" return state_is_married(person, year) + + +def co_oap_has_separation_decree(person, year): + """Recognize a decree reported by either spouse (9 CCR 2503-5 3.520.63).""" + separated = person("is_separated_under_decree", year) + return co_oap_couple_total(person, year, separated) > 0 diff --git a/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_deemed_income.py b/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_deemed_income.py index ca6eeb4bedd..b698a142af2 100644 --- a/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_deemed_income.py +++ b/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_deemed_income.py @@ -1,6 +1,7 @@ from policyengine_us.model_api import * from policyengine_us.variables.gov.states.co.ssa.oap._spouses import ( co_oap_couple_total, + co_oap_has_separation_decree, ) from policyengine_us.variables.gov.states.co.ssa.oap._precision import ( cents, @@ -22,7 +23,10 @@ def formula(person, period, parameters): p = parameters(period).gov.states.co.ssa.oap # 3.534(C): no income is deemed from a spouse who receives Adult # Financial, SSI or Medicaid with income within the OAP limit. - deemable = ~person("co_oap_deeming_exempt", period) + year = period.this_year + # Section 3.520.63(D) treats legally separated clients as unmarried. + separated = co_oap_has_separation_decree(person, year) + deemable = ~(person("co_oap_deeming_exempt", period) | separated) # Monthly amounts in cents, SSI as SSA pays it (see _precision.py). ssi = ssi_paid(person("ssi", period)) earned = cents(person("ssi_earned_income", period)) * deemable @@ -53,7 +57,6 @@ def formula(person, period, parameters): # 3.520.786's exemptions apply to the client, spouse and sponsor, not # the child, so the child's gross income counts, child support and SSI # included, with no source below zero. - year = period.this_year tanf_age = parameters(period).gov.hhs.tanf.cash.eligibility.age_limit age_limit = where( person("is_in_secondary_school", year), diff --git a/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py b/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py index 5d9e562ce4c..9f3afd957aa 100644 --- a/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py +++ b/policyengine_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py @@ -1,4 +1,9 @@ from policyengine_us.model_api import * +from policyengine_us.variables.gov.states.co.ssa.oap._spouses import ( + co_oap_couple_total, + co_oap_has_separation_decree, + co_oap_is_married, +) class co_oap_eligible(Variable): @@ -7,13 +12,26 @@ class co_oap_eligible(Variable): label = "Colorado Old Age Pension Eligible" definition_period = YEAR defined_for = StateCode.CO + reference = ( + "https://www.coloradosos.gov/CCR/GenerateRulePdf.do?ruleVersionId=10694#page=35" + ) def formula(person, period, parameters): - assets = person("ssi_countable_resources", period) - joint_claim = person("ssi_claim_is_joint", period) + # Sections 3.520.63(D) and 3.520.72(C) exclude a legally separated + # spouse's sole property. Either spouse can report the decree. + couple_separated = co_oap_has_separation_decree(person, period) + own_assets = person("ssi_countable_resources", period) + couple_assets = co_oap_couple_total(person, period, own_assets) + assets = round_to_cents(where(couple_separated, own_assets, couple_assets)) + married = ~couple_separated & ( + co_oap_is_married(person, period) | person("ssi_claim_is_joint", period) + ) p = parameters(period).gov.states.co.ssa.oap - asset_limit = where(joint_claim, p.resources.couple, p.resources.single) - below_asset_limit = assets <= asset_limit + asset_limit = where(married, p.resources.couple, p.resources.single) + # Section 3.520.71(A)(1) requires resources below the limit. + below_asset_limit = where( + married | couple_separated, assets < asset_limit, assets <= asset_limit + ) age = person("age", period) in_age_range = p.age_range.calc(age) return below_asset_limit & in_age_range diff --git a/policyengine_us/variables/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.py b/policyengine_us/variables/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.py index ce3eca91f88..944dc7b8918 100644 --- a/policyengine_us/variables/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.py +++ b/policyengine_us/variables/gov/states/ct/dss/ssp/eligibility/ct_ssp_resource_eligible.py @@ -40,4 +40,5 @@ def formula(person, period, parameters): p.asset_limit.couple, p.asset_limit.individual, ) - return resources <= limit + # Inputs are stored as float32, so compare whole cents with the limit. + return round_to_cents(resources) <= limit diff --git a/policyengine_us/variables/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.py b/policyengine_us/variables/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.py index 5b6de4508de..379336c8115 100644 --- a/policyengine_us/variables/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ct/dss/tfa/eligibility/ct_tfa_resources_eligible.py @@ -13,5 +13,6 @@ class ct_tfa_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ct.dss.tfa.resource - assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return assets <= p.limit diff --git a/policyengine_us/variables/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.py index d69a7d04eaf..37b07a2aa2c 100644 --- a/policyengine_us/variables/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/dc/dhs/tanf/eligibility/dc_tanf_resources_eligible.py @@ -24,5 +24,8 @@ def formula(spm_unit, period, parameters): p.higher.amount, p.lower.amount, ) - countable_resources = spm_unit("dc_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("dc_tanf_countable_resources", period) + ) return countable_resources <= resource_limit diff --git a/policyengine_us/variables/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.py index 97c1189e3b9..692ba24d48a 100644 --- a/policyengine_us/variables/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/de/dhss/tanf/eligibility/de_tanf_resources_eligible.py @@ -12,6 +12,7 @@ class de_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): # Per DSSM 4002: Resource limit is $10,000 p = parameters(period).gov.states.de.dhss.tanf - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/fl/dcf/tanf/eligibility/fl_tca_resources_eligible.py b/policyengine_us/variables/gov/states/fl/dcf/tanf/eligibility/fl_tca_resources_eligible.py index 1be15ff8877..58cbc2d93e7 100644 --- a/policyengine_us/variables/gov/states/fl/dcf/tanf/eligibility/fl_tca_resources_eligible.py +++ b/policyengine_us/variables/gov/states/fl/dcf/tanf/eligibility/fl_tca_resources_eligible.py @@ -15,5 +15,6 @@ class fl_tca_resources_eligible(Variable): def formula(spm_unit, period, parameters): # Per Florida DCF: Countable assets must be <= $2,000 p = parameters(period).gov.states.fl.dcf.tanf.resources - assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return assets <= p.asset_limit diff --git a/policyengine_us/variables/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.py index a15e7b7049c..5d7e01e7b23 100644 --- a/policyengine_us/variables/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ga/dfcs/tanf/eligibility/ga_tanf_resources_eligible.py @@ -18,5 +18,6 @@ def formula(spm_unit, period, parameters): # In a more complete implementation, this would account for # excluded resources (primary residence, household goods, etc.) # and vehicle value limits - cash_assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + cash_assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return cash_assets <= p.limit diff --git a/policyengine_us/variables/gov/states/ia/dhs/fip/eligibility/ia_fip_resources_eligible.py b/policyengine_us/variables/gov/states/ia/dhs/fip/eligibility/ia_fip_resources_eligible.py index 5db0c542a5b..fb075e93bb7 100644 --- a/policyengine_us/variables/gov/states/ia/dhs/fip/eligibility/ia_fip_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ia/dhs/fip/eligibility/ia_fip_resources_eligible.py @@ -19,5 +19,6 @@ def formula(spm_unit, period, parameters): p.recipient_limit, p.applicant_limit, ) - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= limit diff --git a/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_eligible.py b/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_eligible.py index e3390ac1274..23d1dcb721d 100644 --- a/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_eligible.py +++ b/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_eligible.py @@ -44,8 +44,10 @@ def formula(person, period, parameters): state_couple_total(person, period.this_year, resource), _ssi_couple_total(person, period.this_year, resource), ) - resource = where(couple, combined, resource) - resource = resource + person("ia_ssa_resources_deemed_from_parents", period) + # Round summed balances to cents and add the exact parental share. + resource = round_to_cents(where(couple, combined, resource)) + person( + "ia_ssa_resources_deemed_from_parents", period + ) # 6-B Resources prints "$2,000 for an individual" and "$3,000 for a # married couple living together" under 20 CFR 416.1202; these equal # the SSI limits of 20 CFR 416.1205, so the federal parameters are used diff --git a/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.py b/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.py index 7ffa7cf73c7..312f25dec08 100644 --- a/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.py +++ b/policyengine_us/variables/gov/states/ia/hhs/ssa/ia_ssa_resources_deemed_from_parents.py @@ -53,21 +53,28 @@ def formula(person, period, parameters): person, period, resources ) allowance = where(parent_count > 1, limit.couple, limit.individual) - excess = max_(parental_resources - allowance, 0) + # Balances are float32 inputs, so round the deemors' total and the + # child's own balances to cents, as SSI's deeming does. The share + # stays exact, so own + share is tested in whole cents. + excess = max_(round_to_cents(parental_resources) - allowance, 0) child = person("is_ssi_resource_deeming_child", period) ihhrc = person("ia_ssa_nonfinancial_eligible", period) & ( person("ia_ssa_ihhrc_amount", period) > 0 ) - own = person("ssi_countable_resources", period.this_year) + own = round_to_cents(person("ssi_countable_resources", period.this_year)) eligible = child & (receives_ssi | ihhrc) & (own <= limit.individual) pool_count = int(np.max(pool, initial=-1)) + 1 share = excess # Each round removes at least one child or leaves the result stable. for _ in range(int(np.max(person.household.nb_persons(), initial=0)) + 1): count = np.bincount(pool[eligible], minlength=pool_count) - share = excess / max_(count[pool], 1) - remaining = eligible & (own + share <= limit.individual) + divisor = max_(count[pool], 1) + share = excess / divisor + remaining = eligible & meets_limit_with_share( + own, excess, divisor, limit.individual + ) if np.array_equal(remaining, eligible): break eligible = remaining - return child * share + # Stored as float32, a share must not round up past the exact total. + return float32_at_most(child * share) diff --git a/policyengine_us/variables/gov/states/id/tafi/eligibility/id_tafi_resources_eligible.py b/policyengine_us/variables/gov/states/id/tafi/eligibility/id_tafi_resources_eligible.py index f348121d4c0..41902b707e1 100644 --- a/policyengine_us/variables/gov/states/id/tafi/eligibility/id_tafi_resources_eligible.py +++ b/policyengine_us/variables/gov/states/id/tafi/eligibility/id_tafi_resources_eligible.py @@ -12,5 +12,6 @@ class id_tafi_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.id.tafi.resources # Per IDAPA 16.03.08.200: Resources must not exceed $5,000 - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.py b/policyengine_us/variables/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.py index 70eeaf73810..2912c634701 100644 --- a/policyengine_us/variables/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.py +++ b/policyengine_us/variables/gov/states/il/dhs/aabd/asset/il_aabd_asset_value_eligible.py @@ -16,7 +16,8 @@ class il_aabd_asset_value_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.il.dhs.aabd.asset.disregard size = spm_unit("spm_unit_size", period) - countable_asset = spm_unit("il_aabd_countable_assets", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_asset = round_to_cents(spm_unit("il_aabd_countable_assets", period)) capped_size = min_(size, 2) reduced_unit_size = max_(size - 2, 0) p1 = p.base[capped_size] diff --git a/policyengine_us/variables/gov/states/in/fssa/tanf/eligibility/in_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/in/fssa/tanf/eligibility/in_tanf_resources_eligible.py index bf033a68739..621ec6ead8e 100644 --- a/policyengine_us/variables/gov/states/in/fssa/tanf/eligibility/in_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/in/fssa/tanf/eligibility/in_tanf_resources_eligible.py @@ -14,7 +14,8 @@ class in_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states["in"].fssa.tanf.resources.limit - countable = spm_unit("in_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable = round_to_cents(spm_unit("in_tanf_countable_resources", period)) is_enrolled = spm_unit("is_tanf_enrolled", period) limit = where( diff --git a/policyengine_us/variables/gov/states/ks/dcf/tanf/eligibility/ks_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/ks/dcf/tanf/eligibility/ks_tanf_resources_eligible.py index 8fcc8858c32..87b2e17eaf5 100644 --- a/policyengine_us/variables/gov/states/ks/dcf/tanf/eligibility/ks_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ks/dcf/tanf/eligibility/ks_tanf_resources_eligible.py @@ -15,5 +15,6 @@ class ks_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): # Per KEESM 5110: Resource limit is $3,000 p = parameters(period).gov.states.ks.dcf.tanf.resource_limit - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.amount diff --git a/policyengine_us/variables/gov/states/ky/dcbs/ktap/eligibility/ky_ktap_resource_eligible.py b/policyengine_us/variables/gov/states/ky/dcbs/ktap/eligibility/ky_ktap_resource_eligible.py index e73597c2678..6dc029862af 100644 --- a/policyengine_us/variables/gov/states/ky/dcbs/ktap/eligibility/ky_ktap_resource_eligible.py +++ b/policyengine_us/variables/gov/states/ky/dcbs/ktap/eligibility/ky_ktap_resource_eligible.py @@ -11,5 +11,6 @@ class ky_ktap_resource_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ky.dcbs.ktap.eligibility - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/md/dhs/fia/paa/md_paa_eligible.py b/policyengine_us/variables/gov/states/md/dhs/fia/paa/md_paa_eligible.py index 5d71e550170..2559d8f9f62 100644 --- a/policyengine_us/variables/gov/states/md/dhs/fia/paa/md_paa_eligible.py +++ b/policyengine_us/variables/gov/states/md/dhs/fia/paa/md_paa_eligible.py @@ -61,7 +61,10 @@ def formula(person, period, parameters): ssi_resource_limit = parameters( period ).gov.ssa.ssi.eligibility.resources.limit.individual - ssi_resources = person("ssi_countable_resources", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + ssi_resources = round_to_cents( + person("ssi_countable_resources", period.this_year) + ) resource_eligible = ssi_resources <= ssi_resource_limit living_arrangement = person("md_paa_living_arrangement", period) in_facility = living_arrangement != living_arrangement.possible_values.NONE diff --git a/policyengine_us/variables/gov/states/me/dhhs/tanf/eligibility/me_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/me/dhhs/tanf/eligibility/me_tanf_resources_eligible.py index 64f0dd1b647..651e4499b58 100644 --- a/policyengine_us/variables/gov/states/me/dhhs/tanf/eligibility/me_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/me/dhhs/tanf/eligibility/me_tanf_resources_eligible.py @@ -17,5 +17,8 @@ def formula(spm_unit, period, parameters): # Resource limit is $10,000 per family # One vehicle per licensed driver is exempt p = parameters(period).gov.states.me.dhhs.tanf - countable_resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("spm_unit_cash_assets", period.this_year) + ) return countable_resources <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.py b/policyengine_us/variables/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.py index f779f24d077..622cc1efd5a 100644 --- a/policyengine_us/variables/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.py +++ b/policyengine_us/variables/gov/states/mi/mdhhs/fip/eligibility/mi_fip_resources_eligible.py @@ -17,6 +17,7 @@ def formula(spm_unit, period, parameters): # Count liquid financial assets explicitly. BEM 400 excludes several # non-liquid resources that are not yet modeled separately here. - assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return assets <= p.resources.limit diff --git a/policyengine_us/variables/gov/states/mn/dcyf/mfip/eligibility/mn_mfip_resources_eligible.py b/policyengine_us/variables/gov/states/mn/dcyf/mfip/eligibility/mn_mfip_resources_eligible.py index df1826a132e..b23c3a1da1a 100644 --- a/policyengine_us/variables/gov/states/mn/dcyf/mfip/eligibility/mn_mfip_resources_eligible.py +++ b/policyengine_us/variables/gov/states/mn/dcyf/mfip/eligibility/mn_mfip_resources_eligible.py @@ -13,5 +13,6 @@ def formula(spm_unit, period, parameters): # Per MN Stat. 256P.02, Subd. 2: # Assets must not exceed $10,000. p = parameters(period).gov.states.mn.dcyf.mfip.resources - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.py b/policyengine_us/variables/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.py index 70214720794..af5cdd1c941 100644 --- a/policyengine_us/variables/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.py +++ b/policyengine_us/variables/gov/states/mn/dhs/msa/eligibility/mn_msa_resource_eligible.py @@ -28,7 +28,7 @@ def formula(person, period, parameters): p = parameters(period).gov.states.mn.dhs.msa.eligibility receives_ssi = (person("ssi", period) > 0) | person("receives_ssi", period) countable_resources = person("ssi_countable_resources", period.this_year) - unit_resources = _ssi_couple_total( - person, period.this_year, countable_resources + unit_resources = round_to_cents( + _ssi_couple_total(person, period.this_year, countable_resources) ) return receives_ssi | (unit_resources <= p.asset_limit.non_ssi_track) diff --git a/policyengine_us/variables/gov/states/mo/dss/tanf/eligibility/mo_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/mo/dss/tanf/eligibility/mo_tanf_resources_eligible.py index 29a469b49b0..9c0cee65722 100644 --- a/policyengine_us/variables/gov/states/mo/dss/tanf/eligibility/mo_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/mo/dss/tanf/eligibility/mo_tanf_resources_eligible.py @@ -20,5 +20,6 @@ def formula(spm_unit, period, parameters): # pact"); IEP participation is not observable, so the $1,000 limit # applies to all units. p = parameters(period).gov.states.mo.dss.tanf.resource_limit - resources = spm_unit("mo_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("mo_tanf_countable_resources", period)) return resources <= p.amount diff --git a/policyengine_us/variables/gov/states/ms/dhs/tanf/eligibility/ms_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/ms/dhs/tanf/eligibility/ms_tanf_resources_eligible.py index 337e0289112..d469c4e8bbb 100644 --- a/policyengine_us/variables/gov/states/ms/dhs/tanf/eligibility/ms_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ms/dhs/tanf/eligibility/ms_tanf_resources_eligible.py @@ -15,5 +15,8 @@ class ms_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ms.dhs.tanf.resources - household_assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + household_assets = round_to_cents( + spm_unit("spm_unit_cash_assets", period.this_year) + ) return household_assets <= p.limit diff --git a/policyengine_us/variables/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.py b/policyengine_us/variables/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.py index 8cf9b04ed93..edb83ae7be6 100644 --- a/policyengine_us/variables/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.py +++ b/policyengine_us/variables/gov/states/ms/dom/hmw/eligibility/ms_hmw_resource_eligible.py @@ -23,4 +23,5 @@ def formula(person, period, parameters): personal_resources, ) p = parameters(period).gov.states.ms.dom.hmw.resources.limit - return resources < where(couple, p.couple, p.individual) + # Inputs are stored as float32, so compare whole cents with the limit. + return round_to_cents(resources) < where(couple, p.couple, p.individual) diff --git a/policyengine_us/variables/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.py index d05fd7d9d16..cb4dcd924f6 100644 --- a/policyengine_us/variables/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/mt/dhs/tanf/eligibility/mt_tanf_resources_eligible.py @@ -11,5 +11,8 @@ class mt_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.mt.dhs.tanf.resource_limit - countable_resources = spm_unit("mt_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("mt_tanf_countable_resources", period) + ) return countable_resources <= p.amount diff --git a/policyengine_us/variables/gov/states/nc/ncdhhs/sa/nc_sa_eligible.py b/policyengine_us/variables/gov/states/nc/ncdhhs/sa/nc_sa_eligible.py index d7e56816df5..12da67e0bf2 100644 --- a/policyengine_us/variables/gov/states/nc/ncdhhs/sa/nc_sa_eligible.py +++ b/policyengine_us/variables/gov/states/nc/ncdhhs/sa/nc_sa_eligible.py @@ -59,7 +59,7 @@ def formula(person, period, parameters): over_income_for_ssi & aged_blind_disabled & immigration_eligible - & (resources <= resource_limit) + & (round_to_cents(resources) <= resource_limit) ) # "If an individual's SA payment when rounded to the nearest lower # whole dollar is $0.00, the individual is not eligible" (SA-3220 diff --git a/policyengine_us/variables/gov/states/nd/dhs/tanf/eligibility/nd_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/nd/dhs/tanf/eligibility/nd_tanf_resources_eligible.py index cba07aa9691..d8630342090 100644 --- a/policyengine_us/variables/gov/states/nd/dhs/tanf/eligibility/nd_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/nd/dhs/tanf/eligibility/nd_tanf_resources_eligible.py @@ -11,7 +11,8 @@ class nd_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.nd.dhs.tanf.resources.limit - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) unit_size = spm_unit("spm_unit_size", period.this_year) capped_size = min_(unit_size, 2) base_limit = p.base[capped_size] diff --git a/policyengine_us/variables/gov/states/ne/dhhs/adc/eligibility/ne_adc_resources_eligible.py b/policyengine_us/variables/gov/states/ne/dhhs/adc/eligibility/ne_adc_resources_eligible.py index d2a5813e246..e57f9d19eca 100644 --- a/policyengine_us/variables/gov/states/ne/dhhs/adc/eligibility/ne_adc_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ne/dhhs/adc/eligibility/ne_adc_resources_eligible.py @@ -15,7 +15,8 @@ class ne_adc_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ne.dhhs.adc # Count explicitly modeled liquid financial assets. - countable_resources = spm_unit("spm_unit_cash_assets", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents(spm_unit("spm_unit_cash_assets", period)) size = spm_unit("spm_unit_size", period) # Resource limits: $4,000 for 1 person, $6,000 for 2+ persons limit = p.resources.limit.calc(size) diff --git a/policyengine_us/variables/gov/states/nh/dhhs/fanf/eligibility/nh_fanf_resources_eligible.py b/policyengine_us/variables/gov/states/nh/dhhs/fanf/eligibility/nh_fanf_resources_eligible.py index 4494d90ee00..b586b9bacea 100644 --- a/policyengine_us/variables/gov/states/nh/dhhs/fanf/eligibility/nh_fanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/nh/dhhs/fanf/eligibility/nh_fanf_resources_eligible.py @@ -19,7 +19,8 @@ def formula(spm_unit, period, parameters): # NOTE: One vehicle per adult is excluded regardless of value. # Resource limits differ for applicants ($1,000) vs recipients ($5,000 as of 07/01/22) p = parameters(period).gov.states.nh.dhhs.fanf.resources - resources = spm_unit("spm_unit_cash_assets", period) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period)) # He-W 656.06(a)(1) also treats an applicant who received FANF in any # one of the previous 6 months as a recipient. The inputs have no # 6-month look-back, so current enrollment stands in for it. diff --git a/policyengine_us/variables/gov/states/nh/dhhs/ssp/nh_ssp_eligible.py b/policyengine_us/variables/gov/states/nh/dhhs/ssp/nh_ssp_eligible.py index 4ba8532fe3f..b931c4de3d6 100644 --- a/policyengine_us/variables/gov/states/nh/dhhs/ssp/nh_ssp_eligible.py +++ b/policyengine_us/variables/gov/states/nh/dhhs/ssp/nh_ssp_eligible.py @@ -42,6 +42,8 @@ def formula(person, period, parameters): resources = resources + essential * max_( essential_resources, spouse_value(essential_resources, spouse) ) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(resources) # He-W 616.02(a): qualified aliens under 8 USC 1641(b) are eligible once # the waiting period since entry has elapsed, which also covers entry # before August 22, 1996. AAM 305.11 exempts the listed statuses, as diff --git a/policyengine_us/variables/gov/states/nj/njdhs/wfnj/eligibility/nj_wfnj_resources_eligible.py b/policyengine_us/variables/gov/states/nj/njdhs/wfnj/eligibility/nj_wfnj_resources_eligible.py index 52729d916fb..0933ef6c5f7 100644 --- a/policyengine_us/variables/gov/states/nj/njdhs/wfnj/eligibility/nj_wfnj_resources_eligible.py +++ b/policyengine_us/variables/gov/states/nj/njdhs/wfnj/eligibility/nj_wfnj_resources_eligible.py @@ -11,5 +11,6 @@ class nj_wfnj_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.nj.njdhs.wfnj.resources - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.py b/policyengine_us/variables/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.py index ea5843c25d3..e41f1d96fad 100644 --- a/policyengine_us/variables/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.py +++ b/policyengine_us/variables/gov/states/nm/hca/nm_works/eligibility/nm_works_resources_eligible.py @@ -11,7 +11,10 @@ class nm_works_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.nm.hca.nm_works.resources.limit - liquid_resources = spm_unit("nm_works_countable_liquid_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + liquid_resources = round_to_cents( + spm_unit("nm_works_countable_liquid_resources", period) + ) non_liquid_resources = spm_unit( "nm_works_countable_non_liquid_resources", period ) diff --git a/policyengine_us/variables/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.py index aa7c78bfff2..6c6f08ff330 100644 --- a/policyengine_us/variables/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/nv/dwss/tanf/eligibility/nv_tanf_resources_eligible.py @@ -14,5 +14,6 @@ def formula(spm_unit, period, parameters): # Nevada excludes the home and up to two vehicles, so use liquid # financial assets explicitly until those vehicle exclusions are # modeled separately. - assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return assets <= p.amount diff --git a/policyengine_us/variables/gov/states/ny/otda/tanf/eligibility/ny_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/ny/otda/tanf/eligibility/ny_tanf_resources_eligible.py index 8a5ee8a8fd0..56c2e4af153 100644 --- a/policyengine_us/variables/gov/states/ny/otda/tanf/eligibility/ny_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ny/otda/tanf/eligibility/ny_tanf_resources_eligible.py @@ -34,5 +34,6 @@ def formula(spm_unit, period, parameters): p.resource_limit.higher.amount, p.resource_limit.lower.amount, ) - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= resource_limit diff --git a/policyengine_us/variables/gov/states/ok/dhs/tanf/eligibility/ok_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/ok/dhs/tanf/eligibility/ok_tanf_resources_eligible.py index 5b29e7bdfb2..0952aef98e3 100644 --- a/policyengine_us/variables/gov/states/ok/dhs/tanf/eligibility/ok_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ok/dhs/tanf/eligibility/ok_tanf_resources_eligible.py @@ -14,5 +14,6 @@ class ok_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ok.dhs.tanf.resources # Per OAC 340:10-3-5: Maximum countable reserve is $1,000 - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/or/odhs/tanf/eligibility/or_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/or/odhs/tanf/eligibility/or_tanf_resources_eligible.py index 58f51d3a206..be74e18548a 100644 --- a/policyengine_us/variables/gov/states/or/odhs/tanf/eligibility/or_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/or/odhs/tanf/eligibility/or_tanf_resources_eligible.py @@ -15,5 +15,8 @@ class or_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states["or"].odhs.tanf.resources.limit # Count explicitly modeled liquid financial assets. - countable_resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("spm_unit_cash_assets", period.this_year) + ) return countable_resources <= p.amount diff --git a/policyengine_us/variables/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.py index fb86153e9de..bda666ab06f 100644 --- a/policyengine_us/variables/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/pa/dhs/tanf/eligibility/pa_tanf_resources_eligible.py @@ -12,6 +12,9 @@ class pa_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.pa.dhs.tanf - household_assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + household_assets = round_to_cents( + spm_unit("spm_unit_cash_assets", period.this_year) + ) return household_assets <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/ri/dhs/works/eligibility/ri_works_resource_eligible.py b/policyengine_us/variables/gov/states/ri/dhs/works/eligibility/ri_works_resource_eligible.py index 94ed47b2733..bb5033b466b 100644 --- a/policyengine_us/variables/gov/states/ri/dhs/works/eligibility/ri_works_resource_eligible.py +++ b/policyengine_us/variables/gov/states/ri/dhs/works/eligibility/ri_works_resource_eligible.py @@ -14,5 +14,6 @@ class ri_works_resource_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ri.dhs.works - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/sc/tanf/eligibility/sc_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/sc/tanf/eligibility/sc_tanf_resources_eligible.py index 1e6c3f92bac..83f72782efc 100644 --- a/policyengine_us/variables/gov/states/sc/tanf/eligibility/sc_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/sc/tanf/eligibility/sc_tanf_resources_eligible.py @@ -11,5 +11,6 @@ class sc_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.sc.tanf.resources - assets = spm_unit("sc_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("sc_tanf_countable_resources", period)) return assets <= p.limit diff --git a/policyengine_us/variables/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.py index 4aa8067f568..2a0feb13035 100644 --- a/policyengine_us/variables/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/sd/dss/tanf/eligibility/sd_tanf_resources_eligible.py @@ -11,5 +11,6 @@ class sd_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.sd.dss.tanf.resources - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.py b/policyengine_us/variables/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.py index 023b4003ece..aba97c3046c 100644 --- a/policyengine_us/variables/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.py +++ b/policyengine_us/variables/gov/states/tn/dhs/ff/eligibility/tn_ff_resources_eligible.py @@ -10,6 +10,9 @@ class tn_ff_resources_eligible(Variable): defined_for = StateCode.TN def formula(spm_unit, period, parameters): - countable_resources = spm_unit("tn_ff_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("tn_ff_countable_resources", period) + ) p = parameters(period).gov.states.tn.dhs.ff.resources return countable_resources <= p.limit diff --git a/policyengine_us/variables/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.py index 65248230bf3..e438cc96097 100644 --- a/policyengine_us/variables/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/tx/tanf/eligibility/tx_tanf_resources_eligible.py @@ -13,7 +13,10 @@ class tx_tanf_resources_eligible(Variable): defined_for = StateCode.TX def formula(spm_unit, period, parameters): - countable_resources = spm_unit("tx_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("tx_tanf_countable_resources", period) + ) p = parameters(period).gov.states.tx.tanf.resources return countable_resources <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.py b/policyengine_us/variables/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.py index d4404c00f8e..d08d1e7a029 100644 --- a/policyengine_us/variables/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.py +++ b/policyengine_us/variables/gov/states/ut/dwf/fep/eligibility/ut_fep_resources_eligible.py @@ -15,5 +15,6 @@ def formula(spm_unit, period, parameters): p = parameters(period).gov.states.ut.dwf.fep.resources.limit # Count liquid financial assets explicitly; other excluded resources # are not yet modeled separately here. - assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return assets <= p.amount diff --git a/policyengine_us/variables/gov/states/va/dars/ag/va_ag_eligible.py b/policyengine_us/variables/gov/states/va/dars/ag/va_ag_eligible.py index 878cb7898ff..008ed2ea3ee 100644 --- a/policyengine_us/variables/gov/states/va/dars/ag/va_ag_eligible.py +++ b/policyengine_us/variables/gov/states/va/dars/ag/va_ag_eligible.py @@ -26,8 +26,12 @@ def formula(person, period, parameters): == 2 ) resources = person("ssi_countable_resources", period.this_year) - resources = where( - joint, state_couple_total(person, period.this_year, resources), resources + resources = round_to_cents( + where( + joint, + state_couple_total(person, period.this_year, resources), + resources, + ) ) limits = parameters(period).gov.ssa.ssi.eligibility.resources.limit receives_ssi = (person("ssi", period) > 0) | person("receives_ssi", period) diff --git a/policyengine_us/variables/gov/states/vt/dcf/reach_up/eligibility/vt_reach_up_resources_eligible.py b/policyengine_us/variables/gov/states/vt/dcf/reach_up/eligibility/vt_reach_up_resources_eligible.py index b0f625dc3f8..5dacf52526e 100644 --- a/policyengine_us/variables/gov/states/vt/dcf/reach_up/eligibility/vt_reach_up_resources_eligible.py +++ b/policyengine_us/variables/gov/states/vt/dcf/reach_up/eligibility/vt_reach_up_resources_eligible.py @@ -14,5 +14,6 @@ def formula(spm_unit, period, parameters): p = parameters(period).gov.states.vt.dcf.reach_up.resources # NOTE: Many exclusions exist (vehicles, retirement accounts, etc.) # that are not separately tracked in PolicyEngine - assets = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return assets <= p.limit diff --git a/policyengine_us/variables/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.py b/policyengine_us/variables/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.py index 984fd596db5..ab86366a75e 100644 --- a/policyengine_us/variables/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.py +++ b/policyengine_us/variables/gov/states/wa/dshs/tanf/wa_tanf_resources_eligible.py @@ -11,5 +11,8 @@ class wa_tanf_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.wa.dshs.tanf - countable_resources = spm_unit("wa_tanf_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("wa_tanf_countable_resources", period) + ) return countable_resources <= p.resource_limit diff --git a/policyengine_us/variables/gov/states/wi/dcf/works/eligibility/wi_works_resources_eligible.py b/policyengine_us/variables/gov/states/wi/dcf/works/eligibility/wi_works_resources_eligible.py index 7871b8455c5..14c8e8ce701 100644 --- a/policyengine_us/variables/gov/states/wi/dcf/works/eligibility/wi_works_resources_eligible.py +++ b/policyengine_us/variables/gov/states/wi/dcf/works/eligibility/wi_works_resources_eligible.py @@ -13,6 +13,7 @@ class wi_works_resources_eligible(Variable): defined_for = StateCode.WI def formula(spm_unit, period, parameters): - countable = spm_unit("wi_works_countable_resources", period) + # Inputs are stored as float32, so compare whole cents with the limit. + countable = round_to_cents(spm_unit("wi_works_countable_resources", period)) p = parameters(period).gov.states.wi.dcf.works.asset return countable <= p.limit diff --git a/policyengine_us/variables/gov/states/wv/dhhr/works/eligibility/wv_works_resources_eligible.py b/policyengine_us/variables/gov/states/wv/dhhr/works/eligibility/wv_works_resources_eligible.py index d22bd9bdfa5..8ffbd787b1f 100644 --- a/policyengine_us/variables/gov/states/wv/dhhr/works/eligibility/wv_works_resources_eligible.py +++ b/policyengine_us/variables/gov/states/wv/dhhr/works/eligibility/wv_works_resources_eligible.py @@ -12,5 +12,8 @@ class wv_works_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.wv.dhhr.works.resources # Count explicitly modeled liquid financial assets. - countable_resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + countable_resources = round_to_cents( + spm_unit("spm_unit_cash_assets", period.this_year) + ) return countable_resources <= p.limit diff --git a/policyengine_us/variables/gov/states/wy/dfs/power/eligibility/wy_power_resources_eligible.py b/policyengine_us/variables/gov/states/wy/dfs/power/eligibility/wy_power_resources_eligible.py index 792b0606f84..6e5c7c395a2 100644 --- a/policyengine_us/variables/gov/states/wy/dfs/power/eligibility/wy_power_resources_eligible.py +++ b/policyengine_us/variables/gov/states/wy/dfs/power/eligibility/wy_power_resources_eligible.py @@ -14,5 +14,6 @@ class wy_power_resources_eligible(Variable): def formula(spm_unit, period, parameters): p = parameters(period).gov.states.wy.dfs.power.resources - resources = spm_unit("spm_unit_cash_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + resources = round_to_cents(spm_unit("spm_unit_cash_assets", period.this_year)) return resources <= p.limit diff --git a/policyengine_us/variables/gov/usda/snap/eligibility/meets_snap_asset_test.py b/policyengine_us/variables/gov/usda/snap/eligibility/meets_snap_asset_test.py index a7b89c647c5..3c03accc5a0 100644 --- a/policyengine_us/variables/gov/usda/snap/eligibility/meets_snap_asset_test.py +++ b/policyengine_us/variables/gov/usda/snap/eligibility/meets_snap_asset_test.py @@ -26,7 +26,8 @@ def formula(spm_unit, period, parameters): # their share at the moment. has_elderly_or_disabled = spm_unit("has_snap_elderly_disabled_member", period) asset_test = parameters(period).gov.usda.snap.asset_test - assets = spm_unit("snap_assets", period.this_year) + # Inputs are stored as float32, so compare whole cents with the limit. + assets = round_to_cents(spm_unit("snap_assets", period.this_year)) asset_limit = where( has_elderly_or_disabled, asset_test.limit.elderly_disabled, diff --git a/policyengine_us/variables/household/assets/bank_account_assets.py b/policyengine_us/variables/household/assets/bank_account_assets.py index 9d96085b69c..365820c8a6a 100644 --- a/policyengine_us/variables/household/assets/bank_account_assets.py +++ b/policyengine_us/variables/household/assets/bank_account_assets.py @@ -14,3 +14,8 @@ class bank_account_assets(Variable): definition_period = YEAR uprating = "gov.bls.cpi.cpi_u" reference = "https://secure.ssa.gov/poms.nsf/lnx/0501140200" + + def __init__(self, baseline_variable=None): + super().__init__(baseline_variable) + # Higher resource limits can distinguish cents lost in float32. + self.dtype = np.dtype(np.float64) diff --git a/policyengine_us/variables/household/assets/bond_assets.py b/policyengine_us/variables/household/assets/bond_assets.py index 7644bbc5d0f..21db071afa5 100644 --- a/policyengine_us/variables/household/assets/bond_assets.py +++ b/policyengine_us/variables/household/assets/bond_assets.py @@ -16,3 +16,8 @@ class bond_assets(Variable): "https://secure.ssa.gov/poms.nsf/lnx/0501140240", "https://secure.ssa.gov/poms.nsf/lnx/0501140250", ) + + def __init__(self, baseline_variable=None): + super().__init__(baseline_variable) + # Higher resource limits can distinguish cents lost in float32. + self.dtype = np.dtype(np.float64) diff --git a/policyengine_us/variables/household/assets/household_vehicles_equity.py b/policyengine_us/variables/household/assets/household_vehicles_equity.py index c3226ccb086..9bb020130e3 100644 --- a/policyengine_us/variables/household/assets/household_vehicles_equity.py +++ b/policyengine_us/variables/household/assets/household_vehicles_equity.py @@ -5,8 +5,12 @@ class household_vehicles_equity(Variable): value_type = float entity = Household label = "Vehicle equity" - documentation = "Net equity in household vehicles after secured vehicle debt." + documentation = ( + "Net equity in household vehicles after secured vehicle debt. " + "Negative infinity indicates missing equity." + ) unit = USD quantity_type = STOCK definition_period = YEAR + default_value = -np.inf uprating = "gov.bls.cpi.cpi_u" diff --git a/policyengine_us/variables/household/assets/stock_assets.py b/policyengine_us/variables/household/assets/stock_assets.py index 1f96b09b357..62989d88555 100644 --- a/policyengine_us/variables/household/assets/stock_assets.py +++ b/policyengine_us/variables/household/assets/stock_assets.py @@ -11,3 +11,8 @@ class stock_assets(Variable): definition_period = YEAR uprating = "gov.bls.cpi.cpi_u" reference = "https://secure.ssa.gov/poms.nsf/lnx/0501140220" + + def __init__(self, baseline_variable=None): + super().__init__(baseline_variable) + # Higher resource limits can distinguish cents lost in float32. + self.dtype = np.dtype(np.float64) diff --git a/policyengine_us/variables/household/demographic/marital_unit/is_separated_under_decree.py b/policyengine_us/variables/household/demographic/marital_unit/is_separated_under_decree.py index d33d39b026a..ff2ad5c61ee 100644 --- a/policyengine_us/variables/household/demographic/marital_unit/is_separated_under_decree.py +++ b/policyengine_us/variables/household/demographic/marital_unit/is_separated_under_decree.py @@ -12,9 +12,9 @@ class is_separated_under_decree(Variable): does not count. Defaults to false because survey data cannot tell a decree from an informal separation, so is_separated alone keeps the married reading - for the EITC. Only the EITC marital test (IRC 32(d)) and New Jersey's - separate-filer rule read this input, and the federal test reads it only - from 2021. Filing status and other rules do not read it yet. + for the EITC. The EITC marital test (IRC 32(d)) reads this input from + 2021. New Jersey's separate-filer rule and Colorado's Old Age Pension + resource test also read it. """ definition_period = YEAR default_value = False