Add official election results and candidates' preference votes (BMI)

National Council 2024 and 2019 and EU 2024: party results for Austria and
the states, and preference votes of candidates who resolve to a known
politician (exact name plus birth year where published). New claim type
election_result, new resolver hint birth_year.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
simonandClaude Opus 5.5 committed 2026-11-12 23:07:51 +01:00
1 parent b06f17e587
commit a59d475e6b
29 files changed
+1696 -9

No files matched your search

+10
View File
@@ -7,6 +7,8 @@ Order (first hit wins, ambiguity never guesses):
Hint strategies for persons (documented in docs/data-model.md):
surname_in_body + on members of a chamber on a date with that surname (roll-call lists)
office + on holder of an office title on a date (Council of Ministers minutes)
birth_year exact name and year of birth (candidate lists); add no_name_match so that a name
alone never matches when the year doesn't
"""
from __future__ import annotations
@@ -133,6 +135,14 @@ class Resolver:
return suffix[0]["id"] if len(suffix) == 1 else None
if "office" in hints:
return self.office_holder(hints["office"], on)
if "birth_year" in hints and ref.name:
rows = self.conn.execute(
"""SELECT DISTINCT a.entity_id AS id FROM alias a JOIN person p ON p.id = a.entity_id
WHERE a.entity_type = 'person' AND a.alias_norm = %s
AND EXTRACT(YEAR FROM p.birth_date) = %s""",
(normalize(strip_titles(ref.name)), int(hints["birth_year"])),
).fetchall()
return rows[0]["id"] if len(rows) == 1 else None
return None
def office_holder(self, office: str, on: date | None) -> int | None: