Skip to content
New issue

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

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

Already on GitHub? # to your account

r 4.0 (r-devel) changes #192

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
cf51a80
Updated location of LIBCIM10MULTI.TXT
patrickmdnet Mar 1, 2020
f7a1905
Fix error on memoising JsonGetRootConcepts
patrickmdnet Mar 1, 2020
8cd9fe5
change system.file to fail fast if directory cannot be located
patrickmdnet Mar 1, 2020
39d9cca
change raw to cache for icd10be
patrickmdnet Mar 1, 2020
a8b4a73
use httr::content to properly handle UTF-8
patrickmdnet Mar 1, 2020
3a3347b
remove stringsAsFactors argument
patrickmdnet Mar 1, 2020
5badf21
export categorize_simple
patrickmdnet Mar 1, 2020
ddd1fac
Update NAMESPACE
patrickmdnet Mar 1, 2020
6bf2f84
add R_REMOTES_STANDALONE=true to fix appveyor curl error
patrickmdnet Mar 2, 2020
aefd696
revert stringsToFactor change
patrickmdnet Mar 2, 2020
7eab1a5
update test to succeed in a stringsAsFactors=FALSE environment
patrickmdnet Mar 2, 2020
37f7e46
fix typos
patrickmdnet Mar 2, 2020
6b8c7a5
move data-raw to inst directory
patrickmdnet Mar 2, 2020
192a0e5
attempt to fix "non-portable flag(s)" error on 3.6.2 travis build
patrickmdnet Mar 2, 2020
df80a40
updated URL
patrickmdnet Mar 13, 2020
92a528c
Merge remote-tracking branch 'upstream/master'
patrickmdnet Mar 13, 2020
4b420cf
use httr::content to properly handle UTF-8
patrickmdnet Mar 1, 2020
214c625
remove stringsAsFactors argument
patrickmdnet Mar 1, 2020
18c6017
export categorize_simple
patrickmdnet Mar 1, 2020
3465a2a
Update NAMESPACE
patrickmdnet Mar 1, 2020
28b1555
add R_REMOTES_STANDALONE=true to fix appveyor curl error
patrickmdnet Mar 2, 2020
5d0a4b0
revert stringsToFactor change
patrickmdnet Mar 2, 2020
fc6c099
fix typos
patrickmdnet Mar 2, 2020
1d533d2
move data-raw to inst directory
patrickmdnet Mar 2, 2020
bc6fdcd
attempt to fix "non-portable flag(s)" error on 3.6.2 travis build
patrickmdnet Mar 2, 2020
6a243e8
updated URL
patrickmdnet Mar 13, 2020
f9c5ba8
Merge branch 'r40' of https://github.com/patrickmdnet/icd into r40
patrickmdnet Mar 13, 2020
ccd8d05
fix typo
patrickmdnet Mar 13, 2020
b77f5a3
revert _R_CHECK_COMPILATION_FLAGS_=TRUE change
patrickmdnet Mar 13, 2020
5be5632
use httr::content to properly handle UTF-8
patrickmdnet Mar 1, 2020
eadddc2
remove stringsAsFactors argument
patrickmdnet Mar 1, 2020
03dbbf4
export categorize_simple
patrickmdnet Mar 1, 2020
a11f8cd
Update NAMESPACE
patrickmdnet Mar 1, 2020
7ac9451
add R_REMOTES_STANDALONE=true to fix appveyor curl error
patrickmdnet Mar 2, 2020
2bbdf54
revert stringsToFactor change
patrickmdnet Mar 2, 2020
cb3b348
fix typos
patrickmdnet Mar 2, 2020
24afec4
move data-raw to inst directory
patrickmdnet Mar 2, 2020
dd85169
attempt to fix "non-portable flag(s)" error on 3.6.2 travis build
patrickmdnet Mar 2, 2020
8461d8d
updated URL
patrickmdnet Mar 13, 2020
44dbc61
remove stringsAsFactors argument
patrickmdnet Mar 1, 2020
494810e
revert stringsToFactor change
patrickmdnet Mar 2, 2020
192bfbc
fix typos
patrickmdnet Mar 2, 2020
b33b1a1
fix typo
patrickmdnet Mar 13, 2020
12a77be
revert _R_CHECK_COMPILATION_FLAGS_=TRUE change
patrickmdnet Mar 13, 2020
d294cdc
Merge branch 'r40' of https://github.com/patrickmdnet/icd into r40
patrickmdnet Mar 28, 2020
17e6f9b
add qpdf
patrickmdnet Mar 28, 2020
c7045ed
try biarch true for remote builds/tests, e.g. rhub; redocumented with…
Mar 18, 2020
00e04b8
fix conflict
patrickmdnet Mar 28, 2020
71c1cd7
resolve conflict
patrickmdnet Mar 28, 2020
7016721
add qpdf to packages
patrickmdnet Mar 28, 2020
24cb44d
fix conflict
patrickmdnet Mar 28, 2020
1df316c
fix conflict
patrickmdnet Mar 28, 2020
570acbd
add qpdf
patrickmdnet Mar 28, 2020
eb82ba5
set R_QPDF
patrickmdnet Mar 29, 2020
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: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
^data-raw$
^doc$
^docs$
^Dockerfile$
^icd.*\.out$
^icd\.Rcheck$
^icd_.*tar\.gz
Expand Down
162 changes: 75 additions & 87 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language: r
# https://docs.travis-ci.com/user/ci-environment/

