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.
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 manualThe 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.
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.
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-demoThe 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.
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.shTo 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.
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).
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 devOpen 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 volumesThe 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.
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.
