Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source text and url fields to classes #388

Merged
merged 6 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions R/Belgium.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ Belgium <- R6::R6Class("Belgium",
),
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new"),
#' @field source_text Plain text description of the source of the data
source_text = "Sciensano (Belgian institute of health)",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://epistat.wiv-isp.be/covid/",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble tribble
Expand Down
5 changes: 5 additions & 0 deletions R/Brazil.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Brazil <- R6::R6Class("Brazil",
),
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_total", "deaths_total"),
#' @field source_text Plain text description of the source of the data
source_text = "Wesley Cota",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/wcota/covid19br/blob/master/README.en.md",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tribble
Expand Down
7 changes: 6 additions & 1 deletion R/Canada.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ Canada <- R6::R6Class("Canada",
"cases_new", "cases_total", "deaths_new",
"recovered_total", "tested_new"
),

#' @field source_text Plain text description of the source of the data
source_text = "Public Health Infobase, Public Health Agency of Canada",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://open.canada.ca/data/en/dataset/261c32ab-4cfd-4f81-9dea-7b64065690dc", # nolint

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
set_region_codes = function() {
Expand Down
5 changes: 5 additions & 0 deletions R/Colombia.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Colombia <- R6::R6Class("Colombia",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_total"),
#' @field source_text Plain text description of the source of the data
source_text = "Daniel C\u00e1rdenas",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/danielcs88/colombia_covid-19/",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
5 changes: 5 additions & 0 deletions R/Covid19DataHub.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Covid19DataHub <- R6::R6Class("Covid19DataHub",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("confirmed", "deaths", "recovered", "tested", "hosp"),
#' @field source_text Plain text description of the source of the data
source_text = "COVID-19 Data Hub",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://covid19datahub.io",

#' @description Covid19 Data Hub specific data cleaning.
#' This takes all the raw data, renames some columns and checks types.
Expand Down
6 changes: 6 additions & 0 deletions R/Cuba.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Cuba <- R6::R6Class("Cuba",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new"),
#' @field source_text Plain text description of the source of the data
source_text = "COVID19 Cuba Data team",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://covid19cubadata.github.io/#cuba",


#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
5 changes: 5 additions & 0 deletions R/ECDC.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ ECDC <- R6::R6Class("ECDC",
),
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new"),
#' @field source_text Plain text description of the source of the data
source_text = "European Centre for Disease Prevention and Control (ECDC)",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide", # nolint

#' @description ECDC specific state level data cleaning
#' @importFrom dplyr mutate rename select arrange filter
Expand Down
6 changes: 6 additions & 0 deletions R/France.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ France <- R6::R6Class("France",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "tested_new"),
#' @field source_text Plain text description of the source of the data
source_text = "French Public Open Data Platform",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://www.data.gouv.fr/fr/pages/donnees-coronavirus",


#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
6 changes: 6 additions & 0 deletions R/Germany.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Germany <- R6::R6Class("Germany",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new"),
#' @field source_text Plain text description of the source of the data
source_text = "Robert Koch-Institut (RKI)",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://hub.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0/explore", # nolint


#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
6 changes: 6 additions & 0 deletions R/Google.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ Google <- R6::R6Class("Google",
"total_recovered",
"total_tested"
),
#' @field source_text Plain text description of the source of the data
source_text = "O. Wahltinez and others",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if people are going to add to citation etc we should go with et al. here rather than others to fit in the usual format.

#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/GoogleCloudPlatform/covid-19-open-data",

#' @description GoogleData specific subregion2 level data cleaning. This
#' takes all the raw data, puts into a single data frame, renames some
#' columns and checks types.
Expand Down
5 changes: 5 additions & 0 deletions R/India.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ India <- R6::R6Class("India",
),
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new", "recovered_new"),
#' @field source_text Plain text description of the source of the data
source_text = "COVID19India",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://www.covid19india.org",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
5 changes: 5 additions & 0 deletions R/Italy.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Italy <- R6::R6Class("Italy",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_total", "deaths_total", "tested_total"),
#' @field source_text Plain text description of the source of the data
source_text = "Department of Civil Protection, Italy",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/pcm-dpc/COVID-19/blob/master/README_EN.md",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
5 changes: 5 additions & 0 deletions R/JHU.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ JHU <- R6::R6Class("JHU", # rename to country name
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("confirmed", "deaths", "recovered"),
#' @field source_text Plain text description of the source of the data
source_text = "Center for Systems Science and Engineering (CSSE) at Johns Hopkins University (JHU)", # nolint
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/CSSEGISandData/COVID-19/",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
6 changes: 6 additions & 0 deletions R/JRC.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ JRC <- R6::R6Class("JRC",
"Hospitalized",
"IntensiveCare"
),
#' @field source_text Plain text description of the source of the data
source_text = "European Commission Joint Research Centre (JRC)",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/ec-jrc/COVID-19",


#' @description JRC specific data cleaning. The raw source data columns are
#' converted to the correct type and renamed appropriately to match the
Expand Down
6 changes: 6 additions & 0 deletions R/Lithuania.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ Lithuania <- R6::R6Class("Lithuania",
source_data_cols = c(
"cases_new", "tested_new", "recovered_total", "deaths_new"
),
#' @field source_text Plain text description of the source of the data
source_text = "Lithuanian Statistics Department",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://hub.arcgis.com/datasets/d49a63c934be4f65a93b6273785a8449_0/about", # nolint

# Additional attributes specific to the Lithuania functionality
#' @field death_definition which criteria of deaths attributed to
#' COVID to use
Expand Down
5 changes: 5 additions & 0 deletions R/Mexico.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Mexico <- R6::R6Class("Mexico",
),
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new"),
#' @field source_text Plain text description of the source of the data
source_text = "Government of Mexico",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://datos.covid-19.conacyt.mx",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
5 changes: 5 additions & 0 deletions R/Netherlands.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Netherlands <- R6::R6Class("Netherlands",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new", "hosp_new"),
#' @field source_text Plain text description of the source of the data
source_text = "National Institute for Public Health and the Environment (RIVM), Netherlands", # nolint
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://data.rivm.nl/covid-19/",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
6 changes: 5 additions & 1 deletion R/SouthAfrica.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ SouthAfrica <- R6::R6Class("SouthAfrica",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_new", "deaths_new", "recovered_new"),
#' @field source_text Plain text description of the source of the data
source_text = "Data Science for Social Impact research group, University of Pretoria", # nolint
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/dsfsi/covid19za",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
#' @importFrom dplyr mutate
set_region_codes = function() {
self$codes_lookup$`1` <- tibble(
code = c(
Expand Down
5 changes: 5 additions & 0 deletions R/Switzerland.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ Switzerland <- R6::R6Class("Switzerland",
"cases_total",
"tested_total"
),
#' @field source_text Plain text description of the source of the data
source_text = "Open Data, Canton of Zurich",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/openZH/covid_19/",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
Expand Down
5 changes: 5 additions & 0 deletions R/UK.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ UK <- R6::R6Class("UK",
"newPillarOneTestsByPublishDate", "newPillarTwoTestsByPublishDate",
"newPillarThreeTestsByPublishDate", "newPillarFourTestsByPublishDate"
),
#' @field source_text Plain text description of the source of the data
source_text = "Public Health England",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://coronavirus.data.gov.uk/",

#' @description Specific function for getting region codes for UK .
set_region_codes = function() {
Expand Down
5 changes: 5 additions & 0 deletions R/USA.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ USA <- R6::R6Class("USA",
# nolint end
#' @field source_data_cols existing columns within the raw data
source_data_cols = c("cases_total", "deaths_total"),
#' @field source_text Plain text description of the source of the data
source_text = "New York Times",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://github.com/nytimes/covid-19-data",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tribble
Expand Down
6 changes: 6 additions & 0 deletions R/WHO.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ WHO <- R6::R6Class("WHO",
"deaths_new",
"deaths_total"
),
#' @field source_text Plain text description of the source of the data
source_text = "World Health Organisation",
#' @field source_url Website address for explanation/introduction of the
#' data
source_url = "https://covid19.who.int",


#' @description WHO specific data cleaning
#' @importFrom dplyr mutate rename
Expand Down
4 changes: 3 additions & 1 deletion R/shared-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ DataClass <- R6::R6Class(
"national", "regional"
),
data_urls = paste(unlist(self$data_urls), collapse = ", "),
source_data_cols = paste(unlist(self$source_data_cols), collapse = ", ")
source_data_cols = paste(unlist(self$source_data_cols), collapse = ", "),
source_text = ifelse(is.null(self$source_text), NA, self$source_text),
source_url = ifelse(is.null(self$source_url), NA, self$source_url)
)
return(sum_df)
},
Expand Down
2 changes: 1 addition & 1 deletion data-raw/render_available_datasets.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# render available datasets table

all_country_data <- get_regional_data(render = TRUE)
all_country_data <- get_available_datasets(render = TRUE)
usethis::use_data(all_country_data, overwrite = TRUE)
Binary file modified data/all_country_data.rda
Binary file not shown.
5 changes: 5 additions & 0 deletions man/Belgium.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/Brazil.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/Canada.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/Colombia.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/Covid19DataHub.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/Cuba.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/ECDC.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/France.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading