Source
Source
A team of researchers from Spain presented an interactive map: deim.urv.cat/~alephsys/COVID-19/spain/en/. And since their numerical data is freely available to everyone as an excel file I decided to take it a look in a Mathematica notebook. The following is the exploration I made with GeoGraphics using their estimated propagation risk of COVID-19 by local contact in Spain (14 - 18 March).
Importing the raw data
Importing the raw data
In[]:=
path=NotebookDirectory[];
In[]:=
rawdata14t18=Import["https://deim.urv.cat/~alephsys/COVID-19/spain/resources/Risk_Municipio_2020_03_14-18.xlsx"]
Out[]=
In[]:=
dates=rawdata14t18[[1,2,2;;]]
Out[]=
,,,,
Data Curation
Data Curation
Propagation risk time series:
In[]:=
ts1418=ParallelMap[#[[1]]->TimeSeries[#[[2;;6]],{dates}]&,rawdata14t18[[1,3;;]]];
Interpreter[Restricted[“City”,Entity[“Country”,”Spain”]]][“municipality”]
Interpreter[Restricted[“City”,Entity[“Country”,”Spain”]]][“municipality”]
In order to get Wolfram’s city interpreter working properly I removed diacritics and other language variants:
In[]:=
cleanNames1=RemoveDiacritics/@Map[StringRiffle@Reverse[StringSplit[#,", "]]&,Map[StringSplit[#,"/"][[-1]]&,Map[StringReplace[#,"-"" "]&,rawdata14t18[[1,3;;,1]]]]];
In[]:=
cleanNames1
In[]:=
cleanNames2=RemoveDiacritics/@Map[StringRiffle@Reverse[StringSplit[#,", "]]&,Map[StringSplit[#,"/"][[-1]]&,Map[StringSplit[#,"-"][[-1]]&,rawdata14t18[[1,3;;,1]]]]];
In[]:=
cleanNames2
In[]:=
cleanNames3=RemoveDiacritics/@Map[StringSplit[#,"/"][[-1]]&,Map[StringReplace[StringDelete[#,{"O ","Los ","El "," el","La ","L ","Las "," al"," las"," la"," l"," de"," d"," y"," i"}],"-"" "]&,Map[StringRiffle@Reverse[StringSplit[#,", "]]&,rawdata14t18[[1,3;;,1]]]]];
In[]:=
cleanNames3
In[]:=
municipalities=ParallelMap[{#[[1]],interpreted=DeleteDuplicates[Interpreter[Restricted["City",Entity["Country","Spain"]]][DeleteDuplicates[#[[2;;]]]]];Select[interpreted,FailureQ[#]==False&]}&,Transpose[{rawdata14t18[[1,3;;,1]],cleanNames1,cleanNames2,cleanNames3}]]
Out[]=
There is 6551 municipalities with non-ambiguous interpretations:
In[]:=
municipalities1=Flatten/@Select[municipalities,Length[#[[-1]]]1&]
And 43 municipalities with more than one possible interpretation that need hand curation:
In[]:=
Select[municipalities,Length[#[[-1]]]>1&]
In[]:=
municipalities2="Rozas de Madrid, Las",,"Valencia de las Torres",,"Arcos, Los",,"Uharte-Arakil",,"Herrera, La",,"Fuente-Álamo",,"Corral-Rubio",,"Santos, Los",,"Granada, La",,"Font-rubí",,"Serrada, La",,"Cerro, El",,"Zarza, La",,"Vélez-Málaga",,"Peñarroya-Pueblonuevo",,"Valls dAguilar, Les",,"Serna, La",,"Fuente-Olmedo",,"Majadas, Las",,"Antigua, La",,"San Pedro de la Nave-Almendra",,"Calahorra, La",,"Oliva, La",,"Foz-Calanda",,"Alamedilla, La",,"Galera, La",,"Grado, El",,"Vélez-Rubio",,"Robleda-Cervantes",,"Zarza, La",,"Zarza-Capilla",,"Marines, Los",,"Valde-Ucieza",,"Torre, La",,"Cuervo, El",,"Saceda-Trasierra",,"Atalaya, La",,"Azanuy-Alins",,"Figuera, La",,"Frontera, La",,"Garganta, La",,"Olmos, Los",,"Villa del Campo",
Despite this effort about 12% of these municipalities were not interpreted at all :
In[]:=
Length@Select[municipalities,Length[#[[-1]]]==0&]
Out[]=
562
In[]:=
Select[municipalities,Length[#[[-1]]]==0&][[All,1]]
Curated Dataset
Curated Dataset
In[]:=
dataset14t18=Dataset[Map[<|"Municipality"->#[[-1]],"Propagation"->#[[1]]/.ts1418|>&,Join[municipalities1,municipalities2]]]
In[]:=
dataset14t18=Import[path<>"dataset14t18.m"]
Out[]=
Data Visualization
Data Visualization
Iberian Peninsula
Iberian Peninsula
Estimated propagation risk of COVID-19 by local contact in Spain for Wed 18:
Estimated propagation risk of COVID-19 by local contact in Spain for Wed 18:
Evolution for the past four days:
Canary Islands
Canary Islands
