Dashboard-only project for exploring NMBS API snapshot exports.
This repository was fully reworked to focus on one thing only:
- a train-centric dashboard over snapshot data in
examples/endpoint_snapshots
Snapshot data can now be refreshed from the official Belgian Mobility Open-Data Portal GTFS feeds for NMBS-SNCB.
Removed from the project:
- legacy analysis scripts
- API fetch/services code
- map generators and unrelated reports
- extra startup flows
NMBS-Train-data/
├── main.py # single startup file
├── docker-compose.yml # easy local run
├── Dockerfile # Python 3.14.3 runtime
├── requirements.txt
├── tools/
│ └── fetch_belgian_mobility_snapshot.py
├── docs/
│ └── GTFS_Realtime_Visualization.md
├── examples/
│ └── endpoint_snapshots/
└── src/
└── nmbs_dashboard/
├── wsgi.py # Gunicorn WSGI entrypoint
├── app/
│ ├── assets/
│ ├── callbacks/
│ ├── layout/
│ ├── services/
│ └── server.py
└── paths.py
pip install -r requirements.txt
python main.pyOpen: http://localhost:8050
Optional flags:
python main.py --host 0.0.0.0 --port 8050 --debugThe official NMBS-SNCB feeds are exposed through the Belgian Mobility Open-Data
Portal. Copy .env.example to .env and fill in your own subscription key if
your portal account requires one:
BM_API_KEY=your-subscription-keyThen create a new dashboard snapshot:
python tools/fetch_belgian_mobility_snapshot.pyBy default this fetches:
- GTFS Schedule:
/api/gtfs/feed/nmbssncb/static - GTFS Realtime trip updates:
/api/gtfs/feed/nmbssncb/rt/trip-update - GTFS Realtime service alerts:
/api/gtfs/feed/nmbssncb/rt/alert
The default gateway is https://api-management-discovery-production.azure-api.net.
The *.developer.azure-api.net host is the documentation portal and returns
404 for direct feed downloads.
The raw static GTFS zip is saved in the snapshot folder as gtfs_static.zip.
For dashboard speed, the generated planning JSON files store a preview of each
GTFS table. Use --row-limit 0 to store all rows, or --static-only to skip
realtime feeds.
docker compose up --buildOpen: http://localhost:8050
Container runtime details:
- Python image:
3.14.3-slim - Process manager:
gunicorn(2 workers, gthread worker class) - Runs as a non-root user (
app) - Healthcheck probes
http://127.0.0.1:8050
Stop:
docker compose down- Default snapshot source is
examples/endpoint_snapshots. - You can override snapshot source with environment variable
SNAPSHOT_ROOT. - Belgian Mobility configuration is read from
.envor environment variables. - Do not commit your
BM_API_KEY;.envis ignored by git.
pytest