Message Boards Message Boards

GROUPS:

Visualizing the Ebola Outbreak

Posted 7 years ago
9972 Views
|
1 Reply
|
12 Total Likes
|

The World Health Organization is tracking the recent outbreak of the Ebola virus in four African countries: Guinea, Liberia, Nigeria, and Sierra Leone. In this post I look at mapping this data to help visualize it. We start out with defining the countries:

CountryNames = {"Guinea", "Liberia", "Nigeria", "Sierra Leone"}

We can map the function SemanticInterpretation over these names to get the entity objects for these countries:

Countries = SemanticInterpretation /@ CountryNames

enter image description here

With these entities we can highlight the affected countries using GeoListPlot:

GeoListPlot[Countries, ImageSize -> Large, GeoLabels -> True]

enter image description here

The World Health organization publishes data on the spread of this disease. The following code imports the table part of this publication:

xml = Import["http://www.who.int/csr/don/2014_08_15_ebola/en/", "XMLObject"];
table = Cases[xml, XMLElement["table", ___], \[Infinity]];
data = Flatten[Cases[table, XMLElement["td", _, d_] :> d, \[Infinity]] /. {{} -> "", "New (1)\n" -> "New"}];
Grid[data = Partition[data, 6]]

enter image description here

For simpler data access we can transform this expression into a Dataset, which allow database-like access to its contents. This code loops once through data and organizes it:

dataset = Dataset[Take[DeleteCases[
 Map[
 Which[
   First[#] === "",
   keys = Rest[#];,
   And[First[#] =!= "Deaths", First[#] =!= "Cases"],
   country = First[#];,
   Or[First[#] === "Deaths", First[#] === "Cases"],
   <|"Country" -> StringTrim[country], "Type" -> First[#], 
    Sequence @@ 
     MapThread[Rule, {keys, ToExpression /@ Rest[#]}]|>] &,
 data], Null], {1, -3}]]

enter image description here

We can now access data from this dataset, for example the total cases for Guinea (returns 519):

dataset[SelectFirst[#Country == "Guinea" && #Type == "Cases" &], "Totals"]

Or we can map the totals for all countries using GeoRegionValuePlot:

GeoRegionValuePlot[ 
  Map[Rule[CountryData[#],
    With[{c = #}, dataset[SelectFirst[#Country == c && #Type == "Cases" &], 
  "Totals"]]] &, CountryNames], 
 GeoRange -> Quantity[2000, "Kilometers"], ImageSize -> Large]

enter image description here

I wonder if the time dependence of the spread of a disease can be described by some sort of diffusion equation.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract