CanAirIO fixed stations API for fetch published data
Edit me

Overview

The current fixed stations are stored in an InfluxDB database service, each station write a data series time in separated tables. We will change it to different schema soon. For now the next endpoints are enabled.

Data visualization

For now, the shared series time of each stations could be listed in our Grafana dashboard here:

CanAirIO grafana

Mobile track visualization

Data endpoint

Each series time could be fetched via the next endpoint:

http://influxdb.canair.io:8086/query

the full documentation of InfluxDB query syntax could be consulted here

For example:

curl -G 'http://influxdb.canair.io:8086/query?db=canairio' --data-urlencode 'q=select * from "PM25_Berlin_CanAirIO_v2" WHERE time >= now() - 12h' > PM25_Berlin_CanAirIO_v2.json

Fixed stations names

For get the complete list of fixed stations names:

curl -G 'http://influxdb.canair.io:8086/query?db=canairio' --data-urlencode 'q=show measurements'

But the more important stations of CanAirIO with more stable data is listed here.

Python example

In your OS please install before the python3-virtualenv package, then:

create and activate your virtual space:

virtualenv venv && source venv/bin/activate

install the next package for run the test:

pip3 install influxdb ipython

Query

enter to ipython console with the command ipython and execute the next lines for import the influxDb client and instance it:

from influxdb import InfluxDBClient
client = InfluxDBClient(host='influxdb.canair.io', port=8086, database='canairio')

after that, run a query:

client.query('select * from "PM2.5_BOG_FON_Hayuelos_E01" WHERE time >= now() - 10m')

you should have an output similar to next:

python output from fixed station query

Stations names

for get the all names of fixed stations:

client.get_list_measurements()

All tracks request

For now we don’t have this development, CanAirIO is a opensource initiative and you able to send any pull request for help us in improve our API. For now we have published some backups of last one year, for example:

CanAirIO full snap - fixed stations

Please read the README file in the link for details.

Tags: api