diff --git a/R/globals.R b/R/globals.R index 30e021b3..9a2998a0 100644 --- a/R/globals.R +++ b/R/globals.R @@ -1,2 +1,4 @@ -utils::globalVariables(c("USUBJID", "VISIT", "dom_dt", "dom_tm", "ref_dt", - "ref_tm")) +utils::globalVariables(c( + "USUBJID", "VISIT", "dom_dt", "dom_tm", "ref_dt", + "ref_tm" +)) diff --git a/tests/testthat/test-derive_blfl.R b/tests/testthat/test-derive_blfl.R index f58da69d..7b6b963c 100644 --- a/tests/testthat/test-derive_blfl.R +++ b/tests/testthat/test-derive_blfl.R @@ -1,33 +1,32 @@ - dm <- tibble::tribble( - ~USUBJID, ~RFSTDTC, ~RFXSTDTC, - "test_study-375", "2020-09-28T10:10", "2020-09-28T10:10", - "test_study-376", "2020-09-21T11:00", "2020-09-21T11:00", - "test_study-377", NA, NA, - "test_study-378", "2020-01-20T10:00", "2020-01-20T10:00", - "test_study-379", NA, NA +dm <- tibble::tribble( + ~USUBJID, ~RFSTDTC, ~RFXSTDTC, + "test_study-375", "2020-09-28T10:10", "2020-09-28T10:10", + "test_study-376", "2020-09-21T11:00", "2020-09-21T11:00", + "test_study-377", NA, NA, + "test_study-378", "2020-01-20T10:00", "2020-01-20T10:00", + "test_study-379", NA, NA +) + +sdtm_in <- + tibble::tribble( + ~DOMAIN, ~oak_id, ~raw_source, ~patient_number, ~USUBJID, ~VSDTC, ~VSTESTCD, ~VSORRES, ~VSSTAT, ~VISIT, + "VS", 1L, "VTLS1", 375L, "test_study-375", "2020-09-01T13:31", "DIABP", "90", NA, "SCREENING", + "VS", 2L, "VTLS1", 375L, "test_study-375", "2020-10-01T11:20", "DIABP", "90", NA, "SCREENING", + "VS", 1L, "VTLS1", 375L, "test_study-375", "2020-09-28T10:10", "PULSE", "ND", NA, "SCREENING", + "VS", 2L, "VTLS1", 375L, "test_study-375", "2020-10-01T13:31", "PULSE", "85", NA, "SCREENING", + "VS", 1L, "VTLS2", 375L, "test_study-375", "2020-09-28T10:10", "SYSBP", "120", NA, "SCREENING", + "VS", 2L, "VTLS2", 375L, "test_study-375", "2020-09-28T10:05", "SYSBP", "120", NA, "SCREENING", + "VS", 1L, "VTLS1", 376L, "test_study-376", "2020-09-20", "DIABP", "75", NA, "SCREENING", + "VS", 1L, "VTLS1", 376L, "test_study-376", "2020-09-20", "PULSE", NA, "NOT DONE", "SCREENING", # nolint + "VS", 2L, "VTLS1", 376L, "test_study-376", "2020-09-20", "PULSE", "110", NA, "SCREENING", + "VS", 2L, "VTLS1", 378L, "test_study-378", "2020-01-20T10:00", "PULSE", "110", NA, "SCREENING", + "VS", 3L, "VTLS1", 378L, "test_study-378", "2020-01-21T11:00", "PULSE", "105", NA, "SCREENING" ) - sdtm_in <- - tibble::tribble( - ~DOMAIN, ~oak_id, ~raw_source, ~patient_number, ~USUBJID, ~VSDTC, ~VSTESTCD, ~VSORRES, ~VSSTAT, ~VISIT, - "VS", 1L, "VTLS1", 375L, "test_study-375", "2020-09-01T13:31", "DIABP", "90", NA, "SCREENING", - "VS", 2L, "VTLS1", 375L, "test_study-375", "2020-10-01T11:20", "DIABP", "90", NA, "SCREENING", - "VS", 1L, "VTLS1", 375L, "test_study-375", "2020-09-28T10:10", "PULSE", "ND", NA, "SCREENING", - "VS", 2L, "VTLS1", 375L, "test_study-375", "2020-10-01T13:31", "PULSE", "85", NA, "SCREENING", - "VS", 1L, "VTLS2", 375L, "test_study-375", "2020-09-28T10:10", "SYSBP", "120", NA, "SCREENING", - "VS", 2L, "VTLS2", 375L, "test_study-375", "2020-09-28T10:05", "SYSBP", "120", NA, "SCREENING", - "VS", 1L, "VTLS1", 376L, "test_study-376", "2020-09-20", "DIABP", "75", NA, "SCREENING", - "VS", 1L, "VTLS1", 376L, "test_study-376", "2020-09-20", "PULSE", NA, "NOT DONE", "SCREENING", # nolint - "VS", 2L, "VTLS1", 376L, "test_study-376", "2020-09-20", "PULSE", "110", NA, "SCREENING", - "VS", 2L, "VTLS1", 378L, "test_study-378", "2020-01-20T10:00", "PULSE", "110", NA, "SCREENING", - "VS", 3L, "VTLS1", 378L, "test_study-378", "2020-01-21T11:00", "PULSE", "105", NA, "SCREENING" - ) - - d <- list(sdtm_in = sdtm_in, dm = dm) +d <- list(sdtm_in = sdtm_in, dm = dm) test_that("derive_blfl example works", { - observed_output <- derive_blfl( sdtm_in = d$sdtm_in, dm_domain = d$dm, @@ -81,7 +80,6 @@ test_that("derive_blfl sdmt_in validations work", { }) test_that("derive_blfl dm_domain validations work", { - dm_no_vars <- d$dm |> dplyr::select(-c(RFXSTDTC, USUBJID)) @@ -95,7 +93,6 @@ test_that("derive_blfl dm_domain validations work", { }) test_that("derive_blfl tgt_var and ref_var validations work", { - expect_snapshot_error(derive_blfl( sdtm_in = d$sdtm_in, dm_domain = d$dm, @@ -119,7 +116,6 @@ test_that("derive_blfl tgt_var and ref_var validations work", { }) test_that("derive_blfl DOMAIN validation works", { - sdtm_in_bad_domain <- d$sdtm_in |> dplyr::mutate(DOMAIN = 4L)