Is there an efficient way to access AdministrativeDivisionData?
The secret is to download the data in bulk and do the mapping via FIPS codes. I just happened to analyze the same data few days ago (took me 82 seconds right now but usually it's faster):
nydata = Dataset[
SemanticImport[
"https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-\
counties.csv",
HeaderLines -> 1], MaxItems -> 10]
Note that SemanticImport
returns FIPS code as integers, not strings, that's why we need to use FromDigits
below. I also did the merge before I learned about JoinAcross, so the last part should be much much simpler - but that's the code I have lying around. Finally, since I was only interested in the latest data, I used MaximalBy
- you would need to modify the code accordingly if you need e.g. time series.
covid = Dataset[Values@Merge[
{Normal@
counties[All, {"FIPSCode" -> FromDigits}][
GroupBy["FIPSCode"]],
Normal@
nydata[GroupBy["fips"],
MaximalBy[#date &], {"cases", "deaths"}]},
Join[First@First@#, First@Last@#] &]][
Select[KeyExistsQ[#, "cases"] && KeyExistsQ[#, "Name"] &]]