Skip to content

mavroprovato/fuelpricesgr

Repository files navigation

Fuel Prices

The purpose of this project is to create a database of fuel prices in Greece. Daily and weekly data about fuel prices are regularly uploaded at the Παρατηρητήριο Τιμών Υγρών Καυσίμων website by the Greek Government, but the data are published as PDF files. In order to process the data more easily, this project fetches those PDF files, extracts the data from them, inserts them in a database, and exposes them in an API.

Data are available since:

  • 2012-04-27 for weekly country data
  • 2012-05-04 for weekly prefecture data
  • 2017-08-28 for daily country data
  • 2017-03-14 for daily prefecture data

Running the API

The backend API is a Python based project, built with FastAPI, that uses uv for dependency management. In order to install uv, you need to run:

curl -LsSf https://astral.sh/uv/install.sh | sh

If you don't have the required Python version install, you need to run

uv python install 3.13

By default, the data are stored in an SQLite database. In order to fetch the data you need to run:

uv run python -m fuelpricesgr.commands.import

This command accepts various parameters to limit the data to be fetched. You can see them by running

uv run python -m fuelpricesgr.commands.import --help

Now you can launch the API by running the command:

uv run uvicorn fuelpricesgr.main:app

The API is now available at http://localhost:8000. The documentation for the API is available at http://localhost:8000/docs.

Running with docker

In order to build the Docker image run

docker build -t mavroprovato/fuelpricesgr .

In order to run the docker image run

docker run -p 8000:8000 mavroprovato/fuelpricesgr

Development

In order to run the application tests, run

uv run pytest

In order to get the test coverage report, run

uv run coverage run -m pytest .

This will generate an HTML coverage report in htmlcov/index.html

In order to get a pylint report, run

uv run pylint fuelpricesgr

About

Database of fuel prices in Greece

Topics

Resources

License

Stars

Watchers

Forks