World Air Quality Index Handler
World Air Quality Index handler for MindsDB provides interfaces to connect to World Air Quality Index via APIs and pull repository data into MindsDB.
Table of Contents
About World Air Quality Index Handler
The World Air Quality Index project is a non-profit project started in 2007. Its mission is to promote air pollution awareness for citizens and provide a unified and world-wide air quality information.
The project is providing transparent air quality information for more than 130 countries, covering more than 30,000 stations in 2000 major cities, via those two websites: aqicn.org and waqi.info
World Air Quality Index Handler Implementation
This handler was implemented using the requests library that makes http calls to https://aqicn.org/json-api/doc/
World Air Quality Index Handler Initialization
The World Air Quality Index handler is initialized with the following parameters:
api_key: API key to interact with aqicn
Read about creating an account here.
Implemented Features
- World Air Quality Index data for lattitude and longitude
- Support SELECT
- Support LIMIT
- Support WHERE
- Support ORDER BY
- Support column selection
- Support SELECT
Example Usage
The first step is to create a database with the new aqicn engine.
CREATE DATABASE mindsdb_aqicn
WITH ENGINE = 'aqicn',
PARAMETERS = {
"api_key": "api_key"
};
Use the established connection to query your database:
To get air quality metrics based on your location:
SELECT * FROM mindsdb_aqicn.air_quality_user_location;
To get air quality metrics based on city:
SELECT * FROM mindsdb_aqicn.air_quality_city where city="Bangalore";
The city column is mandatory in the above query.
To get air quality metrics based on coordinates:
SELECT * FROM mindsdb_aqicn.air_quality_lat_lng where lat="12.938539" AND lng="77.5901";
The lat and lng columns are mandatory in the above query.
To get air quality metrics based on station name:
SELECT * FROM mindsdb_aqicn.air_quality_station_by_name where name="bangalore";
The name column is mandatory in the above query.