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>
This commit is contained in:
commit
583ccba31c
187 files changed
+39890
No files matched your search
@@ -0,0 +1,102 @@
|
||||
# Politrack stack. On Unraid use the "Docker Compose Manager" plugin and set
|
||||
# DATA_DIR in .env to e.g. /mnt/user/appdata/politrack (see docs/deployment-unraid.md).
|
||||
|
||||
x-backend: &backend
|
||||
image: ${POLITRACK_IMAGE:-politrack-backend:latest}
|
||||
build: ./backend
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
environment:
|
||||
POLITRACK_DATABASE_URL: postgresql://politrack:${POSTGRES_PASSWORD}@db:5432/politrack
|
||||
POLITRACK_RAW_DIR: /data/raw
|
||||
volumes:
|
||||
# Raw-response archive: lets `politrack reparse` rebuild data after parser fixes without refetching.
|
||||
- ${DATA_DIR:-./data}/raw:/data/raw
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
x-worker: &worker
|
||||
<<: *backend
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
|
||||
services:
|
||||
db:
|
||||
image: pgvector/pgvector:pg16
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: politrack
|
||||
POSTGRES_USER: politrack
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- ${DATA_DIR:-./data}/postgres:/var/lib/postgresql/data
|
||||
# Exposed so agents/BI tools can connect with the read-only role `politrack_reader`.
|
||||
ports:
|
||||
- "${DB_PORT:-5433}:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U politrack -d politrack"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
shm_size: 256mb
|
||||
# Room for the shutdown checkpoint; Docker's default 10 s kills Postgres mid-checkpoint on slow disks,
|
||||
# forcing crash recovery on the next start.
|
||||
stop_grace_period: 2m
|
||||
|
||||
# Applies SQL migrations, syncs the source registry from code and installs the job-queue schema.
|
||||
migrate:
|
||||
<<: *backend
|
||||
restart: "no"
|
||||
command: ["politrack", "migrate"]
|
||||
|
||||
api:
|
||||
<<: *worker
|
||||
command: ["politrack", "api"]
|
||||
ports:
|
||||
- "${API_PORT:-8000}:8000"
|
||||
|
||||
# Workers, one per queue class so slow bulk downloads never delay the frequent jobs.
|
||||
# Scale with `docker compose up -d --scale worker-scrape=2`, or run the same image on
|
||||
# another machine pointed at this database.
|
||||
worker-scrape:
|
||||
<<: *worker
|
||||
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=scrape,social", "--concurrency=2"]
|
||||
|
||||
worker-bulk:
|
||||
<<: *worker
|
||||
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=bulk", "--concurrency=1"]
|
||||
|
||||
worker-enrich:
|
||||
<<: *worker
|
||||
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=enrich", "--concurrency=1"]
|
||||
|
||||
mcp:
|
||||
<<: *worker
|
||||
command: ["politrack", "mcp"]
|
||||
ports:
|
||||
- "${MCP_PORT:-8001}:8001"
|
||||
|
||||
web:
|
||||
image: ${POLITRACK_WEB_IMAGE:-politrack-web:latest}
|
||||
build: ./web
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
API_INTERNAL_URL: http://api:8000
|
||||
ports:
|
||||
- "${WEB_PORT:-3000}:3000"
|
||||
depends_on:
|
||||
- api
|
||||
|
||||
# Optional local embedding model for semantic search / RAG:
|
||||
# docker compose --profile ai up -d
|
||||
# docker compose exec ollama ollama pull bge-m3
|
||||
# then set POLITRACK_OLLAMA_URL=http://ollama:11434 in .env.
|
||||
# If you already run Ollama on Unraid, point POLITRACK_OLLAMA_URL at it instead.
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
profiles: ["ai"]
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ${DATA_DIR:-./data}/ollama:/root/.ollama
|
||||
Reference in new issue
Block a user