Data Processing Scripts | Read-only mirror of https://github.com/opendatabs/data-processing — Kanton Basel-Stadt. Issues & pull requests at the source.
  • Python 96.8%
  • Dockerfile 1.4%
  • Jupyter Notebook 1.4%
  • HTML 0.2%
  • Shell 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-03 18:40:56 +01:00
.github/workflows Merge parlamentsdienst_grosserrat_datasette into parlamentsdienst_grosserrat 2026-11-26 15:14:51 +01:00
archived_etl_jobs chore(deps): bump the uv group across 2 directories with 7 updates 2026-11-15 08:46:01 +00:00
astra_strassenverkehrsunfaelle chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
aue_fischereistatistik chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
aue_grundwasser chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
aue_luft_klybeck Add Wetterstation 2026-11-19 16:14:50 +01:00
aue_rues chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
aue_schall chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
aue_umweltlabor chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
awa_bewilligungen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
awa_feiertage chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
bafu_hydrodaten chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
bafu_hydrodaten_vorhersagen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
bvb_fahrgastzahlen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
dcc_allmend_fluesse chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
dcc_anonymize_areas chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
dcc_dataspot_schemes chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
dcc_datenkatalog_dienststellen_onboarding Abort ETL on duplicate Departement-Dienststelle pairs. 2026-11-18 10:18:13 +01:00
dcc_grosserrat_docling feat(dcc_grosserrat_*): split docling from parlamentsdienst_grosserrat_datasette and rename the KI jobs 2026-11-26 11:41:01 +01:00
dcc_grosserrat_mcp feat(dcc_grosserrat_mcp): list each file with size and time in release.json 2026-11-26 15:02:46 +01:00
dcc_grosserrat_summaries feat(dcc_grosserrat_*): split docling from parlamentsdienst_grosserrat_datasette and rename the KI jobs 2026-11-26 11:41:01 +01:00
dcc_grosserrat_topics feat(dcc_grosserrat_*): split docling from parlamentsdienst_grosserrat_datasette and rename the KI jobs 2026-11-26 11:41:01 +01:00
dcc_ki_faq chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
dcc_verzeichnis_personendaten chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
digilab_eleistungen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
ed_schulferien chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
ed_swisslos_sportfonds chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
esc_faq chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
euroairport chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
fgi_geodatenshop chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
fgi_stac chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
gd_abwassermonitoring chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
gd_coronavirus_abwassermonitoring chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
gva_geodatenshop chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
gva_metadata chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
ibs_parkhaus_bewegungen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
itbs_klv chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
iwb_gas chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
iwb_netzlast chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
jfs_gartenbaeder chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
jsd_swisslos chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
kantonslabor_coliminder chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
kapo_eventverkehr_stjakob Add indikatoren 2026-12-03 18:40:56 +01:00
kapo_geschwindigkeitsmonitoring chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
kapo_ordnungsbussen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
kapo_smileys chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
lufthygiene_rosental chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
luftqualitaet_ch chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
meteoblue_rosental chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
meteoblue_wolf chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
meteoschweiz_station_basel_binningen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
mkb_sammlung_europa chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
mobilitaet_dtv chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
mobilitaet_mikromobilitaet chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
mobilitaet_mikromobilitaet_stats chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
mobilitaet_parkflaechen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
mobilitaet_verkehrszaehldaten feat: add LOCATION_ID_ALIASES for legacy SiteCodes in dashboard_calc 2026-11-04 17:08:39 +01:00
ods_catalog chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
ods_check_urls chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
ods_harvest chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
ods_publish chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
ods_update_metadata chore: auto-fix formatting and lint with Ruff 2025-09-09 11:29:08 +00:00
ods_update_temporal_coverage chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
parkendd If something is not a valid url skip it 2026-11-19 13:49:55 +01:00
parkhaeuser Prüfen, ob der Text existiert und nur aus Ziffern besteht 2026-11-19 11:21:02 +01:00
parlamentsdienst_gr_abstimmungen Add filter method and ftp folder instead of realtime push 2026-11-27 11:47:13 +01:00
parlamentsdienst_grosserrat Merge parlamentsdienst_grosserrat_datasette into parlamentsdienst_grosserrat 2026-11-26 15:14:51 +01:00
riehen_lohntabelle chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stadtgaertnerei_spielen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stadtreinigung_sauberkeitsindex chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stadtreinigung_wildedeponien chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
staka_abstimmungen Delete ID again 2026-12-01 11:53:26 +01:00
staka_baupublikationen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
staka_briefliche_stimmabgaben chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
staka_gutachten refactor: streamline FTP credentials usage in ETL functions 2026-11-05 16:19:03 +01:00
staka_kandidaturen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
staka_kantonsblatt chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
staka_regierungsratsbeschluesse chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
staka_staatskalender chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
staka_vernehmlassungen chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
staka_wahlen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_baselvotes chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_befragungen Merge 2026-12-01 16:48:33 +01:00
stata_bik chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_business_apartements chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
stata_daily_upload chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_gwr chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_harvester chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_hunde chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_kriminalitaet chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_parzellen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_pull_changes Remove tourismusdashboard since not used anymore 2026-02-02 10:52:00 +01:00
stata_requisitionen Change csv as source 2026-11-12 16:30:04 +00:00
stata_statrhena feat(stata_statrhena): translate geographic fields into DE/FR/EN 2026-11-24 10:59:16 +01:00
stata_superblock_allmend chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
stata_superblockbefragungen Work with Variablen.xlsx from data_orig 2026-11-26 14:46:34 +01:00
stata_tagesstrukturen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
tba_abfuhrtermine chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
tba_baustellen chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
tba_sprayereien chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
tba_wiese chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
unibas_semesterdaten chore(deps): update dependency soupsieve to v4 [security] 2026-11-13 16:01:22 +00:00
util Add OEV-agglo shape 2020-01-27 09:52:29 +01:00
wahlen/Gericht chore: auto-fix formatting and lint with Ruff 2025-06-20 12:41:22 +00:00
zefix_handelsregister chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
zrd_gesetzessammlung chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
.gitignore feat(stata_statrhena): zoom and pan controls for data-tree viewer 2026-11-19 17:29:29 +01:00
.gitmodules Delete Stromverbrauch_productiv.R 2024-01-26 15:43:22 +01:00
Dockerfile Trigger creating all Docker images 2026-11-12 16:56:17 +01:00
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 chore: bulk-refresh uv locks and bump common for Dependabot cleanup 2026-10-27 14:25:31 +01:00
ruff.toml The automatic fixing should do less 2025-06-23 11:45:06 +02:00
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.