Returns the year of eligibilty either 1, 2 or 3 otherwise returns zero
Best Start Float MONTH Person Formula Included used 1 timeValue type Float . Default value 0 Entity person
How is this calculated?
To calculate this variable, the following input is used
- Date date_of_birth Birth date
- Date due_date_of_birth Birth due date
Where is this used?
This variable is referred to by these other variables in their own calculations
- Float best_start__tax_credit_per_child Value of a Families entitlement for best start tax credit
Formulas
This is the formula used to calculate the value of best_start__year_of_child
0001-01-01
This formula is used for scenarios from the date 0001-01-01 onwards. More info on formulas
def formula(persons, period, parameters):
birth = persons('date_of_birth', period)
birth_year = birth.astype('datetime64[Y]').astype(int) + 1970
birth_month = birth.astype('datetime64[M]').astype(int) % 12 + 1
birth_day = (birth - birth.astype('datetime64[M]') + 1).astype(int)\
# adjusts month for first full month after birth
adjust_month = birth_month + (birth_day > 1)
is_birthday_month_past = (adjust_month <= period.start.month)
is_current_or_previous_year = birth_year <= period.start.year
whatyear = (period.start.year - birth_year) - \
where(is_birthday_month_past, 0, 1)
whatyear = whatyear + 1
whatyear = whatyear * \
(whatyear < 4) * \
is_current_or_previous_year * \
(((persons('date_of_birth', period)
>= datetime64('2018-07-01')) + (persons('due_date_of_birth', period) >= datetime64('2018-07-01'))) > 0)
return whatyear