CivicAI and mypilawa.pl – AI for Local Government Data

Data on how a municipality operates is formally public in Poland, but in practice, it is scattered: contracts in the Central Register of Contracts (CRU), statistics at Statistics Poland (GUS), budget data at the Ministry of Finance, and resolutions and ordinances in the Public Information Bulletin (BIP). On top of that, there are council meeting recordings that few people have the time to watch in full.
This project combines software engineering with AI to gather this data in one place and present it in a format accessible to everyday residents. Originally intended as a simple Astro website backed by JSON files for the town of Piława Górna, it evolved into an extensive system.
Two Projects in One
The system consists of two distinctly separated parts:
- CivicAI – the core engine: data ingestion, OCR, transcription, summarization, and pipeline execution,
- mypilawa.pl – the frontend layer, i.e., the website where residents read the processed information about their municipality.
Separating them was crucial: CivicAI is not tied to a single municipality and can be adapted to any local government in Poland, while mypilawa.pl serves as the first implementation and testing ground.
Data Sources
The system aggregates information from several independent public sources:
- Central Register of Contracts (CRU),
- Statistics Poland (GUS),
- Ministry of Finance,
- Public Information Bulletin (BIP) of the town of Piława Górna (resolutions, ordinances, formal inquiries).
Each source has a different format, structure, and edge cases, which is why ingestion is organized into separate pipelines rather than a single monolithic script.
Plain-Language Documents
Resolutions, ordinances, and inquiries are written in legalistic, bureaucratic language. For each such document, LLMs generate a simplified version explaining what the document is about and what it actually changes in plain terms, making it understandable to every resident, not just lawyers or officials.
The simplified version complements the original rather than replacing it. LLM-generated summaries should always be treated as an auxiliary layer over the source document.
City Council Sessions: From Recording to Summary
A separate pipeline downloads recordings of town council session broadcasts. The audio is transcribed using Whisper, and the transcript is then processed and summarized using AI. As a result, a multi-hour session is turned into text that can be searched and read in minutes.
Two-Stage OCR
Many public documents are scans or poorly structured PDFs, making OCR necessary. Instead of relying on LLMs for everything right away, I implemented a two-stage approach:
| Stage | Method | When Used |
|---|---|---|
| 1 | Deterministic Python code extracting the full document text | Always as the first step |
| 2 | AI / LLM | When stage 1 output is unsatisfactory |
This setup limits model usage to cases where it is genuinely needed. Simple documents pass through quickly and predictably, while the LLM handles only the more challenging ones.
Pipeline Runner
Under the hood, CivicAI uses a simple Python runner to execute pipelines. A lightweight custom solution was sufficient to orchestrate ingestion, OCR, transcription, and summary generation without the overhead of heavy infrastructure.
Architecture Evolution
The project started as a static Astro website backed by JSON files. This approach allowed for quick idea validation. As the scope grew to include more sources, OCR, transcription, and summaries, it evolved into a fully fledged, comprehensive system with a dedicated data engine.
- Prototype: Astro website and data stored in JSON files.
- Adding further public sources and AI processing.
- Decoupling CivicAI as an independent engine with a pipeline runner.
- mypilawa.pl as a frontend consuming the processed data.
Adapting to Other Municipalities
Because the processing logic is decoupled from any specific portal, CivicAI can be adapted to any municipality in Poland. Onboarding another municipality mainly requires reconfiguring data sources, while the OCR, summarization, and transcription mechanisms remain unchanged.