FastAPI app to enhance carpool offers from Amarillo
Project description
amarillo-enhancer
Enhancing Amarillo carpools as standalone (Docker) service.
This service complements the Amarillo service, taking Amarillo carpool files and filling in route information with additional stops and stop time data.
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}
]
You can configure the stop sources file location with the environment variable stop_sources_file
.
Uvicorn configuration
amarillo-enhancer
uses uvicorn
to run. Uvicorn can be configured as normal by passing in arguments such as --port 8001
to change the port number.
Graphhopper
amarillo-enhancer
uses a Graphhopper service for routing. You can configure the service that is used with the environment variable graphhopper_base_url
. By default it is https://api.mfdz.de/gh'
2. Make requests to the enhancer
To enhance a trip, make a POST request to /
with the carpool data as the body. The enhancer will respond with the same carpool object enhanced with additional stop time and path data. The enhancer does not save the generated file.
3. Configure the enhancer URL for Amarillo
When Amarillo receives a new carpool object, after returning an OK response it will make a request to the enhancer configured through the environment variable enhancer_url
. By default it points to 'http://localhost:8001'
.
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-enhancer.enhancer: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```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file amarillo_enhancer-2.0.1.tar.gz
.
File metadata
- Download URL: amarillo_enhancer-2.0.1.tar.gz
- Upload date:
- Size: 54.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dedf499b2c2e509665f64d3790c40bccb5768d6bef13b3129d8208a4fecffa7 |
|
MD5 | d85890fb4ef319eaae959e4e67091e9b |
|
BLAKE2b-256 | a566c6fc4da1e8c0fd39037ec0fdd2ab470beab9fa13186a596d8f098cfb7cf5 |
File details
Details for the file amarillo_enhancer-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: amarillo_enhancer-2.0.1-py3-none-any.whl
- Upload date:
- Size: 45.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e323568d4991f260651deb330c09aabf1b80c56080681101e272f70a3e936a5 |
|
MD5 | e7d42a874b389de0b4bf58200ae14139 |
|
BLAKE2b-256 | d0336a4de248c0607aa49bb778a147cce862351d6ffa574651504b607291edac |