Read-only mirror of https://github.com/swiss/fch-political-party-pipeline — Bundeskanzlei. Issues & pull requests at the source.
  • Jupyter Notebook 99.8%
  • Python 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Benedikt Hitz-Gamper e1f47e066a add image to readme
2026-11-30 17:00:22 +01:00
data update 2026-11-30 16:52:12 +01:00
images restructure content 2026-10-02 11:27:08 +02:00
notebooks explain I14Y deletion 2026-11-30 16:58:09 +01:00
.gitignore refactor 2026-11-30 14:53:11 +01:00
.python-version initial commit 2026-06-19 12:53:58 +02:00
pyproject.toml rename project 2026-09-25 09:21:58 +02:00
README.md add image to readme 2026-11-30 17:00:22 +01:00
uv.lock uv sync 2026-09-25 09:24:37 +02:00

Political Party Pipeline

This repository contains all the necessary code to convert the CSV Party Atlas from the project Année Politique Suisse from the University of Bern for two different outlets:

Methodology

The conversion is done by using Jupyter notebooks in the folder notebooks. The code is intentionally quite verbose and not optimized for performance, as the main goal is to have a clear and understandable code that can be easily modified and extended.

  • 1_json.ipynb downloads and converts the multiple CSV files from the University of Bern into multiple JSON files.
  • 2a_I14Y.ipynb contains all the necessary code to convert the JSON files from 1_json.ipynb into an I14Y concept and upload it to the I14Y platform. It also contains the logic to decide whether a new version of the concept needs to be pushed to the I14Y platform or not.
  • 2b_LINDAS.ipynb contains all the necessary code to convert the JSON files from 1_json.ipynb into a LINDAS Shared Dimension in RDF according to the version.link schema and upload it to the LINDAS platform.
  • 3_queries.ipynb contains some example queries to work with the LINDAS data.
  • 4_delete.ipynb contains the code to delete the data from LINDAS (I14Y data can be deleted via Web UI).

The RDF data of the political parties is modeled using the version.link schema. The main idea of this schema is to have both a representation of the current state of the party, but also a representation of the historical changes of the party.

Each party exists as one vl:Identity with a unique ID. The vl:Identity represents the current state of the party. The historical changes of the party are represented as vl:Version instances. The following changes trigger the creation of a new vl:Version instance:

  • the party changes its name
  • the party starts or stops being a child of another party
  • the party starts or stops being an observer in another party
  • the party starts or stops being affiliated with another party
  • the party is involved in a successor-of, split-from or accessed event

The vl:Version instances also have a unique ID built from the party's ID and the starting date of the version.

The original idea of the version.link schema is, that all the information on the vl:Identiy is coming from a vl:Version. This is not the case in the political party data. The vl:Identity contains information that is not available in a versioned form. An example would be some alternate identifiers.

Relationships and Events

The original data in the relationship.csv file contains data that are from a version.link perspective two different types of relationships: Such events that have a start and stop date (e.g. "child of", "observer in", "affiliated with") and events that are instantaneously one-time events (e.g. "successor of", "split from", "accessed").

The solution chosen here is to create events from the relationships so that e.g a "child of" relationship results in a child-of-start-event and a child-of-stop-event. On the other hand, a "successor of" relationship results only in one event. Each vl:Version is started and stopped by events (can be multiple events for starting and stopping a vl:Version). Furthermore, name changes are also represented as events (name-change-start-event and name-change-stop-event).

Hierarchies

Versioned data in a hierarchical structure is potentially complex. If a new relationship (e.g. child-of) triggers also on the parent side a new version, this changed parent version will consequently also trigger new versions on all children. This leads to a not very useful cascade of new versions. Therefore, the approach chosen here is to create only a new version on the lower hierarchy level (e.g. on the child level). The link to the parent will be done to the vl:Identity and not to the vl:Version of the parent.

Alternative Rejected Approach

An alternative approach would be to have only one version per identity. The version has got all the history, the identity only the currently valid data. This would resemble more of a "Wikidata" approach.

The problem with such an approach is, that this would make it difficult to build vl:successor and vl:predecessor relationships, because the vl:successor can be the same party (if a split happens, the new party is one of the followers, but the existing party is also a follower, because it is still existing). This is difficult to model with only one version per identity.

Instructional Examples

In this section, some instructional examples of the data are listed. The examples are chosen to show the different types of relationships and events that can happen in the political party data. These examples can be understood best with the help of the version.link schema and the following image.

Successor-of Event

Two in, one out:

One in, two out:

Accessed Event

Split-from Event