election_day.formats.imports.election.wabstic_proporz

Attributes

WABSTIC_PROPORZ_HEADERS_WP_WAHL

WABSTIC_PROPORZ_HEADERS_WPSTATIC_GEMEINDEN

WABSTIC_PROPORZ_HEADERS_WP_GEMEINDEN

WABSTIC_PROPORZ_HEADERS_WP_LISTEN

WABSTIC_PROPORZ_HEADERS_WP_LISTENGDE

WABSTIC_PROPORZ_HEADERS_WPSTATIC_KANDIDATEN

WABSTIC_PROPORZ_HEADERS_WP_KANDIDATEN

WABSTIC_PROPORZ_HEADERS_WP_KANDIDATENGDE

Functions

get_entity_id(→ int)

get_list_id_from_knr(→ str)

Takes a line from csv file with a candidate number (knr) in it and

get_list_id(→ str)

import_election_wabstic_proporz(...)

Tries to import the given CSV files from a WabstiCExport.

Module Contents

election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WP_WAHL = ('sortgeschaeft', 'anzpendentgde')[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WPSTATIC_GEMEINDEN = ('sortwahlkreis', 'sortgeschaeft', 'bfsnrgemeinde', 'stimmberechtigte')[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WP_GEMEINDEN = ('bfsnrgemeinde', 'stimmberechtigte', 'sperrung', 'stmabgegeben', 'stmleer', 'stmungueltig',...[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WP_LISTEN = ('sortgeschaeft', 'listnr', 'listcode', 'sitze', 'listverb', 'listuntverb')[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WP_LISTENGDE = ('bfsnrgemeinde', 'listnr', 'stimmentotal')[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WPSTATIC_KANDIDATEN = ('sortgeschaeft', 'knr', 'nachname', 'vorname')[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WP_KANDIDATEN = ('sortgeschaeft', 'knr', 'gewaehlt')[source]
election_day.formats.imports.election.wabstic_proporz.WABSTIC_PROPORZ_HEADERS_WP_KANDIDATENGDE = ('bfsnrgemeinde', 'knr', 'stimmen')[source]
election_day.formats.imports.election.wabstic_proporz.get_entity_id(line: onegov.core.csv.DefaultRow, expats: Collection[int]) int[source]
election_day.formats.imports.election.wabstic_proporz.get_list_id_from_knr(line: onegov.core.csv.DefaultRow) str[source]

Takes a line from csv file with a candidate number (knr) in it and returns the derived listnr for this candidate. Will also handle the new WabstiC Standard 2018.

election_day.formats.imports.election.wabstic_proporz.get_list_id(line: onegov.core.csv.DefaultRow) str[source]
election_day.formats.imports.election.wabstic_proporz.import_election_wabstic_proporz(election: onegov.election_day.models.ProporzElection, principal: Canton | Municipality, number: str, district: str | None = None, file_wp_wahl: IO[bytes] | None = None, mimetype_wp_wahl: str | None = None, file_wpstatic_gemeinden: IO[bytes] | None = None, mimetype_wpstatic_gemeinden: str | None = None, file_wp_gemeinden: IO[bytes] | None = None, mimetype_wp_gemeinden: str | None = None, file_wp_listen: IO[bytes] | None = None, mimetype_wp_listen: str | None = None, file_wp_listengde: IO[bytes] | None = None, mimetype_wp_listengde: str | None = None, file_wpstatic_kandidaten: IO[bytes] | None = None, mimetype_wpstatic_kandidaten: str | None = None, file_wp_kandidaten: IO[bytes] | None = None, mimetype_wp_kandidaten: str | None = None, file_wp_kandidatengde: IO[bytes] | None = None, mimetype_wp_kandidatengde: str | None = None) list[onegov.election_day.formats.imports.common.FileImportError][source]

Tries to import the given CSV files from a WabstiCExport.

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.