election_day.formats.imports.election.internal_majorz

Attributes

INTERNAL_MAJORZ_HEADERS

Functions

parse_election(line, errors) → tuple[int | None, onegov.election_day.types.Status | None]

parse_election_result(line, errors, entities, ...) → dict[str, Any] | None

parse_candidate(line, errors, election_id, colors) → dict[str, Any] | None

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

import_election_internal_majorz(election, principal, ...) → list[onegov.election_day.formats.imports.common.FileImportError]

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, onegov.election_day.types.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: onegov.election_day.models.Canton | onegov.election_day.models.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: onegov.election_day.models.Canton | onegov.election_day.models.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.