Function Repository Resource:

JHUCOVID19Data

Source Notebook

Create a dataset of COVID-19 data from the COVID-19 Data Repository of the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University

Contributed by: Mads Bahrami

ResourceFunction["JHUCOVID19Data"]["USCounties"]

returns COVID-19 confirmed cases and deaths by US counties.

ResourceFunction["JHUCOVID19Data"]["WorldCountries"]

returns COVID-19 confirmed cases and deaths by countries.

Details

The raw data is imported as time series summaries from the COVID-19 Data Repository of the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University.
The dataset for US counties contains only confirmed cases and deaths due to COVID-19.
The dataset for the world countries contains the confirmed cases, deaths and recovered cases. For a few countries it also contains information about sub-regions.
The COVID-19 data is transformed into a TimeSeries object.

Examples

Basic Examples (3) 

Create world dataset of COVID19:

In[1]:=
world = ResourceFunction["JHUCOVID19Data"][
    "WorldCountries"]; // AbsoluteTiming
Out[1]=

Top 5 countries with most cumulative death due to COVID19:

In[2]:=
world[TakeLargestBy[#Deaths["LastValue"] &, 5]]
Out[2]=

Visualize the top 30 countries in terms of cumulative confirmed cases:

In[3]:=
DateListLogPlot[
 Callout[Tooltip[10^5 #2/#1["Population"], #1], #1] & @@@ Normal@world[TakeLargestBy[#ConfirmedCases["LastValue"] &, 10]][
    All, {#Country, #ConfirmedCases} &], Sequence[PlotRange -> All, GridLines -> Automatic, AspectRatio -> 1.5, ImageSize -> 500, PlotLabel -> "estimated confirmed cases per 100K people (log scale)"]]
Out[3]=

Possible Issues (1) 

The only allowed inputs are "USCounties" and "WorldCountries":

In[4]:=
ResourceFunction["JHUCOVID19Data"]["ConfirmedCases"]
Out[4]=

Neat Examples (3) 

Get the US COVID19 by counties:

In[5]:=
usa = ResourceFunction["JHUCOVID19Data"][
    "USCounties"]; // AbsoluteTiming
Out[5]=

A peek into the US dataset:

In[6]:=
usa[;; 3]
Out[6]=

Visualize the confirmed cases of California counties, per 100k inhabitants:

In[7]:=
GeoRegionValuePlot[
 Normal@usa[
    Select[Entity[
        "AdministrativeDivision", {"California", "UnitedStates"}] == #State &]][
   All, {#County, 10^5*#ConfirmedCases["LastValue"]/#County["Population"] /. 1/("People") -> IndependentUnit["per 100K people"]} &], PlotLabel -> "COVID-19 cases per 100k inhabitants, CA counties"]
Out[7]=

Publisher

Wolfram Summer Camp

Version History

  • 1.0.0 – 02 April 2021

Source Metadata

Related Resources

License Information