Compare commits

..
1 Commits
Author SHA1 Message Date
Simon DiesenreiterandClaude Opus 5.5 9da5a1dc48 Politrack: track Austrian politicians from public sources
Initial import of Politrack, a self-hosted service that tracks Austrian
politicians from federal to municipal level - roles, votes, money flows,
statements, meetings, social media and legal proceedings - with every claim
linked to its sources.

- backend: FastAPI + Postgres/pgvector; adapter framework (fetch -> parse ->
  load -> enrich) with robots.txt/TDM-aware fetching, a raw-response archive
  for reparsing, and a claim/evidence model with corroboration
- sources: Parliament, Wikidata, EU Parliament/Commission, Council of
  Ministers, Rechnungshof party reports and donations, procurement, RTR media
  transparency, political ad libraries, WKStA, news feeds, Wikipedia edits,
  Bluesky, Mastodon, public Telegram channels, YouTube and X (official API)
- web: Next.js frontend in German and English with typed API client
- mcp: MCP server for AI agents and RAG
- docs: architecture, data model, sources, legal notes, Unraid deployment and
  contributor guides; Docker Compose setup for Unraid

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:47:14 +01:00
152 changed files with 1181 additions and 11181 deletions

No files matched your search

-11
View File
@@ -12,13 +12,6 @@ POLITRACK_READER_PASSWORD=change-me-too
POLITRACK_USER_AGENT=PolitrackBot/0.1 (+https://example.org/about; contact: you@example.org) POLITRACK_USER_AGENT=PolitrackBot/0.1 (+https://example.org/about; contact: you@example.org)
POLITRACK_MIN_REQUEST_INTERVAL=2.0 POLITRACK_MIN_REQUEST_INTERVAL=2.0
# Shown on /impressum and /datenschutz. Required before the site goes public (§ 5 ECG, §§ 24, 25 MedienG).
# POLITRACK_LEGAL_NAME=
# POLITRACK_LEGAL_ADDRESS=
# POLITRACK_LEGAL_EMAIL=
# Defaults to POLITRACK_LEGAL_EMAIL.
# POLITRACK_CORRECTIONS_EMAIL=
# Legislative periods of the Austrian parliament to ingest in detail (JSON list). # Legislative periods of the Austrian parliament to ingest in detail (JSON list).
POLITRACK_PARLAMENT_PERIODS=["XXVII","XXVIII"] POLITRACK_PARLAMENT_PERIODS=["XXVII","XXVIII"]
@@ -31,10 +24,6 @@ POLITRACK_API_CORS_ORIGINS=["http://localhost:3000"]
# Moderation endpoints (/api/v1/review, /api/v1/admin/runs). Leave empty to moderate via the CLI only. # Moderation endpoints (/api/v1/review, /api/v1/admin/runs). Leave empty to moderate via the CLI only.
# POLITRACK_ADMIN_TOKEN= # POLITRACK_ADMIN_TOKEN=
# Nightly database dumps (backup service). Ideally on a different disk or share than DATA_DIR.
# BACKUP_DIR=/mnt/user/backups/politrack
# BACKUP_KEEP_DAYS=14
# Raw-response archive inside the containers (mounted from ${DATA_DIR}/raw by docker-compose.yml). # Raw-response archive inside the containers (mounted from ${DATA_DIR}/raw by docker-compose.yml).
POLITRACK_RAW_DIR=/data/raw POLITRACK_RAW_DIR=/data/raw
-4
View File
@@ -1,4 +0,0 @@
# Golden fixtures are compared byte for byte; never convert their line endings.
backend/tests/fixtures/** -text
# Shell scripts run in Linux containers: LF even in a Windows checkout.
*.sh text eol=lf
-105
View File
@@ -1,105 +0,0 @@
# AGENTS.md
Guidance for AI coding agents working on this repository. Humans: start with [README.md](README.md)
and [CONTRIBUTING.md](CONTRIBUTING.md); everything below links there instead of repeating it.
Politrack tracks Austrian politicians from EU to municipal level (roles, votes, money, statements,
meetings, social media, legal proceedings). Every fact is a claim backed by evidence links. Backend:
Python (FastAPI, Postgres 16 + pgvector, Procrastinate workers, MCP server). Frontend: Next.js 15 with
next-intl, German by default, English at `/en`. Deployed with Docker Compose on the owner's Unraid server.
## Before you start
| Task | Read |
|---|---|
| Pick up open work | [docs/roadmap.md](docs/roadmap.md): *Next*, *Not yet verified*, *Known limitations* |
| Add a data source | [docs/contributing/adapters.md](docs/contributing/adapters.md), legal checklist in §0 first |
| Derive facts from stored data | [docs/contributing/enrichers.md](docs/contributing/enrichers.md) |
| API endpoint or MCP tool | [docs/contributing/api.md](docs/contributing/api.md) |
| UI page or new claim type in the UI | [docs/contributing/frontend.md](docs/contributing/frontend.md) |
| How the UI should look and read | [docs/design/README.md](docs/design/README.md), [design-system.md](docs/design/design-system.md) |
| Tests and fixtures | [docs/contributing/testing.md](docs/contributing/testing.md) |
| Agent sandbox: setup, what it can reach | [docs/contributing/agents.md](docs/contributing/agents.md) |
| Why it is built this way | [docs/architecture/02-comparison-and-decisions.md](docs/architecture/02-comparison-and-decisions.md) |
| Tables, claim types, identifier schemes | [docs/data-model.md](docs/data-model.md) |
| What each source allows | [docs/sources.md](docs/sources.md), [docs/legal.md](docs/legal.md) |
## Ground rules
1. **Legal access only.** Collect as much as possible, but only through official APIs, open data and
pages whose terms and robots.txt allow it. Never use X proxies (Nitter and the like), paywall
bypasses, logged-in scraping, or WhatsApp/Signal. Telegram: public channels via the `t.me/s` web
preview only. A robots.txt exemption needs the publisher's documented permission, recorded in the
adapter's `SourceSpec.tos_notes`; the RTR API is the only one so far. If a source can't be accessed
cleanly, say so and propose legal alternatives instead of working around it.
2. **Every claim has evidence.** No claim without a document link.
3. **Fairness.** Neutral wording. Legal matters carry the procedural stage and "Es gilt die
Unschuldsvermutung". Automatically detected legal claims stay in review (`review_status = pending`).
Connections are not accusations. Personal data only in the person's public role.
4. **Not public yet.** The instance is private (LAN only) as of November 2026. Posts that disappear from
X are marked, not erased, but their text must go (`social.x_deletions`, docs/legal.md).
5. **Commits:** only when the owner asks, as `Simon Diesenreiter <simon@disi.dev>`, not the global
(work) address: `git -c user.email=simon@disi.dev commit …`, unless the repo-local config sets it.
## Invariants that are easy to break
- **Four stages.** Adapters fetch only through `Request` objects handled by the framework's `Fetcher`
(robots, throttling, TDM, archive), never with their own HTTP client. `parse()` is pure: no database,
no network. Only the `Loader` writes claims. Enrichers derive from stored data.
- **Claim identity.** Claims with a facet get their fingerprint from it. Claims without a facet need an
explicit `key`, or duplicates and lost updates follow.
- **Parser changes:** bump `parser_version`. Otherwise unchanged responses are skipped and the fix
never applies. `politrack reparse <adapter>` rebuilds from the raw archive and deletes claims the new
parser no longer emits.
- **Golden fixtures:** new or changed parsers come with a fixture (`politrack fixture …`). Review the
`.expected.json` diff; don't blindly regenerate with `UPDATE_GOLDEN=1`.
- **Schema:** `0001_schema.sql` and `0002_seed.sql` are applied in existing databases. Change the
schema only with a new numbered migration, with `COMMENT`s on new tables and columns.
- **API types:** after changing a response model, regenerate the frontend types:
`cd backend && politrack openapi --ts ../web/src/lib/api-types.ts`.
- **UI text:** every new key goes into both `web/messages/de.json` and `en.json`.
- **Backend dependencies:** a dependency added to or changed in `backend/pyproject.toml` also goes
into the Debian package list in `backend/tests/Dockerfile.debian` (usually `python3-<name>`). That
list builds both the PyPI-free test image and the agent sandbox image; without the entry, tests
there fail on the import. If Debian doesn't package it, add it to the exceptions in the file's header.
## Commands
```bash
cd backend && pytest # unit + golden tests, no DB or network needed
politrack sources list # adapters, enrichers, schedules, queues
politrack run <adapter> --max-requests 20 -p key=val # limit requests when testing against live sources
politrack reparse <adapter> # re-parse archived responses
politrack enrich | status | review | migrate # enrichers, recent runs, legal review, schema
```
## In the agent-envs sandbox
You are in the sandbox if the repository is at `/workspace` and `HTTPS_PROXY` is `http://egress:8080`
([details](docs/contributing/agents.md)). There:
- **Network:** only allowlisted hosts. HTTP 403 "Blocked by egress policy" means the host isn't
allowed: tell the owner which host you need instead of working around it.
- **Git:** pushing and Gitea API calls over HTTPS work without credentials; the proxy adds them.
Don't set up tokens or credential helpers. The commit identity comes from the repository's config.
- **Tests:** the sandbox image has the backend's dependencies from Debian packages, so
`cd backend && python3 -m pytest -q` works without `pip install`. It comes from
`backend/tests/Dockerfile.debian` (see "Backend dependencies" above).
- **No Docker, no database.** Leave adapter runs against the database and the compose stack to the
owner. The notes below on Git's `safe.directory` don't apply in the sandbox; the PyPI and npm block
does when the session runs on the owner's PC.
## The owner's development machine
These notes apply to the owner's Windows PC (Docker Desktop, Git Bash, PowerShell):
- **Git** reports "dubious ownership" for this folder. Don't change the global git config; prefix git
commands with `git -c safe.directory=C:/Users/disi0/source/repos/politics-tracking`.
- **PyPI and npm** downloads failed there in October 2026 (a network filter blocks
`files.pythonhosted.org` and `registry.npmjs.org`). Until that is fixed, run the tests with the Debian
test image ([testing.md, "Without PyPI access"](docs/contributing/testing.md#without-pypi-access)).
The real images, `npm install` and the workers can't be built or run there.
- **Local database:** `docker compose up -d db` (port 5433, passwords in the gitignored `.env`, data in
`data/`). It has the schema and sources but no scraped data yet, and no job-queue schema until the
real `migrate` image runs. Postgres on a Windows bind mount is slow: the first start takes minutes.
- **`DATA_DIR`, not `APPDATA`:** Windows already defines `APPDATA`, so the compose file uses `DATA_DIR`.
-1
View File
@@ -1 +0,0 @@
@AGENTS.md
-1
View File
@@ -17,7 +17,6 @@ Thanks for helping make Austrian politics more transparent. Three principles gui
| add an API endpoint or MCP tool | [docs/contributing/api.md](docs/contributing/api.md) | | add an API endpoint or MCP tool | [docs/contributing/api.md](docs/contributing/api.md) |
| add a page or show a new claim type in the UI | [docs/contributing/frontend.md](docs/contributing/frontend.md) | | add a page or show a new claim type in the UI | [docs/contributing/frontend.md](docs/contributing/frontend.md) |
| run or write tests | [docs/contributing/testing.md](docs/contributing/testing.md) | | run or write tests | [docs/contributing/testing.md](docs/contributing/testing.md) |
| work on this repository with a coding agent | [docs/contributing/agents.md](docs/contributing/agents.md) |
| understand the design | [docs/architecture/01-design-from-scratch.md](docs/architecture/01-design-from-scratch.md), [docs/data-model.md](docs/data-model.md) | | understand the design | [docs/architecture/01-design-from-scratch.md](docs/architecture/01-design-from-scratch.md), [docs/data-model.md](docs/data-model.md) |
| add a social account or party channel | `backend/config/social_accounts.yaml` (comments explain the fields) | | add a social account or party channel | `backend/config/social_accounts.yaml` (comments explain the fields) |
| add a news feed | `backend/config/feeds.yaml` (+ a `SourceSpec` in `sources/news.py`) | | add a news feed | `backend/config/feeds.yaml` (+ a `SourceSpec` in `sources/news.py`) |
-2
View File
@@ -31,8 +31,6 @@ sources they trust.
|---|---| |---|---|
| [docs/architecture/01-design-from-scratch.md](docs/architecture/01-design-from-scratch.md) | The architecture: quality goals, data model, adapter framework, serving, testing, guard-rails | | [docs/architecture/01-design-from-scratch.md](docs/architecture/01-design-from-scratch.md) | The architecture: quality goals, data model, adapter framework, serving, testing, guard-rails |
| [docs/architecture/02-comparison-and-decisions.md](docs/architecture/02-comparison-and-decisions.md) | Why it is built this way (decision records) | | [docs/architecture/02-comparison-and-decisions.md](docs/architecture/02-comparison-and-decisions.md) | Why it is built this way (decision records) |
| [docs/design/README.md](docs/design/README.md) | Design concept: principles, information architecture, core patterns, every page |
| [docs/design/design-system.md](docs/design/design-system.md) | Design system: tokens, components, content and accessibility rules |
| [docs/data-model.md](docs/data-model.md) | Tables, claim types, identifier schemes, views | | [docs/data-model.md](docs/data-model.md) | Tables, claim types, identifier schemes, views |
| [docs/sources.md](docs/sources.md) | Every source with access method, licence/ToS assessment, and what we deliberately don't collect (incl. Telegram/WhatsApp/Signal) | | [docs/sources.md](docs/sources.md) | Every source with access method, licence/ToS assessment, and what we deliberately don't collect (incl. Telegram/WhatsApp/Signal) |
| [docs/legal.md](docs/legal.md) | Copyright/TDM, GDPR, MedienG §7b (presumption of innocence), defamation | | [docs/legal.md](docs/legal.md) | Copyright/TDM, GDPR, MedienG §7b (presumption of innocence), defamation |
-2
View File
@@ -1,2 +0,0 @@
ALTER TABLE vote_event ADD COLUMN part_vote BOOLEAN NOT NULL DEFAULT FALSE;
COMMENT ON COLUMN vote_event.part_vote IS 'TRUE for a vote on an amendment or a single part of a text (European Parliament), FALSE for a vote on the text as a whole. Claims of part votes carry data.part_vote = true and are left out of general lists by default, because a sitting has over a hundred of them.';
@@ -1,7 +0,0 @@
ALTER TABLE claim DROP CONSTRAINT claim_claim_type_check;
ALTER TABLE claim ADD CONSTRAINT claim_claim_type_check CHECK (claim_type IN (
'role', 'vote', 'donation', 'money_flow', 'statement', 'appearance', 'meeting', 'travel',
'side_job', 'legal_proceeding', 'lobbying', 'media_mention', 'career',
'parliamentary_question', 'government_decision', 'wiki_edit', 'declaration', 'ownership',
'affiliation', 'party_finance', 'election_result', 'other'));
COMMENT ON COLUMN claim.claim_type IS 'Kind of fact. election_result: a party''s result in a region (counterpart = the elected body) or a candidate''s preference votes (person, counterpart = party).';
@@ -1,6 +0,0 @@
-- enrich.embed looks up claims and documents without a chunk on every batch. chunk_uniq is an expression index
-- (COALESCE(...)), which those lookups can't use, so each batch scanned the whole table: after the history
-- backfill (over a million claims) a run took hours and blocked the other enrichers. Built CONCURRENTLY by hand on
-- 2026-11-14; IF NOT EXISTS makes this a no-op there.
CREATE INDEX IF NOT EXISTS chunk_claim_idx ON chunk (claim_id) WHERE claim_id IS NOT NULL;
CREATE INDEX IF NOT EXISTS chunk_document_idx ON chunk (document_id) WHERE document_id IS NOT NULL;
@@ -1,7 +0,0 @@
-- enrich.topics fetches the next batch of untagged claims on every iteration; without an index each batch scanned
-- all claims (over a million after the history backfill) and a run took hours, blocking the enrich queue. The
-- predicate must stay identical to the query in enrich/topics.py. Built CONCURRENTLY by hand on 2026-11-14.
CREATE INDEX IF NOT EXISTS claim_untagged_idx ON claim (id)
WHERE claim_type IN ('media_mention', 'statement', 'donation', 'side_job', 'appearance', 'meeting', 'travel',
'money_flow', 'government_decision', 'wiki_edit', 'career')
AND NOT (data ? 'topics_tagged');
+4 -32
View File
@@ -12,7 +12,6 @@ from typing import Annotated
from fastapi import Depends, FastAPI, Header, HTTPException, Query from fastapi import Depends, FastAPI, Header, HTTPException, Query
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from psycopg import Connection from psycopg import Connection
from politrack import queries from politrack import queries
@@ -67,23 +66,6 @@ def healthz(conn: DB) -> dict:
return {"ok": True} return {"ok": True}
BACKUP_SCHEDULE = "30 2 * * *" # the `backup` service in docker-compose.yml logs each dump as a run
@app.get("/api/v1/status/sources", include_in_schema=False)
def source_status(conn: DB) -> JSONResponse:
"""For monitoring (e.g. Uptime Kuma): HTTP 503 as soon as a scheduled source or the nightly backup missed its
last two slots. Lists every task with its last successful run."""
from politrack.core import registry
registry.load_builtin()
schedules = {name: cls.schedule for name, cls in {**registry.ADAPTERS, **registry.ENRICHERS}.items() if cls.schedule}
schedules["backup"] = BACKUP_SCHEDULE
rows = queries.source_freshness(conn, schedules)
stale = [r["adapter"] for r in rows if r["stale"]]
return JSONResponse({"ok": not stale, "stale": stale, "sources": rows}, status_code=503 if stale else 200)
# -- reference data ----------------------------------------------------------------------- # -- reference data -----------------------------------------------------------------------
@app.get("/api/v1/stats", response_model=s.Stats) @app.get("/api/v1/stats", response_model=s.Stats)
@@ -151,10 +133,8 @@ def get_person(slug: str, conn: DB):
@app.get("/api/v1/persons/{slug}/votes", response_model=list[s.PersonVote]) @app.get("/api/v1/persons/{slug}/votes", response_model=list[s.PersonVote])
def get_person_votes(slug: str, conn: DB, topics: str | None = None, include_parts: bool = False, limit: Limit = 100, def get_person_votes(slug: str, conn: DB, topics: str | None = None, limit: Limit = 100, offset: Offset = 0):
offset: Offset = 0): return queries.person_votes(conn, slug, topics=csv_list(topics), limit=limit, offset=offset)
return queries.person_votes(conn, slug, topics=csv_list(topics), include_parts=include_parts, limit=limit,
offset=offset)
@app.get("/api/v1/persons/{slug}/network", response_model=s.Network) @app.get("/api/v1/persons/{slug}/network", response_model=s.Network)
@@ -185,13 +165,6 @@ def get_claims(
limit=limit, offset=offset) limit=limit, offset=offset)
@app.get("/api/v1/claims/{claim_id}", response_model=s.Claim)
def get_claim(claim_id: int, conn: DB, sources: Sources):
"""One claim with all its evidence - the target of permalinks (callers normally omit the source filter)."""
rows = queries.list_claims(conn, sources=sources, claim_id=claim_id, limit=1)
return not_found(rows[0] if rows else None, "claim")
@app.get("/api/v1/timeline", response_model=list[s.TimelineBucket]) @app.get("/api/v1/timeline", response_model=list[s.TimelineBucket])
def get_timeline(conn: DB, sources: Sources, person: str | None = None, party: str | None = None): def get_timeline(conn: DB, sources: Sources, person: str | None = None, party: str | None = None):
return queries.timeline_histogram(conn, sources=sources, person=person, party=party) return queries.timeline_histogram(conn, sources=sources, person=person, party=party)
@@ -238,10 +211,9 @@ def get_wiki_edits(conn: DB, limit: Limit = 100, offset: Offset = 0):
@app.get("/api/v1/votes", response_model=list[s.VoteItem]) @app.get("/api/v1/votes", response_model=list[s.VoteItem])
def get_votes(conn: DB, party: str | None = None, topics: str | None = None, roll_call: bool | None = None, def get_votes(conn: DB, party: str | None = None, topics: str | None = None, roll_call: bool | None = None,
since: date | None = None, until: date | None = None, include_parts: bool = False, limit: Limit = 50, since: date | None = None, until: date | None = None, limit: Limit = 50, offset: Offset = 0):
offset: Offset = 0):
return queries.list_votes(conn, party=party, topics=csv_list(topics), roll_call=roll_call, since=since, return queries.list_votes(conn, party=party, topics=csv_list(topics), roll_call=roll_call, since=since,
until=until, include_parts=include_parts, limit=limit, offset=offset) until=until, limit=limit, offset=offset)
@app.get("/api/v1/votes/{vote_id}", response_model=s.VoteDetail) @app.get("/api/v1/votes/{vote_id}", response_model=s.VoteDetail)
+1 -1
View File
@@ -11,7 +11,7 @@ from pydantic import BaseModel, ConfigDict
ClaimType = Literal["role", "vote", "donation", "money_flow", "statement", "appearance", "meeting", "travel", ClaimType = Literal["role", "vote", "donation", "money_flow", "statement", "appearance", "meeting", "travel",
"side_job", "legal_proceeding", "lobbying", "media_mention", "career", "parliamentary_question", "side_job", "legal_proceeding", "lobbying", "media_mention", "career", "parliamentary_question",
"government_decision", "wiki_edit", "declaration", "ownership", "affiliation", "party_finance", "government_decision", "wiki_edit", "declaration", "ownership", "affiliation", "party_finance",
"election_result", "other"] "other"]
PersonStatus = Literal["active", "former", "party_member", "deceased"] PersonStatus = Literal["active", "former", "party_member", "deceased"]
+4 -53
View File
@@ -20,7 +20,6 @@ from psycopg.types.json import Jsonb
from politrack.core.adapter import RunContext from politrack.core.adapter import RunContext
from politrack.core.records import ( from politrack.core.records import (
ArchiveCopy,
Claim, Claim,
Document, Document,
Event, Event,
@@ -32,7 +31,6 @@ from politrack.core.records import (
Participation, Participation,
PersonRecord, PersonRecord,
PersonRef, PersonRef,
PostRemoved,
Role, Role,
SocialAccount, SocialAccount,
Statement, Statement,
@@ -78,10 +76,6 @@ class Loader:
return self.vote_event(record) return self.vote_event(record)
if isinstance(record, Event): if isinstance(record, Event):
return self.event(record) return self.event(record)
if isinstance(record, PostRemoved):
return self.post_removed(record)
if isinstance(record, ArchiveCopy):
return self.archive_copy(record)
raise TypeError(f"unknown record type {type(record).__name__}") raise TypeError(f"unknown record type {type(record).__name__}")
# -- documents -------------------------------------------------------------------- # -- documents --------------------------------------------------------------------
@@ -115,48 +109,6 @@ class Loader:
self.ctx.stats["documents"] += 1 self.ctx.stats["documents"] += 1
return row["id"] return row["id"]
def archive_copy(self, rec: ArchiveCopy) -> None:
self.ctx.stats["archive_copies"] += self.conn.execute(
"UPDATE document SET archive_url = %s WHERE url = %s AND archive_url IS NULL", (rec.archive_url, rec.url)
).rowcount
def post_removed(self, rec: PostRemoved) -> None:
"""Keep the record that a post existed and disappeared, without any of the platform's text.
The text is copied to several places when a post is loaded; all of them are cleared here. If the
post comes back in a later timeline fetch, the normal upsert restores the text and the flag.
"""
claims = self.conn.execute(
"SELECT claim_id FROM statement WHERE url = %s AND platform = %s AND context = 'social_post'",
(rec.url, rec.platform),
).fetchall()
if not claims:
self.ctx.stats["removed_post_unknown"] += 1
return
day = rec.detected_at.date()
marker = {"removed_from_platform": True, "removed_detected_at": rec.detected_at.isoformat()}
for row in claims:
claim_id = row["claim_id"]
self.conn.execute("UPDATE statement SET excerpt = NULL, title = NULL WHERE claim_id = %s", (claim_id,))
self.conn.execute("UPDATE claim_evidence SET quote = NULL WHERE claim_id = %s", (claim_id,))
self.conn.execute("DELETE FROM chunk WHERE claim_id = %s", (claim_id,))
self.conn.execute(
"""UPDATE claim SET summary_de = %s, summary_en = %s, updated_at = now(),
data = (data - 'likes' - 'reposts') || %s
WHERE id = %s""",
(f"Beitrag auf {rec.platform_label}, dort nicht mehr verfügbar (festgestellt am {day:%d.%m.%Y})",
f"Post on {rec.platform_label}, no longer available there (detected on {day:%Y-%m-%d})",
Jsonb(marker), claim_id),
)
self.conn.execute(
"DELETE FROM chunk WHERE document_id IN (SELECT id FROM document WHERE url = %s)", (rec.url,)
)
self.conn.execute(
"""UPDATE document SET title = %s, excerpt = NULL, full_text = NULL, meta = meta || %s WHERE url = %s""",
(f"Beitrag auf {rec.platform_label} (nicht mehr verfügbar)", Jsonb(marker), rec.url),
)
self.ctx.stats["posts_removed"] += 1
# -- entities --------------------------------------------------------------------- # -- entities ---------------------------------------------------------------------
def person(self, rec: PersonRecord) -> int | None: def person(self, rec: PersonRecord) -> int | None:
@@ -250,15 +202,14 @@ class Loader:
chamber = self.resolver.org(rec.chamber, create=False) if rec.chamber else None chamber = self.resolver.org(rec.chamber, create=False) if rec.chamber else None
row = self.conn.execute( row = self.conn.execute(
"""INSERT INTO vote_event (event_key, chamber_id, item_ref, item_title, stage, voted_on, result, roll_call, """INSERT INTO vote_event (event_key, chamber_id, item_ref, item_title, stage, voted_on, result, roll_call,
url, protocol_url, raw_text, part_vote) url, protocol_url, raw_text)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
ON CONFLICT (event_key) DO UPDATE SET result = EXCLUDED.result, raw_text = EXCLUDED.raw_text, ON CONFLICT (event_key) DO UPDATE SET result = EXCLUDED.result, raw_text = EXCLUDED.raw_text,
roll_call = EXCLUDED.roll_call, item_title = EXCLUDED.item_title, part_vote = EXCLUDED.part_vote, roll_call = EXCLUDED.roll_call, item_title = EXCLUDED.item_title,
item_ref = EXCLUDED.item_ref, stage = EXCLUDED.stage,
protocol_url = COALESCE(EXCLUDED.protocol_url, vote_event.protocol_url) protocol_url = COALESCE(EXCLUDED.protocol_url, vote_event.protocol_url)
RETURNING id""", RETURNING id""",
(rec.key, chamber, rec.item_ref, rec.title, rec.stage, rec.voted_on, rec.result, rec.roll_call, rec.url, (rec.key, chamber, rec.item_ref, rec.title, rec.stage, rec.voted_on, rec.result, rec.roll_call, rec.url,
rec.protocol_url, rec.raw_text, rec.part_vote), rec.protocol_url, rec.raw_text),
).fetchone() ).fetchone()
self.ctx.stats["vote_events"] += 1 self.ctx.stats["vote_events"] += 1
return row["id"] return row["id"]
+1 -24
View File
@@ -149,7 +149,6 @@ class VoteEvent:
url: str | None = None url: str | None = None
protocol_url: str | None = None protocol_url: str | None = None
raw_text: str | None = None raw_text: str | None = None
part_vote: bool = False # a vote on an amendment or part of a text, not on the whole text
@dataclass @dataclass
@@ -248,29 +247,7 @@ class Claim:
facet: Facet | None = None facet: Facet | None = None
@dataclass Record = Union[PersonRecord, OrgRecord, SocialAccount, VoteEvent, Event, Claim, Document]
class PostRemoved:
"""A stored post is no longer available on its platform.
The Loader removes the platform's text everywhere and keeps a marked record (who, when, link), so the
fact that the post existed and disappeared stays on the record. See docs/legal.md.
"""
url: str
platform: str
platform_label: str
detected_at: datetime
@dataclass
class ArchiveCopy:
"""A public archive (Internet Archive) holds a copy of this document."""
url: str
archive_url: str
Record = Union[PersonRecord, OrgRecord, SocialAccount, VoteEvent, Event, Claim, Document, PostRemoved, ArchiveCopy]
def to_jsonable(obj: Any) -> Any: def to_jsonable(obj: Any) -> Any:
-10
View File
@@ -7,8 +7,6 @@ Order (first hit wins, ambiguity never guesses):
Hint strategies for persons (documented in docs/data-model.md): 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) 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) 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 from __future__ import annotations
@@ -135,14 +133,6 @@ class Resolver:
return suffix[0]["id"] if len(suffix) == 1 else None return suffix[0]["id"] if len(suffix) == 1 else None
if "office" in hints: if "office" in hints:
return self.office_holder(hints["office"], on) 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 return None
def office_holder(self, office: str, on: date | None) -> int | None: def office_holder(self, office: str, on: date | None) -> int | None:
+3 -4
View File
@@ -63,7 +63,6 @@ def build_chunks(conn: Connection, batch: int = 5000) -> int:
JOIN document d ON d.id = e.document_id JOIN document d ON d.id = e.document_id
JOIN source s ON s.id = d.source_id JOIN source s ON s.id = d.source_id
WHERE c.merged_into IS NULL AND c.review_status = 'published' WHERE c.merged_into IS NULL AND c.review_status = 'published'
AND NOT COALESCE((c.data->>'part_vote')::boolean, FALSE)
AND NOT EXISTS (SELECT 1 FROM chunk ch WHERE ch.claim_id = c.id) AND NOT EXISTS (SELECT 1 FROM chunk ch WHERE ch.claim_id = c.id)
GROUP BY c.id, p.full_name, o.name GROUP BY c.id, p.full_name, o.name
LIMIT %s LIMIT %s
@@ -77,14 +76,14 @@ def build_chunks(conn: Connection, batch: int = 5000) -> int:
conn.execute(UPSERT_CHUNK, (c["id"], None, 0, text.strip())) conn.execute(UPSERT_CHUNK, (c["id"], None, 0, text.strip()))
docs = conn.execute( docs = conn.execute(
r""" """
SELECT d.id, d.title, d.full_text FROM document d SELECT d.id, d.title, d.full_text FROM document d
WHERE d.full_text ~ '\S' AND NOT EXISTS (SELECT 1 FROM chunk ch WHERE ch.document_id = d.id) WHERE d.full_text IS NOT NULL AND NOT EXISTS (SELECT 1 FROM chunk ch WHERE ch.document_id = d.id)
LIMIT %s LIMIT %s
""", """,
(batch // 10,), (batch // 10,),
).fetchall() ).fetchall()
for d in docs: # blank texts are excluded above: they yield no chunks and would be selected forever for d in docs:
for i, part in enumerate(split_text(d["full_text"])): for i, part in enumerate(split_text(d["full_text"])):
conn.execute(UPSERT_CHUNK, (None, d["id"], i, f"{d['title'] or ''}\n{part}".strip())) conn.execute(UPSERT_CHUNK, (None, d["id"], i, f"{d['title'] or ''}\n{part}".strip()))
conn.commit() conn.commit()
+4 -14
View File
@@ -115,8 +115,7 @@ def list_claims(
) -> str: ) -> str:
"""Claims about a person/party/organisation, newest first. claim_types: role, vote, donation, money_flow, """Claims about a person/party/organisation, newest first. claim_types: role, vote, donation, money_flow,
statement, appearance, meeting, travel, side_job, legal_proceeding, lobbying, media_mention, career, statement, appearance, meeting, travel, side_job, legal_proceeding, lobbying, media_mention, career,
parliamentary_question, government_decision, wiki_edit, declaration, ownership, affiliation, party_finance, parliamentary_question, government_decision, wiki_edit, declaration, ownership, affiliation, party_finance.
election_result.
Dates as YYYY-MM-DD.""" Dates as YYYY-MM-DD."""
with connection() as conn: with connection() as conn:
return _dump(queries.list_claims( return _dump(queries.list_claims(
@@ -125,14 +124,6 @@ def list_claims(
until=_date(until), limit=limit)) until=_date(until), limit=limit))
@mcp.tool()
def get_claim(claim_id: int) -> str:
"""One claim with all its evidence, e.g. from a permalink (/angaben/<id>) a user shared."""
with connection() as conn:
rows = queries.list_claims(conn, sources=SourceFilter([], 0), claim_id=claim_id, limit=1)
return _dump(rows[0] if rows else {"error": f"claim {claim_id} not found"})
@mcp.tool() @mcp.tool()
def money_flows(kinds: list[str] | None = None, organization: str | None = None, person: str | None = None, def money_flows(kinds: list[str] | None = None, organization: str | None = None, person: str | None = None,
query: str | None = None, since: str | None = None, until: str | None = None, query: str | None = None, since: str | None = None, until: str | None = None,
@@ -171,12 +162,11 @@ def calendar(start: str, end: str, person: str | None = None, party: str | None
@mcp.tool() @mcp.tool()
def person_votes(slug: str, topics: list[str] | None = None, include_parts: bool = False, limit: int = 50) -> str: def person_votes(slug: str, topics: list[str] | None = None, limit: int = 50) -> str:
"""Votes: individual roll-call votes (with dissent flag) and faction votes during the person's mandates. """Votes: individual roll-call votes (with dissent flag) and faction votes during the person's mandates.
`spoke` links a speech by the person on the same item (say vs. vote). include_parts adds European `spoke` links a speech by the person on the same item (say vs. vote)."""
Parliament votes on amendments and parts of a text."""
with connection() as conn: with connection() as conn:
return _dump(queries.person_votes(conn, slug, topics=topics, include_parts=include_parts, limit=limit)) return _dump(queries.person_votes(conn, slug, topics=topics, limit=limit))
@mcp.tool() @mcp.tool()
+2 -10
View File
@@ -1,14 +1,6 @@
"""Read queries shared by the REST API and the MCP server (one module per domain).""" """Read queries shared by the REST API and the MCP server (one module per domain)."""
from politrack.queries.admin import ( from politrack.queries.admin import list_sources, list_topics, pending_claims, recent_runs, set_review, stats
list_sources,
list_topics,
pending_claims,
recent_runs,
set_review,
source_freshness,
stats,
)
from politrack.queries.claims import calendar, list_claims, timeline_histogram from politrack.queries.claims import calendar, list_claims, timeline_histogram
from politrack.queries.common import SourceFilter from politrack.queries.common import SourceFilter
from politrack.queries.money import list_money, money_summary, social_feed, wiki_edits from politrack.queries.money import list_money, money_summary, social_feed, wiki_edits
@@ -21,5 +13,5 @@ __all__ = [
"SourceFilter", "calendar", "former_overview", "get_organization", "get_party", "get_person", "list_claims", "SourceFilter", "calendar", "former_overview", "get_organization", "get_party", "get_person", "list_claims",
"list_money", "list_organizations", "list_parties", "list_persons", "list_sources", "list_topics", "list_votes", "list_money", "list_organizations", "list_parties", "list_persons", "list_sources", "list_topics", "list_votes",
"money_summary", "pending_claims", "recent_runs", "person_network", "person_votes", "search", "set_review", "social_feed", "money_summary", "pending_claims", "recent_runs", "person_network", "person_votes", "search", "set_review", "social_feed",
"source_freshness", "stats", "timeline_histogram", "vote_detail", "wiki_edits", "stats", "timeline_histogram", "vote_detail", "wiki_edits",
] ]
-23
View File
@@ -2,8 +2,6 @@
from __future__ import annotations from __future__ import annotations
from datetime import datetime, timedelta, timezone
from psycopg import Connection from psycopg import Connection
@@ -63,27 +61,6 @@ def stats(conn: Connection) -> dict:
).fetchone() ).fetchone()
def source_freshness(conn: Connection, schedules: dict[str, str], now: datetime | None = None) -> list[dict]:
"""Last successful run per scheduled task. Stale = its two latest scheduled slots passed without a
successful run (plus an hour's grace for long runs), so one slow or failed run alone never alerts."""
from croniter import croniter
now = now or datetime.now(timezone.utc)
last_ok = {r["adapter"]: r["at"] for r in conn.execute(
"SELECT adapter, max(COALESCE(finished_at, started_at)) AS at FROM run "
"WHERE status IN ('ok', 'partial') GROUP BY adapter")}
rows = []
for name, schedule in sorted(schedules.items()):
it = croniter(schedule, now)
due = it.get_prev(datetime)
before = it.get_prev(datetime)
deadline = before - timedelta(hours=1)
last = last_ok.get(name)
rows.append({"adapter": name, "schedule": schedule, "last_success": last.isoformat() if last else None,
"stale": last is None or last < deadline, "latest_slot": due.isoformat()})
return rows
def recent_runs(conn: Connection, limit: int = 50) -> list[dict]: def recent_runs(conn: Connection, limit: int = 50) -> list[dict]:
return conn.execute( return conn.execute(
"SELECT adapter, mode, status, started_at, finished_at, stats, left(error, 2000) AS error FROM run " "SELECT adapter, mode, status, started_at, finished_at, stats, left(error, 2000) AS error FROM run "
+4 -7
View File
@@ -6,7 +6,7 @@ from datetime import date
from psycopg import Connection from psycopg import Connection
from politrack.queries.common import NOT_PART_VOTE, VISIBLE, SourceFilter from politrack.queries.common import VISIBLE, SourceFilter
def list_claims( def list_claims(
@@ -21,7 +21,6 @@ def list_claims(
since: date | None = None, since: date | None = None,
until: date | None = None, until: date | None = None,
q: str | None = None, q: str | None = None,
claim_id: int | None = None,
include_pending: bool = False, include_pending: bool = False,
limit: int = 50, limit: int = 50,
offset: int = 0, offset: int = 0,
@@ -29,7 +28,7 @@ def list_claims(
source_sql, params = sources.sql("s") source_sql, params = sources.sql("s")
params.update({ params.update({
"person": person, "party": party, "organization": organization, "claim_types": claim_types, "topics": topics, "since": since, "person": person, "party": party, "organization": organization, "claim_types": claim_types, "topics": topics, "since": since,
"until": until, "q": q, "claim_id": claim_id, "limit": limit, "offset": offset, "include_pending": include_pending, "until": until, "q": q, "limit": limit, "offset": offset, "include_pending": include_pending,
}) })
return conn.execute( return conn.execute(
f""" f"""
@@ -62,7 +61,6 @@ def list_claims(
WHERE e.claim_id = c.id AND {source_sql} WHERE e.claim_id = c.id AND {source_sql}
) ev ) ev
WHERE ev.evidence IS NOT NULL AND {VISIBLE} WHERE ev.evidence IS NOT NULL AND {VISIBLE}
AND (%(claim_id)s::bigint IS NOT NULL OR {NOT_PART_VOTE})
AND (%(person)s::text IS NULL OR p.slug = %(person)s OR cpp.slug = %(person)s) AND (%(person)s::text IS NULL OR p.slug = %(person)s OR cpp.slug = %(person)s)
AND (%(party)s::text IS NULL OR o.slug = %(party)s AND (%(party)s::text IS NULL OR o.slug = %(party)s
OR c.counterpart_org_id = (SELECT id FROM organization WHERE slug = %(party)s)) OR c.counterpart_org_id = (SELECT id FROM organization WHERE slug = %(party)s))
@@ -75,7 +73,6 @@ def list_claims(
AND (%(since)s::date IS NULL OR COALESCE(c.occurred_at::date, c.valid_to, c.valid_from, current_date) >= %(since)s) AND (%(since)s::date IS NULL OR COALESCE(c.occurred_at::date, c.valid_to, c.valid_from, current_date) >= %(since)s)
AND (%(until)s::date IS NULL OR COALESCE(c.occurred_at::date, c.valid_from) <= %(until)s) AND (%(until)s::date IS NULL OR COALESCE(c.occurred_at::date, c.valid_from) <= %(until)s)
AND (%(q)s::text IS NULL OR c.summary_de ILIKE '%%' || %(q)s || '%%') AND (%(q)s::text IS NULL OR c.summary_de ILIKE '%%' || %(q)s || '%%')
AND (%(claim_id)s::bigint IS NULL OR c.id = %(claim_id)s)
ORDER BY COALESCE(c.occurred_at, c.valid_from::timestamptz, c.created_at) DESC, c.id DESC ORDER BY COALESCE(c.occurred_at, c.valid_from::timestamptz, c.created_at) DESC, c.id DESC
LIMIT %(limit)s OFFSET %(offset)s LIMIT %(limit)s OFFSET %(offset)s
""", """,
@@ -98,7 +95,7 @@ def timeline_histogram(conn: Connection, *, sources: SourceFilter, person: str |
LEFT JOIN organization o ON o.id = c.organization_id LEFT JOIN organization o ON o.id = c.organization_id
JOIN claim_evidence e ON e.claim_id = c.id JOIN document d ON d.id = e.document_id JOIN claim_evidence e ON e.claim_id = c.id JOIN document d ON d.id = e.document_id
JOIN source s ON s.id = d.source_id JOIN source s ON s.id = d.source_id
WHERE {VISIBLE} AND {NOT_PART_VOTE} AND {source_sql} AND COALESCE(c.occurred_at, c.valid_from::timestamptz) IS NOT NULL WHERE {VISIBLE} AND {source_sql} AND COALESCE(c.occurred_at, c.valid_from::timestamptz) IS NOT NULL
AND (%(person)s::text IS NULL OR p.slug = %(person)s OR cpp.slug = %(person)s) AND (%(person)s::text IS NULL OR p.slug = %(person)s OR cpp.slug = %(person)s)
AND (%(party)s::text IS NULL OR o.slug = %(party)s) AND (%(party)s::text IS NULL OR o.slug = %(party)s)
AND c.claim_type <> 'role' AND c.claim_type <> 'role'
@@ -150,7 +147,7 @@ def calendar(conn: Connection, *, sources: SourceFilter, start: date, end: date,
LEFT JOIN organization o ON o.id = c.organization_id LEFT JOIN organization o ON o.id = c.organization_id
JOIN claim_evidence e ON e.claim_id = c.id JOIN document d ON d.id = e.document_id JOIN claim_evidence e ON e.claim_id = c.id JOIN document d ON d.id = e.document_id
JOIN source s ON s.id = d.source_id JOIN source s ON s.id = d.source_id
WHERE {VISIBLE} AND {NOT_PART_VOTE} AND {source_sql} AND c.occurred_at::date BETWEEN %(start)s AND %(end)s WHERE {VISIBLE} AND {source_sql} AND c.occurred_at::date BETWEEN %(start)s AND %(end)s
AND (%(person)s::text IS NULL OR p.slug = %(person)s OR cpp.slug = %(person)s) AND (%(person)s::text IS NULL OR p.slug = %(person)s OR cpp.slug = %(person)s)
AND (%(party)s::text IS NULL OR o.slug = %(party)s) AND (%(party)s::text IS NULL OR o.slug = %(party)s)
GROUP BY 1, 2 ORDER BY 1 GROUP BY 1, 2 ORDER BY 1
-2
View File
@@ -13,8 +13,6 @@ from typing import Any
VISIBLE = ("c.merged_into IS NULL AND (c.review_status = 'published' OR " VISIBLE = ("c.merged_into IS NULL AND (c.review_status = 'published' OR "
"(%(include_pending)s AND c.review_status = 'pending'))") "(%(include_pending)s AND c.review_status = 'pending'))")
# Votes on amendments and parts of a text only appear where someone asks for them: they would bury everything else.
NOT_PART_VOTE = "NOT COALESCE((c.data->>'part_vote')::boolean, FALSE)"
@dataclass @dataclass
+4 -12
View File
@@ -8,21 +8,13 @@ from psycopg import Connection
def list_parties(conn: Connection) -> list[dict]: def list_parties(conn: Connection) -> list[dict]:
return conn.execute( return conn.execute(
""" """
-- person_status is an expensive view: evaluate it once, not once per party
WITH active AS (
SELECT party_id, count(DISTINCT ps.person_id) AS n
FROM person_status ps, unnest(ps.current_party_ids) AS party_id
WHERE ps.status = 'active'
GROUP BY party_id
)
SELECT o.slug, o.name, o.short_name, o.color, o.logo_url, SELECT o.slug, o.name, o.short_name, o.color, o.logo_url,
COALESCE(a.n, 0) AS active_officials, (SELECT count(*) FROM person_status ps WHERE ps.status = 'active' AND o.id = ANY(ps.current_party_ids))
AS active_officials,
count(DISTINCT r.person_id) AS total_people count(DISTINCT r.person_id) AS total_people
FROM organization o FROM organization o LEFT JOIN role r ON r.party_id = o.id
LEFT JOIN role r ON r.party_id = o.id
LEFT JOIN active a ON a.party_id = o.id
WHERE o.kind = 'party' WHERE o.kind = 'party'
GROUP BY o.id, a.n GROUP BY o.id
ORDER BY active_officials DESC, total_people DESC, o.name ORDER BY active_officials DESC, total_people DESC, o.name
""" """
).fetchall() ).fetchall()
+1 -1
View File
@@ -72,7 +72,7 @@ def get_person(conn: Connection, slug: str) -> dict | None:
r["claim_type"]: r["count"] r["claim_type"]: r["count"]
for r in conn.execute( for r in conn.execute(
"SELECT claim_type, count(*) AS count FROM claim WHERE person_id = %s AND merged_into IS NULL " "SELECT claim_type, count(*) AS count FROM claim WHERE person_id = %s AND merged_into IS NULL "
"AND review_status = 'published' AND NOT COALESCE((data->>'part_vote')::boolean, FALSE) GROUP BY claim_type", "AND review_status = 'published' GROUP BY claim_type",
(person["id"],), (person["id"],),
) )
} }
+8 -10
View File
@@ -17,9 +17,9 @@ SPOKE = """
""" """
def person_votes(conn: Connection, slug: str, *, topics: list[str] | None = None, include_parts: bool = False, def person_votes(conn: Connection, slug: str, *, topics: list[str] | None = None, limit: int = 100,
limit: int = 100, offset: int = 0) -> list[dict]: offset: int = 0) -> list[dict]:
"""Votes concerning a person (include_parts: also votes on amendments and parts of a text). """Votes concerning a person.
* individual=true: roll-call votes with the person's own vote; dissent=true when it differs from the * individual=true: roll-call votes with the person's own vote; dissent=true when it differs from the
majority of their faction (vote_position.party_id = their faction that day). majority of their faction (vote_position.party_id = their faction that day).
@@ -41,8 +41,7 @@ def person_votes(conn: Connection, slug: str, *, topics: list[str] | None = None
JOIN organization ch ON ch.id = ve.chamber_id JOIN organization ch ON ch.id = ve.chamber_id
LEFT JOIN organization fo ON fo.id = vp.party_id LEFT JOIN organization fo ON fo.id = vp.party_id
LEFT JOIN vote_position fp ON fp.vote_event_id = ve.id AND fp.organization_id = vp.party_id LEFT JOIN vote_position fp ON fp.vote_event_id = ve.id AND fp.organization_id = vp.party_id
WHERE (%(include_parts)s OR NOT ve.part_vote) WHERE (%(topics)s::text[] IS NULL OR EXISTS (
AND (%(topics)s::text[] IS NULL OR EXISTS (
SELECT 1 FROM topic_assignment ta JOIN topic t ON t.id = ta.topic_id SELECT 1 FROM topic_assignment ta JOIN topic t ON t.id = ta.topic_id
WHERE ta.claim_id = vp.claim_id AND t.slug = ANY(%(topics)s))) WHERE ta.claim_id = vp.claim_id AND t.slug = ANY(%(topics)s)))
UNION ALL UNION ALL
@@ -64,13 +63,13 @@ def person_votes(conn: Connection, slug: str, *, topics: list[str] | None = None
ORDER BY voted_on DESC NULLS LAST ORDER BY voted_on DESC NULLS LAST
LIMIT %(limit)s OFFSET %(offset)s LIMIT %(limit)s OFFSET %(offset)s
""", """,
{"slug": slug, "topics": topics, "include_parts": include_parts, "limit": limit, "offset": offset}, {"slug": slug, "topics": topics, "limit": limit, "offset": offset},
).fetchall() ).fetchall()
def list_votes(conn: Connection, *, party: str | None = None, topics: list[str] | None = None, def list_votes(conn: Connection, *, party: str | None = None, topics: list[str] | None = None,
roll_call: bool | None = None, since: date | None = None, until: date | None = None, roll_call: bool | None = None, since: date | None = None, until: date | None = None,
include_parts: bool = False, limit: int = 50, offset: int = 0) -> list[dict]: limit: int = 50, offset: int = 0) -> list[dict]:
return conn.execute( return conn.execute(
""" """
SELECT ve.id, ve.item_title, ve.item_ref, ve.stage, ve.voted_on, ve.result, ve.url, ve.protocol_url, SELECT ve.id, ve.item_title, ve.item_ref, ve.stage, ve.voted_on, ve.result, ve.url, ve.protocol_url,
@@ -84,8 +83,7 @@ def list_votes(conn: Connection, *, party: str | None = None, topics: list[str]
JOIN organization ch ON ch.id = ve.chamber_id JOIN organization ch ON ch.id = ve.chamber_id
LEFT JOIN vote_position vp ON vp.vote_event_id = ve.id AND vp.organization_id IS NOT NULL LEFT JOIN vote_position vp ON vp.vote_event_id = ve.id AND vp.organization_id IS NOT NULL
LEFT JOIN organization o ON o.id = vp.organization_id LEFT JOIN organization o ON o.id = vp.organization_id
WHERE (%(include_parts)s OR NOT ve.part_vote) WHERE (%(party)s::text IS NULL OR EXISTS (
AND (%(party)s::text IS NULL OR EXISTS (
SELECT 1 FROM vote_position v2 JOIN organization o2 ON o2.id = v2.organization_id SELECT 1 FROM vote_position v2 JOIN organization o2 ON o2.id = v2.organization_id
WHERE v2.vote_event_id = ve.id AND o2.slug = %(party)s)) WHERE v2.vote_event_id = ve.id AND o2.slug = %(party)s))
AND (%(topics)s::text[] IS NULL OR EXISTS ( AND (%(topics)s::text[] IS NULL OR EXISTS (
@@ -99,7 +97,7 @@ def list_votes(conn: Connection, *, party: str | None = None, topics: list[str]
LIMIT %(limit)s OFFSET %(offset)s LIMIT %(limit)s OFFSET %(offset)s
""", """,
{"party": party, "topics": topics, "roll_call": roll_call, "since": since, "until": until, {"party": party, "topics": topics, "roll_call": roll_call, "since": since, "until": until,
"include_parts": include_parts, "limit": limit, "offset": offset}, "limit": limit, "offset": offset},
).fetchall() ).fetchall()
-235
View File
@@ -1,235 +0,0 @@
"""Official election results from the Federal Ministry of the Interior (BMI, Bundeswahlbehörde).
Per election: the final result (XLSX, one row per region with votes per party) and the preference votes of the
candidates (XLSX, per list). Only the federal and state totals of the result are kept; municipal rows stay in the
raw archive. Candidates become claims only if they resolve to a known politician: by exact name plus birth year
where the file has one, otherwise by exact, unambiguous name. Unknown candidates are counted, never stored, and
their occupation is never kept.
Not covered yet: the 2019 state and regional lists (a print layout with side-by-side columns), elections before
2019, Landtag and municipal elections (published by the states).
"""
from __future__ import annotations
import io
import re
from collections.abc import Iterator
from dataclasses import dataclass
from datetime import date
from typing import Any
from politrack.core import Adapter, Request, Response, RunContext, SourceSpec, register
from politrack.core.records import Claim, Evidence, OrgRef, PersonRef
from politrack.text import strip_titles
BMI = "https://www.bmi.gv.at/412"
SPEC = SourceSpec(
slug="bmi-wahlen", name="Bundesministerium für Inneres – Wahlergebnisse", kind="official",
homepage=f"{BMI}/start.aspx", license="Amtliches Werk (§7 UrhG); Ergebnisse auch als CC BY 4.0 auf data.gv.at",
access="bulk", trust=95, min_interval=3.0,
tos_notes="Final results and preference votes as published by the Bundeswahlbehörde (XLSX). robots.txt sets "
"no rules. Only candidates who resolve to a known politician are stored; occupations are never kept.",
)
@dataclass(frozen=True)
class Election:
key: str
name_de: str
name_en: str
held_on: date
body: str # slug of the elected body
path: str # folder on bmi.gv.at
result: str | None # None: only in a format we can't read (EU 2019: legacy .xls)
preferences: tuple[tuple[str, str], ...] # (layout, file): layouts "bund", "land", "eu"
ELECTIONS = (
Election("nrw2024", "Nationalratswahl 2024", "2024 National Council election", date(2024, 9, 29), "nationalrat",
"nationalratswahlen/nationalratswahl_2024/files", "endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx",
(("bund", "nrw2024_aufstellung_der_vorzugsstimmen_der_bundesbewerber_16102024.xlsx"),
("land", "nrw2024_aufstellung_der_vorzugsstimmen_der_landes_undregionalbewerber_16102024.xlsx"))),
Election("nrw2019", "Nationalratswahl 2019", "2019 National Council election", date(2019, 9, 29), "nationalrat",
"nationalratswahlen/nationalratswahl_2019/files", "endgultiges_gesamtergebnis_nrw19_16102019.xlsx",
(("bund", "nrw19_vorzugsstimmen_bundesweit_16102019.xlsx"),)),
Election("euw2024", "Europawahl 2024", "2024 European Parliament election", date(2024, 6, 9),
"europaeisches-parlament", "europawahlen/europawahl_2024/files", "endgueltiges_ergebnis_europawahl_26062024.xlsx",
(("eu", "gesamtaufstellung_erzielte_vorzugsstimmen_eu_wahl_2024_parteien.xlsx"),)),
Election("nrw2017", "Nationalratswahl 2017", "2017 National Council election", date(2017, 10, 15), "nationalrat",
"nationalratswahlen/nationalratswahl_2017/files", "nrw17_endgueltiges_gesamtergebnis.xlsx",
(("bund", "nrw17_vorzugsstimmen_bundesweit.xlsx"),)),
Election("euw2019", "Europawahl 2019", "2019 European Parliament election", date(2019, 5, 26),
"europaeisches-parlament", "europawahlen/europawahl_2019/files/endgueltiges_ergebnis", None,
(("eu", "euw_2019_vorzugsstimmen_gesamthomepage.xlsx"),)),
)
BY_KEY = {e.key: e for e in ELECTIONS}
REGION_CODE = re.compile(r"^G\d0000$") # G00000 Österreich, G10000 Burgenland ... G90000 Wien
PARTY_HEAD = re.compile(r"\(([^()]+)\)\s*$")
LIST_HEAD = re.compile(r"^(Landes|Regional)parteilisten im (?:Landes|Regional)wahlkreis\s+(.+?)\s*$")
def de_int(n: int) -> str:
return f"{n:,}".replace(",", ".")
def de_pct(p: float) -> str:
return f"{p:.2f}".replace(".", ",")
def sheets(body: bytes) -> list[tuple[str, list[tuple]]]:
import openpyxl
wb = openpyxl.load_workbook(io.BytesIO(body), read_only=True, data_only=True)
return [(ws.title, list(ws.iter_rows(values_only=True))) for ws in wb.worksheets]
def label(*cells: Any) -> str:
return " ".join(str(c) for c in cells if c not in (None, "")).replace("\n", "").strip().lower()
def parse_results(rows: list[tuple]) -> list[dict[str, Any]]:
"""Votes per party for Austria and the nine states. The header has party names in the first row, either
with the totals in the same row (2024) or split over two rows ("Stimmen" / "gültige", 2019 and EU 2024)."""
head, sub = rows[0], rows[1] if rows[1] and rows[1][0] is None else ()
labels = [label(head[i], sub[i] if i < len(sub) else None) for i in range(len(head))]
valid_col = next(i for i, text in enumerate(labels) if text.endswith("gültige") and "ungültige" not in text)
parties = [(i, str(name).strip()) for i, name in enumerate(head)
if i > valid_col and isinstance(name, str) and name.strip() not in ("", "%")]
out = []
for row in rows:
code = row[0]
if not (isinstance(code, str) and REGION_CODE.match(code)):
continue
valid = int(row[valid_col] or 0)
for col, party in parties:
votes = int(row[col] or 0)
if not votes:
continue
# the share as published (next column), so the figures match the official result exactly
published = row[col + 1] if col + 1 < len(row) and head[col + 1] == "%" else None
percent = (round(float(published), 2) if isinstance(published, (int, float))
else round(votes * 100 / valid, 2) if valid else None)
out.append({"code": code, "region": str(row[1]).strip(), "electorate": int(row[2] or 0),
"valid": valid, "party": party, "votes": votes, "percent": percent})
return out
def split_name(text: str) -> tuple[str, str]:
"""'Brunner, Dr. Magnus' -> ('Brunner', 'Dr. Magnus'); 'Babler, MSc, Andreas' -> ('Babler', 'Andreas')."""
family, _, rest = str(text).partition(",")
parts = [p.strip() for p in rest.split(",")]
return family.strip(), next((p for p in parts if strip_titles(p)), "")
def parse_preferences(layout: str, workbook: list[tuple[str, list[tuple]]]) -> list[dict[str, Any]]:
"""Candidates with their preference votes. Returns rank, name, birth year (if published), party, list."""
out: list[dict[str, Any]] = []
for sheet, rows in workbook:
party, party_name, list_label = None, None, "Bundesliste"
total_col = None
if layout == "eu":
party, party_name, list_label = sheet.strip(), sheet.strip(), "Bundesliste"
for row in rows:
cells = [c for c in row if c is not None and c != ""]
if not cells:
continue
first = row[0]
if layout == "eu" and any(isinstance(c, str) and re.match(r"Bewerber|Kandidat", c) for c in row):
# header: "LP | Bewerber(in) | BGLD ... | Gesamt" (2024) or "_ | Kandidat(in) | ... | Gesamt" (2019).
# 2024 repeats a re-sorted copy of the table further right: its header must not win.
if total_col is None:
total_col = next((i for i, c in enumerate(row) if isinstance(c, str) and c.strip() == "Gesamt"),
None)
continue
if isinstance(first, str) and len(cells) == 1:
if (m := LIST_HEAD.match(first)):
region = re.sub(r"^\w+\s*-\s*", "", m.group(2)) # "1A - Burgenland Nord" -> "Burgenland Nord"
list_label = f"{m.group(1)}parteiliste {region}"
elif (m := PARTY_HEAD.search(first)) and layout != "eu":
party, party_name, list_label = m.group(1).strip(), first.strip(), "Bundesliste"
continue
rank = str(first).rstrip(".") if first is not None else ""
if not rank.isdigit() or party is None:
continue
if layout == "land":
family, given, year, votes = row[1], row[2], row[4], row[6]
elif layout == "eu":
family, given = split_name(row[1])
year, votes = None, row[total_col] if total_col is not None else None
else:
family, given = split_name(row[1])
year, votes = row[2], row[4]
if not family or not isinstance(votes, (int, float)):
continue
out.append({"rank": int(rank), "name": f"{given} {family}".strip(), "birth_year": int(year)
if isinstance(year, (int, float)) else None, "votes": int(votes), "party": party,
"party_name": party_name, "list": list_label})
return out
@register
class ElectionResults(Adapter):
spec = SPEC
name = "bmi.elections"
description = "Final results of federal and EU elections and candidates' preference votes (BMI)"
schedule = "0 6 1 * *" # the files are final; monthly re-checks cost a conditional request each
queue = "bulk"
def start(self, ctx: RunContext) -> Iterator[Request]:
wanted = set(ctx.params.get("elections") or BY_KEY)
for election in ELECTIONS:
if election.key not in wanted:
continue
base = f"{BMI}/{election.path}"
if election.result:
yield Request(url=f"{base}/{election.result}", kind="result", meta={"election": election.key})
for layout, file in election.preferences:
yield Request(url=f"{base}/{file}", kind="preferences", meta={"election": election.key, "layout": layout})
def parse(self, ctx: RunContext, response: Response) -> Iterator[Claim]:
election = BY_KEY[response.meta["election"]]
workbook = sheets(response.body)
if response.request.kind == "result":
yield from self.result_claims(ctx, election, response.request.url, workbook[0][1])
else:
yield from self.preference_claims(ctx, election, response.request.url,
parse_preferences(response.meta["layout"], workbook))
def result_claims(self, ctx: RunContext, election: Election, url: str, rows: list[tuple]) -> Iterator[Claim]:
for r in parse_results(rows):
pct = f"{de_pct(r['percent'])} %" if r["percent"] is not None else "?"
yield Claim(
claim_type="election_result", org=OrgRef(short_name=r["party"], kind="party", create=False),
counterpart_org=OrgRef(slug=election.body), occurred_at=election.held_on,
key=("election", election.key, r["code"], r["party"]),
summary_de=f"{r['party']}: {pct} ({de_int(r['votes'])} Stimmen) bei der {election.name_de} – {r['region']}",
summary_en=f"{r['party']}: {pct.replace(',', '.')} ({r['votes']:,} votes) in the {election.name_en} "
f"– {r['region']}",
data={"election": election.key, "party": r["party"], "region": r["region"], "region_code": r["code"],
"votes": r["votes"], "percent": r["percent"], "valid_votes": r["valid"],
"electorate": r["electorate"]},
evidence=[Evidence(url=url, doc_type="dataset_row", title=f"BMI: {election.name_de}, endgültiges Ergebnis",
published_at=election.held_on, locator=f"{r['code']}:{r['party']}",
quote=f"{r['region']} | {r['party']} | {r['votes']} | {r['valid']} gültige")],
)
def preference_claims(self, ctx: RunContext, election: Election, url: str,
candidates: list[dict[str, Any]]) -> Iterator[Claim]:
for c in candidates:
hints = {"birth_year": c["birth_year"], "no_name_match": True} if c["birth_year"] else {}
yield Claim(
claim_type="election_result", person=PersonRef(name=c["name"], hints=hints),
counterpart_org=OrgRef(short_name=c["party"], kind="party", create=False), occurred_at=election.held_on,
key=("preference-votes", election.key, c["list"], c["party"], c["rank"], c["name"]),
summary_de=f"{de_int(c['votes'])} Vorzugsstimmen bei der {election.name_de} "
f"({c['list']} {c['party']}, Platz {c['rank']})",
summary_en=f"{c['votes']:,} preference votes in the {election.name_en} "
f"({c['party']}, {c['list']}, position {c['rank']})",
data={"election": election.key, "preference_votes": c["votes"], "rank": c["rank"], "list": c["list"],
"party": c["party"]},
evidence=[Evidence(url=url, doc_type="dataset_row", title=f"BMI: {election.name_de}, Vorzugsstimmen",
published_at=election.held_on, locator=f"{c['list']}:{c['party']}:{c['rank']}",
quote=f"{c['list']} {c['party']}, Platz {c['rank']}: {c['votes']} Vorzugsstimmen")],
)
+7 -153
View File
@@ -25,8 +25,6 @@ from politrack.core.records import (
PersonRecord, PersonRecord,
PersonRef, PersonRef,
Role, Role,
VoteEvent,
VotePosition,
) )
from politrack.text import excerpt, fingerprint, normalize from politrack.text import excerpt, fingerprint, normalize
@@ -42,9 +40,7 @@ EP_SPEC = SourceSpec(
tos_notes="EP Open Data API v2 (limit 500 requests / 5 min / endpoint).", tos_notes="EP Open Data API v2 (limit 500 requests / 5 min / endpoint).",
) )
EC_EXPORT = "https://ec.europa.eu/transparency-initiative/meetings/data/meetings/dataxlsx" EC_EXPORT = "https://ec.europa.eu/transparency-initiative/meetings/data/meetings/dataxlsx"
EC_TERMS = ("meetingscommissionrepresentatives2429", "meetingscommissionrepresentatives1924", EC_TERMS = ("meetingscommissionrepresentatives2429", "meetingscommissionrepresentatives1924")
"meetingscommissionrepresentatives1419")
EP_PAST_TERMS = (9,) # Austrian MEPs of earlier terms: their votes and declarations, roles with end dates
EP_API = "https://data.europarl.europa.eu/api/v2" EP_API = "https://data.europarl.europa.eu/api/v2"
# Austrian Commissioners in the terms covered by EC_TERMS (fallback if the DB has no Commission roles yet). # Austrian Commissioners in the terms covered by EC_TERMS (fallback if the DB has no Commission roles yet).
AUSTRIAN_COMMISSIONERS = ("Johannes Hahn", "Magnus Brunner") AUSTRIAN_COMMISSIONERS = ("Johannes Hahn", "Magnus Brunner")
@@ -125,20 +121,12 @@ class EuropeanParliament(Adapter):
description = "Current Austrian MEPs (mandates) and their declarations" description = "Current Austrian MEPs (mandates) and their declarations"
schedule = "30 4 * * 2" schedule = "30 4 * * 2"
creates_persons = True creates_persons = True
parser_version = 2 # roles of former MEPs end with their last membership
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
yield Request(url=f"{EP_API}/meps/show-current", kind="meps", yield Request(url=f"{EP_API}/meps/show-current", kind="meps",
params={"country-of-representation": "AT", "format": "application/ld+json", "limit": 100}) params={"country-of-representation": "AT", "format": "application/ld+json", "limit": 100})
for term in EP_PAST_TERMS:
yield Request(url=f"{EP_API}/meps", kind="meps",
params={"parliamentary-term": term, "country-of-representation": "AT",
"format": "application/ld+json", "limit": 100})
def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]: def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]:
if not response.body.strip(): # the API answers some MEPs' declaration requests with an empty body
ctx.stats["empty_responses"] += 1
return
data = response.json().get("data") or [] data = response.json().get("data") or []
if response.request.kind == "meps": if response.request.kind == "meps":
for mep in data: for mep in data:
@@ -164,22 +152,19 @@ class EuropeanParliament(Adapter):
if mep.get("img"): if mep.get("img"):
yield PersonRecord(ref=ref, full_name=meta["name"], photo_url=mep["img"], yield PersonRecord(ref=ref, full_name=meta["name"], photo_url=mep["img"],
birth_date=date.fromisoformat(mep["bday"][:10]) if mep.get("bday") else None) birth_date=date.fromisoformat(mep["bday"][:10]) if mep.get("bday") else None)
periods = sorted(((m.get("memberDuring") or {}).get("startDate"), (m.get("memberDuring") or {}).get("endDate")) starts = [m.get("memberDuring", {}).get("startDate") for m in mep.get("hasMembership") or []
for m in mep.get("hasMembership") or [] if "EU_PARLIAMENT" in str(m.get("membershipClassification", ""))]
if "EU_PARLIAMENT" in str(m.get("membershipClassification", "")) starts = sorted(s for s in starts if s)
and (m.get("memberDuring") or {}).get("startDate"))
body = OrgRef(slug="europaeisches-parlament") body = OrgRef(slug="europaeisches-parlament")
start = date.fromisoformat(periods[-1][0][:10]) if periods else None start = date.fromisoformat(starts[-1]) if starts else None
# former MEPs: the latest membership has ended; current ones have an open end
end = date.fromisoformat(periods[-1][1][:10]) if periods and periods[-1][1] else None
url = f"https://www.europarl.europa.eu/meps/de/{meta['mep_id']}" url = f"https://www.europarl.europa.eu/meps/de/{meta['mep_id']}"
yield Claim( yield Claim(
claim_type="role", person=ref, org=body, valid_from=start, valid_to=end, claim_type="role", person=ref, org=body, valid_from=start,
summary_de=f"Mitglied des Europäischen Parlaments (Fraktion {meta.get('group') or '?'})", summary_de=f"Mitglied des Europäischen Parlaments (Fraktion {meta.get('group') or '?'})",
summary_en=f"Member of the European Parliament ({meta.get('group') or '?'})", summary_en=f"Member of the European Parliament ({meta.get('group') or '?'})",
data={"ep_group": meta.get("group")}, data={"ep_group": meta.get("group")},
evidence=[Evidence(url=url, doc_type="api_record", title=f"Europäisches Parlament: {meta['name']}")], evidence=[Evidence(url=url, doc_type="api_record", title=f"Europäisches Parlament: {meta['name']}")],
facet=Role(role="mp", level="eu", body=body, start=start, end=end), facet=Role(role="mp", level="eu", body=body, start=start),
) )
def parse_declarations(self, response: Response, docs: list[dict]) -> Iterator[Claim]: def parse_declarations(self, response: Response, docs: list[dict]) -> Iterator[Claim]:
@@ -206,134 +191,3 @@ class EuropeanParliament(Adapter):
evidence=[Evidence(url=url, doc_type="pdf", title=title, published_at=doc.get("document_date"))], evidence=[Evidence(url=url, doc_type="pdf", title=title, published_at=doc.get("document_date"))],
topics=("Transparenz und Korruption",), topics=("Transparenz und Korruption",),
) )
LD_JSON = "application/ld+json"
EP_DECISIONS_PAGE = 500
EP_REFERENCE = re.compile(r"^(?:RC-)?[A-C]\d+-\d+/\d{4}$") # A10-0272/2026, RC-B9-0253/2024, C9-0010/2024
EP_OUTCOME = {"ADOPTED": ("accepted", "angenommen", "adopted"), "REJECTED": ("rejected", "abgelehnt", "rejected")}
EP_VOTERS = (("had_voter_favor", "for", "Stimmte für", "Voted for"),
("had_voter_against", "against", "Stimmte gegen", "Voted against"),
("had_voter_abstention", "abstain", "Enthielt sich bei", "Abstained on"))
EP_INTENDED = (("had_voter_intended_favor", "for"), ("had_voter_intended_against", "against"),
("had_voter_intended_abstention", "abstain"))
def ep_label(value: Any) -> str:
"""German text of a multilingual EP field, falling back to English."""
text = (value.get("de") or value.get("en") or "") if isinstance(value, dict) else (value or "")
return re.sub(r"\s+", " ", str(text)).strip()
def ep_person_ids(values: list[str] | None) -> set[str]:
return {v.rsplit("/", 1)[-1] for v in values or []}
@register
class ParliamentVotes(Adapter):
"""Roll-call votes of the Austrian MEPs known to the database: on whole texts and on amendments or parts.
Part votes are flagged (`VoteEvent.part_vote`, `data.part_vote`), because a sitting has over a hundred of
them and they would otherwise bury the final votes. The official result counts; corrections MEPs file
afterwards are kept in `data.intended`, because they don't change the result.
"""
spec = EP_SPEC
name = "europarl.votes"
description = "Roll-call votes of Austrian MEPs in the European Parliament plenary, including amendments"
schedule = "45 5 * * *"
queue = "scrape"
parser_version = 3 # 2: amendment and part votes; 3: references of joint motions and Council documents
def start(self, ctx: RunContext) -> Iterator[Request]:
ep_ids = []
if ctx.conn is not None:
ep_ids = sorted(row["value"] for row in ctx.conn.execute(
"SELECT value FROM identifier WHERE entity_type = 'person' AND scheme = 'ep'"))
if not ep_ids:
ctx.stats["no_meps_loaded"] = 1
return
for year in range(int(ctx.params.get("since_year", 2024)), date.today().year + 1):
yield Request(url=f"{EP_API}/meetings", kind="meetings", params={"year": year, "format": LD_JSON, "limit": 200},
meta={"ep_ids": ep_ids})
def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]:
if not response.body.strip(): # sittings without recorded votes come back with an empty body
ctx.stats["empty_responses"] += 1
return
kind = response.request.kind
data = response.json().get("data") or []
meta = response.meta
if kind == "meetings":
today = response.fetched_at.date().isoformat()
for meeting in data: # the list includes future sittings, which have no results yet
if str(meeting.get("activity_date", "9999"))[:10] <= today:
yield Request(url=f"{EP_API}/meetings/{meeting['activity_id']}/vote-results", kind="results",
params={"format": LD_JSON, "limit": 500},
meta={"ep_ids": meta["ep_ids"], "meeting": meeting["activity_id"]})
elif kind == "results":
titles = {item["id"]: ep_label(item.get("activity_label")) for item in data if item.get("activity_date")}
if titles:
yield self.decisions_request(meta["meeting"], 0, meta["ep_ids"], titles)
else:
yield from self.parse_decisions(ctx, response, data)
@staticmethod
def decisions_request(meeting: str, offset: int, ep_ids: list[str], titles: dict[str, str]) -> Request:
return Request(url=f"{EP_API}/meetings/{meeting}/decisions", kind="decisions",
params={"format": LD_JSON, "limit": EP_DECISIONS_PAGE, "offset": offset},
meta={"ep_ids": ep_ids, "meeting": meeting, "offset": offset, "titles": titles})
def parse_decisions(self, ctx: RunContext, response: Response, data: list[dict]) -> Iterator[Any]:
meta = response.meta
austrian = set(meta["ep_ids"])
chamber = OrgRef(slug="europaeisches-parlament")
for decision in data:
if "ROLLCALL" not in str(decision.get("decision_method")):
ctx.stats["not_rollcall"] += 1
continue
part_vote = "decisionAboutId" in decision
voters = {position: ep_person_ids(decision.get(field)) & austrian for field, position, _, _ in EP_VOTERS}
if not any(voters.values()):
ctx.stats["no_austrian_voters"] += 1
continue
voted_on = date.fromisoformat(decision["activity_date"][:10])
label = ep_label(decision.get("activity_label"))
items = decision.get("inverse_consists_of") or [None]
title = meta["titles"].get(items[0]) or label
stage = ep_label(decision.get("referenceText"))
label_parts = label.split(" – ", 2) # "A10-0272/2026 – rapporteur – § 13, nach Buchstabe a – Änd. 9"
if part_vote and len(label_parts) == 3:
stage = label_parts[2]
status = str(decision.get("decision_outcome", "")).rsplit("/", 1)[-1]
result, outcome_de, outcome_en = EP_OUTCOME.get(status, ("unknown", "Ergebnis unbekannt", "outcome unknown"))
counts = {"yes": decision.get("number_of_votes_favor"), "no": decision.get("number_of_votes_against"),
"abstained": decision.get("number_of_votes_abstention")}
tally = f"{counts['yes']} Ja, {counts['no']} Nein, {counts['abstained']} Enthaltungen"
url = f"https://data.europarl.europa.eu/{decision['id']}"
record = next(iter(decision.get("recorded_in_a_realization_of") or []), "")
pv = re.search(r"PV-(\d+)-(\d{4}-\d{2}-\d{2})-RCV", record)
protocol = (f"https://www.europarl.europa.eu/doceo/document/PV-{pv.group(1)}-{pv.group(2)}-RCV_DE.html"
if pv else None)
event_key = fingerprint("ep-vote", decision["id"])
yield VoteEvent(key=event_key, chamber=chamber, title=title, voted_on=voted_on, result=result, stage=stage,
item_ref=label_parts[0] if EP_REFERENCE.match(label_parts[0]) else None, roll_call=True,
url=url, protocol_url=protocol, raw_text=f"{stage}: {tally}", part_vote=part_vote)
subject = f"{title}, {stage}" if part_vote and title != label else title # a label already names the part
intended = {mep: position for field, position in EP_INTENDED for mep in ep_person_ids(decision.get(field))}
for _, position, verb_de, verb_en in EP_VOTERS:
for mep in sorted(voters[position]):
yield Claim(
claim_type="vote", person=PersonRef(ids={"ep": mep}), counterpart_org=chamber, occurred_at=voted_on,
summary_de=f"{verb_de}: {subject} (Europäisches Parlament) – {outcome_de}",
summary_en=f"{verb_en}: {subject} (European Parliament) – {outcome_en}",
data={"position": position, "result": result, "roll_call": True, "chamber": "EP", **counts,
**({"intended": intended[mep]} if mep in intended else {}),
**({"part_vote": True} if part_vote else {})},
evidence=[Evidence(url=url, doc_type="api_record", title=title, published_at=voted_on,
quote=f"{stage}: {tally}", locator=f"vote:{decision['id']}")],
topics=("Europäische Union",),
facet=VotePosition(event_key=event_key, position=position),
)
if len(data) == EP_DECISIONS_PAGE:
yield self.decisions_request(meta["meeting"], meta["offset"] + EP_DECISIONS_PAGE, meta["ep_ids"], meta["titles"])
+3 -8
View File
@@ -48,11 +48,7 @@ class ParlamentPress(Adapter):
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
last = ctx.state.get("last_date") last = ctx.state.get("last_date")
backfill = int(ctx.params.get("backfill_days", 365)) backfill = int(ctx.params.get("backfill_days", 365))
# an explicit backfill_days (history backfill) wins over the cursor of the regular runs since = (date.fromisoformat(last) - timedelta(days=2)) if last else date.today() - timedelta(days=backfill)
if last and "backfill_days" not in ctx.params:
since = date.fromisoformat(last) - timedelta(days=2)
else:
since = date.today() - timedelta(days=backfill)
yield list_request(110, {"DATERANGE": [since.isoformat(), date.today().isoformat()]}, kind="list", yield list_request(110, {"DATERANGE": [since.isoformat(), date.today().isoformat()]}, kind="list",
meta={"since": since.isoformat()}) meta={"since": since.isoformat()})
@@ -103,7 +99,6 @@ class ParlamentCalendar(Adapter):
name = "parlament.calendar" name = "parlament.calendar"
description = "Parliament calendar: plenary sessions, committees, hearings, events (tours skipped)" description = "Parliament calendar: plenary sessions, committees, hearings, events (tours skipped)"
schedule = "30 2 * * *" schedule = "30 2 * * *"
parser_version = 2 # 2: titles are HTML-decoded ("84.&nbsp;Sitzung")
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
yield list_request(600, {}, kind="list") yield list_request(600, {}, kind="list")
@@ -111,12 +106,12 @@ class ParlamentCalendar(Adapter):
def parse(self, ctx: RunContext, response: Response) -> Iterator[Event]: def parse(self, ctx: RunContext, response: Response) -> Iterator[Event]:
since = str(ctx.params.get("since_year", date.today().year - 2)) since = str(ctx.params.get("since_year", date.today().year - 2))
for row in list_rows(response.json()): for row in list_rows(response.json()):
kind_label = html_to_text(row.get("Terminart")) kind_label = (row.get("Terminart") or "").replace("<BR>", " ")
starts = next((v for k, v in row.items() if k.startswith("Datum") and k != "Datum Bis" starts = next((v for k, v in row.items() if k.startswith("Datum") and k != "Datum Bis"
and isinstance(v, str) and ISO_DATE.match(v)), None) and isinstance(v, str) and ISO_DATE.match(v)), None)
if not starts or starts[:4] < since or SKIP_TERMIN.search(f"{kind_label} {row.get('Bezeichnung') or ''}"): if not starts or starts[:4] < since or SKIP_TERMIN.search(f"{kind_label} {row.get('Bezeichnung') or ''}"):
continue continue
title = html_to_text(row.get("Bezeichnung")) or kind_label title = row.get("Bezeichnung") or kind_label
kind = next((k for pattern, k in TERMIN_KIND if pattern.search(f"{kind_label} {title}")), "public_event") kind = next((k for pattern, k in TERMIN_KIND if pattern.search(f"{kind_label} {title}")), "public_event")
chamber = {"Nationalrat": "NR", "Bundesrat": "BR"}.get(row.get("Gremium") or "") chamber = {"Nationalrat": "NR", "Bundesrat": "BR"}.get(row.get("Gremium") or "")
ends = next((v for k, v in row.items() if k.startswith("Datum Bis") and isinstance(v, str) ends = next((v for k, v in row.items() if k.startswith("Datum Bis") and isinstance(v, str)
+1 -33
View File
@@ -41,7 +41,6 @@ LEGAL_FORM_END = re.compile(r"(?i:gesmbh|gmbh|ges\.\s?m\.\s?b\.\s?h\.?|m\.\s?b\.
r"e\.\s?u\.|\bse|privatstiftung|genossenschaft|sparkasse)(?=[A-ZÄÖÜ\s,]|$)") r"e\.\s?u\.|\bse|privatstiftung|genossenschaft|sparkasse)(?=[A-ZÄÖÜ\s,]|$)")
COMMITTEE_END = re.compile(r"\(\d{2}\.\d{2}\.\d{4}\s*-\s*(\d{2}\.\d{2}\.\d{4})\s*\)\s*$")
STREET_WORD = r"\S*(?:straße|strasse|str\.|gasse|platz|weg|kai|ring|allee|zeile|lände|markt|steig)" STREET_WORD = r"\S*(?:straße|strasse|str\.|gasse|platz|weg|kai|ring|allee|zeile|lände|markt|steig)"
@@ -80,7 +79,7 @@ class ParlamentPersons(Adapter):
description = "Members of Nationalrat and Bundesrat since 1918, mandates, functions, side jobs, speeches" description = "Members of Nationalrat and Bundesrat since 1918, mandates, functions, side jobs, speeches"
schedule = "15 3 * * *" schedule = "15 3 * * *"
creates_persons = True creates_persons = True
parser_version = 4 parser_version = 3
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
yield list_request(409, {"NRBR": ["NR", "BR"]}, kind="persons") yield list_request(409, {"NRBR": ["NR", "BR"]}, kind="persons")
@@ -93,8 +92,6 @@ class ParlamentPersons(Adapter):
yield from self.parse_person(ctx, response) yield from self.parse_person(ctx, response)
elif kind == "speeches": elif kind == "speeches":
yield from self.parse_speeches(ctx, response) yield from self.parse_speeches(ctx, response)
elif kind == "committees":
yield from self.parse_committees(ctx, response)
# -- persons & mandates ------------------------------------------------------------- # -- persons & mandates -------------------------------------------------------------
@@ -183,35 +180,6 @@ class ParlamentPersons(Adapter):
yield from self.side_jobs(ref, pad, name, content.get("unvtrans") or {}) yield from self.side_jobs(ref, pad, name, content.get("unvtrans") or {})
yield list_request(251, {"PAD_INTERN": [int(pad)]}, kind="speeches", meta={"pad": pad, "name": name}) yield list_request(251, {"PAD_INTERN": [int(pad)]}, kind="speeches", meta={"pad": pad, "name": name})
yield list_request(250, {"PAD_INTERN": [int(pad)]}, kind="committees", meta={"pad": pad, "name": name})
def parse_committees(self, ctx: RunContext, response: Response) -> Iterator[Claim]:
"""Committee memberships (list 250). Affiliations, not roles: a member has dozens of them per period,
and they say nothing about whether the person currently holds a mandate."""
periods = set(ctx.params.get("periods") or get_settings().parlament_periods)
pad, name = response.meta["pad"], response.meta["name"]
for row in list_rows(response.json()):
if row.get("GP") not in periods:
continue
labelled = row.get("Ausschuss") or ""
committee = re.sub(r"\s*\([^()]*\)\s*$", "", labelled).strip()
if not committee:
ctx.stats["committee_without_name"] += 1
continue
function = row.get("Funktion") or "Mitglied"
start = parse_date(row.get("Beginn"))
end = COMMITTEE_END.search(labelled)
chamber = "Bundesrat" if row.get("nrbr") == "BR" else "Nationalrat"
yield Claim(
claim_type="affiliation", person=PersonRef(ids={"parlament": pad}),
key=("parl-committee", pad, row.get("GP"), committee, function, start),
valid_from=start, valid_to=parse_date(end.group(1)) if end else None,
summary_de=f"{name}: {function}, {committee} ({chamber}, {row.get('GP')}. GP)",
summary_en=f"{name}: {function}, {committee} ({chamber}, {row.get('GP')} legislative period)",
data={"committee": committee, "function": function, "gp": row.get("GP"), "chamber": row.get("nrbr")},
evidence=[Evidence(url=f"{BASE}/person/{pad}", doc_type="api_record", title=f"Parlament: {name}",
locator=f"ausschuss:{row.get('GP')}:{committee}:{function}:{start}")],
)
def side_jobs(self, ref: PersonRef, pad: str, name: str, unv: dict) -> Iterator[Claim]: def side_jobs(self, ref: PersonRef, pad: str, name: str, unv: dict) -> Iterator[Claim]:
"""Disclosures under §6 Unv-Transparenz-G: leading positions, paid side jobs, honorary positions.""" """Disclosures under §6 Unv-Transparenz-G: leading positions, paid side jobs, honorary positions."""
+5 -36
View File
@@ -14,7 +14,6 @@ fetch items whose lastmod changed. Runs on the `bulk` queue.
from __future__ import annotations from __future__ import annotations
import re
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from collections.abc import Iterator from collections.abc import Iterator
from datetime import date from datetime import date
@@ -140,28 +139,8 @@ def parse_award_notice(xml: bytes) -> dict[str, Any] | None:
} }
PLACEHOLDER_NAME = re.compile(r"^[\W_]*$|^(?:n/?a|k\.?\s?a\.?|unbekannt|keine angabe|tbd|xxx+)$", re.IGNORECASE)
FRAMEWORK_BUYER = re.compile(r"^Auftraggeber (?:sind|ist)\b", re.IGNORECASE)
def plausible_date(value: str | None, latest: date) -> date | None:
"""An award date, or None if it can't be one: spreadsheet placeholders (1899-12-30, 1900-01-01) and dates after
the notice was fetched (some publishers put the contract's end date in the conclusion field)."""
d = as_date(value)
return d if d and date(1995, 1, 1) <= d <= latest else None
def buyer_name(name: str) -> tuple[str, str | None]:
"""Framework agreements name every eligible buyer in one sentence ("Auftraggeber sind die Republik Österreich
(Bund), die Bundesbeschaffung GmbH sowie alle weiteren ..."). They are concluded by the federal procurement
agency, so it is the buyer; the sentence is kept as the original wording."""
if FRAMEWORK_BUYER.match(name) and "Bundesbeschaffung" in name:
return "Bundesbeschaffung GmbH", name
return name, None
def org_ref(org: dict[str, Any], kind: str) -> OrgRef | None: def org_ref(org: dict[str, Any], kind: str) -> OrgRef | None:
if not org.get("name") or PLACEHOLDER_NAME.match(org["name"].strip()): if not org.get("name"):
return None return None
company_id = (org.get("company_id") or "").replace(" ", "") company_id = (org.get("company_id") or "").replace(" ", "")
ids = {} ids = {}
@@ -188,7 +167,7 @@ class PublicContracts(Adapter):
description = "Contract awards of Austrian public bodies (eForms and BVergG core data via data.gv.at)" description = "Contract awards of Austrian public bodies (eForms and BVergG core data via data.gv.at)"
schedule = "0 2 * * *" schedule = "0 2 * * *"
queue = "bulk" queue = "bulk"
parser_version = 3 # 3: implausible award dates, placeholder contractors, framework-agreement buyers parser_version = 2
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
for query in CATALOG_QUERIES: for query in CATALOG_QUERIES:
@@ -251,32 +230,22 @@ class PublicContracts(Adapter):
if notice is None: if notice is None:
ctx.stats["not_an_award"] += 1 ctx.stats["not_an_award"] += 1
return return
named = next((b for b in notice["buyers"] if b.get("name")), None) buyer = next((org_ref(b, "public_body") for b in notice["buyers"] if b.get("name")), None)
buyer_text = None
if named is not None:
name, buyer_text = buyer_name(named["name"])
named = {**named, "name": name}
buyer = org_ref(named, "public_body") if named else None
if buyer is None: if buyer is None:
return return
latest = response.fetched_at.date()
for contract in notice["contracts"]: for contract in notice["contracts"]:
for winner in contract["winners"]: for winner in contract["winners"]:
supplier = org_ref(winner, "company") supplier = org_ref(winner, "company")
if supplier is None: if supplier is None:
ctx.stats["contractor_unnamed"] += 1
continue continue
amount = contract["amount"] or (notice["total"] if len(notice["contracts"]) == 1 else None) amount = contract["amount"] or (notice["total"] if len(notice["contracts"]) == 1 else None)
awarded = plausible_date(contract["awarded"], latest) or plausible_date(notice["issued"], latest) awarded = as_date(contract["awarded"]) or as_date(notice["issued"])
if contract["awarded"] and awarded is None:
ctx.stats["implausible_award_date"] += 1
title = contract["title"] or notice["title"] or "Auftrag" title = contract["title"] or notice["title"] or "Auftrag"
yield Claim( yield Claim(
claim_type="money_flow", org=buyer, counterpart_org=supplier, occurred_at=awarded, claim_type="money_flow", org=buyer, counterpart_org=supplier, occurred_at=awarded,
summary_de=f"Auftrag „{title}“ an {supplier.name}" + (f" – {format_eur_de(amount)} €" if amount else ""), summary_de=f"Auftrag „{title}“ an {supplier.name}" + (f" – {format_eur_de(amount)} €" if amount else ""),
summary_en=f"Contract \"{title}\" awarded to {supplier.name}" + (f" – EUR {amount}" if amount else ""), summary_en=f"Contract \"{title}\" awarded to {supplier.name}" + (f" – EUR {amount}" if amount else ""),
data={"notice_id": notice["notice_id"], "cpv": notice["cpv"], "publisher": response.meta.get("publisher"), data={"notice_id": notice["notice_id"], "cpv": notice["cpv"], "publisher": response.meta.get("publisher")},
**({"buyer_text": buyer_text} if buyer_text else {})},
evidence=[Evidence(url=response.request.url, doc_type="register_entry", title=f"Vergabe: {title}", evidence=[Evidence(url=response.request.url, doc_type="register_entry", title=f"Vergabe: {title}",
published_at=awarded, quote=f"{buyer.name} → {supplier.name}: {title}")], published_at=awarded, quote=f"{buyer.name} → {supplier.name}: {title}")],
facet=Money(kind="contract", amount=amount, payer=buyer, payer_name=buyer.name, payee=supplier, facet=Money(kind="contract", amount=amount, payer=buyer, payer_name=buyer.name, payee=supplier,
+9 -80
View File
@@ -18,7 +18,7 @@ from typing import Any
from politrack.config import get_settings from politrack.config import get_settings
from politrack.core import Adapter, Request, Response, RunContext, SourceSpec, register from politrack.core import Adapter, Request, Response, RunContext, SourceSpec, register
from politrack.core.records import ArchiveCopy, Claim, Evidence, OrgRef, PersonRef, PostRemoved, Statement from politrack.core.records import Claim, Evidence, OrgRef, PersonRef, Statement
from politrack.text import excerpt, html_to_text from politrack.text import excerpt, html_to_text
@@ -43,8 +43,8 @@ X = SourceSpec(slug="x", name="X (Twitter)", kind="social", homepage="https://x.
store_fulltext=False, keep_raw=False, min_interval=2.0, robots_exempt=(X_API,), store_fulltext=False, keep_raw=False, min_interval=2.0, robots_exempt=(X_API,),
tos_notes="Official X API v2 only (paid tier, POLITRACK_X_BEARER_TOKEN). Scraping x.com or using " tos_notes="Official X API v2 only (paid tier, POLITRACK_X_BEARER_TOKEN). Scraping x.com or using "
"mirrors/proxies (Nitter etc.) violates the ToS and is not done. The Developer Agreement requires " "mirrors/proxies (Nitter etc.) violates the ToS and is not done. The Developer Agreement requires "
"removing posts that were deleted on X: no raw archive or full text is kept, and " "removing posts that were deleted on X; no raw archive or full text is kept, but the "
"social.x_deletions removes the stored excerpt of such posts, keeping only a marked record.") "deletion sync is still open (docs/roadmap.md).")
PLATFORM_LABELS = {"bluesky": "Bluesky", "mastodon": "Mastodon", "telegram": "Telegram", "youtube": "YouTube", PLATFORM_LABELS = {"bluesky": "Bluesky", "mastodon": "Mastodon", "telegram": "Telegram", "youtube": "YouTube",
"x": "X"} "x": "X"}
@@ -99,22 +99,16 @@ class BlueskyPosts(Adapter):
queue = "social" queue = "social"
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
pages = int(ctx.params.get("backfill_pages", 0)) # older pages per account (history backfill)
for acc in accounts(ctx, "bluesky", r"bsky\.app/profile/"): for acc in accounts(ctx, "bluesky", r"bsky\.app/profile/"):
m = re.search(r"bsky\.app/profile/([^/?#]+)", acc["url"]) m = re.search(r"bsky\.app/profile/([^/?#]+)", acc["url"])
if m: if m:
yield Request(url="https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed", yield Request(url="https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed",
params={"actor": m.group(1), "limit": 50, "filter": "posts_no_replies"}, kind="feed", params={"actor": m.group(1), "limit": 50, "filter": "posts_no_replies"}, kind="feed",
meta={**acc["owner"], "handle": m.group(1), **({"pages_left": pages} if pages else {})}) meta={**acc["owner"], "handle": m.group(1)})
def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]: def parse(self, ctx: RunContext, response: Response) -> Iterator[Claim]:
handle = response.meta["handle"] handle = response.meta["handle"]
data = response.json() for item in response.json().get("feed", []):
if response.meta.get("pages_left") and data.get("cursor") and data.get("feed"):
yield Request(url=response.request.url, kind="feed",
params={**(response.request.params or {}), "cursor": data["cursor"]},
meta={**response.meta, "pages_left": response.meta["pages_left"] - 1})
for item in data.get("feed", []):
post = item.get("post") or {} post = item.get("post") or {}
if item.get("reason"): # repost of someone else's post if item.get("reason"): # repost of someone else's post
continue continue
@@ -137,13 +131,12 @@ class MastodonPosts(Adapter):
queue = "social" queue = "social"
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
pages = int(ctx.params.get("backfill_pages", 0)) # older pages per account (history backfill)
for acc in accounts(ctx, "mastodon"): # instances have arbitrary hosts: platform only for acc in accounts(ctx, "mastodon"): # instances have arbitrary hosts: platform only
m = re.match(r"^https?://([^/]+)/@([^/@]+)", acc["url"]) m = re.match(r"^https?://([^/]+)/@([^/@]+)", acc["url"])
if m: if m:
host, user = m.groups() host, user = m.groups()
yield Request(url=f"https://{host}/api/v1/accounts/lookup", params={"acct": user}, kind="lookup", yield Request(url=f"https://{host}/api/v1/accounts/lookup", params={"acct": user}, kind="lookup",
meta={**acc["owner"], "host": host, **({"pages_left": pages} if pages else {})}) meta={**acc["owner"], "host": host})
def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]: def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]:
meta = response.meta meta = response.meta
@@ -154,12 +147,7 @@ class MastodonPosts(Adapter):
params={"limit": 40, "exclude_replies": "true", "exclude_reblogs": "true"}, params={"limit": 40, "exclude_replies": "true", "exclude_reblogs": "true"},
kind="statuses", meta=meta) kind="statuses", meta=meta)
return return
statuses = response.json() for status in response.json():
if meta.get("pages_left") and statuses:
yield Request(url=response.request.url, kind="statuses",
params={**(response.request.params or {}), "max_id": statuses[-1]["id"]},
meta={**meta, "pages_left": meta["pages_left"] - 1})
for status in statuses:
if status.get("visibility") not in (None, "public"): if status.get("visibility") not in (None, "public"):
continue continue
yield post_claim(owner=meta, platform="mastodon", url=status.get("url") or status.get("uri"), yield post_claim(owner=meta, platform="mastodon", url=status.get("url") or status.get("uri"),
@@ -256,7 +244,6 @@ class XPosts(Adapter):
description = "Posts of politicians on X via the official API v2 (requires POLITRACK_X_BEARER_TOKEN)" description = "Posts of politicians on X via the official API v2 (requires POLITRACK_X_BEARER_TOKEN)"
schedule = "47 */6 * * *" schedule = "47 */6 * * *"
queue = "social" queue = "social"
parser_version = 2 # data.removed_from_platform: a post seen in the timeline again is no longer removed
def start(self, ctx: RunContext) -> Iterator[Request]: def start(self, ctx: RunContext) -> Iterator[Request]:
token = get_settings().x_bearer_token token = get_settings().x_bearer_token
@@ -289,62 +276,4 @@ class XPosts(Adapter):
yield post_claim(owner=meta, platform="x", yield post_claim(owner=meta, platform="x",
url=f"https://x.com/{meta['username']}/status/{tweet['id']}", text=tweet.get("text", ""), url=f"https://x.com/{meta['username']}/status/{tweet['id']}", text=tweet.get("text", ""),
created=tweet.get("created_at"), created=tweet.get("created_at"),
data={"likes": metrics.get("like_count"), "reposts": metrics.get("retweet_count"), data={"likes": metrics.get("like_count"), "reposts": metrics.get("retweet_count")})
"removed_from_platform": False})
X_LOOKUP_BATCH = 100 # maximum ids per request on GET /2/tweets
WAYBACK_API = "https://archive.org/wayback/available"
@register
class XDeletionSync(Adapter):
"""Finds stored X posts that no longer exist there, so their text can be removed (Developer Agreement).
Only "resource-not-found" counts: posts that are merely protected or whose author is suspended come back
with other error types and stay untouched. Runs four times a day because deletions must be honoured promptly.
"""
spec = X
name = "social.x_deletions"
description = "Marks stored X posts that are gone from X and removes their text (requires POLITRACK_X_BEARER_TOKEN)"
schedule = "17 */6 * * *"
queue = "social"
def start(self, ctx: RunContext) -> Iterator[Request]:
if not get_settings().x_bearer_token:
ctx.stats["skipped_no_api_key"] = 1
return
if ctx.conn is None:
return
rows = ctx.conn.execute(
"""SELECT st.url FROM statement st JOIN claim c ON c.id = st.claim_id
WHERE st.platform = 'x' AND st.context = 'social_post'
AND NOT COALESCE((c.data->>'removed_from_platform')::boolean, FALSE)
ORDER BY st.said_at DESC NULLS LAST"""
).fetchall()
urls = {m.group(1): row["url"] for row in rows if (m := re.search(r"/status/(\d+)", row["url"]))}
ids = list(urls)
for i in range(0, len(ids), X_LOOKUP_BATCH):
batch = ids[i:i + X_LOOKUP_BATCH]
yield Request(url=f"{X_API}tweets", kind="lookup", headers=XPosts.auth(), params={"ids": ",".join(batch)},
meta={"urls": {post_id: urls[post_id] for post_id in batch}},
conditional=False, skip_unchanged=False)
def parse(self, ctx: RunContext, response: Response) -> Iterator[Any]:
if response.request.kind == "wayback":
closest = (response.json().get("archived_snapshots") or {}).get("closest") or {}
if closest.get("available") and str(closest.get("status")) == "200" and closest.get("url"):
yield ArchiveCopy(url=response.meta["url"],
archive_url=closest["url"].replace("http://", "https://", 1))
return
urls = response.meta["urls"]
for error in response.json().get("errors") or []:
if error.get("resource_type") != "tweet" or not str(error.get("type", "")).endswith("/resource-not-found"):
continue
url = urls.get(str(error.get("resource_id")))
if url:
yield PostRemoved(url=url, platform="x", platform_label=PLATFORM_LABELS["x"],
detected_at=response.fetched_at)
yield Request(url=WAYBACK_API, kind="wayback", params={"url": url}, meta={"url": url},
conditional=False, skip_unchanged=False)
+1 -97
View File
@@ -9,62 +9,21 @@ One periodic task is generated per registered adapter/enricher from its `schedul
Periodic tasks are deferred by every running worker and de-duplicated by Procrastinate; queueing locks Periodic tasks are deferred by every running worker and de-duplicated by Procrastinate; queueing locks
prevent two runs of the same adapter at once. Workers can run on other machines that reach the DB. prevent two runs of the same adapter at once. Workers can run on other machines that reach the DB.
Procrastinate only remembers in memory when it last deferred a task, and skips a slot that is more than
ten minutes overdue. In November 2026 every daily and weekly source silently missed two days that way,
and jobs of killed workers stayed "doing" forever. The watchdog below makes both self-healing.
""" """
from __future__ import annotations from __future__ import annotations
import asyncio
import logging import logging
import os
import socket
from datetime import datetime, timedelta, timezone
from logging.handlers import RotatingFileHandler
from pathlib import Path
from croniter import croniter
from procrastinate import App, PsycopgConnector from procrastinate import App, PsycopgConnector
from procrastinate.exceptions import AlreadyEnqueued
from procrastinate.jobs import Status
from politrack.config import get_settings from politrack.config import get_settings
from politrack.core import registry from politrack.core import registry
from politrack.core.runner import run from politrack.core.runner import run
from politrack.db import connection
LOG_FORMAT = "%(asctime)s %(levelname)s %(name)s: %(message)s" logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s")
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
log = logging.getLogger("politrack.watchdog")
def _log_to_file() -> None:
"""Container logs vanish when a container is recreated (every deploy); keep a rotating copy in
$POLITRACK_LOG_DIR/<hostname>.log so failures can still be traced afterwards."""
log_dir = os.environ.get("POLITRACK_LOG_DIR")
if not log_dir:
return
try:
handler = RotatingFileHandler(Path(log_dir) / f"{socket.gethostname()}.log", maxBytes=20_000_000,
backupCount=5, encoding="utf-8")
except OSError as exc: # e.g. the host folder belongs to root: logs stay on stdout only
log.warning("cannot write logs to %s: %s", log_dir, exc)
return
handler.setFormatter(logging.Formatter(LOG_FORMAT))
logging.getLogger().addHandler(handler)
_log_to_file()
app = App(connector=PsycopgConnector(conninfo=get_settings().database_url)) app = App(connector=PsycopgConnector(conninfo=get_settings().database_url))
TASKS: dict = {}
SCHEDULES: dict[str, str] = {}
STALLED_AFTER = 300 # seconds without a worker heartbeat
OVERDUE_GRACE = timedelta(minutes=15) # normal deferral happens within a minute of the slot
ABANDONED_RUN = timedelta(hours=6) # CLI runs have no job; don't close them while they may still run
def _make_task(name: str, queue: str, schedule: str | None) -> None: def _make_task(name: str, queue: str, schedule: str | None) -> None:
@@ -73,65 +32,10 @@ def _make_task(name: str, queue: str, schedule: str | None) -> None:
job.__name__ = f"run_{name.replace('.', '_')}" job.__name__ = f"run_{name.replace('.', '_')}"
task = app.task(name=f"politrack.run.{name}", queue=queue, queueing_lock=name, pass_context=False)(job) task = app.task(name=f"politrack.run.{name}", queue=queue, queueing_lock=name, pass_context=False)(job)
TASKS[name] = task
if schedule: if schedule:
SCHEDULES[name] = schedule
app.periodic(cron=schedule, periodic_id=name)(task) app.periodic(cron=schedule, periodic_id=name)(task)
registry.load_builtin() registry.load_builtin()
for _name, _cls in {**registry.ADAPTERS, **registry.ENRICHERS}.items(): for _name, _cls in {**registry.ADAPTERS, **registry.ENRICHERS}.items():
_make_task(_name, _cls.queue, _cls.schedule) _make_task(_name, _cls.queue, _cls.schedule)
def overdue_tasks(now: datetime) -> list[str]:
"""Scheduled tasks whose latest slot passed without a run, a waiting job or a running job."""
due: list[str] = []
with connection() as conn:
for name, schedule in SCHEDULES.items():
slot = croniter(schedule, now).get_prev(datetime)
if now - slot < OVERDUE_GRACE:
continue
seen = conn.execute(
"""SELECT EXISTS (SELECT 1 FROM run WHERE adapter = %(name)s AND started_at >= %(slot)s)
OR EXISTS (SELECT 1 FROM procrastinate_jobs WHERE task_name = %(task)s
AND status IN ('todo', 'doing')) AS seen""",
{"name": name, "slot": slot, "task": f"politrack.run.{name}"},
).fetchone()["seen"]
if not seen:
due.append(name)
return due
def close_abandoned_runs() -> int:
"""Runs still marked running although no job for them is in progress (the worker was stopped)."""
with connection() as conn:
closed = conn.execute(
"""UPDATE run r SET status = 'error', finished_at = now(),
error = 'abandoned: the worker stopped before the run finished (closed by the watchdog)'
WHERE r.status = 'running' AND r.started_at < now() - %s
AND NOT EXISTS (SELECT 1 FROM procrastinate_jobs j
WHERE j.status = 'doing' AND j.task_name = 'politrack.run.' || r.adapter)""",
(ABANDONED_RUN,),
).rowcount
conn.commit()
return closed
@app.periodic(cron="*/10 * * * *", periodic_id="watchdog")
@app.task(name="politrack.watchdog", queue="social", queueing_lock="watchdog", pass_context=False)
async def watchdog(timestamp: int | None = None) -> dict:
stats = {"stalled_failed": 0, "overdue_deferred": 0}
for job in await app.job_manager.get_stalled_jobs(seconds_since_heartbeat=STALLED_AFTER):
await app.job_manager.finish_job(job, status=Status.FAILED, delete_job=False)
stats["stalled_failed"] += 1
log.warning("failed stalled job %s (%s): its worker is gone", job.id, job.task_name)
stats["abandoned_runs_closed"] = await asyncio.to_thread(close_abandoned_runs)
for name in await asyncio.to_thread(overdue_tasks, datetime.now(timezone.utc)):
try:
await TASKS[name].defer_async()
stats["overdue_deferred"] += 1
log.warning("deferred %s: its last scheduled slot passed without a run", name)
except AlreadyEnqueued:
pass
return stats
+1 -2
View File
@@ -17,10 +17,9 @@ dependencies = [
"python-slugify>=8.0", "python-slugify>=8.0",
"rapidfuzz>=3.9", "rapidfuzz>=3.9",
"procrastinate>=2.14,<4", "procrastinate>=2.14,<4",
"croniter>=2.0",
"typer>=0.12", "typer>=0.12",
"pyyaml>=6.0", "pyyaml>=6.0",
"mcp>=1.9,<2", "mcp>=1.9",
] ]
# Third-party adapters register themselves here, e.g. in another package's pyproject: # Third-party adapters register themselves here, e.g. in another package's pyproject:
-24
View File
@@ -1,24 +0,0 @@
# The Python dependencies from Debian packages, for networks where PyPI is unreachable. Lacks
# procrastinate and mcp (not packaged in Debian), so it runs the test suite and adapters, not the
# workers or the MCP server; ruff isn't packaged either.
#
# Two images share this package list; keep it in step with backend/pyproject.toml:
# - the test image, the default target: docs/contributing/testing.md ("Without PyPI access");
# - the agent sandbox image, target `sandbox` with BASE set to the agent-envs agent image, which
# agent-envs builds from this checkout: docs/contributing/agents.md.
ARG BASE=debian:trixie-slim
FROM ${BASE} AS deps
# eatmydata skips dpkg's disk syncs, which crawl on some Docker Desktop disks.
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends eatmydata >/dev/null \
&& eatmydata apt-get install -y -qq --no-install-recommends \
python3 python3-psycopg python3-psycopg-pool python3-pydantic-settings python3-fastapi python3-httpx \
python3-protego python3-feedparser python3-bs4 python3-slugify python3-rapidfuzz python3-typer \
python3-yaml python3-uvicorn python3-pytest python3-openpyxl python3-croniter ca-certificates >/dev/null \
&& rm -rf /var/lib/apt/lists/*
# Keeps the agent image's user, entrypoint and /workspace as they are.
FROM deps AS sandbox
FROM deps AS test
WORKDIR /app
ENV PYTHONPATH=/app PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
@@ -1,262 +0,0 @@
[
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Bundesliste",
"party": "ÖVP",
"preference_votes": 60402,
"rank": 1
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:ÖVP:1",
"meta": {},
"published_at": "2024-09-29",
"quote": "Bundesliste ÖVP, Platz 1: 60402 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_bundesbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Bundesliste",
"ÖVP",
1,
"Karl Nehammer"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1972,
"no_name_match": true
},
"ids": {},
"name": "Karl Nehammer"
},
"review": false,
"sensitive": false,
"summary_de": "60.402 Vorzugsstimmen bei der Nationalratswahl 2024 (Bundesliste ÖVP, Platz 1)",
"summary_en": "60,402 preference votes in the 2024 National Council election (ÖVP, Bundesliste, position 1)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Bundesliste",
"party": "ÖVP",
"preference_votes": 7820,
"rank": 2
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:ÖVP:2",
"meta": {},
"published_at": "2024-09-29",
"quote": "Bundesliste ÖVP, Platz 2: 7820 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_bundesbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Bundesliste",
"ÖVP",
2,
"Claudia Plakolm"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1994,
"no_name_match": true
},
"ids": {},
"name": "Claudia Plakolm"
},
"review": false,
"sensitive": false,
"summary_de": "7.820 Vorzugsstimmen bei der Nationalratswahl 2024 (Bundesliste ÖVP, Platz 2)",
"summary_en": "7,820 preference votes in the 2024 National Council election (ÖVP, Bundesliste, position 2)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Bundesliste",
"party": "ÖVP",
"preference_votes": 2069,
"rank": 3
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:ÖVP:3",
"meta": {},
"published_at": "2024-09-29",
"quote": "Bundesliste ÖVP, Platz 3: 2069 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_bundesbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Bundesliste",
"ÖVP",
3,
"Dr. Magnus Brunner"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1972,
"no_name_match": true
},
"ids": {},
"name": "Dr. Magnus Brunner"
},
"review": false,
"sensitive": false,
"summary_de": "2.069 Vorzugsstimmen bei der Nationalratswahl 2024 (Bundesliste ÖVP, Platz 3)",
"summary_en": "2,069 preference votes in the 2024 National Council election (ÖVP, Bundesliste, position 3)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Bundesliste",
"party": "SPÖ",
"preference_votes": 46440,
"rank": 1
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:SPÖ:1",
"meta": {},
"published_at": "2024-09-29",
"quote": "Bundesliste SPÖ, Platz 1: 46440 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_bundesbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Bundesliste",
"SPÖ",
1,
"Andreas Babler"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1973,
"no_name_match": true
},
"ids": {},
"name": "Andreas Babler"
},
"review": false,
"sensitive": false,
"summary_de": "46.440 Vorzugsstimmen bei der Nationalratswahl 2024 (Bundesliste SPÖ, Platz 1)",
"summary_en": "46,440 preference votes in the 2024 National Council election (SPÖ, Bundesliste, position 1)",
"topics": [],
"valid_from": null,
"valid_to": null
}
]
@@ -1,13 +0,0 @@
{
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_bundesbewerber_16102024.xlsx",
"kind": "preferences",
"method": "GET",
"params": null,
"json": null,
"meta": {
"election": "nrw2024",
"layout": "bund"
},
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"body_file": "preferences_bund.xlsx"
}
Binary file not shown.
@@ -1,250 +0,0 @@
[
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"list": "Bundesliste",
"party": "ÖVP",
"preference_votes": 58013,
"rank": 1
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:ÖVP:1",
"meta": {},
"published_at": "2024-06-09",
"quote": "Bundesliste ÖVP, Platz 1: 58013 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/gesamtaufstellung_erzielte_vorzugsstimmen_eu_wahl_2024_parteien.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"euw2024",
"Bundesliste",
"ÖVP",
1,
"Dr. Reinhold Lopatka"
],
"occurred_at": "2024-06-09",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {},
"name": "Dr. Reinhold Lopatka"
},
"review": false,
"sensitive": false,
"summary_de": "58.013 Vorzugsstimmen bei der Europawahl 2024 (Bundesliste ÖVP, Platz 1)",
"summary_en": "58,013 preference votes in the 2024 European Parliament election (ÖVP, Bundesliste, position 1)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"list": "Bundesliste",
"party": "ÖVP",
"preference_votes": 38426,
"rank": 2
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:ÖVP:2",
"meta": {},
"published_at": "2024-06-09",
"quote": "Bundesliste ÖVP, Platz 2: 38426 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/gesamtaufstellung_erzielte_vorzugsstimmen_eu_wahl_2024_parteien.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"euw2024",
"Bundesliste",
"ÖVP",
2,
"Mag. Dr. Angelika Winzig"
],
"occurred_at": "2024-06-09",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {},
"name": "Mag. Dr. Angelika Winzig"
},
"review": false,
"sensitive": false,
"summary_de": "38.426 Vorzugsstimmen bei der Europawahl 2024 (Bundesliste ÖVP, Platz 2)",
"summary_en": "38,426 preference votes in the 2024 European Parliament election (ÖVP, Bundesliste, position 2)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"list": "Bundesliste",
"party": "SPÖ",
"preference_votes": 61982,
"rank": 1
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:SPÖ:1",
"meta": {},
"published_at": "2024-06-09",
"quote": "Bundesliste SPÖ, Platz 1: 61982 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/gesamtaufstellung_erzielte_vorzugsstimmen_eu_wahl_2024_parteien.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"euw2024",
"Bundesliste",
"SPÖ",
1,
"Mag. Andreas Schieder"
],
"occurred_at": "2024-06-09",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {},
"name": "Mag. Andreas Schieder"
},
"review": false,
"sensitive": false,
"summary_de": "61.982 Vorzugsstimmen bei der Europawahl 2024 (Bundesliste SPÖ, Platz 1)",
"summary_en": "61,982 preference votes in the 2024 European Parliament election (SPÖ, Bundesliste, position 1)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"list": "Bundesliste",
"party": "SPÖ",
"preference_votes": 17448,
"rank": 2
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Bundesliste:SPÖ:2",
"meta": {},
"published_at": "2024-06-09",
"quote": "Bundesliste SPÖ, Platz 2: 17448 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/gesamtaufstellung_erzielte_vorzugsstimmen_eu_wahl_2024_parteien.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"euw2024",
"Bundesliste",
"SPÖ",
2,
"Mag. Evelyn Regner"
],
"occurred_at": "2024-06-09",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {},
"name": "Mag. Evelyn Regner"
},
"review": false,
"sensitive": false,
"summary_de": "17.448 Vorzugsstimmen bei der Europawahl 2024 (Bundesliste SPÖ, Platz 2)",
"summary_en": "17,448 preference votes in the 2024 European Parliament election (SPÖ, Bundesliste, position 2)",
"topics": [],
"valid_from": null,
"valid_to": null
}
]
@@ -1,13 +0,0 @@
{
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/gesamtaufstellung_erzielte_vorzugsstimmen_eu_wahl_2024_parteien.xlsx",
"kind": "preferences",
"method": "GET",
"params": null,
"json": null,
"meta": {
"election": "euw2024",
"layout": "eu"
},
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"body_file": "preferences_eu.xlsx"
}
Binary file not shown.
@@ -1,197 +0,0 @@
[
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Landesparteiliste Burgenland",
"party": "ÖVP",
"preference_votes": 3937,
"rank": 1
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Landesparteiliste Burgenland:ÖVP:1",
"meta": {},
"published_at": "2024-09-29",
"quote": "Landesparteiliste Burgenland ÖVP, Platz 1: 3937 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_landes_undregionalbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Landesparteiliste Burgenland",
"ÖVP",
1,
"Christoph Zarits"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1980,
"no_name_match": true
},
"ids": {},
"name": "Christoph Zarits"
},
"review": false,
"sensitive": false,
"summary_de": "3.937 Vorzugsstimmen bei der Nationalratswahl 2024 (Landesparteiliste Burgenland ÖVP, Platz 1)",
"summary_en": "3,937 preference votes in the 2024 National Council election (ÖVP, Landesparteiliste Burgenland, position 1)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Landesparteiliste Burgenland",
"party": "ÖVP",
"preference_votes": 2734,
"rank": 2
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Landesparteiliste Burgenland:ÖVP:2",
"meta": {},
"published_at": "2024-09-29",
"quote": "Landesparteiliste Burgenland ÖVP, Platz 2: 2734 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_landes_undregionalbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Landesparteiliste Burgenland",
"ÖVP",
2,
"Nikolaus Berlakovich"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1961,
"no_name_match": true
},
"ids": {},
"name": "Nikolaus Berlakovich"
},
"review": false,
"sensitive": false,
"summary_de": "2.734 Vorzugsstimmen bei der Nationalratswahl 2024 (Landesparteiliste Burgenland ÖVP, Platz 2)",
"summary_en": "2,734 preference votes in the 2024 National Council election (ÖVP, Landesparteiliste Burgenland, position 2)",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"list": "Regionalparteiliste Burgenland Nord",
"party": "ÖVP",
"preference_votes": 7361,
"rank": 1
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "Regionalparteiliste Burgenland Nord:ÖVP:1",
"meta": {},
"published_at": "2024-09-29",
"quote": "Regionalparteiliste Burgenland Nord ÖVP, Platz 1: 7361 Vorzugsstimmen",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, Vorzugsstimmen",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_landes_undregionalbewerber_16102024.xlsx"
}
],
"facet": null,
"key": [
"preference-votes",
"nrw2024",
"Regionalparteiliste Burgenland Nord",
"ÖVP",
1,
"Christoph Zarits"
],
"occurred_at": "2024-09-29",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {
"birth_year": 1980,
"no_name_match": true
},
"ids": {},
"name": "Christoph Zarits"
},
"review": false,
"sensitive": false,
"summary_de": "7.361 Vorzugsstimmen bei der Nationalratswahl 2024 (Regionalparteiliste Burgenland Nord ÖVP, Platz 1)",
"summary_en": "7,361 preference votes in the 2024 National Council election (ÖVP, Regionalparteiliste Burgenland Nord, position 1)",
"topics": [],
"valid_from": null,
"valid_to": null
}
]
@@ -1,13 +0,0 @@
{
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/nrw2024_aufstellung_der_vorzugsstimmen_der_landes_undregionalbewerber_16102024.xlsx",
"kind": "preferences",
"method": "GET",
"params": null,
"json": null,
"meta": {
"election": "nrw2024",
"layout": "land"
},
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"body_file": "preferences_land.xlsx"
}
Binary file not shown.
@@ -1,266 +0,0 @@
[
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"electorate": 6372205,
"party": "ÖVP",
"percent": 24.52,
"region": "Österreich",
"region_code": "G00000",
"valid_votes": 3523935,
"votes": 864072
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G00000:ÖVP",
"meta": {},
"published_at": "2024-06-09",
"quote": "Österreich | ÖVP | 864072 | 3523935 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/endgueltiges_ergebnis_europawahl_26062024.xlsx"
}
],
"facet": null,
"key": [
"election",
"euw2024",
"G00000",
"ÖVP"
],
"occurred_at": "2024-06-09",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "ÖVP: 24,52 % (864.072 Stimmen) bei der Europawahl 2024 – Österreich",
"summary_en": "ÖVP: 24.52 % (864,072 votes) in the 2024 European Parliament election – Österreich",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"electorate": 6372205,
"party": "SPÖ",
"percent": 23.22,
"region": "Österreich",
"region_code": "G00000",
"valid_votes": 3523935,
"votes": 818287
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G00000:SPÖ",
"meta": {},
"published_at": "2024-06-09",
"quote": "Österreich | SPÖ | 818287 | 3523935 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/endgueltiges_ergebnis_europawahl_26062024.xlsx"
}
],
"facet": null,
"key": [
"election",
"euw2024",
"G00000",
"SPÖ"
],
"occurred_at": "2024-06-09",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "SPÖ: 23,22 % (818.287 Stimmen) bei der Europawahl 2024 – Österreich",
"summary_en": "SPÖ: 23.22 % (818,287 votes) in the 2024 European Parliament election – Österreich",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"electorate": 235492,
"party": "ÖVP",
"percent": 27.91,
"region": "Burgenland",
"region_code": "G10000",
"valid_votes": 134907,
"votes": 37654
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G10000:ÖVP",
"meta": {},
"published_at": "2024-06-09",
"quote": "Burgenland | ÖVP | 37654 | 134907 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/endgueltiges_ergebnis_europawahl_26062024.xlsx"
}
],
"facet": null,
"key": [
"election",
"euw2024",
"G10000",
"ÖVP"
],
"occurred_at": "2024-06-09",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "ÖVP: 27,91 % (37.654 Stimmen) bei der Europawahl 2024 – Burgenland",
"summary_en": "ÖVP: 27.91 % (37,654 votes) in the 2024 European Parliament election – Burgenland",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"election": "euw2024",
"electorate": 235492,
"party": "SPÖ",
"percent": 29.84,
"region": "Burgenland",
"region_code": "G10000",
"valid_votes": 134907,
"votes": 40253
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G10000:SPÖ",
"meta": {},
"published_at": "2024-06-09",
"quote": "Burgenland | SPÖ | 40253 | 134907 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Europawahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/endgueltiges_ergebnis_europawahl_26062024.xlsx"
}
],
"facet": null,
"key": [
"election",
"euw2024",
"G10000",
"SPÖ"
],
"occurred_at": "2024-06-09",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "SPÖ: 29,84 % (40.253 Stimmen) bei der Europawahl 2024 – Burgenland",
"summary_en": "SPÖ: 29.84 % (40,253 votes) in the 2024 European Parliament election – Burgenland",
"topics": [],
"valid_from": null,
"valid_to": null
}
]
@@ -1,12 +0,0 @@
{
"url": "https://www.bmi.gv.at/412/europawahlen/europawahl_2024/files/endgueltiges_ergebnis_europawahl_26062024.xlsx",
"kind": "result",
"method": "GET",
"params": null,
"json": null,
"meta": {
"election": "euw2024"
},
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"body_file": "result_euw2024.xlsx"
}
Binary file not shown.
@@ -1,398 +0,0 @@
[
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "nationalrat"
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"electorate": 6346059,
"party": "ÖVP",
"percent": 26.26,
"region": "Österreich",
"region_code": "G00000",
"valid_votes": 4882888,
"votes": 1282734
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G00000:ÖVP",
"meta": {},
"published_at": "2024-09-29",
"quote": "Österreich | ÖVP | 1282734 | 4882888 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx"
}
],
"facet": null,
"key": [
"election",
"nrw2024",
"G00000",
"ÖVP"
],
"occurred_at": "2024-09-29",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "ÖVP: 26,26 % (1.282.734 Stimmen) bei der Nationalratswahl 2024 – Österreich",
"summary_en": "ÖVP: 26.26 % (1,282,734 votes) in the 2024 National Council election – Österreich",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "nationalrat"
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"electorate": 6346059,
"party": "SPÖ",
"percent": 21.13,
"region": "Österreich",
"region_code": "G00000",
"valid_votes": 4882888,
"votes": 1032233
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G00000:SPÖ",
"meta": {},
"published_at": "2024-09-29",
"quote": "Österreich | SPÖ | 1032233 | 4882888 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx"
}
],
"facet": null,
"key": [
"election",
"nrw2024",
"G00000",
"SPÖ"
],
"occurred_at": "2024-09-29",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "SPÖ: 21,13 % (1.032.233 Stimmen) bei der Nationalratswahl 2024 – Österreich",
"summary_en": "SPÖ: 21.13 % (1,032,233 votes) in the 2024 National Council election – Österreich",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "nationalrat"
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"electorate": 6346059,
"party": "FPÖ",
"percent": 28.84,
"region": "Österreich",
"region_code": "G00000",
"valid_votes": 4882888,
"votes": 1408512
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G00000:FPÖ",
"meta": {},
"published_at": "2024-09-29",
"quote": "Österreich | FPÖ | 1408512 | 4882888 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx"
}
],
"facet": null,
"key": [
"election",
"nrw2024",
"G00000",
"FPÖ"
],
"occurred_at": "2024-09-29",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "FPÖ",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "FPÖ: 28,84 % (1.408.512 Stimmen) bei der Nationalratswahl 2024 – Österreich",
"summary_en": "FPÖ: 28.84 % (1,408,512 votes) in the 2024 National Council election – Österreich",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "nationalrat"
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"electorate": 233738,
"party": "ÖVP",
"percent": 28.55,
"region": "Burgenland",
"region_code": "G10000",
"valid_votes": 190099,
"votes": 54287
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G10000:ÖVP",
"meta": {},
"published_at": "2024-09-29",
"quote": "Burgenland | ÖVP | 54287 | 190099 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx"
}
],
"facet": null,
"key": [
"election",
"nrw2024",
"G10000",
"ÖVP"
],
"occurred_at": "2024-09-29",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "ÖVP",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "ÖVP: 28,55 % (54.287 Stimmen) bei der Nationalratswahl 2024 – Burgenland",
"summary_en": "ÖVP: 28.55 % (54,287 votes) in the 2024 National Council election – Burgenland",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "nationalrat"
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"electorate": 233738,
"party": "SPÖ",
"percent": 27.02,
"region": "Burgenland",
"region_code": "G10000",
"valid_votes": 190099,
"votes": 51374
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G10000:SPÖ",
"meta": {},
"published_at": "2024-09-29",
"quote": "Burgenland | SPÖ | 51374 | 190099 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx"
}
],
"facet": null,
"key": [
"election",
"nrw2024",
"G10000",
"SPÖ"
],
"occurred_at": "2024-09-29",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "SPÖ",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "SPÖ: 27,02 % (51.374 Stimmen) bei der Nationalratswahl 2024 – Burgenland",
"summary_en": "SPÖ: 27.02 % (51,374 votes) in the 2024 National Council election – Burgenland",
"topics": [],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "election_result",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "nationalrat"
},
"counterpart_person": null,
"data": {
"election": "nrw2024",
"electorate": 233738,
"party": "FPÖ",
"percent": 28.78,
"region": "Burgenland",
"region_code": "G10000",
"valid_votes": 190099,
"votes": 54718
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "dataset_row",
"excerpt": null,
"full_text": null,
"locator": "G10000:FPÖ",
"meta": {},
"published_at": "2024-09-29",
"quote": "Burgenland | FPÖ | 54718 | 190099 gültige",
"source": null,
"stance": "supports",
"title": "BMI: Nationalratswahl 2024, endgültiges Ergebnis",
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx"
}
],
"facet": null,
"key": [
"election",
"nrw2024",
"G10000",
"FPÖ"
],
"occurred_at": "2024-09-29",
"org": {
"__type__": "OrgRef",
"create": false,
"ids": {},
"kind": "party",
"name": null,
"short_name": "FPÖ",
"slug": null
},
"person": null,
"review": false,
"sensitive": false,
"summary_de": "FPÖ: 28,78 % (54.718 Stimmen) bei der Nationalratswahl 2024 – Burgenland",
"summary_en": "FPÖ: 28.78 % (54,718 votes) in the 2024 National Council election – Burgenland",
"topics": [],
"valid_from": null,
"valid_to": null
}
]
@@ -1,12 +0,0 @@
{
"url": "https://www.bmi.gv.at/412/nationalratswahlen/nationalratswahl_2024/files/endgueltiges_ergebnis_beschluss_bundeswahlbehoerde_16102024.xlsx",
"kind": "result",
"method": "GET",
"params": null,
"json": null,
"meta": {
"election": "nrw2024"
},
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"body_file": "result_nrw2024.xlsx"
}
Binary file not shown.
@@ -1,314 +0,0 @@
[
{
"__type__": "VoteEvent",
"chamber": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"item_ref": "A10-0259/2026",
"key": "3ab02bb907351dfa059987800a98ee3b1e2a77a9",
"part_vote": false,
"protocol_url": "https://www.europarl.europa.eu/doceo/document/PV-10-2026-10-21-RCV_DE.html",
"raw_text": "Entschließungsantrag (gesamter Text): 504 Ja, 63 Nein, 99 Enthaltungen",
"result": "accepted",
"roll_call": true,
"stage": "Entschließungsantrag (gesamter Text)",
"title": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs",
"url": "https://data.europarl.europa.eu/eli/dl/event/MTG-PL-2026-10-21-DEC-198302",
"voted_on": "2026-10-21"
},
{
"__type__": "Claim",
"claim_type": "vote",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"abstained": 99,
"chamber": "EP",
"intended": "against",
"no": 63,
"position": "for",
"result": "accepted",
"roll_call": true,
"yes": 504
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "vote:eli/dl/event/MTG-PL-2026-10-21-DEC-198302",
"meta": {},
"published_at": "2026-10-21",
"quote": "Entschließungsantrag (gesamter Text): 504 Ja, 63 Nein, 99 Enthaltungen",
"source": null,
"stance": "supports",
"title": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs",
"url": "https://data.europarl.europa.eu/eli/dl/event/MTG-PL-2026-10-21-DEC-198302"
}
],
"facet": {
"__type__": "VotePosition",
"event_key": "3ab02bb907351dfa059987800a98ee3b1e2a77a9",
"party": null,
"position": "for"
},
"key": null,
"occurred_at": "2026-10-21",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"ep": "257104"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Stimmte für: Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs (Europäisches Parlament) – angenommen",
"summary_en": "Voted for: Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs (European Parliament) – adopted",
"topics": [
"Europäische Union"
],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "vote",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"abstained": 99,
"chamber": "EP",
"no": 63,
"position": "against",
"result": "accepted",
"roll_call": true,
"yes": 504
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "vote:eli/dl/event/MTG-PL-2026-10-21-DEC-198302",
"meta": {},
"published_at": "2026-10-21",
"quote": "Entschließungsantrag (gesamter Text): 504 Ja, 63 Nein, 99 Enthaltungen",
"source": null,
"stance": "supports",
"title": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs",
"url": "https://data.europarl.europa.eu/eli/dl/event/MTG-PL-2026-10-21-DEC-198302"
}
],
"facet": {
"__type__": "VotePosition",
"event_key": "3ab02bb907351dfa059987800a98ee3b1e2a77a9",
"party": null,
"position": "against"
},
"key": null,
"occurred_at": "2026-10-21",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"ep": "256996"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Stimmte gegen: Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs (Europäisches Parlament) – angenommen",
"summary_en": "Voted against: Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs (European Parliament) – adopted",
"topics": [
"Europäische Union"
],
"valid_from": null,
"valid_to": null
},
{
"__type__": "Claim",
"claim_type": "vote",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"abstained": 99,
"chamber": "EP",
"no": 63,
"position": "abstain",
"result": "accepted",
"roll_call": true,
"yes": 504
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "vote:eli/dl/event/MTG-PL-2026-10-21-DEC-198302",
"meta": {},
"published_at": "2026-10-21",
"quote": "Entschließungsantrag (gesamter Text): 504 Ja, 63 Nein, 99 Enthaltungen",
"source": null,
"stance": "supports",
"title": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs",
"url": "https://data.europarl.europa.eu/eli/dl/event/MTG-PL-2026-10-21-DEC-198302"
}
],
"facet": {
"__type__": "VotePosition",
"event_key": "3ab02bb907351dfa059987800a98ee3b1e2a77a9",
"party": null,
"position": "abstain"
},
"key": null,
"occurred_at": "2026-10-21",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"ep": "213330"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Enthielt sich bei: Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs (Europäisches Parlament) – angenommen",
"summary_en": "Abstained on: Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs (European Parliament) – adopted",
"topics": [
"Europäische Union"
],
"valid_from": null,
"valid_to": null
},
{
"__type__": "VoteEvent",
"chamber": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"item_ref": "A10-0272/2026",
"key": "6f5c1cd4005ecf97b7b450c671850a66d9fd5943",
"part_vote": true,
"protocol_url": "https://www.europarl.europa.eu/doceo/document/PV-10-2026-10-21-RCV_DE.html",
"raw_text": "nach § 3 – Änd. 70: 177 Ja, 455 Nein, 41 Enthaltungen",
"result": "rejected",
"roll_call": true,
"stage": "nach § 3 – Änd. 70",
"title": "A10-0272/2026 – Nils Ušakovs, Michalis Hadjipantela – nach § 3 – Änd. 70",
"url": "https://data.europarl.europa.eu/eli/dl/event/MTG-PL-2026-10-21-DEC-198977",
"voted_on": "2026-10-21"
},
{
"__type__": "Claim",
"claim_type": "vote",
"counterpart_org": {
"__type__": "OrgRef",
"create": true,
"ids": {},
"kind": "other",
"name": null,
"short_name": null,
"slug": "europaeisches-parlament"
},
"counterpart_person": null,
"data": {
"abstained": 41,
"chamber": "EP",
"no": 455,
"part_vote": true,
"position": "for",
"result": "rejected",
"roll_call": true,
"yes": 177
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "vote:eli/dl/event/MTG-PL-2026-10-21-DEC-198977",
"meta": {},
"published_at": "2026-10-21",
"quote": "nach § 3 – Änd. 70: 177 Ja, 455 Nein, 41 Enthaltungen",
"source": null,
"stance": "supports",
"title": "A10-0272/2026 – Nils Ušakovs, Michalis Hadjipantela – nach § 3 – Änd. 70",
"url": "https://data.europarl.europa.eu/eli/dl/event/MTG-PL-2026-10-21-DEC-198977"
}
],
"facet": {
"__type__": "VotePosition",
"event_key": "6f5c1cd4005ecf97b7b450c671850a66d9fd5943",
"party": null,
"position": "for"
},
"key": null,
"occurred_at": "2026-10-21",
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"ep": "257104"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Stimmte für: A10-0272/2026 – Nils Ušakovs, Michalis Hadjipantela – nach § 3 – Änd. 70 (Europäisches Parlament) – abgelehnt",
"summary_en": "Voted for: A10-0272/2026 – Nils Ušakovs, Michalis Hadjipantela – nach § 3 – Änd. 70 (European Parliament) – rejected",
"topics": [
"Europäische Union"
],
"valid_from": null,
"valid_to": null
}
]
-189
View File
@@ -1,189 +0,0 @@
{
"data": [
{
"id": "eli/dl/event/MTG-PL-2026-10-21-DEC-198302",
"type": "Vote",
"activity_date": "2026-10-21",
"activity_id": "MTG-PL-2026-10-21-DEC-198302",
"activity_label": {
"de": "A10-0259/2026 – Brigitte van den Berg – Entschließungsantrag (gesamter Text)",
"en": "A10-0259/2026 – Brigitte van den Berg – Motion for a resolution (as a whole)"
},
"activity_order": "7.0",
"activity_start_date": "2026-10-21T13:49:16+02:00",
"decision_method": "def/ep-decision-methods/VOTE_ELECTRONIC_ROLLCALL",
"decision_outcome": "def/ep-statuses/ADOPTED",
"had_activity_type": "def/ep-activities/PLENARY_OUTCOME",
"had_voter_abstention": [
"person/213330"
],
"had_voter_against": [
"person/256996"
],
"had_voter_favor": [
"person/257104",
"person/125023"
],
"number_of_attendees": 666,
"number_of_votes_abstention": 99,
"number_of_votes_against": 63,
"number_of_votes_favor": 504,
"recorded_in_a_realization_of": [
"eli/dl/doc/PV-10-2026-10-21-RCV-ITM-151"
],
"comment": {
"hu": "Nsz",
"lt": "VB",
"pt": "VN",
"es": "VN",
"cs": "JH",
"bg": "ПГ",
"de": "NA",
"lv": "ATKL",
"sl": "PG",
"mt": "VSI",
"fr": "AN",
"it": "AN",
"hr": "AN",
"da": "AN",
"ro": "AN",
"pl": "gi",
"ga": "VGR",
"nl": "HS",
"fi": "NHÄ",
"et": "NH",
"sk": "HPM",
"el": "OK",
"sv": "ONU",
"en": "RCV"
},
"notation_votingId": "198302",
"referenceText": {
"de": "Entschließungsantrag (gesamter Text)",
"en": "Motion for a resolution (as a whole)"
},
"inverse_consists_of": [
"eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993266"
],
"had_voter_intended_against": [
"person/257104"
]
},
{
"id": "eli/dl/event/MTG-PL-2026-10-21-DEC-198977",
"type": "Vote",
"activity_date": "2026-10-21",
"activity_id": "MTG-PL-2026-10-21-DEC-198977",
"activity_label": {
"de": "A10-0272/2026 – Nils Ušakovs, Michalis Hadjipantela – nach § 3 – Änd. 70",
"en": "A10-0272/2026 – Nils Ušakovs, Michalis Hadjipantela – After § 3 – Am 70"
},
"activity_order": "13.0",
"activity_start_date": "2026-10-21T13:20:25+02:00",
"decided_on_a_realization_of": [
"eli/dl/doc/A-10-2026-0272-AM-70"
],
"decision_method": "def/ep-decision-methods/VOTE_ELECTRONIC_ROLLCALL",
"decision_outcome": "def/ep-statuses/REJECTED",
"had_activity_type": "def/ep-activities/PLENARY_OUTCOME",
"number_of_attendees": 673,
"number_of_votes_abstention": 41,
"number_of_votes_against": 455,
"number_of_votes_favor": 177,
"recorded_in_a_realization_of": [
"eli/dl/doc/PV-10-2026-10-21-RCV-ITM-023"
],
"responsible_organization_label": {
"et": "PfE",
"hu": "PfE",
"pl": "PfE",
"sl": "PfE",
"el": "PfE",
"ro": "PfE",
"lv": "PfE",
"pt": "PfE",
"sk": "PfE",
"fi": "PfE",
"bg": "PfE",
"en": "PfE",
"fr": "PfE",
"hr": "PfE",
"nl": "PfE",
"mt": "PfE",
"da": "PfE",
"cs": "PfE",
"de": "PfE",
"ga": "PfE",
"it": "PfE",
"sv": "PfE",
"es": "PfE",
"lt": "PfE"
},
"was_motivated_by": [
"eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993294-RCV-3"
],
"comment": {
"sl": "PG",
"sv": "ONU",
"cs": "JH",
"el": "OK",
"fr": "AN",
"it": "AN",
"hr": "AN",
"da": "AN",
"ro": "AN",
"lv": "ATKL",
"et": "NH",
"es": "VN",
"pt": "VN",
"ga": "VGR",
"bg": "ПГ",
"nl": "HS",
"mt": "VSI",
"pl": "gi",
"fi": "NHÄ",
"en": "RCV",
"de": "NA",
"sk": "HPM",
"hu": "Nsz",
"lt": "VB"
},
"notation_votingId": "198977",
"decisionAboutId": "70",
"referenceText": {
"de": "Nach § 3",
"en": "After § 3"
},
"inverse_consists_of": [
"eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993294"
],
"had_voter_favor": [
"person/257104",
"person/125023"
]
},
{
"id": "eli/dl/event/MTG-PL-2026-10-21-DEC-199277",
"type": "Vote",
"activity_date": "2026-10-21",
"activity_id": "MTG-PL-2026-10-21-DEC-199277",
"activity_label": {
"de": "Block 16",
"en": "Block 16"
},
"activity_order": "197.0",
"decision_method": "def/ep-decision-methods/VOTE_HAND",
"decision_outcome": "def/ep-statuses/ADOPTED",
"had_activity_type": "def/ep-activities/PLENARY_OUTCOME",
"notation_votingId": "199277",
"decisionAboutId": "707, 708, 709",
"referenceText": {
"de": "Block 16",
"en": "Block 16"
},
"inverse_consists_of": [
"eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993336"
]
}
]
}
@@ -1,25 +0,0 @@
{
"url": "https://data.europarl.europa.eu/api/v2/meetings/MTG-PL-2026-10-21/decisions",
"kind": "decisions",
"method": "GET",
"params": {
"format": "application/ld+json",
"limit": 500,
"offset": 0
},
"json": null,
"meta": {
"ep_ids": [
"257104",
"256996",
"213330"
],
"meeting": "MTG-PL-2026-10-21",
"offset": 0,
"titles": {
"eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993266": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs"
}
},
"content_type": "application/ld+json",
"body_file": "decisions.json"
}
@@ -1,42 +0,0 @@
[
{
"__type__": "Request",
"conditional": true,
"headers": null,
"json": null,
"kind": "results",
"meta": {
"ep_ids": [
"197490"
],
"meeting": "MTG-PL-2025-01-20"
},
"method": "GET",
"params": {
"format": "application/ld+json",
"limit": 500
},
"skip_unchanged": true,
"url": "https://data.europarl.europa.eu/api/v2/meetings/MTG-PL-2025-01-20/vote-results"
},
{
"__type__": "Request",
"conditional": true,
"headers": null,
"json": null,
"kind": "results",
"meta": {
"ep_ids": [
"197490"
],
"meeting": "MTG-PL-2025-01-21"
},
"method": "GET",
"params": {
"format": "application/ld+json",
"limit": 500
},
"skip_unchanged": true,
"url": "https://data.europarl.europa.eu/api/v2/meetings/MTG-PL-2025-01-21/vote-results"
}
]
-34
View File
@@ -1,34 +0,0 @@
{
"data": [
{
"id": "eli/dl/event/MTG-PL-2025-01-20",
"type": "Activity",
"activity_date": "2025-01-20",
"activity_id": "MTG-PL-2025-01-20",
"activity_label": {
"de": "Montag, 20. Januar 2025",
"en": "Monday, 20 January 2025"
}
},
{
"id": "eli/dl/event/MTG-PL-2025-01-21",
"type": "Activity",
"activity_date": "2025-01-21",
"activity_id": "MTG-PL-2025-01-21",
"activity_label": {
"de": "Dienstag, 21. Januar 2025",
"en": "Tuesday, 21 January 2025"
}
},
{
"id": "eli/dl/event/MTG-PL-2026-06-01",
"type": "Activity",
"activity_date": "2026-06-01",
"activity_id": "MTG-PL-2026-06-01",
"activity_label": {
"de": "Dienstag, 21. Januar 2025",
"en": "Tuesday, 21 January 2025"
}
}
]
}
@@ -1,18 +0,0 @@
{
"url": "https://data.europarl.europa.eu/api/v2/meetings",
"kind": "meetings",
"method": "GET",
"params": {
"year": 2025,
"format": "application/ld+json",
"limit": 200
},
"json": null,
"meta": {
"ep_ids": [
"197490"
]
},
"content_type": "application/ld+json",
"body_file": "meetings.json"
}
@@ -1,27 +0,0 @@
[
{
"__type__": "Request",
"conditional": true,
"headers": null,
"json": null,
"kind": "decisions",
"meta": {
"ep_ids": [
"X"
],
"meeting": "MTG-PL-2026-10-21",
"offset": 0,
"titles": {
"eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993266": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs"
}
},
"method": "GET",
"params": {
"format": "application/ld+json",
"limit": 500,
"offset": 0
},
"skip_unchanged": true,
"url": "https://data.europarl.europa.eu/api/v2/meetings/MTG-PL-2026-10-21/decisions"
}
]
-20
View File
@@ -1,20 +0,0 @@
{
"data": [
{
"id": "eli/dl/event/MTG-PL-2026-10-21-VOT-ITM-993266",
"activity_date": "2026-10-21",
"activity_id": "MTG-PL-2026-10-21-VOT-ITM-993266",
"activity_label": {
"de": "Förderung von Kompetenzen in der Union durch Möglichkeiten der beruflichen Aus- und Weiterbildung in Zeiten des Übergangs",
"en": "Boosting skills in the Union – opportunities for vocational education and training in times of transition"
}
},
{
"id": "eli/dl/event/no-date",
"activity_id": "no-date",
"activity_label": {
"de": "Eintrag ohne Datum"
}
}
]
}
@@ -1,18 +0,0 @@
{
"url": "https://data.europarl.europa.eu/api/v2/meetings/MTG-PL-2026-10-21/vote-results",
"kind": "results",
"method": "GET",
"params": {
"format": "application/ld+json",
"limit": 500
},
"json": null,
"meta": {
"ep_ids": [
"X"
],
"meeting": "MTG-PL-2026-10-21"
},
"content_type": "application/ld+json",
"body_file": "results.json"
}
@@ -12,7 +12,6 @@
}, },
"item_ref": "416/A", "item_ref": "416/A",
"key": "931917bd2feea2b95c21f3e15a86267702bce32f", "key": "931917bd2feea2b95c21f3e15a86267702bce32f",
"part_vote": false,
"protocol_url": "https://www.parlament.gv.at/dokument/XXVIII/NRSITZ/44/fnameorig_1764795.html#160", "protocol_url": "https://www.parlament.gv.at/dokument/XXVIII/NRSITZ/44/fnameorig_1764795.html#160",
"raw_text": "44. Sitzung des Nationalrates: Gesetzesvorschlag in zweiter Lesung angenommen Dafür: ÖVP, SPÖ, NEOS, GRÜNE, dagegen: FPÖ", "raw_text": "44. Sitzung des Nationalrates: Gesetzesvorschlag in zweiter Lesung angenommen Dafür: ÖVP, SPÖ, NEOS, GRÜNE, dagegen: FPÖ",
"result": "accepted", "result": "accepted",
@@ -460,7 +459,6 @@
}, },
"item_ref": "416/A", "item_ref": "416/A",
"key": "106b0163e733dbe54ccf3a7c148a2041ee607b6b", "key": "106b0163e733dbe54ccf3a7c148a2041ee607b6b",
"part_vote": false,
"protocol_url": "https://www.parlament.gv.at/dokument/XXVIII/NRSITZ/44/fnameorig_1764795.html#160", "protocol_url": "https://www.parlament.gv.at/dokument/XXVIII/NRSITZ/44/fnameorig_1764795.html#160",
"raw_text": "44. Sitzung des Nationalrates: Gesetzesvorschlag in dritter Lesung angenommen Dafür: ÖVP, SPÖ, NEOS, GRÜNE, dagegen: FPÖ", "raw_text": "44. Sitzung des Nationalrates: Gesetzesvorschlag in dritter Lesung angenommen Dafür: ÖVP, SPÖ, NEOS, GRÜNE, dagegen: FPÖ",
"result": "accepted", "result": "accepted",
@@ -908,7 +906,6 @@
}, },
"item_ref": "416/A", "item_ref": "416/A",
"key": "bc19d7af2b29acce57bfa6ad139b44c43aacc98a", "key": "bc19d7af2b29acce57bfa6ad139b44c43aacc98a",
"part_vote": false,
"protocol_url": "https://www.parlament.gv.at/dokument/BR/BRSITZ/982/fnameorig_1768518.html#45", "protocol_url": "https://www.parlament.gv.at/dokument/BR/BRSITZ/982/fnameorig_1768518.html#45",
"raw_text": "982. Sitzung: Antrag, keinen Einspruch zu erheben, angenommen Dafür: ÖVP, SPÖ, GRÜNE, NEOS, dagegen: FPÖ", "raw_text": "982. Sitzung: Antrag, keinen Einspruch zu erheben, angenommen Dafür: ÖVP, SPÖ, GRÜNE, NEOS, dagegen: FPÖ",
"result": "accepted", "result": "accepted",
@@ -1,167 +0,0 @@
[
{
"__type__": "Claim",
"claim_type": "affiliation",
"counterpart_org": null,
"counterpart_person": null,
"data": {
"chamber": "NR",
"committee": "Ständiger Unterausschuss des Budgetausschusses",
"function": "Ersatzmitglied",
"gp": "XXVIII"
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "ausschuss:XXVIII:Ständiger Unterausschuss des Budgetausschusses:Ersatzmitglied:2024-10-24",
"meta": {},
"published_at": null,
"quote": null,
"source": null,
"stance": "supports",
"title": "Parlament: Hannes Amesbauer",
"url": "https://www.parlament.gv.at/person/51879"
}
],
"facet": null,
"key": [
"parl-committee",
"51879",
"XXVIII",
"Ständiger Unterausschuss des Budgetausschusses",
"Ersatzmitglied",
"2024-10-24"
],
"occurred_at": null,
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"parlament": "51879"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Hannes Amesbauer: Ersatzmitglied, Ständiger Unterausschuss des Budgetausschusses (Nationalrat, XXVIII. GP)",
"summary_en": "Hannes Amesbauer: Ersatzmitglied, Ständiger Unterausschuss des Budgetausschusses (Nationalrat, XXVIII legislative period)",
"topics": [],
"valid_from": "2024-10-24",
"valid_to": "2024-12-18"
},
{
"__type__": "Claim",
"claim_type": "affiliation",
"counterpart_org": null,
"counterpart_person": null,
"data": {
"chamber": "NR",
"committee": "Ständiger Unterausschuss des Hauptausschusses",
"function": "Ersatzmitglied",
"gp": "XXVIII"
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "ausschuss:XXVIII:Ständiger Unterausschuss des Hauptausschusses:Ersatzmitglied:2024-10-24",
"meta": {},
"published_at": null,
"quote": null,
"source": null,
"stance": "supports",
"title": "Parlament: Hannes Amesbauer",
"url": "https://www.parlament.gv.at/person/51879"
}
],
"facet": null,
"key": [
"parl-committee",
"51879",
"XXVIII",
"Ständiger Unterausschuss des Hauptausschusses",
"Ersatzmitglied",
"2024-10-24"
],
"occurred_at": null,
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"parlament": "51879"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Hannes Amesbauer: Ersatzmitglied, Ständiger Unterausschuss des Hauptausschusses (Nationalrat, XXVIII. GP)",
"summary_en": "Hannes Amesbauer: Ersatzmitglied, Ständiger Unterausschuss des Hauptausschusses (Nationalrat, XXVIII legislative period)",
"topics": [],
"valid_from": "2024-10-24",
"valid_to": "2024-12-18"
},
{
"__type__": "Claim",
"claim_type": "affiliation",
"counterpart_org": null,
"counterpart_person": null,
"data": {
"chamber": "NR",
"committee": "Ständiger Unterausschuss des Budgetausschusses",
"function": "Obfrau",
"gp": "XXVIII"
},
"evidence": [
{
"__type__": "Evidence",
"confidence": 1.0,
"doc_type": "api_record",
"excerpt": null,
"full_text": null,
"locator": "ausschuss:XXVIII:Ständiger Unterausschuss des Budgetausschusses:Obfrau:2024-10-24",
"meta": {},
"published_at": null,
"quote": null,
"source": null,
"stance": "supports",
"title": "Parlament: Hannes Amesbauer",
"url": "https://www.parlament.gv.at/person/51879"
}
],
"facet": null,
"key": [
"parl-committee",
"51879",
"XXVIII",
"Ständiger Unterausschuss des Budgetausschusses",
"Obfrau",
"2024-10-24"
],
"occurred_at": null,
"org": null,
"person": {
"__type__": "PersonRef",
"hints": {},
"ids": {
"parlament": "51879"
},
"name": null
},
"review": false,
"sensitive": false,
"summary_de": "Hannes Amesbauer: Obfrau, Ständiger Unterausschuss des Budgetausschusses (Nationalrat, XXVIII. GP)",
"summary_en": "Hannes Amesbauer: Obfrau, Ständiger Unterausschuss des Budgetausschusses (Nationalrat, XXVIII legislative period)",
"topics": [],
"valid_from": "2024-10-24",
"valid_to": null
}
]
-206
View File
@@ -1,206 +0,0 @@
{
"pages": 1,
"count": 4,
"header": [
{
"css_class": "datum-col",
"feldId": 92,
"hidden": false,
"rnr": 1,
"listeId": 250,
"label": "GP",
"sortable": "1",
"feld_name": "GP",
"class": "datum-col"
},
{
"feldId": 93,
"hidden": true,
"rnr": 2,
"listeId": 250,
"label": "Sort"
},
{
"css_class": "col-20",
"feldId": 94,
"hidden": false,
"rnr": 3,
"listeId": 250,
"label": "Funktion",
"feld_name": "FUNKTION",
"class": "col-20"
},
{
"css_class": "fraction-col",
"link_rnr": "6",
"feldId": 95,
"hidden": false,
"rnr": 4,
"listeId": 250,
"label": "Ausschuss",
"class": "fraction-col"
},
{
"feldId": 96,
"hidden": true,
"rnr": 5,
"listeId": 250,
"label": "nrbr"
},
{
"feldId": 97,
"hidden": true,
"rnr": 6,
"listeId": 250,
"label": "URL"
},
{
"feldId": 98,
"hidden": true,
"rnr": 7,
"listeId": 250,
"label": "PAD_INTERN",
"feld_name": "PAD_INTERN"
},
{
"feldId": 969,
"hidden": true,
"rnr": 8,
"mediaType": "fromDate",
"listeId": 250,
"label": "fromDate"
},
{
"feldId": 564,
"hidden": true,
"rnr": 9,
"listeId": 250,
"label": "Ausschuss",
"feld_name": "AUSSCHUSS"
},
{
"feldId": 565,
"hidden": true,
"rnr": 10,
"listeId": 250,
"label": "Gremium",
"feld_name": "GREMIUM"
},
{
"feldId": 584,
"hidden": true,
"rnr": 11,
"listeId": 250,
"label": "gp_text_full",
"feld_name": "GP_TEXT_FULL"
},
{
"feldId": 1645,
"hidden": true,
"ist_range": "1",
"rnr": 12,
"mediaType": "datetime",
"listeId": 250,
"label": "Beginn",
"feld_name": "BEGINNDATUM_ISO"
},
{
"feldId": 1665,
"hidden": false,
"sort_rnr": 14,
"label": "Funktionsbeginn",
"sortable": "1",
"css_class": "datum-col",
"rnr": 13,
"listeId": 250,
"feld_name": "FUNKTIONSBEGINN",
"class": "datum-col"
},
{
"feldId": 1666,
"hidden": true,
"rnr": 14,
"listeId": 250,
"label": "Beginn4Sort",
"feld_name": "BEGINN4SORT"
},
{
"feldId": 1685,
"hidden": true,
"rnr": 15,
"listeId": 250,
"label": "Personenregister",
"feld_name": "PERSONENREGISTER"
}
],
"rows": [
[
"XXVIII",
"2Z797589750013220241024STÄNDIGER UNTERAUSSCHUSS DES BUDGETAUSSCHUSSES79758975",
"Ersatzmitglied",
"Ständiger Unterausschuss des Budgetausschusses (24.10.2024 - 18.12.2024)",
"NR",
"/PAKT/VHG/XXVIII/SA-BU/SA-BU_00001_00908/index.shtml",
"51879",
"Thu Oct 24 02:00:00 CEST 2024",
"Ständiger Unterausschuss des Budgetausschusses",
"Nationalrat",
"ab 24.10.2024: XXVIII. Gesetzgebungsperiode des NR",
"2024-10-24T00:00:00",
"24.10.2024",
"20241024",
null
],
[
"XXVIII",
"2Z797589750013220241024STÄNDIGER UNTERAUSSCHUSS DES HAUPTAUSSCHUSSES79758975",
"Ersatzmitglied",
"Ständiger Unterausschuss des Hauptausschusses (24.10.2024 - 18.12.2024)",
"NR",
"/PAKT/VHG/XXVIII/SA-HA/SA-HA_00001_00912/index.shtml",
"51879",
"Thu Oct 24 02:00:00 CEST 2024",
"Ständiger Unterausschuss des Hauptausschusses",
"Nationalrat",
"ab 24.10.2024: XXVIII. Gesetzgebungsperiode des NR",
"2024-10-24T00:00:00",
"24.10.2024",
"20241024",
null
],
[
"XXVI",
"2Z798288900013120171221AUSSCHUSS FÜR KONSUMENTENSCHUTZ79828778",
"Mitglied",
"Ausschuss für Konsumentenschutz (21.12.2017 - 25.09.2018)",
"NR",
"/PAKT/VHG/XXVI/A-KO/A-KO_00001_00842/index.shtml",
"51879",
"Thu Dec 21 01:00:00 CET 2017",
"Ausschuss für Konsumentenschutz",
"Nationalrat",
"09.11.2017 - 22.10.2019: XXVI. Gesetzgebungsperiode des NR",
"2017-12-21T00:00:00",
"21.12.2017",
"20171221",
null
],
[
"XXVIII",
"2Z797589750013220241024STÄNDIGER UNTERAUSSCHUSS DES BUDGETAUSSCHUSSES79758975",
"Obfrau",
"Ständiger Unterausschuss des Budgetausschusses (24.10.2024 - )",
"NR",
"/PAKT/VHG/XXVIII/SA-BU/SA-BU_00001_00908/index.shtml",
"51879",
"Thu Oct 24 02:00:00 CEST 2024",
"Ständiger Unterausschuss des Budgetausschusses",
"Nationalrat",
"ab 24.10.2024: XXVIII. Gesetzgebungsperiode des NR",
"2024-10-24T00:00:00",
"24.10.2024",
"20241024",
null
]
]
}
@@ -1,23 +0,0 @@
{
"url": "https://www.parlament.gv.at/Filter/api/filter/data/250?js=eval&showAll=true",
"kind": "committees",
"method": "POST",
"params": null,
"json": {
"PAD_INTERN": [
51879
]
},
"meta": {
"pad": "51879",
"name": "Hannes Amesbauer"
},
"content_type": "application/json",
"body_file": "committees.json",
"run_params": {
"periods": [
"XXVII",
"XXVIII"
]
}
}
@@ -677,24 +677,5 @@
"params": null, "params": null,
"skip_unchanged": true, "skip_unchanged": true,
"url": "https://www.parlament.gv.at/Filter/api/filter/data/251?js=eval&showAll=true" "url": "https://www.parlament.gv.at/Filter/api/filter/data/251?js=eval&showAll=true"
},
{
"__type__": "Request",
"conditional": true,
"headers": null,
"json": {
"PAD_INTERN": [
1977
]
},
"kind": "committees",
"meta": {
"name": "Tanja Graf",
"pad": "1977"
},
"method": "POST",
"params": null,
"skip_unchanged": true,
"url": "https://www.parlament.gv.at/Filter/api/filter/data/250?js=eval&showAll=true"
} }
] ]
@@ -1,25 +0,0 @@
[
{
"__type__": "PostRemoved",
"detected_at": "2026-01-01T00:00:00+00:00",
"platform": "x",
"platform_label": "X",
"url": "https://x.com/example/status/222"
},
{
"__type__": "Request",
"conditional": false,
"headers": null,
"json": null,
"kind": "wayback",
"meta": {
"url": "https://x.com/example/status/222"
},
"method": "GET",
"params": {
"url": "https://x.com/example/status/222"
},
"skip_unchanged": false,
"url": "https://archive.org/wayback/available"
}
]
-25
View File
@@ -1,25 +0,0 @@
{
"data": [
{"id": "111", "text": "Still online"}
],
"errors": [
{
"value": "222",
"detail": "Could not find tweet with ids: [222].",
"title": "Not Found Error",
"resource_type": "tweet",
"parameter": "ids",
"resource_id": "222",
"type": "https://api.twitter.com/2/problems/resource-not-found"
},
{
"value": "333",
"detail": "Sorry, you are not authorized to see the Tweet with ids: [333].",
"title": "Authorization Error",
"resource_type": "tweet",
"parameter": "ids",
"resource_id": "333",
"type": "https://api.twitter.com/2/problems/not-authorized-for-resource"
}
]
}
@@ -1,18 +0,0 @@
{
"url": "https://api.x.com/2/tweets",
"kind": "lookup",
"method": "GET",
"params": {
"ids": "111,222,333"
},
"json": null,
"meta": {
"urls": {
"111": "https://x.com/example/status/111",
"222": "https://x.com/example/status/222",
"333": "https://x.com/example/status/333"
}
},
"content_type": "application/json; charset=utf-8",
"body_file": "lookup.json"
}
@@ -1,7 +0,0 @@
[
{
"__type__": "ArchiveCopy",
"archive_url": "https://web.archive.org/web/20260101000000/https://x.com/example/status/222",
"url": "https://x.com/example/status/222"
}
]
-11
View File
@@ -1,11 +0,0 @@
{
"url": "https://x.com/example/status/222",
"archived_snapshots": {
"closest": {
"status": "200",
"available": true,
"url": "http://web.archive.org/web/20260101000000/https://x.com/example/status/222",
"timestamp": "20260101000000"
}
}
}
@@ -1,14 +0,0 @@
{
"url": "https://archive.org/wayback/available",
"kind": "wayback",
"method": "GET",
"params": {
"url": "https://x.com/example/status/222"
},
"json": null,
"meta": {
"url": "https://x.com/example/status/222"
},
"content_type": "application/json",
"body_file": "wayback.json"
}
-75
View File
@@ -142,78 +142,3 @@ def test_firmenbuch_number():
assert firmenbuch_number("FN 306527 a") == firmenbuch_number("FN306527A") == firmenbuch_number("306527a") == "306527a" assert firmenbuch_number("FN 306527 a") == firmenbuch_number("FN306527A") == firmenbuch_number("306527a") == "306527a"
assert firmenbuch_number("ATU12345678") is None assert firmenbuch_number("ATU12345678") is None
def test_parlament_calendar_titles_are_html_decoded():
import json
from politrack.core.runner import make_response, parse_offline
from politrack.sources.parlament.news import ParlamentCalendar
body = {"header": [{"label": "Datum"}, {"label": "Terminart"}, {"label": "Bezeichnung"}, {"label": "Gremium"},
{"label": "Link"}, {"label": "WENTRY_ID"}],
"rows": [["2026-06-10T09:00:00", "Plenarsitzung<BR>NR", "84.&nbsp;Sitzung des Nationalrates", "Nationalrat",
"/termin/1", "1"]]}
events = parse_offline(ParlamentCalendar(), make_response("https://www.parlament.gv.at/x", json.dumps(body).encode(), kind="list"),
params={"since_year": 2026})
assert [e.title for e in events] == ["84. Sitzung des Nationalrates"]
assert events[0].description == "Plenarsitzung NR"
def test_procurement_rejects_implausible_award_dates():
from datetime import date
from politrack.sources.procurement import plausible_date
today = date(2026, 11, 13)
assert plausible_date("2025-02-17", today) == date(2025, 2, 17)
assert plausible_date("1900-12-30", today) is None # spreadsheet placeholder
assert plausible_date("2028-09-30", today) is None # the contract's end, not its award
assert plausible_date(None, today) is None
def test_procurement_placeholder_contractor_and_framework_buyer():
from politrack.sources.procurement import buyer_name, org_ref
assert org_ref({"name": "-"}, "company") is None
assert org_ref({"name": " n/a "}, "company") is None
assert org_ref({"name": "Swietelsky AG"}, "company").name == "Swietelsky AG"
sentence = ("Auftraggeber sind die Republik Österreich (Bund), die Bundesbeschaffung GmbH sowie alle weiteren "
"Auftraggeber gemäß der den Ausschreibungsunterlagen beiliegenden Liste")
assert buyer_name(sentence) == ("Bundesbeschaffung GmbH", sentence)
assert buyer_name("ASFINAG Alpenstraßen GmbH") == ("ASFINAG Alpenstraßen GmbH", None)
def test_source_freshness_alerts_after_two_missed_slots():
from datetime import datetime, timezone
from politrack.queries.admin import source_freshness
class Conn:
def __init__(self, rows):
self.rows = rows
def execute(self, *_):
return self.rows
now = datetime(2026, 11, 13, 12, 0, tzinfo=timezone.utc)
daily = "15 3 * * *"
rows = [{"adapter": "fresh", "at": datetime(2026, 11, 13, 3, 40, tzinfo=timezone.utc)},
{"adapter": "one_missed", "at": datetime(2026, 11, 12, 3, 40, tzinfo=timezone.utc)},
{"adapter": "two_missed", "at": datetime(2026, 11, 11, 3, 40, tzinfo=timezone.utc)}]
result = {r["adapter"]: r["stale"] for r in source_freshness(
Conn(rows), {"fresh": daily, "one_missed": daily, "two_missed": daily, "never": daily}, now)}
assert result == {"fresh": False, "one_missed": False, "two_missed": True, "never": True}
def test_election_preferences_eu_layouts():
from politrack.sources.elections import parse_preferences, split_name
assert split_name("Babler, MSc, Andreas") == ("Babler", "Andreas")
assert split_name("Brunner, Dr. Magnus") == ("Brunner", "Dr. Magnus")
eu2019 = [("ÖVP", [(None, "Kandidat(in)", "BGLD", "Gesamt"), (1, "Karas, Dr. Othmar ", 3012, 103035)])]
eu2024 = [("ÖVP", [("LP", "Bewerber(in)", "BGLD", "Gesamt", None, "Darstellung", None, None),
(None, None, None, None, None, "(LP)", "Bewerber(in)", "Gesamt"),
(1, "Lopatka, Dr. Reinhold", 2268, 58013, None, 3, "Bernhuber, Alexander", 44641)])]
assert [(c["name"], c["votes"]) for c in parse_preferences("eu", eu2019)] == [("Dr. Othmar Karas", 103035)]
assert [(c["name"], c["votes"]) for c in parse_preferences("eu", eu2024)] == [("Dr. Reinhold Lopatka", 58013)]
-33
View File
@@ -1,33 +0,0 @@
#!/bin/sh
# Nightly database backup, run by the `backup` service in docker-compose.yml.
# Writes politrack-YYYY-MM-DD.dump (pg_dump custom format) to /backups at 02:30 UTC, deletes dumps older than
# $BACKUP_KEEP_DAYS days, and records each attempt as a run of "backup", so /api/v1/status/sources alerts
# when backups stop. Restore: pg_restore -h <host> -U politrack -d politrack --clean <file>
set -u
KEEP="${BACKUP_KEEP_DAYS:-14}"
export PGHOST=db PGUSER=politrack PGDATABASE=politrack
record() { # record <status> <json stats>
psql -q -c "INSERT INTO run (adapter, mode, status, finished_at, stats) VALUES ('backup', 'backup', '$1', now(), '$2'::jsonb)" \
|| echo "could not record the backup run"
}
while true; do
now=$(date -u +%s)
next=$(date -u -d "today 02:30" +%s)
[ "$next" -le "$now" ] && next=$(date -u -d "tomorrow 02:30" +%s)
echo "next backup at $(date -u -d "@$next")"
sleep $((next - now))
file="/backups/politrack-$(date -u +%F).dump"
if pg_dump -Fc -f "$file.tmp" && mv "$file.tmp" "$file"; then
size=$(stat -c %s "$file")
echo "backup ok: $file ($size bytes)"
record ok "{\"file\": \"$(basename "$file")\", \"bytes\": $size}"
else
rm -f "$file.tmp"
echo "backup FAILED"
record error '{}'
fi
find /backups -name 'politrack-*.dump' -mtime "+$KEEP" -delete
done
-26
View File
@@ -9,12 +9,9 @@ x-backend: &backend
environment: environment:
POLITRACK_DATABASE_URL: postgresql://politrack:${POSTGRES_PASSWORD}@db:5432/politrack POLITRACK_DATABASE_URL: postgresql://politrack:${POSTGRES_PASSWORD}@db:5432/politrack
POLITRACK_RAW_DIR: /data/raw POLITRACK_RAW_DIR: /data/raw
POLITRACK_LOG_DIR: /data/logs
volumes: volumes:
# Raw-response archive: lets `politrack reparse` rebuild data after parser fixes without refetching. # Raw-response archive: lets `politrack reparse` rebuild data after parser fixes without refetching.
- ${DATA_DIR:-./data}/raw:/data/raw - ${DATA_DIR:-./data}/raw:/data/raw
# Worker logs (<service>.log, rotating), kept across redeploys.
- ${DATA_DIR:-./data}/logs:/data/logs
depends_on: depends_on:
db: db:
condition: service_healthy condition: service_healthy
@@ -65,34 +62,16 @@ services:
# another machine pointed at this database. # another machine pointed at this database.
worker-scrape: worker-scrape:
<<: *worker <<: *worker
hostname: worker-scrape # names the log file
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=scrape,social", "--concurrency=2"] command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=scrape,social", "--concurrency=2"]
worker-bulk: worker-bulk:
<<: *worker <<: *worker
hostname: worker-bulk
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=bulk", "--concurrency=1"] command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=bulk", "--concurrency=1"]
worker-enrich: worker-enrich:
<<: *worker <<: *worker
hostname: worker-enrich
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=enrich", "--concurrency=1"] command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=enrich", "--concurrency=1"]
# Nightly pg_dump at 02:30 UTC into ${BACKUP_DIR}, kept for ${BACKUP_KEEP_DAYS} days (see backup.sh).
backup:
image: pgvector/pgvector:pg16
restart: unless-stopped
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
BACKUP_KEEP_DAYS: ${BACKUP_KEEP_DAYS:-14}
volumes:
- ./backup.sh:/backup.sh:ro
- ${BACKUP_DIR:-./data/backups}:/backups
entrypoint: ["sh", "/backup.sh"]
depends_on:
db:
condition: service_healthy
mcp: mcp:
<<: *worker <<: *worker
command: ["politrack", "mcp"] command: ["politrack", "mcp"]
@@ -105,11 +84,6 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
API_INTERNAL_URL: http://api:8000 API_INTERNAL_URL: http://api:8000
POLITRACK_USER_AGENT: ${POLITRACK_USER_AGENT:-}
POLITRACK_LEGAL_NAME: ${POLITRACK_LEGAL_NAME:-}
POLITRACK_LEGAL_ADDRESS: ${POLITRACK_LEGAL_ADDRESS:-}
POLITRACK_LEGAL_EMAIL: ${POLITRACK_LEGAL_EMAIL:-}
POLITRACK_CORRECTIONS_EMAIL: ${POLITRACK_CORRECTIONS_EMAIL:-}
ports: ports:
- "${WEB_PORT:-3000}:3000" - "${WEB_PORT:-3000}:3000"
depends_on: depends_on:
+1 -1
View File
@@ -59,7 +59,7 @@ parsers, archive-first, per-publisher legal policy) – see ADR-20.
## Interfaces for other agents ## Interfaces for other agents
1. **MCP** – `http://<host>:8001/mcp`: `search`, `find_person`, `get_person`, `person_network`, 1. **MCP** – `http://<host>:8001/mcp`: `search`, `find_person`, `get_person`, `person_network`,
`list_parties`, `get_party`, `find_organization`, `get_organization`, `list_claims`, `get_claim`, `money_flows`, `list_parties`, `get_party`, `find_organization`, `get_organization`, `list_claims`, `money_flows`,
`social_posts`, `wikipedia_edits`, `calendar`, `person_votes`, `former_politicians`, `list_topics`. `social_posts`, `wikipedia_edits`, `calendar`, `person_votes`, `former_politicians`, `list_topics`.
2. **REST** – `http://<host>:8000/api/docs` (OpenAPI 3). 2. **REST** – `http://<host>:8000/api/docs` (OpenAPI 3).
3. **SQL** – role `politrack_reader`; start with the view `claim_with_evidence`; `\d+ claim` shows the 3. **SQL** – role `politrack_reader`; start with the view `claim_with_evidence`; `\d+ claim` shows the
@@ -81,9 +81,8 @@ no public channels and groups are private by design.
**Context.** Many Austrian politicians are most active on X; proxies such as Nitter work by violating **Context.** Many Austrian politicians are most active on X; proxies such as Nitter work by violating
X's terms. **Decision.** `social.x` uses the official API v2 with the operator's bearer token and does X's terms. **Decision.** `social.x` uses the official API v2 with the operator's bearer token and does
nothing without one. It keeps no raw archive and no full text (`keep_raw=False`, `store_fulltext=False`). nothing without one. It keeps no raw archive and no full text (`keep_raw=False`, `store_fulltext=False`).
The Developer Agreement requires removing posts deleted on X. For accountability we mark instead of erase: The Developer Agreement requires removing posts deleted on X; until a deletion sync exists the adapter is
`social.x_deletions` clears every copy of the text and keeps a record that the post existed and disappeared documented as not production-ready.
(a new `PostRemoved` record, so the Loader stays the only writer).
### ADR-23: Organisation-owned accounts ### ADR-23: Organisation-owned accounts
**Context.** Party and institution channels (MFG on Telegram, NEOS and the Federal President on Bluesky) **Context.** Party and institution channels (MFG on Telegram, NEOS and the Federal President on Bluesky)
-71
View File
@@ -1,71 +0,0 @@
# Coding agents
Coding agents (Claude Code) work on this repository in a sandbox from
[agent-envs](https://git.disi.dev/AICode/agent-envs): a Linux container whose only way out is an
egress proxy with an allowlist. The proxy also adds the Gitea token to requests, so the agent never
holds it. This page covers setting that up for Politrack; [AGENTS.md](../../AGENTS.md) is what the
agent itself reads.
## Setup
1. Prepare the computer once, as described in agent-envs'
[docs/setup.md](https://git.disi.dev/AICode/agent-envs/src/branch/main/docs/setup.md): Docker, the
registry login, the 1Password CLI and, for VS Code, the Dev Containers settings.
2. In 1Password's `Agents` vault, create an API Credential item `gitea-politics-tracking` with the
`username` and an access token (`credential`) of a Gitea bot user. Make that user a collaborator
on `AIPlayground/politics-tracking` only, with write access. Protect `main` so the agent works
through pull requests.
3. In agent-envs, `cp projects/politics-tracking/.env.example projects/politics-tracking/.env` and set
`WORKSPACE` to this checkout.
4. Set the commit identity in this checkout, once. The sandbox uses the same `.git`, so its commits
get it too:
```bash
git config user.name "Simon Diesenreiter"
git config user.email simon@disi.dev
```
5. Start a session from anywhere: `agent politics-tracking` (Claude in the terminal) or
`agent politics-tracking code` (VS Code attached to the sandbox).
## What the sandbox can reach
| What | Hosts | For |
|---|---|---|
| Claude Code | `api.anthropic.com`, `claude.ai`, `platform.claude.com`, `console.anthropic.com` | the agent itself |
| Gitea | `git.disi.dev` (DELETE requests blocked) | push, pull requests through the API, as the bot user |
| Packages | `pypi.org`, `files.pythonhosted.org`, `registry.npmjs.org` | dependencies (see the limits below) |
| Sources | Parlament, data.gv.at, RTR, Rechnungshof, Justiz, Bundeskanzleramt, OTS, the European Parliament, data.europa.eu, Wikidata, German Wikipedia | capturing fixtures, short test runs |
| VS Code | the extension marketplace | installing the Claude Code extension in the sandbox |
The exact list is in agent-envs, `projects/politics-tracking/egress.yaml`. Media sites and social
networks are not included; add a host there when a task needs it, and only one that the source's
legal checklist ([adapters.md](adapters.md#0-before-writing-code-the-legal-checklist)) allows.
Everything else, and anything that isn't HTTP(S) (SSH, database connections), is blocked.
## The sandbox image
Politrack runs in its own sandbox image: the agent-envs agent image plus the backend's dependencies
as Debian packages. It is the `sandbox` target of
[backend/tests/Dockerfile.debian](../../backend/tests/Dockerfile.debian), the same package list as the
[PyPI-free test image](testing.md#without-pypi-access), so `cd backend && python3 -m pytest` works in
the sandbox without downloading anything. agent-envs builds it from this checkout at every start;
unchanged, that takes seconds from the cache.
Keep the list in step with `backend/pyproject.toml` (AGENTS.md says so too). Debian doesn't package
`procrastinate`, `mcp` and `ruff`, so the workers, the MCP server and linting don't run in the
sandbox.
## Limits
- **No Docker** in the sandbox: no compose stack.
- **No database:** the compose `db` on the host isn't reachable from the sandbox, so adapter runs that
write claims and [the database checks](testing.md#against-a-real-database) have to run outside it.
- **On the owner's PC**, PyPI and npm downloads fail inside the sandbox too (the same network filter;
see AGENTS.md): no `pip install` of new packages and no `npm install` for the frontend there.
- Claude's memory in the sandbox is separate from the one on the host. Rules that must always hold
belong in AGENTS.md, not in memory.
## Changing what the agent can reach or knows
All of it lives in agent-envs, not in this repository: hosts in `projects/politics-tracking/egress.yaml`,
kits (Gitea, Python, Node, VS Code) in `projects/politics-tracking/compose.yaml`, the token in
1Password. Instructions for the agent stay in this repository's AGENTS.md.
+22 -57
View File
@@ -1,25 +1,17 @@
# Extending the web app # Extending the web app
Next.js 15 (App Router, React Server Components) with next-intl (German default, English). Pages fetch Next.js 15 (App Router, React Server Components) with next-intl (German default, English). Pages fetch
from the API on the server; there is almost no client-side JavaScript. How it should look and why: from the API on the server; there is almost no client-side JavaScript.
[design/README.md](../design/README.md) (concept) and [design/design-system.md](../design/design-system.md)
(tokens, components, content rules).
``` ```
web/ web/
messages/de.json, en.json all UI text (keys must exist in both) messages/de.json, en.json all UI text (keys must exist in both)
src/app/[locale]/<route>/page.tsx pages (German route names: /personen, /parteien, /geld …) src/app/[locale]/<route>/page.tsx pages (German route names: /personen, /parteien, /geld …)
src/app/[locale]/layout.tsx frame: header, footer, theme, stylesheets src/components/ shared server components
src/app/[locale]/loading.tsx, error.tsx, not-found.tsx
src/app/icon.svg favicon
src/components/ shared components (catalogue: design-system.md §4)
src/components/nav.ts site structure for header, menu and footer
src/styles/ tokens, base, layout, components, print
src/lib/api.ts typed API client (server-side only; reads the filter cookie) src/lib/api.ts typed API client (server-side only; reads the filter cookie)
src/lib/api-types.ts GENERATED from the backend's response models – do not edit src/lib/api-types.ts GENERATED from the backend's response models – do not edit
src/lib/format.ts dates, periods, numbers, money, party colours src/lib/format.ts dates, money, localized names
src/lib/prefs.ts the visitor's source/topic filter and theme (cookies) src/lib/prefs.ts the user's source/topic filter (cookie)
src/lib/roles.ts role labels
``` ```
## Types come from the backend ## Types come from the backend
@@ -33,56 +25,34 @@ cd ../web && npm run typecheck
`api.ts` re-exports the generated types (`Claim`, `MoneyFlow`, …) and adds one function per endpoint. `api.ts` re-exports the generated types (`Claim`, `MoneyFlow`, …) and adds one function per endpoint.
`api.claims()`, `api.money()`, `api.social()` … automatically apply the visitor's source filter `api.claims()`, `api.money()`, `api.social()` … automatically apply the visitor's source filter
(`withPrefs`), so every list respects "which sources do I trust". `api.claim(id)` deliberately does not: (`withPrefs`), so every list respects "which sources do I trust".
a permalink shows the same to everyone.
## Adding a page ## Adding a page
1. Create `src/app/[locale]/<route>/page.tsx` – an async server component built from the shared parts: 1. Create `src/app/[locale]/<route>/page.tsx` – an async server component:
```tsx ```tsx
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'MyPage'});
return {title: t('title')};
}
export default async function Page({params, searchParams}: Props) { export default async function Page({params, searchParams}: Props) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
const sp = await searchParams;
const t = await getTranslations('MyPage'); const t = await getTranslations('MyPage');
const page = Math.max(1, Number(sp.page) || 1); const rows = await api.something({...});
const rows = await api.something({kind: sp.kind, limit: PAGE, offset: (page - 1) * PAGE}); return <>…</>;
return (
<>
<PageHeader title={t('title')} lede={t('intro')} />
<FilterBar id="mypage" active={countActive(sp.kind)} resetHref="/meine-seite">
<Field label={t('kind')}><select name="kind" defaultValue={sp.kind ?? ''}>…</select></Field>
</FilterBar>
{rows.length === 0 ? <EmptyState>{t('none')}</EmptyState> : <ul className="grid-cards">…</ul>}
<Pagination pathname="/meine-seite" query={sp} page={page} hasNext={rows.length === PAGE} />
</>
);
} }
``` ```
Filters are plain GET forms – shareable URLs, no client state. Filters are plain `<form method="get">` – shareable URLs, no client state.
2. Add the texts to **both** `messages/de.json` and `messages/en.json`. 2. Add the texts to **both** `messages/de.json` and `messages/en.json`.
3. Add it to the site structure in `src/components/nav.ts` (primary, "Mehr" or a footer group) or link it 3. Link it from the navigation (`src/app/[locale]/layout.tsx`) or the home page's "Entdecken" cards.
from the home page's "Entdecken" cards.
4. Page modules may only export Next.js page fields (`default`, `generateMetadata`, …); keep helpers and 4. Page modules may only export Next.js page fields (`default`, `generateMetadata`, …); keep helpers and
constants module-local or in `src/components`. constants module-local or in `src/components`.
5. Check it at 390 px and in both themes (design-system.md §7). `node web/scripts/mobile-audit.mjs` emulates a
phone, reports pages that scroll sideways (and which elements cause it) and saves screenshots; the
script's header shows how to call it. All pages passed on 2026-11-12.
## Showing a new claim type ## Showing a new claim type
Claims render through `ClaimList` → `ClaimCard`; type-specific details come from the registry in Claims render through `ClaimList`; type-specific details come from the registry in
`src/components/ClaimDetails.tsx`: `src/components/ClaimDetails.tsx`:
```tsx ```tsx
const ambassador: Renderer = (claim, {t}) => ( const ambassador: Renderer = (claim, {t}) => (
<p className="claim-detail">{t('country')}: {String(claim.data.country ?? '')}</p> <p className="claim-detail small">{t('country')}: {String(claim.data.country ?? '')}</p>
); );
const DETAILS: Partial<Record<ClaimType, Renderer[]>> = { const DETAILS: Partial<Record<ClaimType, Renderer[]>> = {
@@ -91,26 +61,21 @@ const DETAILS: Partial<Record<ClaimType, Renderer[]>> = {
}; };
``` ```
Also add an icon to `TYPE_ICONS` in `src/components/badges.tsx`, the label under Also add the label under `Claims.type.<claim_type>` in both message files, and (if it should appear) the
`Claims.type.<claim_type>` in both message files, and (if it should appear) the type to the person page's type to the person page's `TABS`.
`TABS`.
## Non-negotiables in the UI ## Non-negotiables in the UI
* **Every fact shows its sources** (the evidence disclosure under each claim, source chips in tables). * **Every fact shows its sources** (the "Quellen" disclosure under each claim, `[source]` links in
Don't render a claim without its evidence. tables). Don't render a claim without its evidence.
* **Presumption of innocence:** `needsInnocenceNotice()` in `ClaimList.tsx` decides; the notice stays inside * **Presumption of innocence:** `needsInnocenceNotice()` in `ClaimList.tsx` decides; never remove the
the claim card. Never remove it for anything but an undisputed final conviction. notice for anything but an undisputed final conviction.
* **Connections are not accusations:** sections that show networks or money of connected organisations * **Connections are not accusations:** pages that show networks or money of connected organisations
carry the note (`Network.note`, `Organizations.connectionNote`). carry the note (`Network.note`, `Organizations.connectionNote`).
* **Neutral colours:** party colours only through `partyStyle()` as dots and thin bars, next to the name.
* Unverified social accounts are marked (Wikidata-only handles). * Unverified social accounts are marked (Wikidata-only handles).
* No third-party scripts, fonts, embeds or trackers.
## Styling ## Styling
Global CSS with design tokens, one section per component in `src/styles/components.css`. Use tokens One global stylesheet (`src/app/globals.css`) with CSS variables for light/dark mode. Reuse the existing
(`var(--ink-2)`, `var(--space-4)`) instead of raw values, reuse the components and layout utilities classes (`claims`, `claim-detail`, `chip`, `tag`, `notice`, `grid-2`, `compact`, `num`, `muted`, `small`)
listed in [design-system.md](../design/design-system.md), and add a new section (and a row in its before adding new ones.
component table) when you create a component. A new token goes into all three blocks of `tokens.css`
(light, dark by preference, dark by choice).
-18
View File
@@ -16,24 +16,6 @@ UPDATE_GOLDEN=1 pytest tests/test_golden.py # regenerate expected outputs (rev
Parsers are pure, so none of these needs a database or network. Parsers are pure, so none of these needs a database or network.
### Without PyPI access
`tests/Dockerfile.debian` installs the dependencies from Debian packages instead (everything except
`procrastinate` and `mcp`, which the tests don't need):
```bash
docker build -t politrack-test -f backend/tests/Dockerfile.debian backend/tests
docker run --rm -v "$PWD/backend:/app" politrack-test python3 -m pytest -q -p no:cacheprovider
```
The test image can also run adapters against the compose database: add
`--network politics-tracking_default` and
`-e POLITRACK_DATABASE_URL=postgresql://politrack:<password>@db:5432/politrack`, then
`python3 -m politrack.cli run <adapter> --max-requests 20`.
The same package list builds the agent sandbox image (target `sandbox`, see
[agents.md](agents.md#the-sandbox-image)), so keep it in step with `pyproject.toml`.
## Golden fixtures ## Golden fixtures
``` ```
+1 -5
View File
@@ -69,12 +69,8 @@ counterpart (`counterpart_person_id`, `counterpart_org_id`), time (`occurred_at`
| `government_decision` | – | Council of Ministers minutes | | `government_decision` | – | Council of Ministers minutes |
| `wiki_edit` | – | Wikipedia edits from institutional IP ranges (subject = network owner) | | `wiki_edit` | – | Wikipedia edits from institutional IP ranges (subject = network owner) |
| `declaration` | – | EP declarations of interests | | `declaration` | – | EP declarations of interests |
| `ownership`, `affiliation` | – | party reports (holdings, affiliated organisations), committee memberships | | `ownership`, `affiliation` | – | party reports (holdings, affiliated organisations) |
| `party_finance` | – | party annual reports (totals in `data`) | | `party_finance` | – | party annual reports (totals in `data`) |
| `election_result` | – | BMI: a party's votes in Austria or a state (counterpart = elected body), a candidate's preference votes (counterpart = party) |
EP votes on amendments and parts of a text: `vote_event.part_vote` and `claim.data.part_vote` are true; general
lists, counts and search chunks leave them out (`NOT_PART_VOTE` in `queries/common.py`).
**Status:** `reported` (one source) → `corroborated` (≥ 2 distinct sources support/mention it) or **Status:** `reported` (one source) → `corroborated` (≥ 2 distinct sources support/mention it) or
`disputed` (a source contradicts). Computed by the Loader on every new piece of evidence and by `disputed` (a source contradicts). Computed by the Loader on every new piece of evidence and by
+6 -16
View File
@@ -23,10 +23,6 @@
docker compose build docker compose build
docker compose up -d docker compose up -d
``` ```
Docker creates `${DATA_DIR}/raw` and `${DATA_DIR}/logs` as root, but the backend runs as a non-root user, and
every fetch then fails with "Permission denied". Hand them over once after the first `up`:
`chown -R "$(docker run --rm --entrypoint id politrack-backend -u):$(docker run --rm --entrypoint id politrack-backend -g)" "$DATA_DIR/raw" "$DATA_DIR/logs"`.
`migrate` runs once (schema, seed data, source registry, job-queue tables), then `api`, `web`, `mcp` `migrate` runs once (schema, seed data, source registry, job-queue tables), then `api`, `web`, `mcp`
and three workers start: and three workers start:
@@ -76,11 +72,11 @@ bge-m3 runs fine on CPU for this data volume. With an NVIDIA GPU, add a device r
## Backups ## Backups
* Database: the `backup` service dumps it every night at 02:30 UTC to `BACKUP_DIR` (default `./data/backups`; * Database: a nightly `pg_dump`, e.g. with the **User Scripts** plugin:
better a different share, e.g. `/mnt/user/backups/politrack`) and keeps `BACKUP_KEEP_DAYS` (14) days. Each dump is ```bash
recorded as a run of `backup`, so the status endpoint below alerts when backups stop. Restore with docker exec politrack-db-1 pg_dump -U politrack -Fc politrack > /mnt/user/backups/politrack/$(date +%F).dump
`pg_restore -h localhost -p 5433 -U politrack -d politrack --clean <file>`. For off-site copies, sync `BACKUP_DIR` find /mnt/user/backups/politrack -mtime +30 -delete
elsewhere. ```
* Raw archive (`${DATA_DIR}/raw`): optional to back up – it saves refetching after parser fixes, and it can * Raw archive (`${DATA_DIR}/raw`): optional to back up – it saves refetching after parser fixes, and it can
be pruned (`find raw -mtime +365 -delete`); missing blobs are simply refetched. be pruned (`find raw -mtime +365 -delete`); missing blobs are simply refetched.
@@ -96,13 +92,7 @@ bge-m3 runs fine on CPU for this data volume. With an NVIDIA GPU, add a device r
* `GET /api/v1/admin/runs` with `Authorization: Bearer $POLITRACK_ADMIN_TOKEN`. * `GET /api/v1/admin/runs` with `Authorization: Bearer $POLITRACK_ADMIN_TOKEN`.
* Fetch log: `SELECT adapter, status, count(*) FROM fetch_log WHERE fetched_at > now() - interval '1 day' GROUP BY 1, 2;` * Fetch log: `SELECT adapter, status, count(*) FROM fetch_log WHERE fetched_at > now() - interval '1 day' GROUP BY 1, 2;`
* Job queue: `SELECT task_name, status, count(*) FROM procrastinate_jobs GROUP BY 1, 2;` * Job queue: `SELECT task_name, status, count(*) FROM procrastinate_jobs GROUP BY 1, 2;`
* `GET /api/v1/status/sources` returns HTTP 503 as soon as a scheduled source (or the backup) missed its last two * Uptime Kuma can poll `http://api:8000/healthz`.
slots, and lists every task with its last successful run: point an HTTP monitor (Uptime Kuma) at it.
`/healthz` only checks that the API reaches the database.
* The `watchdog` task (every 10 minutes) fails jobs of dead workers, closes abandoned runs and starts any scheduled
source whose last slot was missed (Procrastinate skips slots that are more than ten minutes overdue).
* Worker logs: `${DATA_DIR}/logs/worker-*.log` (rotating), kept across redeploys; `docker compose logs` only covers
the current containers.
## Troubleshooting ## Troubleshooting
-478
View File
@@ -1,478 +0,0 @@
# Politrack design concept
How Politrack looks, reads and behaves, and why. This is the concept: goals, principles, information
architecture, the core patterns and a concept for every page. The companion
[design-system.md](design-system.md) is the implementation reference: tokens, components, CSS
conventions and recipes for contributors.
Items marked **(later)** are designed here but not built yet; everything else is implemented in `web/`.
## 1. Goals
Politrack is a public record of what Austrian politicians do, where every fact links to its source.
The interface has four jobs, in this order:
1. **Make every fact checkable.** A reader is never more than one click from the document behind a
statement on the screen.
2. **Be fair to everyone shown.** The same layout, wording and weight for every person and party; the
presumption of innocence and the limits of the data are visible where they matter, not in a footer.
3. **Answer common questions fast, on a phone.** "Who is this?", "How did they vote?", "Who gave money to
whom?" in a few seconds, with no app and no account.
4. **Support deep research on a desk.** Dense tables, filters in the URL, time ranges, cross-links between
people, organisations and money, and stable links for citing.
## 2. Audiences and their tasks
| Audience | Context | Top tasks | What the UI must provide |
|---|---|---|---|
| Interested citizens | Phone, linked from news or social media, a few minutes | Look up a politician, a party's votes, donations | Search first, plain language, clear summaries, a readable profile on a small screen |
| Journalists and researchers | Desktop, long sessions, need to cite | Follow money between organisations, build a timeline, check a claim | Filters and date ranges in the URL, dense tables, permalinks per fact, source details, consistent numbers |
| NGOs and activists | Desktop and phone, recurring | Monitor topics and people | Topic filters, calendar, (later) alerts |
| The people profiled and their staff | Desktop | Check what is shown about them | Fair presentation, visible sources, (later) a corrections form |
| AI agents | No UI (MCP server, REST API) | Retrieve facts with evidence | Mentioned in the footer and methodology; the UI never shows anything the API doesn't |
## 3. Principles
Each principle comes with the rules that make it concrete.
**P1 Evidence first.** The atom of the interface is the *claim card*: a one-sentence summary plus its
sources. Rules: the number of sources is always visible; the source list is one click away; every
external link opens the original; quotes are shown as quotes (marked, attributed); there is no UI
element that states a fact without a claim behind it.
**P2 Neutral by design.** Rules: the interface accent is a colour no Austrian party uses (an ink indigo,
not the flag red, which reads as SPÖ red); party colours appear only as small identity markers (a dot or
a thin bar) and always next to the party's name, never as large backgrounds; every party and person gets
the same layout; lists are ordered by neutral criteria (date, size, alphabet); copy uses reporting verbs
("laut", "gemeldet", "berichtet") instead of judgement.
**P3 Show certainty honestly.** One vocabulary for how sure we are (see §6.3), shown the same way
everywhere: single vs. multiple sources, disputed facts, unverified accounts, unconfirmed status,
publication date vs. event date.
**P4 Fairness for legal matters.** The procedural stage is the headline of a legal claim; "Es gilt die
Unschuldsvermutung" sits inside the claim card, not in a footnote; legal claims are styled in a neutral
caution tone, never in alarm red; no portraits inside legal claim cards or feeds of allegations; connections
between people and organisations carry the note that a connection is not an accusation; profile overviews
highlight work (votes, speeches, offices), not allegations.
**P5 Plain language, German first.** German is the default at `/`, English at `/en`. Technical terms
(namentliche Abstimmung, Klub, Ministerrat, Diversion) are explained where they appear. Long German
compounds must not break layouts: hyphenation is on and long tokens may wrap.
**P6 Time is a first-class dimension.** Every list can be narrowed to a date range, profiles have a
timeline, a calendar shows what happened on a day, and "search in time" lists everything in a period.
Dates say what they are ("Datum = Veröffentlichung der Quelle" where we only know the publication date).
**P7 Fast, robust, accessible, private.** Server-rendered pages that work without JavaScript; WCAG 2.2
AA; system fonts; no third-party scripts, fonts, embeds or trackers; print stylesheets that keep source
URLs.
**P8 Shareable and citable.** Filters live in the URL; every claim has a permalink page with a ready-made
citation; page titles name the person or topic.
## 4. Brand and tone
**Name and mark.** *politrack* in lowercase, set in the system font at heavy weight. The mark is a pair of
square brackets around a dot: the citation bracket of a footnote with the piece of evidence inside. It is
the favicon too. Tagline: *Österreichs Politik, belegt.*
**Colour stance.** Near-monochrome "paper and ink" neutrals carry the interface. One accent, an ink indigo,
marks interaction (links, focus, active navigation, magnitude bars). A highlighter yellow marks quoted
evidence and search hits. Semantic colours (positive, negative, caution) appear only in small badges and
always with an icon and a word, never as colour alone. Party colours follow the rules in P2.
**Voice.** Sachlich, precise, friendly. We address readers with "du" (as the existing copy does) and use
gender-inclusive forms with a colon (Politiker:innen). We describe what a source says, with the source:
"Laut Rechnungshof spendete …", not "X kaufte sich Einfluss". Numbers are exact where the source is exact
and labelled as reported ("Beträge wie gemeldet").
## 5. Information architecture
### Sitemap
```
/ Start: search, key figures, latest facts, explore
/suche Search (full text and "search in time": a date range without a query)
/personen People (filters: party, level, status)
/personen/{slug} Profile with tabs: overview, timeline, votes, travel & meetings,
statements, social media, money & network, media & career, legal
/ehemalige Former politicians: what they do now
/parteien Parties
/parteien/{slug} Party: officials, votes, money, finances, affiliated organisations, channels
/organisationen Organisations (companies, associations, authorities, media, lobbies)
/organisationen/{slug} Organisation: money in and out, counterparties, connected people
/geld Money explorer: donations, contracts, ads, subsidies, party funding
/abstimmungen Votes (faction votes; roll calls)
/abstimmungen/{id} Vote: result, factions, individual votes, dissent
/kalender Calendar: sessions, committees, hearings, Council of Ministers, trips, meetings
/social Public posts from politicians' and parties' channels
/wikipedia Wikipedia edits from parliament and government networks
/angaben/{id} Claim permalink: one fact with all its sources and a citation
/einstellungen My filters: trusted sources, topics
/methodik Methodology, statuses, legal stages, sources and their terms
```
Route names are German in both languages (`/en/personen/…`): one URL scheme, links stay valid when
switching language.
### Navigation
* **Header**, primary: Personen, Parteien, Abstimmungen, Geld, Organisationen, Kalender; **Mehr**:
Social Media, Wikipedia-Bearbeitungen, Ehemalige, Methodik & Quellen. Utilities: a search field,
*Meine Filter* with the number of active filters, language, light/dark theme. Below 1024 px the
navigation collapses into a menu (a native disclosure, no JavaScript) and the search field becomes a
search button.
* **Footer**: the full sitemap in three groups (Menschen, Entscheidungen, Geld & Einfluss), the
principles in three lines, links for developers and agents.
* **Breadcrumbs** on every detail page (Start › Personen › Name).
* **Cross-links everywhere**: every person, party and organisation name is a link; money rows link both
sides; lists on profiles end with a "Alle …" link into the explorer, pre-filtered.
### URL conventions
All filters are query parameters on plain GET forms (`/geld?kind=donation&since=2025-01-01`), so every view
can be bookmarked and shared. Personal source/topic preferences are the only state kept outside the URL
(a cookie), and the header always shows when they are active.
## 6. Core patterns
### 6.1 The claim card
```
┌──────────────────────────────────────────────────────────────────────┐
│ ◇ SPENDE · 12. März 2026 · Österreichische Volkspartei ●●○ 2 │ type, date, subject, sources
│ │
│ Die Muster GmbH spendete der ÖVP 25.000 €. │ summary (the fact)
│ 25.000 € · Muster GmbH → ÖVP · 2025 │ type-specific details
│ [Wirtschaft] [Parteifinanzen] │ topics
│ ▸ 2 Belege Permalink ↗ │ evidence disclosure
└──────────────────────────────────────────────────────────────────────┘
```
* The header row is metadata in small type: type label with icon, date, subject (when the list mixes
subjects), and the **source meter** on the right.
* The summary is the largest text in the card. In English the English summary is used when available.
* Type-specific details (amounts, counterparts, platforms, file numbers) come from a registry, one renderer
per claim type.
* The evidence disclosure lists each source with its publisher, source kind (Amtlich, Medien, …), title,
date, stance (supports / mentions / contradicts) and quote. Quotes are set as block quotes with the
highlighter mark.
* A **permalink** opens the claim page (§7.17).
* Disputed claims get a caution edge and the word "umstritten". Claims awaiting review are never public;
if one is shown (admin views) it carries "Noch nicht redaktionell geprüft".
### 6.2 Evidence and corroboration
The source meter shows up to three dots: one filled dot = one source ("einfach belegt"), two or more
filled = "mehrfach belegt" with the number. A disputed claim shows a caution triangle and the word
"umstritten" instead. A tooltip gives the full wording ("bestätigt durch 3 unabhängige Quellen"). The meter
never stands alone: the number is always written next to it.
### 6.3 Certainty vocabulary
| Concept | Values (German UI) | Shown as |
|---|---|---|
| Claim status | einfach belegt · mehrfach belegt · umstritten | source meter; caution edge for umstritten |
| Person status | Aktiv · Ehemalig · Ohne Amt (Parteimitglied) · Verstorben | status badge; "Aktiv" without an official confirmation adds "nicht amtlich bestätigt" |
| Social account | bestätigt · nicht bestätigt | unconfirmed accounts get a dashed badge and a tooltip (source: Wikidata only) |
| Review | Noch nicht redaktionell geprüft | caution notice (admin views only) |
| Dates | Ereignisdatum · Veröffentlichungsdatum | footnote on calendar and trips: "Datum = Veröffentlichungsdatum der Quelle" |
| Amounts | wie gemeldet · Kategorie | exact amount, or the reported category ("über 50.000 €") |
### 6.4 Legal matters
```
┌──────────────────────────────────────────────────────────────────────┐
│ ⚖ VERFAHREN · 3. Februar 2026 · Name ●○○ 1 │
│ [Ermittlungsverfahren] § 302 StGB · WKStA │ stage first, as a badge
│ Summary of what the source reports … │
│ ⓘ Es gilt die Unschuldsvermutung. │ inside the card
│ ▸ 1 Beleg │
└──────────────────────────────────────────────────────────────────────┘
```
The notice is shown for every stage except an undisputed final conviction (including acquittals,
dropped proceedings and diversion, which confirm there is no finding of guilt). Automatically detected
legal claims stay in review until a human approves them. Profiles count legal claims only on their tab,
never in the "at a glance" figures.
### 6.5 Money
* Amounts in euro with locale formatting (`25.000 €`, `€25,000`); large figures in summaries and bar
lists are compact (`1,2 Mio. €`) with the exact value in the tooltip; tables show exact values.
* Direction is always explicit: **Von → An**. Both sides are links when the organisation is known.
* Every amount says what kind of money it is (Spende, öffentlicher Auftrag, Regierungsinserat, Förderung,
Parteienförderung, politische Werbung, Kredit). Different kinds are never summed into one figure
without a label.
* "Beträge wie gemeldet" and the list of registers sit under every money table.
* Money of organisations a person is *connected* to (side jobs, career) is labelled as the organisation's
money and carries the connection note.
### 6.6 Votes
* A vote shows date, item title, reference, stage, chamber, result and the position of every faction as
**position chips**: party dot + short name + position icon (✓ dafür, ✕ dagegen, – Enthaltung,
○ abwesend), with a tinted background per position.
* Roll calls are marked ("namentlich"); they show individual votes grouped by faction with counts, and
members who voted against their faction are marked "gegen die eigene Fraktion".
* On a person's vote list the position says whether it is the faction's vote or the person's own vote,
because most Austrian votes are recorded per faction only. The note explaining this sits above the list.
* *Say vs. vote*: when the person spoke on the item, a link to the speech appears under the vote.
### 6.7 Time
* Dates in lists: `12. März 2026` (de-AT) / `12 Mar 2026` (en-GB). Months in charts: `03/2026`.
* The **activity histogram** (claims per month) on profiles links each bar to that month.
* **Date range** fields on every list that supports them; with no query, search becomes "search in
time" and lists everything in the range.
* The **role timeline** on a profile draws offices and memberships as bars on a year axis.
### 6.8 Filters
Two kinds, never mixed up:
* **Page filters** (party, level, kind, date …) live in the URL. Active filters are visible in the form;
a reset link clears them. On phones the filter form is collapsed behind "Filter" with the number of
active filters.
* **My filters** (trusted sources, minimum trust, topics) are stored in a cookie and apply to every list.
When they are active, the header badge shows the count and lists show a notice with a link to change
them, so nobody is surprised by missing data.
### 6.9 Connections
Wherever the UI shows that a person is connected to an organisation (side job, career, meeting, party)
or shows the organisation's money, the note "Eine Verbindung ist kein Vorwurf." is part of the section.
### 6.10 Social posts
Posts are shown as text cards with platform, author, date and a link to the original; no embeds, no
third-party images or scripts. Accounts that only Wikidata attributes to a person are marked "Konto nicht
bestätigt". The collection policy (official APIs only; no Facebook/Instagram scraping; no WhatsApp,
Signal or private Telegram groups) is stated on the page.
### 6.11 Empty, loading and error states
* **Empty**: an icon, one sentence that says why ("Keine Angaben mit deinen Quellen- und Themenfiltern.")
and the most likely next step (reset filters, broaden the date range).
* **Loading**: skeleton blocks in the page's layout, no spinners.
* **Error**: what happened in one sentence, a retry button, a link home.
## 7. Page concepts
Every page uses one of four templates: **index** (header, filters, results, pagination, source note),
**profile** (identity header, key figures, tabs, main column plus aside), **detail** (header, verdict,
breakdown) and **prose** (methodology).
### 7.1 Start (`/`)
Purpose: orient, search, show that the data is alive.
```
┌ hero ───────────────────────────────────────────────────────────────┐
│ Politik in Österreich – nachvollziehbar. │
│ Lede: what Politrack is, "jede Angabe mit Quelle". │
│ [ Person, Thema oder Stichwort … ] [Suchen] │
│ Schnellzugriff: Parteispenden · Namentliche Abstimmungen · Inserate │
└──────────────────────────────────────────────────────────────────────┘
[ 1.234 Personen ] [ 56.789 Angaben ] [ 1.210 Abstimmungen ] [ 9.876 Geldflüsse ] Stand …
┌ Neueste Angaben (claim feed) ──────────┐ ┌ aside ───────────────────┐
│ claim card … │ │ Parteien (dot, name, n) │
│ claim card … │ │ Letzte Abstimmungen │
└─────────────────────────────────────────┘ └──────────────────────────┘
Entdecken: 6 cards with icon, title, one line (Geld, Organisationen, Social, Wikipedia, Ehemalige, Kalender)
So arbeitet Politrack: Belege · Unabhängige Bestätigung · Unschuldsvermutung → Methodik
```
### 7.2 Search (`/suche`)
A large search field with optional date range. Results are cards with type label, date, subject and a
snippet with the query terms highlighted; document hits (news, releases) show the publisher. Without a
query but with a date range, the page lists all claims in that period ("search in time"). Empty states
suggest fewer words or a wider range.
### 7.3 People (`/personen`)
Index template. Filters: name, party, level (EU, Bund, Land, Gemeinde, Partei), status (default: aktiv).
Results are **person cards** in a responsive grid: portrait or initials, name, current roles (two lines
max), party tags, and the status for non-active people. Pagination at the bottom.
### 7.4 Person profile (`/personen/{slug}`)
```
Start › Personen › Name
┌──────┐ [Aktiv] Profile elsewhere:
│ │ Vorname Nachname Parlament ↗ Wikidata ↗ EP ↗
│ foto │ Abgeordnete zum Nationalrat · ● ÖVP
│ │ * 3. Mai 1970 · Kanäle: [Bluesky] [Telegram*]
└──────┘
[Überblick] [Zeitleiste 312] [Abstimmungen 120] [Reisen & Treffen 4] [Aussagen 58] [Social Media]
[Geld & Netzwerk 6] [Medien & Werdegang 40] [Rechtliches 1]
Overview:
┌ main ─────────────────────────────────────┐ ┌ aside ───────────────────────┐
│ Laufbahn (role timeline on a year axis) │ │ Auf einen Blick │
│ Neueste Angaben (claim cards) │ │ 120 Abstimmungen · 58 Reden │
│ │ │ Funktionen & Mandate (list, │
│ │ │ each with its sources) │
└───────────────────────────────────────────┘ └──────────────────────────────┘
```
* Tabs are links (`?tab=votes`), so every tab is shareable; each shows its claim count.
* **Zeitleiste**: activity histogram, date range, all claims in the range.
* **Abstimmungen**: the faction-vote note, then the vote list with position, own/faction vote, dissent and
say-vs-vote.
* **Geld & Netzwerk**: connected organisations (via side job, career, meeting, party) with their money,
the connection note, the organisations' money flows, then money-related claims.
* **Rechtliches**: legal claims only, each with stage and the innocence notice.
* "At a glance" counts work: votes, speeches and statements, questions, side jobs, appearances, media
reports; not legal matters.
### 7.5 Former politicians (`/ehemalige`)
Index template ordered by latest media coverage. Each card: name, status, last role, last office end,
latest headline with source link and date, latest career entry. Party filter.
### 7.6 Parties (`/parteien`)
Cards with a thin top bar in the party colour, short name, full name, active officials and people
tracked. Ordered by the number of active officials.
### 7.7 Party (`/parteien/{slug}`)
```
──────── party colour bar ────────
Start › Parteien › ÖVP
ÖVP Österreichische Volkspartei
[ 312 Funktionsträger:innen ] [ 1.020 Ehemalige ] [ 830 Abstimmungen ] [ 4 abweichende Mandatar:innen ]
┌ Stimmverhalten (proportion bar) ──┐ ┌ Geld nach Jahr und Art (table) ─────┐
└───────────────────────────────────┘ └─────────────────────────────────────┘
Funktionsträger:innen grouped by level (EU · Bund · Land · Gemeinde), multi-column
┌ Rechenschaftsberichte ────────────┐ ┌ Nahestehende Organisationen ────────┐
┌ Ehemalige ────────────────────────┐ ┌ Abweichendes Stimmverhalten ────────┐
Letzte Abstimmungen · Kanäle der Partei · Belegte Angaben
```
### 7.8 Organisations (`/organisationen`)
Index template with a table: name, kind badge, paid, received (compact amounts, exact in tooltip). On
phones the table stacks into cards. Filters: name, kind.
### 7.9 Organisation (`/organisationen/{slug}`)
Header with kind badge and parent organisation; identifiers (Firmenbuch, ZVR, UID, Wikidata, EU
transparency register) in the aside with links where a public register page exists. Key figures (received,
paid, counterparties). Counterparties as two bar lists ("zahlte an", "erhielt von"). Connected people with
the connection note. Money flow table, then all claims. Parties redirect to their party page.
### 7.10 Money (`/geld`)
Explorer template. Filters: kind, name, date range, minimum amount. Unfiltered, the page opens with two
bar lists, largest payers and largest recipients, each row labelled with the kind of money. Then the money
table: date, kind, from, to, amount, sources. Footer: registers used and "Beträge wie gemeldet".
### 7.11 Votes (`/abstimmungen`) and vote (`/abstimmungen/{id}`)
The index is a list of vote rows: date, title, reference, roll-call marker, result badge, position chips
per faction. Filter: roll calls only. The vote page shows the verdict as a large result badge, links to the
item and the protocol, faction positions, and for roll calls a proportion bar over all individual votes and
the members grouped by faction with dissent marked. The protocol wording sits in a disclosure.
### 7.12 Calendar (`/kalender`)
Month grid (Monday first) with previous/next month as header actions. Each event shows its kind (colour
stripe + label), title (linked to the source) and participants. Days with only claim activity link to
"search in time" for that day. Today is highlighted. On phones the grid becomes an agenda: only days with
events, in order. A legend explains the kinds; the footnote states the date precision.
### 7.13 Social media (`/social`)
Feed of post cards in one or two columns. Filters: platform, party. Each card: platform badge, author
(person or party channel), date, title, text (clamped to a few lines), "Original ansehen ↗", unconfirmed
marker. The collection policy closes the page.
### 7.14 Wikipedia edits (`/wikipedia`)
The framing comes first: a notice that an edit from a network says nothing about which person made it.
Then a table: date, network (organisation), article (linked to the diff), size change, edit comment.
### 7.15 My filters (`/einstellungen`)
Two sections. **Quellen**: grouped by kind (Amtlich, NGO, Medien, Datenbanken, Soziale Medien,
Community, Abgeleitet); each source is a switch row with name, trust value as a small meter, and its terms
in the tooltip; a minimum-trust slider below. **Themen**: topic chips that toggle; none selected = all.
A sticky action bar with Speichern, Zurücksetzen and the saved status. Stored in a cookie only.
### 7.16 Methodology (`/methodik`)
Prose template with a table of contents: how claims and evidence work, the status vocabulary with live
badges, the legal stages glossary, the sources table (publisher, licence, access method, trust meter, terms
notes), what we deliberately don't collect, corrections.
### 7.17 Claim permalink (`/angaben/{id}`)
One fact on its own page: type, date, subject, the summary as the title, details, legal notice where
applicable, all sources expanded with quotes, and a citation box:
`Politrack: „{Zusammenfassung}“. Angabe #{id}, abgerufen am {Datum}. {URL}`. The page ignores personal
source filters, so a shared link shows the same content to everyone.
### 7.18 Not found and errors
Not found: an empty state with the search field and links to Personen, Parteien and Start. Errors: one
sentence, "Erneut versuchen", link home.
## 8. Responsive behaviour
| Width | Behaviour |
|---|---|
| < 640 px | one column; tables stack into labelled cards; filter forms collapse; role timeline labels above the bars; tabs scroll horizontally |
| < 768 px | the calendar becomes an agenda (only days with events) |
| 640–1023 px | two-column card grids; tables scroll horizontally inside their container; menu still collapsed |
| ≥ 1024 px | full header navigation with search field; profile pages get the aside column; two-column sections |
| ≥ 1280 px | content width caps at 76 rem; more cards per row |
## 9. Accessibility (WCAG 2.2 AA)
* Contrast ≥ 4.5:1 for text and ≥ 3:1 for UI parts in both themes (token values are chosen and checked
for it, see the design system).
* Never colour alone: positions, results, statuses and party identity always have text, and an icon or
a shape where possible.
* Keyboard: skip link, visible focus ring on everything, tabs and disclosures are native links and
`details` elements, no keyboard traps.
* Structure: one `h1` per page, headings in order, landmarks (header, nav, main, footer), `aria-current`
for the active page and tab, tables with header cells, charts with text equivalents.
* Language: `lang` on the document; English summaries are marked when shown in the German UI.
* Motion: no animation beyond short hover transitions; `prefers-reduced-motion` removes them.
* Targets at least 24 × 24 px; form fields have visible labels.
## 10. Privacy and performance
* No third-party requests from the page itself: system fonts, no analytics, no embeds, no CDNs.
Portraits and logos still come from Wikimedia and the parliament; they load lazily with
`referrerpolicy="no-referrer"`. **(later)** an image proxy so visitors' IP addresses never reach
third parties.
* Server-rendered HTML; client JavaScript only for the filter settings, the theme switch, the language
switch and active-link marking.
* Budget: under 100 kB of CSS and JavaScript per page (compressed), first content without waiting for
scripts.
## 11. Before going public
Not design work, but the design depends on them; flagged here so they are not forgotten:
* **Impressum and Offenlegung** (§ 5 ECG, § 25 MedienG) and a **privacy policy**: footer links and a
prose page each.
* A **corrections and right-of-reply** path (§ 9 MedienG): a contact on the methodology page and, later, a
form linked from every claim page.
* The X deletion sync (see the roadmap) before X data is shown publicly.
## 12. Later
* Claim permalinks are implemented; **(later)** a "Fehler melden" button on them.
* Compare two people or parties side by side (votes, money, statements).
* Topic pages (`/themen/{slug}`): everything on one topic across people and parties.
* Alerts (e-mail or RSS) for people, parties and topics.
* A review queue for editors in the web UI (today `politrack review` on the command line).
* A map of trips and appearances.
* Share images (Open Graph) generated per profile and claim.
* CSV export of every table.
-305
View File
@@ -1,305 +0,0 @@
# Politrack design system
The implementation reference for the web app: tokens, components, CSS conventions, content rules and
recipes. The concept behind it (goals, principles, page concepts) is in [README.md](README.md); how to add
pages and claim types step by step is in [contributing/frontend.md](../contributing/frontend.md).
## 1. Architecture
```
web/src/styles/
tokens.css design tokens (custom properties), light + dark
base.css element defaults: typography, links, tables, forms, buttons, text utilities
layout.css page frame (header, menu, footer) and layout utilities
components.css one section per component in src/components
print.css print: content only, link targets written out
web/src/components/ server components (a few client components, marked 'use client')
web/src/app/icon.svg favicon (the brand mark)
```
All five stylesheets are imported once, in order, by `src/app/[locale]/layout.tsx`.
* **Plain global CSS** with custom properties: no CSS framework, no CSS-in-JS, no npm dependency beyond
Next.js, React and next-intl. The UI must keep working where npm is slow or blocked.
* **Class names**: one block per component in kebab-case (`.claim`, `.claim-head`, `.vote-row`);
variants with `--` (`.badge--positive`, `.notice--legal`); states with `is-` (`.is-current`,
`.is-disputed`); `aria-current` for the active link or tab.
* **Only tokens** for colour, spacing, radius and type. The exceptions are deliberate: party colours
(from the data), platform brand colours, and the favicon.
* **Server first.** Pages and most components are async server components. Client components exist only
where the browser must act: `ThemeSwitcher`, `LocaleSwitcher`, `NavLink`, `SettingsForm`, the error page.
* **No JavaScript needed** for navigation, filters, tabs, disclosures or the mobile menu: links, GET forms,
`<details>` and one checkbox toggle.
## 2. Tokens
### Colour
| Token | Light | Dark | Use |
|---|---|---|---|
| `--paper` | `#f6f5f1` | `#131311` | page background |
| `--surface` | `#ffffff` | `#1b1a17` | cards, panels, tables, header |
| `--surface-2` | `#efede7` | `#24231f` | subtle fills: chips, table heads, compact stats |
| `--surface-3` | `#e4e1d9` | `#2e2c27` | avatar placeholder, skeleton highlight |
| `--line` | `#dcd8cf` | `#36332d` | borders and rules |
| `--line-strong` | `#b9b3a6` | `#57534a` | emphasised rules, decorative outlines |
| `--line-field` | `#878073` | `#7d786f` | form field borders, switch track (≥ 3:1) |
| `--ink` | `#1c1b18` | `#ecebe6` | text |
| `--ink-2` | `#47443d` | `#c9c5bb` | secondary text |
| `--ink-3` | `#66625a` | `#a29d92` | muted text, meta data |
| `--accent` | `#4338ca` | `#a5b4fc` | links, focus, active navigation, bars |
| `--accent-hover` | `#3730a3` | `#c7d2fe` | hover of links and buttons |
| `--accent-soft` / `--accent-ink` | `#ebeafd` / `#312e81` | `#25264d` / `#c7d2fe` | info notices, accent badges |
| `--on-accent` | `#ffffff` | `#16163a` | text on accent buttons |
| `--mark` / `--mark-ink` | `#fde68a` / `#1c1b18` | `#5a4b10` / `#fff6d5` | highlighter: quotes, search hits |
| `--positive` / `-soft` | `#146c43` / `#e2f2e8` | `#74d3a2` / `#11301f` | "dafür", "angenommen", verified |
| `--negative` / `-soft` | `#b3261e` / `#fbe9e6` | `#ff9d90` / `#3c1612` | "dagegen", "abgelehnt" |
| `--caution` / `-soft` | `#8a5300` / `#fcf0d4` | `#f2c35c` / `#36290c` | legal matters, disputed, dissent, review |
| `--focus` | `#4338ca` | `#a5b4fc` | focus ring |
**Contrast** (WCAG 2.2: text ≥ 4.5, UI parts ≥ 3; computed from the values above):
| Pair | Use | Light | Dark |
|---|---|---|---|
| `--ink` on `--paper` | body text | 15.8 | 15.6 |
| `--ink-2` on `--surface` | secondary text | 9.7 | 10.1 |
| `--ink-3` on `--paper` | muted text on the page | 5.6 | 6.9 |
| `--ink-3` on `--surface-2` | muted text on fills | 5.2 | 5.8 |
| `--accent` on `--surface` | links on cards | 7.9 | 8.7 |
| `--on-accent` on `--accent` | primary button | 7.9 | 8.7 |
| `--accent-ink` on `--accent-soft` | info notice, accent badge | 9.6 | 9.6 |
| `--mark-ink` on `--mark` | highlighted search hit | 13.8 | 7.9 |
| `--positive` on `--positive-soft` | positive badge | 5.6 | 7.9 |
| `--negative` on `--negative-soft` | negative badge | 5.6 | 8.0 |
| `--caution` on `--caution-soft` | caution badge | 5.6 | 8.6 |
| `--line-field` on `--surface` | form field border | 3.9 | 4.0 |
`--line` and `--line-strong` are decorative (card edges, rules) and are never the only way to recognise a
control. Re-run the numbers when you change a colour; the check is twenty lines of Python (relative
luminance per WCAG).
**Party colours** come from the data (`organization.color`) and are used only through
`partyStyle(color)` → `--party`, by `.party-dot`, `.party-band` (a 4 rem bar), `.party-card` (a 4 px top
edge) and party bars in the role timeline. Never as text colour, never as a large background, always next
to the party's name. Dots get a thin ring so dark party colours stay visible on the dark theme.
**Platform colours** (`.platform-bluesky` …) follow the same rule: a dot next to the platform name.
### Typography
System font stack (`--font-sans`): fast, private (no font downloads) and native on every device.
`--font-mono` for identifiers (file numbers, Firmenbuch numbers, item references).
| Token | Size | Use |
|---|---|---|
| `--text-xs` | 0.75 rem | meta data, badges, axis labels |
| `--text-sm` | 0.875 rem | secondary text, tables, filters |
| `--text-base` | 1 rem | body |
| `--text-md` | 1.125 rem | ledes, search field |
| `--text-lg` | 1.25 rem | h2 |
| `--text-xl` | 1.5 rem | key figures, claim title on its permalink page |
| `--text-2xl` | clamp(1.625 → 2.125 rem) | h1 |
| `--text-display` | clamp(2 → 3 rem) | home headline |
Line height 1.55 for text, 1.2 for headings. Headings use `text-wrap: balance`. Running text, list items,
table cells and headings hyphenate (`hyphens: auto` with the document's `lang`), which keeps long German
compounds from breaking layouts on phones.
### Spacing, shape, depth
* Spacing on a 4 px grid: `--space-1` 0.25 rem · `-2` 0.5 · `-3` 0.75 · `-4` 1 · `-5` 1.5 · `-6` 2 ·
`-7` 3 · `-8` 4 rem.
* Radius: `--radius-sm` 4 px (chips, position badges) · `--radius` 8 px (fields, buttons, notices) ·
`--radius-lg` 12 px (cards, panels, tables) · `--radius-pill`.
* Depth: borders first. `--shadow-sm` on hover of link cards; `--shadow` only for overlays (menus,
sticky action bar).
### Layout
* `--page-max` 76 rem content width, `--prose-max` 44 rem for reading, `--gutter` clamp(1–2 rem),
`--header-h` 3.5 rem.
* Breakpoints (media queries can't use custom properties, so they are written out): **640 px** (stacked
tables, collapsed filters, one-column role timeline), **768 px** (calendar → agenda), **1024 px** (full
header navigation, aside columns), **1360 px** (header tool labels).
### Theming
The light theme is defined on `:root`. The dark theme is defined twice with the same values: once in
`@media (prefers-color-scheme: dark)` for `:root:not([data-theme='light'])`, once for
`:root[data-theme='dark']`. `ThemeSwitcher` sets `data-theme` and the `pt_theme` cookie; the layout reads
the cookie, so the server renders the chosen theme without a flash. **A new token goes into all three
blocks.**
## 3. Icons
`<Icon name="…" />` (`src/components/Icon.tsx`): inline SVG on a 24 px grid, 1.75 px strokes in
`currentColor`, decorative (`aria-hidden`) unless you pass `label`. Sizes follow the text (`1em`) unless a
component sets them.
Available: `search person people flag building euro vote calendar message book history sliders external
document check checks alert scale globe sun moon monitor arrow-right arrow-left chevron-down
chevron-right link quote mic plane briefcase landmark info close menu pin news question pencil pie
activity shield code`.
To add one, append a list of path strings (and `c:cx,cy,r` for circles) to `PATHS`. Draw it yourself from
simple geometry rather than copying a set with a licence to track. Claim types map to icons in
`TYPE_ICONS` (`badges.tsx`).
`<BrandMark />` is the logo: brackets around a dot (a citation with its evidence). `src/app/icon.svg` is the
same mark as the favicon.
## 4. Components
| Component | File | Use |
|---|---|---|
| `SiteHeader`, `SiteFooter` | `SiteHeader.tsx`, `SiteFooter.tsx` | page frame; navigation from `nav.ts` |
| `NavLink` (client) | `NavLink.tsx` | navigation link with `aria-current` for the section |
| `ThemeSwitcher`, `LocaleSwitcher` (client) | | system → light → dark; same page in the other language |
| `PageHeader`, `Breadcrumbs`, `SectionHead` | `PageHeader.tsx` | title block; crumbs (home is added); h2 with an "Alle …" link |
| `Tabs` | `Tabs.tsx` | link tabs with counts; scroll shadows when they overflow |
| `FilterBar`, `Field`, `countActive` | `FilterBar.tsx` | GET filter form, collapses on phones |
| `Pagination` | `Pagination.tsx` | previous / page n / next (the API has no totals) |
| `Notice`, `EmptyState` | `Notice.tsx` | notes with tone `note`/`info`/`caution`/`legal`; empty results |
| `ExternalLink` | `ExternalLink.tsx` | link to a source: new tab, no referrer, announced to screen readers |
| `TypeLabel`, `SourceMeter` | `badges.tsx` | claim type with icon; source count / disputed |
| `PartyTag`, `StatusBadge` | `badges.tsx` | party dot + short name; person status |
| `PositionChip`, `ResultBadge` | `badges.tsx` | vote position (optionally per party); accepted/rejected |
| `PlatformBadge`, `platformName` | `badges.tsx` | social platform |
| `Avatar`, `PersonCard` | `Avatar.tsx`, `PersonCard.tsx` | portrait or initials; person in a grid |
| `StatGrid`, `BarList`, `ProportionBar` | `charts.tsx` | key figures; ranked bars; shares of a whole |
| `Timeline`, `DateRangeForm` | `Timeline.tsx` | activity per month (bars link to the month); date filter |
| `RoleTimeline` | `RoleTimeline.tsx` | offices and memberships on a year axis |
| `ClaimList`, `ClaimCard`, `EvidenceList` | `ClaimList.tsx` | the claim card and its sources |
| `ClaimDetails`, `OrgLink` | `ClaimDetails.tsx` | type-specific details (registry `DETAILS`) |
| `MoneyTable` | `MoneyTable.tsx` | money flows in four columns (date + kind, from, to, amount + source chips); `self` mutes the page's own organisation |
| `VoteList`, `VoteLegend` | `VoteList.tsx` | votes (vote items or one person's votes); `compact` for panels |
| `SocialFeed` | `SocialFeed.tsx` | post cards, no embeds |
| `SearchForm` | `SearchForm.tsx` | the big search field (optional date range) |
| `SettingsForm` (client) | `SettingsForm.tsx` | "Meine Filter" |
### The claim card
`ClaimCard` renders, in this order: head (type label, date, subject, source meter), legal stage row,
summary, `ClaimDetails`, innocence notice (`needsInnocenceNotice()`), review notice, topics, and the foot
with the evidence disclosure and the permalink. `standalone` is the permalink page variant: the summary
becomes the `h1` and the sources are expanded. Rules:
* Never render a claim without its evidence.
* Don't remove or move the innocence notice; it belongs inside the card.
* Show the subject only when the list mixes subjects (`showSubject={false}` on profiles).
* When the English UI shows a German summary, it is marked `lang="de"`.
### Filters
```tsx
<FilterBar id="money" active={countActive(sp.kind, sp.q)} resetHref="/geld" hidden={{org: sp.org}}>
<Field label={t('kindLabel')}><select name="kind" defaultValue={sp.kind ?? ''}>…</select></Field>
<Field label={t('nameLabel')} wide><input type="search" name="q" defaultValue={sp.q} /></Field>
</FilterBar>
```
`active` drives the count badge, the reset link and whether the phone toggle starts open. Hidden values
keep context (an organisation, the current tab) across submits.
### Tables
```tsx
<div className="table-wrap">
<table className="table-stack">
<thead><tr><th scope="col">{t('date')}</th>…</tr></thead>
<tbody><tr><td data-label={t('date')}>…</td>…</tr></tbody>
</table>
</div>
```
`.table-wrap` gives the frame and horizontal scrolling. `.table-stack` turns rows into labelled cards
below 640 px, using each cell's `data-label`. Numbers: `className="num"` (right-aligned, tabular).
Amounts: `<span className="amount">`. Keep tables to four or five columns: secondary values (a kind badge, source
chips) go into the cell they belong to rather than into a column of their own.
### Charts
All charts are HTML and CSS, with the numbers as text:
* `StatGrid` is a `<dl>`; values can link to the list behind them.
* `BarList` scales bars to the largest value in the list. Use it for rankings of the same unit only, and
label each row's kind (`meta`).
* `ProportionBar` has `role="img"` with a text alternative, plus a legend with counts.
* `Timeline` bars are links with labels ("März 2026: 12").
* `RoleTimeline` labels every bar with its years. Roles without a start date are listed in the roles panel
only.
## 5. Layout utilities
| Class | Does |
|---|---|
| `.page` | the main column (set by the layout) |
| `.stack`, `.cluster` | vertical stack with gap; wrapping row with gap |
| `.grid-2` | two columns ≥ 22 rem, one column below |
| `.grid-cards` | auto-fill card grid; `--card-min` (default 17 rem) |
| `.layout-aside` | main + 20 rem aside from 1024 px |
| `.section`, `.section-head` | vertical rhythm between sections; h2 row with a "more" link |
| `.prose` | 44 rem reading width |
| `.panel` | aside box with an h2 |
| `.link-list`, `.name-list`, `.meta-list` | ruled list; multi-column names; definition grid |
| `.muted`, `.small`, `.xsmall`, `.strong`, `.num`, `.mono`, `.nowrap`, `.block`, `.visually-hidden` | text utilities |
## 6. Content
### Voice and wording
Sachlich and precise; "du"; gender-inclusive with a colon (Politiker:innen, Funktionär:innen). Say what the
source says, with the source.
| Instead of | Write |
|---|---|
| "X kassierte 25.000 €" | "Laut Rechnungshof erhielt X 25.000 € (Spende)" |
| "Skandal um …", "dubios" | the fact and its source; no adjectives that judge |
| "X ist korrupt", "Anklage!" | the procedural stage ("Ermittlungsverfahren") + the innocence notice |
| "X und Y sind verbandelt" | "X ist laut Firmenbuch Geschäftsführer von Y" + the connection note |
| "X hat 33.000 Follower" (from somewhere) | only data we collected, with its source and date |
### Numbers, dates, money
* Use `formatDate`, `formatMonth`, `formatPeriod`, `formatNumber`, `formatMoney`, `formatMoneyCompact`
from `lib/format.ts`. They use de-AT and en-GB conventions (`12. März 2026`, `€ 25.000`,
`1,2 Mio. €`, `2. Halbjahr 2025`).
* Exact amounts in tables, compact amounts in summaries and bar lists (exact value in the `title`).
* Pass numbers to ICU messages (`{count, plural, …}`), never pre-formatted strings. Pass IDs as strings,
so they don't get thousands separators.
* Never add up different kinds of money into one figure without saying so.
### Interface text
* Every key goes into both `messages/de.json` and `messages/en.json`; German first.
* Labels are short nouns ("Quellen", "Filter"); buttons are verbs ("Anwenden", "Speichern").
* Links say where they go ("Alle Abstimmungen", "Original ansehen"), never "hier klicken".
* Keep a dash with the preceding word using a non-breaking space where a line break would start a line
with "–" (the home headline does this).
## 7. Accessibility checklist (for every UI change)
- [ ] Headings in order, one `h1`; landmarks intact; new sections have `aria-labelledby`.
- [ ] Everything works with the keyboard and shows the focus ring.
- [ ] Nothing relies on colour alone: badges have words, positions have icons, charts have numbers.
- [ ] Contrast of new colours checked (§2).
- [ ] External links use `ExternalLink` (new tab announced).
- [ ] Images: `alt=""` when decorative (the name is next to the portrait), real text otherwise.
- [ ] Phone width (390 px): no horizontal scrolling, tables stack, nothing cut off.
- [ ] Both themes look right; both languages fit (English is shorter, German compounds are longer).
## 8. Recipes
**An index page.** Use `PageHeader` → `FilterBar` → results (`grid-cards`, a `table-wrap`, or
`ClaimList`) → `Pagination` → a source `Notice`. The persons and organisations pages are the templates.
**A profile section.** Use a `section` with `aria-labelledby` and a `SectionHead` (with `more` pointing to
the pre-filtered explorer), then the list component. Put secondary facts into a `.panel` in the aside.
**Showing a new claim type.** Add a renderer to `DETAILS` in `ClaimDetails.tsx`, an icon to `TYPE_ICONS`
in `badges.tsx`, and the label `Claims.type.<type>` in both message files.
**A new chart.** Prefer `StatGrid`, `BarList` or `ProportionBar`. If you need something else, build it from
HTML/CSS with the numbers as text, add its section to `components.css`, and document it here.
**A new token.** Add it to all three blocks in `tokens.css`, check its contrast, and add it to §2.
+1 -1
View File
@@ -11,7 +11,7 @@
* **Database right** (§76c ff. UrhG): systematically extracting substantial parts of someone else's curated database (for example MeineAbgeordneten) is not allowed without permission, so we ask for partnerships instead. * **Database right** (§76c ff. UrhG): systematically extracting substantial parts of someone else's curated database (for example MeineAbgeordneten) is not allowed without permission, so we ask for partnerships instead.
* **ToS**: we never scrape platforms whose terms prohibit it (X, Meta, most newspapers). We use official APIs or leave the source out. Each source's assessment is recorded in its `SourceSpec.tos_notes` (shown on the method page and in `/api/v1/sources`). * **ToS**: we never scrape platforms whose terms prohibit it (X, Meta, most newspapers). We use official APIs or leave the source out. Each source's assessment is recorded in its `SourceSpec.tos_notes` (shown on the method page and in `/api/v1/sources`).
* **Raw archive**: responses are archived only where the publisher's terms allow it (`SourceSpec.keep_raw`) and never for TDM-reserved sites. The archive serves re-parsing and auditability, not republication. * **Raw archive**: responses are archived only where the publisher's terms allow it (`SourceSpec.keep_raw`) and never for TDM-reserved sites. The archive serves re-parsing and auditability, not republication.
* **X API**: the Developer Agreement requires removing content of posts that were deleted on X. `social.x` keeps no raw archive or full text, and `social.x_deletions` checks stored posts four times a day. For accountability, a post that disappears is **marked, not erased**: author, link, dates and a neutral "no longer available" note stay, plus an Internet Archive link if a copy exists, while every copy of X's text is removed. Keeping the text itself would need X's written permission (Twitter cut off Politwoops over this in 2015 and restored access only after an agreement). Check the current terms before enabling `social.x`. * **X API**: the Developer Agreement requires removing content of posts that were deleted on X. `social.x` keeps no raw archive or full text, but the deletion sync is still open – don't enable it in production before it exists (see roadmap).
* **Messaging platforms**: only public Telegram broadcast channels through Telegram's public web preview. No WhatsApp (no public read access, terms forbid automated collection), no Signal, no private groups. * **Messaging platforms**: only public Telegram broadcast channels through Telegram's public web preview. No WhatsApp (no public read access, terms forbid automated collection), no Signal, no private groups.
## 2. Personal data (GDPR / DSG) ## 2. Personal data (GDPR / DSG)
+4 -35
View File
@@ -31,31 +31,17 @@ Next.js frontend (de/en), Docker Compose for Unraid.
- [x] Political ads: Google (bundle), Meta Ad Library (opt-in token) - [x] Political ads: Google (bundle), Meta Ad Library (opt-in token)
- [x] Social: Bluesky, Mastodon, public Telegram channels, YouTube (key), X via official API (token); - [x] Social: Bluesky, Mastodon, public Telegram channels, YouTube (key), X via official API (token);
party/institution channels; curated `social_accounts.yaml` party/institution channels; curated `social_accounts.yaml`
- [x] X deletion sync (`social.x_deletions`): posts gone from X keep a marked record without their text
- [x] EP roll-call votes of Austrian MEPs, including amendments and part votes (`europarl.votes`)
- [x] Committee memberships of the configured legislative periods (list 250, `parlament.persons`)
- [x] Election results and preference votes: NR 2024, NR 2019, NR 2017, EU 2024, EU 2019 preference votes (`bmi.elections`)
- [x] Former Austrian MEPs of the 2019-2024 term; EC meetings of the 2014-2019 Commission; Bluesky/Mastodon history paging
- [x] Operations: watchdog for missed schedules and stalled jobs, nightly backups, `/api/v1/status/sources` for
monitoring, worker logs kept across redeploys; procurement data cleaned (award dates, placeholder contractors,
framework-agreement buyers)
- [x] Draft legal pages (`/impressum`, `/datenschutz`), corrections contact, portrait proxy (`/api/img`)
- [x] Pages: organisations, money explorer, social feed, Wikipedia edits, person network ("follow the money"), - [x] Pages: organisations, money explorer, social feed, Wikipedia edits, person network ("follow the money"),
say-vs-vote on roll calls say-vs-vote on roll calls
**Design (v2)** – see [design/README.md](design/README.md):
- [x] Design concept and design system (neutral palette, light/dark, tokens with checked contrast, icons)
- [x] Redesigned pages: header with search and filter count, profiles with role timeline and key figures,
party and organisation dashboards, vote list with position chips, calendar agenda on phones
- [x] Claim permalink pages with citation (`/angaben/{id}`, `GET /api/v1/claims/{id}`)
## Next ## Next
**Data** **Data**
- [ ] Full speech texts and interjections from the protocols - [ ] X deletion sync (Developer Agreement: remove posts deleted on X) – required before enabling `social.x` in production
- [ ] Full speech texts and interjections from the protocols; committee memberships (list 250)
- [ ] HowTheyVote.eu / EP roll-call votes of Austrian MEPs
- [ ] EU Council participant lists, ministries' press releases, Federal President's schedule - [ ] EU Council participant lists, ministries' press releases, Federal President's schedule
- [ ] Election results before 2019, NR 2019 state lists, Landtag and municipal elections - [ ] Election results and candidate lists; AMA/TAM subsidy recipients (after checking bulk access and terms)
- [ ] AMA/TAM subsidy recipients (after checking bulk access and terms)
- [ ] Cabinet staff and appointments to state-owned companies (from answers to parliamentary questions) - [ ] Cabinet staff and appointments to state-owned companies (from answers to parliamentary questions)
- [ ] One adapter per Landtag (OGD where available); municipal councils and mayors - [ ] One adapter per Landtag (OGD where available); municipal councils and mayors
- [ ] Lobbying register – if the BMJ ever offers stable URLs or an export - [ ] Lobbying register – if the BMJ ever offers stable URLs or an export
@@ -67,28 +53,11 @@ Next.js frontend (de/en), Docker Compose for Unraid.
- [ ] Wayback Machine archiving of evidence URLs (`document.archive_url`) - [ ] Wayback Machine archiving of evidence URLs (`document.archive_url`)
**Product** **Product**
- [ ] Before going public: have `/impressum` and `/datenschutz` legally reviewed, set `POLITRACK_LEGAL_*` in `.env`,
and document the balancing test (see legal.md)
- [ ] Compare two people or parties; topic pages (`/themen/{slug}`); Open Graph share images; CSV export
- [ ] Review queue for editors in the web UI (today `politrack review`)
- [ ] Community link submissions and a corrections/right-of-reply form - [ ] Community link submissions and a corrections/right-of-reply form
- [ ] Alerts (e-mail/RSS) for followed politicians - [ ] Alerts (e-mail/RSS) for followed politicians
- [ ] Optional accounts via reverse-proxy SSO using `app_user` - [ ] Optional accounts via reverse-proxy SSO using `app_user`
- [ ] Partnerships: MeineAbgeordneten, Parteispenden.at, APA (OTS full-text licence) - [ ] Partnerships: MeineAbgeordneten, Parteispenden.at, APA (OTS full-text licence)
- [ ] Map view of trips and appearances - [ ] Map view of trips and appearances
- [ ] Semantic search with embeddings (`POLITRACK_OLLAMA_URL`): parked by the owner on 2026-11-09, full-text search only for now
## Not yet verified (v2)
Tested so far: unit and golden tests, a live pipeline run of every adapter with `--max-requests`
against a test database, every API endpoint, the frontend type check against the generated types.
Not run yet, because PyPI/npm were unreachable on the development network (October 2026):
- [ ] Building the `backend` and `web` images (`docker compose build`), `npm run build`
- [ ] Procrastinate workers and the periodic schedule; the job-queue schema (`politrack migrate` installs it)
- [ ] The MCP server at runtime
- [ ] Mastodon (no account in the test sample), YouTube, X and Meta Ad Library (no credentials)
- [ ] GDELT (rate-limited during the test), EP declarations for MEPs whose API calls returned HTTP 500
## Known limitations ## Known limitations
+3 -5
View File
@@ -31,7 +31,6 @@ Status: ✅ implemented (adapter name in `code`) · 🟡 planned · ⛔ delibera
| Source | Data | Access | Licence / terms | Status | | Source | Data | Access | Licence / terms | Status |
|---|---|---|---|---| |---|---|---|---|---|
| Parlament Österreich | MPs since 1918, mandates, functions, **side jobs & income category** (§6 Unv-Transparenz-G), social-media links, plenary speeches, **faction votes** per item and reading | JSON API (`/Filter/api/filter/data/409,101,251`, `?json=TRUE` detail pages) | [CC BY 4.0](https://www.parlament.gv.at/recherchieren/open-data/daten-und-lizenz/) | ✅ `parlament.persons`, `parlament.items` | | Parlament Österreich | MPs since 1918, mandates, functions, **side jobs & income category** (§6 Unv-Transparenz-G), social-media links, plenary speeches, **faction votes** per item and reading | JSON API (`/Filter/api/filter/data/409,101,251`, `?json=TRUE` detail pages) | [CC BY 4.0](https://www.parlament.gv.at/recherchieren/open-data/daten-und-lizenz/) | ✅ `parlament.persons`, `parlament.items` |
| – committee memberships | who sat on which committee, with function and dates | JSON API (`/Filter/api/filter/data/250`) | CC BY 4.0 | ✅ `parlament.persons` |
| – stenographic protocols | **Roll-call votes**: every member's yes/no from the "Mit „Ja“/„Nein“ stimmten …" lists | HTML fragments | CC BY 4.0 | ✅ `parlament.items` | | – stenographic protocols | **Roll-call votes**: every member's yes/no from the "Mit „Ja“/„Nein“ stimmten …" lists | HTML fragments | CC BY 4.0 | ✅ `parlament.items` |
| – immunity waivers | prosecutors' requests to lift immunity: authority, offence, outcome | items + committee report | CC BY 4.0 | ✅ `parlament.items` | | – immunity waivers | prosecutors' requests to lift immunity: authority, offence, outcome | items + committee report | CC BY 4.0 | ✅ `parlament.items` |
| – written questions and answers | who asked which minister what | item list (J / AB) | CC BY 4.0 | ✅ `parlament.items` | | – written questions and answers | who asked which minister what | item list (J / AB) | CC BY 4.0 | ✅ `parlament.items` |
@@ -46,7 +45,6 @@ Status: ✅ implemented (adapter name in `code`) · 🟡 planned · ⛔ delibera
| Public procurement – data.gv.at "Vergabe-Kerndaten" | **contract awards**: buyer, winner, amount, CPV (eForms) | OGD hub catalogue → per-publisher XML | open data (CC BY 4.0) | ✅ `vergabe.awards` | | Public procurement – data.gv.at "Vergabe-Kerndaten" | **contract awards**: buyer, winner, amount, CPV (eForms) | OGD hub catalogue → per-publisher XML | open data (CC BY 4.0) | ✅ `vergabe.awards` |
| RTR / KommAustria Medientransparenz | **government advertising** and **media subsidies** per payer → medium | open-data API | free re-use, attribution | ✅ `rtr.medientransparenz` | | RTR / KommAustria Medientransparenz | **government advertising** and **media subsidies** per payer → medium | open-data API | free re-use, attribution | ✅ `rtr.medientransparenz` |
| European Parliament | Austrian MEPs, roles, **declarations of interests** | open-data/website XML | CC BY 4.0 | ✅ `europarl.meps` | | European Parliament | Austrian MEPs, roles, **declarations of interests** | open-data/website XML | CC BY 4.0 | ✅ `europarl.meps` |
| – plenary roll calls | **votes of Austrian MEPs** on whole texts and on amendments or parts (flagged `part_vote`), with totals and later corrections | Open Data API v2 (`/meetings/{id}/decisions`) | CC BY 4.0 | ✅ `europarl.votes` |
| European Commission – meetings | meetings of Commissioners/cabinets with **interest representatives** (Austrians and Austrian organisations) | XLSX export | EU re-use policy | ✅ `eu.commission_meetings` | | European Commission – meetings | meetings of Commissioners/cabinets with **interest representatives** (Austrians and Austrian organisations) | XLSX export | EU re-use policy | ✅ `eu.commission_meetings` |
| Wikipedia (de/en) | anonymous edits from **parliament/government IP ranges** (`config/ip_ranges.yaml`) | MediaWiki API `usercontribs` | CC BY-SA (edit metadata) | ✅ `wikipedia.institution_edits` | | Wikipedia (de/en) | anonymous edits from **parliament/government IP ranges** (`config/ip_ranges.yaml`) | MediaWiki API `usercontribs` | CC BY-SA (edit metadata) | ✅ `wikipedia.institution_edits` |
| Google Political Ads Transparency | Austrian political ads: advertiser, spend bracket, impressions | public bundle (zip, CSV) | Google's transparency report terms | ✅ `ads.google` | | Google Political Ads Transparency | Austrian political ads: advertiser, spend bracket, impressions | public bundle (zip, CSV) | Google's transparency report terms | ✅ `ads.google` |
@@ -57,7 +55,7 @@ Status: ✅ implemented (adapter name in `code`) · 🟡 planned · ⛔ delibera
| Municipalities | mayors, councils | fragmented | – | 🟡 via Wikidata | | Municipalities | mayors, councils | fragmented | – | 🟡 via Wikidata |
| EU Council participant lists | which minister attended which Council | PDF per meeting | EU re-use policy | 🟡 not implemented yet | | EU Council participant lists | which minister attended which Council | PDF per meeting | EU re-use policy | 🟡 not implemented yet |
| AMA farm subsidies, EU state-aid register (TAM) | subsidy recipients | search interfaces | – | 🟡 not implemented yet (bulk access and terms still to be checked) | | AMA farm subsidies, EU state-aid register (TAM) | subsidy recipients | search interfaces | – | 🟡 not implemented yet (bulk access and terms still to be checked) |
| Election results, preference votes | party results for Austria and the states; candidates' preference votes (only candidates who resolve to a known politician) | BMI XLSX (Bundeswahlbehörde) | official works; CC BY 4.0 on data.gv.at | ✅ `bmi.elections` (NR 2024, NR 2019, EU 2024); 🟡 earlier elections, NR 2019 state lists, Landtag and municipal elections | | Election results, candidate lists | results per municipality, candidates | BMI / data.gv.at, official gazettes | open data / official | 🟡 not implemented yet |
| Insolvency notices (Ediktsdatei) | companies tied to politicians | Justiz web application | terms to be checked before automating | 🟡 | | Insolvency notices (Ediktsdatei) | companies tied to politicians | Justiz web application | terms to be checked before automating | 🟡 |
| Firmenbuch, Grundbuch, beneficial owners (WiEReG) | company roles, property | paid clearing houses; WiEReG public access restricted since the 2022 CJEU ruling | – | ⛔ cost and legal limits | | Firmenbuch, Grundbuch, beneficial owners (WiEReG) | company roles, property | paid clearing houses; WiEReG public access restricted since the 2022 CJEU ruling | – | ⛔ cost and legal limits |
| Criminal record (*Strafregister*) | – | not public | – | ⛔ does not exist publicly | | Criminal record (*Strafregister*) | – | not public | – | ⛔ does not exist publicly |
@@ -68,7 +66,7 @@ Status: ✅ implemented (adapter name in `code`) · 🟡 planned · ⛔ delibera
|---|---|---|---|---| |---|---|---|---|---|
| Wikidata | positions incl. Landtage and mayors, party membership, careers, birth dates, **social-media handles**, ids | SPARQL | CC0 | ✅ `wikidata.politicians` | | Wikidata | positions incl. Landtage and mayors, party membership, careers, birth dates, **social-media handles**, ids | SPARQL | CC0 | ✅ `wikidata.politicians` |
| GDELT DOC 2.0 | article metadata for politicians' names, attributed to the original outlets | API, ≤ 1 request / 5 s | free | ✅ `gdelt.coverage` (supplement; thin for Austrian outlets) | | GDELT DOC 2.0 | article metadata for politicians' names, attributed to the original outlets | API, ≤ 1 request / 5 s | free | ✅ `gdelt.coverage` (supplement; thin for Austrian outlets) |
| HowTheyVote.eu | EP roll-call votes | CSV dump on GitHub (robots.txt blocks its download path), API | ODbL 1.0 (share-alike) | ⛔ not needed: `europarl.votes` takes the same votes from the EP under CC BY 4.0 | | HowTheyVote.eu | EP roll-call votes | CSV dump | check licence | 🟡 |
| OpenSanctions | PEP cross-references | bulk JSON | CC BY-NC 4.0 | 🟡 non-commercial only | | OpenSanctions | PEP cross-references | bulk JSON | CC BY-NC 4.0 | 🟡 non-commercial only |
| MeineAbgeordneten.at | curated dossiers | – | sui-generis database right (§76c UrhG) | ⛔ scraping → 🟡 ask for a partnership | | MeineAbgeordneten.at | curated dossiers | – | sui-generis database right (§76c UrhG) | ⛔ scraping → 🟡 ask for a partnership |
| Parteispenden.at | party-finance analysis | – | ask | 🟡 partnership | | Parteispenden.at | party-finance analysis | – | ask | 🟡 partnership |
@@ -107,7 +105,7 @@ Accounts come from parliament profiles (verified), Wikidata (unverified until co
| Mastodon / Fediverse | public REST API of the account's instance | ✅ `social.mastodon` | | Mastodon / Fediverse | public REST API of the account's instance | ✅ `social.mastodon` |
| Telegram – public broadcast channels | public web preview `t.me/s/<channel>` (no login, no robots.txt restriction); latest posts | ✅ `social.telegram` | | Telegram – public broadcast channels | public web preview `t.me/s/<channel>` (no login, no robots.txt restriction); latest posts | ✅ `social.telegram` |
| YouTube | Data API v3 (free quota, `POLITRACK_YOUTUBE_API_KEY`) | ✅ `social.youtube` (opt-in) | | YouTube | Data API v3 (free quota, `POLITRACK_YOUTUBE_API_KEY`) | ✅ `social.youtube` (opt-in) |
| X (Twitter) | **official API v2 only** (paid read access, `POLITRACK_X_BEARER_TOKEN`). No raw archive or full text kept; posts gone from X keep a marked record without their text (`social.x_deletions`) | ✅ `social.x` (opt-in) | | X (Twitter) | **official API v2 only** (paid read access, `POLITRACK_X_BEARER_TOKEN`). No raw archive or full text kept; posts deleted on X must be removed (deletion sync still open, see roadmap) | ✅ `social.x` (opt-in) |
| Facebook / Instagram | ToS forbid scraping; Meta Content Library is for researchers only | ⛔ posts · ✅ political ads via the Ad Library API | | Facebook / Instagram | ToS forbid scraping; Meta Content Library is for researchers only | ⛔ posts · ✅ political ads via the Ad Library API |
| TikTok | Research API (academic only) | ⛔ | | TikTok | Research API (academic only) | ⛔ |
-2
View File
@@ -16,8 +16,6 @@ ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=3000 HOSTNAME=0.0.0.0
COPY --from=build /app/.next/standalone ./ COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public COPY --from=build /app/public ./public
# Next.js caches fetched data here at runtime (portrait proxy).
RUN mkdir -p .next/cache && chown -R node:node .next/cache
USER node USER node
EXPOSE 3000 EXPOSE 3000
CMD ["node", "server.js"] CMD ["node", "server.js"]
+38 -289
View File
@@ -4,6 +4,7 @@
"description": "Was Österreichs Politikerinnen und Politiker tun: Abstimmungen, Geld, Auftritte, Aussagen – jede Angabe mit Quelle." "description": "Was Österreichs Politikerinnen und Politiker tun: Abstimmungen, Geld, Auftritte, Aussagen – jede Angabe mit Quelle."
}, },
"Nav": { "Nav": {
"home": "Start",
"persons": "Personen", "persons": "Personen",
"parties": "Parteien", "parties": "Parteien",
"votes": "Abstimmungen", "votes": "Abstimmungen",
@@ -15,88 +16,22 @@
"former": "Ehemalige", "former": "Ehemalige",
"organizations": "Organisationen", "organizations": "Organisationen",
"money": "Geld", "money": "Geld",
"social": "Social Media", "social": "Social Media"
"wikipedia": "Wikipedia-Bearbeitungen",
"imprint": "Impressum",
"privacy": "Datenschutz"
},
"Imprint": {
"title": "Impressum",
"intro": "Offenlegung gemäß § 5 ECG und §§ 24, 25 MedienG.",
"notConfigured": "Die Angaben zum Medieninhaber sind noch nicht eingetragen. Vor einer Veröffentlichung müssen sie vollständig sein.",
"missing": "[noch nicht eingetragen]",
"ownerHeading": "Medieninhaber und Herausgeber",
"email": "E-Mail",
"purposeHeading": "Unternehmensgegenstand",
"purpose": "Keiner. Politrack ist ein privates, nicht gewinnorientiertes Projekt ohne Werbung.",
"directionHeading": "Grundlegende Richtung",
"direction": "Information über die öffentliche Tätigkeit österreichischer Politikerinnen, Politiker und Parteien auf Grundlage öffentlich zugänglicher Quellen, unabhängig von Parteien und Interessengruppen.",
"correctionsHeading": "Korrekturen und Gegendarstellung",
"corrections": "Eine Angabe ist falsch oder unvollständig? Schreib uns bitte die Nummer der Angabe und eine Quelle. Widersprochene Angaben markieren wir als umstritten, falsche korrigieren wir.",
"liabilityHeading": "Haftung",
"liability": "Alle Angaben stammen aus den jeweils verlinkten Quellen; maßgeblich sind diese. Für die Inhalte verlinkter Seiten sind deren Betreiber verantwortlich."
},
"Privacy": {
"title": "Datenschutz",
"intro": "Welche Daten Politrack verarbeitet und welche Rechte du hast.",
"draft": "Entwurf: Dieser Text wurde noch nicht rechtlich geprüft.",
"missing": "[noch nicht eingetragen]",
"controllerHeading": "Verantwortlicher",
"visitorsHeading": "Wenn du diese Website besuchst",
"visitors": "Politrack verwendet keine Werbung, kein Tracking und keine Skripte, Schriften oder Einbettungen von Dritten. Beim Abruf fallen technisch notwendige Zugriffsdaten an (IP-Adresse, Zeitpunkt, aufgerufene Seite), die nur so lange gespeichert werden, wie es für den sicheren Betrieb nötig ist.",
"cookiesHeading": "Cookies",
"cookies": "Wir speichern nur deine eigenen Einstellungen in Cookies: Quellen- und Themenfilter sowie das Farbschema. Sie dienen keiner Nachverfolgung.",
"imagesHeading": "Porträts",
"images": "Porträts laden wir über unseren eigenen Server, sodass deine IP-Adresse nicht an das Parlament oder andere Quellen übermittelt wird. Links zu externen Quellen öffnest du selbst; dort gelten die Bestimmungen der jeweiligen Betreiber.",
"subjectsHeading": "Daten über Politikerinnen und Politiker",
"subjects": "Politrack verarbeitet personenbezogene Daten ausschließlich zur öffentlichen Rolle von Personen: Funktionen, Abstimmungen, öffentliche Aussagen und Auftritte, gemeldete Nebentätigkeiten, Parteispenden und öffentlich bekannte Verfahren. Private Spender werden nur so genannt, wie es die amtliche Veröffentlichung vorsieht.",
"basisHeading": "Rechtsgrundlage",
"basis": "Berechtigtes Interesse und öffentliches Interesse an politischer Transparenz (Art. 6 Abs. 1 lit. f DSGVO) sowie die Freiheit der Meinungsäußerung und Information (Art. 85 DSGVO).",
"rightsHeading": "Deine Rechte",
"rights": "Du hast das Recht auf Auskunft, Berichtigung, Löschung, Einschränkung und Widerspruch. Wende dich dazu an die oben genannte Adresse. Außerdem kannst du dich bei der Österreichischen Datenschutzbehörde beschweren."
}, },
"Home": { "Home": {
"headline": "Politik in Österreich – nachvollziehbar.", "headline": "Politik in Österreich – nachvollziehbar.",
"intro": "Politrack sammelt öffentlich zugängliche Informationen über Politikerinnen, Politiker und Parteien und verlinkt jede Angabe mit ihren Quellen. Du entscheidest, welchen Quellen du vertraust.", "intro": "Politrack sammelt öffentlich zugängliche Informationen über Politikerinnen, Politiker und Parteien und verlinkt jede Angabe mit ihren Quellen. Du entscheidest, welchen Quellen du vertraust.",
"stats": "{persons} Personen ({active} aktiv) · {claims} belegte Angaben, davon {corroborated} mehrfach bestätigt · {votes} Abstimmungen ({rollCalls} namentlich) · {money} Geldflüsse",
"lastUpdate": "Zuletzt aktualisiert: {date}", "lastUpdate": "Zuletzt aktualisiert: {date}",
"latest": "Neueste Angaben", "latest": "Neueste Angaben",
"filtersActive": "Deine Filter sind aktiv ({count}) – manche Angaben sind ausgeblendet.", "filtersActive": "Deine Filter sind aktiv: {sources} Quellen ausgeblendet, {topics} Themen gewählt.",
"explore": "Entdecken", "explore": "Entdecken",
"exploreMoney": "Geld: Spenden, Aufträge, Inserate, Parteienförderung", "exploreMoney": "Geld: Spenden, Aufträge, Inserate, Parteienförderung",
"exploreOrganizations": "Unternehmen, Vereine, Behörden – und ihre Verbindungen", "exploreOrganizations": "Unternehmen, Vereine, Behörden – und ihre Verbindungen",
"exploreSocial": "Was Politiker:innen öffentlich posten", "exploreSocial": "Was Politiker:innen öffentlich posten",
"exploreWiki": "Wikipedia-Bearbeitungen aus Parlament und Regierung", "exploreWiki": "Wikipedia-Bearbeitungen aus Parlament und Regierung",
"exploreFormer": "Was machen Ehemalige heute?", "exploreFormer": "Was machen Ehemalige heute?",
"exploreCalendar": "Sitzungen, Ausschüsse, Ministerrat, Reisen und Treffen", "exploreCalendar": "Kalender: Sitzungen, Reisen, Treffen"
"quick": "Schnellzugriff",
"quickDonations": "Parteispenden",
"quickRollCalls": "Namentliche Abstimmungen",
"quickAds": "Regierungsinserate",
"quickCalendar": "Kalender",
"statPersons": "Personen, davon {active} aktiv",
"statClaims": "belegte Angaben, {corroborated} mehrfach belegt",
"statVotes": "Abstimmungen, {rollCalls} namentlich",
"statMoney": "Geldflüsse aus amtlichen Registern",
"changeFilters": "Filter ändern",
"searchInTime": "Suche in der Zeit",
"parties": "Parteien",
"activeOfficials": "{count} aktiv",
"latestVotes": "Letzte Abstimmungen",
"allVotes": "Alle Abstimmungen",
"exploreMoneyTitle": "Geld",
"exploreOrganizationsTitle": "Organisationen",
"exploreSocialTitle": "Social Media",
"exploreCalendarTitle": "Kalender",
"exploreFormerTitle": "Ehemalige",
"exploreWikiTitle": "Wikipedia-Bearbeitungen",
"howTitle": "So arbeitet Politrack",
"howMore": "Methodik & Quellen",
"howEvidenceTitle": "Jede Angabe mit Beleg",
"howEvidence": "Angaben stammen aus amtlichen Daten, offenen Registern und Medienberichten. Jede verlinkt ihre Quellen – du kannst alles nachprüfen.",
"howCorroborationTitle": "Unabhängig bestätigt",
"howCorroboration": "Berichten mehrere unabhängige Quellen dasselbe, gilt eine Angabe als mehrfach belegt. Widerspricht eine Quelle, wird sie als umstritten markiert.",
"howInnocenceTitle": "Fair und neutral",
"howInnocence": "Bei Verfahren zeigen wir immer den Stand. Bis zu einer rechtskräftigen Verurteilung gilt die Unschuldsvermutung."
}, },
"Search": { "Search": {
"placeholder": "Person, Thema oder Stichwort …", "placeholder": "Person, Thema oder Stichwort …",
@@ -104,13 +39,7 @@
"results": "Ergebnisse für „{q}“", "results": "Ergebnisse für „{q}“",
"none": "Keine Treffer.", "none": "Keine Treffer.",
"from": "Von", "from": "Von",
"to": "Bis", "to": "Bis"
"title": "Suche",
"intro": "Suche nach Personen, Themen und Stichworten in allen Angaben und Dokumenten – oder gib nur einen Zeitraum an, um alles zu sehen, was in dieser Zeit passiert ist.",
"label": "Suchbegriff",
"inTime": "Angaben im Zeitraum {range}",
"tips": "Tipp: Gib nur ein Datum oder einen Zeitraum ein (ohne Suchbegriff), um alle Angaben aus dieser Zeit zu sehen.",
"details": "Angabe ansehen"
}, },
"Persons": { "Persons": {
"title": "Personen", "title": "Personen",
@@ -135,17 +64,14 @@
"deceased": "Verstorben", "deceased": "Verstorben",
"all": "Alle" "all": "Alle"
}, },
"lastOffice": "Letztes Amt bis {date}", "lastOffice": "Letztes Amt bis {date}"
"intro": "Abgeordnete, Regierungsmitglieder, Landes- und Gemeindepolitiker:innen sowie Funktionär:innen der Parteien.",
"name": "Name",
"namePlaceholder": "z. B. Nachname",
"unverifiedStatus": "Aktuelles Amt nur laut Wikidata – nicht amtlich bestätigt",
"roleMp": "Abgeordnete:r"
}, },
"Person": { "Person": {
"roles": "Funktionen & Mandate", "roles": "Funktionen & Mandate",
"current": "aktuell",
"since": "seit {date}", "since": "seit {date}",
"period": "{from} – {to}", "period": "{from} – {to}",
"social": "Kanäle",
"tabs": { "tabs": {
"overview": "Überblick", "overview": "Überblick",
"votes": "Abstimmungen", "votes": "Abstimmungen",
@@ -157,41 +83,22 @@
"travel": "Reisen & Treffen", "travel": "Reisen & Treffen",
"social": "Social Media" "social": "Social Media"
}, },
"showPartVotes": "Auch Änderungsanträge und Teilabstimmungen anzeigen", "factionVoteNote": "Im Nationalrat wird meist per Aufstehen abgestimmt; offiziell protokolliert ist dann nur das Stimmverhalten der Fraktion. Bei namentlichen Abstimmungen zeigen wir die eigene Stimme – und ob sie von der Fraktion abweicht.",
"hidePartVotes": "Nur Abstimmungen über ganze Texte anzeigen", "noVotes": "Keine Abstimmungen erfasst.",
"factionVoteNote":"Im Nationalrat wird meist per Aufstehen abgestimmt; offiziell protokolliert ist dann nur das Stimmverhalten der Fraktion. Bei namentlichen Abstimmungen zeigen wir die eigene Stimme – und ob sie von der Fraktion abweicht.", "faction": "Fraktion {faction}",
"statusNote": "Status wird aus den Mandaten und Funktionen berechnet: „aktiv“ nur mit bestätigtem aktuellem Amt.",
"roleCorroborated": "mehrfach belegt", "roleCorroborated": "mehrfach belegt",
"unverified": "laut Wikidata – nicht amtlich bestätigt", "unverified": "laut Wikidata – nicht amtlich bestätigt",
"accountUnverified": "Laut Wikidata – nicht amtlich bestätigt", "accountUnverified": "Laut Wikidata – nicht amtlich bestätigt"
"metaDescription": "{name}: Funktionen, Abstimmungen, Geldflüsse, Aussagen und Medienberichte – jede Angabe mit Quelle.",
"member": "Mitglied",
"born": "geboren {date}",
"died": "gestorben {date}",
"elsewhere": "Profile und Kanäle",
"parliamentProfile": "Parlament",
"epProfile": "Europäisches Parlament",
"sections": "Bereiche",
"career": "Laufbahn",
"latest": "Neueste Angaben",
"allClaims": "Alle Angaben",
"glanceTitle": "Auf einen Blick",
"glance": {
"votes": "Abstimmungen",
"statements": "Reden & Aussagen",
"questions": "Anfragen",
"appearances": "Termine & Reisen",
"sideJobs": "Nebentätigkeiten",
"media": "Medienberichte"
},
"moneyClaims": "Angaben zu Geld",
"legalNote": "Verfahren werden mit ihrem Stand gezeigt; automatisch erkannte erscheinen erst nach redaktioneller Prüfung. Es gilt die Unschuldsvermutung.",
"datePrecision": "Bei Reisen und Treffen ist das Datum oft das Veröffentlichungsdatum der Quelle."
}, },
"Parties": { "Parties": {
"title": "Parteien", "title": "Parteien",
"activeOfficials": "{count, plural, one {# aktive:r Funktionsträger:in} other {# aktive Funktionsträger:innen}}", "activeOfficials": "{count} aktive Funktionsträger:innen",
"members": "Aktuelle Funktionsträger:innen", "members": "Aktuelle Funktionsträger:innen",
"donations": "Gemeldete Spenden (Rechnungshof)",
"year": "Jahr", "year": "Jahr",
"total": "Summe",
"count": "Anzahl",
"voteStats": "Stimmverhalten", "voteStats": "Stimmverhalten",
"recentVotes": "Letzte Abstimmungen", "recentVotes": "Letzte Abstimmungen",
"claims": "Belegte Angaben", "claims": "Belegte Angaben",
@@ -208,24 +115,10 @@
"ownership": "Beteiligung" "ownership": "Beteiligung"
}, },
"channels": "Kanäle der Partei und ihrer Mitglieder", "channels": "Kanäle der Partei und ihrer Mitglieder",
"allPosts": "Alle Beiträge", "allPosts": "Alle Beiträge"
"intro": "Parteien mit ihren aktuellen Funktionsträger:innen, Abstimmungen, Finanzen und nahestehenden Organisationen.",
"tracked": "{count, plural, one {# Person erfasst} other {# Personen erfasst}}",
"statOfficials": "aktuelle Funktionsträger:innen",
"statFormer": "Ehemalige",
"statVotes": "erfasste Fraktionsstimmen",
"statDissent": "Mandatar:innen mit abweichenden Stimmen",
"voteStatsNote": "Stimmverhalten der Fraktion in allen erfassten Abstimmungen.",
"noMoney": "Keine Geldflüsse erfasst.",
"allMembers": "Alle {count} anzeigen",
"relatedNote": "Laut Rechenschaftsbericht der Partei.",
"allFormer": "Alle Ehemaligen",
"lastMention": "zuletzt in den Medien {date}",
"dissentCount": "{count, plural, one {# abweichende Stimme} other {# abweichende Stimmen}}"
}, },
"Votes": { "Votes": {
"title": "Abstimmungen", "title": "Abstimmungen",
"includePartVotes": "Auch Änderungsanträge und Teilabstimmungen (EU-Parlament)",
"accepted": "angenommen", "accepted": "angenommen",
"rejected": "abgelehnt", "rejected": "abgelehnt",
"for": "dafür", "for": "dafür",
@@ -236,22 +129,13 @@
"item": "Gegenstand", "item": "Gegenstand",
"rollCall": "namentliche Abstimmung", "rollCall": "namentliche Abstimmung",
"dissent": "gegen die eigene Fraktion", "dissent": "gegen die eigene Fraktion",
"factionVote": "Fraktion",
"ownVote": "eigene Stimme", "ownVote": "eigene Stimme",
"individualVotes": "Einzelstimmen", "individualVotes": "Einzelstimmen",
"onlyRollCall": "Nur namentliche Abstimmungen", "onlyRollCall": "Nur namentliche Abstimmungen",
"splitVote": "Getrennte Abstimmung – Details im Protokoll", "splitVote": "Getrennte Abstimmung – Details im Protokoll",
"spoke": "Rede dazu", "spoke": "Rede dazu",
"speech": "Rede", "speech": "Rede"
"intro": "Wie die Fraktionen im Nationalrat und Bundesrat abgestimmt haben – und bei namentlichen Abstimmungen jede einzelne Stimme.",
"none": "Keine Abstimmungen gefunden.",
"legend": "Legende",
"factionVoteOf": "Stimme der Fraktion {faction}",
"vote": "Abstimmung",
"factions": "Fraktionen",
"factionOnly": "Protokolliert ist das Stimmverhalten der Fraktionen, nicht einzelner Abgeordneter.",
"dissentSummary": "{count, plural, one {# Abgeordnete:r stimmte} other {# Abgeordnete stimmten}} gegen die eigene Fraktion.",
"protocolText": "Wortlaut im Protokoll",
"filteredParty": "Gefiltert nach Partei: {party}"
}, },
"Claims": { "Claims": {
"sources": "{count, plural, one {# Quelle} other {# Quellen}}", "sources": "{count, plural, one {# Quelle} other {# Quellen}}",
@@ -265,8 +149,8 @@
"mentions": "erwähnt", "mentions": "erwähnt",
"contradicts": "widerspricht", "contradicts": "widerspricht",
"none": "Keine Angaben mit deinen Quellen- und Themenfiltern.", "none": "Keine Angaben mit deinen Quellen- und Themenfiltern.",
"more": "Weitere laden",
"type": { "type": {
"election_result": "Wahlergebnis",
"role": "Funktion", "role": "Funktion",
"vote": "Abstimmung", "vote": "Abstimmung",
"donation": "Spende", "donation": "Spende",
@@ -304,11 +188,7 @@
"proceedings_dropped": "Verfahren eingestellt", "proceedings_dropped": "Verfahren eingestellt",
"diversion": "Diversion (keine Verurteilung)" "diversion": "Diversion (keine Verurteilung)"
}, },
"pending": "Noch nicht redaktionell geprüft", "pending": "Noch nicht redaktionell geprüft"
"evidence": "{count, plural, one {# Beleg} other {# Belege}}",
"permalink": "Permalink",
"permalinkHint": "Eigene Seite dieser Angabe – zum Teilen und Zitieren",
"archived": "archivierte Kopie"
}, },
"Settings": { "Settings": {
"title": "Meine Filter", "title": "Meine Filter",
@@ -328,9 +208,7 @@
"aggregator": "Datenbanken", "aggregator": "Datenbanken",
"user": "Community", "user": "Community",
"derived": "Abgeleitet" "derived": "Abgeleitet"
}, }
"sourcesHint": "Ausgeschaltete Quellen werden überall ausgeblendet. Die Zahl ist der voreingestellte Vertrauenswert (0–100).",
"trust": "Vertrauenswert"
}, },
"Method": { "Method": {
"title": "Methodik & Quellen", "title": "Methodik & Quellen",
@@ -339,66 +217,11 @@
"p3": "Zu strafrechtlichen Angelegenheiten zeigen wir stets den Verfahrensstand. Bis zu einer rechtskräftigen Verurteilung gilt die Unschuldsvermutung.", "p3": "Zu strafrechtlichen Angelegenheiten zeigen wir stets den Verfahrensstand. Bis zu einer rechtskräftigen Verurteilung gilt die Unschuldsvermutung.",
"license": "Lizenz", "license": "Lizenz",
"access": "Zugriff", "access": "Zugriff",
"trust": "Vertrauen", "trust": "Vertrauen"
"intro": "Wie Politrack Angaben sammelt, prüft und zeigt.",
"toc": "Inhalt",
"section": {
"claims": "Angaben und Belege",
"certainty": "Wie sicher eine Angabe ist",
"legal": "Rechtliche Verfahren",
"sources": "Quellen",
"notCollected": "Was wir nicht erfassen",
"data": "Daten für Entwickler:innen und KI-Agenten",
"corrections": "Korrekturen"
},
"certaintyIntro": "Diese Kennzeichen bedeuten überall auf Politrack dasselbe:",
"reported": "Eine Quelle berichtet die Angabe.",
"corroborated": "Mehrere unabhängige Quellen bestätigen die Angabe.",
"disputed": "Mindestens eine Quelle widerspricht – beide Seiten sind verlinkt.",
"activeVerified": "Aktuelles Amt laut Parlament oder Europäischem Parlament bestätigt.",
"activeUnverified": "Aktuelles Amt nur laut Wikidata, nicht amtlich bestätigt.",
"accountUnverified": "Social-Media-Konto nur laut Wikidata, von keiner offiziellen Seite bestätigt.",
"stage": {
"allegation_reported": "Ein Medium oder eine andere Quelle berichtet über einen Vorwurf; ein Verfahren ist nicht bekannt.",
"investigation": "Staatsanwaltschaft oder Polizei ermitteln. Das sagt nichts über Schuld aus – viele Ermittlungen werden eingestellt.",
"immunity_waiver_requested": "Eine Behörde ersucht das Parlament, die Immunität aufzuheben, um ermitteln zu können.",
"immunity_waived": "Das Parlament hat die Immunität aufgehoben; Ermittlungen sind damit möglich, eine Anklage gibt es dadurch nicht.",
"immunity_refused": "Das Parlament hat die Aufhebung der Immunität abgelehnt.",
"indicted": "Die Staatsanwaltschaft hat Anklage erhoben; ein Gericht entscheidet.",
"trial": "Das Gerichtsverfahren läuft.",
"convicted_not_final": "Ein Gericht hat verurteilt, das Urteil ist aber nicht rechtskräftig (Rechtsmittel möglich).",
"convicted_final": "Rechtskräftige Verurteilung – das Verfahren ist abgeschlossen.",
"acquitted": "Das Gericht hat freigesprochen.",
"proceedings_dropped": "Das Verfahren wurde eingestellt.",
"diversion": "Erledigung ohne Verurteilung (z. B. Geldbuße oder gemeinnützige Leistung); kein Schuldspruch, kein Strafregistereintrag."
},
"sourcesIntro": "Alle Quellen mit Lizenz, Zugriffsart und voreingestelltem Vertrauenswert. Unter „Meine Filter“ kannst du einzelne Quellen ausblenden oder einen Mindestwert festlegen.",
"source": "Quelle",
"kind": "Art",
"notCollected": "Wir umgehen keine Bezahlschranken, Logins oder technischen Sperren und halten uns an robots.txt und Nutzungsbedingungen. Von Medien speichern wir nur Überschrift, Teaser und Link.",
"data": "Die Betreiber:innen dieser Instanz stellen die Daten auch maschinenlesbar bereit: als REST-API mit OpenAPI-Dokumentation, als MCP-Server für KI-Agenten und als Lesezugriff auf die Datenbank. Jede Angabe kommt dort mit denselben Belegen wie hier.",
"corrections": "Fehler gefunden? Wir korrigieren falsche Angaben, markieren widersprochene als umstritten und löschen nichts stillschweigend. Bitte nenne die Nummer der Angabe (siehe Permalink) und eine Quelle für die Korrektur.",
"correctionsContact": "Kontakt für Korrekturen"
}, },
"Common": { "Common": {
"loadError": "Die Daten konnten nicht geladen werden. Bitte versuche es gleich noch einmal.", "loadError": "Daten konnten nicht geladen werden.",
"notFound": "Diese Seite gibt es nicht (mehr). Vielleicht hilft die Suche weiter.", "notFound": "Nicht gefunden."
"home": "Start",
"persons": "Personen",
"search": "Suche",
"breadcrumb": "Navigationspfad",
"filters": "Filter",
"apply": "Anwenden",
"reset": "Zurücksetzen",
"previous": "Zurück",
"next": "Weiter",
"page": "Seite {page}",
"pagination": "Seiten",
"newTab": "öffnet in neuem Tab",
"loading": "Wird geladen …",
"retry": "Erneut versuchen",
"errorTitle": "Das hat nicht geklappt",
"notFoundTitle": "Seite nicht gefunden"
}, },
"Timeline": { "Timeline": {
"from": "Von", "from": "Von",
@@ -410,9 +233,9 @@
"Calendar": { "Calendar": {
"title": "Kalender", "title": "Kalender",
"intro": "Sitzungen, Ausschüsse, Reisen, Treffen und Auftritte – mit Quellen.", "intro": "Sitzungen, Ausschüsse, Reisen, Treffen und Auftritte – mit Quellen.",
"prev": "Vormonat", "prev": "← Vormonat",
"next": "Nächster Monat", "next": "Nächster Monat →",
"person": "Person", "person": "Person (Kurzname)",
"none": "Keine Termine in diesem Zeitraum.", "none": "Keine Termine in diesem Zeitraum.",
"activity": "{count} Angaben", "activity": "{count} Angaben",
"kind": { "kind": {
@@ -429,42 +252,21 @@
"hearing": "Befragung (U-Ausschuss)", "hearing": "Befragung (U-Ausschuss)",
"government_meeting": "Ministerrat" "government_meeting": "Ministerrat"
}, },
"datePrecision": "Datum = Veröffentlichungsdatum der Quelle", "datePrecision": "Datum = Veröffentlichungsdatum der Quelle"
"today": "Heute",
"personPlaceholder": "Name",
"kindLabel": "Art",
"allKinds": "Alle Arten",
"legend": "Legende",
"group": {
"parliament": "Parlament",
"government": "Regierung",
"travel": "Reisen & Treffen",
"public": "Öffentliche Auftritte"
},
"more": "+{count} weitere",
"activityHint": "Alle Angaben von diesem Tag"
}, },
"Former": { "Former": {
"title": "Was machen ehemalige Politikerinnen und Politiker?", "title": "Was machen ehemalige Politikerinnen und Politiker?",
"intro": "Ehemalige Mandatarinnen, Mandatare und Funktionsträger:innen – sortiert nach der jüngsten Berichterstattung.", "intro": "Ehemalige Mandatarinnen, Mandatare und Funktionsträger:innen – sortiert nach der jüngsten Berichterstattung.",
"lastRole": "Zuletzt: {role}", "lastRole": "Zuletzt: {role}",
"latestNews": "Zuletzt in den Medien", "latestNews": "Zuletzt in den Medien",
"career": "Werdegang", "career": "Werdegang"
"none": "Keine ehemaligen Politiker:innen gefunden."
}, },
"ClaimDetails": { "ClaimDetails": {
"with": "mit", "with": "mit",
"reference": "Ref.", "reference": "Ref.",
"article": "Artikel", "article": "Artikel",
"fileNumber": "GZ", "fileNumber": "GZ",
"financeDetails": "Details Rechenschaftsbericht {year}", "financeDetails": "Details Rechenschaftsbericht {year}"
"metric": {
"likes": "Likes",
"reposts": "Reposts",
"favourites": "Favoriten",
"reblogs": "Boosts",
"views": "Aufrufe"
}
}, },
"Money": { "Money": {
"title": "Geld", "title": "Geld",
@@ -499,10 +301,7 @@
"side_income": "Nebeneinkommen", "side_income": "Nebeneinkommen",
"sponsorship": "Sponsoring", "sponsorship": "Sponsoring",
"other": "Sonstiges" "other": "Sonstiges"
}, }
"flows": "Einzelne Geldflüsse",
"nameLabel": "Name",
"asReported": "Beträge wie gemeldet."
}, },
"Organizations": { "Organizations": {
"title": "Organisationen", "title": "Organisationen",
@@ -551,14 +350,7 @@
"authority": "Behörde", "authority": "Behörde",
"eu_institution": "EU-Institution", "eu_institution": "EU-Institution",
"other": "Sonstige" "other": "Sonstige"
}, }
"receivedTotal": "erhalten (gesamt)",
"paidTotal": "gezahlt (gesamt)",
"counterpartyCount": "Gegenparteien",
"receivedFromTitle": "Erhielt Geld von",
"paidToTitle": "Zahlte an",
"noMoney": "Keine Geldflüsse erfasst.",
"identifiers": "Kennungen"
}, },
"Network": { "Network": {
"title": "Netzwerk: verbundene Organisationen", "title": "Netzwerk: verbundene Organisationen",
@@ -574,18 +366,13 @@
"role": "Funktion", "role": "Funktion",
"lobbying": "Lobbying", "lobbying": "Lobbying",
"party": "Partei" "party": "Partei"
}, }
"organization": "Organisation",
"connection": "Verbindung",
"money": "Geld dieser Organisation"
}, },
"Social": { "Social": {
"title": "Social Media", "title": "Social Media",
"intro": "Öffentliche Beiträge von Politiker:innen und Parteien auf Bluesky, Mastodon, öffentlichen Telegram-Kanälen und YouTube.", "intro": "Öffentliche Beiträge von Politiker:innen und Parteien auf Bluesky, Mastodon, öffentlichen Telegram-Kanälen und YouTube.",
"none": "Keine Beiträge.", "none": "Keine Beiträge.",
"original": "Original ansehen", "original": "Original ansehen",
"removed": "Dieser Beitrag ist auf der Plattform nicht mehr verfügbar (festgestellt am {date}). Seinen Text zeigen wir daher nicht mehr.",
"archivedCopy": "Kopie im Internet Archive",
"unverified": "Konto nicht bestätigt", "unverified": "Konto nicht bestätigt",
"unverifiedHint": "Das Konto stammt aus Wikidata und wurde von keiner offiziellen Seite bestätigt.", "unverifiedHint": "Das Konto stammt aus Wikidata und wurde von keiner offiziellen Seite bestätigt.",
"platform": "Plattform", "platform": "Plattform",
@@ -602,44 +389,6 @@
"network": "Netzwerk", "network": "Netzwerk",
"article": "Artikel", "article": "Artikel",
"change": "Änderung", "change": "Änderung",
"note": "Eine Bearbeitung aus einem Netzwerk sagt nichts darüber, welche Person sie vorgenommen hat.", "note": "Eine Bearbeitung aus einem Netzwerk sagt nichts darüber, welche Person sie vorgenommen hat. IP-Bereiche: config/ip_ranges.yaml."
"ranges": "Die IP-Bereiche stehen in config/ip_ranges.yaml im Quellcode."
},
"Layout": {
"skip": "Zum Inhalt springen",
"homeLabel": "Politrack – Startseite",
"mainNav": "Hauptnavigation",
"footerNav": "Seitenübersicht",
"more": "Mehr",
"menu": "Menü",
"searchLabel": "Suche",
"searchPlaceholder": "Suchen …",
"filtersActive": "Meine Filter: {count} aktiv",
"themeLabel": "Farbschema: {current} – wechseln zu {next}",
"theme": {
"system": "wie System",
"light": "hell",
"dark": "dunkel"
},
"group": {
"people": "Menschen",
"decisions": "Entscheidungen",
"influence": "Geld & Einfluss",
"about": "Über Politrack"
}
},
"Footer": {
"tagline": "Österreichs Politik, belegt. Ein unabhängiges Projekt, das öffentlich zugängliche Informationen über Politikerinnen, Politiker und Parteien sammelt – jede Angabe mit Quelle.",
"principleEvidence": "Jede Angabe mit Beleg",
"principleInnocence": "Es gilt die Unschuldsvermutung",
"principlePrivacy": "Keine Werbung, kein Tracking",
"developers": "Daten, API & KI-Agenten",
"bottom": "Angaben ohne Gewähr. Jede Angabe verweist auf ihre Quellen – maßgeblich sind diese."
},
"ClaimPage": {
"crumb": "Angabe #{id}",
"cite": "Zitieren",
"citation": "Politrack: „{summary}“. Angabe #{id}, abgerufen am {date}. {url}",
"filtersIgnored": "Diese Seite zeigt die Angabe mit allen Quellen – unabhängig von deinen Filtern, damit ein geteilter Link für alle gleich aussieht."
} }
} }
+38 -289
View File
@@ -4,6 +4,7 @@
"description": "What Austria's politicians do: votes, money, appearances, statements – every claim with its sources." "description": "What Austria's politicians do: votes, money, appearances, statements – every claim with its sources."
}, },
"Nav": { "Nav": {
"home": "Home",
"persons": "People", "persons": "People",
"parties": "Parties", "parties": "Parties",
"votes": "Votes", "votes": "Votes",
@@ -15,53 +16,22 @@
"former": "Former politicians", "former": "Former politicians",
"organizations": "Organisations", "organizations": "Organisations",
"money": "Money", "money": "Money",
"social": "Social media", "social": "Social media"
"wikipedia": "Wikipedia edits",
"imprint": "Legal notice",
"privacy": "Privacy"
}, },
"Home": { "Home": {
"headline": "Austrian politics – traceable.", "headline": "Austrian politics – traceable.",
"intro": "Politrack collects publicly available information about politicians and parties and links every claim to its sources. You decide which sources you trust.", "intro": "Politrack collects publicly available information about politicians and parties and links every claim to its sources. You decide which sources you trust.",
"stats": "{persons} people ({active} active) · {claims} sourced claims, {corroborated} corroborated · {votes} votes ({rollCalls} roll calls) · {money} money flows",
"lastUpdate": "Last updated: {date}", "lastUpdate": "Last updated: {date}",
"latest": "Latest claims", "latest": "Latest claims",
"filtersActive": "Your filters are active ({count}) – some facts are hidden.", "filtersActive": "Your filters are active: {sources} sources hidden, {topics} topics selected.",
"explore": "Explore", "explore": "Explore",
"exploreMoney": "Money: donations, contracts, ads, party funding", "exploreMoney": "Money: donations, contracts, ads, party funding",
"exploreOrganizations": "Companies, associations, authorities – and their connections", "exploreOrganizations": "Companies, associations, authorities – and their connections",
"exploreSocial": "What politicians post publicly", "exploreSocial": "What politicians post publicly",
"exploreWiki": "Wikipedia edits from parliament and government", "exploreWiki": "Wikipedia edits from parliament and government",
"exploreFormer": "What are former politicians doing?", "exploreFormer": "What are former politicians doing?",
"exploreCalendar": "Sessions, committees, Council of Ministers, trips and meetings", "exploreCalendar": "Calendar: sessions, trips, meetings"
"quick": "Quick links",
"quickDonations": "Party donations",
"quickRollCalls": "Roll-call votes",
"quickAds": "Government ads",
"quickCalendar": "Calendar",
"statPersons": "people, {active} in office",
"statClaims": "sourced facts, {corroborated} corroborated",
"statVotes": "votes, {rollCalls} roll calls",
"statMoney": "money flows from official registers",
"changeFilters": "Change filters",
"searchInTime": "Search in time",
"parties": "Parties",
"activeOfficials": "{count} active",
"latestVotes": "Latest votes",
"allVotes": "All votes",
"exploreMoneyTitle": "Money",
"exploreOrganizationsTitle": "Organisations",
"exploreSocialTitle": "Social media",
"exploreCalendarTitle": "Calendar",
"exploreFormerTitle": "Former politicians",
"exploreWikiTitle": "Wikipedia edits",
"howTitle": "How Politrack works",
"howMore": "Methodology & sources",
"howEvidenceTitle": "Every fact has a source",
"howEvidence": "Facts come from official data, open registers and media reports. Each links to its sources, so you can check everything.",
"howCorroborationTitle": "Independently confirmed",
"howCorroboration": "When several independent sources report the same thing, a fact counts as corroborated. If a source contradicts it, it is marked as disputed.",
"howInnocenceTitle": "Fair and neutral",
"howInnocence": "For legal proceedings we always show the stage. Until a final conviction, the presumption of innocence applies."
}, },
"Search": { "Search": {
"placeholder": "Person, topic or keyword …", "placeholder": "Person, topic or keyword …",
@@ -69,13 +39,7 @@
"results": "Results for “{q}”", "results": "Results for “{q}”",
"none": "No results.", "none": "No results.",
"from": "From", "from": "From",
"to": "To", "to": "To"
"title": "Search",
"intro": "Search people, topics and keywords across all facts and documents – or enter only a date range to see everything that happened in that period.",
"label": "Search term",
"inTime": "Facts from {range}",
"tips": "Tip: enter only a date or a date range (no search term) to see all facts from that time.",
"details": "View fact"
}, },
"Persons": { "Persons": {
"title": "People", "title": "People",
@@ -100,17 +64,14 @@
"deceased": "Deceased", "deceased": "Deceased",
"all": "All" "all": "All"
}, },
"lastOffice": "Last office until {date}", "lastOffice": "Last office until {date}"
"intro": "MPs, members of government, state and municipal politicians, and party officials.",
"name": "Name",
"namePlaceholder": "e.g. last name",
"unverifiedStatus": "Current office only according to Wikidata – not officially confirmed",
"roleMp": "Member of parliament"
}, },
"Person": { "Person": {
"roles": "Offices & mandates", "roles": "Offices & mandates",
"current": "current",
"since": "since {date}", "since": "since {date}",
"period": "{from} – {to}", "period": "{from} – {to}",
"social": "Channels",
"tabs": { "tabs": {
"overview": "Overview", "overview": "Overview",
"votes": "Votes", "votes": "Votes",
@@ -122,41 +83,22 @@
"travel": "Travel & meetings", "travel": "Travel & meetings",
"social": "Social media" "social": "Social media"
}, },
"showPartVotes": "Also show amendments and part votes", "factionVoteNote": "The National Council mostly votes by standing up; then only each faction's vote is recorded. For roll-call votes we show the person's own vote – and whether it differs from their faction.",
"hidePartVotes": "Show votes on whole texts only", "noVotes": "No votes recorded.",
"factionVoteNote":"The National Council mostly votes by standing up; then only each faction's vote is recorded. For roll-call votes we show the person's own vote – and whether it differs from their faction.", "faction": "Faction {faction}",
"statusNote": "Status is derived from mandates and functions: \"active\" only with a verified current office.",
"roleCorroborated": "corroborated", "roleCorroborated": "corroborated",
"unverified": "per Wikidata – not officially confirmed", "unverified": "per Wikidata – not officially confirmed",
"accountUnverified": "According to Wikidata – not officially confirmed", "accountUnverified": "According to Wikidata – not officially confirmed"
"metaDescription": "{name}: offices, votes, money, statements and media reports – every fact with its source.",
"member": "Member",
"born": "born {date}",
"died": "died {date}",
"elsewhere": "Profiles and channels",
"parliamentProfile": "Parliament",
"epProfile": "European Parliament",
"sections": "Sections",
"career": "Career",
"latest": "Latest facts",
"allClaims": "All facts",
"glanceTitle": "At a glance",
"glance": {
"votes": "votes",
"statements": "speeches & statements",
"questions": "questions",
"appearances": "appointments & trips",
"sideJobs": "side jobs",
"media": "media reports"
},
"moneyClaims": "Money-related facts",
"legalNote": "Proceedings are shown with their stage; automatically detected ones appear only after editorial review. The presumption of innocence applies.",
"datePrecision": "For trips and meetings the date is often the publication date of the source."
}, },
"Parties": { "Parties": {
"title": "Parties", "title": "Parties",
"activeOfficials": "{count, plural, one {# active official} other {# active officials}}", "activeOfficials": "{count} active officials",
"members": "Current officials", "members": "Current officials",
"donations": "Reported donations (Court of Audit)",
"year": "Year", "year": "Year",
"total": "Total",
"count": "Count",
"voteStats": "Voting record", "voteStats": "Voting record",
"recentVotes": "Recent votes", "recentVotes": "Recent votes",
"claims": "Sourced claims", "claims": "Sourced claims",
@@ -173,24 +115,10 @@
"ownership": "holding" "ownership": "holding"
}, },
"channels": "Channels of the party and its members", "channels": "Channels of the party and its members",
"allPosts": "All posts", "allPosts": "All posts"
"intro": "Parties with their current officials, votes, finances and affiliated organisations.",
"tracked": "{count, plural, one {# person tracked} other {# people tracked}}",
"statOfficials": "current officials",
"statFormer": "former members",
"statVotes": "faction votes recorded",
"statDissent": "members who voted against their faction",
"voteStatsNote": "The faction's positions in all recorded votes.",
"noMoney": "No money flows recorded.",
"allMembers": "Show all {count}",
"relatedNote": "According to the party's annual report.",
"allFormer": "All former members",
"lastMention": "last in the news {date}",
"dissentCount": "{count, plural, one {# dissenting vote} other {# dissenting votes}}"
}, },
"Votes": { "Votes": {
"title": "Votes", "title": "Votes",
"includePartVotes": "Include amendments and part votes (European Parliament)",
"accepted": "accepted", "accepted": "accepted",
"rejected": "rejected", "rejected": "rejected",
"for": "for", "for": "for",
@@ -201,22 +129,13 @@
"item": "Item", "item": "Item",
"rollCall": "roll-call vote", "rollCall": "roll-call vote",
"dissent": "against own faction", "dissent": "against own faction",
"factionVote": "faction",
"ownVote": "own vote", "ownVote": "own vote",
"individualVotes": "Individual votes", "individualVotes": "Individual votes",
"onlyRollCall": "Roll-call votes only", "onlyRollCall": "Roll-call votes only",
"splitVote": "Split vote – see transcript", "splitVote": "Split vote – see transcript",
"spoke": "Spoke on this", "spoke": "Spoke on this",
"speech": "Speech", "speech": "Speech"
"intro": "How the factions voted in the Nationalrat and Bundesrat – and, in roll-call votes, every individual vote.",
"none": "No votes found.",
"legend": "Legend",
"factionVoteOf": "vote of the {faction} faction",
"vote": "Vote",
"factions": "Factions",
"factionOnly": "The record shows how each faction voted, not individual MPs.",
"dissentSummary": "{count, plural, one {# member voted} other {# members voted}} against their faction.",
"protocolText": "Wording in the record",
"filteredParty": "Filtered by party: {party}"
}, },
"Claims": { "Claims": {
"sources": "{count, plural, one {# source} other {# sources}}", "sources": "{count, plural, one {# source} other {# sources}}",
@@ -230,8 +149,8 @@
"mentions": "mentions", "mentions": "mentions",
"contradicts": "contradicts", "contradicts": "contradicts",
"none": "No claims match your source and topic filters.", "none": "No claims match your source and topic filters.",
"more": "Load more",
"type": { "type": {
"election_result": "Election result",
"role": "Office", "role": "Office",
"vote": "Vote", "vote": "Vote",
"donation": "Donation", "donation": "Donation",
@@ -269,11 +188,7 @@
"proceedings_dropped": "Proceedings dropped", "proceedings_dropped": "Proceedings dropped",
"diversion": "Diversion (no conviction)" "diversion": "Diversion (no conviction)"
}, },
"pending": "Not yet reviewed", "pending": "Not yet reviewed"
"evidence": "{count, plural, one {# source} other {# sources}}",
"permalink": "Permalink",
"permalinkHint": "This fact's own page – for sharing and citing",
"archived": "archived copy"
}, },
"Settings": { "Settings": {
"title": "My filters", "title": "My filters",
@@ -293,9 +208,7 @@
"aggregator": "Databases", "aggregator": "Databases",
"user": "Community", "user": "Community",
"derived": "Derived" "derived": "Derived"
}, }
"sourcesHint": "Sources you switch off are hidden everywhere. The number is the default trust score (0–100).",
"trust": "Trust score"
}, },
"Method": { "Method": {
"title": "Method & sources", "title": "Method & sources",
@@ -304,66 +217,11 @@
"p3": "For criminal matters we always show the procedural stage. The presumption of innocence applies until a final conviction.", "p3": "For criminal matters we always show the procedural stage. The presumption of innocence applies until a final conviction.",
"license": "Licence", "license": "Licence",
"access": "Access", "access": "Access",
"trust": "Trust", "trust": "Trust"
"intro": "How Politrack collects, checks and presents facts.",
"toc": "Contents",
"section": {
"claims": "Facts and sources",
"certainty": "How certain a fact is",
"legal": "Legal proceedings",
"sources": "Sources",
"notCollected": "What we don't collect",
"data": "Data for developers and AI agents",
"corrections": "Corrections"
},
"certaintyIntro": "These labels mean the same everywhere on Politrack:",
"reported": "One source reports the fact.",
"corroborated": "Several independent sources confirm the fact.",
"disputed": "At least one source contradicts it – both sides are linked.",
"activeVerified": "Current office confirmed by the Austrian or European Parliament.",
"activeUnverified": "Current office only according to Wikidata, not officially confirmed.",
"accountUnverified": "Social media account only according to Wikidata, not confirmed by an official source.",
"stage": {
"allegation_reported": "A media outlet or another source reports an allegation; no proceedings are known.",
"investigation": "Prosecutors or police are investigating. This says nothing about guilt – many investigations are dropped.",
"immunity_waiver_requested": "An authority asks parliament to lift immunity so it can investigate.",
"immunity_waived": "Parliament has lifted immunity; this allows an investigation and is not an indictment.",
"immunity_refused": "Parliament has refused to lift immunity.",
"indicted": "Prosecutors have brought charges; a court will decide.",
"trial": "The trial is ongoing.",
"convicted_not_final": "A court has convicted, but the judgment is not final (an appeal is possible).",
"convicted_final": "Final conviction – the proceedings are closed.",
"acquitted": "The court has acquitted.",
"proceedings_dropped": "The proceedings were dropped.",
"diversion": "Settled without a conviction (e.g. a fine or community service); no finding of guilt, no criminal record."
},
"sourcesIntro": "All sources with their licence, access method and default trust score. Under “My filters” you can hide individual sources or set a minimum score.",
"source": "Source",
"kind": "Kind",
"notCollected": "We don't get around paywalls, logins or technical barriers, and we respect robots.txt and terms of use. From media we store only the headline, teaser and link.",
"data": "The operators of this instance also provide the data in machine-readable form: a REST API with OpenAPI documentation, an MCP server for AI agents and read access to the database. Every fact comes with the same sources as here.",
"corrections": "Found a mistake? We correct wrong facts, mark contradicted ones as disputed and never delete anything silently. Please quote the fact's number (see its permalink) and a source for the correction.",
"correctionsContact": "Contact for corrections"
}, },
"Common": { "Common": {
"loadError": "The data could not be loaded. Please try again in a moment.", "loadError": "Could not load data.",
"notFound": "This page doesn't exist (any more). The search may help.", "notFound": "Not found."
"home": "Home",
"persons": "People",
"search": "Search",
"breadcrumb": "Breadcrumb",
"filters": "Filters",
"apply": "Apply",
"reset": "Reset",
"previous": "Previous",
"next": "Next",
"page": "Page {page}",
"pagination": "Pages",
"newTab": "opens in a new tab",
"loading": "Loading …",
"retry": "Try again",
"errorTitle": "Something went wrong",
"notFoundTitle": "Page not found"
}, },
"Timeline": { "Timeline": {
"from": "From", "from": "From",
@@ -375,9 +233,9 @@
"Calendar": { "Calendar": {
"title": "Calendar", "title": "Calendar",
"intro": "Sessions, committees, trips, meetings and appearances – with sources.", "intro": "Sessions, committees, trips, meetings and appearances – with sources.",
"prev": "Previous month", "prev": "← Previous month",
"next": "Next month", "next": "Next month →",
"person": "Person", "person": "Person (slug)",
"none": "No events in this period.", "none": "No events in this period.",
"activity": "{count} claims", "activity": "{count} claims",
"kind": { "kind": {
@@ -394,42 +252,21 @@
"hearing": "Hearing (inquiry committee)", "hearing": "Hearing (inquiry committee)",
"government_meeting": "Council of Ministers" "government_meeting": "Council of Ministers"
}, },
"datePrecision": "Date = publication date of the source", "datePrecision": "Date = publication date of the source"
"today": "Today",
"personPlaceholder": "Name",
"kindLabel": "Kind",
"allKinds": "All kinds",
"legend": "Legend",
"group": {
"parliament": "Parliament",
"government": "Government",
"travel": "Trips & meetings",
"public": "Public appearances"
},
"more": "+{count} more",
"activityHint": "All facts from this day"
}, },
"Former": { "Former": {
"title": "What are former politicians up to?", "title": "What are former politicians up to?",
"intro": "Former office holders – sorted by most recent news coverage.", "intro": "Former office holders – sorted by most recent news coverage.",
"lastRole": "Last: {role}", "lastRole": "Last: {role}",
"latestNews": "Latest coverage", "latestNews": "Latest coverage",
"career": "Career", "career": "Career"
"none": "No former politicians found."
}, },
"ClaimDetails": { "ClaimDetails": {
"with": "with", "with": "with",
"reference": "Ref.", "reference": "Ref.",
"article": "Article", "article": "Article",
"fileNumber": "File no.", "fileNumber": "File no.",
"financeDetails": "Annual report {year} details", "financeDetails": "Annual report {year} details"
"metric": {
"likes": "likes",
"reposts": "reposts",
"favourites": "favourites",
"reblogs": "boosts",
"views": "views"
}
}, },
"Money": { "Money": {
"title": "Money", "title": "Money",
@@ -464,10 +301,7 @@
"side_income": "Side income", "side_income": "Side income",
"sponsorship": "Sponsorship", "sponsorship": "Sponsorship",
"other": "Other" "other": "Other"
}, }
"flows": "Individual money flows",
"nameLabel": "Name",
"asReported": "Amounts as reported."
}, },
"Organizations": { "Organizations": {
"title": "Organisations", "title": "Organisations",
@@ -516,14 +350,7 @@
"authority": "Authority", "authority": "Authority",
"eu_institution": "EU institution", "eu_institution": "EU institution",
"other": "Other" "other": "Other"
}, }
"receivedTotal": "received (total)",
"paidTotal": "paid (total)",
"counterpartyCount": "counterparties",
"receivedFromTitle": "Received money from",
"paidToTitle": "Paid to",
"noMoney": "No money flows recorded.",
"identifiers": "Identifiers"
}, },
"Network": { "Network": {
"title": "Network: connected organisations", "title": "Network: connected organisations",
@@ -539,18 +366,13 @@
"role": "office", "role": "office",
"lobbying": "lobbying", "lobbying": "lobbying",
"party": "party" "party": "party"
}, }
"organization": "Organisation",
"connection": "Connection",
"money": "This organisation's money"
}, },
"Social": { "Social": {
"title": "Social media", "title": "Social media",
"intro": "Public posts by politicians and parties on Bluesky, Mastodon, public Telegram channels and YouTube.", "intro": "Public posts by politicians and parties on Bluesky, Mastodon, public Telegram channels and YouTube.",
"none": "No posts.", "none": "No posts.",
"original": "View original", "original": "View original",
"removed": "This post is no longer available on the platform (detected on {date}), so we no longer show its text.",
"archivedCopy": "Copy in the Internet Archive",
"unverified": "account unconfirmed", "unverified": "account unconfirmed",
"unverifiedHint": "The account comes from Wikidata and was not confirmed by an official page.", "unverifiedHint": "The account comes from Wikidata and was not confirmed by an official page.",
"platform": "Platform", "platform": "Platform",
@@ -567,79 +389,6 @@
"network": "Network", "network": "Network",
"article": "Article", "article": "Article",
"change": "Change", "change": "Change",
"note": "An edit from a network says nothing about which person made it.", "note": "An edit from a network says nothing about which person made it. IP ranges: config/ip_ranges.yaml."
"ranges": "The IP ranges are listed in config/ip_ranges.yaml in the source code."
},
"Layout": {
"skip": "Skip to content",
"homeLabel": "Politrack – home",
"mainNav": "Main navigation",
"footerNav": "Site map",
"more": "More",
"menu": "Menu",
"searchLabel": "Search",
"searchPlaceholder": "Search …",
"filtersActive": "My filters: {count} active",
"themeLabel": "Colour scheme: {current} – switch to {next}",
"theme": {
"system": "system",
"light": "light",
"dark": "dark"
},
"group": {
"people": "People",
"decisions": "Decisions",
"influence": "Money & influence",
"about": "About Politrack"
}
},
"Imprint": {
"title": "Legal notice",
"intro": "Disclosure under § 5 ECG and §§ 24, 25 MedienG (Austrian law).",
"notConfigured": "The publisher's details have not been entered yet. They must be complete before publication.",
"missing": "[not entered yet]",
"ownerHeading": "Media owner and publisher",
"email": "Email",
"purposeHeading": "Business purpose",
"purpose": "None. Politrack is a private, non-profit project without advertising.",
"directionHeading": "Editorial line",
"direction": "Information on the public activity of Austrian politicians and parties, based on publicly available sources and independent of parties and interest groups.",
"correctionsHeading": "Corrections and right of reply",
"corrections": "Is a fact wrong or incomplete? Please send us its number and a source. We mark contradicted facts as disputed and correct wrong ones.",
"liabilityHeading": "Liability",
"liability": "All facts come from the sources linked with them, which are authoritative. Linked sites are the responsibility of their operators."
},
"Privacy": {
"title": "Privacy",
"intro": "What data Politrack processes and what rights you have.",
"draft": "Draft: this text has not been legally reviewed yet.",
"missing": "[not entered yet]",
"controllerHeading": "Controller",
"visitorsHeading": "When you visit this website",
"visitors": "Politrack uses no advertising, no tracking and no third-party scripts, fonts or embeds. Serving a page produces technically necessary access data (IP address, time, page requested), kept only as long as needed to run the site securely.",
"cookiesHeading": "Cookies",
"cookies": "Cookies only store your own settings: source and topic filters and the colour scheme. They are not used for tracking.",
"imagesHeading": "Portraits",
"images": "Portraits are loaded through our own server, so your IP address is not passed to the parliament or other sources. External source links are yours to open; the operators' own terms apply there.",
"subjectsHeading": "Data about politicians",
"subjects": "Politrack processes personal data only about people's public role: offices, votes, public statements and appearances, declared side jobs, party donations and publicly known proceedings. Private donors are named only as the official publication names them.",
"basisHeading": "Legal basis",
"basis": "Legitimate and public interest in political transparency (Art. 6(1)(f) GDPR) and freedom of expression and information (Art. 85 GDPR).",
"rightsHeading": "Your rights",
"rights": "You have the right to access, rectification, erasure, restriction and objection. Please contact the address above. You can also complain to the Austrian Data Protection Authority."
},
"Footer": {
"tagline": "Austrian politics, sourced. An independent project that collects public information on politicians and parties – every fact with its source.",
"principleEvidence": "Every fact with its source",
"principleInnocence": "Presumption of innocence",
"principlePrivacy": "No ads, no tracking",
"developers": "Data, API & AI agents",
"bottom": "No liability for the data. Every fact links to its sources, which are authoritative."
},
"ClaimPage": {
"crumb": "Fact #{id}",
"cite": "Cite",
"citation": "Politrack: “{summary}”. Fact #{id}, retrieved {date}. {url}",
"filtersIgnored": "This page shows the fact with all its sources – regardless of your filters, so a shared link looks the same for everyone."
} }
} }
-72
View File
@@ -1,72 +0,0 @@
// Phone-width audit: emulate a 390x844 phone through the DevTools protocol (a plain headless window can't go
// below ~500 px and fakes overflow), then for each page report horizontal overflow, the elements causing it and
// small tap targets, and save a full-page screenshot. Needs Node 22+ and any Chromium browser (Chrome, Edge).
// Usage: node web/scripts/mobile-audit.mjs <browser executable> <outdir> <baseUrl> <path>...
// Example: node web/scripts/mobile-audit.mjs "/usr/bin/chromium" /tmp/audit http://localhost:3000 / /personen /geld
// From Git Bash, prefix MSYS_NO_PATHCONV=1, or it rewrites "/personen" into a Windows path.
import {spawn} from 'node:child_process';
import {mkdirSync, writeFileSync} from 'node:fs';
const [edge, outDir, base, ...paths] = process.argv.slice(2);
mkdirSync(outDir, {recursive: true});
const port = 9333;
const proc = spawn(edge, ['--headless=new', `--remote-debugging-port=${port}`, '--disable-gpu', '--no-first-run',
`--user-data-dir=${outDir}/profile`, 'about:blank'], {stdio: 'ignore'});
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
let target;
for (let i = 0; i < 40 && !target; i++) {
try { target = (await (await fetch(`http://127.0.0.1:${port}/json/list`)).json()).find((t) => t.type === 'page'); }
catch { await sleep(250); }
}
const ws = new WebSocket(target.webSocketDebuggerUrl);
await new Promise((r) => ws.addEventListener('open', r, {once: true}));
let seq = 0; const pending = new Map();
ws.addEventListener('message', (ev) => {
const msg = JSON.parse(ev.data);
if (msg.id && pending.has(msg.id)) { pending.get(msg.id)(msg); pending.delete(msg.id); }
});
const send = (method, params = {}) => new Promise((resolve) => {
const id = ++seq; pending.set(id, resolve); ws.send(JSON.stringify({id, method, params}));
});
const evaluate = async (expression) => (await send('Runtime.evaluate', {expression, returnByValue: true})).result?.result?.value;
await send('Page.enable');
await send('Emulation.setDeviceMetricsOverride', {width: 390, height: 844, deviceScaleFactor: 1, mobile: true});
await send('Emulation.setTouchEmulationEnabled', {enabled: true});
await send('Network.enable');
await send('Network.setUserAgentOverride', {userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 Mobile/15E148'});
const report = [];
for (const path of paths) {
await send('Page.navigate', {url: base + path});
await sleep(4000);
const info = await evaluate(`(() => {
const vw = document.documentElement.clientWidth;
const offenders = [];
for (const el of document.querySelectorAll('body *')) {
const r = el.getBoundingClientRect();
if (r.width > 0 && r.right > vw + 1) {
const style = getComputedStyle(el);
let p = el.parentElement, clipped = false;
while (p) { const s = getComputedStyle(p); if (/(auto|scroll|hidden|clip)/.test(s.overflowX)) { clipped = true; break; } p = p.parentElement; }
if (!clipped) offenders.push({tag: el.tagName.toLowerCase(), cls: String(el.className).slice(0, 60), right: Math.round(r.right), text: (el.textContent || '').trim().slice(0, 50)});
}
}
// keep only the outermost offenders
return {vw, scrollWidth: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight,
offenders: offenders.slice(0, 12), tapTargetsTooSmall: [...document.querySelectorAll('a,button,input,select,summary')]
.filter((e) => { const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0 && (r.height < 24 || r.width < 24); }).length};
})()`);
const name = path.replace(/[^a-z0-9]+/gi, '_').replace(/^_|_$/g, '') || 'home';
const height = Math.min(info?.height ?? 2000, 4000);
await send('Emulation.setDeviceMetricsOverride', {width: 390, height, deviceScaleFactor: 1, mobile: true});
await sleep(500);
const shot = await send('Page.captureScreenshot', {format: 'png'});
writeFileSync(`${outDir}/${name}.png`, Buffer.from(shot.result.data, 'base64'));
await send('Emulation.setDeviceMetricsOverride', {width: 390, height: 844, deviceScaleFactor: 1, mobile: true});
report.push({path, ...info});
}
console.log(JSON.stringify(report, null, 1));
ws.close(); proc.kill();
process.exit(0);
+31 -88
View File
@@ -1,123 +1,66 @@
import type {Metadata} from 'next';
import {notFound} from 'next/navigation'; import {notFound} from 'next/navigation';
import {getTranslations, setRequestLocale} from 'next-intl/server'; import {getLocale, getTranslations, setRequestLocale} from 'next-intl/server';
import {PositionChip, ResultBadge} from '@/components/badges';
import {ProportionBar} from '@/components/charts';
import {ExternalLink} from '@/components/ExternalLink';
import {Icon} from '@/components/Icon';
import {Notice} from '@/components/Notice';
import {Breadcrumbs, SectionHead} from '@/components/PageHeader';
import {Link} from '@/i18n/navigation'; import {Link} from '@/i18n/navigation';
import {api, NotFoundError, type VoteDetail} from '@/lib/api'; import {api, NotFoundError, type VoteDetail} from '@/lib/api';
import {formatDate, partyStyle} from '@/lib/format'; import {formatDate} from '@/lib/format';
const POSITIONS = ['for', 'against', 'abstain', 'absent'];
type Props = {params: Promise<{locale: string; id: string}>}; type Props = {params: Promise<{locale: string; id: string}>};
async function loadVote(id: string): Promise<VoteDetail> {
try {
return await api.vote(id);
} catch (error) {
if (error instanceof NotFoundError) notFound();
throw error;
}
}
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {id} = await params;
const vote = await loadVote(id);
return {title: vote.item_title};
}
export default async function VotePage({params}: Props) { export default async function VotePage({params}: Props) {
const {locale, id} = await params; const {locale, id} = await params;
setRequestLocale(locale); setRequestLocale(locale);
const t = await getTranslations('Votes'); const t = await getTranslations('Votes');
const vote = await loadVote(id); const loc = await getLocale();
let vote: VoteDetail;
try {
vote = await api.vote(id);
} catch (error) {
if (error instanceof NotFoundError) notFound();
throw error;
}
const groups = new Map<string, VoteDetail['individual']>(); const groups = new Map<string, VoteDetail['individual']>();
for (const v of vote.individual) { for (const v of vote.individual) {
const key = v.faction ?? '–'; const key = v.faction ?? '–';
groups.set(key, [...(groups.get(key) ?? []), v]); groups.set(key, [...(groups.get(key) ?? []), v]);
} }
const colors = new Map(vote.positions.map((p) => [p.party, p.color]));
const count = (list: VoteDetail['individual'], position: string) => list.filter((v) => v.position === position).length;
const dissenters = vote.individual.filter((v) => v.dissent).length;
return ( return (
<article> <article>
<Breadcrumbs items={[{label: t('title'), href: '/abstimmungen'}, {label: vote.item_ref ?? t('vote')}]} />
<header className="page-header">
<div className="page-header-main">
<p className="eyebrow">
<Icon name="vote" /> {vote.chamber}{vote.voted_on && <> · {formatDate(vote.voted_on, locale)}</>}
{vote.roll_call && <> · {t('rollCall')}</>}
</p>
<h1>{vote.item_title}</h1> <h1>{vote.item_title}</h1>
<p className="page-header-meta"> <p className="muted">
{vote.item_ref && <span className="mono">{vote.item_ref}</span>} {formatDate(vote.voted_on, loc)} · {vote.chamber}
{vote.item_ref && <> · {vote.item_ref}</>}
{vote.stage && <> · {vote.stage}</>} {vote.stage && <> · {vote.stage}</>}
{vote.roll_call && <> · <strong>{t('rollCall')}</strong></>}
{' · '}<span className={`result result-${vote.result}`}>{vote.result !== 'unknown' && t(vote.result)}</span>
</p> </p>
</div> <p>
</header> {vote.url && <a href={vote.url} target="_blank" rel="noopener noreferrer">{t('item')}</a>}
{vote.protocol_url && <> · <a href={vote.protocol_url} target="_blank" rel="noopener noreferrer">{t('protocol')}</a></>}
<div className="result-banner"> </p>
<ResultBadge result={vote.result} large /> {vote.raw_text && <blockquote className="small">{vote.raw_text}</blockquote>}
{vote.url && <ExternalLink href={vote.url} className="ext-link">{t('item')}</ExternalLink>}
{vote.protocol_url && <ExternalLink href={vote.protocol_url} className="ext-link">{t('protocol')}</ExternalLink>}
</div>
{vote.positions.length > 0 && (
<section aria-labelledby="factions">
<SectionHead id="factions" title={t('factions')} />
<ul className="cluster" style={{listStyle: 'none', padding: 0}}>
{vote.positions.map((p) => (
<li key={p.slug}><PositionChip position={p.position} party={p.party} color={p.color} /></li>
))}
</ul>
{!vote.roll_call && <p className="small muted">{t('factionOnly')}</p>}
</section>
)}
{vote.positions.length === 0 && !vote.roll_call && <Notice tone="note">{t('splitVote')}</Notice>}
{vote.individual.length > 0 && ( {vote.individual.length > 0 && (
<section className="section" aria-labelledby="individual"> <section>
<SectionHead id="individual" title={t('individualVotes')} /> <h2>{t('individualVotes')}</h2>
<ProportionBar <div className="grid-2">
label={t('individualVotes')}
segments={POSITIONS.map((position) => ({
key: position, label: t(position as 'for'), value: count(vote.individual, position), className: `seg-${position}`
}))}
/>
{dissenters > 0 && <Notice tone="caution">{t('dissentSummary', {count: dissenters})}</Notice>}
<ul className="faction-grid">
{[...groups.entries()].map(([faction, members]) => ( {[...groups.entries()].map(([faction, members]) => (
<li key={faction} className="card"> <div key={faction}>
<h3> <h3>{faction}</h3>
<span className="party-tag"><span className="party-dot" style={partyStyle(colors.get(faction))} aria-hidden="true" />{faction}</span> <ul className="compact">
<span className="muted small">{POSITIONS.map((p) => count(members, p)).filter(Boolean).join(' / ')}</span>
</h3>
<ul className="member-list">
{members.map((m) => ( {members.map((m) => (
<li key={m.slug}> <li key={m.slug}>
<PositionChip position={m.position} showLabel={false} /> <span className={`pos pos-${m.position}`}>{t(m.position as 'for')}</span>{' '}
<Link href={`/personen/${m.slug}?tab=votes`}>{m.full_name}</Link> <Link href={`/personen/${m.slug}`}>{m.full_name}</Link>
{m.dissent && <span className="badge badge--caution">{t('dissent')}</span>} {m.dissent && <span className="dissent">{t('dissent')}</span>}
</li> </li>
))} ))}
</ul> </ul>
</li> </div>
))} ))}
</ul> </div>
</section> </section>
)} )}
{vote.raw_text && (
<details className="section card">
<summary className="strong">{t('protocolText')}</summary>
<blockquote className="small">{vote.raw_text}</blockquote>
</details>
)}
</article> </article>
); );
} }
+14 -27
View File
@@ -1,48 +1,35 @@
import type {Metadata} from 'next';
import {getTranslations, setRequestLocale} from 'next-intl/server'; import {getTranslations, setRequestLocale} from 'next-intl/server';
import {countActive, FilterBar} from '@/components/FilterBar'; import {VoteTable} from '@/components/VoteTable';
import {PageHeader} from '@/components/PageHeader'; import {Link} from '@/i18n/navigation';
import {Pagination} from '@/components/Pagination';
import {VoteLegend, VoteList} from '@/components/VoteList';
import {api} from '@/lib/api'; import {api} from '@/lib/api';
const PAGE = 50;
type Props = { type Props = {
params: Promise<{locale: string}>; params: Promise<{locale: string}>;
searchParams: Promise<{party?: string; page?: string; roll_call?: string; parts?: string}>; searchParams: Promise<{party?: string; page?: string; roll_call?: string}>;
}; };
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Votes'});
return {title: t('title')};
}
export default async function VotesPage({params, searchParams}: Props) { export default async function VotesPage({params, searchParams}: Props) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
const sp = await searchParams; const sp = await searchParams;
const t = await getTranslations('Votes'); const t = await getTranslations('Votes');
const page = Math.max(1, Number(sp.page) || 1); const page = Math.max(1, Number(sp.page) || 1);
const votes = await api.votes({party: sp.party, roll_call: sp.roll_call ? 'true' : undefined, const votes = await api.votes({party: sp.party, roll_call: sp.roll_call ? 'true' : undefined, limit: 50, offset: (page - 1) * 50});
include_parts: sp.parts ? 'true' : undefined, limit: PAGE, offset: (page - 1) * PAGE});
return ( return (
<> <>
<PageHeader title={t('title')} lede={t('intro')} meta={sp.party ? t('filteredParty', {party: sp.party}) : undefined} /> <h1>{t('title')}</h1>
<FilterBar id="votes" active={countActive(sp.roll_call, sp.parts)} resetHref={sp.party ? `/abstimmungen?party=${sp.party}` : '/abstimmungen'} <form className="filters" method="get">
hidden={{party: sp.party}}> {sp.party && <input type="hidden" name="party" value={sp.party} />}
<label className="field field--check"> <label>
<input type="checkbox" name="roll_call" value="1" defaultChecked={Boolean(sp.roll_call)} /> {t('onlyRollCall')} <input type="checkbox" name="roll_call" value="1" defaultChecked={Boolean(sp.roll_call)} /> {t('onlyRollCall')}
</label> </label>
<label className="field field--check"> <button type="submit">OK</button>
<input type="checkbox" name="parts" value="1" defaultChecked={Boolean(sp.parts)} /> {t('includePartVotes')} </form>
</label> <VoteTable votes={votes} />
</FilterBar> {votes.length === 50 && (
<VoteLegend /> <p><Link href={{pathname: '/abstimmungen', query: {...sp, page: String(page + 1)}}}>→</Link></p>
<VoteList votes={votes} /> )}
<Pagination pathname="/abstimmungen" query={sp} page={page} hasNext={votes.length === PAGE} />
</> </>
); );
} }
@@ -1,63 +0,0 @@
import type {Metadata} from 'next';
import {headers} from 'next/headers';
import {notFound} from 'next/navigation';
import {getTranslations, setRequestLocale} from 'next-intl/server';
import {ClaimCard} from '@/components/ClaimList';
import {Notice} from '@/components/Notice';
import {Breadcrumbs, type Crumb, SectionHead} from '@/components/PageHeader';
import {getPathname} from '@/i18n/navigation';
import {api, NotFoundError, type Claim} from '@/lib/api';
import {formatDate} from '@/lib/format';
type Props = {params: Promise<{locale: string; id: string}>};
async function loadClaim(id: string): Promise<Claim> {
if (!/^\d+$/.test(id)) notFound();
try {
return await api.claim(id);
} catch (error) {
if (error instanceof NotFoundError) notFound();
throw error;
}
}
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {id, locale} = await params;
const claim = await loadClaim(id);
const summary = locale === 'en' && claim.summary_en ? claim.summary_en : claim.summary_de;
return {title: summary.length > 70 ? `${summary.slice(0, 69)}…` : summary, description: summary};
}
/** One claim on its own page: all sources expanded and a ready-made citation (docs/design/README.md §7.17). */
export default async function ClaimPage({params}: Props) {
const {locale, id} = await params;
setRequestLocale(locale);
const t = await getTranslations('ClaimPage');
const claim = await loadClaim(id);
const summary = locale === 'en' && claim.summary_en ? claim.summary_en : claim.summary_de;
const h = await headers();
const host = h.get('x-forwarded-host') ?? h.get('host') ?? 'localhost';
const proto = h.get('x-forwarded-proto') ?? (host.startsWith('localhost') ? 'http' : 'https');
const url = `${proto}://${host}${getPathname({href: `/angaben/${claim.id}`, locale})}`;
const today = formatDate(new Date().toISOString(), locale);
const crumbs: Crumb[] = [];
if (claim.person_slug) crumbs.push({label: claim.person_name ?? claim.person_slug, href: `/personen/${claim.person_slug}`});
else if (claim.organization_slug) {
crumbs.push({label: claim.organization_short ?? claim.organization_name ?? claim.organization_slug, href: `/organisationen/${claim.organization_slug}`});
}
crumbs.push({label: t('crumb', {id: String(claim.id)})});
return (
<article className="prose">
<Breadcrumbs items={crumbs} />
<ClaimCard claim={claim} standalone />
<section className="section" aria-labelledby="cite">
<SectionHead id="cite" title={t('cite')} />
<p className="citation">{t('citation', {summary, id: String(claim.id), date: today, url})}</p>
<Notice tone="note">{t('filtersIgnored')}</Notice>
</section>
</article>
);
}
-42
View File
@@ -1,42 +0,0 @@
import type {Metadata} from 'next';
import {getTranslations, setRequestLocale} from 'next-intl/server';
import {Notice} from '@/components/Notice';
import {PageHeader} from '@/components/PageHeader';
import {legalDetails} from '@/lib/legal';
export const dynamic = 'force-dynamic'; // the operator's details are read from the environment at request time
const SECTIONS = ['visitors', 'cookies', 'images', 'subjects', 'basis', 'rights'] as const;
export async function generateMetadata({params}: {params: Promise<{locale: string}>}): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Privacy'});
return {title: t('title')};
}
export default async function PrivacyPage({params}: {params: Promise<{locale: string}>}) {
const {locale} = await params;
setRequestLocale(locale);
const t = await getTranslations('Privacy');
const {name, address, email} = legalDetails();
return (
<article>
<PageHeader title={t('title')} lede={t('intro')} />
<div className="prose">
<Notice tone="caution">{t('draft')}</Notice>
<section>
<h2>{t('controllerHeading')}</h2>
<p>{name ?? t('missing')}<br />{address ?? t('missing')}</p>
<p>{email ? <a href={`mailto:${email}`}>{email}</a> : t('missing')}</p>
</section>
{SECTIONS.map((key) => (
<section key={key}>
<h2>{t(`${key}Heading`)}</h2>
<p>{t(key)}</p>
</section>
))}
</div>
</article>
);
}
+27 -42
View File
@@ -1,79 +1,64 @@
import type {Metadata} from 'next'; import {getLocale, getTranslations, setRequestLocale} from 'next-intl/server';
import {getTranslations, setRequestLocale} from 'next-intl/server';
import {Avatar} from '@/components/Avatar';
import {StatusBadge} from '@/components/badges';
import {ExternalLink} from '@/components/ExternalLink';
import {countActive, Field, FilterBar} from '@/components/FilterBar';
import {EmptyState} from '@/components/Notice';
import {PageHeader} from '@/components/PageHeader';
import {Pagination} from '@/components/Pagination';
import {Link} from '@/i18n/navigation'; import {Link} from '@/i18n/navigation';
import {api} from '@/lib/api'; import {api} from '@/lib/api';
import {formatDate} from '@/lib/format'; import {formatDate} from '@/lib/format';
const PAGE = 50;
type Props = {params: Promise<{locale: string}>; searchParams: Promise<{party?: string; page?: string}>}; type Props = {params: Promise<{locale: string}>; searchParams: Promise<{party?: string; page?: string}>};
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Former'});
return {title: t('title')};
}
export default async function FormerPage({params, searchParams}: Props) { export default async function FormerPage({params, searchParams}: Props) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
const sp = await searchParams; const sp = await searchParams;
const t = await getTranslations('Former'); const t = await getTranslations('Former');
const tp = await getTranslations('Persons'); const tp = await getTranslations('Persons');
const loc = await getLocale();
const page = Math.max(1, Number(sp.page) || 1); const page = Math.max(1, Number(sp.page) || 1);
const [people, parties] = await Promise.all([ const [people, parties] = await Promise.all([
api.former({party: sp.party, limit: PAGE, offset: (page - 1) * PAGE}), api.former({party: sp.party, limit: 50, offset: (page - 1) * 50}),
api.parties() api.parties()
]); ]);
return ( return (
<> <>
<PageHeader title={t('title')} lede={t('intro')} /> <h1>{t('title')}</h1>
<FilterBar id="former" active={countActive(sp.party)} resetHref="/ehemalige"> <p className="muted">{t('intro')}</p>
<Field label={tp('filterParty')}> <form className="filters" method="get">
<select name="party" defaultValue={sp.party ?? ''}> <select name="party" defaultValue={sp.party ?? ''}>
<option value="">{tp('all')}</option> <option value="">{tp('all')}</option>
{parties.filter((p) => p.total_people > 20).map((p) => <option key={p.slug} value={p.slug}>{p.short_name ?? p.name}</option>)} {parties.filter((p) => (p.total_people ?? 0) > 20).map((p) => (
<option key={p.slug} value={p.slug}>{p.short_name ?? p.name}</option>
))}
</select> </select>
</Field> <button type="submit">OK</button>
</FilterBar> </form>
{people.length === 0 ? <EmptyState icon="history">{t('none')}</EmptyState> : (
<ul className="claims"> <ul className="claims">
{people.map((p) => ( {people.map((p) => (
<li key={p.slug}> <li key={p.slug} className="claim">
<article className="claim">
<div className="profile-head">
<Avatar name={p.full_name} src={p.photo_url} />
<div>
<div className="claim-head"> <div className="claim-head">
<Link href={`/personen/${p.slug}`}>{p.full_name}</Link> <Link href={`/personen/${p.slug}`}><strong>{p.full_name}</strong></Link>
<StatusBadge status={p.status} /> <span>{tp(`statusValue.${p.status}`)}</span>
{p.last_role && <span>{t('lastRole', {role: p.last_role})}</span>} {p.last_role && <span>{t('lastRole', {role: p.last_role})}</span>}
{p.last_office_end && <span>{tp('lastOffice', {date: formatDate(p.last_office_end, locale)})}</span>} {p.last_office_end && <span>{tp('lastOffice', {date: formatDate(p.last_office_end, loc)})}</span>}
</div> </div>
{p.latest_news && ( {p.latest_news && (
<p className="claim-detail"> <p className="claim-summary">
<span className="muted">{t('latestNews')} ({formatDate(p.latest_news_at, locale)}): </span> <span className="muted small">{t('latestNews')} ({formatDate(p.latest_news_at, loc)}): </span>
{p.latest_news_url ? <ExternalLink href={p.latest_news_url}>{p.latest_news}</ExternalLink> : p.latest_news} {p.latest_news_url ? (
<a href={p.latest_news_url} target="_blank" rel="noopener noreferrer nofollow">{p.latest_news}</a>
) : (
p.latest_news
)}
</p> </p>
)} )}
{p.latest_career && <p className="claim-detail"><span className="muted">{t('career')}: </span>{p.latest_career}</p>} {p.latest_career && (
</div> <p className="small"><span className="muted">{t('career')}: </span>{p.latest_career}</p>
</div> )}
</article>
</li> </li>
))} ))}
</ul> </ul>
{people.length === 50 && (
<p><Link href={{pathname: '/ehemalige', query: {...sp, page: String(page + 1)}}}>→</Link></p>
)} )}
<Pagination pathname="/ehemalige" query={sp} page={page} hasNext={people.length === PAGE} />
</> </>
); );
} }
+4 -11
View File
@@ -1,15 +1,7 @@
import type {Metadata} from 'next';
import {getTranslations, setRequestLocale} from 'next-intl/server'; import {getTranslations, setRequestLocale} from 'next-intl/server';
import {PageHeader} from '@/components/PageHeader';
import {SettingsForm} from '@/components/SettingsForm'; import {SettingsForm} from '@/components/SettingsForm';
import {api, getPrefs} from '@/lib/api'; import {api, getPrefs} from '@/lib/api';
export async function generateMetadata({params}: {params: Promise<{locale: string}>}): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Settings'});
return {title: t('title'), robots: {index: false}};
}
export default async function SettingsPage({params}: {params: Promise<{locale: string}>}) { export default async function SettingsPage({params}: {params: Promise<{locale: string}>}) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
@@ -17,9 +9,10 @@ export default async function SettingsPage({params}: {params: Promise<{locale: s
const [sources, topics, prefs] = await Promise.all([api.sources(), api.topics(), getPrefs()]); const [sources, topics, prefs] = await Promise.all([api.sources(), api.topics(), getPrefs()]);
return ( return (
<div className="prose"> <>
<PageHeader title={t('title')} lede={t('intro')} /> <h1>{t('title')}</h1>
<p>{t('intro')}</p>
<SettingsForm sources={sources} topics={topics} initial={prefs} /> <SettingsForm sources={sources} topics={topics} initial={prefs} />
</div> </>
); );
} }
-21
View File
@@ -1,21 +0,0 @@
'use client';
import {useTranslations} from 'next-intl';
import {Icon} from '@/components/Icon';
import {Link} from '@/i18n/navigation';
/** Shown when a page fails to load (usually the API is unreachable). */
export default function ErrorPage({reset}: {error: Error & {digest?: string}; reset: () => void}) {
const t = useTranslations('Common');
return (
<div className="empty-state" role="alert">
<Icon name="alert" />
<h1>{t('errorTitle')}</h1>
<p>{t('loadError')}</p>
<p className="cluster">
<button type="button" onClick={() => reset()}>{t('retry')}</button>
<Link href="/" className="button secondary">{t('home')}</Link>
</p>
</div>
);
}
+38 -50
View File
@@ -1,14 +1,8 @@
import type {Metadata} from 'next';
import {getTranslations, setRequestLocale} from 'next-intl/server'; import {getTranslations, setRequestLocale} from 'next-intl/server';
import {BarList} from '@/components/charts';
import {countActive, Field, FilterBar} from '@/components/FilterBar';
import {MoneyTable} from '@/components/MoneyTable'; import {MoneyTable} from '@/components/MoneyTable';
import {Notice} from '@/components/Notice';
import {PageHeader, SectionHead} from '@/components/PageHeader';
import {Pagination} from '@/components/Pagination';
import {Link} from '@/i18n/navigation'; import {Link} from '@/i18n/navigation';
import {api, type MoneySummaryRow} from '@/lib/api'; import {api} from '@/lib/api';
import {formatMoneyCompact} from '@/lib/format'; import {formatMoney} from '@/lib/format';
const KINDS = ['donation', 'party_funding', 'contract', 'government_ad', 'subsidy', 'political_ad', 'party_ad', const KINDS = ['donation', 'party_funding', 'contract', 'government_ad', 'subsidy', 'political_ad', 'party_ad',
'sponsorship', 'loan', 'side_income'] as const; 'sponsorship', 'loan', 'side_income'] as const;
@@ -20,12 +14,6 @@ type Props = {
min?: string; page?: string}>; min?: string; page?: string}>;
}; };
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Money'});
return {title: t('title')};
}
export default async function MoneyPage({params, searchParams}: Props) { export default async function MoneyPage({params, searchParams}: Props) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
@@ -36,60 +24,60 @@ export default async function MoneyPage({params, searchParams}: Props) {
const [flows, summary] = await Promise.all([ const [flows, summary] = await Promise.all([
api.money({kinds: sp.kind, q: sp.q, org: sp.org, person: sp.person, since: sp.since, until: sp.until, api.money({kinds: sp.kind, q: sp.q, org: sp.org, person: sp.person, since: sp.since, until: sp.until,
min_amount: sp.min, limit: PAGE, offset: (page - 1) * PAGE}), min_amount: sp.min, limit: PAGE, offset: (page - 1) * PAGE}),
filtered ? Promise.resolve([] as MoneySummaryRow[]) : api.moneySummary({kinds: sp.kind}) filtered ? Promise.resolve([]) : api.moneySummary({kinds: sp.kind})
]); ]);
const rows = (side: 'payer' | 'payee') => summary.filter((row) => row.side === side).slice(0, 10).map((row) => ({ const payers = summary.filter((row) => row.side === 'payer').slice(0, 15);
key: `${row.slug}-${row.kind}`, const payees = summary.filter((row) => row.side === 'payee').slice(0, 15);
label: <Link href={`/organisationen/${row.slug}`}>{row.name}</Link>,
value: row.total ?? 0,
display: row.total ? formatMoneyCompact(row.total, locale) : `${row.count}×`,
meta: t(`kind.${row.kind}` as 'kind.other')
}));
const payers = rows('payer');
const payees = rows('payee');
return ( return (
<> <>
<PageHeader title={t('title')} lede={t('intro')} /> <h1>{t('title')}</h1>
<FilterBar id="money" active={countActive(sp.kind, sp.q, sp.since, sp.until, sp.min)} resetHref="/geld" <p className="muted">{t('intro')}</p>
hidden={{org: sp.org, person: sp.person}}> <form className="filters" method="get">
<Field label={t('kindLabel')}> <select name="kind" defaultValue={sp.kind ?? ''} aria-label={t('kindLabel')}>
<select name="kind" defaultValue={sp.kind ?? ''}>
<option value="">{t('allKinds')}</option> <option value="">{t('allKinds')}</option>
{KINDS.map((kind) => <option key={kind} value={kind}>{t(`kind.${kind}`)}</option>)} {KINDS.map((kind) => <option key={kind} value={kind}>{t(`kind.${kind}`)}</option>)}
</select> </select>
</Field> <input type="search" name="q" defaultValue={sp.q} placeholder={t('searchPlaceholder')} />
<Field label={t('nameLabel')} wide><input type="search" name="q" defaultValue={sp.q} placeholder={t('searchPlaceholder')} /></Field> <label>{t('from')} <input type="date" name="since" defaultValue={sp.since} /></label>
<Field label={t('from')}><input type="date" name="since" defaultValue={sp.since} /></Field> <label>{t('to')} <input type="date" name="until" defaultValue={sp.until} /></label>
<Field label={t('to')}><input type="date" name="until" defaultValue={sp.until} /></Field> <label>{t('minAmount')} <input type="number" name="min" min={0} step={1000} defaultValue={sp.min} /></label>
<Field label={t('minAmount')}><input type="number" name="min" min={0} step={1000} defaultValue={sp.min} inputMode="numeric" /></Field> {sp.org && <input type="hidden" name="org" value={sp.org} />}
</FilterBar> {sp.person && <input type="hidden" name="person" value={sp.person} />}
<button type="submit">OK</button>
</form>
{(sp.org || sp.person) && ( {(sp.org || sp.person) && (
<Notice tone="info"> <p className="small">
{t('filteredBy')}: <strong>{sp.org ?? sp.person}</strong> {t('filteredBy')}: <strong>{sp.org ?? sp.person}</strong>
{sp.person && <> ({t('personNote')})</>} · <Link href="/geld">{t('reset')}</Link> {sp.person && <> ({t('personNote')})</>} · <Link href="/geld">{t('reset')}</Link>
</Notice> </p>
)} )}
{!filtered && (payers.length > 0 || payees.length > 0) && ( {!filtered && summary.length > 0 && (
<div className="grid-2"> <div className="grid-2">
<section aria-labelledby="top-payers"> {([{label: 'topPayers', rows: payers}, {label: 'topPayees', rows: payees}] as const).map(({label, rows}) => (
<SectionHead id="top-payers" title={t('topPayers')} /> <section key={label}>
<BarList rows={payers} label={t('topPayers')} /> <h2>{t(label)}</h2>
</section> <ol className="compact">
<section aria-labelledby="top-payees"> {rows.map((row) => (
<SectionHead id="top-payees" title={t('topPayees')} /> <li key={`${row.slug}-${row.kind}`}>
<BarList rows={payees} label={t('topPayees')} /> <Link href={`/organisationen/${row.slug}`}>{row.name}</Link>{' '}
<span className="muted small">
{t(`kind.${row.kind}` as 'kind.other')} · {row.total ? formatMoney(row.total, locale) : `${row.count}×`}
</span>
</li>
))}
</ol>
</section> </section>
))}
</div> </div>
)} )}
<section className={filtered ? undefined : 'section'} aria-labelledby="flows">
<SectionHead id="flows" title={t('flows')} />
<MoneyTable flows={flows} /> <MoneyTable flows={flows} />
<Pagination pathname="/geld" query={sp} page={page} hasNext={flows.length === PAGE} /> {flows.length === PAGE && (
</section> <p><Link href={{pathname: '/geld', query: {...sp, page: String(page + 1)}}}>→</Link></p>
<Notice tone="note">{t('sourcesNote')}</Notice> )}
<p className="small muted">{t('sourcesNote')}</p>
</> </>
); );
} }
-52
View File
@@ -1,52 +0,0 @@
import type {Metadata} from 'next';
import {getTranslations, setRequestLocale} from 'next-intl/server';
import {Notice} from '@/components/Notice';
import {PageHeader} from '@/components/PageHeader';
import {legalDetails} from '@/lib/legal';
export const dynamic = 'force-dynamic'; // the operator's details are read from the environment at request time
export async function generateMetadata({params}: {params: Promise<{locale: string}>}): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Imprint'});
return {title: t('title')};
}
export default async function ImprintPage({params}: {params: Promise<{locale: string}>}) {
const {locale} = await params;
setRequestLocale(locale);
const t = await getTranslations('Imprint');
const {name, address, email, correctionsEmail} = legalDetails();
const missing = t('missing');
return (
<article>
<PageHeader title={t('title')} lede={t('intro')} />
<div className="prose">
{(!name || !address || !email) && <Notice tone="caution">{t('notConfigured')}</Notice>}
<section>
<h2>{t('ownerHeading')}</h2>
<p>{name ?? missing}<br />{address ?? missing}</p>
<p>{t('email')}: {email ? <a href={`mailto:${email}`}>{email}</a> : missing}</p>
</section>
<section>
<h2>{t('purposeHeading')}</h2>
<p>{t('purpose')}</p>
</section>
<section>
<h2>{t('directionHeading')}</h2>
<p>{t('direction')}</p>
</section>
<section id="korrekturen">
<h2>{t('correctionsHeading')}</h2>
<p>{t('corrections')}</p>
<p>{correctionsEmail ? <a href={`mailto:${correctionsEmail}`}>{correctionsEmail}</a> : missing}</p>
</section>
<section>
<h2>{t('liabilityHeading')}</h2>
<p>{t('liability')}</p>
</section>
</div>
</article>
);
}
+53 -82
View File
@@ -1,13 +1,6 @@
import type {Metadata} from 'next'; import {getLocale, getTranslations, setRequestLocale} from 'next-intl/server';
import {getTranslations, setRequestLocale} from 'next-intl/server';
import {ExternalLink} from '@/components/ExternalLink';
import {countActive, Field, FilterBar} from '@/components/FilterBar';
import {Icon} from '@/components/Icon';
import {Notice} from '@/components/Notice';
import {PageHeader} from '@/components/PageHeader';
import {Link} from '@/i18n/navigation'; import {Link} from '@/i18n/navigation';
import {api, type CalendarEvent} from '@/lib/api'; import {api, type CalendarEvent} from '@/lib/api';
import {formatMonth, intlLocale} from '@/lib/format';
type Props = { type Props = {
params: Promise<{locale: string}>; params: Promise<{locale: string}>;
@@ -17,12 +10,12 @@ type Props = {
const KINDS = ['parliament_session', 'committee', 'hearing', 'government_meeting', 'press_conference', 'foreign_trip', const KINDS = ['parliament_session', 'committee', 'hearing', 'government_meeting', 'press_conference', 'foreign_trip',
'meeting', 'public_event'] as const; 'meeting', 'public_event'] as const;
// Four stripe colours for the event kinds (always with the kind's name; see the legend). function monthBounds(month: string) {
const GROUPS: Record<string, 'parliament' | 'government' | 'travel' | 'public'> = { const [y, m] = month.split('-').map(Number);
parliament_session: 'parliament', committee: 'parliament', hearing: 'parliament', const first = new Date(Date.UTC(y, m - 1, 1));
government_meeting: 'government', press_conference: 'government', const last = new Date(Date.UTC(y, m, 0));
foreign_trip: 'travel', meeting: 'travel' return {first, last};
}; }
function iso(d: Date) { function iso(d: Date) {
return d.toISOString().slice(0, 10); return d.toISOString().slice(0, 10);
@@ -34,22 +27,14 @@ function shiftMonth(month: string, delta: number) {
return `${d.getUTCFullYear()}-${String(d.getUTCMonth() + 1).padStart(2, '0')}`; return `${d.getUTCFullYear()}-${String(d.getUTCMonth() + 1).padStart(2, '0')}`;
} }
export async function generateMetadata({params}: Props): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Calendar'});
return {title: t('title')};
}
export default async function CalendarPage({params, searchParams}: Props) { export default async function CalendarPage({params, searchParams}: Props) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
const sp = await searchParams; const sp = await searchParams;
const t = await getTranslations('Calendar'); const t = await getTranslations('Calendar');
const today = iso(new Date()); const loc = await getLocale();
const month = /^\d{4}-\d{2}$/.test(sp.month ?? '') ? sp.month! : today.slice(0, 7); const month = /^\d{4}-\d{2}$/.test(sp.month ?? '') ? sp.month! : new Date().toISOString().slice(0, 7);
const [y, m] = month.split('-').map(Number); const {first, last} = monthBounds(month);
const first = new Date(Date.UTC(y, m - 1, 1));
const last = new Date(Date.UTC(y, m, 0));
const kinds = sp.kind && (KINDS as readonly string[]).includes(sp.kind) ? [sp.kind] : undefined; const kinds = sp.kind && (KINDS as readonly string[]).includes(sp.kind) ? [sp.kind] : undefined;
const data = await api.calendar({start: iso(first), end: iso(last), person: sp.person, party: sp.party, kinds}); const data = await api.calendar({start: iso(first), end: iso(last), person: sp.person, party: sp.party, kinds});
@@ -65,88 +50,74 @@ export default async function CalendarPage({params, searchParams}: Props) {
// Monday-first grid. // Monday-first grid.
const lead = (first.getUTCDay() + 6) % 7; const lead = (first.getUTCDay() + 6) % 7;
const cells: (Date | null)[] = [...Array(lead).fill(null)]; const cells: (Date | null)[] = [...Array(lead).fill(null)];
for (let day = 1; day <= last.getUTCDate(); day++) cells.push(new Date(Date.UTC(y, m - 1, day))); for (let day = 1; day <= last.getUTCDate(); day++) cells.push(new Date(Date.UTC(first.getUTCFullYear(), first.getUTCMonth(), day)));
const weekday = (d: Date, style: 'short' | 'long') => d.toLocaleDateString(intlLocale(locale), {weekday: style, timeZone: 'UTC'}); const weekdays = [...Array(7)].map((_, i) =>
const weekdays = [...Array(7)].map((_, i) => weekday(new Date(Date.UTC(2024, 0, 1 + i)), 'short')); new Date(Date.UTC(2024, 0, 1 + i)).toLocaleDateString(loc === 'de' ? 'de-AT' : 'en-GB', {weekday: 'short'})
);
const query = {person: sp.person, party: sp.party, kind: sp.kind}; const query = {person: sp.person, party: sp.party, kind: sp.kind};
const kindLabel = (kind: string) => t(`kind.${(KINDS as readonly string[]).includes(kind) ? kind : 'other'}` as 'kind.other'); const title = first.toLocaleDateString(loc === 'de' ? 'de-AT' : 'en-GB', {month: 'long', year: 'numeric', timeZone: 'UTC'});
return ( return (
<> <>
<PageHeader <h1>{t('title')}: {title}</h1>
title={`${t('title')}: ${formatMonth(month, locale)}`} <p className="muted">{t('intro')}</p>
lede={t('intro')} <form className="filters" method="get">
actions={ <input type="month" name="month" defaultValue={month} />
<> <input type="text" name="person" defaultValue={sp.person} placeholder={t('person')} />
<Link className="button secondary" href={{pathname: '/kalender', query: {...query, month: shiftMonth(month, -1)}}}>
<Icon name="arrow-left" /> {t('prev')}
</Link>
{month !== today.slice(0, 7) && (
<Link className="button secondary" href={{pathname: '/kalender', query}}>{t('today')}</Link>
)}
<Link className="button secondary" href={{pathname: '/kalender', query: {...query, month: shiftMonth(month, 1)}}}>
{t('next')} <Icon name="arrow-right" />
</Link>
</>
}
/>
<FilterBar id="calendar" active={countActive(sp.person, sp.kind)} resetHref={`/kalender?month=${month}`} hidden={{month, party: sp.party}}>
<Field label={t('person')} wide><input type="text" name="person" defaultValue={sp.person} placeholder={t('personPlaceholder')} /></Field>
<Field label={t('kindLabel')}>
<select name="kind" defaultValue={sp.kind ?? ''}> <select name="kind" defaultValue={sp.kind ?? ''}>
<option value="">{t('allKinds')}</option> <option value="">–</option>
{KINDS.map((k) => <option key={k} value={k}>{t(`kind.${k}`)}</option>)} {KINDS.map((k) => (
</select> <option key={k} value={k}>{t(`kind.${k}`)}</option>
</Field>
</FilterBar>
<ul className="legend" aria-label={t('legend')}>
{(['parliament', 'government', 'travel', 'public'] as const).map((group) => (
<li key={group} className={`event--${group}`}><span className="event-swatch" /> {t(`group.${group}`)}</li>
))} ))}
</ul> </select>
<button type="submit">OK</button>
</form>
<p>
<Link href={{pathname: '/kalender', query: {...query, month: shiftMonth(month, -1)}}}>{t('prev')}</Link>
{' · '}
<Link href={{pathname: '/kalender', query: {...query, month: shiftMonth(month, 1)}}}>{t('next')}</Link>
</p>
<div className="calendar section" style={{marginTop: 'var(--space-4)'}}> <div className="calendar">
{weekdays.map((w) => <div key={w} className="calendar-head" aria-hidden="true">{w}</div>)} {weekdays.map((w) => (
<div key={w} className="calendar-head">{w}</div>
))}
{cells.map((cell, i) => { {cells.map((cell, i) => {
if (!cell) return <div key={`blank-${i}`} className="calendar-cell is-blank" aria-hidden="true" />; if (!cell) return <div key={`empty-${i}`} className="calendar-cell empty" />;
const day = iso(cell); const day = iso(cell);
const events = byDay.get(day) ?? []; const events = byDay.get(day) ?? [];
const count = activity.get(day) ?? 0; const count = activity.get(day) ?? 0;
const weekend = cell.getUTCDay() === 0 || cell.getUTCDay() === 6;
const classes = ['calendar-cell', events.length && 'has-events', weekend && 'is-weekend', day === today && 'is-today']
.filter(Boolean).join(' ');
return ( return (
<section key={day} className={classes} aria-label={cell.toLocaleDateString(intlLocale(locale), {dateStyle: 'full', timeZone: 'UTC'})}> <div key={day} className={`calendar-cell${events.length ? ' has-events' : ''}`}>
<div className="calendar-day"> <div className="calendar-day">
<span className="calendar-day-num">{cell.getUTCDate()}</span> <strong>{cell.getUTCDate()}</strong>
<span className="calendar-day-name">{weekday(cell, 'long')}</span>
{count > 0 && ( {count > 0 && (
<Link href={{pathname: '/suche', query: {since: day, until: day}}} title={t('activityHint')}>{t('activity', {count})}</Link> <Link className="small muted" href={{pathname: '/suche', query: {since: day, until: day, q: sp.person ?? ''}}}>
{t('activity', {count})}
</Link>
)} )}
</div> </div>
{events.length > 0 && ( <ul>
<ul className="calendar-events">
{events.slice(0, 6).map((ev) => ( {events.slice(0, 6).map((ev) => (
<li key={ev.id} className={`event event--${GROUPS[ev.kind] ?? 'public'}`}> <li key={ev.id} className={`ev ev-${ev.kind}`}>
<span className="event-kind">{kindLabel(ev.kind)}</span> <span className="ev-kind">{t(`kind.${(KINDS as readonly string[]).includes(ev.kind) ? ev.kind : 'other'}` as 'kind.other')}</span>{' '}
{ev.url ? <ExternalLink href={ev.url} icon={false}>{ev.title}</ExternalLink> : ev.title} {ev.url ? <a href={ev.url} target="_blank" rel="noopener noreferrer">{ev.title}</a> : ev.title}
{ev.participants.length > 0 && ( {ev.participants.length > 0 && (
<span className="event-people"> <div className="small">
{ev.participants.slice(0, 4).map((p) => <Link key={p.slug} href={`/personen/${p.slug}`}>{p.name}</Link>)} {ev.participants.map((p) => (
{ev.participants.length > 4 && <span>+{ev.participants.length - 4}</span>} <Link key={p.slug} href={`/personen/${p.slug}`}>{p.name}</Link>
</span> ))}
</div>
)} )}
</li> </li>
))} ))}
{events.length > 6 && <li className="muted">{t('more', {count: events.length - 6})}</li>} {events.length > 6 && <li className="small muted">+{events.length - 6}</li>}
</ul> </ul>
)} </div>
</section>
); );
})} })}
</div> </div>
{data.events.length === 0 && <Notice tone="note">{t('none')}</Notice>} {data.events.length === 0 && <p className="muted">{t('none')}</p>}
<p className="small muted">{t('datePrecision')}</p> <p className="small muted">{t('datePrecision')}</p>
</> </>
); );
+27 -26
View File
@@ -1,17 +1,12 @@
import type {Metadata, Viewport} from 'next'; import type {Metadata} from 'next';
import {cookies} from 'next/headers';
import {notFound} from 'next/navigation'; import {notFound} from 'next/navigation';
import {Suspense} from 'react';
import {hasLocale, NextIntlClientProvider} from 'next-intl'; import {hasLocale, NextIntlClientProvider} from 'next-intl';
import {getTranslations, setRequestLocale} from 'next-intl/server'; import {getTranslations, setRequestLocale} from 'next-intl/server';
import {SiteFooter} from '@/components/SiteFooter'; import {LocaleSwitcher} from '@/components/LocaleSwitcher';
import {SiteHeader} from '@/components/SiteHeader'; import {Link} from '@/i18n/navigation';
import {routing} from '@/i18n/routing'; import {routing} from '@/i18n/routing';
import {activeFilterCount, parsePrefs, parseTheme, PREFS_COOKIE, THEME_COOKIE} from '@/lib/prefs'; import '../globals.css';
import '@/styles/tokens.css';
import '@/styles/base.css';
import '@/styles/layout.css';
import '@/styles/components.css';
import '@/styles/print.css';
type Props = {children: React.ReactNode; params: Promise<{locale: string}>}; type Props = {children: React.ReactNode; params: Promise<{locale: string}>};
@@ -25,30 +20,36 @@ export async function generateMetadata({params}: Props): Promise<Metadata> {
return {title: {default: t('title'), template: '%s · Politrack'}, description: t('description')}; return {title: {default: t('title'), template: '%s · Politrack'}, description: t('description')};
} }
export const viewport: Viewport = {
themeColor: [
{media: '(prefers-color-scheme: light)', color: '#f6f5f1'},
{media: '(prefers-color-scheme: dark)', color: '#131311'}
]
};
export default async function LocaleLayout({children, params}: Props) { export default async function LocaleLayout({children, params}: Props) {
const {locale} = await params; const {locale} = await params;
if (!hasLocale(routing.locales, locale)) notFound(); if (!hasLocale(routing.locales, locale)) notFound();
setRequestLocale(locale); setRequestLocale(locale);
const t = await getTranslations('Layout'); const t = await getTranslations('Nav');
const store = await cookies();
const theme = parseTheme(store.get(THEME_COOKIE)?.value);
const filterCount = activeFilterCount(parsePrefs(store.get(PREFS_COOKIE)?.value));
return ( return (
<html lang={locale} data-theme={theme === 'system' ? undefined : theme}> <html lang={locale}>
<body> <body>
<NextIntlClientProvider> <NextIntlClientProvider>
<a href="#main" className="skip-link">{t('skip')}</a> <header className="site-header">
<SiteHeader theme={theme} filterCount={filterCount} /> <Link href="/" className="brand">Politrack</Link>
<main id="main" className="page">{children}</main> <nav>
<SiteFooter /> <Link href="/personen">{t('persons')}</Link>
<Link href="/parteien">{t('parties')}</Link>
<Link href="/organisationen">{t('organizations')}</Link>
<Link href="/geld">{t('money')}</Link>
<Link href="/abstimmungen">{t('votes')}</Link>
<Link href="/social">{t('social')}</Link>
<Link href="/kalender">{t('calendar')}</Link>
<Link href="/ehemalige">{t('former')}</Link>
<Link href="/suche">{t('search')}</Link>
<Link href="/einstellungen">{t('settings')}</Link>
<Link href="/methodik">{t('method')}</Link>
<Suspense>
<LocaleSwitcher />
</Suspense>
</nav>
</header>
<main>{children}</main>
</NextIntlClientProvider> </NextIntlClientProvider>
</body> </body>
</html> </html>
-16
View File
@@ -1,16 +0,0 @@
import {useTranslations} from 'next-intl';
/** Skeleton in the shape of an index page while the server waits for the API. */
export default function Loading() {
const t = useTranslations('Common');
return (
<div aria-busy="true" aria-live="polite">
<span className="visually-hidden">{t('loading')}</span>
<div className="skeleton" style={{height: '2.25rem', width: '40%', marginBottom: 'var(--space-3)'}} />
<div className="skeleton" style={{height: '1.25rem', width: '65%', marginBottom: 'var(--space-6)'}} />
{[0, 1, 2, 3].map((i) => (
<div key={i} className="skeleton" style={{height: '7rem', marginBottom: 'var(--space-3)'}} />
))}
</div>
);
}
+12 -110
View File
@@ -1,134 +1,36 @@
import type {CSSProperties} from 'react';
import type {Metadata} from 'next';
import {getTranslations, setRequestLocale} from 'next-intl/server'; import {getTranslations, setRequestLocale} from 'next-intl/server';
import {SourceMeter, StatusBadge} from '@/components/badges'; import {api} from '@/lib/api';
import {ExternalLink} from '@/components/ExternalLink';
import {Notice} from '@/components/Notice';
import {PageHeader} from '@/components/PageHeader';
import {Link} from '@/i18n/navigation';
import {api, type LegalStage} from '@/lib/api';
const LEGAL_STAGES: LegalStage[] = ['allegation_reported', 'investigation', 'immunity_waiver_requested', 'immunity_waived',
'immunity_refused', 'indicted', 'trial', 'convicted_not_final', 'convicted_final', 'acquitted', 'proceedings_dropped', 'diversion'];
const SECTIONS = ['claims', 'certainty', 'legal', 'sources', 'notCollected', 'data', 'corrections'] as const;
const ANCHORS: Record<(typeof SECTIONS)[number], string> = {
claims: 'angaben', certainty: 'sicherheit', legal: 'verfahren', sources: 'quellen', notCollected: 'nicht-erfasst',
data: 'daten', corrections: 'korrekturen'
};
export async function generateMetadata({params}: {params: Promise<{locale: string}>}): Promise<Metadata> {
const {locale} = await params;
const t = await getTranslations({locale, namespace: 'Method'});
return {title: t('title')};
}
export default async function MethodPage({params}: {params: Promise<{locale: string}>}) { export default async function MethodPage({params}: {params: Promise<{locale: string}>}) {
const {locale} = await params; const {locale} = await params;
setRequestLocale(locale); setRequestLocale(locale);
const t = await getTranslations('Method'); const t = await getTranslations('Method');
const tc = await getTranslations('Claims'); const sources = await api.sources();
const ts = await getTranslations('Settings');
const tsocial = await getTranslations('Social');
const sources = (await api.sources()).sort((a, b) => b.default_trust - a.default_trust || a.name.localeCompare(b.name));
return ( return (
<article> <article className="prose">
<PageHeader title={t('title')} lede={t('intro')} /> <h1>{t('title')}</h1>
<div className="layout-aside">
<div className="prose">
<section id={ANCHORS.claims}>
<h2>{t('section.claims')}</h2>
<p>{t('p1')}</p> <p>{t('p1')}</p>
<p>{t('p2')}</p> <p>{t('p2')}</p>
</section>
<section id={ANCHORS.certainty}>
<h2>{t('section.certainty')}</h2>
<p>{t('certaintyIntro')}</p>
<dl className="meta-list">
<dt><SourceMeter count={1} status="reported" /></dt><dd>{t('reported')}</dd>
<dt><SourceMeter count={3} status="corroborated" /></dt><dd>{t('corroborated')}</dd>
<dt><SourceMeter count={2} status="disputed" /></dt><dd>{t('disputed')}</dd>
<dt><StatusBadge status="active" /></dt><dd>{t('activeVerified')}</dd>
<dt><StatusBadge status="active" verified={false} /></dt><dd>{t('activeUnverified')}</dd>
<dt><span className="badge badge--dashed">{tsocial('unverified')}</span></dt><dd>{t('accountUnverified')}</dd>
</dl>
</section>
<section id={ANCHORS.legal}>
<h2>{t('section.legal')}</h2>
<p>{t('p3')}</p> <p>{t('p3')}</p>
<Notice tone="legal">{tc('innocence')}</Notice> <table>
<dl className="meta-list">
{LEGAL_STAGES.map((stage) => (
<div key={stage} style={{display: 'contents'}}>
<dt><span className="badge badge--caution">{tc(`legalStage.${stage}`)}</span></dt>
<dd>{t(`stage.${stage}`)}</dd>
</div>
))}
</dl>
</section>
<section id={ANCHORS.sources}>
<h2>{t('section.sources')}</h2>
<p>{t('sourcesIntro')}</p>
</section>
</div>
<aside>
<nav className="panel" aria-labelledby="toc">
<h2 id="toc">{t('toc')}</h2>
<ol className="link-list">
{SECTIONS.map((key) => <li key={key}><a href={`#${ANCHORS[key]}`}>{t(`section.${key}`)}</a></li>)}
</ol>
</nav>
</aside>
</div>
<div className="table-wrap">
<table className="table-stack">
<thead> <thead>
<tr> <tr><th></th><th>{t('license')}</th><th>{t('access')}</th><th>{t('trust')}</th></tr>
<th scope="col">{t('source')}</th><th scope="col">{t('kind')}</th><th scope="col">{t('license')}</th>
<th scope="col">{t('access')}</th><th scope="col">{t('trust')}</th>
</tr>
</thead> </thead>
<tbody> <tbody>
{sources.map((s) => ( {sources.map((s) => (
<tr key={s.slug}> <tr key={s.slug}>
<td data-label={t('source')}> <td>
{s.homepage ? <ExternalLink href={s.homepage}>{s.name}</ExternalLink> : <strong>{s.name}</strong>} {s.homepage ? <a href={s.homepage} target="_blank" rel="noopener noreferrer">{s.name}</a> : s.name}
{s.tos_notes && <span className="block muted xsmall">{s.tos_notes}</span>} {s.tos_notes && <div className="muted small">{s.tos_notes}</div>}
</td>
<td data-label={t('kind')}><span className="badge">{ts(`kind.${s.kind}` as 'kind.official')}</span></td>
<td data-label={t('license')} className="small">{s.license ?? '–'}</td>
<td data-label={t('access')} className="small">{s.access_method}</td>
<td data-label={t('trust')}>
<span className="trust-meter">
<span><span style={{'--value': `${s.default_trust}%`} as CSSProperties} /></span>{s.default_trust}
</span>
</td> </td>
<td className="small">{s.license}</td>
<td className="small">{s.access_method}</td>
<td className="num">{s.default_trust}</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
</table> </table>
</div>
<div className="prose">
<section id={ANCHORS.notCollected}>
<h2>{t('section.notCollected')}</h2>
<p>{t('notCollected')}</p>
<p>{tsocial('policy')}</p>
</section>
<section id={ANCHORS.data}>
<h2>{t('section.data')}</h2>
<p>{t('data')}</p>
</section>
<section id={ANCHORS.corrections}>
<h2>{t('section.corrections')}</h2>
<p>{t('corrections')} <Link href="/impressum#korrekturen">{t('correctionsContact')}</Link></p>
</section>
</div>
</article> </article>
); );
} }
Loaded 100 of 152 files, more files were not shown because too many files have changed in this diff. Show more