Rapu Ture - Exploring the Rules

was present in New Zealand for at least 240 days in each the 5 years immediately preceding the date of application

Citizenship Boolean DAY Person Formula Included used 1 time

Value type Boolean . Default value false Entity person

How is this calculated?

To calculate this variable, the following input is used

Where is this used?

This variable is referred to by these other variables in their own calculations


This is the formula used to calculate the value of citizenship__meets_each_year_minimum_presence_requirements


This formula is used for scenarios from the date 0001-01-01 onwards. More info on formulas

def formula(persons, period, parameters):
    required_days = parameters(period).citizenship.by_grant.minimum_days_present_for_each_of_preceeding_5_years

    meets_presence = True

    for n in range(0, 5):
        # print("Checking year", n, "ending on", period.date)

        number_of_days_ago = days_since_n_years_ago(period.date, n)
        # print("the day to end our rolling year on is (the day before)", number_of_days_ago, "days before", period.date)

        # Go back in time by n years
        day_n_years_ago = period.offset(number_of_days_ago * -1)
        # print("day_n_years_ago", day_n_years_ago)

        days_present = persons('days_present_in_new_zealand_in_preceeding_year', day_n_years_ago)
        # print("days present on rolling year ending at", day_n_years_ago, "is", days_present)

        meets_presence_n_years_ago = (days_present >= required_days)
        # print("Meets rquirement??", meets_presence_n_years_ago)

        # Accumulate the each year
        meets_presence = meets_presence_n_years_ago * meets_presence

        # print("======================")

    return meets_presence

Scenarios calculating this variables