Skip to content

Commit

Permalink
Edit for test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-ahmadi committed Jan 13, 2025
1 parent e0221f8 commit fc83a03
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from policyengine_uk.model_api import *


class child_age_eligible(Variable):
value_type = bool
entity = Person
Expand Down Expand Up @@ -32,14 +31,15 @@ def formula(person, period, parameters):
standard_disability_benefits = gc.eligibility
severe_disability_benefits = gc.severe.eligibility

is_disabled = (
add(person, period, standard_disability_benefits)
| add(person, period, severe_disability_benefits)
) > 0
# Convert to boolean arrays before combining
standard_benefits = add(person, period, standard_disability_benefits).astype(bool)
severe_benefits = add(person, period, severe_disability_benefits).astype(bool)
is_disabled = (standard_benefits | severe_benefits)

# Check age conditions using parameterized values
basic_age_condition = age < standard_age_limit
age_under_disability_limit = age < disability_age_limit

# Combine conditions
return basic_age_condition | (age_under_disability_limit & is_disabled)
# Convert to boolean before final combination
return (basic_age_condition.astype(bool) |
(age_under_disability_limit.astype(bool) & is_disabled))

0 comments on commit fc83a03

Please sign in to comment.