US Air Quality: An R Shiny App for Planning Health

Posted on May 2, 2023

In the time it took you to read this sentence, you probably took a breath without thinking about it.  Breathing is essential for our survival. However, the air we breathe is not always pure and can be contaminated with various pollutants that can harm our health. The Air Quality Index (AQI) is a measure of how polluted the air is and provides information on the concentration of pollutants such as particulate matter and ozone, among others. Understanding AQI data can help people take necessary measures to reduce exposure to air pollution and improve their quality of life. To that end, I created an app to make that data easily accessible. 

Air pollution measured via AQI has been linked to a variety of health problems, such as respiratory issues, allergies, and even heart-related ailments [1][2]. Informed decisions enable us to take appropriate actions to protect the well-being of ourselves and those around us. When traveling, knowing air quality trends, enables us to plan activities, choose appropriate accommodations, or select healthier locations, reducing exposure to harmful pollutants and promoting our overall health.

The data was first obtained from the EPA and is now available on kaggle. In addition to the typical features in this data set (AQI, location data, date), it draws on census information to add population and population densities for each of the cities. In service of speed of the app, the dataset was pruned from over 40 years of data to the timeframe 1/1/2016 - 5/31/2022. The data is spread over 523 different cities in the US. This dataset tracks five different pollutants: Ozone, PM2.5, PM10, NO2, and CO, with respective frequencies of 53.9%, 25.4%, 8.2%, 6.4%, and 6%.

Unfortunately, this dataset lacks temporal consistency. That is, at some locations, there may be a reading every day; at some, every few days; at others, for only part of the year. To compensate, we include options to group entries by month. This is sensible, as we expect some level of seasonality due to events such as forest fires. 

This app allows us to take air quality into consideration when planning a visit to a region of the US. Selecting a month reveals a colored chart of the country corresponding to average AQI. 

During September, for instance, we see that a large part of the West coast records poor air quality, indicating that sensitive people may want to avoid traveling to that region during this time. In contrast, the northern Midwest has very clean air during this time, so that may be a better choice for late summer to early fall.

We can also view the distribution of points more directly to compare cities or states. Compared to Michigan, Minnesota has a smaller average but a larger variance in September.

To easily compare multiple specific regions at once via multiple metrics, we can use the Best and Worst Locations tab. 

While all of these locations typically have clean air, Houghton, MI is the winner in the vast majority of these metrics. This remains true even when looking at the data through a date range. 

This app is a valuable tool for making informed decisions regarding health, moving, and travel plans based on air quality. By understanding AQI data, users can identify regions with healthier air and minimize their exposure to harmful pollutants. Clean air is especially important for people suffering from respiratory conditions like asthma or COPD. Management of air quality exposure not only benefits their personal well-being but also raises awareness about air pollution and its impact on our lives. As more people become informed and take action, we can collectively work towards a cleaner, healthier environment, permitting healthier selves as well.

[1] Brook, R. D., et. al (2010). Particulate matter air pollution and cardiovascular disease: An update to the scientific statement from the American Heart Association. Circulation, 121(21), 2331-2378.

[2] Khreis, H., et. al (2017). Exposure to traffic-related air pollution and risk of development of childhood asthma: A systematic review and meta-analysis. Environment international, 100, 1-31. 

About Author

Daniel Erickson

I'm received my Ph.D in mathematics from Oregon State University. I enjoy tackling complex problems - specifically those amenable to insight gleaned through data.
View all posts by Daniel Erickson >

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI