election_day.formats.imports.election.ech

Module Contents

Functions

import_elections_ech(...)

Imports all elections in a given eCH-0252 delivery.

import_information_delivery(→ tuple[datetime.date, ...)

Import an election information delivery.

import_result_delivery(→ None)

Import an election result delivery.

import_majoral_election_result(→ None)

Helper function to import election results specific to majoral

import_proportional_election_result(→ None)

Helper function to import election results specific to proportional

get_candidate(→ onegov.ballot.Candidate | None)

Helper function to retreive a candidate of existing candidates.

get_list(→ onegov.ballot.List | None)

Helper function to retreive a list of existing lists.

Attributes

MajoralElected

election_class

gender

election_day.formats.imports.election.ech.MajoralElected: typing_extensions.TypeAlias[source]
election_day.formats.imports.election.ech.election_class[source]
election_day.formats.imports.election.ech.gender: dict[xsdata_ech.e_ch_0155_5_0.SexType, onegov.ballot.types.Gender][source]
election_day.formats.imports.election.ech.import_elections_ech(principal: Canton | Municipality, delivery: xsdata_ech.e_ch_0252_2_0.Delivery, session: sqlalchemy.orm.Session, default_locale: str) onegov.election_day.formats.imports.common.ECHImportResultType[source]

Imports all elections in a given eCH-0252 delivery.

Deletes elections on the same day not appearing in the delivery.

Returns:

A tuple consisting of a list with errors, a set with updated elections, and a set with deleted elections.

election_day.formats.imports.election.ech.import_information_delivery(principal: Canton | Municipality, delivery: xsdata_ech.e_ch_0252_2_0.EventElectionInformationDeliveryType, session: sqlalchemy.orm.Session, default_locale: str) tuple[datetime.date, list[onegov.ballot.ElectionCompound], list[onegov.ballot.Election], set[onegov.ballot.ElectionCompound | onegov.ballot.Election], set[onegov.election_day.formats.imports.common.FileImportError]][source]

Import an election information delivery.

election_day.formats.imports.election.ech.import_result_delivery(principal: Canton | Municipality, delivery: xsdata_ech.e_ch_0252_2_0.EventElectionResultDeliveryType, polling_day: datetime.date, elections: list[onegov.ballot.Election], errors: set[onegov.election_day.formats.imports.common.FileImportError]) None[source]

Import an election result delivery.

election_day.formats.imports.election.ech.import_majoral_election_result(candidates: dict[str, onegov.ballot.Candidate], election_result: onegov.ballot.ElectionResult, majoral_election: xsdata_ech.e_ch_0252_2_0.ElectionResultType.MajoralElection, errors: set[onegov.election_day.formats.imports.common.FileImportError]) None[source]

Helper function to import election results specific to majoral elections.

election_day.formats.imports.election.ech.import_proportional_election_result(candidates: dict[str, onegov.ballot.Candidate], lists: dict[str, onegov.ballot.List], election_result: onegov.ballot.ElectionResult, proportional_election: xsdata_ech.e_ch_0252_2_0.ElectionResultType.ProportionalElection, errors: set[onegov.election_day.formats.imports.common.FileImportError]) None[source]

Helper function to import election results specific to proportional elections.

election_day.formats.imports.election.ech.get_candidate(candidates: dict[str, onegov.ballot.Candidate], candidate_id: str, errors: set[onegov.election_day.formats.imports.common.FileImportError]) onegov.ballot.Candidate | None[source]

Helper function to retreive a candidate of existing candidates.

election_day.formats.imports.election.ech.get_list(lists: dict[str, onegov.ballot.List], list_id: str, errors: set[onegov.election_day.formats.imports.common.FileImportError]) onegov.ballot.List | None[source]

Helper function to retreive a list of existing lists.