election_day.formats.imports.election.internal_majorz

Attributes

INTERNAL_MAJORZ_HEADERS

Functions

parse_election(→ tuple[int | None, Status | None])

parse_election_result(→ dict[str, Any] | None)

parse_candidate(→ dict[str, Any] | None)

parse_candidate_result(→ dict[str, Any] | None)

import_election_internal_majorz(...)

Tries to import the given file (internal format).

Module Contents

election_day.formats.imports.election.internal_majorz.INTERNAL_MAJORZ_HEADERS = ('election_status', 'entity_id', 'entity_counted', 'entity_eligible_voters',...[source]
election_day.formats.imports.election.internal_majorz.parse_election(line: onegov.core.csv.DefaultRow, errors: list[str]) tuple[int | None, Status | None][source]
election_day.formats.imports.election.internal_majorz.parse_election_result(line: onegov.core.csv.DefaultRow, errors: list[str], entities: dict[int, dict[str, str]], election: onegov.election_day.models.Election, principal: Canton | Municipality) dict[str, Any] | None[source]
election_day.formats.imports.election.internal_majorz.parse_candidate(line: onegov.core.csv.DefaultRow, errors: list[str], election_id: str, colors: dict[str, str]) dict[str, Any] | None[source]
election_day.formats.imports.election.internal_majorz.parse_candidate_result(line: onegov.core.csv.DefaultRow, errors: list[str], counted: bool) dict[str, Any] | None[source]
election_day.formats.imports.election.internal_majorz.import_election_internal_majorz(election: onegov.election_day.models.Election, principal: Canton | Municipality, file: IO[bytes], mimetype: str) list[onegov.election_day.formats.imports.common.FileImportError][source]

Tries to import the given file (internal format).

This function is typically called automatically every few minutes during an election day - we use bulk inserts to speed up the import.

Returns:

A list containing errors.