COVIDMINDER: Where you live matters! — RShiny and Leaflet based visualization tool
By: Karan Bhanot
Tags: Towards Data Science, Visualization, R, Technology, Data Science

For the past one month, I’ve been actively working with my research team to explore the data around COVID and develop a visualization tool to understand the disparities across United States. We recently released the first iteration of the application COVIDMINDER which includes disparities in mortality rates, test cases, diabetes, and hospital beds across United States, with a special focus on New York.

In this post, we’ll explore the various tabs in some detail and see how the app was designed. Also, the application is constantly evolving and you might see many more features and tabs if you’re reading this article at a much later point in time. For quick reference, the application is live: https://covidminder.idea.rpi.edu/ and you can go ahead and explore the code on GitHub: https://github.com/TheRensselaerIDEA/COVIDMINDER

The Idea

COVIDMINDER is an application that reveals the regional disparities in outcomes, determinants and medications. It explores data about COVID-19 and tries to extract and disseminate information about various factors.

Disparity index

You must have came across several dashboards till now with the basic idea of displaying the current statistics, the number of death cases, total positive counts etc. in a beautiful interface.

But we wanted to do something different. We wanted our dashboard to be much more than just spitting out numbers directly. Thus, we decided to expand our horizon of data and include factors that could be associated with mortality. We decided to include not just mortality rates but also hospital beds in each state, the current number of test cases and diabetes spread across the country. Moreover, in these factors we calculated the disparity index in relevance to the population of the state to give a better visualization capability.

Further, we decided to include New York in our analysis as it is not only the most alarming state at the moment but I am also based out of New York so I can see everything first hand.

R-Shiny and Leaflet

App homepage

The application that you see has been designed from the ground up using R Shiny, a R package that allows you to develop websites using R code, HTML, CSS and Javascript. We explored various design styles, layouts, color schemes and finally chose the one that we see in the image. The color in plots are in high contrast to the background to highlight them better.

All the plots (except the line plot), are designed using the Leaflet package. As I am well versed with how Leaflet plots are made, I can say that the map designing is very intuitive and makes working with geo plots very simple.

Plots

Geo Plot

Geo Plot using Leaflet

For each tab, we decided to plot the data on the geo map of United States or New York. The various states/counties are color coded based on the disparity index value, ranging from dark blue to dark red. As I mentioned earlier, we used Leaflets to generate these plots.

You can hover over any state/county and see more statistics specific to that region. Each hover information changes based on which tab you are on and the disparity index.

The plots have been made interactive which allows you to zoom in and out of each plot. The legend has been added to the bottom right.

Line plot

New York test cases line plot

The second kind of plot included in our application is the New York COVID cases as they have occurred since March. As expected, New York State as a whole is the highest one. Furthermore, this is closely followed by New York, which is actually the county with the most number of cases as of today.

You can zoom in and out of the image by selecting a bounding box and explore the plot even deeper. The colors of the counties are based on the color map defined below:

Color coding for New York regions

The Maths

Disparity index is used to describe the relative position of a state or county. We use log values to identify the index. For example, to calculate disparity index for US state mortality rates, we use the following formula

index = log(Mortality rate in state/Mean mortality rate in US)

South Korea was able to “flatten the curve” using testing and thus, we compare our testing cases with the South Korea rate. Italy has higher hospital bed counts but still was not able to meet all needs, thus, we compare our hospital bed counts against Italian rates as the base minimum.

Conclusion

Developing the application taught us a lot about the COVID situation and how we can use easily available tools like R Shiny and Leaflet to generate beautiful visualizations that make understanding information much easier.

Go ahead and try the COVIDMINDER application and share your thoughts, ideas and suggestions with us.

You can reach out to us via the comments form on the website or reach out to me on LinkedIn: https://www.linkedin.com/in/bhanotkaran22/