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

Develop #250

Merged
merged 83 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c430f4a
Quick fix boxes
GuidoMaggio Mar 15, 2022
246181b
Prepare for new release
GuidoMaggio Mar 15, 2022
e8a0856
Prepare for new release
GuidoMaggio Mar 15, 2022
faa5193
Merge branch 'develop' of https://github.com/miraisolutions/Covid19 i…
GuidoMaggio Mar 16, 2022
b1fa8d5
Feature/217 check provided data (#219)
GuidoMaggio Sep 28, 2022
a888c37
closes #127
GuidoMaggio Sep 28, 2022
790ac1e
updated
GuidoMaggio Sep 28, 2022
a578ee8
updated data
GuidoMaggio Sep 28, 2022
032946d
data update off line
GuidoMaggio Sep 29, 2022
114ffe0
prepare fore next release
GuidoMaggio Sep 29, 2022
6f1ec2c
Bugfix/221 test map in continent (#222)
GuidoMaggio Oct 17, 2022
2ccab62
### Covid19Mirai 2.8.1
GuidoMaggio Oct 17, 2022
bcc5410
update
GuidoMaggio Oct 17, 2022
4d76a9a
Increment version number to 2.8.1.9000
GuidoMaggio Oct 17, 2022
251ed52
Comment
GuidoMaggio Oct 17, 2022
0af4669
Feature/226 upgrade to actions v2 (#227)
GuidoMaggio Nov 2, 2022
f7af9f1
off line update, prep for new release
GuidoMaggio Nov 2, 2022
fc24575
correction deploy
GuidoMaggio Nov 2, 2022
4210c6f
deploy
GuidoMaggio Nov 2, 2022
3f5df52
from master
GuidoMaggio Nov 2, 2022
b05ce89
Prep for next release
GuidoMaggio Nov 2, 2022
8318097
Bug/schedule run not working (#231)
GuidoMaggio Nov 4, 2022
976763a
offline update, resolve merge conflict
GuidoMaggio Nov 4, 2022
07b7c4d
Handle better NAs
GuidoMaggio Nov 29, 2022
79fcd07
Offline data update
GuidoMaggio Nov 29, 2022
1a8be49
Offline update
GuidoMaggio Nov 29, 2022
2208765
prep for next release
GuidoMaggio Nov 29, 2022
a2c8427
Added depandabot yml (#236)
GuidoMaggio Jan 11, 2023
1139ab1
offline update
GuidoMaggio Jan 11, 2023
f4d9261
release prep
GuidoMaggio Jan 11, 2023
7c3d71d
Updated test and data (#240)
GuidoMaggio Feb 1, 2023
b51c844
### Covid19Mirai 2.9.4
GuidoMaggio Feb 1, 2023
8e21d9e
Merge branch 'develop' of https://github.com/miraisolutions/Covid19 i…
GuidoMaggio Feb 1, 2023
603245c
Foxed conflicts
GuidoMaggio Feb 1, 2023
626e333
prep for new release
GuidoMaggio Feb 1, 2023
6864575
check and update of workflow
GuidoMaggio May 15, 2023
1af9b54
resolve conflicts
GuidoMaggio May 15, 2023
a8ba5b5
Increment version number to 2.9.5.9000
GuidoMaggio May 15, 2023
d2cbd10
Feature/246 rsconect must be updated (#247)
GuidoMaggio Aug 22, 2023
84c31bc
- Updated rsconnect (#246)
GuidoMaggio Aug 22, 2023
ea1d49c
forceUpdate = TRUE
GuidoMaggio Aug 22, 2023
5edf2a2
offline update
GuidoMaggio Aug 22, 2023
7c143a7
reinitialized renv
GuidoMaggio Aug 22, 2023
edf4f1a
renv
GuidoMaggio Aug 22, 2023
e909bd8
re-initialized
GuidoMaggio Aug 22, 2023
beafe28
Added sf
GuidoMaggio Aug 22, 2023
0a68014
packagemanager
GuidoMaggio Aug 22, 2023
0c2cf83
install system dependencies
GuidoMaggio Aug 22, 2023
8c3d276
remove install system deps
GuidoMaggio Aug 22, 2023
6d43bf0
4.3.1
GuidoMaggio Aug 22, 2023
d5020fe
dpwngraded ggplot2
GuidoMaggio Aug 22, 2023
daeb299
back to 4.2.1
GuidoMaggio Aug 22, 2023
5f44f64
test deployment
GuidoMaggio Aug 22, 2023
4475125
added rsconnect
GuidoMaggio Aug 23, 2023
6d41e38
add rsconnect to imports
GuidoMaggio Aug 23, 2023
47e589f
v4.3.1
GuidoMaggio Aug 23, 2023
443089c
install system dependencies
GuidoMaggio Aug 23, 2023
3773bd5
removed renvsettings
GuidoMaggio Aug 23, 2023
aec3e80
do not install system deps
GuidoMaggio Aug 23, 2023
037b15c
4.2.1
GuidoMaggio Aug 23, 2023
d11fec4
system deps
GuidoMaggio Aug 23, 2023
49cae04
old workflow
GuidoMaggio Aug 23, 2023
44c2afc
old wf
GuidoMaggio Aug 23, 2023
0dcb454
wf from tech guides
GuidoMaggio Aug 23, 2023
7f051af
no workflow dispatch
GuidoMaggio Aug 23, 2023
f9fd945
options packarat
GuidoMaggio Aug 23, 2023
23bdd6e
testthat
GuidoMaggio Aug 23, 2023
d4801f9
redone lock
GuidoMaggio Aug 23, 2023
2c660f8
pkgmanager posit
GuidoMaggio Aug 23, 2023
b37c8d3
updated terra
GuidoMaggio Aug 23, 2023
e94cb1e
old lock
GuidoMaggio Aug 23, 2023
1e6106b
renv implicit
GuidoMaggio Aug 23, 2023
dd4f201
rsconnect
GuidoMaggio Aug 23, 2023
c0c272e
rsconnect
GuidoMaggio Aug 23, 2023
57296d3
rsconnect update
GuidoMaggio Aug 23, 2023
c9ec928
added packrat
GuidoMaggio Aug 23, 2023
58660f5
removed rgdal
GuidoMaggio Aug 25, 2023
6b853be
REPO CRAN
GuidoMaggio Aug 25, 2023
efebcb3
renv 1.0.0
GuidoMaggio Aug 26, 2023
09cad87
back packrat
GuidoMaggio Aug 28, 2023
9ef32db
rsconnect.packrat = false
GuidoMaggio Aug 28, 2023
18c3070
official deployment
GuidoMaggio Aug 28, 2023
73b0eeb
Merge branch 'master' into develop
GuidoMaggio Aug 28, 2023
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
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
^app\.R$
^man-roxygen$
^\.github$
^deploy$
^rsconnect$
2 changes: 2 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# renv::settings$ignored.packages(c("devtools", "Covid19Mirai"), persist = FALSE)
source("renv/activate.R")

25 changes: 14 additions & 11 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: CI-CD
# renv with GitHub actions: https://rstudio.github.io/renv/articles/ci.html#github-actions

# Triggered on push and pull request events, schedule for data update
on:
push:
pull_request:
schedule:
# every day at 21 UTC
- cron: "0 21 * * *"
name: CI-CD

# renv with GitHub actions: https://rstudio.github.io/renv/articles/ci.html#github-actions


jobs:
CI-CD:
Expand All @@ -29,6 +31,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:

- name: Checkout repo
uses: actions/checkout@v3

Expand All @@ -39,16 +42,16 @@ jobs:
# Enable RStudio Package Manager to speed up package installation
use-public-rspm: true

- name: Activate renv and restore packages with cache
uses: r-lib/actions/setup-renv@v2

# - name: Install system dependencies
# env:
# RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
# # This is not taken care of (yet) by r-lib/actions/setup-renv
# # Package distro used to get the distro for the used ubuntu-latest
# run: |
# Rscript -e "renv::install('r-hub/sysreqs')"
# sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
# sudo -s eval "$sysreqs"
# Rscript -e "install.packages(c('remotes', 'distro'))"
# while read -r cmd
# do
# eval sudo $cmd
# done < <(Rscript -e 'writeLines(with(distro::distro(), remotes::system_requirements(id, short_version)))')

- name: Activate renv and restore packages with cache
uses: r-lib/actions/setup-renv@v2

Expand Down Expand Up @@ -77,7 +80,7 @@ jobs:
git push origin
- name: Deploy to shinyapps.io
# Continuous deployment only for pushes to the main / master branch
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
env:
SHINYAPPS_ACCOUNT: ${{ secrets.SHINYAPPS_ACCOUNT }}
SHINYAPPS_TOKEN: ${{ secrets.SHINYAPPS_TOKEN }}
Expand Down
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,22 @@ Imports:
grid,
leaflet,
leaflet.extras,
rgdal,
shinycssloaders,
lubridate,
sp,
markdown,
scales,
COVID19,
grDevices,
pkgload,
rlang,
zoo
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Suggests:
testthat,
pkgload,
rsconnect
rsconnect,
spelling,
testthat (>= 3.0.0),
sf,
packrat
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export(get_timeseries_global_data)
export(get_timeseries_province_data)
export(get_timeseries_single_data)
export(lab_percent)
export(load_countries_data_map)
export(lw_vars_calc)
export(merge_pop_data)
export(new_total_colors)
Expand Down
5 changes: 3 additions & 2 deletions R/run_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
#' @export
#' @importFrom shiny shinyApp
#' @importFrom golem with_golem_options
#'
run_app <- function(
...
) {
with_golem_options(
app = shinyApp(
ui = app_ui,
ui = app_ui,
server = app_server
),
),
golem_opts = list(...)
)
}
139 changes: 0 additions & 139 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,146 +307,7 @@ new_total_colors <- c(
"new" = "#ea8b5b"
)

#' load countries data
#' @param destpath path to file
#'
#' @returns countries shapefile
#' @export
load_countries_data_map <- function(destpath = system.file("./countries_data", package = "Covid19Mirai")){
# Resource https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/
url <- "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip"
zip_path <- file.path(destpath,"ne_50m_admin_0_countries.zip")
dsn_path <- file.path(destpath, "ne_50m_admin_0_countries")

if (!file.exists(zip_path)) {
download.file(url = url, destfile = zip_path)
unzip(zip_path, exdir = dsn_path)
}

countries <- rgdal::readOGR(dsn = dsn_path,
layer = "ne_50m_admin_0_countries",
encoding = "utf-8", use_iconv = T,
verbose = FALSE)
assign_new_level = function(countrymap , lev, from, to, regexpress = FALSE) {
if (regexpress) {
if (!any(grepl(from, as.character(countrymap[[lev]]))))
stop("wrong expression, not present in map: ", from)
from = grep(from, as.character(countrymap[[lev]]), value = TRUE)
}
if (!any(countrymap[[lev]] == from))
stop("wrong name, not present in map: ", from)
levels(countrymap[[lev]])[levels(countrymap[[lev]])==from] <- to
countrymap[[lev]][countrymap[[lev]] == from] = to
countrymap
}
#rename continents
countries = assign_new_level(countries, "CONTINENT", "North America", "Northern America")
countries = assign_new_level(countries, "CONTINENT", "South America", "LatAm & Carib.")
#rename NAME, i.e. countries
#countries = assign_new_level(countries, "NAME", "Macao", "Macau")
#countries = assign_new_level(countries, "NAME", "Macao", "Macau")
countries = assign_new_level(countries, "NAME", "Macedonia", "North Macedonia")
countries = assign_new_level(countries, "NAME", "Czechia", "Czech Republic")
countries = assign_new_level(countries, "NAME", "Dominican Rep.", "Dominican Republic")
countries = assign_new_level(countries, "NAME", "United Kingdom", "UK")
countries = assign_new_level(countries, "NAME", "United States of America", "USA")
countries = assign_new_level(countries, "NAME", "United Arab Emirates", "UAE")
countries = assign_new_level(countries, "NAME", "^St-Barth", "St. Barth", regexpress = TRUE)
countries = assign_new_level(countries, "NAME", "Faeroe Is.", "Faeroe Islands")
countries = assign_new_level(countries, "NAME", "Bosnia and Herz.", "Bosnia and Herzegovina")
countries = assign_new_level(countries, "NAME", "Vatican", "Vatican City")
countries = assign_new_level(countries, "NAME", "St. Vin. and Gren.", "St. Vincent Grenadines")
countries = assign_new_level(countries, "NAME", "Dem. Rep. Congo", "Republic of the Congo")
#countries = assign_new_level(countries, "NAME", "Central African Rep.", "CAR")
countries = assign_new_level(countries, "NAME", "Ivoire", "Cote d'Ivoire", regexpress = TRUE)
countries = assign_new_level(countries, "NAME", "St-Martin", "St Martin")
countries = assign_new_level(countries, "NAME", "Cayman Is.", "Cayman Islands")
countries = assign_new_level(countries, "NAME", "Eq. Guinea", "Equatorial Guinea")
countries = assign_new_level(countries, "NAME", "Central African Rep.", "CAR")
countries = assign_new_level(countries, "NAME", "eSwatini", "Eswatini")
countries = assign_new_level(countries, "NAME", "Cabo Verde", "Cape Verde")
countries = assign_new_level(countries, "NAME", "S. Sudan", "South Sudan")
countries = assign_new_level(countries, "NAME", "Fr. Polynesia", "French Polynesia")
countries = assign_new_level(countries, "NAME", "Antigua and Barb.", "Antigua and Barbuda")
countries = assign_new_level(countries, "NAME", "Cook Is.", "Cook Islands")
countries = assign_new_level(countries, "NAME", "Falkland Is.", "Falkland Islands")
countries = assign_new_level(countries, "NAME", "U.S. Virgin Is.", "U.S. Virgin Islands")

countries
}

#' load countries data to match with get_datahub
#' @param destpath path to file
#'
#' @returns countries shapefile
#' @noRd
load_countries_datahub_map <- function(destpath = system.file("./countries_data", package = "Covid19Mirai")){
# Resource https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/
url <- "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip"
zip_path <- file.path(destpath,"ne_50m_admin_0_countries.zip")
dsn_path <- file.path(destpath, "ne_50m_admin_0_countries")

if (!file.exists(zip_path)) {
download.file(url = url, destfile = zip_path)
unzip(zip_path, exdir = dsn_path)
}

countries <- rgdal::readOGR(dsn = dsn_path,
layer = "ne_50m_admin_0_countries",
encoding = "utf-8", use_iconv = T,
verbose = FALSE)
assign_new_level = function(countrymap , lev, from, to, regexpress = FALSE) {
if (regexpress) {
if (!any(grepl(from, as.character(countrymap[[lev]]))))
stop("wrong expression, not present in map: ", from)
from = grep(from, as.character(countrymap[[lev]]), value = TRUE)
}
if (!any(countrymap[[lev]] == from))
stop("wrong name, not present in map: ", from)
levels(countrymap[[lev]])[levels(countrymap[[lev]])==from] <- to
countrymap[[lev]][countrymap[[lev]] == from] = to
countrymap
}
#rename continents
countries = assign_new_level(countries, "CONTINENT", "North America", "Northern America")
countries = assign_new_level(countries, "CONTINENT", "South America", "LatAm & Carib.")
#rename NAME, i.e. countries
#countries = assign_new_level(countries, "NAME", "Macao", "Macau")
#countries = assign_new_level(countries, "NAME", "Macao", "Macau")
countries = assign_new_level(countries, "NAME", "Macedonia", "North Macedonia")
countries = assign_new_level(countries, "NAME", "Czechia", "Czech Republic")
countries = assign_new_level(countries, "NAME", "Dominican Rep.", "Dominican Republic")
countries = assign_new_level(countries, "NAME", "United Kingdom", "UK")
countries = assign_new_level(countries, "NAME", "United States of America", "USA")
#countries = assign_new_level(countries, "NAME", "United Arab Emirates", "UAE") # now has new name
countries = assign_new_level(countries, "NAME", "^St-Barth", "St. Barth", regexpress = TRUE) # not needed but ok
countries = assign_new_level(countries, "NAME", "Faeroe Is.", "Faeroe Islands")
countries = assign_new_level(countries, "NAME", "Bosnia and Herz.", "Bosnia and Herzegovina")
countries = assign_new_level(countries, "NAME", "Vatican", "Vatican City")
countries = assign_new_level(countries, "NAME", "St. Vin. and Gren.", "St. Vincent Grenadines")
countries = assign_new_level(countries, "NAME", "Dem. Rep. Congo", "Republic of the Congo")
#countries = assign_new_level(countries, "NAME", "Central African Rep.", "CAR")
countries = assign_new_level(countries, "NAME", "Ivoire", "Cote d'Ivoire", regexpress = TRUE)
countries = assign_new_level(countries, "NAME", "St-Martin", "St Martin")
countries = assign_new_level(countries, "NAME", "Cayman Is.", "Cayman Islands")
countries = assign_new_level(countries, "NAME", "Eq. Guinea", "Equatorial Guinea")
countries = assign_new_level(countries, "NAME", "Central African Rep.", "Central African Republic")
countries = assign_new_level(countries, "NAME", "eSwatini", "Swaziland")
countries = assign_new_level(countries, "NAME", "Cabo Verde", "Cape Verde")
countries = assign_new_level(countries, "NAME", "S. Sudan", "South Sudan")
countries = assign_new_level(countries, "NAME", "Fr. Polynesia", "French Polynesia")
countries = assign_new_level(countries, "NAME", "Antigua and Barb.", "Antigua and Barbuda")
countries = assign_new_level(countries, "NAME", "Cook Is.", "Cook Islands")
countries = assign_new_level(countries, "NAME", "Falkland Is.", "Falkland Islands")
countries = assign_new_level(countries, "NAME", "U.S. Virgin Is.", "U.S. Virgin Islands") # new name
countries = assign_new_level(countries, "NAME", "St. Kitts and Nevis", "Saint Kitts and Nevis" ) # new name
countries = assign_new_level(countries, "NAME", "Principe", "Sao Tome and Principe", regexpress = TRUE )
countries = assign_new_level(countries, "NAME", "N. Mariana Is.", "Northern Mariana Islands")
countries = assign_new_level(countries, "NAME", "Marshall Is.", "Marshall Iselands")
countries = assign_new_level(countries, "NAME", "St. Pierre and Miquelon", "St. Pierre and Miquelon")

countries
}

#' Sort type by max
#'
Expand Down
7 changes: 6 additions & 1 deletion deploy/deploy-shinyapps.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ rsconnect::setAccountInfo(
Sys.getenv("SHINYAPPS_TOKEN"),
Sys.getenv("SHINYAPPS_SECRET")
)

# to be added since rsconnect >1
options(rsconnect.packrat = FALSE)

rsconnect::deployApp(
account = "miraisolutions",
appName = "Covid19",
forceUpdate = TRUE
forceUpdate = TRUE, # to be added since rsconnect >1
quarto = FALSE # to be added since rsconnect >1
# exclude hidden files and renv directory (if present)
# appFiles = setdiff(list.files(), "renv")
)
Loading
Loading