Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 14e112c
Author: Sam Abbott <contact@samabbott.co.uk>
Date:   Fri Feb 4 15:50:18 2022 +0000

    add github to vscode tools for dev environmenth

commit a851c75
Author: Sam Abbott <contact@samabbott.co.uk>
Date:   Fri Feb 4 15:43:07 2022 +0000

    switch to preferably template for website

commit 2bec63f
Merge: a13fd4e 6f2753e
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:28:39 2022 +0000

    Merge pull request epiforecasts#450 from epiforecasts/fix-lintr-warnings

    Fix lintr warnings

commit a13fd4e
Merge: 35d6938 fd1219f
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:26:52 2022 +0000

    Merge pull request epiforecasts#445 from DavisVaughan/fix/reliance-on-complete-column-order

    Don't rely on exact column ordering when grouped data is involved

commit 6f2753e
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Fri Feb 4 16:25:46 2022 +0100

    Fix lintr warnings

    so we don't get nagged with annotations on PRs

commit fd1219f
Merge: 46b22ac 35d6938
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:25:26 2022 +0000

    Merge branch 'master' into fix/reliance-on-complete-column-order

commit 35d6938
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:22:06 2022 +0000

    Update devcontainer.json

commit 70adf70
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:20:55 2022 +0000

    Create build-image.yaml

commit f29752e
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:19:26 2022 +0000

    Drop docker from full commit

