Digitalize revised Swiss municipal Bau- und Zonenordnung (BZO) documents — building and zoning regulations published as PDFs on ortsplanung.ch — so residents and lawyers can ask questions about what changed, what applies today, and how it affects them.
See CLAUDE.md for project goals, the staged pipeline (Collect → Extract → Connect → Frontend), and repository conventions. The docs/*.jpg whiteboard slides are the closest thing to a spec.
src/nupla/pipeline/— stage I (Collect): Python package that discovers and downloads BZO PDFs for any Swiss municipality. Ships abzoCLI and a FastAPI service.src/nupla/app/— stage IV slice: Vue 3 SPA + FastAPI BFF that renders a unified-diff file. Seesrc/nupla/app/README.md.data/<municipality>/src/*.pdf— original source PDFs (currently onlyoberrieden).tf/— Terraform for deployingsrc/nupla/app/to Azure Container Apps (PROD only)..github/workflows/—build.yml,deploy-prod.yml,upload-data.yml.docs/*.jpg— whiteboard spec.
Pipeline stages II (extract) and III (connect) are not yet implemented.
Lives in src/nupla/pipeline/. Independent from src/nupla/app/ — different package, different pyproject.toml (this repo's root pyproject.toml).
cli.py—nuplaentry point with subcommandsbfs-update,refresh,list,search,serve.api.py— FastAPI REST API ; also serves the vanilla-JS UI instatic/.bfs.py— fuzzy lookup against the Swiss BFS municipality register.cantons.py,cantons_zh.py,gemeinden.py— canton-level URL mappings and scrapers.crawler.py,search.py— web search via Serper API or Playwright fallback; PDF discovery and metadata/content filtering.converter.py— PDF → Markdown via an external doc-converter service.enrichment.py,law_enrichment.py,laws_combined.json— legal-text enrichment.db.py— SQLModel/SQLite store for search cache, annotations, labels.profiles.py— search profiles (BZO, etc.).static/index.html— minimal frontend served by the API.
From the repo root:
uv sync # install dependencies into .venv
uv run playwright install chromium # one-time; needed when SERPER_API_KEY is unset
uv run nupla bfs-update # one-time; downloads the BFS register
uv run nupla serve # http://localhost:7100 (UI + API; src/nupla/app/ uses 7000)CLI examples:
uv run nupla list --canton ZH
uv run nupla search Oberrieden --pdfs --check-content
uv run nupla refresh --canton zhload_dotenv() reads a .env at the repo root. All variables are optional.
| Variable | Used by | Effect |
|---|---|---|
SERPER_API_KEY |
search.py |
Use Serper for Google search; without it falls back to Playwright crawling (slower). |
BASIC_AUTH_USER / BASIC_AUTH_PASS |
api.py |
Protect the API + static UI with HTTP Basic. If unset, auth is disabled. |
DOCCONVERTER_URL |
converter.py |
External PDF→Markdown service. Required only for endpoints that convert PDFs. |
DOCCONVERTER_USER / DOCCONVERTER_PASS |
converter.py |
Basic-auth credentials for the doc-converter. |
Vue 3 SPA + FastAPI BFF that renders a unified-diff file. Local dev and container build instructions live in src/nupla/app/README.md.
MIT — see LICENSE.