# Tractanda

> Open archive of the documents Swiss municipalities publish on their websites: minutes, decisions, budgets, accounts, vote results and other papers of communal assemblies, parliaments and councils. Each file is listed once, with its title and a link to the original on the commune's website. Free to use under CC0 1.0; a citation ("Tractanda, https://www.tractanda.ch") is appreciated.

The archive lists 349’986 documents from 2’050 communes, each classified by a language model: its title and body as printed, the kind of body, its date and years, its languages and its sections (minutes, decisions, vote results, budget, accounts and others) with their pages. No person has checked this classification yet. The archive is growing: a missing document does not mean that a meeting did not take place.

## Query it

- [MCP server](https://www.tractanda.ch/mcp): streamable HTTP, no key. Tools: `search_documents` (filters by commune, section type, section family, body, year and title, with counts per value), `get_document`, `list_communes`, `search_text`, `read_pages`.
- [JSON API](https://github.com/davidrzs/tractanda/blob/main/server/API.md): for example `https://www.tractanda.ch/api/documents?commune=261&section=budget`, `https://www.tractanda.ch/api/documents/{sha256}`, `https://www.tractanda.ch/api/communes`; described in `https://www.tractanda.ch/api/openapi.json`.

## Search the text of the pages

- `https://www.tractanda.ch/api/pages?q=Kunstrasen*%20Kredit&canton=ZH` (MCP: `search_text`): the documents whose pages hold every word, best first, each with its best pages as plain-text snippets and a link to the file at that page. `"a phrase"` must occur as written; `word*` matches the words that begin with it (at least 3 letters before the `*`), which German compounds need: `Kunstrasen*` also finds `Kunstrasenplatz`. Case and accents do not matter; there are no operators. Filters: `commune` (BFS number), `canton`, `year`, `from` and `to` (YYYY-MM-DD), `section`, `family`, `body`, and `document` (a sha256: search inside one document). `limit` up to 50, `offset`, and `pages_per_document` 1 to 20 (default 3).
- The search ranks at most the 20,000 best matching pages. When more match, `capped` is true and `total` and the facets count only those pages' documents: add a word or a filter.
- `https://www.tractanda.ch/api/documents/{sha256}/pages?from=1&to=10` (MCP: `read_pages`): the text of up to 10 pages at a time. An `original_url` is relative to https://www.tractanda.ch and redirects to the commune's file at that page.
- The search covers the pages inside sections of these types: minutes, decisions, vote_result, budget, accounts, proposal, invitation_agenda and member_request. It leaves out bulletins and the documents of private bodies; pages without a text layer come in as OCR reaches them.
- The text is machine-extracted (the PDF's text layer, or OCR) and no person has checked it. Names, street addresses and e-mail addresses are replaced by `［name］`, `［address］` and `［email］`. Cite the document and the page.

## Pages

- A commune: `https://www.tractanda.ch/de/gemeinden/{BFS number}`, also in French (`/fr/`) and Italian (`/it/`).
- [Sitemap](https://www.tractanda.ch/sitemap.xml), [about](https://www.tractanda.ch/de/ueber-uns).

## Code

- [Source code](https://github.com/davidrzs/tractanda) (MIT)
- Contact: zdavid@ethz.ch
