Skip to content

Commit

Permalink
More fixes to address CRAN policy violation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Sep 30, 2024
1 parent 5f3b838 commit 9254fa4
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 76 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cff-version: 1.2.0
message: "Matthew P Hamilton (2024). ready4: Develop and Use Modular Health Economic Models. Version 0.1.17.9000. Zenodo. https://doi.org/10.5281/zenodo.5606250"
message: "Matthew P Hamilton (2024). ready4: Develop and Use Modular Health Economic Models. Version 0.1.17.9001. Zenodo. https://doi.org/10.5281/zenodo.5606250"
authors:
- family-names: "Hamilton"
given-names: "Matthew P"
title: "ready4: Develop and Use Modular Health Economic Models"
version: 0.1.17.9000
version: 0.1.17.9001
doi: 10.5281/zenodo.5606250
date-released: 2024-09-30
url: "https://ready4-dev.github.io/ready4/"
31 changes: 11 additions & 20 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Description: A template model module, tools to help find model modules
use it visit <https://www.ready4-dev.com/>. For a background to the
methodological issues that the framework is attempting to help solve,
see Hamilton et al. (2024) <doi:10.1007/s40273-024-01378-8>.
License: GPL-3 + file LICENSE
License: GPL-3
URL: https://ready4-dev.github.io/ready4/,
https://github.com/ready4-dev/ready4, https://www.ready4-dev.com/
Encoding: UTF-8
Expand All @@ -29,8 +29,6 @@ Collate:
'C4_Ready4Module.R'
'C4_Ready4Private.R'
'C4_Ready4Public.R'
'add.R'
'bind.R'
'fn_add.R'
'fn_bind.R'
'fn_get.R'
Expand All @@ -41,11 +39,9 @@ Collate:
'fn_transform.R'
'fn_update.R'
'fn_write.R'
'get.R'
'grp_generics.R'
'imp_fns.R'
'imp_mthds.R'
'make.R'
'mthd_authorSlot.R'
'mthd_characterizeSlot.R'
'mthd_depictSlot.R'
Expand All @@ -62,34 +58,31 @@ Collate:
'mthd_renewSlot.R'
'mthd_shareSlot.R'
'pkg_ready4.R'
'print.R'
'ready4-package.R'
'remove.R'
'rowbind.R'
'transform.R'
'update.R'
'write.R'
Suggests:
devtools,
Hmisc,
knitr,
testthat
pkgload,
readr,
readxl,
rmarkdown,
testthat,
usethis,
zen4R
VignetteBuilder: knitr
Imports:
curl,
dataverse,
devtools,
dplyr,
gh,
Hmisc,
kableExtra,
lifecycle,
magrittr,
methods,
piggyback,
purrr,
readr,
readxl,
rlang,
rmarkdown,
rvest,
stats,
stringi,
Expand All @@ -98,6 +91,4 @@ Imports:
tidyRSS,
tidyselect,
tools,
usethis,
utils,
zen4R
utils
3 changes: 0 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# ready4 (development version)

# ready4 0.1.18
This patch addresses a CRAN policy violation related to unsuccessful internet requests needing to fail gracefully.

# ready4 0.1.17
This patch attempts (unsuccessfully) to address a CRAN policy violation related to unsuccessful internet requests needing to fail gracefully.

