From 1426e7ad63e8a27273d8cc667b51d69a8ba57832 Mon Sep 17 00:00:00 2001 From: Richard Martin-Nielsen Date: Thu, 16 Sep 2021 20:33:41 +0300 Subject: [PATCH 1/6] Transfer Estonia code into new clean branch --- DESCRIPTION | 2 +- NAMESPACE | 2 + R/Estonia.R | 86 +++++++++++++++++++++++++ data/all_country_data.rda | Bin 2817 -> 2910 bytes man/Belgium.Rd | 1 + man/Brazil.Rd | 1 + man/Canada.Rd | 1 + man/Colombia.Rd | 1 + man/Covid19DataHub.Rd | 1 + man/Cuba.Rd | 1 + man/Estonia.Rd | 129 ++++++++++++++++++++++++++++++++++++++ man/France.Rd | 1 + man/Germany.Rd | 1 + man/Google.Rd | 1 + man/India.Rd | 1 + man/Italy.Rd | 1 + man/JHU.Rd | 1 + man/Lithuania.Rd | 1 + man/Mexico.Rd | 1 + man/Netherlands.Rd | 1 + man/SouthAfrica.Rd | 1 + man/Switzerland.Rd | 1 + man/UK.Rd | 1 + man/USA.Rd | 1 + man/all_country_data.Rd | 2 +- 25 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 R/Estonia.R create mode 100644 man/Estonia.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 86fd1d5f..f6529692 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -121,4 +121,4 @@ Encoding: UTF-8 Language: en-gb LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 diff --git a/NAMESPACE b/NAMESPACE index ce3bcc43..00588964 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,6 +10,7 @@ export(Covid19DataHub) export(Cuba) export(DataClass) export(ECDC) +export(Estonia) export(France) export(Germany) export(Google) @@ -73,6 +74,7 @@ importFrom(dplyr,slice_tail) importFrom(dplyr,starts_with) importFrom(dplyr,summarise) importFrom(dplyr,tally) +importFrom(dplyr,transmute) importFrom(dplyr,ungroup) importFrom(dplyr,vars) importFrom(httr,GET) diff --git a/R/Estonia.R b/R/Estonia.R new file mode 100644 index 00000000..046bd465 --- /dev/null +++ b/R/Estonia.R @@ -0,0 +1,86 @@ +#' Estonia Class for downloading, cleaning and processing notification data +#' @description Information for downloading, cleaning +#' and processing COVID-19 region data for Estonia +#' +# nolint start +#' @source \url{https://www.terviseamet.ee/et/koroonaviirus/avaandmed} +# nolint end +#' @export +#' @concept dataset +#' @family subnational +#' @examples +#' \dontrun{ +#' region <- Estonia$new(verbose = TRUE, steps = TRUE, get = TRUE) +#' region$return() +#' } +Estonia <- R6::R6Class("Estonia", + inherit = DataClass, + public = list( + + # Core Attributes + #' @field origin name of origin to fetch data for + origin = "Estonia", + #' @field supported_levels A list of supported levels. + supported_levels = list("1"), + #' @field supported_region_names A list of region names in order of level. + supported_region_names = list("1" = "county"), + #' @field supported_region_codes A 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. + # nolint start + common_data_urls = list( + "main" = "https://opendata.digilugu.ee/opendata_covid19_test_county_all.csv" # nolint + ), + # nolint end + #' @field source_data_cols existing columns within the raw data + source_data_cols = c("cases_new", "tested_new", "cases_total", "tested_total"), + #' @field source_text Plain text description of the source of the data + source_text = "Estonian Ministry of Social Affairs", + #' @field source_url Website address for explanation/introduction of the + #' data + source_url = "https://www.terviseamet.ee/et/koroonaviirus/avaandmed", + + + #' @description Set up a table of region codes for clean data + #' @importFrom tibble tibble + set_region_codes = function() { + self$codes_lookup$`1` <- tibble( + code = c("EE-37", + "EE-39", "EE-45", "EE-52", "EE-50", "EE-56", "EE-60", "EE-68", + "EE-64", "EE-71", "EE-74", "EE-79", "EE-81", "EE-84", "EE-87", + NA), + region = c("Harju", "Hiiu", "Ida-Viru", "J\u00e4rva", + "J\u00f5geva", "L\u00e4\u00e4ne", "L\u00e4\u00e4ne-Viru", + "P\u00e4rnu", "P\u00f5lva", "Rapla","Saare", "Tartu", + "Valga", "Viljandi", "V\u00f5ru", "Unknown") + ) + }, + + #' @description Estonia specific state level data cleaning + #' @importFrom dplyr select mutate transmute + #' @importFrom tidyr pivot_wider + #' @importFrom rlang .data + #' + clean_common = function() { + self$data$clean <- self$data$raw[["main"]] %>% + pivot_wider( + id_cols = c("LastStatisticsDate","StatisticsDate","Country","CountryEHAK","County","CountyEHAK"), + names_from = ResultValue, + values_from = c("DailyTests","TotalTests","DailyCases","TotalCases")) %>% + select(-Country,-CountryEHAK) %>% + mutate(TestPositivity = ifelse((DailyTests_N+DailyTests_P)>0, + (DailyTests_P/(DailyTests_N+DailyTests_P)), + NA)) %>% + transmute( + level_1_region = gsub(" maakond","", .data$County), + level_1_region_code=gsub("00","EE-", .data$CountyEHAK), + date = .data$StatisticsDate, + cases_new = .data$DailyCases_P, + tested_new = .data$DailyTests_P + .data$DailyTests_N, + cases_total = .data$TotalCases_P, + tested_total = .data$TotalTests_P + .data$TotalTests_N, + test_positivity = .data$TestPositivity + ) + } + ) +) diff --git a/data/all_country_data.rda b/data/all_country_data.rda index f95a7f512e7e80dbb09e85e5338935b82dd03b6e..cf06d6ea056ed4f3229a4e09ead3701b4251a0f0 100644 GIT binary patch literal 2910 zcmV-k3!(HvT4*^jL0KkKSu2V^fB**b|Mma>Z@>Qk|NQ^|-|)Zx-|#>H005vs2m*kh z00H0(KN%9<%?5>m7!3e)A5TC43IGHp5T=WQYGjR)W|8F7^)%4P(`p8QGzNe) z$?9Tc9#8<%OeWBZVi=m66G&-@z?n3}U=tyeMj?{|VldQc>SSPW0009(000dDGynrY z01W^D00T87G>M5c^)eo#)NLcw(9i%HGyniSAkYSY000Ic&;S4c0MGyc01W^D00000 z2@(hh&bn31jZjjM!|i*f2L?a1sIn0 zgVUG#eBU3}=`O!pAi_=D|ADNbFo4K_pDca|l$vTE8ciwDyPCSvBm`+v5T!H_@=pqbsb5@ZEf{kylHU%v9oQw8QTxgw})a<$~&5RPaJ&{P$S>and z(zEQIRIFJnrF6d6d;iCVRrzBIe2*;9Yh@g+(W+phtCx47T8CHwr?G>Wrv7LsB51lm^gsD9Nz~8Y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ovZU%k T2q_oQf8y>)rwS4fnnaO6RL2}{ diff --git a/man/Belgium.Rd b/man/Belgium.Rd index 16578b4d..d552ff29 100644 --- a/man/Belgium.Rd +++ b/man/Belgium.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Brazil.Rd b/man/Brazil.Rd index 1016a6aa..81c461f4 100644 --- a/man/Brazil.Rd +++ b/man/Brazil.Rd @@ -26,6 +26,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Canada.Rd b/man/Canada.Rd index 022d5277..52ef95fd 100644 --- a/man/Canada.Rd +++ b/man/Canada.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Colombia.Rd b/man/Colombia.Rd index e8ff1a8d..50065b17 100644 --- a/man/Colombia.Rd +++ b/man/Colombia.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Canada}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Covid19DataHub.Rd b/man/Covid19DataHub.Rd index b305691f..5489abae 100644 --- a/man/Covid19DataHub.Rd +++ b/man/Covid19DataHub.Rd @@ -77,6 +77,7 @@ Subnational data sources \code{\link{Canada}}, \code{\link{Colombia}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Cuba.Rd b/man/Cuba.Rd index 4b688582..fc8d32f4 100644 --- a/man/Cuba.Rd +++ b/man/Cuba.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Canada}}, \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Estonia.Rd b/man/Estonia.Rd new file mode 100644 index 00000000..5c29e1f1 --- /dev/null +++ b/man/Estonia.Rd @@ -0,0 +1,129 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Estonia.R +\name{Estonia} +\alias{Estonia} +\title{Estonia Class for downloading, cleaning and processing notification data} +\source{ +\url{https://www.terviseamet.ee/et/koroonaviirus/avaandmed} +} +\description{ +Information for downloading, cleaning +and processing COVID-19 region data for Estonia +} +\examples{ +\dontrun{ +region <- Estonia$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{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{Estonia} +} +\section{Public fields}{ +\if{html}{\out{
}} +\describe{ +\item{\code{origin}}{name of origin to fetch data for} + +\item{\code{supported_levels}}{A list of supported levels.} + +\item{\code{supported_region_names}}{A list of region names in order of level.} + +\item{\code{supported_region_codes}}{A 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{Estonia$set_region_codes()}} +\item \href{#method-clean_common}{\code{Estonia$clean_common()}} +\item \href{#method-clone}{\code{Estonia$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}{\code{covidregionaldata::DataClass$download()}}\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{Estonia$set_region_codes()}\if{html}{\out{
}} +} + +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-clean_common}{}}} +\subsection{Method \code{clean_common()}}{ +Estonia specific state level data cleaning +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Estonia$clean_common()}\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{Estonia$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/France.Rd b/man/France.Rd index fb3d2b12..0d4f92f6 100644 --- a/man/France.Rd +++ b/man/France.Rd @@ -28,6 +28,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{Germany}}, \code{\link{Google}}, \code{\link{India}}, diff --git a/man/Germany.Rd b/man/Germany.Rd index bca080b9..f48b50fe 100644 --- a/man/Germany.Rd +++ b/man/Germany.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Google}}, \code{\link{India}}, diff --git a/man/Google.Rd b/man/Google.Rd index a4ff31af..d47fe1dd 100644 --- a/man/Google.Rd +++ b/man/Google.Rd @@ -68,6 +68,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{India}}, diff --git a/man/India.Rd b/man/India.Rd index d676bd92..1d19917d 100644 --- a/man/India.Rd +++ b/man/India.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Italy.Rd b/man/Italy.Rd index 1c527c0a..666199f9 100644 --- a/man/Italy.Rd +++ b/man/Italy.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/JHU.Rd b/man/JHU.Rd index 53e56a88..db8db1e8 100644 --- a/man/JHU.Rd +++ b/man/JHU.Rd @@ -72,6 +72,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Lithuania.Rd b/man/Lithuania.Rd index 789460d5..3e982180 100644 --- a/man/Lithuania.Rd +++ b/man/Lithuania.Rd @@ -138,6 +138,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Mexico.Rd b/man/Mexico.Rd index 5c9c653f..7174e346 100644 --- a/man/Mexico.Rd +++ b/man/Mexico.Rd @@ -34,6 +34,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Netherlands.Rd b/man/Netherlands.Rd index d1fe4ff0..ab3c0bf9 100644 --- a/man/Netherlands.Rd +++ b/man/Netherlands.Rd @@ -28,6 +28,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/SouthAfrica.Rd b/man/SouthAfrica.Rd index 78c0b096..e2c281dd 100644 --- a/man/SouthAfrica.Rd +++ b/man/SouthAfrica.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Switzerland.Rd b/man/Switzerland.Rd index 90e35976..3fcdd39f 100644 --- a/man/Switzerland.Rd +++ b/man/Switzerland.Rd @@ -49,6 +49,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/UK.Rd b/man/UK.Rd index c70c18c1..c2f45c4a 100644 --- a/man/UK.Rd +++ b/man/UK.Rd @@ -71,6 +71,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/USA.Rd b/man/USA.Rd index ff36de2f..13e5364e 100644 --- a/man/USA.Rd +++ b/man/USA.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/all_country_data.Rd b/man/all_country_data.Rd index d8dcc66b..052c4727 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 22 rows and 10 columns. +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 23 rows and 10 columns. } \usage{ all_country_data From 24bd6686e77a4a0fc61dd8599a169d4fbdf7e662 Mon Sep 17 00:00:00 2001 From: Richard Martin-Nielsen Date: Thu, 16 Sep 2021 20:33:41 +0300 Subject: [PATCH 2/6] Transfer Estonia code into new clean branch --- DESCRIPTION | 2 +- NAMESPACE | 2 + R/Estonia.R | 90 ++++++++++++++++++++++++++ data/all_country_data.rda | Bin 2817 -> 2910 bytes man/Belgium.Rd | 1 + man/Brazil.Rd | 1 + man/Canada.Rd | 1 + man/Colombia.Rd | 1 + man/Covid19DataHub.Rd | 1 + man/Cuba.Rd | 1 + man/Estonia.Rd | 129 ++++++++++++++++++++++++++++++++++++++ man/France.Rd | 1 + man/Germany.Rd | 1 + man/Google.Rd | 1 + man/India.Rd | 1 + man/Italy.Rd | 1 + man/JHU.Rd | 1 + man/Lithuania.Rd | 1 + man/Mexico.Rd | 1 + man/Netherlands.Rd | 1 + man/SouthAfrica.Rd | 1 + man/Switzerland.Rd | 1 + man/UK.Rd | 1 + man/USA.Rd | 1 + man/all_country_data.Rd | 2 +- 25 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 R/Estonia.R create mode 100644 man/Estonia.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 86fd1d5f..f6529692 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -121,4 +121,4 @@ Encoding: UTF-8 Language: en-gb LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 diff --git a/NAMESPACE b/NAMESPACE index ce3bcc43..00588964 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,6 +10,7 @@ export(Covid19DataHub) export(Cuba) export(DataClass) export(ECDC) +export(Estonia) export(France) export(Germany) export(Google) @@ -73,6 +74,7 @@ importFrom(dplyr,slice_tail) importFrom(dplyr,starts_with) importFrom(dplyr,summarise) importFrom(dplyr,tally) +importFrom(dplyr,transmute) importFrom(dplyr,ungroup) importFrom(dplyr,vars) importFrom(httr,GET) diff --git a/R/Estonia.R b/R/Estonia.R new file mode 100644 index 00000000..564601b8 --- /dev/null +++ b/R/Estonia.R @@ -0,0 +1,90 @@ +#' Estonia Class for downloading, cleaning and processing notification data +#' @description Information for downloading, cleaning +#' and processing COVID-19 region data for Estonia +#' +# nolint start +#' @source \url{https://www.terviseamet.ee/et/koroonaviirus/avaandmed} +# nolint end +#' @export +#' @concept dataset +#' @family subnational +#' @examples +#' \dontrun{ +#' region <- Estonia$new(verbose = TRUE, steps = TRUE, get = TRUE) +#' region$return() +#' } +Estonia <- R6::R6Class("Estonia", + inherit = DataClass, + public = list( + + # Core Attributes + #' @field origin name of origin to fetch data for + origin = "Estonia", + #' @field supported_levels A list of supported levels. + supported_levels = list("1"), + #' @field supported_region_names A list of region names in order of level. + supported_region_names = list("1" = "county"), + #' @field supported_region_codes A 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. + # nolint start + common_data_urls = list( + "main" = "https://opendata.digilugu.ee/opendata_covid19_test_county_all.csv" # nolint + ), + # nolint end + #' @field source_data_cols existing columns within the raw data + source_data_cols = c("cases_new", "tested_new", + "cases_total", "tested_total"), + #' @field source_text Plain text description of the source of the data + source_text = "Estonian Ministry of Social Affairs", + #' @field source_url Website address for explanation/introduction of the + #' data + source_url = "https://www.terviseamet.ee/et/koroonaviirus/avaandmed", + + + #' @description Set up a table of region codes for clean data + #' @importFrom tibble tibble + set_region_codes = function() { + self$codes_lookup$`1` <- tibble( + code = c("EE-37", + "EE-39", "EE-45", "EE-52", "EE-50", "EE-56", "EE-60", "EE-68", + "EE-64", "EE-71", "EE-74", "EE-79", "EE-81", "EE-84", "EE-87", + NA), + region = c("Harju", "Hiiu", "Ida-Viru", "J\u00e4rva", + "J\u00f5geva", "L\u00e4\u00e4ne", "L\u00e4\u00e4ne-Viru", + "P\u00e4rnu", "P\u00f5lva", "Rapla", "Saare", "Tartu", + "Valga", "Viljandi", "V\u00f5ru", "Unknown") + ) + }, + + #' @description Estonia specific state level data cleaning + #' @importFrom dplyr select mutate transmute + #' @importFrom tidyr pivot_wider + #' @importFrom rlang .data + #' + clean_common = function() { + self$data$clean <- self$data$raw[["main"]] %>% + pivot_wider( + id_cols = c("LastStatisticsDate", "StatisticsDate", "Country", + "CountryEHAK", "County", "CountyEHAK"), + names_from = ResultValue, + values_from = c("DailyTests", "TotalTests", + "DailyCases", "TotalCases")) %>% + select(-Country, -CountryEHAK) %>% + mutate(TestPositivity = + ifelse((DailyTests_N + DailyTests_P) > 0, + (DailyTests_P / (DailyTests_N + DailyTests_P)), + NA)) %>% + transmute( + level_1_region = gsub(" maakond", "", .data$County), + level_1_region_code = gsub("00", "EE-", .data$CountyEHAK), + date = .data$StatisticsDate, + cases_new = .data$DailyCases_P, + tested_new = .data$DailyTests_P + .data$DailyTests_N, + cases_total = .data$TotalCases_P, + tested_total = .data$TotalTests_P + .data$TotalTests_N, + test_positivity = .data$TestPositivity + ) + } + ) +) diff --git a/data/all_country_data.rda b/data/all_country_data.rda index f95a7f512e7e80dbb09e85e5338935b82dd03b6e..cf06d6ea056ed4f3229a4e09ead3701b4251a0f0 100644 GIT binary patch literal 2910 zcmV-k3!(HvT4*^jL0KkKSu2V^fB**b|Mma>Z@>Qk|NQ^|-|)Zx-|#>H005vs2m*kh z00H0(KN%9<%?5>m7!3e)A5TC43IGHp5T=WQYGjR)W|8F7^)%4P(`p8QGzNe) z$?9Tc9#8<%OeWBZVi=m66G&-@z?n3}U=tyeMj?{|VldQc>SSPW0009(000dDGynrY z01W^D00T87G>M5c^)eo#)NLcw(9i%HGyniSAkYSY000Ic&;S4c0MGyc01W^D00000 z2@(hh&bn31jZjjM!|i*f2L?a1sIn0 zgVUG#eBU3}=`O!pAi_=D|ADNbFo4K_pDca|l$vTE8ciwDyPCSvBm`+v5T!H_@=pqbsb5@ZEf{kylHU%v9oQw8QTxgw})a<$~&5RPaJ&{P$S>and z(zEQIRIFJnrF6d6d;iCVRrzBIe2*;9Yh@g+(W+phtCx47T8CHwr?G>Wrv7LsB51lm^gsD9Nz~8Yx%}d!|(-1Tr_6d7&c7jA~9* zF~%IXy^v#s8r8w^SYSU5Ho3Awvq*tfP-9DIw6qqmSnI%K?xIuC0BB)qIvQ4gS`#nl zllN|1adg}HK$IvHMV}jP)=KfY38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7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Brazil.Rd b/man/Brazil.Rd index 1016a6aa..81c461f4 100644 --- a/man/Brazil.Rd +++ b/man/Brazil.Rd @@ -26,6 +26,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Canada.Rd b/man/Canada.Rd index 022d5277..52ef95fd 100644 --- a/man/Canada.Rd +++ b/man/Canada.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Colombia.Rd b/man/Colombia.Rd index e8ff1a8d..50065b17 100644 --- a/man/Colombia.Rd +++ b/man/Colombia.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Canada}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Covid19DataHub.Rd b/man/Covid19DataHub.Rd index b305691f..5489abae 100644 --- a/man/Covid19DataHub.Rd +++ b/man/Covid19DataHub.Rd @@ -77,6 +77,7 @@ Subnational data sources \code{\link{Canada}}, \code{\link{Colombia}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Cuba.Rd b/man/Cuba.Rd index 4b688582..fc8d32f4 100644 --- a/man/Cuba.Rd +++ b/man/Cuba.Rd @@ -23,6 +23,7 @@ Subnational data sources \code{\link{Canada}}, \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Estonia.Rd b/man/Estonia.Rd new file mode 100644 index 00000000..5c29e1f1 --- /dev/null +++ b/man/Estonia.Rd @@ -0,0 +1,129 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Estonia.R +\name{Estonia} +\alias{Estonia} +\title{Estonia Class for downloading, cleaning and processing notification data} +\source{ +\url{https://www.terviseamet.ee/et/koroonaviirus/avaandmed} +} +\description{ +Information for downloading, cleaning +and processing COVID-19 region data for Estonia +} +\examples{ +\dontrun{ +region <- Estonia$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{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{Estonia} +} +\section{Public fields}{ +\if{html}{\out{
}} +\describe{ +\item{\code{origin}}{name of origin to fetch data for} + +\item{\code{supported_levels}}{A list of supported levels.} + +\item{\code{supported_region_names}}{A list of region names in order of level.} + +\item{\code{supported_region_codes}}{A 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{Estonia$set_region_codes()}} +\item \href{#method-clean_common}{\code{Estonia$clean_common()}} +\item \href{#method-clone}{\code{Estonia$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}{\code{covidregionaldata::DataClass$download()}}\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{Estonia$set_region_codes()}\if{html}{\out{
}} +} + +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-clean_common}{}}} +\subsection{Method \code{clean_common()}}{ +Estonia specific state level data cleaning +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Estonia$clean_common()}\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{Estonia$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/France.Rd b/man/France.Rd index fb3d2b12..0d4f92f6 100644 --- a/man/France.Rd +++ b/man/France.Rd @@ -28,6 +28,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{Germany}}, \code{\link{Google}}, \code{\link{India}}, diff --git a/man/Germany.Rd b/man/Germany.Rd index bca080b9..f48b50fe 100644 --- a/man/Germany.Rd +++ b/man/Germany.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Google}}, \code{\link{India}}, diff --git a/man/Google.Rd b/man/Google.Rd index a4ff31af..d47fe1dd 100644 --- a/man/Google.Rd +++ b/man/Google.Rd @@ -68,6 +68,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{India}}, diff --git a/man/India.Rd b/man/India.Rd index d676bd92..1d19917d 100644 --- a/man/India.Rd +++ b/man/India.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Italy.Rd b/man/Italy.Rd index 1c527c0a..666199f9 100644 --- a/man/Italy.Rd +++ b/man/Italy.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/JHU.Rd b/man/JHU.Rd index 53e56a88..db8db1e8 100644 --- a/man/JHU.Rd +++ b/man/JHU.Rd @@ -72,6 +72,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Lithuania.Rd b/man/Lithuania.Rd index 789460d5..3e982180 100644 --- a/man/Lithuania.Rd +++ b/man/Lithuania.Rd @@ -138,6 +138,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Mexico.Rd b/man/Mexico.Rd index 5c9c653f..7174e346 100644 --- a/man/Mexico.Rd +++ b/man/Mexico.Rd @@ -34,6 +34,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Netherlands.Rd b/man/Netherlands.Rd index d1fe4ff0..ab3c0bf9 100644 --- a/man/Netherlands.Rd +++ b/man/Netherlands.Rd @@ -28,6 +28,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/SouthAfrica.Rd b/man/SouthAfrica.Rd index 78c0b096..e2c281dd 100644 --- a/man/SouthAfrica.Rd +++ b/man/SouthAfrica.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/Switzerland.Rd b/man/Switzerland.Rd index 90e35976..3fcdd39f 100644 --- a/man/Switzerland.Rd +++ b/man/Switzerland.Rd @@ -49,6 +49,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/UK.Rd b/man/UK.Rd index c70c18c1..c2f45c4a 100644 --- a/man/UK.Rd +++ b/man/UK.Rd @@ -71,6 +71,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/USA.Rd b/man/USA.Rd index ff36de2f..13e5364e 100644 --- a/man/USA.Rd +++ b/man/USA.Rd @@ -24,6 +24,7 @@ Subnational data sources \code{\link{Colombia}}, \code{\link{Covid19DataHub}}, \code{\link{Cuba}}, +\code{\link{Estonia}}, \code{\link{France}}, \code{\link{Germany}}, \code{\link{Google}}, diff --git a/man/all_country_data.Rd b/man/all_country_data.Rd index d8dcc66b..052c4727 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 22 rows and 10 columns. +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 23 rows and 10 columns. } \usage{ all_country_data From aff8dbdb21b9bfccfba074ceb77d14c4e092f87e Mon Sep 17 00:00:00 2001 From: Richard Martin-Nielsen Date: Thu, 16 Sep 2021 20:41:16 +0300 Subject: [PATCH 3/6] Add Estonia.yaml --- .github/workflows/Estonia.yaml | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/Estonia.yaml diff --git a/.github/workflows/Estonia.yaml b/.github/workflows/Estonia.yaml new file mode 100644 index 00000000..f345ba60 --- /dev/null +++ b/.github/workflows/Estonia.yaml @@ -0,0 +1,48 @@ +on: + schedule: + - cron: '36 12 * * *' + workflow_dispatch: + +name: Estonia + +jobs: + Estonia: + 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" = "Estonia") + devtools::load_all() + testthat::test_file("tests/testthat/test-regional-datasets.R", reporter = c("summary", "fail")) + shell: Rscript {0} From fc0d356c95daeee7a6ad4dca0a5d4fa1f7984396 Mon Sep 17 00:00:00 2001 From: Sam Abbott Date: Fri, 17 Sep 2021 16:50:56 +0100 Subject: [PATCH 4/6] bump news --- NEWS.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS.md b/NEWS.md index 8f93cbdd..b77a8cbc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# covidregionaldata 0.9.3 + +This release is currrent under development + +## New data sets + +- Support for level 1 region data in Estonia (thanks to @RichardMN). See `?Estonia` 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. From 27f77f187e11694728bd4b9225086a2daa08f37f Mon Sep 17 00:00:00 2001 From: Sam Abbott Date: Fri, 17 Sep 2021 16:51:09 +0100 Subject: [PATCH 5/6] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b77a8cbc..38acad4c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # covidregionaldata 0.9.3 -This release is currrent under development +This release is currrently under development ## New data sets From da185c9cde6c3196e63ada281900df220bdf070f Mon Sep 17 00:00:00 2001 From: Sam Abbott Date: Fri, 17 Sep 2021 16:51:23 +0100 Subject: [PATCH 6/6] Update DESCRIPTION --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f6529692..61168eb0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: covidregionaldata Title: Subnational Data for COVID-19 Epidemiology -Version: 0.9.2.1000 +Version: 0.9.2.2000 Authors@R: c(person(given = "Joseph", family = "Palmer",