Geospatial Air Quality Sensor Data in Redis

This project provides a demonstration of the use of the geospatial features of Redis to store and query air quality sensor readings. It provides a complete process of collecting, ingesting, querying, and rendering the raw sensor data to provide AQI (Air Quality Index) measurements in a map-based web application.

The raw data is collected from air quality sensors (see Data sources) and is transformed into AQI (Air Quality Index) measurements and stored as in geospatial partitions.

The demonstration application is a simple Flask-based application that creates a map-based interactive experience with the date/time and geospatial partitions of the data which displays an interpolated (estimated) surface of AQI measurements.

An example interpoliation

Data Sources

PurpleAir sells air quality sensors that measure particulate matter in the air and upload that data to a data repository. They provide access to this aggregated data via an API.

At its simplest, the API returns a list of sensor readings for a given bounding box defined by a pair of coordinate parameters defining the north west and south east corners of the bounds. The resulting data contains the current sensor data with rolling averages for the particulate matter readings.

PurpleAir provides documentation for how to turn the PM readings into an AQI (Air Quality Index) measure.

Setup

All the implementation is written in Python 3. To run the code, all you will need to do is create a python environment and install the required packages:

pip install -r requirements.txt

The Research

A complete write-up of the methodology behind the approach the is available.

What you can do next

Collecting Data

Understand how data is collected from the air quality sensors and stored for reuse. More

Data Architecture

See how data is stored in Redis and understand how to setup Redis / Redis Enterprise databases. More

Ingesting Data

All about how to ingest raw sensor data into Redis. More

Querying Data

Understand how geospatial data is queried from the various data partitions. More

Demo Application

Understand how to run the demo web application. More

Kubernetes

Deploy the whole system on Kubernetes. More