Establish a reliable methodology for comparing data between ATLAS and OSM. — Identify problematic cases requiring special attention. — Provide tools to facilitate the resolution of inconsistencies. — Contribute to the continuous improvement of public transport data quality in Switzerland. | Read-only mirror of https://github.com/openTdataCH/stop_sync_osm_atlas — SBB. Issues & pull requests at the source.
  • TypeScript 48%
  • Python 33.4%
  • CSS 8.8%
  • HTML 6.8%
  • JavaScript 2.7%
  • Other 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-03 23:02:13 +01:00
.github Make the review app Swiss-only and accept SLOIDs without their prefix 2026-12-03 12:06:14 +01:00
.vscode Backend and documentation cleanup: one stats summary, one filtered query, docs split 2026-11-10 16:16:28 +01:00
backend Keep the other side of a problem's stops among the Problems map's context markers 2026-12-03 16:32:10 +01:00
documentation Refactor changelog for version 0.8.0. 2026-12-03 22:57:27 +01:00
frontend Show the Problems scroll arrow only when content is really hidden 2026-12-03 17:51:48 +01:00
migrations Route side called gtfs in the code; one migration for the whole schema 2026-11-11 23:11:20 +01:00
quality Accept the reworded engine validator copies in the clone baseline 2026-12-03 16:28:48 +01:00
scripts Pin the engine at fd66d60 and drop the legacy engine catalog fallback 2026-12-02 19:57:50 +01:00
static Show each problem's own type and priority chips on the Problems page 2026-12-03 16:26:33 +01:00
templates Show the Problems scroll arrow only when content is really hidden 2026-12-03 17:51:48 +01:00
tests Run the theme switcher and docs filter E2E tests on mobile too 2026-12-03 18:11:08 +01:00
.dockerignore Upgrade Code Map to TypeScript TypeChecker and add v0.8.0 CI/release pipeline 2026-12-01 20:30:51 +01:00
.gitattributes Baseline snapshot at 2026-02-01 (Europe/Zurich) 2026-02-01 00:00:00 +01:00
.gitignore Cut over Jinja templates to ES module bundles and remove legacy static/js 2026-12-01 20:30:51 +01:00
compose.quality.yml Count the Playwright browser tests in the quality report 2026-12-02 15:16:00 +01:00
CONTRIBUTING.md Refactor documentation scripts and improve match type handling 2026-11-10 12:26:45 +01:00
docker-compose.yml Make the review app Swiss-only and accept SLOIDs without their prefix 2026-12-03 12:06:14 +01:00
dockerfile Make the review app Swiss-only and accept SLOIDs without their prefix 2026-12-03 12:06:14 +01:00
Dockerfile.quality WeasyPrint's system libraries: the list WeasyPrint itself gives 2026-11-13 00:12:58 +01:00
engine.ref Version 0.8.0: pin engine 0.3.0 2026-12-03 17:26:20 +01:00
entrypoint.sh Backend and documentation cleanup: one stats summary, one filtered query, docs split 2026-11-10 16:16:28 +01:00
env.example Make the review app Swiss-only and accept SLOIDs without their prefix 2026-12-03 12:06:14 +01:00
eslint.config.mjs Add TypeScript toolchain, esbuild bundler, and ESLint/Jest TS config 2026-12-01 20:30:35 +01:00
LICENSE Baseline snapshot at 2026-02-01 (Europe/Zurich) 2026-02-01 00:00:00 +01:00
Makefile Rebuild the TypeScript bundles in a dev container started by make dev 2026-12-02 16:37:47 +01:00
package-lock.json Add TypeScript toolchain, esbuild bundler, and ESLint/Jest TS config 2026-12-01 20:30:35 +01:00
package.json Add TypeScript toolchain, esbuild bundler, and ESLint/Jest TS config 2026-12-01 20:30:35 +01:00
playwright.config.mjs Count the Playwright browser tests in the quality report 2026-12-02 15:16:00 +01:00
README.md Update README to streamline contributing section 2026-12-03 23:02:13 +01:00
requirements-dev.txt Quality: one map at three depths, results fetched from CI by commit 2026-11-11 10:56:05 +01:00
requirements.txt Backend and documentation cleanup: one stats summary, one filtered query, docs split 2026-11-10 16:16:28 +01:00
ruff.toml big commit 2026-09-22 19:50:18 +02:00
stylelint.config.mjs Enhance tests for pipeline progress and snapshot publication 2026-09-21 19:23:30 +02:00
tsconfig.app.json Add TypeScript toolchain, esbuild bundler, and ESLint/Jest TS config 2026-12-01 20:30:35 +01:00
tsconfig.json Add TypeScript toolchain, esbuild bundler, and ESLint/Jest TS config 2026-12-01 20:30:35 +01:00

Public Transport Matching and Review

Compare the Swiss stop registry ATLAS and the Swiss GTFS timetable with OpenStreetMap, explain the differences, and review them on a map at atlas.osm.ch, hosted by the Swiss OpenStreetMap Association (SOSM).

The matching itself is done by the source-neutral matching engine, which works with other datasets too.

The map page of atlas.osm.ch: matched and unmatched ATLAS and OSM stops around Rapperswil-Jona, with the details of one matched stop open

Quick start with Docker

You need Git and Docker with Compose v2. Clone this repository and the matching engine side by side, and check out the engine commit this app is pinned to:

git clone https://github.com/openTdataCH/stop_sync_osm_atlas.git
git clone https://github.com/openTdataCH/osm-public-transport-matcher.git engine
cd stop_sync_osm_atlas
git -C ../engine checkout "$(cat engine.ref)"

