# Obecní vyhlášky

> A public site that turns the municipal ordinances of the Czech registry into data: what 6 006 municipalities set for the waste fee, 5 714 for the dog fee and 559 for fireworks on New Year's Eve, every value with a quote from the ordinance.

- **Role:** Author & Maintainer
- **Year:** 2026
- **Tech:** TypeScript, Astro, Claude Opus 5.5, Claude Code CLI, Tesseract OCR, MapLibre GL, Cloudflare Workers, Vitest
- **Live:** https://obecnivyhlasky.cz
- **Canonical page:** https://ulehla.dev/projects/obecni-vyhlasky/

**Problem.** Since 2025 every valid municipal ordinance in Czechia is in one state registry, but only as DOCX, PDF and scans. Nobody had the rates, bans and exemptions as data, and a resident has to read the legal text to learn what applies in their town.

**Solution.** A pipeline downloads the ordinances, converts them to text (OCR for scans) and a language model extracts the facts into a fixed schema with a quote for every value; code checks that each quote is in the text. Ordinances that amend each other are read together per municipality. A golden set with two independent annotators and a human review measures the accuracy before a topic goes live.

**Outcome.** Live at obecnivyhlasky.cz: 18 428 pages for three topics, 12 290 dog-fee rates, 6 079 waste-fee rates and a map of the national fireworks ban zones. On the held-out test set the fireworks answer is right for 69 of 70 ordinances (98.6 %).

---

## Context

Czech municipalities set their local rules in ordinances: who pays how much for a dog or for
waste, where and when fireworks are banned. Since 2025 all 49 865 valid ordinances sit in one
registry (Sbírka právních předpisů), each as a file. The registry has an export of metadata and
no API; the content of the ordinances was never structured.

## Problem

A resident who wants to know the dog fee in their town opens a PDF and reads a legal text. A
journalist who writes about fireworks bans before New Year's Eve checks a handful of cities.
Nobody can answer "what applies in my municipality" for all 6 254 municipalities, and nobody
can compare them.

## Solution

- **Fetch and convert.** One request a second to the registry, 13 000 ordinances in three sets,
  DOCX, ODT, DOC and PDF to text, Tesseract for the scans, annexes from the record pages.
- **Extract with quotes.** Claude Opus 5.5 reads each ordinance against an annotation guide and
  writes the facts into a schema per topic. Every value carries a quote; code verifies that the
  quote is in the text and repairs small differences, so a page never shows an invented
  number.
- **Merge per municipality.** A plan decides which ordinances apply on the target day, which
  are repealed and which amend another; the model reads an ordinance with its amendments
  together and returns the wording in force.
- **Measure before launch.** For each topic a golden set of about 100 ordinances is annotated
  twice by independent agents, compared by meaning, checked by skeptics and a judge, and the
  open legal questions are decided by a human. The eval runs three models against it and the
  results are on the site.
- **Serve.** A static Astro site with 18 428 pages, a municipality search, a map of the
  national fireworks ban zones (the zones of the Ministry of Agriculture and the borders of
  the Czech cadastral office, queried in the browser) and the datasets under CC BY 4.0.

The whole extraction runs through the Claude Code CLI on a subscription, with a loop that waits
at usage limits and goes on, so a 6 673-document corpus costs nothing beyond the plan.

## Outcome

- Three topics live: fireworks on New Year's Eve 2026 (559 municipalities), the dog fee 2027
  (5 714) and the waste fee 2027 (6 006)
- Fireworks: the answer for midnight is right for 69 of 70 ordinances of the held-out test set;
  dog fee and waste fee reach 96.8 % and 100 % of right answers on their dev sets
- Every page says what the ordinance sets, never what the visitor may do, and links the
  ordinance in the registry

## What I learned

A quote that the code verifies in the source text is worth more than any prompt instruction:
it turns "the model says" into "the ordinance says", and it catches the errors that two models
make the same way. The second lesson is about scope: the territorial range of a rule ("the
built-up area", a map in an annex) cannot be resolved from text, so the site answers per
municipality and shows the map instead of pretending to know where a line runs.
