Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Number of children in a family

class number_of_children_in_family(Variable):
    value_type = int
    definition_period = MONTH
    entity = Family
    label = u"The number of children in a family"

    def formula(families, period):
        return families.nb_persons(role=Family.CHILD)

Does a family have children

class is_a_child_in_a_family(Variable):
    value_type = bool
    entity = Person
    label = u"person is a child in a family"
    definition_period = ETERNITY

    def formula(person, period):
        return person.has_role(Family.CHILD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment