election_day.formats.imports.election.ech ========================================= .. py:module:: election_day.formats.imports.election.ech Attributes ---------- .. autoapisummary:: election_day.formats.imports.election.ech.MajoralElected election_day.formats.imports.election.ech.election_class election_day.formats.imports.election.ech.gender Functions --------- .. autoapisummary:: election_day.formats.imports.election.ech.import_elections_ech election_day.formats.imports.election.ech.import_information_delivery election_day.formats.imports.election.ech.import_result_delivery election_day.formats.imports.election.ech.import_majoral_election_result election_day.formats.imports.election.ech.import_proportional_election_result election_day.formats.imports.election.ech.get_candidate election_day.formats.imports.election.ech.get_list Module Contents --------------- .. py:type:: MajoralElected :canonical: ElectedType.MajoralElection.ElectedCandidate .. py:data:: election_class .. py:data:: gender :type: dict[xsdata_ech.e_ch_0155_5_0.SexType, onegov.election_day.types.Gender] .. py:function:: import_elections_ech(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, delivery: xsdata_ech.e_ch_0252_2_0.Delivery, session: sqlalchemy.orm.Session, default_locale: str) -> onegov.election_day.formats.imports.common.ECHImportResultType Imports all elections in a given eCH-0252 delivery. Deletes elections on the same day not appearing in the delivery. :return: A tuple consisting of a list with errors, a set with updated elections, and a set with deleted elections. .. py:function:: import_information_delivery(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, delivery: xsdata_ech.e_ch_0252_2_0.EventElectionInformationDeliveryType, session: sqlalchemy.orm.Session, default_locale: str) -> tuple[datetime.date, list[onegov.election_day.models.ElectionCompound], list[onegov.election_day.models.Election], set[onegov.election_day.models.ElectionCompound | onegov.election_day.models.Election], set[onegov.election_day.formats.imports.common.FileImportError]] Import an election information delivery. .. py:function:: import_result_delivery(principal: onegov.election_day.models.Canton | onegov.election_day.models.Municipality, delivery: xsdata_ech.e_ch_0252_2_0.EventElectionResultDeliveryType, polling_day: datetime.date, elections: list[onegov.election_day.models.Election], errors: set[onegov.election_day.formats.imports.common.FileImportError]) -> None Import an election result delivery. .. py:function:: import_majoral_election_result(candidates: dict[str, onegov.election_day.models.Candidate], election_result: onegov.election_day.models.ElectionResult, majoral_election: xsdata_ech.e_ch_0252_2_0.ElectionResultType.MajoralElection, errors: set[onegov.election_day.formats.imports.common.FileImportError]) -> None Helper function to import election results specific to majoral elections. .. py:function:: import_proportional_election_result(candidates: dict[str, onegov.election_day.models.Candidate], lists: dict[str, onegov.election_day.models.List], election_result: onegov.election_day.models.ElectionResult, proportional_election: xsdata_ech.e_ch_0252_2_0.ElectionResultType.ProportionalElection, errors: set[onegov.election_day.formats.imports.common.FileImportError]) -> None Helper function to import election results specific to proportional elections. .. py:function:: get_candidate(candidates: dict[str, onegov.election_day.models.Candidate], candidate_id: str, errors: set[onegov.election_day.formats.imports.common.FileImportError]) -> onegov.election_day.models.Candidate | None Helper function to retreive a candidate of existing candidates. .. py:function:: get_list(lists: dict[str, onegov.election_day.models.List], list_id: str, errors: set[onegov.election_day.formats.imports.common.FileImportError]) -> onegov.election_day.models.List | None Helper function to retreive a list of existing lists.