Expand Down
18 changes: 11 additions & 7 deletions R/fn_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ get_dv_fls_urls <- function (file_nms_chr, dv_ds_nm_1L_chr, dv_url_pfx_1L_chr =
dv_url_pfx_1L_chr <- paste0("https://", server_1L_chr,
"/api/access/datafile/")
ds_ls <- get_gracefully(dv_ds_nm_1L_chr, fn = dataverse::dataset_files,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr),
not_chr_1L_lgl = TRUE)
if (!is.null(ds_ls)) {
all_items_chr <- purrr::map_chr(ds_ls, ~.x$label)
urls_chr <- file_nms_chr %>% purrr::map_chr(~{
Expand Down Expand Up @@ -456,7 +457,8 @@ get_gh_repos <- function (org_1L_chr)
}
acknowledgement_1L_chr <- "This function is a minor rephrasing of natmanager::list_repo"
repositories_ls <- get_gracefully(paste0("/orgs/", org_1L_chr,
"/repos"), fn = gh::gh, args_ls = list(type = "public"))
"/repos"), fn = gh::gh, args_ls = list(type = "public"),
not_chr_1L_lgl = TRUE)
if (!is.null(repositories_ls)) {
repositories_chr <- vapply(repositories_ls, "[[", "",
"name")
Expand Down Expand Up @@ -524,9 +526,10 @@ get_gracefully <- function (url_1L_chr, args_ls = NULL, fn = readRDS, not_chr_1L
if (identical(tests_chr, character(0))) {
tests_chr <- c("cannot open the connection to ", "unknown input format",
"Attempt to get feed was unsuccessful", "Not Found \\(HTTP 404\\)",
"GitHub API error \\(404\\)", "Cannot access release data for repo",
"HTTP error 404", "Could not resolve host", "Could not parse",
"does not exist in current working directory", "Could not retrieve Dataset ID from persistent identifier",
"GitHub API error \\(404\\)", "Bad Request \\(HTTP 400\\)",
"Cannot access release data for repo", "HTTP error 404",
"Could not resolve host", "Could not parse", "does not exist in current working directory",
"Could not retrieve Dataset ID from persistent identifier",
"Unknown HTTP verb")
}
if (identical(fn, readRDS)) {
Expand Down Expand Up @@ -582,7 +585,7 @@ get_libraries_ls <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_ch
dmt_urls_chr <- dmt_urls_xx
if (any(dmt_urls_chr %>% endsWith("libraries_ls.RDS"))) {
libraries_ls <- get_gracefully(dmt_urls_chr[dmt_urls_chr %>%
endsWith("libraries_ls.RDS")])
endsWith("libraries_ls.RDS")], not_chr_1L_lgl = TRUE)
}
}
return(libraries_ls)
Expand Down Expand Up @@ -773,7 +776,8 @@ get_rds_from_dv <- function (file_nm_1L_chr, dv_ds_nm_1L_chr = "https://doi.org/
dv_url_pfx_1L_chr <- paste0("https://", server_1L_chr,
"/api/access/datafile/")
ds_ls <- get_gracefully(dv_ds_nm_1L_chr, fn = dataverse::dataset_files,
args_ls = list(server = server_1L_chr, key = key_1L_chr))
args_ls = list(server = server_1L_chr, key = key_1L_chr),
not_chr_1L_lgl = TRUE)
if (!is.null(ds_ls)) {
all_items_chr <- purrr::map_chr(ds_ls, ~.x$label) %>%
stringi::stri_replace_last_regex("\\.RDS", "") %>%
Expand Down
15 changes: 10 additions & 5 deletions R/fn_make.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ make_datasets_tb <- function (dv_nm_1L_chr = "ready4", dvs_tb = NULL, filter_cdn
type_1L_chr <- match.arg(type_1L_chr)
if (is.null(dvs_tb)) {
contents_ls <- get_gracefully(dv_nm_1L_chr, fn = dataverse::dataverse_contents,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr),
not_chr_1L_lgl = TRUE)
if (!is.null(contents_ls)) {
dv_ls <- contents_ls[contents_ls %>% purrr::map_lgl(~.x$type ==
"dataverse")]
Expand All @@ -218,19 +219,22 @@ make_datasets_tb <- function (dv_nm_1L_chr = "ready4", dvs_tb = NULL, filter_cdn
}
else {
extra_dv_ls <- get_gracefully(dv_nm_1L_chr, fn = dataverse::get_dataverse,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr),
not_chr_1L_lgl = TRUE)
dv_ls <- append(extra_dv_ls, dv_ls)
}
dvs_tb <- dv_ls %>% purrr::map_dfr(~{
dv_ls <- get_gracefully(.x, fn = dataverse::get_dataverse,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr),
not_chr_1L_lgl = TRUE)
tb <- tibble::tibble(Dataverse = dv_ls$alias,
Name = dv_ls$name, Description = dv_ls$description,
Creator = dv_ls$affiliation)
tb %>% dplyr::mutate(Contents = purrr::map(.data$Dataverse,
~{
dv_all_ls <- get_gracefully(.x, fn = dataverse::dataverse_contents,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr),
not_chr_1L_lgl = TRUE)
dv_all_ls[dv_all_ls %>% purrr::map_lgl(~.x$type ==
"dataset")] %>% purrr::map_chr(~if ("persistentUrl" %in%
names(.x)) {
Expand Down Expand Up @@ -326,7 +330,8 @@ make_ds_releases_tbl <- function (ds_dois_chr, format_1L_chr = "%d-%b-%Y", key_1
{
ds_releases_xx <- ds_dois_chr %>% purrr::map_dfr(~{
meta_ls <- get_gracefully(.x, fn = dataverse::dataset_versions,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr),
not_chr_1L_lgl = TRUE)
if (is.null(meta_ls)) {
NULL
}
Expand Down
15 changes: 10 additions & 5 deletions R/fn_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ write_dv_fl_to_loc <- function (ds_url_1L_chr = character(0), dest_path_1L_chr,
ds_url_1L_chr <- ds_ui_1L_chr
}
}
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset)
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset,
not_chr_1L_lgl = TRUE)
if (!is.null(ds_ls)) {
if (ds_ls$versionState != "DRAFT") {
if (!is.na(fl_id_1L_int)) {
Expand Down Expand Up @@ -332,7 +333,8 @@ write_env_objs_to_dv <- function (env_objects_ls, descriptions_chr, ds_url_1L_ch
NULL
})
if (is.null(ds_ls)) {
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset)
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset,
not_chr_1L_lgl = TRUE)
}
}
}
Expand Down Expand Up @@ -559,7 +561,8 @@ write_fls_to_dv <- function (file_paths_chr, ds_url_1L_chr, consent_1L_chr = "",
descriptions_chr, ds_ls, key_1L_chr, server_1L_chr) {
ids_int <- NULL
if (is.null(ds_ls))
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset)
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset,
not_chr_1L_lgl = TRUE)
if (!is.null(ds_ls)) {
is_draft_1L_lgl <- ds_ls$versionState == "DRAFT"
nms_chr <- ds_ls$files$filename
Expand Down Expand Up @@ -1274,7 +1277,8 @@ write_to_dv_from_tbl <- function (files_tb, ds_url_1L_chr, consent_1L_chr = "",
consented_fn <- function(files_tb, consent_indcs_int, data_dir_rt_1L_chr,
ds_url_1L_chr, key_1L_chr, options_chr, server_1L_chr) {
fl_ids_int <- NULL
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset)
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset,
not_chr_1L_lgl = TRUE)
if (!is.null(ds_ls)) {
is_draft_1L_lgl <- ds_ls$versionState == "DRAFT"
nms_chr <- ds_ls$files$filename
Expand Down Expand Up @@ -1368,7 +1372,8 @@ write_to_dv_with_wait <- function (dss_tb, dv_nm_1L_chr, ds_url_1L_chr, parent_d
ds_url_1L_chr = ds_url_1L_chr, key_1L_chr = key_1L_chr,
options_chr = options_chr, server_1L_chr = server_1L_chr)
})
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset)
ds_ls <- get_gracefully(ds_url_1L_chr, fn = dataverse::get_dataset,
not_chr_1L_lgl = TRUE)
if (!is.null(ds_ls)) {
if (make_local_copy_1L_lgl | ds_ls$versionState !=
"DRAFT") {
Expand Down
15 changes: 13 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Test environments

* Local Windows (mingw32), R 4.3.1 [1 WARNING generated]
* Local Windows (mingw32), R version 4.4.1 (2024-06-14 ucrt) [1 WARNING generated]
* Mac OS macos-13 (R-hub action at https://github.com/ready4-dev/ready4/actions/runs/9800145754/job/27061585744)
* Windows windows-latest (R-hub action at https://github.com/ready4-dev/ready4/actions/runs/9800145754/job/27061585842)
* Fedora Linux 38 R Under development (unstable) gcc13 (R-hub action at https://github.com/ready4-dev/ready4/actions/runs/9800145754/job/27061585644)
Expand All @@ -10,7 +10,18 @@

There was 1 WARNING (on Local Windows).

- 'qpdf' is needed for checks on size reduction of PDFs
Maintainer: 'Matthew Hamilton <matthew.hamilton1@monash.edu>'

New submission

Package was archived on CRAN

Version contains large components (0.1.17.9000)

CRAN repository db overrides:
X-CRAN-Comment: Archived on 2024-08-20 for policy violation

On Internet access

---

Expand Down
9 changes: 5 additions & 4 deletions data-raw/fns/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ get_dv_fls_urls <- function(file_nms_chr,
server_1L_chr,
"/api/access/datafile/")
ds_ls <- get_gracefully(dv_ds_nm_1L_chr, fn = dataverse::dataset_files,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr), not_chr_1L_lgl = TRUE)
if(!is.null(ds_ls)){
all_items_chr <- purrr::map_chr(ds_ls,~.x$label)
urls_chr <- file_nms_chr %>%
Expand Down Expand Up @@ -319,7 +319,7 @@ get_gh_repos <- function (org_1L_chr) {
stop("gh package is required - please install it and rerun the last command.")
}
acknowledgement_1L_chr <- "This function is a minor rephrasing of natmanager::list_repo"
repositories_ls <- get_gracefully(paste0("/orgs/", org_1L_chr, "/repos"), fn = gh::gh, args_ls=list(type = "public"))
repositories_ls <- get_gracefully(paste0("/orgs/", org_1L_chr, "/repos"), fn = gh::gh, args_ls=list(type = "public"), not_chr_1L_lgl = TRUE)
if(!is.null(repositories_ls)){
repositories_chr <- vapply(repositories_ls, "[[", "", "name")
}else{
Expand All @@ -338,6 +338,7 @@ get_gracefully <- function(url_1L_chr,
"Attempt to get feed was unsuccessful",
"Not Found \\(HTTP 404\\)",
"GitHub API error \\(404\\)",
"Bad Request \\(HTTP 400\\)",
"Cannot access release data for repo",
"HTTP error 404",
"Could not resolve host",
Expand Down Expand Up @@ -382,7 +383,7 @@ get_libraries_ls <- function(gh_repo_1L_chr = "ready4-dev/ready4",
if(!is.null(dmt_urls_xx)){
dmt_urls_chr <- dmt_urls_xx
if(any(dmt_urls_chr %>% endsWith("libraries_ls.RDS"))){
libraries_ls <- get_gracefully(dmt_urls_chr[dmt_urls_chr %>% endsWith("libraries_ls.RDS")])
libraries_ls <- get_gracefully(dmt_urls_chr[dmt_urls_chr %>% endsWith("libraries_ls.RDS")], not_chr_1L_lgl = TRUE)
}
}
return(libraries_ls)
Expand Down Expand Up @@ -494,7 +495,7 @@ get_rds_from_dv <- function(file_nm_1L_chr,
server_1L_chr,
"/api/access/datafile/")
ds_ls <- get_gracefully(dv_ds_nm_1L_chr, fn = dataverse::dataset_files,
args_ls = list(server = server_1L_chr, key = key_1L_chr))
args_ls = list(server = server_1L_chr, key = key_1L_chr), not_chr_1L_lgl = TRUE)
if(!is.null(ds_ls)){
all_items_chr <- purrr::map_chr(ds_ls,~.x$label) %>%
stringi::stri_replace_last_regex("\\.RDS","") %>%
Expand Down
10 changes: 5 additions & 5 deletions data-raw/fns/make.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,22 @@ make_datasets_tb <- function(dv_nm_1L_chr = "ready4",
type_1L_chr <- match.arg(type_1L_chr)
if(is.null(dvs_tb)){
contents_ls <- get_gracefully(dv_nm_1L_chr, fn = dataverse::dataverse_contents,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr), not_chr_1L_lgl = TRUE)
if(!is.null(contents_ls)){
dv_ls <- contents_ls[contents_ls %>% purrr::map_lgl(~.x$type == "dataverse")]
ds_ls <- contents_ls[contents_ls %>% purrr::map_lgl(~.x$type == "dataset")]
if(identical(ds_ls,list())){
ds_ls <- NULL
}else{
extra_dv_ls <- get_gracefully(dv_nm_1L_chr, fn = dataverse::get_dataverse,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr), not_chr_1L_lgl = TRUE)
dv_ls <- append(extra_dv_ls,
dv_ls)
}
dvs_tb <- dv_ls %>%
purrr::map_dfr(~{
dv_ls <- get_gracefully(.x, fn = dataverse::get_dataverse,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr), not_chr_1L_lgl = TRUE)
tb <- tibble::tibble(Dataverse = dv_ls$alias,
Name = dv_ls$name,
Description = dv_ls$description,
Expand All @@ -157,7 +157,7 @@ make_datasets_tb <- function(dv_nm_1L_chr = "ready4",
dplyr::mutate(Contents = purrr::map(.data$Dataverse,
~{
dv_all_ls <- get_gracefully(.x, fn = dataverse::dataverse_contents,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr), not_chr_1L_lgl = TRUE)
#dv_ls <- dv_all_ls[dv_all_ls %>% purrr::map_lgl(~.x$type == "dataverse")]
dv_all_ls[dv_all_ls %>% purrr::map_lgl(~.x$type == "dataset")] %>%
purrr::map_chr(~if("persistentUrl" %in% names(.x)){
Expand Down Expand Up @@ -248,7 +248,7 @@ make_ds_releases_tbl <- function (ds_dois_chr,
{
ds_releases_xx <- ds_dois_chr %>% purrr::map_dfr(~{
meta_ls <- get_gracefully(.x, fn = dataverse::dataset_versions,
args_ls = list(key = key_1L_chr, server = server_1L_chr))
args_ls = list(key = key_1L_chr, server = server_1L_chr), not_chr_1L_lgl = TRUE)
if(is.null(meta_ls)){
NULL
}else{
Expand Down
Loading

0 comments on commit 9254fa4

Please sign in to comment.