- How to train brand models
- How to use the matching assessment and recalculate the models with the positive lists
- Explanations on the filter options
- Swagger API documentation
- Activate GPU acceleration for the matching and model creation process
You need docker
and docker-compose
installed!
- Set your desired
postgres_user | postgres_pass and postgres_dbname
--> Remember to adjust those changes in theofs_settings_docker.yml
if you don't use the standard values:
`docker run --name=ofs-postgis -d -e POSTGRES_USER=gis_admin -e POSTGRES_PASS=admin -e POSTGRES_DBNAME=gis -e ALLOW_IP_RANGE=0.0.0.0/0 -p 5434:5432 kartoza/postgis:9.6-2.4`
- Download the models:
Download link is coming soon
. - Prepare the models: Create a folder called
ann_models
in the ofs root folder and copy the models in it.
Run ofs from the root folder:
docker-compose up -d
- Create the db:
docker exec -it container_name /ofs_venv/bin/python manage.py create_db
- Import the data:
docker exec -it container_name /ofs_venv/bin/python manage.py import_data
- Match the data (This will take some time):
docker exec -it container_name /ofs_venv/bin/python manage.py match_data
- If done, ofs should be ready to test. Head to the end of the file to find some test queries.
- You need at least
Ubuntu 18.04 with python 3.6!
- A freshly created virtual environment (recommended!)
sudo apt update
sudo apt install python3-distutils
sudo apt install python3-dev
- A freshly created virtual environment (recommended!)
- Install the beautiful
yay
aur manager
sudo pacman -S base-devel
sudo pacman -S postgresql-libs
sudo pacman -S libyaml
sudo pacman -S cython
sudo pacman -S cython2
sudo pacman -S geos
yay -S python-distutils
yay -S python2-distutils
- Install the
requirements.txt
from the ofs base folder
pip install -r requirements.txt
- Add your desired postgres_user | postgres_pass and postgres_dbname --> Remember to adjust those changes in the
ofs_settings.yml
if you don't use the standard values:
docker run --name=ofs-postgis -d -e POSTGRES_USER=gis_admin -e POSTGRES_PASS=admin -e POSTGRES_DBNAME=gis -e ALLOW_IP_RANGE=0.0.0.0/0 -p 5434:5432 kartoza/postgis:9.6-2.4
- Download the models:
Download link is coming soon
. - Prepare the models: Copy the models in the
openfuelservice/server/files/models/
folder.
- Run the creation process from the root folder of ofs:
python manage.py create-db
Couldn't drop user gis_admin
andCouldn't create user gis_admin
can be ignored!
python manage.py import-data
python manage.py run
- Please adjust the curl requests if you changed anything from the standard settings e.g. port and ip from the docker container etc.
- Get supported categories:
curl -X GET \
'http://127.0.0.1:5000/fuel?request=categories' \
-H 'cache-control: no-cache'
- Get currently supported brands:
curl -X GET \
'http://127.0.0.1:5000/fuel?request=brands&source=cfd' \
-H 'cache-control: no-cache'
- Get currently supported cars for
VW
:
curl -X GET \
'http://127.0.0.1:5000/fuel?request=cars&brand=VW&source=cfd' \
-H 'cache-control: no-cache'
- Query for all categories:
curl -X POST \
'http://127.0.0.1:5000/fuel?request=route' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"request": "route",
"geometry": {
"geojson": {
"coordinates": [
[8.679111522296585, 49.40613104364613],
[8.679119403627244, 49.40613014781563]
],
"type": "LineString"
},
"filters":{
"data_source": "cfd",
"fuel_type": "gasoline",
"vehicle_type": "car",
"driving_speed": "150",
"vehicle_categories": ["all"],
"request_id": "test123"
}
}
}'
- Query only category
b
andc
and set thetank_size
and an individualfuel_consumption
to override ofs values:
curl -X POST \
'http://127.0.0.1:5000/fuel?request=route' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"request": "route",
"geometry": {
"geojson": {
"coordinates": [
[8.679111522296585, 49.40613104364613],
[8.679119403627244, 49.40613014781563]
],
"type": "LineString"
},
"filters":{
"data_source": "cfd",
"fuel_type": "gasoline",
"vehicle_type": "car",
"driving_speed": "150",
"vehicle_categories": ["b", "c"],
"tank_sizes": {"a":"20"},
"fuel_consumptions": {"a": "4.5"},
"request_id": "test123"
}
}
}'
- Query a specific car from the database. You need to query a hash from the database to paste it in the body (See the example above:
Get currently supported cars for VW
):
curl -X POST \
'http://127.0.0.1:5000/fuel?request=route' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"request": "route",
"geometry": {
"geojson": {
"coordinates": [
[
10.502782,
51.181212
],
[
10.50239,
51.1812
],
[
10.501769,
51.181171
]
],
"type": "LineString"
},
"filters":{
"data_source": "cfd",
"fuel_type": "gasoline",
"vehicle_type": "car",
"driving_speed": "60",
"cfd_ids": ["{enter your car id here without the {}}"],
"request_id": "test123"
}
}
}'