PolicyEngine / PolicyEngine/policyengine-api

Mixed-year requests return `nan`

Open
#1,136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
18
Forks
33
Avg merge
23h 40m
Merged PRs (30d)
22

Description

The below request from MyFriendBen gives a nan. @nikhilwoodruff verified that it works in the Python package, and works when replacing 2023-10 with 2024-01 for snap.

{
    'household': {
        'people': {
            '10221': {
                'is_pregnant': {'2024': False},
                'age': {'2024': 44, '2023': 44},
                'wic': {'2024': None},
                'wic_category': {'2024': None},
                'employment_income': {'2024': 0, '2023': 0},
                'medicaid': {'2024': None},
                'pell_grant_dependent_available_income': {'2024': 0},
                'pell_grant_countable_assets': {'2024': 0},
                'cost_of_attending_college': {'2024': 0},
                'pell_grant_months_in_school': {'2024': 9},
                'is_tax_unit_dependent': {'2024': False, '2023': False},
                'is_tax_unit_head': {'2024': True},
                'is_tax_unit_spouse': {'2024': False, '2023': False},
                'pell_grant': {'2024': None},
                'ssi_countable_resources': {'2024': 0},
                'ssi_reported': {'2024': 0},
                'is_blind': {'2024': False},
                'is_disabled': {'2024': False},
                'ssi_earned_income': {'2024': 0},
                'ssi_unearned_income': {'2024': 0},
                'ssi': {'2024': None},
                'co_state_supplement': {'2024': None},
                'co_oap': {'2024': None},
                'co_chp_eligible': {'2024': None},
            }
        },
        'tax_units': {
            'tax_unit': {
                'members': ['10221'],
                'pell_grant_primary_income': {'2024': 0},
                'pell_grant_dependents_in_college': {'2024': 0},
                'eitc': {'2023': None},
                'co_eitc': {'2023': None},
                'ctc': {'2023': None},
            }
        },
        'families': {'family': {'members': ['10221']}},
        'households': {
            'household': {
                'state_code_str': {'2024': 'CO', '2023': 'CO'},
                'members': ['10221'],
            }
        },
        'spm_units': {
            'spm_unit': {
                'members': ['10221'],
                'broadband_cost': {'2024': 500},
                'acp': {'2024': None},
                'lifeline': {'2024': None},
                'school_meal_daily_subsidy': {'2024': None},
                'school_meal_tier': {'2024': None},
                'snap_child_support_deduction': {'2023': 0.0},
                'snap_gross_income': {'2023': 0},
                'snap_assets': {'2023': 0},
                'meets_snap_categorical_eligibility': {'2023': False},
                'snap_emergency_allotment': {'2023': 0},
                'housing_cost': {'2023': 0},
                'meets_snap_gross_income_test': {'2023': True},
                'has_phone_expense': {'2023': False},
                'has_heating_cooling_expense': {'2023': False},
                'heating_cooling_expense': {'2023': 0.0},
                'electricity_expense': {'2023': 0.0},
                'snap_earned_income': {'2023': 0.0},
                'meets_snap_asset_test': {'2023': True},
                'childcare_expenses': {'2023': 0.0},
                'snap': {'2023-10': None},
                'co_tanf_countable_gross_earned_income': {'2024': 0},
                'co_tanf_countable_gross_unearned_income': {'2024': 0},
                'co_tanf': {'2024': None},
            }
        },
        'marital_units': {},
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the request in the issue against the PolicyEngine API, then compare its result with the Python package and with the same request using 2024-01 for snap. Done means the mixed-year request no longer returns nan and produces the expected calculation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.