Commit Graph
37 Commits
Author SHA1 Message Date
simonandClaude Opus 5.5 1395dc2840 normalize_org_name keeps a partnership marker: a GmbH & Co KG no longer matches the GmbH
'Huber GmbH & Co KG' -> 'huber kg', 'Porsche Austria GmbH & Co OG' -> 'porsche austria og' (also &CoKG, KEG,
OHG), 'Huber GmbH' -> 'huber'. Alias matching treated the partnership and its general partner (different legal
entities) as one organisation. New legal_form_class(); firmenbuch.is_partnership uses it. Existing aliases are
recomputed and the merged organisations split by a one-off script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:20:42 +01:00
simonandClaude Opus 5.5 c61cb31e4a firmenbuch: a partnership (KG, OG, GmbH & Co KG) no longer matches the GmbH of the same name
The name search ignored the legal form, so "Huber GmbH & Co KG" (public contracts) was given the register number of
"Huber GmbH" in Ebenfurth and thereby linked to that company's managing director. Fixed on the server by moving the
number and the officer role to an organisation of their own. Commons register ids reuse firmenbuch_number().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:40:48 +01:00
simonandClaude Opus 5.5 b761517386 images: portraits and logos from Wikimedia Commons with author and licence
New adapter wikimedia.images: Wikidata P18 for people without an official photo, P154 logos for parties and
organisations matched by Wikidata id, Firmenbuch (P5285) or ZVR number (P6279). Licence data from the Commons
file page goes into image_credit (keyed by image URL); official Parliament/EP photos are never replaced.
Web: logos on party cards, party, organisation and organisation-list pages, credit lines under portraits and
logos, image proxy allows upload.wikimedia.org.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:35:27 +01:00
simonandClaude Opus 5.5 5640ed653b parlament: a written question's addressed minister is no longer recorded as asking it
The list row's "Personen" names the askers and the minister the question is addressed to. Persons who answered
the linked answer (or, for unanswered questions, any answer in the same period) are now left out of the askers.
(Test in the following commit, tests/test_parsers.py.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:35:27 +01:00
simonandClaude Opus 5.5 0c8b38a6b4 reports: count only claims that exist and are published
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 11:33:14 +01:00
simonandClaude Opus 5.5 8e16c01634 resolver: an organisation name shared by several records no longer creates another one
When an alias matched more than one organisation, the lookup gave up and the loader created a new record,
which made the name match three next time. A reparse of rtr.medientransparenz (2026-11-20) turned this into
41 duplicate organisations and 3,600 duplicate money flows. pick_org now chooses the exact name, then the same
kind, then the oldest record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:35:01 +01:00
simonandClaude Opus 5.5 9f0e2fc115 reports: user articles that embed claims under a database seal and link each other
- /berichte lists published reports; /berichte/<slug> renders a report: Markdown subset built as React
  elements (no raw HTML), [[angabe:ID]] embeds the claim card under a seal (green 'Amtliche Daten' when a
  source is official), [text](angabe:ID|bericht:slug|person:slug|org:slug) links inline, [[bericht:slug]]
  embeds another report; a box says how many claims the text rests on; backlinks between reports.
- /berichte/verfassen (login at the proxy): own reports, editor with a picker that finds claims, reports and
  persons and inserts their codes; draft / published / withdrawn; every save kept in report_revision.
- Claim pages show the embed code, 'use in a new report' and the reports citing the claim.
- API: GET /api/v1/reports, /reports/{slug} (references resolved like permalinks, merged claims follow the
  survivor); POST/PUT for the web app with POLITRACK_AUTHOR_TOKEN on behalf of the proxy user. The web app
  trusts Remote-User only with X-Politrack-Proxy = POLITRACK_PROXY_SECRET.
- Migration 0011 (report, report_revision, report_reference, app_user.display_name); docs: data model,
  deployment (sign-in setup), design system, roadmap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:19:50 +01:00
simonandClaude Opus 5.5 f2d72fe464 fixes: immunity outcomes without political connection, ORF fee rows, dropped WKStA investigations
- parlament.items (parser 3): a committee finding of no connection to the political activity
  (Art. 57 Abs. 3 B-VG) means prosecution may proceed; it was left at 'requested'. Authority and
  case number no longer run into the following sentence on older reports.
- rtr.medientransparenz (parser 2): notice type 31 is the ORF's licence-fee income under section 31
  ORF-G, not a payment to an organisation named after the paragraph.
- enrich.legal: 'Einstellung der Ermittlungen' is proceedings_dropped, not an investigation.
- reparse -p kinds=a,b replays only responses of these request kinds (no stale sweep then).
- migration 0010 removes the wrong ORF rows and organisations and re-queues the affected headlines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:03:11 +01:00
simonandClaude Opus 5.5 d2039a9dc3 speeches: always parse protocol responses, the wanted anchors grow over time
The reparse after the XXIV-XXVII fix left 12.7k speeches without text: their protocol had been
fetched earlier for other anchors, and an unchanged body was never parsed again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 00:58:10 +01:00
simonandClaude Opus 5.5 95355305d4 speeches: end XXIV-XXVII speeches at the next RU_ anchor or the chair
Protocols of these periods mark speeches with RU_ anchors only, so no heading was found and
every speech ran to the end of its session protocol (~57k documents of up to 2.8 MB;
document table 11 GB, chunks 5.6 GB, nightly dump 0.4 -> 6+ GB). Segments longer than any
real speech (200k chars) are now dropped instead of stored. parser_version 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 12:20:10 +01:00
simonandClaude Opus 5.5 10c677ca70 Firmenbuch (JustizOnline HVD): register numbers and politicians' company functions
- firmenbuch.search: register number for companies linked to people/parties, only for
  one current register entry with the same name
- firmenbuch.extracts: current extracts; officers/shareholders who are politicians in
  the database (exact birth date + name, new person hint birth_date) become company_role
  claims; nobody else is stored, raw responses are not archived, addresses never read;
  the register's daily change list triggers re-extracts
- enrich.firmenbuch closes roles a newer extract no longer lists
- Request.data (raw body, part of the fingerprint); SOAP faults are not retried
- firmenbuch_number drops leading zeros; migration 0009 adds company_role and aligns
  stored numbers; internal politrack_org ids are no longer stored as identifiers
- company_role in API types, MCP docs, person money tab, connections, labels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 11:33:01 +01:00
simonandClaude Opus 5.5 68be25a953 Landtag lists: match existing persons by birth date, Landtag membership and name variants
- person_by_name rules out homonyms born on another day and prefers the one who sat in
  that Landtag; failing an exact name, accepts a unique variant among that Landtag's
  members (Rudi/Rudolf, Chiara-Sophia/Chiara, new double surnames)
- normalize() maps ß to ss like SQL unaccent(); migration 0008 aligns stored aliases
- clean_name drops image captions, parenthesised suffixes, LTP, other abbreviations
  and zero-width characters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:50:18 +01:00
simonandClaude Opus 5.5 faf9572b9f landtage: always reparse member lists, drop Wien (robots.txt disallows /advuew/)
enrich.landtage judges coverage by the role claims a run touched, so an unchanged
page skipped by the fetcher made a state look incomplete (Burgenland). Wien's
politician search is only allowed for the city's own search appliance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:36:05 +01:00
simonandClaude Opus 5.5 3e6b1328b4 Current members of eight Landtage from their official lists
One adapter per state (landtag.noe, .ooe, .stmk, .tirol, .vbg, .sbg, .bgld,
.wien) reads the official member list: name, party, district and mandate
start where published; no contact details or addresses. enrich.landtage
closes the roles of members who leave a list (skipping incomplete runs) and
records which states are covered; migration 0007 makes person_status trust
those lists instead of open-ended Wikidata Landtag roles. Kärnten is left
out because ktn.gv.at disallows all crawlers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:19:32 +01:00
simonandClaude Opus 5.5 d9c6c3649e docs: speech texts and event dates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 21:27:34 +01:00
simonandClaude Opus 5.5 fe418cce1f Full texts and interjections of plenary speeches
parlament.speeches fetches the stenographic protocols that speeches link to
(one file per speech since 2019, one per session before) and stores each
speech's text on its evidence document, with the interjections listed in
the document's meta. Speeches linked without an anchor are skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 21:27:23 +01:00
simonandClaude Opus 5.5 0f7e003879 Event dates from the text, faster chunking, fixes
- enrich.events: take the date a sentence names (gestern, am Montag,
  am 12. November, 12.11.2026) within 60 days of publication; otherwise the
  publication date as before. -p redo=true rebuilds all extracted events.
- enrich.embed: claim cursor instead of rescanning every claim per batch;
  a full sweep once a day
- worker-enrich: two concurrent jobs, so one slow enricher can't block the rest
- Loader: empty date strings are stored as no date (a news sitemap with an
  empty publication date failed every 20 minutes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 21:22:24 +01:00
simonandClaude Opus 5.5 7bd0142734 Partial index for claims still awaiting topic tagging
Each enrich.topics batch scanned all claims for untagged ones; after the
history backfill a run took hours and blocked the enrich queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 12:23:27 +01:00
simonandClaude Opus 5.5 d03b9643e9 Index chunk.claim_id and chunk.document_id
enrich.embed looks up claims without a chunk on every batch. The existing
unique index is on COALESCE expressions, which that lookup can't use, so
after the history backfill each run took hours and starved the other
enrichers on the same queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 11:28:25 +01:00
simonandClaude Opus 5.5 ccf1a4c755 parlament.press: an explicit backfill_days overrides the cursor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 00:46:57 +01:00
simonandClaude Opus 5.5 405c21a8c5 Backups, freshness monitoring, persistent logs, procurement cleanup
- backup service: nightly pg_dump with retention, recorded as a run
- GET /api/v1/status/sources: 503 when a scheduled source or the backup
  missed its last two slots (for Uptime Kuma)
- worker logs to ${DATA_DIR}/logs, so they survive redeploys
- procurement: reject implausible award dates (1900, contract end dates),
  skip placeholder contractors, credit framework agreements to the BBG

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 00:46:18 +01:00
simonandClaude Opus 5.5 79639e5319 Backfill: former MEPs, older elections, EC 2014-2019, social history paging
- europarl.meps also loads the Austrian MEPs of the 2019-2024 term; roles end
  with the last membership, so former MEPs don't show as current
- bmi.elections: National Council 2017 and EU 2019 preference votes
- eu.commission_meetings: the 2014-2019 Commission
- social.bluesky / social.mastodon: -p backfill_pages=N pages older posts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 00:34:24 +01:00
simonandClaude Opus 5.5 4bd4e5b2db Add a phone-width audit script for the web app
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 00:00:07 +01:00
simonandClaude Opus 5.5 b7b7f2f648 Add a watchdog that repairs missed schedules and stalled jobs
Every daily and weekly source missed two days in November 2026: Procrastinate
skips a periodic slot that is more than ten minutes overdue, and jobs of
killed workers stayed "doing" forever. Every ten minutes the watchdog fails
jobs of dead workers, closes abandoned run records and defers any scheduled
task whose last slot passed without a run.

Also: EP vote references of joint motions and Council documents, and the
loader now refreshes a vote's reference and stage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 23:42:19 +01:00
simonandClaude Opus 5.5 a59d475e6b Add official election results and candidates' preference votes (BMI)
National Council 2024 and 2019 and EU 2024: party results for Austria and
the states, and preference votes of candidates who resolve to a known
politician (exact name plus birth year where published). New claim type
election_result, new resolver hint birth_year.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 23:07:51 +01:00
simonandClaude Opus 5.5 b06f17e587 Add EP amendment and part votes, hidden from general lists by default
They come from the same responses as final votes. A sitting has over a
hundred, so they are flagged part_vote and only appear on request: the vote
lists have an option for them, feeds, counts and search chunks leave them out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:17:10 +01:00
simonandClaude Opus 5.5 bf19e503f9 Use a raw string for the chunker's regex query
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:59:08 +01:00
simonandClaude Opus 5.5 1f945b8bad Stop the chunker looping forever on blank documents
A document whose text is only whitespace produces no chunks, so it was
selected again on every pass and enrich.embed never finished.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:56:58 +01:00
simonandClaude Opus 5.5 9c58bb3d8f Add committee memberships; tolerate empty EP declaration responses
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 02:19:25 +01:00
simonandClaude Opus 5.5 b4e26bb296 Let the web container write its fetch cache
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 02:15:06 +01:00
simonandClaude Opus 5.5 256906e9fe Prepare for going public: legal pages, corrections contact, portrait proxy
/impressum and /datenschutz read the operator's details from the environment
so they stay out of this repository, and show a visible notice until set.
Portraits go through an allowlisted /api/img so visitors' IPs stay with us.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 01:22:02 +01:00
simonandClaude Opus 5.5 cd44d8fbba Add EP final roll-call votes of Austrian MEPs
Uses the European Parliament's open data (CC BY 4.0) rather than
HowTheyVote, whose dump is ODbL share-alike and behind a robots.txt block.
Also documents the raw archive ownership step for Unraid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 01:18:58 +01:00
simonandClaude Opus 5.5 693c32a5e9 Mark posts that disappear from X instead of erasing them; pin mcp below 2
social.x_deletions checks stored posts through the official API. A post X
reports as not found keeps a marked record (author, link, dates, Internet
Archive link if a copy exists) while every copy of its text is removed, as
the Developer Agreement requires. A post that shows up in the timeline again
is restored by the normal upsert.

mcp 2.x removed FastMCP, which crash-looped the MCP server on first deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 00:43:36 +01:00
simonandClaude Opus 5.5 0e21730b9f Document coding agents and give them a sandbox image
Agents work on this repository in the agent-envs sandbox: a container
whose only way out is an egress proxy with an allowlist, which also adds
the Gitea bot token. docs/contributing/agents.md covers setting it up
for Politrack (1Password item, .env, commit identity), what it can reach
and its limits; AGENTS.md tells agents how to recognise the sandbox and
behave in it.

backend/tests/Dockerfile.debian gains a `sandbox` target: the agent-envs
agent image plus the backend's dependencies from Debian packages, the
same list as the PyPI-free test image (still the default target). The
sandbox runs `pytest` without PyPI, which the owner's PC can't reach. A
new invariant in AGENTS.md keeps that list in step with pyproject.toml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:59:01 +01:00
simonandClaude Opus 5.5 456f9816f4 Redesign the web app from a written design concept
Design concept and design system in docs/design/: principles (evidence
first, neutral, fair to the people shown, plain language, time as a
dimension, accessible and private), information architecture, core
patterns and a concept for every page; tokens with checked contrast,
component catalogue, content and accessibility rules.

web:
- neutral ink-indigo accent instead of flag red; party colours only as
  small markers next to the name; light/dark theme with a switcher
- stylesheets split into tokens, base, layout, components, print
- new header (search, filter count, language, theme, mobile menu) and
  footer; breadcrumbs, page headers, tabs with counts, filter bars that
  collapse on phones, pagination, notices and empty states
- claim cards with source meter, legal stage, innocence notice inside
  the card and a permalink; claim pages with citation (/angaben/{id})
- profiles with role timeline and key figures; party and organisation
  dashboards; vote list with position chips; calendar agenda on phones;
  tables that stack into cards; loading and error pages; favicon

backend:
- GET /api/v1/claims/{id} and MCP tool get_claim for permalinks
- parties list: evaluate person_status once instead of per party
  (30 s -> 1 s on the sample database, identical result)
- parliament calendar: HTML-decode titles ("84.&nbsp;Sitzung")

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:21:44 +01:00
simonandClaude Opus 5.5 45514624f4 Add AGENTS.md for agents picking up work in new sessions
- AGENTS.md: ground rules (legal access, evidence, fairness), invariants
  that are easy to break, commands, and notes on the owner's dev machine;
  CLAUDE.md imports it
- backend/tests/Dockerfile.debian: test image from Debian packages for
  networks where PyPI is unreachable, documented in testing.md
- roadmap: list what v2 has not been verified against yet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 20:02:33 +01:00
simonandClaude Opus 5.5 583ccba31c 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 20:02:01 +01:00