nCov-2019

Why I created an open-source coronavirus tracker with Shiny.

John Coene https://john-coene.com
02-08-2020

This post details first the reason I put together the coronavirus package(Coene 2020a), an open-source tracker for the nCov-2019, and second presents some of the technical details of the application.

Panic?

I worry, and I think you should too. There are numerous indications that make this virus particularly frightening, the asymptotic transmission combined with the 1 to 14 days incubation period certainly makes one. In that regard what gets me worked up is the grave misunderstandings that surround the whole situation.

I have noticed a lot of people complaining that more people die from gun violence or the flu every year than have died from the novel coronavirus yet we worry more about the latter than the former. All things being equal we can’t expect the number of deaths from guns or the flu to double this year, but we can very well expect nCov-2019 to set us back 50 years. Some processes are thin-tailed and idiosyncratic, others, like nCov-2019, are multiplicative and fat tailed. In other words, one gun or the flu cannot kill more than x people (thin-tailed) but the coronavirus could wipe us out (multiplicative). It is naive empiricism to compare numbers without context, one should compare distributions and dynamics. It is infuriating when such bogus rationality emanates from trained statisticians who ordinarily would would not look at the mean without the standard deviation.

On the “we’re going to find a vaccine:” never in history has a vaccine stopped an epidemic. They come years or even decades later (research, testing, production), only quarantine and isolation can stop a novel strain from spreading: reducing connectivity subsequently hinders the aforementioned multiplicative process.

Finally, I have lived in China for 5 years and it taught me not to trust any figure issued by the Chinese government. GDP is artificially increased, steel production is double counted, it follows that the impact of the novel coronavirus is lessened. Trusting those figures is like trusting soviet wheat yields. This is anecdotally supported by friends and extended family in China who depict a situation much different from what is read in the international press. On the ground, locals seem to believe the real number of confirmed cases are as high as three times what is reported. I am unsure which number one should trust, the tracker I created uses three different data sources.

Tracker

The application is built with Shiny using golem(Guyader et al. 2019), it lets one easily structure such an application in the form of a package which comes with numerous advantages like R CMD check, or keeping track of dependencies. One of the reasons I started building this application is because most of the already existing dashboard I found online were not mobile friendly, I therefore used the shinyMobile(Granjon, Perrier, and Rudolf 2020) framework by the RinteRface Group of which I am part in a small way.

The crawler uses the nCov2019(Yu 2020) by Guangchuang Yu to get data from Weixin/WeChat, it relies on the rvest package(Wickham 2019) to scrape DingXiangYing, finally it uses the readr package(Wickham, Hester, and Francois 2018) to load the data from John Hopkins via Github.

The screen you are presented with when the app disconnects is made with sever(Coene 2020c).

In the DXY tab, upon clicking a province the app scroll down to the breakdown by city below, this is done using shinyscroll(Coene 2020d).

All the visualisations are built with echarts4r(Coene 2019) it provides a single interface to plotting maps, timelines and more. I’m also the author and I ought to eat my own cooking.

Loading screens are built with waiter(Coene 2020e) and the counter-like spinning numbers are built with countup(Coene 2020b).

Coene, John. 2019. Echarts4r: Create Interactive Graphs with ’Echarts Javascript’ Version 4. http://echarts4r.john-coene.com/.

———. 2020a. Coronavirus: Tracking the Coronavirus. https://github/JohnCoene/coronavirus.

———. 2020b. Countup: R Htmlwidget for Countup.js.

———. 2020c. Sever: Customise the ’Shiny’ Disconnected Screen.

———. 2020d. Shinyscroll: Scroll in ’Shiny’.

———. 2020e. Waiter: Loading Screen for ’Shiny’. https://CRAN.R-project.org/package=waiter.

Granjon, David, Victor Perrier, and Isabelle Rudolf. 2020. ShinyMobile: Mobile Ready ’Shiny’ Apps with Standalone Capabilities.

Guyader, Vincent, Colin Fay, Sébastien Rochette, and Cervan Girard. 2019. Golem: A Framework for Robust Shiny Applications. https://CRAN.R-project.org/package=golem.

Wickham, Hadley. 2019. Rvest: Easily Harvest (Scrape) Web Pages. https://CRAN.R-project.org/package=rvest.

Wickham, Hadley, Jim Hester, and Romain Francois. 2018. Readr: Read Rectangular Text Data. https://CRAN.R-project.org/package=readr.

Yu, Guangchuang. 2020. NCov2019: Stats of the ’2019-nCov’ Cases.

Citation

For attribution, please cite this work as

Coene (2020, Feb. 8). John Coene's blog: nCov-2019. Retrieved from https://coronavirus.john-coene.com

BibTeX citation

@misc{coene2020coronavirus,
  author = {Coene, John},
  title = {John Coene's blog: nCov-2019},
  url = {https://coronavirus.john-coene.com},
  year = {2020}
}