Data Processing Scripts | Read-only mirror of https://github.com/opendatabs/data-processing — Kanton Basel-Stadt. Issues & pull requests at the source.
  • Python 96.3%
  • Jupyter Notebook 1.7%
  • Dockerfile 1.6%
  • HTML 0.2%
  • Shell 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-21 11:46:47 +02:00
.github/workflows feat: add Dockerfile support for dcc_datenkatalog_dienststellen_onboarding in GitHub Actions workflow 2026-08-10 11:05:36 +02:00
archived_etl_jobs Move smarte_strasse_ladestationen to archived 2026-01-26 16:45:38 +01:00
astra_strassenverkehrsunfaelle Update dependency requests to v2.32.4 [SECURITY] 2026-01-25 15:57:32 +00:00
aue_fischereistatistik Add year 2025 2026-05-21 14:18:10 +02:00
aue_grundwasser chore: auto-fix formatting and lint with Ruff 2026-05-21 09:13:24 +00:00
aue_luft_klybeck refactor: enhance Feinstaub data processing by adding numeric validation and filtering for empty or zero values in etl.py 2026-08-18 18:31:28 +02:00
aue_rues feat: add functionality for handling archived Truebung data 2026-05-18 19:49:02 +02:00
aue_schall chore: auto-fix formatting and lint with Ruff 2026-01-28 14:31:49 +00:00
aue_umweltlabor Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
awa_bewilligungen chore: auto-fix formatting and lint with Ruff 2026-03-16 13:06:37 +00:00
awa_feiertage Add Python version files and update .gitignore; create pyproject.toml for new projects 2025-09-23 16:53:52 +02:00
bafu_hydrodaten Merge pull request #519 from opendatabs/renovate/pypi-requests-vulnerability 2026-01-28 14:29:20 +01:00
bafu_hydrodaten_vorhersagen Merge pull request #519 from opendatabs/renovate/pypi-requests-vulnerability 2026-01-28 14:29:20 +01:00
bvb_fahrgastzahlen chore: auto-fix formatting and lint with Ruff 2026-02-27 16:05:22 +00:00
dcc_anonymize_areas chore(deps): bump pillow from 11.3.0 to 12.1.1 in /dcc_anonymize_areas 2026-02-20 15:45:52 +00:00
dcc_dataspot_schemes chore: auto-fix formatting and lint with Ruff 2026-02-11 07:50:57 +00:00
dcc_datenkatalog_dienststellen_onboarding refactor: simplify SharePoint file handling in etl.py by removing fallback logic and enhancing error handling 2026-08-17 15:03:40 +02:00
dcc_ki_faq chore(deps): update dependency markdown to v3.8.1 [security] 2026-03-12 14:13:47 +00:00
dcc_verzeichnis_personendaten chore: auto-fix formatting and lint with Ruff 2026-07-14 11:57:47 +00:00
digilab_eleistungen chore: auto-fix formatting and lint with Ruff 2026-02-20 15:42:57 +00:00
ed_schulferien Add prefix to ed-schulferien ics calendar entries. 2026-07-13 14:08:51 +02:00
ed_swisslos_sportfonds Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
esc_faq chore(deps): bump markdown from 3.7 to 3.8.1 in /esc_faq 2026-03-06 03:06:51 +00:00
euroairport Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
fgi_geodatenshop fix: correct casing in WMS service parameter in URL 2026-05-21 15:53:47 +02:00
fgi_stac feat: implement resource deduplication in publish_dataset.py to ensure unique GeoJSON sources during dataset updates 2026-08-10 16:19:11 +02:00
gd_abwassermonitoring Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
gd_coronavirus_abwassermonitoring Update etl.py 2026-04-30 12:19:42 +02:00
gva_geodatenshop refactor: update geocat metadata retrieval to support ISO 19115-3 paths and ensure JSON response 2026-07-24 12:09:36 +02:00
gva_metadata Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
ibs_parkhaus_bewegungen Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
itbs_klv Change typo 2026-05-22 14:38:12 +02:00
iwb_gas Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
iwb_netzlast Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
jfs_gartenbaeder Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
jsd_swisslos Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
kantonslabor_coliminder chore: auto-fix formatting and lint with Ruff 2026-07-14 11:57:47 +00:00
kapo_eventverkehr_stjakob refactor: simplify SharePoint file handling in etl.py by removing fallback logic and enhancing error handling 2026-08-17 15:03:40 +02:00
kapo_geschwindigkeitsmonitoring chore: auto-fix formatting and lint with Ruff 2026-04-23 07:29:51 +00:00
kapo_ordnungsbussen Update etl.py 2026-07-23 17:29:30 +02:00
kapo_smileys chore: auto-fix formatting and lint with Ruff 2026-07-14 11:57:47 +00:00
lufthygiene_rosental Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
luftqualitaet_ch Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
meteoblue_rosental Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
meteoblue_wolf Revert "refactor: simplify ETL process by removing unnecessary column checks and FTP upload logic" 2026-07-23 16:33:12 +02:00
meteoschweiz_station_basel_binningen chore: auto-fix formatting and lint with Ruff 2026-02-27 16:05:22 +00:00
mkb_sammlung_europa Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
mobilitaet_dtv Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
mobilitaet_mikromobilitaet chore: auto-fix formatting and lint with Ruff 2026-05-18 18:38:15 +00:00
mobilitaet_mikromobilitaet_stats Refactor download_spatial_descriptors to use GeoJSON instead of shapefile and enhance column handling in both mobilitaet_mikromobilitaet_stats and mobilitaet_parkflaechen ETL scripts. 2026-08-21 11:46:47 +02:00
mobilitaet_parkflaechen Refactor download_spatial_descriptors to use GeoJSON instead of shapefile and enhance column handling in both mobilitaet_mikromobilitaet_stats and mobilitaet_parkflaechen ETL scripts. 2026-08-21 11:46:47 +02:00
mobilitaet_verkehrszaehldaten refactor: improve ETL data handling with conditional exports and warnings 2026-03-25 15:36:10 +01:00
ods_catalog Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
ods_check_urls feat: enhance ETL process with map links functionality 2026-04-30 02:26:29 +02:00
ods_harvest Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
ods_publish Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
ods_update_metadata chore: auto-fix formatting and lint with Ruff 2025-09-09 11:29:08 +00:00
ods_update_temporal_coverage Add Python version files and update .gitignore; create pyproject.toml for new projects 2025-09-23 16:53:52 +02:00
parkendd Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
parkhaeuser chore(deps): bump urllib3 from 2.3.0 to 2.6.3 in /parkhaeuser 2026-01-28 13:34:31 +00:00
parlamentsdienst_gr_abstimmungen chore: auto-fix formatting and lint with Ruff 2026-05-21 09:13:24 +00:00
parlamentsdienst_grosserrat Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
parlamentsdienst_grosserrat_datasette chore: update pdf-converter dependency version in pyproject.toml and uv.lock for enhanced functionality 2026-08-06 13:59:11 +02:00
riehen_lohntabelle chore(deps): bump cryptography in /riehen_lohntabelle 2026-02-19 15:58:53 +00:00
stadtgaertnerei_spielen chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-15 11:16:25 +00:00
stadtreinigung_sauberkeitsindex chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-01 20:40:42 +00:00
stadtreinigung_wildedeponien chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-01 20:40:42 +00:00
staka_abstimmungen chore: auto-fix formatting and lint with Ruff 2026-04-23 07:29:51 +00:00
staka_baupublikationen chore: auto-fix formatting and lint with Ruff 2026-02-11 07:50:57 +00:00
staka_briefliche_stimmabgaben Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
staka_gutachten Add Staatskanzlei as a Departement 2026-07-10 12:06:54 +02:00
staka_kandidaturen Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
staka_kantonsblatt Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
staka_regierungsratsbeschluesse Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
staka_staatskalender Add initial implementation of ETL pipeline for digilab-eleistungen 2026-02-19 16:57:27 +01:00
staka_vernehmlassungen chore: auto-fix formatting and lint with Ruff 2026-07-14 11:57:47 +00:00
staka_verz_verf_persdat Deprecate VVP to id 100520_deprecated 2026-06-09 14:22:25 +02:00
stata_baselvotes feat: update DROP_COLUMNS to include 'Beschreibung der Vorlag' for enhanced DataFrame processing 2026-08-04 17:23:20 +02:00
stata_befragungen Correct folder 2026-06-08 09:28:32 +02:00
stata_bik Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
stata_business_apartements chore: auto-fix formatting and lint with Ruff 2025-08-25 15:38:22 +00:00
stata_daily_upload Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
stata_gwr Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
stata_harvester chore(deps): bump urllib3 from 2.3.0 to 2.6.3 in /stata_harvester 2026-01-28 13:31:35 +00:00
stata_hunde chore: auto-fix formatting and lint with Ruff 2026-07-14 11:57:47 +00:00
stata_kriminalitaet chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-01 20:40:42 +00:00
stata_parzellen Merge pull request #518 from opendatabs/dependabot/uv/stata_parzellen/requests-2.32.4 2026-01-28 14:35:31 +01:00
stata_pull_changes Remove tourismusdashboard since not used anymore 2026-02-02 10:52:00 +01:00
stata_requisitionen feat: add function to download spatial descriptors and integrate Wohnviertel and Bezirke into Requisitionen processing in etl.py 2026-08-12 10:59:51 +02:00
stata_superblock_allmend chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-01 20:40:42 +00:00
stata_tagesstrukturen chore(deps): bump pillow from 11.3.0 to 12.1.1 in /stata_tagesstrukturen 2026-02-11 17:48:09 +00:00
tba_abfuhrtermine chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-01 20:40:42 +00:00
tba_baustellen chore(deps): update dependency geopandas to v1.1.2 [security] 2026-02-01 20:40:42 +00:00
tba_sprayereien Change plz to postleitzahl 2026-08-21 10:02:08 +02:00
tba_wiese Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
unibas_semesterdaten chore: auto-fix formatting and lint with Ruff 2025-09-30 14:00:19 +00:00
util
wahlen/Gericht
zefix_handelsregister Add dplzname again 2026-03-16 10:56:11 +01:00
zrd_gesetzessammlung Update common digest to b2d26f4 2026-01-26 15:50:40 +00:00
.gitignore Update .gitignore to exclude JPG files 2026-06-04 15:22:01 +02:00
.gitmodules
Dockerfile
LICENSE Create LICENSE 2026-01-19 10:07:02 +01:00
ods_update_references.py chore: auto-fix formatting and lint with Ruff 2025-08-19 09:23:09 +00:00
README.md Update README.md 2026-06-09 15:10:58 +02:00
renovate.json
ruff.toml
setup_new_etl.py chore: auto-fix formatting and lint with Ruff 2026-01-28 14:31:49 +00:00