# for RcppEigen to compile, (but disable if brew gcc on mac to avoid conflict)
# fortran: true # set explicitly in each stanza
# fortran: true # set explicitly in each stanza? but not recognized by an "include" group.

# may need this for clang:
# export LD_LIBRARY_PATH=/usr/local/clang/lib:$LD_LIBRARY_PATH
Expand All @@ -16,15 +16,18 @@ language: r
#
# https://docs.travis-ci.com/user/languages/cpp/

sudo: false
# assert the defaults for os and dist - will add macos and bionic etc. later
os: linux
dist: xenial

cache:
- packages
- ccache

addons:
apt:
packages:
- valgrind
#addons:
# apt:
# packages:
# - valgrind # when I do do this (probably too slow for travis anyway, then just put the apt addon in the specific build)
#- r-cran-tinytex

#r_packages:
Expand All @@ -36,103 +39,60 @@ cran: https://cloud.r-project.org
r_check_args: ""
warnings_are_errors: true

# try to speed up compilation time
before_install:
# - set -o allexport; source tools/env/travis-global; set +o allexport;
# May need to set the R library directory so R CMD check finds packages
# installed by travis (automatically, and in my scripts) and by R itself
# https://stackoverflow.com/questions/31879011/r-cant-find-packages-installed-by-travis
# - mkdir -p "$HOME/R.icd.lib"
# - echo R_LIBS=$HOME/R.icd.lib:/usr/lib/R/site-library/" > ~/.Renviron
# - sudo chmod 2777 "$HOME/R.icd.lib"
#
# Work-around r-lib/remotes bug which prevents travis building.
# https://github.com/r-lib/devtools/issues/2020#issuecomment-481219296
- Rscript -e 'source("https://install-github.me/r-lib/remotes")'
# ready for Makevars
- mkdir -p ~/.R ;
- echo 'CXXFLAGS=-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option' >> ~/.R/Makevars ;
- echo 'CXX11FLAGS=-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option' >> ~/.R/Makevars ;
- if [[ "$TRAVIS_R_VERSION_STRING" = 'devel' ]]; then
echo 'CFLAGS=-O0' >> ~/.R/Makevars ;
echo 'CXXFLAGS=-O0' >> ~/.R/Makevars ;
echo 'CXX11FLAGS=-O0' >> ~/.R/Makevars ;
fi
# ignore the stubs for the pre-built vignettes, as the latex environments on
# travis are heterogeneous!
- if [[ $TRAVIS_R_VERSION_STRING == devel ]]; then cat tools/mk/travis-debug.mk >> ~/.R/Makevars; fi;
# this is one of oldrel, release or devel per https://docs.travis-ci.com/user/languages/r#configuration-options
- cat tools/mk/travis-nowarn.mk >> ~/.R/Makevars
# ignore the stubs for the pre-built vignettes, as the latex environments on travis are heterogeneous!
- echo '^vignettes\/.*-vignette\.Rnw$' >> .Rbuildignore
# Homebrew GCC currently version 8.3 from

