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

Use InPhyT data for Italy #464

Open RichardMN opened 2 years ago

RichardMN commented 2 years ago

This currently fails in single class test but seems to work to generate results. It is a straightforward adjustment to use a different data source but (see #463) I think it may be useful to be able to switch between the two options.

RichardMN commented 2 years ago

I'm pushing an update but this mainly reflects changes in the upstream data source (which itself is still a development branch).

I do have the problem that running the tests on the file specifying to test Italy only gives the following output, but that it's hard to reproduce this error when running the code as an instantiated class or when running R-CMD check. Somehow I am not importing .data correctly? I cannot tell what is the difference in context between running it under devtools::load_all(); devtools::test() (with an option set) and running the full test.

Error (test-DataClass.R:179:7): Italy at level 1 can be cleaned as expected
<rlang_error_data_pronoun_not_found/rlang_error/error/condition>
Error in `select(., .data$date, .data$level_1_region, level_1_region_code = .data$code, 
    cases_new = .data$confirmed, deaths_new = .data$deceased, 
    hosp_new = .data$ordinary_hospital_admission, symp_new = .data$symptomatic, 
    icu_new = .data$ICU_admission)`: Column `confirmed` not found in `.data`.
Backtrace:
  1. DataClass_obj$clean()
       at covidregionaldata/R/test-DataClass.R:179:6
 28. rlang:::abort_data_pronoun(x, call = y)

Failure (test-DataClass.R:189:7): Italy at level 1 highlights available regions as expected
`DataClass_obj$available_regions()` threw an unexpected error.
Message: Data must first be cleaned using the clean method
Class:   simpleError/error/condition
Backtrace:
 1. testthat::expect_error(DataClass_obj$available_regions(), NA)
      at covidregionaldata/R/test-DataClass.R:189:6
 7. DataClass_obj$available_regions()

Error (test-DataClass.R:190:7): Italy at level 1 highlights available regions as expected
Error in `DataClass_obj$available_regions()`: Data must first be cleaned using the clean method
Backtrace:
 1. testthat::expect_true(...)
      at covidregionaldata/R/test-DataClass.R:190:6
 5. DataClass_obj$available_regions()

Error (test-DataClass.R:212:7): Italy at level 1 can be processed as expected
Error in `DataClass_obj$process()`: Data must first be cleaned using the clean method
Backtrace:
 1. DataClass_obj$process()
      at covidregionaldata/R/test-DataClass.R:212:6

Error (test-DataClass.R:248:7): Italy at level 1 can be returned as expected
Error in `DataClass_obj$return()`: Data must first be proccessed using the process method
Backtrace:
 1. DataClass_obj$return()
      at covidregionaldata/R/test-DataClass.R:248:6

Error (test-DataClass.R:70:11): Italy at level 1column 'cases_new' is not just composed of NA
Error in `UseMethod("filter")`: no applicable method for 'filter' applied to an object of class "NULL"
Backtrace:
 1. testthat::expect_true(...)
      at covidregionaldata/R/test-DataClass.R:70:10
 6. dplyr::filter(., !is.na("cases_new"))

Error (test-DataClass.R:70:11): Italy at level 1column 'cases_total' is not just composed of NA
Error in `UseMethod("filter")`: no applicable method for 'filter' applied to an object of class "NULL"
Backtrace:
 1. testthat::expect_true(...)
      at covidregionaldata/R/test-DataClass.R:70:10
 6. dplyr::filter(., !is.na("cases_total"))

Error (test-DataClass.R:70:11): Italy at level 1column 'deaths_new' is not just composed of NA
Error in `UseMethod("filter")`: no applicable method for 'filter' applied to an object of class "NULL"
Backtrace:
 1. testthat::expect_true(...)
      at covidregionaldata/R/test-DataClass.R:70:10
 6. dplyr::filter(., !is.na("deaths_new"))

Error (test-DataClass.R:70:11): Italy at level 1column 'deaths_total' is not just composed of NA
Error in `UseMethod("filter")`: no applicable method for 'filter' applied to an object of class "NULL"
Backtrace:
 1. testthat::expect_true(...)
      at covidregionaldata/R/test-DataClass.R:70:10
 6. dplyr::filter(., !is.na("deaths_total"))
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

══ Results ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 9.5 s

[ FAIL 9 | WARN 2 | SKIP 0 | PASS 279 ]
github-actions[bot] commented 2 years ago

This PR has been flagged as stale due to lack of activity

github-actions[bot] commented 2 years ago

This PR has been flagged as stale due to lack of activity