diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a66ad0aa..75442281 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -38,7 +38,8 @@ RUN install2.r --error --skipinstalled --repos ${CRAN} --ncpus -1 \ RUN apt-get update \ && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends libgdal-dev \ - libudunits2-dev libharfbuzz-dev libfribidi-dev + libudunits2-dev libharfbuzz-dev libfribidi-dev \ + libjq-dev libprotobuf-dev # install dependencies COPY DESCRIPTION /tmp/package/DESCRIPTION diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e2a87fc7..f4c1f7db 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,9 @@ "extensions": [ "ikuyadeu.r", "reditorsupport.r-lsp", - "shan.code-settings-sync" + "shan.code-settings-sync", + "searking.preview-vscode", + "tht13.html-preview-vscode" ], // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.github/workflows/Vietnam.yaml b/.github/workflows/Vietnam.yaml new file mode 100644 index 00000000..1425587e --- /dev/null +++ b/.github/workflows/Vietnam.yaml @@ -0,0 +1,48 @@ +on: + schedule: + - cron: '36 12 * * *' + workflow_dispatch: + +name: Vietnam + +jobs: + Vietnam: + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Cache R packages + uses: actions/cache@v2 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install dependencies + run: | + install.packages(c("remotes")) + remotes::install_deps(dependencies = TRUE) + install.packages("devtools") + shell: Rscript {0} + + - name: Install package + run: R CMD INSTALL . + + - name: Test dataset + run: | + options("testDownload" = TRUE) + options("testSource" = "Vietnam") + devtools::load_all() + testthat::test_file("tests/testthat/test-regional-datasets.R", reporter = c("summary", "fail")) + shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION index 61168eb0..20e44186 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: covidregionaldata Title: Subnational Data for COVID-19 Epidemiology -Version: 0.9.2.2000 +Version: 0.9.2.3000 Authors@R: c(person(given = "Joseph", family = "Palmer", @@ -55,6 +55,10 @@ Authors@R: family = "Gruson", role = "ctb", comment = c(ORCID = "0000-0002-4094-1476")), + person(given = "Vang", + family = "Le", + role = "ctb", + comment = c(URL = "https://github.com/biocyberman")), person(given = "Sebastian", family = "Funk", role = "aut", @@ -86,6 +90,7 @@ Imports: countrycode (>= 1.2.0), dplyr, httr, + jsonlite, lifecycle, lubridate, magrittr, @@ -94,6 +99,7 @@ Imports: R6, readxl, rlang, + stringi, stringr, tibble, tidyr (>= 1.0.0), diff --git a/NAMESPACE b/NAMESPACE index 00588964..5cdf4ccd 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -25,6 +25,7 @@ export(SouthAfrica) export(Switzerland) export(UK) export(USA) +export(Vietnam) export(WHO) export(expect_clean_cols) export(expect_columns_contain_data) @@ -48,6 +49,7 @@ importFrom(countrycode,countryname) importFrom(dplyr,"%>%") importFrom(dplyr,across) importFrom(dplyr,arrange) +importFrom(dplyr,as_tibble) importFrom(dplyr,bind_rows) importFrom(dplyr,count) importFrom(dplyr,distinct) @@ -74,6 +76,7 @@ importFrom(dplyr,slice_tail) importFrom(dplyr,starts_with) importFrom(dplyr,summarise) importFrom(dplyr,tally) +importFrom(dplyr,tibble) importFrom(dplyr,transmute) importFrom(dplyr,ungroup) importFrom(dplyr,vars) @@ -81,6 +84,7 @@ importFrom(httr,GET) importFrom(httr,POST) importFrom(httr,content) importFrom(httr,status_code) +importFrom(jsonlite,fromJSON) importFrom(lifecycle,deprecate_warn) importFrom(lifecycle,deprecated) importFrom(lifecycle,is_present) @@ -109,6 +113,9 @@ importFrom(rlang,"!!") importFrom(rlang,":=") importFrom(rlang,.data) importFrom(rlang,syms) +importFrom(stringi,stri_replace_all) +importFrom(stringi,stri_trans_general) +importFrom(stringi,stri_trim_both) importFrom(stringr,str_detect) importFrom(stringr,str_replace_all) importFrom(stringr,str_to_sentence) @@ -125,6 +132,7 @@ importFrom(tidyr,nesting) importFrom(tidyr,pivot_longer) importFrom(tidyr,pivot_wider) importFrom(tidyr,replace_na) +importFrom(tidyr,separate) importFrom(tidyselect,all_of) importFrom(tidyselect,ends_with) importFrom(tidyselect,starts_with) diff --git a/NEWS.md b/NEWS.md index 38acad4c..27fe3285 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,11 +4,12 @@ This release is currrently under development ## New data sets -- Support for level 1 region data in Estonia (thanks to @RichardMN). See `?Estonia` for details. +- Support for level 1 region data in Estonia (thanks to @RichardMN). See `?Estonia` for details. +- Support for level 1 region data in Vietnam (thanks to @biocyberman). See `?Vietname` for details. # covidregionaldata 0.9.2 -This release adds support for the Covid19 Data Hub which includes Google and Apple mobility data amongst a large range of other data sets, data from the European Commission's Joint Research Centre which is at both the regional and national level, and individual sources for regional data from several countries. Package updates have been made in line with a software review at the [Journal of Open Source Software](https://github.com/openjournals/joss-reviews/issues/3290). Finally, this release exposes more of the testing infrastructure to users and adds a package hexsticker. +This release adds support for the Covid19 Data Hub which includes Google and Apple mobility data amongst a large range of other data sets, data from the European Commission's Joint Research Centre which is at both the regional and national level, and individual sources for regional data from several countries. Package updates have been made in line with a software review at the [Journal of Open Source Software](https://github.com/openjournals/joss-reviews/issues/3290). Finally, this release exposes more of the testing infrastructure to users and adds a package hexsticker. Thanks to @joseph-palmer, @RichardMN, and @kathsherratt for contributions towards this release. diff --git a/R/Vietnam.R b/R/Vietnam.R new file mode 100644 index 00000000..ebc35abb --- /dev/null +++ b/R/Vietnam.R @@ -0,0 +1,137 @@ +#' Vietnam Class for downloading, cleaning and processing +#' notification data +#' +#' @description Information for downloading, cleaning +#' and processing covid-19 region data for Vietnam. +#' +#' @source \url{https://covid.ncsc.gov.vn} +#' @export +#' @concept dataset +#' @family subnational +#' @examples +#' \dontrun{ +#' region <- Vietnam$new(verbose = TRUE, steps = TRUE, get = TRUE) +#' region$return() +#' } +Vietnam <- R6::R6Class("Vietnam", + inherit = DataClass, + public = list( + + # Core Attributes (amend each parameter for country specific information) + #' @field origin name of country to fetch data for + origin = "Vietnam", + #' @field supported_levels List of supported levels. + supported_levels = list("1"), + #' @field supported_region_names List of region names in order of level. + supported_region_names = list("1" = "region"), + #' @field supported_region_codes List of region codes in order of level. + supported_region_codes = list("1" = "iso_3166_2"), + #' @field common_data_urls List of named links to raw data. + common_data_urls = list( + # nolint start + "case_by_time" = "https://covid.ncsc.gov.vn/api/v3/covid/provinces?filter_type=case_by_time", + "death_by_time" = "https://covid.ncsc.gov.vn/api/v3/covid/provinces?filter_type=death_by_time", + "recovered_by_time" = "https://covid.ncsc.gov.vn/api/v3/covid/provinces?filter_type=recovered_by_time", + "provinces" = "https://covid.ncsc.gov.vn/api/v3/covid/provinces" + # nolint end + ), + #' @field source_data_cols existing columns within the raw data + source_data_cols = c( + "cases_total", "deaths_total", "recovered_total" + ), + #' @field source_text Plain text description of the source of the data + source_text = + "Public COVID-19 for Vietnam, curated by NCSC's COVID-19 team", + #' @field source_url Website address for explanation/introduction of the + #' data + source_url = "https://covid.ncsc.gov.vn", + + #' @description Set up a table of region codes for clean data + #' @importFrom tibble tibble + set_region_codes = function() { + self$codes_lookup$`1` <- covidregionaldata::vietnam_codes + }, + + #' @description Download function to get raw data. Uses the + #' parent class JSON-specific method for downloads. + download = function() { + super$download_JSON() + }, + + #' @description Provincial Level Data + #' cleaning + #' @param ... pass additional arguments + #' + #' @importFrom dplyr filter select mutate rename tibble as_tibble full_join + #' @importFrom tidyr replace_na drop_na separate + #' @importFrom purrr map + #' @importFrom stringi stri_trans_general stri_trim_both stri_replace_all + #' @importFrom stringr str_to_title str_replace_all + #' @importFrom lubridate dmy + clean_common = function() { + # The first three elements of self$data$raw are the data + # tables downloaded and so these can be processed identically + # + data_inputs <- self$data$raw[1:3] + flat_all <- map( + map( + data_inputs, + function(x) as_tibble(unlist(x), + rownames = "date")), + function(y) { + y %>% separate(date, sep = "[.]+", into = c(NA, "province", "date")) + } + ) + self$data$clean <- full_join( + full_join( + flat_all$case_by_time, flat_all$death_by_time, + by = c("province", "date"), + suffix = c(".cases", ".deaths"), + copy = TRUE + ), + flat_all$recovered_by_time, + by = c("province", "date"), + suffix = c("", ".recovered"), + copy = TRUE + ) %>% + # The api uses integer codes for provinces which do not + # line up with ISO 3166-2 (some of which are not numbers) + # so we use this as a temporary code to line names up + # with data. + select( + ncsc_region_code = province, + date, + cases_total = value.cases, + deaths_total = value.deaths, + recovered_total = value) %>% + mutate(ncsc_region_code = as.numeric(ncsc_region_code)) %>% + left_join( + self$data$raw$provinces %>% + select(ncsc_region_code = id, level_1_region = name), + by = c("ncsc_region_code")) %>% + select(-ncsc_region_code) %>% + mutate( + date = dmy(date), + cases_total = as.numeric(cases_total), + deaths_total = as.numeric(deaths_total), + recovered_total = as.numeric(recovered_total), + level_1_region = str_replace_all(level_1_region, + "TP HCM", "Hochiminh"), + ) %>% + # + #tidyr::drop_na(date, region_name) %>% + mutate( + level_1_region = stri_trans_general(level_1_region, "latin-ascii"), + level_1_region = stri_trim_both(level_1_region), + level_1_region = str_replace_all(level_1_region, + "\\(.*\\)|-| ", ""), + level_1_region = str_to_title(level_1_region), + level_1_region = replace_na(level_1_region, "Unknown") + ) %>% + left_join( + self$codes_lookup$`1`, + by = c("level_1_region" = "level_1_region") + ) + } + ) +) diff --git a/R/datasets.R b/R/datasets.R index efd04202..3c1ad8a2 100644 --- a/R/datasets.R +++ b/R/datasets.R @@ -33,6 +33,12 @@ #' @return A tibble of region codes and related information. "france_codes" +#' Region Codes for Vietnam Dataset. +#' +#' @description The region codes for Viet Nam +#' @return A tibble of region codes and related information. +"vietnam_codes" + #' Region Codes for JHU Dataset. Taken from the region codes provided as #' part of the WHO dataset. #' diff --git a/R/shared-methods.R b/R/shared-methods.R index bd7eff52..3b413380 100644 --- a/R/shared-methods.R +++ b/R/shared-methods.R @@ -302,6 +302,20 @@ DataClass <- R6::R6Class( ) }, + #' @description Download raw data from `data_urls`, stores a named list + #' of the `data_url` name and the corresponding raw data table in + #' `data$raw`. Designed as a drop-in replacement for `download` so + #' it can be used in sub-classes. + #' @importFrom purrr map + download_JSON = function() { + if (length(self$data_urls) == 0) { + stop("No data to download as data_urls is empty") + } + self$data$raw <- map(self$data_urls, json_reader, + verbose = self$verbose + ) + }, + #' @description Cleans raw data (corrects format, converts column types, #' etc). Works on raw data and so should be called after #' \href{#method-download}{\code{download()}} diff --git a/R/test-DataClass.R b/R/test-DataClass.R index 4349124b..e6f7f2fd 100644 --- a/R/test-DataClass.R +++ b/R/test-DataClass.R @@ -102,7 +102,8 @@ test_download <- function(DataClass_obj, download, snapshot_path) { walk(DataClass_obj$data$raw, function(data) { testthat::expect_s3_class(data, "data.frame") testthat::expect_true(nrow(data) > 0) - testthat::expect_true(ncol(data) >= 2) + testthat::expect_true(ncol(data) >= 2 + || typeof(data[[1]]) == "list") }) } ) diff --git a/R/utils.R b/R/utils.R index 276f6613..da992a3d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -53,6 +53,30 @@ csv_reader <- function(file, verbose = FALSE, guess_max = 1000, ...) { return(tibble(data)) } +#' Custom JSON reading function +#' +#' @description Checks for use of memoise and then uses vroom::vroom. +#' @param file A URL or filepath to a JSON +#' @param ... extra parameters to be passed to jsonlite::fromJSON +#' @inheritParams message_verbose +#' @return A data table +#' @importFrom tibble tibble +#' @importFrom jsonlite fromJSON +#' @concept utility +json_reader <- function(file, verbose = FALSE, ...) { + if (verbose) { + message("Downloading data from ", file) + data <- fromJSON(file, ...) + } else { + data <- suppressWarnings( + suppressMessages( + fromJSON(file, ...) + ) + ) + } + return(tibble(data)) +} + #' Wrapper for message #' #' @description A wrapper for `message` that only prints output when diff --git a/README.md b/README.md index b1700d62..b452cac6 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ the temporary directory by default), ``` r start_using_memoise() -#> Using a cache at: /tmp/RtmprTOAdV +#> Using a cache at: /tmp/RtmpPgZXiv ``` To stop using `memoise` use, @@ -105,7 +105,7 @@ the Google COVID-19 open data project), use: ``` r nots <- get_national_data() #> Downloading data from https://covid19.who.int/WHO-COVID-19-global-data.csv -#> Rows: 132483 Columns: 8 +#> Rows: 142911 Columns: 8 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: "," #> chr (3): Country_code, Country, WHO_region @@ -117,20 +117,20 @@ nots <- get_national_data() #> Cleaning data #> Processing data nots -#> # A tibble: 132,483 x 15 -#> date un_region who_region country iso_code cases_new cases_total -#> -#> 1 2020-01-03 Asia EMRO Afghanistan AF 0 0 -#> 2 2020-01-03 Europe EURO Albania AL 0 0 -#> 3 2020-01-03 Africa AFRO Algeria DZ 0 0 -#> 4 2020-01-03 Oceania WPRO American Samoa AS 0 0 -#> 5 2020-01-03 Europe EURO Andorra AD 0 0 -#> 6 2020-01-03 Africa AFRO Angola AO 0 0 -#> 7 2020-01-03 Americas AMRO Anguilla AI 0 0 -#> 8 2020-01-03 Americas AMRO Antigua & Bar… AG 0 0 -#> 9 2020-01-03 Americas AMRO Argentina AR 0 0 -#> 10 2020-01-03 Asia EURO Armenia AM 0 0 -#> # … with 132,473 more rows, and 8 more variables: deaths_new , +#> # A tibble: 142,911 × 15 +#> date un_region who_region country iso_code cases_new cases_total +#> +#> 1 2020-01-03 Asia EMRO Afghanistan AF 0 0 +#> 2 2020-01-03 Europe EURO Albania AL 0 0 +#> 3 2020-01-03 Africa AFRO Algeria DZ 0 0 +#> 4 2020-01-03 Oceania WPRO American Samoa AS 0 0 +#> 5 2020-01-03 Europe EURO Andorra AD 0 0 +#> 6 2020-01-03 Africa AFRO Angola AO 0 0 +#> 7 2020-01-03 Americas AMRO Anguilla AI 0 0 +#> 8 2020-01-03 Americas AMRO Antigua & Barbuda AG 0 0 +#> 9 2020-01-03 Americas AMRO Argentina AR 0 0 +#> 10 2020-01-03 Asia EURO Armenia AM 0 0 +#> # … with 142,901 more rows, and 8 more variables: deaths_new , #> # deaths_total , recovered_new , recovered_total , #> # hosp_new , hosp_total , tested_new , tested_total ``` @@ -171,7 +171,7 @@ for example by level 1 region in the UK, use: ``` r uk_nots <- get_regional_data(country = "UK", verbose = FALSE) uk_nots -#> # A tibble: 6,916 x 26 +#> # A tibble: 7,501 × 26 #> date region region_code cases_new cases_total deaths_new deaths_total #> #> 1 2020-01-30 East Mi… E12000004 NA NA NA NA @@ -184,16 +184,13 @@ uk_nots #> 8 2020-01-30 Scotland S92000003 NA NA NA NA #> 9 2020-01-30 South E… E12000008 NA NA NA NA #> 10 2020-01-30 South W… E12000009 NA NA NA NA -#> # … with 6,906 more rows, and 19 more variables: recovered_new , +#> # … with 7,491 more rows, and 19 more variables: recovered_new , #> # recovered_total , hosp_new , hosp_total , tested_new , #> # tested_total , areaType , cumCasesByPublishDate , #> # cumCasesBySpecimenDate , newCasesByPublishDate , #> # newCasesBySpecimenDate , cumDeaths28DaysByDeathDate , #> # cumDeaths28DaysByPublishDate , newDeaths28DaysByDeathDate , -#> # newDeaths28DaysByPublishDate , newPillarFourTestsByPublishDate , -#> # newPillarOneTestsByPublishDate , -#> # newPillarThreeTestsByPublishDate , -#> # newPillarTwoTestsByPublishDate +#> # newDeaths28DaysByPublishDate , … ``` Now we have the data we can create plots, for example the time-series of diff --git a/data-raw/vietnam_codes.R b/data-raw/vietnam_codes.R new file mode 100644 index 00000000..bdba31fc --- /dev/null +++ b/data-raw/vietnam_codes.R @@ -0,0 +1,33 @@ +# Set vietnam region codes +# +# Level 1 codes: ISO-3166-2 +# Source: https://en.wikipedia.org/wiki/ISO_3166-2:VN +# +library(rvest) +library(stringi) +library(stringr) +library(dplyr) +library(tibble) + +# Level 1 ----------------------------------------------------------------- +# Get ISO codes +vn_iso <- "https://en.wikipedia.org/wiki/ISO_3166-2:VN" + +level_1_region_df <- read_html(vn_iso) %>% + html_element(css="table.wikitable:nth-child(11)") %>% + html_table() + +vietnam_codes <- data.frame( + level_1_region_code = level_1_region_df$Code, + level_1_region = level_1_region_df$`Subdivision name (vi)`, + stringsAsFactors = FALSE +) %>% + mutate( + level_1_region = stri_trans_general(level_1_region, "latin-ascii"), + level_1_region = stri_trim_both(level_1_region), + level_1_region = str_replace_all(level_1_region, '\\(.*\\)|-| ', ''), + level_1_region = str_to_title(level_1_region) + ) + +# update package region_codes +usethis::use_data(vietnam_codes, overwrite = TRUE) diff --git a/data/all_country_data.rda b/data/all_country_data.rda index cf06d6ea..d89f20b7 100644 Binary files a/data/all_country_data.rda and b/data/all_country_data.rda differ diff --git a/data/vietnam_codes.rda b/data/vietnam_codes.rda new file mode 100644 index 00000000..f13d7abd Binary files /dev/null and b/data/vietnam_codes.rda differ diff --git a/inst/WORDLIST b/inst/WORDLIST index 832cbb0e..e3fb521e 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,105 +1,174 @@ +abbott ac ACAPS afghanistan api APL apskritis +aut BB BBSRC +bevan +biocyberman +BugReports Bundesland +campbell cloneable CMD CMMID Codecov com +Config conuntry Cota countries’ +countrycode CoV covid Covid COVID +covidregionaldata +cre CSSE +ctb +currrently DataClass datahub dd DD documentaion doi +dplyr ec ECDC +epiforecasts Estados etc filepath +flavio +Flavio fns +fromJSON +gb geocode geocoding +ggplot +ggspatial github Github GoogleData +Gruson Guidotti +hellewell +Hellewell hexsticker +httr ICD inegi INEGI Inf initalize Initalize +io IPC iso JHU +joe +joel +jonnie +Jonnie jrc JRC +jsonlite jure +katharine +knitr Kreise Landkreis +LazyData +lifecycle linelist Linelist linelists +lshtm ltla +lubridate magrittr md +Meakin +meaking Meixco memoise metacran +msf MX +Nam nhs nhsregions nr OpenDataZH +ORCID org OSP params +patrick +paul paulcampbell PHE +pkgdown PRs +purrr quickstart +rboyes rds +readxl recomended regioni reparameterise +rhul +RichardMN +rlang +rmarkdown +Roxygen +RoxygenNote +rvest RVIM +rworldmap +sam SARS savivaldybe SciELOPreprints +sebastian seperate shapefiles +sherratt +Sherratt +sophie SouthAfrica spi st +stringi +stringr subnationaldata subnationally supertracker +tessella testthat tibble tibbles +tidyr +tidyselect UCPM uk urls useMemoise +usethis utla +Vang +VignetteBuilder Wellcome wikipedia +withr yaml yyyy YYYY diff --git a/man/Belgium.Rd b/man/Belgium.Rd index d552ff29..9e084058 100644 --- a/man/Belgium.Rd +++ b/man/Belgium.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -89,6 +90,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean_common}{\code{covidregionaldata::DataClass$clean_common()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Brazil.Rd b/man/Brazil.Rd index 81c461f4..3962eec0 100644 --- a/man/Brazil.Rd +++ b/man/Brazil.Rd @@ -39,7 +39,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -85,6 +86,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Canada.Rd b/man/Canada.Rd index 52ef95fd..097a3b09 100644 --- a/man/Canada.Rd +++ b/man/Canada.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -80,6 +81,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Colombia.Rd b/man/Colombia.Rd index 50065b17..d1f88abb 100644 --- a/man/Colombia.Rd +++ b/man/Colombia.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -79,6 +80,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/CountryDataClass.Rd b/man/CountryDataClass.Rd index f6b5ae67..3c4bc56a 100644 --- a/man/CountryDataClass.Rd +++ b/man/CountryDataClass.Rd @@ -46,6 +46,7 @@ Defaults to the country level of the data.} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean_common}{\code{covidregionaldata::DataClass$clean_common()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/Covid19DataHub.Rd b/man/Covid19DataHub.Rd index 5489abae..2bcbe269 100644 --- a/man/Covid19DataHub.Rd +++ b/man/Covid19DataHub.Rd @@ -90,7 +90,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{aggregations} \concept{dataset} @@ -135,6 +136,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/Cuba.Rd b/man/Cuba.Rd index fc8d32f4..44ff9bec 100644 --- a/man/Cuba.Rd +++ b/man/Cuba.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -79,6 +80,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/DataClass.Rd b/man/DataClass.Rd index 191071a1..7fa7793b 100644 --- a/man/DataClass.Rd +++ b/man/DataClass.Rd @@ -104,6 +104,7 @@ Defaults to the target level.} \item \href{#method-set_region_codes}{\code{DataClass$set_region_codes()}} \item \href{#method-new}{\code{DataClass$new()}} \item \href{#method-download}{\code{DataClass$download()}} +\item \href{#method-download_JSON}{\code{DataClass$download_JSON()}} \item \href{#method-clean}{\code{DataClass$clean()}} \item \href{#method-clean_common}{\code{DataClass$clean_common()}} \item \href{#method-available_regions}{\code{DataClass$available_regions()}} @@ -203,6 +204,19 @@ of the \code{data_url} name and the corresponding raw data table in \if{html}{\out{
}}\preformatted{DataClass$download()}\if{html}{\out{
}} } +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-download_JSON}{}}} +\subsection{Method \code{download_JSON()}}{ +Download raw data from \code{data_urls}, stores a named list +of the \code{data_url} name and the corresponding raw data table in +\code{data$raw}. Designed as a drop-in replacement for \code{download} so +it can be used in sub-classes. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{DataClass$download_JSON()}\if{html}{\out{
}} +} + } \if{html}{\out{
}} \if{html}{\out{}} diff --git a/man/ECDC.Rd b/man/ECDC.Rd index 7b501efb..d7cc9bcb 100644 --- a/man/ECDC.Rd +++ b/man/ECDC.Rd @@ -69,6 +69,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/Estonia.Rd b/man/Estonia.Rd index 5c29e1f1..b7a5f9c1 100644 --- a/man/Estonia.Rd +++ b/man/Estonia.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -79,6 +80,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/France.Rd b/man/France.Rd index 0d4f92f6..e3c42fbc 100644 --- a/man/France.Rd +++ b/man/France.Rd @@ -40,7 +40,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -86,6 +87,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean_common}{\code{covidregionaldata::DataClass$clean_common()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Germany.Rd b/man/Germany.Rd index f48b50fe..22fe8291 100644 --- a/man/Germany.Rd +++ b/man/Germany.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -82,6 +83,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Google.Rd b/man/Google.Rd index d47fe1dd..675cdcf7 100644 --- a/man/Google.Rd +++ b/man/Google.Rd @@ -80,7 +80,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{aggregations} \concept{dataset} @@ -127,6 +128,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-return}{\code{covidregionaldata::DataClass$return()}}\out{} diff --git a/man/India.Rd b/man/India.Rd index 1d19917d..42646f92 100644 --- a/man/India.Rd +++ b/man/India.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -80,6 +81,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Italy.Rd b/man/Italy.Rd index 666199f9..22310f27 100644 --- a/man/Italy.Rd +++ b/man/Italy.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -80,6 +81,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/JHU.Rd b/man/JHU.Rd index db8db1e8..7ec8e5fe 100644 --- a/man/JHU.Rd +++ b/man/JHU.Rd @@ -84,7 +84,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{aggregations} \concept{dataset} @@ -131,6 +132,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/JRC.Rd b/man/JRC.Rd index 50cdcac7..19073ba5 100644 --- a/man/JRC.Rd +++ b/man/JRC.Rd @@ -82,6 +82,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/Lithuania.Rd b/man/Lithuania.Rd index 3e982180..80c356a2 100644 --- a/man/Lithuania.Rd +++ b/man/Lithuania.Rd @@ -150,7 +150,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -207,6 +208,7 @@ by OSP} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/Mexico.Rd b/man/Mexico.Rd index 7174e346..967f1bea 100644 --- a/man/Mexico.Rd +++ b/man/Mexico.Rd @@ -46,7 +46,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -94,6 +95,7 @@ data} \itemize{ \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Netherlands.Rd b/man/Netherlands.Rd index ab3c0bf9..5f39d0e5 100644 --- a/man/Netherlands.Rd +++ b/man/Netherlands.Rd @@ -40,7 +40,8 @@ Subnational data sources \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -85,6 +86,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/SouthAfrica.Rd b/man/SouthAfrica.Rd index e2c281dd..10bd8161 100644 --- a/man/SouthAfrica.Rd +++ b/man/SouthAfrica.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{Netherlands}}, \code{\link{Switzerland}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -79,6 +80,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Switzerland.Rd b/man/Switzerland.Rd index 3fcdd39f..c5ab1201 100644 --- a/man/Switzerland.Rd +++ b/man/Switzerland.Rd @@ -61,7 +61,8 @@ Subnational data sources \code{\link{Netherlands}}, \code{\link{SouthAfrica}}, \code{\link{UK}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -104,6 +105,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/UK.Rd b/man/UK.Rd index c2f45c4a..bf9182ce 100644 --- a/man/UK.Rd +++ b/man/UK.Rd @@ -83,7 +83,8 @@ Subnational data sources \code{\link{Netherlands}}, \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, -\code{\link{USA}} +\code{\link{USA}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -148,6 +149,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean_common}{\code{covidregionaldata::DataClass$clean_common()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/USA.Rd b/man/USA.Rd index 13e5364e..ae520e65 100644 --- a/man/USA.Rd +++ b/man/USA.Rd @@ -36,7 +36,8 @@ Subnational data sources \code{\link{Netherlands}}, \code{\link{SouthAfrica}}, \code{\link{Switzerland}}, -\code{\link{UK}} +\code{\link{UK}}, +\code{\link{Vietnam}} } \concept{dataset} \concept{subnational} @@ -82,6 +83,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean_common}{\code{covidregionaldata::DataClass$clean_common()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} diff --git a/man/Vietnam.Rd b/man/Vietnam.Rd new file mode 100644 index 00000000..c273aa71 --- /dev/null +++ b/man/Vietnam.Rd @@ -0,0 +1,151 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Vietnam.R +\name{Vietnam} +\alias{Vietnam} +\title{Vietnam Class for downloading, cleaning and processing +notification data} +\source{ +\url{https://covid.ncsc.gov.vn} +} +\description{ +Information for downloading, cleaning +and processing covid-19 region data for Vietnam. +} +\examples{ +\dontrun{ +region <- Vietnam$new(verbose = TRUE, steps = TRUE, get = TRUE) +region$return() +} +} +\seealso{ +Subnational data sources +\code{\link{Belgium}}, +\code{\link{Brazil}}, +\code{\link{Canada}}, +\code{\link{Colombia}}, +\code{\link{Covid19DataHub}}, +\code{\link{Cuba}}, +\code{\link{Estonia}}, +\code{\link{France}}, +\code{\link{Germany}}, +\code{\link{Google}}, +\code{\link{India}}, +\code{\link{Italy}}, +\code{\link{JHU}}, +\code{\link{Lithuania}}, +\code{\link{Mexico}}, +\code{\link{Netherlands}}, +\code{\link{SouthAfrica}}, +\code{\link{Switzerland}}, +\code{\link{UK}}, +\code{\link{USA}} +} +\concept{dataset} +\concept{subnational} +\section{Super class}{ +\code{\link[covidregionaldata:DataClass]{covidregionaldata::DataClass}} -> \code{Vietnam} +} +\section{Public fields}{ +\if{html}{\out{
}} +\describe{ +\item{\code{origin}}{name of country to fetch data for} + +\item{\code{supported_levels}}{List of supported levels.} + +\item{\code{supported_region_names}}{List of region names in order of level.} + +\item{\code{supported_region_codes}}{List of region codes in order of level.} + +\item{\code{common_data_urls}}{List of named links to raw data.} + +\item{\code{source_data_cols}}{existing columns within the raw data} + +\item{\code{source_text}}{Plain text description of the source of the data} + +\item{\code{source_url}}{Website address for explanation/introduction of the +data} +} +\if{html}{\out{
}} +} +\section{Methods}{ +\subsection{Public methods}{ +\itemize{ +\item \href{#method-set_region_codes}{\code{Vietnam$set_region_codes()}} +\item \href{#method-download}{\code{Vietnam$download()}} +\item \href{#method-clean_common}{\code{Vietnam$clean_common()}} +\item \href{#method-clone}{\code{Vietnam$clone()}} +} +} +\if{html}{ +\out{
Inherited methods} +\itemize{ +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-return}{\code{covidregionaldata::DataClass$return()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-summary}{\code{covidregionaldata::DataClass$summary()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-test}{\code{covidregionaldata::DataClass$test()}}\out{} +} +\out{
} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-set_region_codes}{}}} +\subsection{Method \code{set_region_codes()}}{ +Set up a table of region codes for clean data +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Vietnam$set_region_codes()}\if{html}{\out{
}} +} + +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-download}{}}} +\subsection{Method \code{download()}}{ +Download function to get raw data. Uses the +parent class JSON-specific method for downloads. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Vietnam$download()}\if{html}{\out{
}} +} + +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-clean_common}{}}} +\subsection{Method \code{clean_common()}}{ +Provincial Level Data +cleaning +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Vietnam$clean_common()}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{...}}{pass additional arguments} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-clone}{}}} +\subsection{Method \code{clone()}}{ +The objects of this class are cloneable with this method. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Vietnam$clone(deep = FALSE)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{deep}}{Whether to make a deep clone.} +} +\if{html}{\out{
}} +} +} +} diff --git a/man/WHO.Rd b/man/WHO.Rd index 6cc63911..6f34e2b3 100644 --- a/man/WHO.Rd +++ b/man/WHO.Rd @@ -68,6 +68,7 @@ data} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} +\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-initialize}{\code{covidregionaldata::DataClass$initialize()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-process}{\code{covidregionaldata::DataClass$process()}}\out{} diff --git a/man/all_country_data.Rd b/man/all_country_data.Rd index 052c4727..b81bf36f 100644 --- a/man/all_country_data.Rd +++ b/man/all_country_data.Rd @@ -6,7 +6,7 @@ \title{Table of available datasets along with level and other information. Rendered from the individual R6 class objects included in this package.} \format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 23 rows and 10 columns. +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 24 rows and 10 columns. } \usage{ all_country_data diff --git a/man/figures/README-g7_plot-1.png b/man/figures/README-g7_plot-1.png index 51e78de4..75fa7c69 100644 Binary files a/man/figures/README-g7_plot-1.png and b/man/figures/README-g7_plot-1.png differ diff --git a/man/figures/README-uk_plot-1.png b/man/figures/README-uk_plot-1.png index 7f0f3d83..8a19f88a 100644 Binary files a/man/figures/README-uk_plot-1.png and b/man/figures/README-uk_plot-1.png differ diff --git a/man/json_reader.Rd b/man/json_reader.Rd new file mode 100644 index 00000000..6081d976 --- /dev/null +++ b/man/json_reader.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{json_reader} +\alias{json_reader} +\title{Custom JSON reading function} +\usage{ +json_reader(file, verbose = FALSE, ...) +} +\arguments{ +\item{file}{A URL or filepath to a JSON} + +\item{verbose}{Logical, defaults to \code{TRUE}. Should verbose processing +messages and warnings be returned.} + +\item{...}{extra parameters to be passed to jsonlite::fromJSON} +} +\value{ +A data table +} +\description{ +Checks for use of memoise and then uses vroom::vroom. +} +\concept{utility} diff --git a/man/vietnam_codes.Rd b/man/vietnam_codes.Rd new file mode 100644 index 00000000..00bf8534 --- /dev/null +++ b/man/vietnam_codes.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/datasets.R +\docType{data} +\name{vietnam_codes} +\alias{vietnam_codes} +\title{Region Codes for Vietnam Dataset.} +\format{ +An object of class \code{data.frame} with 63 rows and 2 columns. +} +\usage{ +vietnam_codes +} +\value{ +A tibble of region codes and related information. +} +\description{ +The region codes for Viet Nam +} +\keyword{datasets} diff --git a/tests/testthat/custom_data/Estonia_level_1.rds b/tests/testthat/custom_data/Estonia_level_1.rds new file mode 100644 index 00000000..7a285cf5 Binary files /dev/null and b/tests/testthat/custom_data/Estonia_level_1.rds differ diff --git a/tests/testthat/custom_data/Vietnam_level_1.rds b/tests/testthat/custom_data/Vietnam_level_1.rds new file mode 100644 index 00000000..6758afb1 Binary files /dev/null and b/tests/testthat/custom_data/Vietnam_level_1.rds differ