Tracking the COVID-19 outbreak in India using Python
Making a web-based dashboard to track the numbers of COVID-19 cases in India.
First of all , I would really like to thank Sourabh Inani for giving this idea a shape and making it possible to develop this application and Yamini Lakshmipathy for encouraging me to write this blog.
Let’s dive into the what, why and how of this dashboard.
Update
Appreciate the love and support from this community. I have open sourced the code of this dashboard few days ago on GitHub. Please check it out here.
I will really encourage people who are interested to learn more about the development of this dashboard to contribute to it. There is much more that we can do together.
Introduction (What?)
The first case of COVID-19 in India was confirmed on January 30, 2020. At present the total number of confirmed cases have crossed 600 with the maximum being from Maharashtra. The Government of India is investing all their efforts to minimize the damage and keep the citizens of India safe. They have requested people to stay indoors to curtail the infection. As a responsible citizen, that is the least we could do.
Motivation(Why ?)
National Informatics Centre posted on LinkedIn to encourage the engineers of India to build tools and services that can help provide accurate information from official sources in user-friendly manner and help spread awareness of gravity of situation.
Translating the idea into reality(How?)
1. Getting the data
When building a dashboard or visualization, the key component is the data. I went on to the official website of Ministry of Health and Family Welfare, GOI. They have been tracking the numbers in state-wise manner.
So I started by building a web scrapper using BeautifulSoup, which is a very popular library for parsing simple HTML and XML documents. The scrapping task was not much of an effort since the table was a simple HTML <table> element.
After 5 minutes into the project, I was successfully able to retrieve the data. I chose to save it as a CSV document.
The next challenge was to setup a visualization interface.
2. Making the data speak
Python offers a myriad of web frameworks to build an application. Choosing the best among them was not an easy task. But at the end, I decided to go with Flask which is a micro framework with built-in server and debugger. It’s 100% WSGI compliant. Last but not the least, it is easy to understand and being light-weight, it offers great performance.
Dash makes it dead-simple to build a GUI around your data analysis code.
3. Current Functionality
The current dashboard is still pretty raw and supports the following features:
- Interactive Table to sort and filter data
- Bar graphs to visually represent the impacted states
- Key Performance Indicators
Future Enhancements
There are some enhancements identified during the beta-testing. They are not implemented yet but it will surely help improve the usability of the dashboard.
- Heat map visualization for showing state-wise intensity.
- Hockey curve for daily additional cases.
- Stock market ticker to help correlate the financial turmoil.
Thank you for your time.
If you have any requests towards improving this dashboard or wish to collaborate on this, feel free to reach out here.