{"id":14036982,"url":"https://github.com/GIScience/openfuelservice","last_synced_at":"2025-07-27T04:33:43.777Z","repository":{"id":37056829,"uuid":"173100586","full_name":"GIScience/openfuelservice","owner":"GIScience","description":":car::cloud::money_with_wings: The opensource vehicle fuel consumption, emission and cost calculator api","archived":true,"fork":false,"pushed_at":"2024-08-08T11:50:19.000Z","size":92407,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-08-13T03:06:25.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GIScience.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-28T11:33:04.000Z","updated_at":"2024-08-08T11:51:06.000Z","dependencies_parsed_at":"2023-01-20T14:30:17.282Z","dependency_job_id":null,"html_url":"https://github.com/GIScience/openfuelservice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fopenfuelservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fopenfuelservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fopenfuelservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fopenfuelservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GIScience","download_url":"https://codeload.github.com/GIScience/openfuelservice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227762380,"owners_count":17816016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-12T03:02:22.835Z","updated_at":"2025-07-27T04:33:43.771Z","avatar_url":"https://github.com/GIScience.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# This repository is now archived.\n\nopenfuelservice was a first prototype regarding fuel saving topics, and we gained valuable knowledge through it.\nDue to being heavily out-dated and a missing vision for this project, we have to let it go, for now.\n\nIf you want to get in touch with us regarding this or other related topics, feel free to contact us under **support[at]smartmobility.heigit.org** or visit us at [heigit.org](https://heigit.org).\n\n\n---\nOLD README\n---\n## Run as Docker Container (Flask + Gunicorn)\n---\n#### 1. Requirements\nYou need `docker` and `docker-compose` installed!\n#### 2. Install PostgreSQL-Service with docker\n-  Set your desired `postgres_user | postgres_pass and postgres_dbname` --\u003e Remember to adjust those changes in the `ofs_settings_docker.yml` if you don't use the standard values:\n```bash\n`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`\n```\n#### 3. Prepare the current brand matching models\n- Download the models: `Download link is coming soon`.    \n- Prepare the models: Create a folder called `ann_models` in the ofs root folder and copy the models in it.\n\n#### 4. Start OpenFuelService\nRun ofs from the root folder:\n```bash\ndocker-compose up -d\n```\n\n#### 5. Configure OpenFuelService\n-  Create the db:\n```bash\ndocker exec -it container_name /ofs_venv/bin/python manage.py create_db\n```\n- Import the data:\n```bash\ndocker exec -it container_name /ofs_venv/bin/python manage.py import_data\n```\n- Match the data (This will take some time):\n```bash\ndocker exec -it container_name /ofs_venv/bin/python manage.py match_data\n```\n-  If done, ofs should be ready to test. Head to the end of the file to find some test queries.\n---\n## Manual Setup (Ubuntu and Arch)\n---\n### Ubuntu Preparations\n#### 1. Requirements\n-  You need at least `Ubuntu 18.04 with python 3.6!`\n-  A freshly created virtual environment (recommended!)\n#### 2. Install the required packages\n```bash\nsudo apt update\nsudo apt install python3-distutils  \nsudo apt install python3-dev\n```\n\n\n### Arch Preparations\n#### 1. Requirements\n-  A freshly created virtual environment (recommended!)\n-  Install the beautiful `yay` aur manager \n#### 2. Install required packages\n```bash  \nsudo pacman -S base-devel  \nsudo pacman -S postgresql-libs  \nsudo pacman -S libyaml  \nsudo pacman -S cython  \nsudo pacman -S cython2  \nsudo pacman -S geos  \nyay -S python-distutils  \nyay -S python2-distutils  \n```   \n---\n### General steps\n#### 3. Activate your venv\n#### 4. Install requirements\n-  Install the `requirements.txt` from the ofs base folder\n```bash\npip install -r requirements.txt   \n```\n#### 5. Install PostgreSQL-Service with docker\n-  Add your desired postgres_user | postgres_pass and postgres_dbname --\u003e Remember to adjust those changes in the `ofs_settings.yml` if you don't use the standard values:\n```bash\ndocker 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\n```\n\n#### 6. Prepare the matching models\n- Download the models: `Download link is coming soon`.    \n- Prepare the models: Copy the models in the `openfuelservice/server/files/models/` folder.\n\n#### 7. Create the database\n-  Run the creation process from the root folder of ofs:\n```bash\npython manage.py create-db   \n```\n-  `Couldn't drop user gis_admin` and `Couldn't create user gis_admin` can be ignored!\n\n#### 8. Import the data\n```bash\npython manage.py import-data\n```\n\n#### 8. Run the server\n```bash\npython manage.py run  \n```\n---\n# Test queries\n-  Please adjust the curl requests if you changed anything from the standard settings e.g. port and ip from the docker container etc.\n\n###### [GET] Standard data queries:\n-   Get supported categories:\n```bash\ncurl -X GET \\\n  'http://127.0.0.1:5000/fuel?request=categories' \\\n  -H 'cache-control: no-cache'\n```\n-   Get currently supported brands:\n```bash\ncurl -X GET \\\n  'http://127.0.0.1:5000/fuel?request=brands\u0026source=cfd' \\\n  -H 'cache-control: no-cache'\n```\n-   Get currently supported cars for `VW`:\n```bash\ncurl -X GET \\\n  'http://127.0.0.1:5000/fuel?request=cars\u0026brand=VW\u0026source=cfd' \\\n  -H 'cache-control: no-cache'\n```\n###### [POST] Route Calculation examples:\n-   Query for all categories:\n```bash\ncurl -X POST \\\n'http://127.0.0.1:5000/fuel?request=route' \\\n-H 'Content-Type: application/json' \\\n-H 'cache-control: no-cache' \\\n-d '{\n  \"request\": \"route\",\n  \"geometry\": {\n    \"geojson\": {\n      \"coordinates\":  [\n      [8.679111522296585, 49.40613104364613],\n      [8.679119403627244, 49.40613014781563]\n      ],\n      \"type\": \"LineString\"\n    },\n    \"filters\":{\n      \"data_source\": \"cfd\",\n      \"fuel_type\": \"gasoline\",\n      \"vehicle_type\": \"car\",\n      \"driving_speed\": \"150\",\n      \"vehicle_categories\": [\"all\"],\n      \"request_id\": \"test123\"\n    }\n  }\n}'\n```\n-   Query only category  `b` and `c` and set the `tank_size` and an individual `fuel_consumption` to override ofs values:\n```bash\ncurl -X POST \\\n'http://127.0.0.1:5000/fuel?request=route' \\\n-H 'Content-Type: application/json' \\\n-H 'cache-control: no-cache' \\\n-d '{\n  \"request\": \"route\",\n  \"geometry\": {\n    \"geojson\": {\n      \"coordinates\":  [\n      [8.679111522296585, 49.40613104364613],\n      [8.679119403627244, 49.40613014781563]\n      ],\n      \"type\": \"LineString\"\n    },\n    \"filters\":{\n      \"data_source\": \"cfd\",\n      \"fuel_type\": \"gasoline\",\n      \"vehicle_type\": \"car\",\n      \"driving_speed\": \"150\",\n      \"vehicle_categories\": [\"b\", \"c\"],\n      \"tank_sizes\": {\"a\":\"20\"},\n      \"fuel_consumptions\": {\"a\": \"4.5\"},\n      \"request_id\": \"test123\"\n    }\n  }\n}'\n```\n\n-  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 `):\n```bash\ncurl -X POST \\\n  'http://127.0.0.1:5000/fuel?request=route' \\\n  -H 'Content-Type: application/json' \\\n  -H 'cache-control: no-cache' \\\n  -d '{\n  \"request\": \"route\",\n  \"geometry\": {\n    \"geojson\": {\n      \"coordinates\": [\n                    [\n                        10.502782,\n                        51.181212\n                    ],\n                    [\n                        10.50239,\n                        51.1812\n                    ],\n                    [\n                        10.501769,\n                        51.181171\n                    ]\n                ],\n                \"type\": \"LineString\"\n    },\n     \"filters\":{\n\t  \"data_source\": \"cfd\",\n      \"fuel_type\": \"gasoline\",\n      \"vehicle_type\": \"car\",\n      \"driving_speed\": \"60\",\t\n      \"cfd_ids\": [\"{enter your car id here without the {}}\"],\n      \"request_id\": \"test123\"\n    }\n  }\n}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGIScience%2Fopenfuelservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGIScience%2Fopenfuelservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGIScience%2Fopenfuelservice/lists"}