Data Processing Repository

This repository contains ETL (Extract, Transform, Load) jobs for processing Open Government Data for Canton Basel-Stadt, Switzerland.

For more information about the OpenDataBS organization and its projects, visit opendatabs on GitHub.

Repository Structure

Each ETL job is contained in its own folder at the root of this repository. Each folder represents an independent data processing pipeline that:

  1. Extracts data from source systems
  2. Transforms the data into a standardized format
  3. Loads the processed data to the web server for publication

Creating a New ETL Job

Use the interactive setup script to create a new ETL job:

python setup_new_etl.py

The script will ask you a series of questions and automatically create all necessary files and folders with the correct structure.

Manual Setup

When creating a new ETL job manually, create a new folder with the following structure:

Required Files and Folders

  • Dockerfile - Container definition that builds the ETL job image

    • Must use the base image: FROM ghcr.io/opendatabs/data-processing/base:latest
    • Copies uv.lock and pyproject.toml and runs uv sync --frozen
    • Copies all files to /code/
    • Sets the command to: CMD ["uv", "run", "-m", "etl"]
  • etl.py - Main ETL script that contains the data processing logic

    • Should have a main() function that is executed when the module runs
    • Uses the common library (imported from https://github.com/opendatabs/common)
    • Typically reads from data_orig/ and writes to data/
  • pyproject.toml - Python project configuration and dependencies

    • Defines project name, version, and Python requirements
    • Must include common as a dependency with a git source reference
    • Example:
      [project]
      name = "project-name"
      version = "0.1.0"
      requires-python = ">=3.12"
      dependencies = [
          "common",
          "pandas>=2.2.3",
          # ... other dependencies
      ]
      
      [tool.uv.sources]
      common = { git = "https://github.com/opendatabs/common", rev = "..." }
      
  • uv.lock - Lock file for dependency versions (generated by uv)

  • data/ - Folder for processed/transformed data output

    • Contains .gitkeep to ensure the folder is tracked in git
    • Processed data files are written here by the ETL script
  • data_orig/ - Folder for original/source data

    • Contains .gitkeep to ensure the folder is tracked in git
    • Source data files are typically mounted here at runtime in Docker
    • Original data files are read from here by the ETL script
  • change_tracking/ - Folder for change tracking metadata

    • Contains .gitkeep to ensure the folder is tracked in git
    • Used by the common.change_tracking module to track data changes

Optional Files

  • .python-version - Python version specification (typically 3.12)
  • README.md - Documentation specific to the ETL job
  • .gitignore - Git ignore rules for the specific job
  • Schema files, configuration files, or other job-specific resources

Naming Convention

Folder names should:

  • Use lowercase letters
  • Use underscores (_) to separate words
  • Be descriptive and identify the data source and type
  • Follow the pattern: {organization}_{dataset} or {organization}_{data_type}

Examples:

  • aue_umweltlabor - Umweltlabor data from AUE (Amt für Umwelt und Energie)
  • gva_geodatenshop - Geodatenshop data from GVA (Grundbuch- und Vermessungsamt)

Important for discoverability:

  • Use clear, descriptive names that indicate the data source
  • Include the organization abbreviation prefix (e.g., aue_, gva_, stata_, kapo_)

Workflows

Docker Build Workflow

The repository includes a GitHub Actions workflow (.github/workflows/docker_build.yaml) that:

  1. Detects changes - Monitors which folders have been modified
  2. Builds base image - If the root Dockerfile changes, rebuilds the base image
  3. Builds job images - For each modified folder, builds and pushes a Docker image to GitHub Container Registry (GHCR)
    • Images are tagged with: ghcr.io/opendatabs/data-processing/{folder_name}:latest
    • Images are also tagged with the commit SHA for versioning

Important: When adding a new ETL job folder, you must add it to the workflow file (.github/workflows/docker_build.yaml) in the filters section so that changes to the folder trigger Docker image builds. Also Important: After the first push, you must set the Docker image visibility to Public on GitHub Container Registry:

  1. Go to the repository's "Packages" section on GitHub: https://github.com/orgs/opendatabs/packages
  2. Click on the image (under "Packages") corresponding to your ETL job (e.g., data-processing/your_job_folder).
  3. Click the "Package settings" or gear icon.
  4. Under "Package visibility", change it from "Private" to "Public".
  5. Confirm the change.

This allows the image to be pulled and run by anyone with appropriate access.

Code Quality Workflow

The repository includes a Ruff workflow (.github/workflows/ruff.yaml) that:

  • Automatically formats Python code
  • Checks for linting issues
  • Creates pull requests with auto-fixes

Running ETL Jobs

ETL jobs are designed to run in Docker containers. Each job:

  1. Reads source data from data_orig/ (typically mounted as a volume)
  2. Processes the data using the logic in etl.py
  3. Writes processed data to data/
  4. May upload data to FTP servers or push to APIs as configured

Jobs are typically scheduled and orchestrated using Apache Airflow, with DAG definitions stored in a separate repository.

Development

Local Development

  1. Install dependencies using uv:

    uv sync
    
  2. Run the ETL script locally:

    uv run -m etl
    
  3. Ensure source data is available in data_orig/ for testing

Testing Docker Builds

To test Docker builds locally:

docker build -t test-job ./your_job_folder

Dependencies

  • Python 3.12+ - Required Python version
  • uv - Fast Python package installer and resolver (used for dependency management)
  • common - Shared library from https://github.com/opendatabs/common containing utilities for ETL jobs
  • Docker - For containerization and deployment

Base Docker Image

The base Docker image (ghcr.io/opendatabs/data-processing/base:latest) provides:

  • Python 3.12 environment
  • Timezone configured to Europe/Zurich
  • Locale configured to de_CH.UTF-8
  • uv package manager pre-installed

All ETL job Dockerfiles extend this base image.