commit 4aa5732
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Feb 4 15:15:27 2022 +0000

    Hugo: ctb -> aut (epiforecasts#416)

commit 46b22ac
Author: DavisVaughan <davis@rstudio.com>
Date:   Mon Jan 10 10:23:41 2022 -0500

    Don't rely on exact column ordering when grouped data is involved

commit 097708f
Merge: 950e625 1a99fa7
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Dec 10 21:43:52 2021 +0000

    Merge pull request epiforecasts#444 from epiforecasts/Bisaloo-patch-1

    Fix website URL

commit 1a99fa7
Author: Hugo Gruson <Bisaloo@users.noreply.github.com>
Date:   Fri Dec 3 17:04:19 2021 +0000

    Fix website URL

commit 950e625
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Dec 3 16:37:48 2021 +0000

    Update NEWS.md

commit b93e19d
Merge: f6c9759 007b535
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Dec 3 16:36:05 2021 +0000

    Merge pull request epiforecasts#437 from epiforecasts/fewer-deps

    Reduce the number of `Imports`

commit f6c9759
Merge: 4509d81 ac3e63e
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Dec 3 16:33:49 2021 +0000

    Merge pull request epiforecasts#439 from epiforecasts/pr-checklist-news

    Update pr-checklist.yaml to include news nudge

commit 4509d81
Merge: 04009e7 b24f2b6
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Fri Dec 3 16:33:08 2021 +0000

    Merge pull request epiforecasts#429 from epiforecasts/alternate-switzerland

    New data source for Switzerland - fix for epiforecasts#412

commit b24f2b6
Author: Richard Martin-Nielsen <richard.martin@alumni.utoronto.ca>
Date:   Wed Dec 1 19:50:08 2021 +0200

    Update all_country_data.rda

commit ed0f6c0
Author: Richard Martin-Nielsen <richard.martin@alumni.utoronto.ca>
Date:   Wed Dec 1 19:36:35 2021 +0200

    Fixed documentation links to FOPH as source of Switzerland data, updated News

commit 2a7f105
Merge: aea9b96 04009e7
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Wed Dec 1 15:23:21 2021 +0000

    Merge branch 'master' into alternate-switzerland

commit aea9b96
Merge: 0d8a6e5 71d7b1f
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Wed Dec 1 10:52:16 2021 +0000

    Merge branch 'master' into alternate-switzerland

commit ac3e63e
Author: Sam Abbott <s.e.abbott12@gmail.com>
Date:   Wed Dec 1 10:42:33 2021 +0000

    Update pr-checklist.yaml

commit 007b535
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Wed Dec 1 10:43:26 2021 +0100

    Run devtools::document()

commit fe79373
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Wed Dec 1 10:43:16 2021 +0100

    Get rid of tidyselect

commit 3f5c115
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Wed Dec 1 10:27:44 2021 +0100

    Remove withr dependency as well

commit 79857e9
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Tue Nov 30 19:03:17 2021 +0100

    Use dplyr::tibble in tests as well

commit d3c150b
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Tue Nov 30 18:59:59 2021 +0100

    Remove broken rlang::.data import
    to prevent it from being understood as a re-export

commit e711456
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Tue Nov 30 12:53:15 2021 +0100

    Run devtools::document()

commit 4032abd
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Tue Nov 30 12:43:43 2021 +0100

    Use stringr everywhere instead of stringi

commit 1c4ede0
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Tue Nov 30 12:34:20 2021 +0100

    Get tibble functions from dplyr

commit a499cc0
Author: Hugo Gruson <hugo.gruson@protonmail.com>
Date:   Tue Nov 30 12:10:05 2021 +0100

    Re-export pipe from dplyr

commit 0d8a6e5
Author: Richard Martin-Nielsen <richard.martin@alumni.utoronto.ca>
Date:   Mon Oct 11 22:19:24 2021 +0300

    Fixes to keep lintr happier

commit 4eb12da
Author: Richard Martin-Nielsen <richard.martin@alumni.utoronto.ca>
Date:   Mon Oct 11 22:05:46 2021 +0300

    Cleaning code added and running. Passes tests.

    Removed AltSwitzerland code, generated data file of sample data and list of data sets.

commit 76e4c44
Author: Richard Martin-Nielsen <richard.martin@alumni.utoronto.ca>
Date:   Mon Oct 4 22:16:44 2021 +0300

    Moved old Switzerland code to SwitzerlandAlt, written functional 2-stage download method
  • Loading branch information
RichardMN committed Feb 4, 2022
1 parent 75cf2bd commit 808b23e
Show file tree
Hide file tree
Showing 44 changed files with 275 additions and 253 deletions.
10 changes: 3 additions & 7 deletions .devcontainer/devcontainer.json
Expand Up @@ -2,12 +2,7 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/r
{
"name": "covidregionaldata",
"build": {
"dockerfile": "Dockerfile",
// Update VARIANT to pick a specific R version: latest, ... ,4.0.1 , 4.0.0
"args": { "VARIANT": "latest" },
"context": ".."
},
"image": "ghcr.io/epiforecasts/covidregionaldata:master",

// Set *default* container specific settings.json values on container create.
"settings": {
Expand All @@ -26,7 +21,8 @@
"shan.code-settings-sync",
"searking.preview-vscode",
"tht13.html-preview-vscode",
"formulahendry.code-runner"
"formulahendry.code-runner",
"github.vscode-pull-request-github"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/build-image.yaml
@@ -0,0 +1,50 @@


name: Create and publish a Docker image

on:
push:
branches: ['release', 'master']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:

- name: Cancel previous builds if present
uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./.devcontainer/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
24 changes: 0 additions & 24 deletions .github/workflows/check-full.yaml
Expand Up @@ -270,27 +270,3 @@ jobs:
git config --local user.name "GitHub Actions"
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)"
shell: bash

push_to_registry:
if: github.ref == 'refs/heads/master' && github.repository == 'epiforecasts/covidregionaldata'
name: Push Docker image to GitHub Packages
runs-on: ubuntu-20.04

needs: [R-CMD-check, pkgdown, test-coverage]

steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Login to GitHub Packages
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v2
with:
context: .
file: .devcontainer/Dockerfile
push: true
tags: docker.pkg.github.com/epiforecasts/covidregionaldata/covidregionaldata:latest
53 changes: 53 additions & 0 deletions .github/workflows/pkgdown.yaml
@@ -0,0 +1,53 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
tags: ['*']

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v2
- uses: r-lib/actions/setup-pandoc@v1
- 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: Restore R package cache
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", "curl"))
remotes::install_deps(dependencies = TRUE)
remotes::install_github("r-lib/pkgdown")
remotes::install_github("amirmasoudabdol/preferably", type = "source")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
2 changes: 1 addition & 1 deletion .github/workflows/pr-checklist.yaml
Expand Up @@ -14,4 +14,4 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Thanks for opening this pull request! Can you please run through the following checklist before requesting review (ticking as complete or if not relevant). \n\n - [ ] Read our [contribution guidelines](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing) if you have not already done so. \n- [ ] If you have altered an existing class please run the tests locally (using `devtools::load_all(); devtools::test()`) first setting `options(testDownload=TRUE, testSource=class-name)` and report your findings. \n- [ ] If you have added a new data class please run the tests locally for that class (using `devtools::load_all(); devtools::test()`). \n- [ ] Check your code passes our CI checks and review any style and code coverage warnings. \n- [ ] Comment with details if unable to get our CI checks to pass or unable to remove all warnings. \n\nThank you again for the contribution. If making large scale changes consider using our `pre-commit` hooks (see the [contributing guide](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing)) to more easily comply with our guidelines.'})
body: '👋 Thanks for opening this pull request! Can you please run through the following checklist before requesting review (ticking as complete or if not relevant). \n\n - [ ] Read our [contribution guidelines](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing) if you have not already done so. \n- [ ] If you have altered an existing class please run the tests locally (using `devtools::load_all(); devtools::test()`) first setting `options(testDownload=TRUE, testSource=class-name)` and report your findings. \n- [ ] If you have added a new data class please run the tests locally for that class (using `devtools::load_all(); devtools::test()`). \n- [ ] Check your code passes our CI checks and review any style and code coverage warnings. \n- [ ] Comment with details if unable to get our CI checks to pass or unable to remove all warnings. \n- [ ] Update the [news](https://github.com/epiforecasts/covidregionaldata/blob/master/NEWS.md) file with information on your changes (crediting yourself at the same time) \n\nThank you again for the contribution. If making large scale changes consider using our `pre-commit` hooks (see the [contributing guide](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing)) to more easily comply with our guidelines.'})
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Expand Up @@ -2,7 +2,7 @@
# R specific hooks: https://github.com/lorenzwalthert/precommit
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.1.3.9014
rev: v0.2.2.9009
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
Expand Down Expand Up @@ -45,7 +45,7 @@ repos:
- id: no-browser-statement
- id: deps-in-desc
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-added-large-files
args: ['--maxkb=800']
Expand Down
17 changes: 7 additions & 10 deletions DESCRIPTION
Expand Up @@ -25,6 +25,10 @@ Authors@R:
role = "aut",
email = "Hamish.Gibbs@lshtm.ac.uk",
comment = c(ORCID = "0000-0003-4413-453X")),
person(given = "Hugo",
family = "Gruson",
role = "aut",
comment = c(ORCID = "0000-0002-4094-1476")),
person(given = "Sophie",
family = "Meakin",
role = "ctb",
Expand All @@ -51,10 +55,6 @@ Authors@R:
family = "Boyes",
role = "ctb",
comment = c(URL = "https://github.com/rboyes")),
person(given = "Hugo",
family = "Gruson",
role = "ctb",
comment = c(ORCID = "0000-0002-4094-1476")),
person(given = "Vang",
family = "Le",
role = "ctb",
Expand Down Expand Up @@ -93,26 +93,20 @@ Imports:
jsonlite,
lifecycle,
lubridate,
magrittr,
memoise,
purrr,
R6,
readxl,
rlang,
stringi,
stringr,
tibble,
tidyr (>= 1.0.0),
tidyselect,
vroom,
withr,
xml2
Suggests:
ggplot2,
ggspatial,
knitr,
mockery,
pkgdown,
rmarkdown,
rvest,
rworldmap,
Expand All @@ -123,6 +117,9 @@ Suggests:
VignetteBuilder:
knitr
Config/testthat/edition: 3
Config/Needs/website:
r-lib/pkgdown,
amirmasoudabdol/preferably
Encoding: UTF-8
Language: en-gb
LazyData: true
Expand Down
19 changes: 6 additions & 13 deletions NAMESPACE
Expand Up @@ -49,12 +49,14 @@ importFrom(countrycode,countrycode)
importFrom(countrycode,countryname)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,arrange)
importFrom(dplyr,as_tibble)
importFrom(dplyr,bind_rows)
importFrom(dplyr,count)
importFrom(dplyr,distinct)
importFrom(dplyr,do)
importFrom(dplyr,ends_with)
importFrom(dplyr,everything)
importFrom(dplyr,filter)
importFrom(dplyr,full_join)
Expand All @@ -79,6 +81,7 @@ importFrom(dplyr,summarise)
importFrom(dplyr,tally)
importFrom(dplyr,tibble)
importFrom(dplyr,transmute)
importFrom(dplyr,tribble)
importFrom(dplyr,ungroup)
importFrom(dplyr,vars)
importFrom(httr,GET)
Expand All @@ -96,10 +99,10 @@ importFrom(lubridate,month)
importFrom(lubridate,year)
importFrom(lubridate,ymd)
importFrom(lubridate,ymd_hms)
importFrom(magrittr,"%>%")
importFrom(memoise,cache_filesystem)
importFrom(memoise,memoise)
importFrom(purrr,compact)
importFrom(purrr,keep)
importFrom(purrr,map)
importFrom(purrr,map_chr)
importFrom(purrr,map_lgl)
Expand All @@ -114,17 +117,12 @@ 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_conv)
importFrom(stringr,str_detect)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_to_sentence)
importFrom(stringr,str_to_title)
importFrom(tibble,add_column)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(tibble,tribble)
importFrom(stringr,str_trim)
importFrom(tidyr,complete)
importFrom(tidyr,drop_na)
importFrom(tidyr,fill)
Expand All @@ -134,13 +132,8 @@ 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)
importFrom(tidyselect,vars_select_helpers)
importFrom(utils,download.file)
importFrom(utils,untar)
importFrom(vroom,vroom)
importFrom(withr,with_envvar)
importFrom(xml2,xml_find_first)
importFrom(xml2,xml_text)
4 changes: 3 additions & 1 deletion NEWS.md
Expand Up @@ -5,11 +5,13 @@ This release is currently 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 Vietnam (thanks to @biocyberman). See `?Vietname` for details.
* Support for level 1 region data in Vietnam (thanks to @biocyberman). See `?Vietnam` for details.