Start the database, the website and the scheduler, then run the pipeline once:

docker compose --profile dev up --build -d
docker exec stop_sync_osm_atlas_scheduler python -m backend.jobs.job_runner --mode full --trigger manual

The run downloads the national ATLAS, GTFS and OSM data, matches it and imports the result, so the first one takes a while. When it ends, open localhost:5001. From then on the scheduler refreshes the data every hour. docker compose --profile dev down stops everything; the database stays in its Compose volume.

The dev profile also starts the frontend container, which builds the TypeScript into static/js/. Compose mounts the checkout over the image's copy of the app, so a fresh clone has no built scripts without it.

How it fits together

How the project works: sources, matching engine with adapters and a source-neutral core, result bundle, review application

The project has two repositories:

  • The matching engine downloads the sources, matches them with OSM and writes a versioned result bundle. Its core is source-neutral and it needs no database.
  • This repository, the review application, imports the bundle into PostGIS and serves the map, problems, routes and reports. It reads bundles without installing the engine.

They share only the bundle format, with no Python imports between them. In Docker, the scheduler image installs the engine from your engine checkout and runs it as a separate program; the website image takes only the engine's documentation and version from it.

Try only the engine, without Docker or a database

With Python 3.10 or later:

python -m venv ../engine/.venv
source ../engine/.venv/bin/activate
python -m pip install -e '../engine[gtfs,test]'
osm-public-transport-matcher gtfs --source ../engine/examples/gtfs --namespace demo --osm ../engine/examples/osm.xml --output /tmp/transport-demo

The example is synthetic and uses no Swiss identifiers. The core library only needs NumPy/SciPy; curated integrations install through optional extras. Other datasets can use their own adapters, which implement the public adapter contract without changes to the engine (what belongs in the engine). See the engine README for its Python API and Swiss workflow.

Run deactivate before setting up a separate application environment.

Keep the engine at its pinned commit

engine.ref holds the full commit SHA of the engine this app is built and tested with. CI checks out that commit. Docker builds install your local checkout from ENGINE_DIR (default ../engine; set it in .env if yours lives elsewhere), so before building, check that it is clean and exactly at the pin:

./scripts/verify_engine_checkout.sh

To upgrade the engine, put the new SHA in engine.ref and commit it. The meaning of package versions, Git tags, SHA pins and schema versions is documented in Dependencies and builds.

How a pipeline run works

The scheduler starts the osm-public-transport-matcher executable, which writes a complete result bundle, and asks the app importer to publish it. Scheduled runs start every PIPELINE_SCHEDULE_INTERVAL_HOURS hours (one by default), the first one interval after the scheduler starts, which is why a new setup needs the run by hand above. Background scheduler describes the run modes (full, match-import, import), who writes the shared status, how a dead run is detected and the settings. Its operational checks cover a scheduler container that needs rebuilding.

The engine requires no database credentials. The importer validates the bundle and loads it into a private PostGIS schema while readers keep the published snapshot, then switches in one transaction (Bundle import and publication).

Configuration and development

Copy env.example to .env to change settings; every setting has a default and is listed in A3 Settings. Source snapshots and runtime state live under data/; PostGIS persists in the Compose volume. Long-running services restart unless manually stopped. Database migrations run through the one-shot migrator service.

For day-to-day web development, run this from the application checkout:

make dev

Open localhost:5001. Compose mounts this checkout into /app: Python edits reload Flask automatically, and template and CSS edits appear when you refresh the browser. TypeScript under frontend/src/ is rebuilt into static/js/ on each save by the frontend container, which make dev starts (the first start installs the npm packages, about 30 s); docker compose logs -f frontend shows its builds, and the VS Code task Web app & DB → Start app (debug, make dev) follows them. The Flask CLI reloader also recovers after you fix a syntax error. Dependency or Dockerfile changes require another make dev to rebuild the image. The scheduler and its installed engine need rebuilding/restarting separately when their code changes.

After moving or renaming the workspace, run make dev from its new location. Docker Desktop's Start button reuses the absolute bind paths recorded when the container was created; docker compose up recreates containers with the current paths while retaining the PostGIS volume. To also update the scheduler's paths, run docker compose up --build -d scheduler.

Run the supported quality workflow from this repository with Docker Desktop, Compose v2 and the sibling engine checkout available:

make quality-fast-container # lint, ownership, architecture and focused contract checks
make quality                # full suites, real PostGIS, coverage, structural debt and report
make quality-down           # remove the disposable quality services and volumes

The full command builds the Python 3.13 and Node 22 tooling, keeps the app and engine Python environments apart and starts its own disposable PostGIS database. For fast native iteration, use make quality-fast after installing the supported toolchain. An ordinary app-only test run skips the PostGIS publication and engine contract tests, so it does not replace the full run.

Running the quality checks covers native setup, the commands and evidence files, the module catalog, baselines, CI and troubleshooting. The code quality dashboard of a site shows the CI results of the commit it runs; how they reach the site needs no step before a deployment.

Contributing and documentation

contributor guide.

This repository's code is AGPL-3.0-or-later. The data it shows is not covered by that licence: OSM data is © OpenStreetMap contributors under the Open Database License (ODbL), and ATLAS and GTFS data come from opentransportdata.swiss under its terms of use. Each published dataset names its sources in the bundle manifest (metadata.attribution), and the stop lookup API returns them as snapshot.attribution.