Skip to main content

amarillo-gtfs-generator

Generate GTFS from carpools as standalone (Docker) service.

This service complements the Amarillo application, creating GTFS and GTFS-RT data from the enhanced Amarillo carpool files. It is a non-public backend service called from the Amarillo FastAPI application. You can run it as part of docker compose, or separately using the instructions below.

Overview

Amarillo GTFS generation overview

Usage

1. Configuration

Create data/stop_sources.json

Example contents:

[
    {"url": "https://datahub.bbnavi.de/export/rideshare_points.geojson", "vicinity": 50},
    {"url": "https://data.mfdz.de/mfdz/stops/stops_zhv.csv", "vicinity": 50},
    {"url": "https://data.mfdz.de/mfdz/stops/parkings_osm.csv", "vicinity": 500}
]

Add region files data/region

File name should be {region_id}.json.

Example (by.json):

{"id": "by", "bbox": [ 8.97, 47.28, 13.86, 50.56]}

For each region a separate GTFS zip file will be created in /data/gtfs, only containing the trips that intersect the region's bounding box.

Add agency files data/agency

File name should be {agency_id}.json.

Example (mfdz.json):

{
  "id": "mfdz",
  "name": "MITFAHR|DE|ZENTRALE",
  "url": "http://mfdz.de",
  "timezone": "Europe/Berlin",
  "lang": "de",
  "email": "info@mfdz.de"
}

The generator will use this data to populate agency.txt in the GTFS output.

Uvicorn configuration

amarillo-gtfs-generator uses uvicorn to run. Uvicorn can be configured as normal by passing in arguments such as --port 8002 to change the port number.

2. Install the gtfs-exporter plugin for Amarillo

This is a separate service and not used by Amarillo by default. You should use the amarillo-gtfs-exporter plugin which creates endpoints for /region/{region_id}/gtfs and /region/{region_id}/gtfs-rt on your Amarillo instance. These will serve the GTFS zip files from data/gtfs, or if they do not exist yet, they will call the configured generator and cache the results.

3. Add carpools to Amarillo

Use Amarillo's /carpool endpoint to create new carpools. The generator listens to file system events in the /data/enhanced folder to recognize newly added or deleted carpools. It will also discover existing carpools on startup. GTFS generation happens automatically on startup, at midnight on a schedule, and by sending a GET request to a /region/{region_id}/gtfs or /region/{region_id}/gtfs-rt endpoint.

Amarillo will use its configured enhancer to create enhanced carpool files. They will get picked up by the generator and they will be included in the next batch of generated GTFS data. Changes to carpools will be reflected immediately in the GTFS-RT output.

Run with uvicorn

  • Python 3.10 with pip
  • python3-venv

Create a virtual environment python3 -m venv venv.

Activate the environment and install the dependencies pip install -r requirements.txt.

Run uvicorn amarillo_gtfs_generator.gtfs_generator:app.

In development, you can use --reload.

Run with docker

You can download a container image from the MFDZ package registry.

Example command:

docker run -it --rm --name amarillo-gtfs-generator -p 8002:80 -e TZ=Europe/Berlin -v $(pwd)/data:/app/data amarillo-gtfs-generator```

Metadata

Release files for amarillo-gtfs-generator 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amarillo-gtfs-generator 2.0.1
File Size Uploaded Provenance Actions
amarillo_gtfs_generator-2.0.1.tar.gz 62.1 kB Without provenance Details for amarillo_gtfs_generator-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amarillo-gtfs-generator 2.0.1
File Interpreter ABI Platform Actions
amarillo_gtfs_generator-2.0.1-py3-none-any.whl Python 3 none any Details for amarillo_gtfs_generator-2.0.1-py3-none-any.whl

Total release size: 116.7 kB

Release files / amarillo_gtfs_generator-2.0.1.tar.gz

Download URL amarillo_gtfs_generator-2.0.1.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ce6c8a8984702d221ec481e8e8640891d276d3bb3b865035239f2bac7f1c8ea0
BLAKE2b-256 checksum
How to use checksums
50a726ac0072cad3bae20950d923154d46ef4849449c95ae3c3153b1f089940a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.2

Release files / amarillo_gtfs_generator-2.0.1-py3-none-any.whl

Download URL amarillo_gtfs_generator-2.0.1-py3-none-any.whl
Size 54.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba9e0055266e6fd103b6f7ff7a188bfd466aba57d835128310942575488e5b39
BLAKE2b-256 checksum
How to use checksums
b25771d8aa1bae19df1677410d39467e17c80a2937cc4729aea5a2dc7ccadfd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.2

Security for amarillo-gtfs-generator 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page