This is an API that provides data about COVID-19 pandemic in Greece.
It is developed by Sociality in collaboration with iMEdD.
By default, the application retrieves its data from these sources:
- Cases per prefecture
- Greece Covid-19 timeline
- Deaths per municipality
- Demographic information
- Waste information
Of course, other sources can be also used for feeding it, by changing the application's environment variables (see below).
Here is a short description of the application's endpoints. More detailed info is included in Swagger documentation (see below).
/deaths_per_municipality: COVID-19 deaths per Greek municipality/cases: COVID-19 deaths per Greek prefecture/timeline: Gets full COVID-19 info for every date of a specific period/demographics: Gets full COVID-19 demographics info for every date and for a certain age category(0-17,18-39,40-64,65+)
/health: Just for a simple check if the application is up and running./timeline_fields: Gets all filter fields for the/timelineendpoint
/regional_units: Greece's prefectures geographical information/municipalities: Greece's municipality geographical information
We assume that you have Docker and Docker-Compose installed. If not, check here for Docker and here for Docker-Compose.
You can build the application container by typing:
make containerand let docker do its magic.
Please export the variables below with values of your choice.
POSTGRES_USER: database userPOSTGRES_PASSWORD: database password
Docker-compose will start 3 containers. The API that you just built, the database needed for storing the data, and the documentation container.
You can simply type:
docker-compose upYou can also add -d parameter to start all containers in the background.
- Also note that, if the application is running for the first time, all migrations and data hydration will take place. No more than 2 minutes are needed for this operation.
http://localhost:8080/healthIf this URL answers with hello friend message, congratulations! Your application is up and running!
You can see the database contents by typing:
docker exec -it covid19-postgres psql -U ${POSTGRES_USER} -d covid19CASES_CSV_URL: CSV file containing covid cases (default)TIMELINE_CSV_URL: CSV file containing greece COVID19 timeline info (default)DEATHS_PER_MUNICIPALITY_CSV_URL: CSV file containing deaths per greek municipality (default)DEMOGRAPHICS_CSV_URL: CSV file containing demographics information per date and per age category (default)WASTE_CSV_URL: CSV file containing waste information per week and year (default)YPES_MUNICIPALITIES_CSV_FILE: CSV file containing municipalities together with their identification code, and populations of 2021 and 2022 (default file isinternal/data/municipalities_ypes.csv)
Please keep in mind that if you want to change the data source files, you have to strictly follow their initial format.
POPULATE_DB: Choose if the database will be populated with new data at startup and every 24hPORT: API port (default 8080)MIGRATIONS_DIR: Migrations directory
We introduced rate limiting set to 100 requests per minute.
No authentication method is used for now.
If you want to only see the API's documentation without running the whole application via docker-compose, simply
run:
make swagger-startBy opening with your browser http://localhost:9000 you will see a full descriptive Swagger documentation.
Information about all the application endpoints available, etc.
We assume that you have Go 1.19 installed. If not, check here
Start a dummy database by typing:
make db-startYou can stop it later on by typing make db-stop.
You can run the migrations for the database by typing:
make migrateYou can populate the db with data by typing:
make populate-dbYou can enter the db by typing:
make db-loginmake test