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:
- GeoService
- Web Feature Service
- Shapefile
- CSV
- KML
- XLS
- File Geodatabase
- GeoJSON
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
Enhancement Opportunities
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
5 Comments
@eustatic just in case you didn't see this!
Reply to this comment...
Log in to comment
This is absolutely wonderful, @seankmcginnis! Thanks for responding to needs brought up on the Open Calls by creating this custom code and sharing it!
I had a couple questions that I think will help me understand better how this works:
Thanks again, this is really helpful!
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment
@liz awards a barnstar to seankmcginnis for their awesome contribution!
My first barnstar!!!!!!!!! Thanks @liz
Reply to this comment...
Log in to comment
This is really, really cool @seankmcginnis
Reply to this comment...
Log in to comment
Login to comment.