A topic of conversation in the Organizing and Maps phone calls has been how to utilize data being collected by PurpleAir Real-time Air Quality Monitoring sensors as groups are starting to deploy them as part of their initiatives.
PurpleAir has a documented RESTful Application Programming Interface (API) that a user can get programmatic access to sensor data. I have written a sample Python Notebook that is scheduled to run every fifteen minutes which calls PurpleAir's API and loads the data into a hosted feature layer.
By putting it into the hosted feature layer, it becomes accessible in multiple service and file formats, including:
I have published the Python Notebook to GitHub for anyone interested in running the service or seeing how the data is being brought in from the PurpleAir API. Before running the script in your environment, there are a few dependencies:
- Get an API key from PurpleAir
- Modify the destination where the data is being written. I am using ArcGIS Online to store the feature layers, but your destination or file format may differ
As we iterate through the sensors, we can check for certain threshold or average values. When we encounter a value of concern, the script can send a push notification or text message using something like Amazon Simple Notification Service