# https://github.com/Homebrew/homebrew-core/blob/master/Formula/gcc.rb
- if [[ "$(uname -s)" = 'Darwin' && x"$ICD_USE_XCODE_CLANG" != 'xtrue' ]]; then
brew upgrade gcc;
command -v g++-9 >/dev/null 2>&1 || brew install gcc && echo 'CC=gcc-9' >> ~/.R/Makevars && echo 'CXX=g++-9' >> ~/.R/Makevars && echo 'CXX11=g++-9' >> ~/.R/Makevars && Rscript -e 'install.packages("Rcpp", type = "source")';
# I think PKG_CXX etc only needed if Makevars in the package itself, not ~/.R/Makevars
# openblas may need brew linking. may be best NOT to overwrite gfortran?
- export HOMEBREW_NO_INSTALL_CLEANUP=1 && if [[ "$(uname -s)" = 'Darwin' ]] && [[ $ICD_USE_XCODE_CLANG != 'true' ]]; then
brew upgrade ;
brew install gcc ;
brew link --overwrite gcc ;
cat tools/mk/travis-macos.mk >> ~/.R/Makevars ;
Rscript -e 'install.packages("Rcpp", type = "source")' ;
fi
- cat ~/.R/Makevars
- cat .Rbuildignore
- Rscript -e '.libPaths()'
- Rscript -e '.libPaths(); getOption("repos")'
- pwd
- ls -R
# for the pre-built static vignette stubs to include the actual vignettes.
# Make sure travis latex option is not false for relevant builds.
# - Rscript -e 'if (!require("tinytex")) {quit(status=1)} else {tinytex::install_tinytex(); tinytex::tlmgr_install("pdfpages", "ae")}' || hash tlmgr 2>/dev/null && { tlmgr --usermode install pdfpages ae; }
# Make sure travis latex: true is set just for relevant builds. Official way to add latex packages is:
# before_install:
# - tlmgr install index
# and/or? something like:
# - Rscript -e 'if (!require("tinytex", character.only = TRUE, quietly = TRUE, warn.conflicts = FALSE)) {quit(status=1)} else {tinytex::install_tinytex(); tinytex::tlmgr_install("pdfpages", "ae")}' || hash tlmgr 2>/dev/null && { tlmgr --usermode install pdfpages ae; }

env:
global:
- _R_CHECK_CRAN_INCOMING_=FALSE
- _R_CHECK_CRAN_INCOMING_REMOTE_=FALSE
- _R_CHECK_FORCE_SUGGESTS_=FALSE
- _R_CHECK_USE_INSTALL_LOG_=TRUE
- _R_CHECK_LENGTH_1_CONDITION_="verbose,abort"
- _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort"
- _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE
# some of the following are ignored if --as-cran is set
- _R_CHECK_COMPILATION_FLAGS_=FALSE
- _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option"
# the following are to simulate cran, and
# help debugging if we didn't use --as-cran
- _R_CHECK_ALL_NON_ISO_C_=TRUE
- _R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=TRUE
- _R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE
- _R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE"
- _R_CHECK_EXIT_ON_FIRST_ERROR_=FALSE
- _R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE
- _R_CHECK_NO_STOP_ON_TEST_ERROR_=TRUE
- _R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE
- _R_CHECK_RD_LINE_WIDTHS_=true
- _R_CHECK_TESTS_NLINES_=0
- _R_CHECK_USE_INSTALL_LOG_=TRUE
- _R_CHECK_VIGNETTES_NLINES_=0
- _R_CHECK_PKG_SIZES_THRESHOLD_=50
- ICD_COVERAGE=false
- ICD_MINI_BENCH=false
- ICD_DATA_VERBOSE=true
- ICD_DATA_OFFLINE=true
- ICD_DATA_INTERACT=false
# 4 is the official travis suggestion, but the docker images only seem to
# have access to two cores/threads.
- OMP_NUM_THREADS=2
#env: # global: instead of defining here, source tools/env/travis-global

matrix:
jobs:
fast_finish: true
include:
- r: devel
os: linux
dist: xenial
compiler:
- gcc
- clang
dist: bionic
# note that the default compilers are quite far behind, e.g. bionic is only gcc 7 by default. See:
# https://docs.travis-ci.com/user/languages/c/#choosing-compilers-to-test-against
compiler: gcc
env:
- ICD_MINI_BENCH=true
- r: release
os: linux
compiler:
- gcc
- clang
dist: xenial
compiler: clang
dist: bionic
env:
- ICD_MINI_BENCH=true
# https://docs.travis-ci.com/user/languages/c/#gcc-on-macos
- r: release
os: linux
compiler: gcc
latex: false
r_build_args: --no-build-vignettes --no-manual --resave-data=no
Expand All @@ -142,48 +102,68 @@ matrix:
- ICD_MINI_BENCH=false
- ICD_TEST_SLOW=true
- r: oldrel
os: linux
dist: trusty
compiler: gcc
latex: false
r_build_args: --no-build-vignettes --no-manual --resave-data=no
r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual
# MacOS:
# MacOS: https://docs.travis-ci.com/user/languages/c/#gcc-on-macos
- r: release
os: osx
# xcode image is needed so things like _stdio.h are available to GCC.
osx_image: xcode10.1
osx_image: xcode10.3
# compiler: gcc # redundant: done by logic in before_intall
fortran: false
addons:
homebrew:
packages:
- checkbashisms
env:
- ICD_MINI_BENCH=true
- r: devel
os: osx
osx_image: xcode10.2
osx_image: xcode10.3
addons:
homebrew:
packages:
- checkbashisms
# compiler: gcc # redundant: done by logic in before_intall
fortran: false
- r: devel
os: osx
addons:
homebrew:
packages:
- checkbashisms
# as of May 2019, default osx image is 9.4.1
# https://docs.travis-ci.com/user/reference/osx#xcode-version
# compiler: clang # redundant
fortran: true
env: ICD_USE_XCODE_CLANG=true
- r: release
os: osx
addons:
homebrew:
packages:
- checkbashisms
# compiler: clang # redundant
fortran: true
latex: false
r_build_args: --no-build-vignettes --no-manual --resave-data=no
r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual
env:
- ICD_USE_XCODE_CLANG=true
- ICD_MINI_BENCH=true
- r: release
arch: arm64
r_build_args: --no-build-vignettes --no-manual --resave-data=no
r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual
env:
- ICD_MINI_BENCH=true
- ICD_TEST_SLOW=true
allow_failures:
# allow any osx to fail for now: error prone tool chain
- os: osx
- arch: arm64
- arch: ppc64le
- arch: s390x
- r: oldrel
- r: release
os: linux
latex: false
r_build_args: --no-build-vignettes --no-manual --resave-data=no
r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual
Expand All @@ -193,6 +173,14 @@ matrix:
- ICD_TEST_SLOW=true

before_script:
# n.b., before_install bash exports are not preserved beyond each shell invocation.
- set -o allexport; source tools/env/travis-global; set +o allexport;
- set
- echo "$LD_LIBRARY_PATH"
# qpdf debugging start
- which qpdf || true
- which gs || true
# qpdf debugging end
- if [ x"$ICD_TEST_SLOW" = x"true" ]; then
Rscript -e 'source("tools/split-tests.R"); testthat_split();';
fi
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ LinkingTo:
RcppEigen
VignetteBuilder:
knitr
Biarch: true
Classification/ACM-2012: Social and professional topics~Medical
records, Applied computing~Health care information systems, Applied
computing~Health informatics, Applied computing~Bioinformatics
Expand All @@ -79,4 +80,4 @@ Encoding: UTF-8
Language: en-US
LazyData: true
LazyDataCompression: xz
RoxygenNote: 7.0.2
RoxygenNote: 7.1.0
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export(as.icd_long_data)
export(as.icd_short_diag)
export(as.icd_wide_data)
export(as.short_diag)
export(categorize_simple)
export(chapters_to_map)
export(charlson)
export(charlson_from_comorbid)
Expand Down
1 change: 1 addition & 0 deletions R/categorize.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#' u$icd10 <- decimal_to_short(u$icd10)
#' j <- icd:::categorize_simple(u, m, id_name = "case", code_name = "icd10")
#' @keywords internal
#' @export
categorize_simple <- function(x,
map,
id_name,
Expand Down
2 changes: 1 addition & 1 deletion R/cim-10-fr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"https://www.atih.sante.fr",
"plateformes-de-transmission-et-logiciels",
"logiciels-espace-de-telechargement",
"telecharger/gratuit/11616/456"
"telecharger/gratuit/13332/456"
),
file_name = "LIBCIM10MULTI.TXT",
dl_msg = "Working on ICD-10-FR (CIM-10-FR)",
Expand Down
8 changes: 4 additions & 4 deletions R/icd10be.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
...) {
site_file_2017 <-
"fy2017_reflist_icd-10-be.xlsx_last_updatet_28-07-2017_1.xlsx"
fnp <- .download_to_data_raw(
fnp <- .download_to_data_cache(
paste(.icd10be_site,
.icd10be_url_path,
site_file_2017,
Expand All @@ -28,7 +28,7 @@
}
site_file <- "fy2014_reflist_icd-10-be.xlsx"
.msg("Downloading or getting cached icd10be2014 data")
.download_to_data_raw(
.download_to_data_cache(
paste(.icd10be_site,
.icd10be_url_path,
site_file,
Expand Down Expand Up @@ -58,7 +58,7 @@
#' \url{https://www.health.belgium.be/sites/default/files/uploads/fields/fpshealth_theme_file/fy2017_reflist_icd-10-be.xlsx_last_updatet_28-07-2017_1.xlsx}
# nolint end
#' \url{https://www.health.belgium.be/fr/fy2014reflisticd-10-bexlsx}
#' @param ... passed to \code{.download_to_data_raw}, e.g., \code{offline =
#' @param ... passed to \code{.download_to_data_cache}, e.g., \code{offline =
#' FALSE}.
#' @seealso \code{link{parse_icd10be2014_be}}
#' @keywords internal
Expand Down Expand Up @@ -133,7 +133,7 @@
#' \url{https://www.health.belgium.be/fr/sante/organisation-des-soins-de-sante/hopitaux/systemes-denregistrement/icd-10-be}
# nolint end
#' \url{https://www.health.belgium.be/fr/fy2014reflisticd-10-bexlsx}
#' @param ... passed to \code{.download_to_data_raw}, e.g., \code{offline =
#' @param ... passed to \code{.download_to_data_cache}, e.g., \code{offline =
#' FALSE}.
#' @seealso \code{link{parse_icd10be2014_be}}
#' @keywords internal
Expand Down
2 changes: 1 addition & 1 deletion R/util-file.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
#' @param url URL of a zip file
#' @param file_name file name of the resource within the zip file
#' @param save_path file path to save the first file from the zip
#' @param insecure Logical value, wil disable certificate check which fails on
#' @param insecure Logical value, will disable certificate check which fails on
#' some platforms for some ICD data from CDC and CMS, probably because of TLS
#' version or certificate key length issues. Default is \code{TRUE}.
#' @param ... additional arguments passed to \code{utils::download.file}
Expand Down
3 changes: 2 additions & 1 deletion R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ capitalize_first <- function(x) {
#' @noRd
#' @keywords internal
get_raw_data_dir <- function() {
system.file("data-raw", package = "icd")
# use mustWork = TRUE to throw an error if the directory is not found
system.file("data-raw", package = "icd", mustWork = TRUE)
}

.stopifnot_year <- function(year) {
Expand Down
7 changes: 3 additions & 4 deletions R/who.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# memoise package has given me problems and crashes. DIY
mem_file_name <- paste(
"WHO", year, lang,
gsub("JsonGetChildrenConcepts\\?ConceptId=|&useHtml=false", "", resource),
gsub("JsonGetChildrenConcepts\\?ConceptId=|(&|\\?)useHtml=false", "", resource),
"json",
sep = "."
)
Expand Down Expand Up @@ -70,8 +70,7 @@
)
}
} # end 400+
json_data <- rawToChar(http_response$content)
jsonlite::fromJSON(json_data)
httr::content(http_response, simplifyDataFrame=TRUE)
}

#' Use WHO API to discover chapters
Expand All @@ -91,7 +90,7 @@
}

#' Get the children of a concept (ICD-10 chapter, code or range)
#' @param concept_id NULl for root, concept string for any leaf or intermediate.
#' @param concept_id NULL for root, concept string for any leaf or intermediate.
#' @examples
#' .dl_icd10who_children("XXII")
#' .dl_icd10who_children("U84")
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ build_script:

environment:
# APPVEYOR_CACHE_SKIP_RESTORE: true
R_REMOTES_STANDALONE: true
WARNINGS_ARE_ERRORS: 1
_R_CHECK_EXIT_ON_FIRST_ERROR_: true
USE_RTOOLS: true
Expand Down
Loading