language:
- de
- fr
- it
🚀 Demokratis.ch makes it easier to participate in Swiss consultation procedures in order to better influence the legislative process at the federal and cantonal level.
What data we use
We obtain information about federal and cantonal consultations through APIs and website scraping. For each consultation (Vernehmlassung) we typically collect a number of documents of various types:
- The proposed law change (draft, "Vorlage", "Entwurf", ...)
- A report explaining the proposed change ("Erläuternder Bericht")
- Accompanying letters, questionnaires, synoptic tables etc...
The documents are almost always just PDFs. We also get some metadata for the consultation itself, e.g. its title, starting and ending dates, and perhaps a short description.
Data acquisition and preprocessing
We use data from two main sources:
- Fedlex for federal ("Bund") consultations.
- Open Parl Data for cantonal consultations.
Document and consultation data is ingested from these sources into the Demokratis web platform running at Demokratis.ch. The web platform is our main source of truth. In addition to making the data available to end users, it also runs an admin interface that we use for manual review and correction of our database of consultations and their documents.
To transform the web platform data into a dataset for training models, we run a Prefect pipeline: demokratis_ml/pipelines/preprocess_consultation_documents.py. The result of this pipeline is a Parquet file conforming to the above-mentioned dataframe schema.
We then run several additional pipelines to extract more features from the documents (e.g. some visual PDF features) and embed the texts.
This dataset contains all our preprocessed data
Every week, all the outputs of our preprocessing pipelines are automatically published in this HuggingFace dataset:
- consultation-documents-preprocessed.parquet – the preprocessed documents themselves.
- consultation-documents-features.parquet – PDF features, such as aspect ratios, page counts, table counts etc.
- consultation-documents-embeddings-beginnings-openai-text-embedding-3-large.parquet – embeddings of the first 8,192 tokens of each document; we only embed the beginnings because they are sufficient for our current classification tasks.
- consultation-attributes-embeddings-beginnings-openai-text-embedding-3-large.parquet – embeddings of consultation attributes: title, organisation name, and short description if available.
See the Pandera schemata in demokratis_ml/data/schemata.py for a complete specification of the data we have on consultations and their documents.
Don't hesitate to talk to us on Slack #ml if you have any questions about the data!