epiforecasts / covidregionaldata

An interface to subnational and national level COVID-19 data. For all countries supported, this includes a daily time-series of cases. Wherever available we also provide data on deaths, hospitalisations, and tests. National level data is also supported using a range of data sources as well as linelist data and links to intervention data sets.
https://epiforecasts.io/covidregionaldata/
Other
37 stars 18 forks source link

download issue for UK with `nhsregions=TRUE` #344

Closed joseph-palmer closed 3 years ago

joseph-palmer commented 3 years ago

When I request uk with nhsregions I get an error:

uk <- UK$new(level = "1", verbose = TRUE, nhsregions = TRUE)
uk$download()
Downloading UK data.
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=nation&metric=newCasesBySpecimenDate&metric=cumCasesBySpecimenDate&metric=newCasesByPublishDate&metric=cumCasesByPublishDate&format=csv
Rows: 1,788                                                                                                                                                                                                     
Columns: 8
Delimiter: ","
chr  [3]: areaCode, areaName, areaType
dbl  [4]: cumCasesByPublishDate, cumCasesBySpecimenDate, newCasesByPublishDate, newCasesBySpecimenDate
date [1]: date

Use `spec()` to retrieve the guessed column specification
Pass a specification to the `col_types` argument to quiet this message
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=nation&metric=newDeaths28DaysByPublishDate&metric=cumDeaths28DaysByPublishDate&metric=newDeaths28DaysByDeathDate&metric=cumDeaths28DaysByDeathDate&format=csv
Rows: 1,712                                                                                                                                                                                                     
Columns: 8
Delimiter: ","
chr  [3]: areaCode, areaName, areaType
dbl  [4]: cumDeaths28DaysByDeathDate, cumDeaths28DaysByPublishDate, newDeaths28DaysByDeathDate, newDeaths28DaysByPublishDate
date [1]: date

Use `spec()` to retrieve the guessed column specification
Pass a specification to the `col_types` argument to quiet this message
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=nation&metric=newTestsByPublishDate&metric=cumTestsByPublishDate&metric=newAdmissions&metric=cumAdmissions&format=csv
Rows: 1,711                                                                                                                                                                                                     
Columns: 8
Delimiter: ","
chr  [3]: areaCode, areaName, areaType
dbl  [4]: cumAdmissions, cumTestsByPublishDate, newAdmissions, newTestsByPublishDate
date [1]: date

Use `spec()` to retrieve the guessed column specification
Pass a specification to the `col_types` argument to quiet this message
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=nation&metric=newPillarOneTestsByPublishDate&metric=newPillarTwoTestsByPublishDate&metric=newPillarThreeTestsByPublishDate&metric=newPillarFourTestsByPublishDate&format=csv
Rows: 1,593                                                                                                                                                                                                     
Columns: 8
Delimiter: ","
chr  [3]: areaCode, areaName, areaType
dbl  [3]: newPillarOneTestsByPublishDate, newPillarThreeTestsByPublishDate, newPillarTwoTestsByPublishDate
lgl  [1]: newPillarFourTestsByPublishDate
date [1]: date

Use `spec()` to retrieve the guessed column specification
Pass a specification to the `col_types` argument to quiet this message
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=region&metric=newCasesBySpecimenDate&metric=cumCasesBySpecimenDate&metric=newCasesByPublishDate&metric=cumCasesByPublishDate&format=csv
Rows: 4,044                                                                                                                                                                                                     
Columns: 8
Delimiter: ","
chr  [3]: areaCode, areaName, areaType
dbl  [4]: cumCasesByPublishDate, cumCasesBySpecimenDate, newCasesByPublishDate, newCasesBySpecimenDate
date [1]: date

Use `spec()` to retrieve the guessed column specification
Pass a specification to the `col_types` argument to quiet this message
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=region&metric=newDeaths28DaysByPublishDate&metric=cumDeaths28DaysByPublishDate&metric=newDeaths28DaysByDeathDate&metric=cumDeaths28DaysByDeathDate&format=csv
Rows: 3,891                                                                                                                                                                                                     
Columns: 8
Delimiter: ","
chr  [3]: areaCode, areaName, areaType
dbl  [4]: cumDeaths28DaysByDeathDate, cumDeaths28DaysByPublishDate, newDeaths28DaysByDeathDate, newDeaths28DaysByPublishDate
date [1]: date

Use `spec()` to retrieve the guessed column specification
Pass a specification to the `col_types` argument to quiet this message
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=region&metric=newTestsByPublishDate&metric=cumTestsByPublishDate&metric=newAdmissions&metric=cumAdmissions&format=csv
Downloading data from https://api.coronavirus.data.gov.uk/v2/data?areaType=region&metric=newPillarOneTestsByPublishDate&metric=newPillarTwoTestsByPublishDate&metric=newPillarThreeTestsByPublishDate&metric=newPillarFourTestsByPublishDate&format=csv
Arranging data by NHS region. Also adding new variable:
        hosp_new_first_admissions. This is NHS data for first hospital
        admissions, which excludes readmissions. This is available for
        England and English regions only.
trying URL 'https://www.england.nhs.uk/statistics/wp-content/uploads/sites/2/2021/05/COVID-19-daily-admissions-and-beds-20210512.xlsx'
Content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' length 25301 bytes (24 KB)
==================================================
downloaded 24 KB

Error in download.file(url = url, destfile = archive, mode = "wb", quiet = !(TRUE)) :                                                                                                                           
  'url' must be a length-one character vector

Unsure why this has popped up but surly must be new or nightly checks would have shown them?

Trying to work out the source of the error but thought I would post here first.

seabbs commented 3 years ago

Hmm most odd.

Is this with the CRAN version or the GitHub version. Aside from our tests the Rt pipeline is using admissions without throwing errors (using the CRAN version) so that is strange.

Something to do with dropping the common_data_urls field?