Air Quality VS Respiratory Diseases Dashboard: Shiny as a Powerful Tool for Data-Driven Insights

Estimated time:
time
min

<video width="100%" height="auto" src="https://wordpress.appsilon.com/wp-content/uploads/2023/06/air-respiratory-diseases-vs-shiny-pedal-data-visualization-showcase.webm" loop="true" autoplay="true" controls="true"></video>


From a technical standpoint, this visualization was generated using D3.js, a JavaScript library renowned for its capability in creating custom, creative data visualizations. R Shiny enables the incorporation of expertise from JavaScript developers within a team, allowing for the creation of stunning graphics using D3.js, even within an R Shiny framework. While it is possible to create D3.js plots using the {r2d3} package, in this case, since we are injecting the plot into a leaflet popup, we opted to use plain JavaScript for this task.

One technical challenge we encountered was transferring data from the generated leaflet popup to the D3 plot. We successfully overcame this obstacle by passing the data as an HTML attribute to the leaflet popup, which is then detected by a MutationObserver in JavaScript, monitoring the leaflet popup pane for the addition of new popups.
<h3>Insightful Representations</h3>
Upon clicking on a monitoring station, the panel below the map dynamically updates to display the name of the country where the station is located, along with information regarding the prevalent respiratory diseases in that country. Here also, the approach has been to create an impact by engaging users with captivating insights.

Firstly, a population pyramid is utilized to showcase the distribution of deaths from respiratory diseases based on age and gender, providing viewers with valuable information for those considering relocating to areas with varying air pollutants. Additionally, rows of candles appear alongside the population pyramid, representing the Years of Life Lost (YLL) due to mortality. Each YLL signifies the loss of one year of life and is calculated by multiplying the number of deaths by a global standard life expectancy at the age of death.
<blockquote>Ready to try out R Shiny? <a href="https://templates.appsilon.com/" target="_blank" rel="noopener">Download our free templates to hit the ground running</a>!</blockquote>
This approach considers the impact of premature mortality by incorporating both the frequency of deaths and the age at which they occur. While a single YLL value represents a specific country, conveying its gravity solely as a number may not effectively communicate its significance.

To address this, the concept of birthday wishes lost is introduced, symbolized by the candles. As birthdays are highly anticipated occasions, showcasing the candles represents the unrealized potential of lives lost due to air pollution. Each candle represents 365 years of lives lost, illustrating the profound impact and emphasizing the missed opportunities for celebration and growth.

This poignant visualization underscores the urgent need for improved air quality to prevent such premature deaths.

<video width="100%" height="auto" src="https://wordpress.appsilon.com/wp-content/uploads/2023/06/air-quality-vs-respiratory-diseases-dashboard-view.webm" loop="true" autoplay="true" controls="true"></video>


<h2><strong> Impact and Potential Applications for Shiny</strong></h2>
The potential benefits of this project extend far beyond its immediate scope, offering valuable insights to a diverse range of organizations.

Public health agencies can leverage this dashboard as a powerful tool for monitoring air quality and respiratory disease rates within their communities. By identifying areas of concern, they can effectively target their efforts and interventions where they are most needed.
<blockquote>R Shiny is making fast strides in Government and Non-Government Organizations. <a href="https://appsilon.com/r-shiny-in-government-examples/" target="_blank" rel="noopener">See the power of R Shiny in Government with real examples</a>.</blockquote>
Similarly, environmental organizations can utilize the dashboard to advocate for policies and initiatives that enhance air quality, while policymakers can make more informed decisions regarding air quality regulations and public health measures.
<h2><strong>Conclusion: Finding Breathing Room with Shiny</strong></h2>
The Air Quality VS Respiratory Diseases Dashboard serves as a robust tool that empowers organizations to make data-driven decisions to improve air quality and public health. By integrating data on air quality and respiratory diseases and presenting it in a user-friendly format, the dashboard enables users to explore the data, identify trends, and gain valuable insights for decision-making processes. Its showcase of flexibility, scalability, and ease of use make it a beneficial resource for influencing various organizations, ranging from public health agencies to policymakers.