## Other changes

* Change the data source for Switzerland to draw data from the Swiss Federal Office of Public Health (FOPH)
* Updated the package logo to include the newly supported data sets.
* Reduced the number of package dependencies (@bisaloo and @RichardMN)

## Bug fixes

Expand Down
11 changes: 5 additions & 6 deletions R/Belgium.R
Expand Up @@ -57,13 +57,13 @@ Belgium <- R6::R6Class("Belgium",
source_url = "https://epistat.wiv-isp.be/covid/",

#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble tribble
#' @importFrom dplyr tibble tribble
set_region_codes = function() {
self$codes_lookup$`1` <- tibble::tibble(
self$codes_lookup$`1` <- tibble(
level_1_region_code = c("BE-BRU", "BE-VLG", "BE-WAL"),
level_1_region = c("Brussels", "Flanders", "Wallonia")
)
self$codes_lookup$`2` <- tibble::tribble(
self$codes_lookup$`2` <- tribble(
~level_2_region_code, ~level_2_region, ~level_1_region_code,
"BE-VAN", "Antwerpen", "BE-VLG",
"BE-WBR", "BrabantWallon", "BE-WAL",
Expand All @@ -82,8 +82,7 @@ Belgium <- R6::R6Class("Belgium",

#' @description Downloads data from source and (for Belgium)
#' applies an initial data patch.
#' @importFrom dplyr select mutate filter bind_rows
#' @importFrom tibble tribble
#' @importFrom dplyr select mutate filter bind_rows tribble
download = function() {
# do the actual downloading using the parent download method
super$download()
Expand All @@ -92,7 +91,7 @@ Belgium <- R6::R6Class("Belgium",
# For now, we filter out the broken lines and replace them
# with the following data shim

fixed_lines <- tibble::tribble(
fixed_lines <- tribble(
~DATE, ~PROVINCE, ~REGION, ~AGEGROUP, ~SEX, ~CASES,
"2020-04-22", "Limburg", "Flanders", "50-59", "F", 10,
"2021-02-17", "VlaamsBrabant", "Flanders", "10-19", "M", 12
Expand Down
2 changes: 1 addition & 1 deletion R/Brazil.R
Expand Up @@ -47,7 +47,7 @@ Brazil <- R6::R6Class("Brazil",
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
#' @importFrom dplyr tibble
set_region_codes = function() {
self$codes_lookup <- tibble(
state_name = c(
Expand Down
2 changes: 1 addition & 1 deletion R/Canada.R
Expand Up @@ -44,7 +44,7 @@ Canada <- R6::R6Class("Canada",
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
#' @importFrom dplyr tibble
set_region_codes = function() {
canada_codes <- tibble(
code = c(
Expand Down
1 change: 0 additions & 1 deletion R/Colombia.R
Expand Up @@ -41,7 +41,6 @@ Colombia <- R6::R6Class("Colombia",
source_url = "https://github.com/danielcs88/colombia_covid-19/",

#' @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` <- covidregionaldata::colombia_codes
Expand Down
2 changes: 1 addition & 1 deletion R/Cuba.R
Expand Up @@ -42,7 +42,7 @@ Cuba <- R6::R6Class("Cuba",


#' @description Set up a table of region codes for clean data
#' @importFrom tibble tibble
#' @importFrom dplyr tibble
set_region_codes = function() {
self$codes_lookup$`1` <- tibble(
code = c(
Expand Down

0 comments on commit 808b23e

Please sign in to comment.