Raven is an open source web based Air Quality data validation and e-reporting system, with the aim to control the flow, metadata inventory, the quality of the monitoring data and producing the XML files required for the Air Quality B-G, except from D1b (Information on the assessment methods - for models and objective estimation) and E1b (Information on primary validated assessment data – modelled).
The system is managed and developed by NILU, with support from 4sFera, on the behalf of the European Environmental Agency.
Raven Public API is a supplement to Raven to share data with the public
Python version 3.10.8
Raven Administration Database v3.1.0+: (https://github.com/eea/raven-administration)
git clone https://github.com/eea/raven-public-apiCreate a file called .env in the root folder and set the variable
DATABASE_URI = postgresql://dbuser:password@host:port/database
INCLUDE_EEA = False
USE_PREAGG = False
USE_LOCAL_AQI_IF_AVAILABLE = False
Make sure you have Docker engine installed. (https://www.docker.com/)
Then build and run the docker-compose file.
# build and run
docker-compose build
docker-compose upThe application will run at http://localhost:5000
The default port is 5000.
Add the environment variable API_PORT to change this.
Create a virtual environment and activate it
# create
python -m venv venv
# activate on Windows
.\venv\Scripts\activate
# activate on Mac and Linux
source venv/bin/activateIn the api folder install the required python packages
pip install -r requirements.txtRun Raven
# from inside the api folder start backend server
uvicorn app:app --reloadTo use LOCAL AQI set USE_LOCAL_AQI_IF_AVAILABLE = True.
Local aqi can be defined in Raven Administrator
To enable E2a endpoint, add INCLUDE_EEA = True in the .env file.
EEA can then use the endpoint GET eea/e2a/?last_request=<datetime> to retrieve utd data
last_request in this context means you will get all data that has changes since this date
There is a maximum limit of 3 months.
To enable the use of pre aggregation, add USE_PREAGG = True in the .env file.
Make sure the sql script https://git.nilu.no/raven/raven-administration/-/blob/master/sql/pre_aggregates.sql is installed,
and that a scheduled task is set up to update the aggregations.
See https://git.nilu.no/raven/raven-administration#pre-aggregations for more information