If you want to learn more about how Shiny can impact your data and unlock valuable insights, <a href="https://appsilon.com/#contact" target="_blank" rel="noopener">reach out to us today</a> or explore our collection of <a href="https://demo.appsilon.com/" target="_blank" rel="noopener">Shiny demos</a>. Our team of experts is ready to assist you in leveraging the power of data visualization and analysis for your organization's success.
<h3>Understanding the Air Pollution with Shiny</h3>
Air pollution is a global problem that affects the health and well-being of millions of people each year. Poor air quality is linked to various respiratory diseases such as asthma, chronic obstructive pulmonary disease (COPD), and lung cancer. Monitoring air quality is crucial in comprehending its impact on public health and implementing necessary measures to mitigate its adverse effects.

In this blog post, we will discuss the <a href="https://connect.appsilon.com/air-quality/" target="_blank" rel="noopener">Air Quality VS Respiratory Diseases Shiny dashboard</a>, using it as a showcase for how organizations can use dashboards to interpret results, engage stakeholders, and incite change.

<img class="aligncenter size-full wp-image-19779" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01aea03aa52514f977c1b_air-quality-vs-respiratory-diseases-r-shiny-dashboard-example.webp" alt="air quality vs respiratory diseases r shiny dashboard example" width="1213" height="1002" />
<h2>The Power of Data Visualization</h2>
The fundamental idea behind this dashboard is to merge data on air pollutants and respiratory diseases to identify connections between air quality and respiratory illnesses. To achieve this, visualizing the data in a relatable manner can have a significant impact in effectively conveying the story derived from the dataset.
<blockquote>Data can have a real, positive impact on the world. <a href="https://data4good.appsilon.com/" target="_blank" rel="noopener">See how Appsilon leverages Data Science for Good</a>.</blockquote>
Data visualization serves as a powerful tool that enables organizations to comprehend intricate datasets and make informed decisions. The Air Quality VS Respiratory Diseases Dashboard employs interactive data visualization techniques to present information on air quality and respiratory diseases in a user-friendly format. Users have the ability to explore the data, uncover trends, and identify patterns that can contribute to decision-making processes.
<h2><strong>Tech, Data Sources and Management</strong></h2>
<h3>What We Used</h3>
The dashboard was created using R Shiny with the assistance of the <a href="https://rhinoverse.dev/#rhino" target="_blank" rel="noopener">{rhino} framework</a>. Through the power of visualizations, including maps, charts, and graphs, it aids users in understanding the data.
<h3>What It Does</h3>
Upon opening the application, users are greeted with a map of Europe featuring scattered dots colored from light red to dark red. These colors represent the air quality index (AQI), where higher values indicate greater levels of air pollution and increased health concerns. Gray dots indicate areas where air pollutant data was unavailable due to various reasons, such as monitoring stations not being set up yet, while data for respiratory diseases were still accessible.
<h3>Data Sources</h3>
There are two data sources utilized in this application. The European Environment Agency (EEA) supplies the data on air pollutants and air quality, while the {eurostat} R package furnishes data on demographic and other indicators pertaining to prevalent respiratory diseases in European countries.
<h3>Data In Action</h3>
The application ingests live data from the European Environment Agency (EEA), and in cases where the API is unavailable, the app gracefully handles the situation by resorting to static cached data. The static cached data is regularly updated on a weekly basis for the EEA data and daily for the {eurostat} data through the use of cronjobs executed as GitHub Actions.

These automated processes download data from the APIs and write it to a PositConnect instance using the {pins} package. These backups are solely accessed if the live data API fails to provide the required information. Additionally, apart from the static data residing in the PositConnect instance, each R process serving a user caches the data locally in memory using the {memoise} package. This ensures that previously served requests can be delivered instantly.
<h2>Innovative Data Visualization Techniques with Shiny</h2>
As is common in some R Shiny applications with maps, the {leaflet} package is employed to provide the map view. A seemingly small, but unique change is the use of flower icons within each marker's popup, representing the proportions of air pollutants recorded at specific monitoring stations.

Why a flower? While simple bar charts can directly convey exact values, we aimed to raise awareness and engage users through an innovative approach. In this representation, the length of each petal symbolizes the amount of a particular pollutant detected at the station. By using a large flower, we can capture a user's attention and foster increased engagement with the dashboard.

Contact us!
Damian's Avatar
Damian Rodziewicz
Head of Sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
shiny
shiny demo
data for good
r
shiny dashboard