Files
politics-tracking/backend/migrations/0002_seed.sql
T
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

78 lines
6.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Seed data: core organizations (chambers, government, major parties), aliases, topics.
-- Sources are NOT seeded here: they are defined in code (SourceSpec) and synced by `politrack migrate`.
INSERT INTO organization (slug, name, short_name, kind, color) VALUES
('nationalrat', 'Nationalrat', 'NR', 'parliament', NULL),
('bundesrat', 'Bundesrat', 'BR', 'parliament', NULL),
('bundesregierung', 'Bundesregierung', 'BReg', 'government', NULL),
('europaeisches-parlament', 'Europäisches Parlament', 'EP', 'eu_institution', NULL),
('europaeische-kommission', 'Europäische Kommission', 'EK', 'eu_institution', NULL),
('oevp', 'Österreichische Volkspartei', 'ÖVP', 'party', '#62C3D0'),
('spoe', 'Sozialdemokratische Partei Österreichs', 'SPÖ', 'party', '#FF0000'),
('fpoe', 'Freiheitliche Partei Österreichs', 'FPÖ', 'party', '#0052FB'),
('gruene', 'Die Grünen – Die Grüne Alternative', 'GRÜNE', 'party', '#69B12E'),
('neos', 'NEOS – Das Neue Österreich und Liberales Forum', 'NEOS', 'party', '#E3257B'),
('kpoe', 'Kommunistische Partei Österreichs', 'KPÖ', 'party', '#AA0000'),
('bzoe', 'Bündnis Zukunft Österreich', 'BZÖ', 'party', '#FF8800'),
('team-stronach', 'Team Stronach für Österreich', 'STRONACH', 'party', '#F3E600'),
('jetzt', 'JETZT – Liste Pilz', 'JETZT', 'party', '#999999'),
('bier', 'Bierpartei', 'BIER', 'party', '#FFD700'),
('mfg', 'MFG – Österreich Menschen Freiheit Grundrechte', 'MFG', 'party', '#8B4513');
-- Wikidata ids so Wikidata party memberships merge with these rows.
INSERT INTO identifier (entity_type, entity_id, scheme, value, source_slug)
SELECT 'organization', o.id, 'wikidata', q.qid, 'seed'
FROM (VALUES ('oevp', 'Q186867'), ('spoe', 'Q179111'), ('fpoe', 'Q131692'), ('gruene', 'Q193178'),
('kpoe', 'Q161118'), ('bzoe', 'Q653833'), ('team-stronach', 'Q103748')) AS q(slug, qid)
JOIN organization o ON o.slug = q.slug;
-- Aliases used by the parliament API (party codes), Wikidata labels and news text.
INSERT INTO alias (entity_type, entity_id, alias, alias_norm)
SELECT 'organization', o.id, a.alias, lower(unaccent(a.alias))
FROM (VALUES
('oevp', 'ÖVP'), ('oevp', 'V'), ('oevp', 'Volkspartei'), ('oevp', 'Neue Volkspartei'), ('oevp', 'Österreichische Volkspartei'),
('spoe', 'SPÖ'), ('spoe', 'S'), ('spoe', 'Sozialdemokraten'), ('spoe', 'Sozialdemokratische Partei Österreichs'),
('fpoe', 'FPÖ'), ('fpoe', 'F'), ('fpoe', 'Freiheitliche'), ('fpoe', 'Freiheitliche Partei Österreichs'),
('gruene', 'GRÜNE'), ('gruene', 'G'), ('gruene', 'Grüne'), ('gruene', 'Die Grünen'), ('gruene', 'Die Grünen – Die Grüne Alternative'),
('neos', 'NEOS'), ('neos', 'N'), ('neos', 'NEOS – Das Neue Österreich und Liberales Forum'),
('kpoe', 'KPÖ'), ('kpoe', 'Kommunisten'), ('kpoe', 'Kommunistische Partei Österreichs'),
('bzoe', 'BZÖ'), ('bzoe', 'B'),
('team-stronach', 'STRONACH'), ('team-stronach', 'T'),
('jetzt', 'JETZT'), ('jetzt', 'PILZ'), ('jetzt', 'J'),
('bier', 'Bierpartei'), ('bier', 'Die Bierpartei'), ('bier', 'BIER'),
('mfg', 'MFG'), ('mfg', 'MFG Österreich'),
('nationalrat', 'NR'), ('nationalrat', 'Nationalrat'), ('bundesrat', 'BR'), ('bundesrat', 'Bundesrat'),
('europaeisches-parlament', 'Europäisches Parlament'), ('europaeisches-parlament', 'European Parliament'),
('europaeische-kommission', 'Europäische Kommission'), ('europaeische-kommission', 'European Commission')
) AS a(slug, alias)
JOIN organization o ON o.slug = a.slug
ON CONFLICT DO NOTHING;
-- The first 18 topics mirror the official topics (THEMEN) of the Austrian Parliament so
-- that parliament data maps 1:1; the rest are cross-cutting topics tagged by keywords.
INSERT INTO topic (slug, name_de, name_en, keywords) VALUES
('arbeit', 'Arbeit', 'Labour', '{Arbeit,Arbeitslos,Lohn,Gehalt,Kollektivvertrag,AMS}'),
('aussenpolitik', 'Außenpolitik', 'Foreign affairs', '{Außenpolitik,Neutralität,Botschaft,Ukraine,Russland,Israel,Gaza}'),
('bildung', 'Bildung', 'Education', '{Schule,Bildung,Lehrer,Kindergarten,Matura}'),
('budget-finanzen', 'Budget und Finanzen', 'Budget & finance', '{Budget,Steuer,Finanz,Schulden,Defizit}'),
('europaeische-union', 'Europäische Union', 'European Union', '{EU,Europäische Union,Brüssel,Europaparlament}'),
('familie-generationen', 'Familie und Generationen', 'Family & generations', '{Familie,Kinderbetreuung,Familienbeihilfe,Jugend,Senioren}'),
('frauen-gleichbehandlung', 'Frauen und Gleichbehandlung', 'Women & equal treatment', '{Frauen,Gleichstellung,Gleichbehandlung,Gewaltschutz,Femizid}'),
('gesundheit', 'Gesundheit und Ernährung', 'Health & nutrition', '{Gesundheit,Spital,Krankenhaus,Ärzt,Pandemie,Impf,Lebensmittel}'),
('medien', 'Information und Medien', 'Information & media', '{ORF,Medien,Presseförderung,Informationsfreiheit,Datenschutz,Digitalisierung,KI}'),
('inneres-recht', 'Inneres und Recht', 'Interior & justice', '{Polizei,Sicherheit,Kriminalität,Terror,Justiz,Gericht,Strafrecht,Staatsanwalt,WKStA}'),
('forschung', 'Innovation, Technologie und Forschung', 'Innovation, technology & research', '{Forschung,Wissenschaft,Universität,Innovation,Technologie}'),
('klima-umwelt-energie', 'Klima, Umwelt und Energie', 'Climate, environment & energy', '{Klima,Umwelt,CO2,Emission,Energie,Strom,Gas,Erneuerbar,Photovoltaik}'),
('kultur', 'Kultur', 'Culture', '{Kultur,Kunst,Theater,Museum}'),
('land-forstwirtschaft', 'Land- und Forstwirtschaft', 'Agriculture & forestry', '{Landwirtschaft,Bauern,Agrar,Forst,Wald}'),
('parlament-demokratie', 'Parlament und Demokratie', 'Parliament & democracy', '{Verfassung,Wahlrecht,Demokratie,Volksbegehren,Parlament}'),
('soziales', 'Soziales', 'Social affairs', '{Sozial,Pension,Sozialhilfe,Armut,Pflege}'),
('verkehr', 'Verkehr und Infrastruktur', 'Transport & infrastructure', '{Verkehr,Bahn,ÖBB,Straße,Autobahn,Tunnel}'),
('wirtschaft', 'Wirtschaft', 'Economy', '{Wirtschaft,Unternehmen,Industrie,Standort,Inflation,Teuerung}'),
('migration', 'Migration und Asyl', 'Migration & asylum', '{Asyl,Migration,Flüchtling,Integration,Abschiebung}'),
('transparenz-korruption', 'Transparenz und Korruption', 'Transparency & corruption', '{Korruption,Transparenz,Parteispende,Untersuchungsausschuss,Inserat,Postenschacher}'),
('landesverteidigung', 'Landesverteidigung', 'Defence', '{Bundesheer,Verteidigung,Sky Shield}'),
('wohnen', 'Wohnen', 'Housing', '{Wohnen,Miete,Wohnbau,Mietpreis}'),
('sport', 'Sport', 'Sports', '{Sport}'),
('konsumentenschutz', 'Konsumentenschutz', 'Consumer protection', '{Konsumentenschutz,Preise,Teuerung}');