A simple Python utility for converting the weekly assignment PDF by the "Staatsanwaltschaft Freiburg"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Martin Folkers bd3203f741
Update 'editorconfig'
2 weeks ago
sitzungsdienst Bump version 1 month ago
tests Add function 'express_service' 1 month ago
.editorconfig Update 'editorconfig' 2 weeks ago
.gitattributes Initial commit 3 months ago
.gitignore Add test for 'cli' 2 months ago
.woodpecker.yml Add CI workflow 1 month ago
LICENSE Migrate repo to 'codeberg.org' 1 month ago
README.md Add CI workflow 1 month ago
setup.bash Package as CLI library 3 months ago
setup.py Update 'setup.py' 1 month ago




A simple Python utility for converting the weekly assignment PDF by the "Staatsanwaltschaft Freiburg" into csv, json as well as ics files.

Getting started

Running setup.bash will install all dependencies inside a virtual environment, ready for action:

# Set up & activate virtualenv
virtualenv -p python3 venv

# shellcheck disable=SC1091
source venv/bin/activate

# Install dependencies
python -m pip install --editable .


Using this library is straightforward:

$ sta --help

  Extract weekly assignments from SOURCE file.

  -o, --output PATH         Output filename, without extension.
  -d, --directory TEXT      Output directory.
  -f, --file-format TEXT    File format, "csv", "json" or "ics".
  -q, --query TEXT          Query assignees, eg for name, department.
  -i, --inquiries FILENAME  JSON file with parameters for automation.
  -c, --clear-cache         Remove existing files in directory first.
  -v, --verbose             Enable verbose mode.
  --version                 Show the version and exit.
  --help                    Show this message and exit.

The following code snippet provides a very basic batch processing example:


# Create multiple calendar files at once
for arg; do
   sta -f ics -q "$arg" -o "$arg" source.pdf

Calling this script with something like bash script.bash alice bob charlie would give you alice.ics, bob.ics and charlie.ics, each containing their respective assignments.

However, you might want to store these information inside a json file and pass it via --inquiries:

        "output": "study-group",
        "query": [
        "output": "alice",
        "query": [
        "output": "bob",
        "query": [
        "output": "all-events",
        "query": []

The output property resembles the filename whereas query contains all search terms. Therefore, the first entry is equivalent to this command: sta -o study-group -q 123 -q 456 -q 789 source.pdf.


After installing this package, eg with pip install sitzungsdienst, the underlying module may also be used directly:

from sitzungsdienst import Sitzungsdienst

# Pass file path (or its stream)
sta = Sitzungsdienst(file_path)

# Retrieve data
data = sta.data

# Use a subset by filtering it
filtered = sta.filter(['alice', 'bob'])

If you want to see it in action, head over to the sitzungsapp!

Happy coding!