covid19datahub / COVID19

A worldwide epidemiological database for COVID-19 at fine-grained spatial resolution
https://covid19datahub.io
GNU General Public License v3.0
251 stars 93 forks source link

Solution to everchanging Apple Mobility url #184

Closed heinonmatti closed 2 years ago

heinonmatti commented 2 years ago

Hi,

A friend of mine reverse engineered Apple's javascript bundle, and jameshtwose translated the code to R.

It should figure out the csv filename automatically, so you don't have to look for it every time. I'm just a noob, but maybe this could be integrated to the package so that it works seamlessly?

Function here: https://github.com/jameshtwose/Data-Science/blob/master/Backend/apple_mobility_data.R Documentation in Rd: https://github.com/jameshtwose/Data-Science/blob/master/Backend/apple_mobility_data_help.Rd Documentation in html: https://github.com/jameshtwose/Data-Science/blob/master/Backend/apple_mobility_data_help.html

eguidotti commented 2 years ago

Hi @heinonmatti, thanks for this nice idea! I'd like to avoid extra dependencies (httr), so I edited the function and pushed a commit here: https://github.com/covid19datahub/R/commit/3cea6796d4f7fb7a39401a21c9ea8684d8901336

You can already try it out with:

devtools::install_github("covid19datahub/R")
library(COVID19)
x <- covid19(amr = TRUE)

This should work. If things are stable in the next few days, I'll update the version on CRAN

eguidotti commented 2 years ago

On its way to CRAN. Thanks!