Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* exclusions for less severer conditions when more severer conditions are flagged
* Improved POA, NPOA, and EXEMPTPOA. This came about from #20.

* Make internal data.frame tool `mdcr_duplicated` data.table aware.

* Elixhauser (Quan 2005) - added missing ICD-10 codes to the mappings

## New Features

* `comorbidities()` will return a `tibble` with the input data is a `tbl_df`
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
5 changes: 4 additions & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ mdcr_setnames <- function(x, old, new, ...) {
mdcr_duplicated <- function(x, by = seq_along(x), ...) {
stopifnot(is.data.frame(x))
if (requireNamespace("data.table", quietly = TRUE) && inherits(x, "data.table")) {
rtn <- duplicated(x, by = by, ...)
# Flag this frame as data.table-aware so duplicated.data.table uses its
# optimized path instead of falling back to duplicated.data.frame.
.datatable.aware <- TRUE
rtn <- utils::getFromNamespace(x = 'duplicated.data.table', ns = "data.table")(x, by = by, ...)
} else {
rtn <- duplicated(x[, by, drop = FALSE], ...)
}
Expand Down
3 changes: 3 additions & 0 deletions data-raw/build_sysdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
..mdcr_internal_elixhauser_poa.. <- readRDS("./elixhauser/elixhauser_poa.rds")
..mdcr_internal_elixhauser_codes.. <- readRDS("./elixhauser/elixhauser_codes.rds")


# All internl data sets need to have the ..mdcr_internal_ prefix and .. suffix.
# This is expected in tests and in use within the package.
usethis::use_data(
..mdcr_internal_pccc_codes..
, ..mdcr_internal_pccc_conditions..
Expand Down
6 changes: 6 additions & 0 deletions data-raw/elixhauser/regex_based_on_quan2005.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ DEPRESS | 9 | 1 | quan2005 | ^296\.[2,3,5]
DEPRESS | 9 | 1 | quan2005 | ^300\.4
DEPRESS | 9 | 1 | quan2005 | ^309
DEPRESS | 9 | 1 | quan2005 | ^311
DEPRESS | 10 | 1 | quan2005 | ^F20\.4
DEPRESS | 10 | 1 | quan2005 | ^F31\.[3-5]
DEPRESS | 10 | 1 | quan2005 | ^F3[2-3]
DEPRESS | 10 | 1 | quan2005 | ^F34\.1
DEPRESS | 10 | 1 | quan2005 | ^F4[1-3]\.2
DM | 10 | 1 | quan2005 | ^E1[0-4]\.[0,1,9]
DM | 9 | 1 | ahrq_web | ^250\.[0-3]
DM | 9 | 1 | ahrq_web | ^648\.0
Expand Down Expand Up @@ -191,6 +196,7 @@ HTN_UNCX | 9 | 1 | ahrq_web | ^642\.0
HTN_UNCX | 9 | 1 | elixhauser1988 | ^401\.[1,9]
HTN_UNCX | 9 | 1 | quan2005 | ^401
HYPOTHY | 10 | 1 | quan2005 | ^E0[0-3]
HYPOTHY | 10 | 1 | quan2005 | ^E89\.0
HYPOTHY | 9 | 1 | ahrq_web | ^243
HYPOTHY | 9 | 1 | ahrq_web | ^244\.[0-2,8,9]
HYPOTHY | 9 | 1 | elixhauser1988 | ^243
Expand Down
2 changes: 0 additions & 2 deletions tests/test-asserts.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ stopifnot(
t01b = !("assert_scalar_logical" %in% getNamespaceExports("medicalcoder"))
)

# the method should only be used within methods and the error messages are
# controlled:
common_args <- list(data = mdcr, method = "pccc_v3.1", icd.codes = "code", poa = 1L)

t02a <- tryCatchError(do.call(comorbidities, args = c(common_args, list(full.codes = TRUE))))
Expand Down
64 changes: 0 additions & 64 deletions tests/test-charlson-codes.R

This file was deleted.

35 changes: 0 additions & 35 deletions tests/test-charlson-index-scores.R

This file was deleted.

Loading