covid19india / covid19india-react

Tracking the impact of COVID-19 in India
https://www.covid19india.org
MIT License
6.86k stars 3.41k forks source link

New Cases vs Total Confirmed graph #349

Closed mmshah278 closed 4 years ago

mmshah278 commented 4 years ago

Is your feature request related to a problem? Please describe. The graphs currently displayed show the current scenario of the cases but it fails to visualize the trend, or more specifically where the trend is headed - towards progress or opposite. On viewing the non-cumulative trend of the new cases, one can determine whether the pandemic is spreading (which can be verified by the upward trend in the graph), it is in control (a steady horizontal trend line of new cases), or the spread is reducing (on seeing the downward trend in new cases). This indicator of the trend in new cases with confirmed total cases will show the trend in spread across the country (one can even plot for each individual state)

Describe the solution you'd like On plotting the new confirmed cases (y-axis) against total confirmed cases (x-axis), one can view the trend in the spread. Few things can be known from this graph:

  1. If the graph line goes diagonally from the bottom left corner to the top right corner, it shows that that the lockdown/social distancing is not working efficiently and that there is a daily increase in the number of cases seen in a day which will result in an exponential graph in the total confirmed cases.

  2. If the graph line flattens and moves towards becoming horizontal then this proves that the number of daily new confirmed cases is steadying and the spread is being controlled. Total confirmed against time graph will be linear in this case

  3. If the graph suddenly drops then this shows that the spread is totally under control and there is a decrease in new cases seen across the nation.

Describe alternatives you've considered The above solution is for total new cases seen every day across the nation vs total confirmed cases across the nation. But it can be implemented for each state as well. Each states' new confirmed cases vs total confirmed cases of that state can be plotted as a different line with that state's name written on it. This will help viewers to know which state is doing well/worst and necessary actions can be taken.

Additional context This graph will help visualize the trend of the spread. Now, one little caveat is that this graph is not static and needs to be dynamic/interactive. One idea is to put a slider for date and plot the graph from the start of the date (date can be the start of the lockdown or any date) till the date the slider is on (or present-day). Other idea is to plot the graph (at an appropriate speed) from the start date to the present date and loop it till the user is interacting with the graph. My advice would be to use the former idea. Also, this graph should be plotted until one day before the present day. N.B.- both the axis should be in log scale.

mmshah278 commented 4 years ago

This is an implementation using plotly and plotly express library of python. I've zero knowledge in java and hence can't implement similar things directly using the website. I've python code for this if someone wants to use it for inspiration.

Current implementation only plots the cases across the nation. One can update to show for each state as well. The second small graph actually is a slider which can be used to focus on a sub-region of the original (bigger) graph.

N.B.- social distancing/lockdown is not working and every day the number of new positive cases registered is increasing. The moment the plot flattens (becomes horizontal) it'd be proof that the number of new cases is becoming steady/decreasing.

covid19

sudevschiz commented 4 years ago

This could be a potential candidate for the deep-dive (analysis and more granular slice/dice) page.

Thanks for your detail comment. Let's revisit this soon.

aruncodes commented 4 years ago

I put some effort into implementing this but mine doesn't look very pretty or informative at the moment. The data trend is correct as we can see for example Kerala's growth is declining.

Anyone who is interested to take this forward or suggest changes are welcome.

What I tried to make was something similar to this https://aatishb.com/covidtrends/

image

Code: https://github.com/aruncodes/covid19india-react/commit/a932e1690140c798462b91cf471e787d7b6e2b7d