election_day.models.principal
Classes
The principal is the political entity running the election day app. |
|
A cantonal instance. |
|
A communal instance. |
Module Contents
- class election_day.models.principal.Principal(id_: str, domain: str, domains_election: dict[str, translationstring.TranslationString], domains_vote: dict[str, translationstring.TranslationString], entities: dict[int, dict[int, dict[str, str]]], name: str | None = None, logo: str | None = None, logo_position: str = 'left', color: str = '#000', base: str | None = None, analytics: str | None = None, has_districts: bool = True, has_regions: bool = False, has_superregions: bool = False, use_maps: bool = False, fetch: dict[str, Any] | None = None, webhooks: dict[str, dict[str, str]] | None = None, sms_notification: bool | None = None, email_notification: bool | None = None, wabsti_import: bool = False, open_data: dict[str, str] | None = None, hidden_elements: dict[str, dict[str, dict[str, bool]]] | None = None, publish_intermediate_results: dict[str, bool] | None = None, csp_script_src: list[str] | None = None, csp_connect_src: list[str] | None = None, cache_expiration_time: int = 300, reply_to: str | None = None, custom_css: str | None = None, official_host: str | None = None, segmented_notifications: bool = False, private: bool = False, **kwargs: Never)[source]
The principal is the political entity running the election day app.
There are currently two different types of principals supported: Cantons and Municipalitites.
A principal is identitifed by its ID (municipalitites: BFS number, cantons: canton code).
A principal may consist of different entities (municipalitites: quarters, cantons: municipalities) grouped by districts. Some cantons have regions for certain years, an additional type of district only used for regional elections (Kantonsratswahl, Grossratswahl, Landratswahl). Some of them have superregions which further aggregate these regions. The label of the entity, the districts, regions and superregions may vary and can be queried with label.
A principal is part of a domain (municipalitites: municipality, canton: canton) and supports different types of domains (typically all higher domains).
hidden_elements: Used to optionally show and hide certain charts on the defined views.
Example config in a yaml file:
hidden_elements: always: candidate-by-entity: chart_percentages: true intermediate_results: connections: chart: false candidates: chart: false
publish_intermediate_results: Optionally renders svg and pdf for intermediate results. Example:
publish_intermediate_results: vote: true election: true election_compound: true
Defaults to false if nothing specified
- classmethod from_yaml(yaml_source: yaml.reader._ReadStream) Canton | Municipality [source]