The policyengine_core.entities module contains the classes that define how entities (and group entities) function.


class policyengine_core.entities.entity.Entity(key: str, plural: str, label: str, doc: str)[source]#

Bases: object

Represents an entity (e.g. a person, a household, etc.) on which calculations can be run.

check_role_validity(role: Any) None[source]#
check_variable_defined_for_entity(variable_name: str) None[source]#
get_variable(variable_name: str, check_existence: bool = False)[source]#
set_tax_benefit_system(tax_benefit_system) None[source]#


class policyengine_core.entities.group_entity.GroupEntity(key: str, plural: str, label: str, doc: str, roles: List[str], containing_entities: List[str] = ())[source]#

Bases: Entity

Represents an entity containing several others with different roles.

A GroupEntity represents an Entity containing several other Entity with different Role, and on which calculations can be run.

  • key – A key to identify the group entity.

  • plural – The key, pluralised.

  • label – A summary description.

  • doc – A full description.

  • roles – The list of Role of the group entity.

  • containing_entities – The list of keys of group entities whose members are guaranteed to be a superset of this group’s entities.

Changed in version 35.7.0: Added containing_entities, that allows the defining of group entities which entirely contain other group entities.


class policyengine_core.entities.role.Role(description, entity)[source]#

Bases: object

The type of the relation between an entity instance and a group entity instance.


policyengine_core.entities.helpers.build_entity(key: str, plural: str, label: str, doc: str = '', roles: Optional[List] = None, is_person: bool = False, containing_entities: List[str] = ()) Entity[source]#