Skip to content

Refactor medicaid_group to use state-level override pattern for state-funded Medicaid programs #7026

@hua7450

Description

@hua7450

Problem

PR #7005 (Illinois HBI) adds state-specific logic directly into the federal medicaid_group variable. This approach doesn't scale well - if other states add similar programs (like California FFYP), the federal file will become cluttered with state-specific code.

Current implementation in medicaid_group.py:

# Illinois HBI-specific mapping (for those who fail immigration check
# but are eligible via state-funded HBI program)
il_hbi_eligible = person("il_hbi_eligible", period)
age = person("age", period)
p_hbi = parameters(period).gov.states.il.hfs.hbi.eligibility
il_hbi_child = il_hbi_eligible & (age <= p_hbi.child.max_age)
# ... more Illinois-specific logic

Proposed Solution

Create a generic state override pattern:

  1. New file: policyengine_us/variables/gov/states/il/hfs/hbi/il_hbi_medicaid_group.py

    • Returns appropriate MedicaidGroup for HBI-eligible people
    • Returns NONE for everyone else
  2. New file: policyengine_us/variables/gov/hhs/medicaid/costs/state_medicaid_group_override.py

    • Aggregates all state-level Medicaid group overrides
    • Future state programs just add their variable to this file
  3. Edit: policyengine_us/variables/gov/hhs/medicaid/costs/medicaid_group.py

    • Remove state-specific logic
    • Add generic check for state override at the end:
    state_override = person("state_medicaid_group_override", period)
    has_override = state_override != MedicaidGroup.NONE
    return where(has_override, state_override, federal_group)

Benefits

  • Keeps federal variables clean of state-specific logic
  • Scales to multiple states without modifying federal files
  • State logic stays in state folders (gov/states/il/...)
  • Follows existing patterns (similar to how is_medicaid_eligible handles state programs)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions