jackwasey / icd

@@ -153,7 +153,6 @@
Loading
153 153
  if (!short_code) {
154 154
    x <- decimal_to_short(x)
155 155
  }
156 -
  # Workaround until next icd.data is on CRAN
157 156
  ia <- get_icd10cm_active()
158 157
  leaf_name <- ifelse("leaf" %in% names(ia), "leaf", "billable")
159 158
  x %in% ia[ia[[leaf_name]] == 1L, "code"]

@@ -70,7 +70,9 @@
Loading
70 70
      )
71 71
    }
72 72
  } # end 400+
73 -
  json_data <- httr::content(http_response, simplifyDataFrame=TRUE)
73 +
  # encoding not specified by WHO resource (as of 2020-06-06).  Be explicit
74 +
  # about assumption.
75 +
  json_data <- httr::content(http_response, type = "text", encoding = "UTF-8")
74 76
  jsonlite::fromJSON(json_data)
75 77
}
76 78

@@ -91,33 +91,6 @@
Loading
91 91
  x
92 92
}
93 93
94 -
#' Internal use only: get data from the icd.data package, without relying on it
95 -
#' being attached
96 -
#'
97 -
#' Some data is hidden in active bindings, so it may be downloaded on demand,
98 -
#' and some is lazy-loaded. This will work for regular package members, active
99 -
#' bindings, and lazy data, whether or not the package is attached or loaded.
100 -
#'
101 -
#' This is really just needed for the transition from icd 3.3 to icd 4.0, and
102 -
#' icd.data > 1.0
103 -
#' @param alt If the data cannot be found, this value is returned. Default is
104 -
#'   \code{NULL}.
105 -
#' @keywords internal
106 -
#' @noRd
107 -
get_icd_data <- function(data_name, alt = NULL) {
108 -
  if (!is.character(data_name)) {
109 -
    data_name <- deparse(substitute(data_name))
110 -
  }
111 -
  ns <- asNamespace("icd")
112 -
  if (exists(data_name, ns)) {
113 -
    return(get(data_name, ns))
114 -
  }
115 -
  if (.exists_in_cache(data_name)) {
116 -
    return(.get_from_cache(data_name))
117 -
  }
118 -
  alt
119 -
}
120 -
121 94
.exists_in_ns <- function(name) {
122 95
  all(vapply(name, .exists_in_ns_single, logical(1), USE.NAMES = FALSE))
123 96
}

@@ -605,7 +605,7 @@
Loading
605 605
    return(.get_fetcher_fun(var_name)())
606 606
  }
607 607
  .absent_action_switch(
608 -
    paste(var_name, "not available in icd.data regular or lazy data")
608 +
    paste(var_name, "not available in icd, even via as-yet-unloaded lazy data")
609 609
  )
610 610
}
611 611

@@ -242,7 +242,7 @@
Loading
242 242
#' \dontrun{
243 243
#' set_icd_data_dir()
244 244
#' # or choose another directory:
245 -
#' # set_icd_data_dir("/var/cache/icd.data")
245 +
#' # set_icd_data_dir("/var/cache/icd")
246 246
#' # If you choose a custom directory, you may wish to add this command to your .Rprofile .
247 247
#' # then you may use:
248 248
#' # download_all_icd_data()
@@ -279,9 +279,12 @@
Loading
279 279
  }
280 280
  if (!dir.exists(path)) {
281 281
    created <- dir.create(path, showWarnings = TRUE, recursive = TRUE)
282 -
    if (!created) stop("Unable to create directory at: ", path, " Try ",
283 -
                       sQuote("set_icd_data_dir(\"/path/with/write/access\")")
284 -
    )
282 +
    if (!created) {
283 +
      stop(
284 +
        "Unable to create directory at: ", path, " Try ",
285 +
        sQuote("set_icd_data_dir(\"/path/with/write/access\")")
286 +
      )
287 +
    }
285 288
  }
286 289
  .set_opt("cache" = path)
287 290
  if (!.all_cached() && "download_all_icd_data" %nin% names(sys.calls())) {

@@ -130,8 +130,9 @@
Loading
130 130
131 131
#' Expand two major codes to a range
132 132
#'
133 -
#' Expand a pair of major codes into a range of major codes. Primarily for use
134 -
#' by \code{icd.data}.
133 +
#' Expand a pair of major codes into a range of major codes.
134 +
#'
135 +
#' Primarily for internal use
135 136
#' @examples
136 137
#' expand_range_major("100", "102")
137 138
#' @template dotdotdot

@@ -25,7 +25,7 @@
Loading
25 25
#'   would find \code{myvar} in the parent environment, and save it as
26 26
#'   \code{myvar.RData} in \code{package_root/data}.
27 27
#' @param compress xz now default, as reasonably close to gzip speed for
28 -
#'   decompression and compression approaching twice as compact archives. 
28 +
#'   decompression and compression approaching twice as compact archives.
29 29
#' @param envir environment in which to look for the variable to save
30 30
#' @return invisibly returns the data
31 31
#' @keywords internal
Files Coverage
R 49.30%
src 87.60%
Project Totals (70 files) 55.27%
1
comment:
2
  layout: "header, diff, tree, changes"
3
  behavior: default
4
  require_changes: true  # only post if coverage changes
5
  branches: null
6
  flags: null
7
  paths: null
8

9
coverage:
10
  status:
11
    project:
12
      default:
13
        target: auto
14
        threshold: 1%
15
    patch:
16
      default:
17
        target: auto
18
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading