Skip to content
Open
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
30 changes: 3 additions & 27 deletions R/callback-cncpt.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,11 @@ collect_dots <- function(concepts, interval, ..., merge_dat = FALSE) {

dots <- list(...)

if (length(concepts) == 1L) {

assert_that(identical(length(dots), 1L))

res <- dots[[1L]]

if (is_ts_tbl(res)) {
ival <- coalesce(interval, interval(res))
assert_that(has_interval(res, ival))
} else {
assert_that(is_df(res))
}

return(res)
}

if (length(dots) == 1L) {
dots <- dots[[1L]]
}

if (is.null(names(dots))) {
names(dots) <- concepts
}

if (not_null(names(concepts))) {
concepts <- chr_ply(concepts, grep, names(dots), value = TRUE,
use_names = TRUE)
}

assert_that(setequal(names(dots), concepts))

res <- dots[concepts]

assert_that(all_map(has_col, res, concepts))
Expand All @@ -45,7 +19,9 @@ collect_dots <- function(concepts, interval, ..., merge_dat = FALSE) {

ival <- check_interval(res, interval)

if (merge_dat) {
if (length(res) == 1) {
res <- res[[1]]
} else if (merge_dat) {
res <- reduce(merge, res, all = TRUE)
} else {
attr(res, "ival_checked") <- ival
Expand Down
4 changes: 1 addition & 3 deletions R/concept-load.R
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ load_concepts.rec_cncpt <- function(x, aggregate = NULL, patient_ids = NULL,

ext <- list(patient_ids = patient_ids, id_type = id_type,
interval = coalesce(x[["interval"]], interval),
progress = progress)
..., progress = progress)

sub <- x[["items"]]
agg <- x[["aggregate"]]
Expand Down Expand Up @@ -606,8 +606,6 @@ load_concepts.item <- function(x, patient_ids = NULL, id_type = "icustay",
load_concepts.itm <- function(x, patient_ids = NULL, id_type = "icustay",
interval = hours(1L), ...) {

warn_dots(..., ok_args = "keep_components")

res <- do_itm_load(x, id_type, interval = interval)
res <- merge_patid(res, patient_ids)
res <- do_callback(x, res)
Expand Down
1 change: 0 additions & 1 deletion inst/extdata/config/concept-dict.R
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,6 @@ cfg <- list(
omopid = 132797L,
category = "outcome",
callback = "sep3",
keep_components = c(FALSE, TRUE),
class = "rec_cncpt"
),
bnd = list(
Expand Down
1 change: 0 additions & 1 deletion inst/extdata/config/concept-dict.json
Original file line number Diff line number Diff line change
Expand Up @@ -5254,7 +5254,6 @@
"omopid": 132797,
"category": "outcome",
"callback": "sep3",
"keep_components": [false, true],
"class": "rec_cncpt"
},
"sex": {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-callback.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,5 @@ test_that("susp_inf", {
57, 61, 70)), susp_inf = rep(TRUE, 6L), interval = hours(1L)
)

expect_identical(susp_inf(abx, samp), expected)
expect_identical(susp_inf(abx = abx, samp = samp), expected)
})
2 changes: 1 addition & 1 deletion tests/testthat/test-scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test_that("suspicion of infection", {
expect_equal(interval(si_ei), hours(1L))
})

sep3 <- sep3(so_mi, si_mi)
sep3 <- sep3(sofa = so_mi, susp_inf = si_mi)

test_that("sepsis 3", {

Expand Down