https://github.com/mavroprovato/fuelpricesgr
Database of fuel prices in Greece
https://github.com/mavroprovato/fuelpricesgr
fastapi python
Last synced: 12 months ago
JSON representation
Database of fuel prices in Greece
- Host: GitHub
- URL: https://github.com/mavroprovato/fuelpricesgr
- Owner: mavroprovato
- License: mit
- Created: 2022-07-29T22:06:42.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-01T15:10:08.000Z (over 1 year ago)
- Last Synced: 2025-03-18T02:03:10.999Z (over 1 year ago)
- Topics: fastapi, python
- Language: Python
- Homepage:
- Size: 1.22 MB
- Stars: 13
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 [Παρατηρητήριο Τιμών Υγρών Καυσίμων](http://www.fuelprices.gr) 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](https://www.python.org) based project, built with [FastAPI](https://fastapi.tiangolo.com),
that uses [uv](https://docs.astral.sh/uv/) for dependency management. In order to install uv, you need to run:
```shell
curl -LsSf https://astral.sh/uv/install.sh | sh
```
If you don't have the required Python version install, you need to run
```shell
uv python install 3.13
```
By default, the data are stored in an [SQLite](https://www.sqlite.org) 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
```