From a86e4a92b3a6c7ab6ae3e0528c49d1c6032a2871 Mon Sep 17 00:00:00 2001 From: Rammprasad Ganapathy Date: Tue, 18 Jun 2024 18:20:05 +0000 Subject: [PATCH] Fix pipeline failures --- .lintr | 4 +++- R/derive_blfl.R | 4 ++-- man/derive_blfl.Rd | 51 +++++++++++++++++++++++++-------------------- man/dtc_datepart.Rd | 4 ++-- man/dtc_timepart.Rd | 8 +++---- 5 files changed, 39 insertions(+), 32 deletions(-) diff --git a/.lintr b/.lintr index feb3a253..05e507a1 100644 --- a/.lintr +++ b/.lintr @@ -23,6 +23,8 @@ linters: linters_with_defaults( redundant_ifelse_linter(), sprintf_linter(), strings_as_factors_linter(), - undesirable_function_linter(c(Sys.setenv = NA_character_, mapply = NA_character_)) + undesirable_function_linter(c(Sys.setenv = NA_character_, mapply = NA_character_)), + object_name_linter = NULL, + object_usage_linter = NULL ) encoding: "UTF-8" diff --git a/R/derive_blfl.R b/R/derive_blfl.R index 8e3fa521..94003c25 100644 --- a/R/derive_blfl.R +++ b/R/derive_blfl.R @@ -25,7 +25,7 @@ #' dtc_datepart <- function(dtc, partial_as_na = TRUE) { # Assert that dtc is a character vector - checkmate::assert_character(dtc) + admiraldev::assert_character_vector(dtc) # Extract date part from ISO 8601 date/time variable dt <- sub("^([^T]+).*", "\\1", dtc) @@ -83,7 +83,7 @@ dtc_datepart <- function(dtc, partial_as_na = TRUE) { #' dtc_timepart <- function(dtc, partial_as_na = TRUE, ignore_seconds = TRUE) { # Assert that dtc is a character vector - checkmate::assert_character(dtc) + admiraldev::assert_character_vector(dtc) # Determine length of time part depending on ignore_seconds parameter tm_length <- ifelse(ignore_seconds, 5L, 8L) diff --git a/man/derive_blfl.Rd b/man/derive_blfl.Rd index fc9353ae..ec3be0f0 100644 --- a/man/derive_blfl.Rd +++ b/man/derive_blfl.Rd @@ -28,7 +28,7 @@ include "RFSTDTC" (the date/time of the first study treatment) or \item{baseline_visits}{A character vector specifying the baseline visits within the study. These visits are identified as critical points for data collection at the start of the study, before any intervention is applied. This allows the function to assign the baseline -flag if thre --DTC matches to the reference date.} +flag if the --DTC matches to the reference date.} \item{baseline_timepoints}{A character vector of timpoints values in --TPT that specifies the specific timepoints during the baseline visits when key assessments or measurements were taken. @@ -84,36 +84,41 @@ exposure flag (\code{--LOBXFL}) variable to these rows. } \examples{ 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, + ~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 sdtm_in <- -tibble::tribble( -~DOMAIN, ~oak_id, ~raw_source, ~patient_number, ~USUBJID, ~VSDTC, ~VSTESTCD, ~VSORRES, ~VSSTAT, -"VS", 1L, "VTLS1", 375L, "test_study-375", "2020-09-01T13:31", "DIABP", "90", NA, -"VS", 2L, "VTLS1", 375L, "test_study-375", "2020-10-01T11:20", "DIABP", "90", NA, -"VS", 1L, "VTLS1", 375L, "test_study-375", "2020-09-28T10:10", "PULSE", "ND", NA, -"VS", 2L, "VTLS1", 375L, "test_study-375", "2020-10-01T13:31", "PULSE", "85", NA, -"VS", 1L, "VTLS2", 375L, "test_study-375", "2020-09-28T10:10", "SYSBP", "120", NA, -"VS", 2L, "VTLS2", 375L, "test_study-375", "2020-09-28T10:05", "SYSBP", "120", NA, -"VS", 1L, "VTLS1", 376L, "test_study-376", "2020-09-20", "DIABP", "75", NA, -"VS", 1L, "VTLS1", 376L, "test_study-376", "2020-09-20", "PULSE", NA, "NOT DONE", #nolint -"VS", 2L, "VTLS1", 376L, "test_study-376", "2020-09-20", "PULSE", "110", NA -) + 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 -observed_output <- derive_blfl(sdtm_in = sdtm_in, - dm_domain = dm, - tgt_var = "VSLOBXFL", - ref_var = "RFXSTDTC") +observed_output <- derive_blfl( + sdtm_in = sdtm_in, + dm_domain = dm, + tgt_var = "VSLOBXFL", + ref_var = "RFXSTDTC", + baseline_visits = c("SCREENING") +) observed_output } diff --git a/man/dtc_datepart.Rd b/man/dtc_datepart.Rd index 543d6ff1..e17ba977 100644 --- a/man/dtc_datepart.Rd +++ b/man/dtc_datepart.Rd @@ -24,13 +24,13 @@ By default, partial or missing dates are set to NA. dtc_datepart( c(NA, "", "2021", "2021-12", "2021-12-25", "2021-12-25T12:00:00") ) - # |--> c(NA, NA, NA, NA, "2021-12-25", "2021-12-25") +# |--> c(NA, NA, NA, NA, "2021-12-25", "2021-12-25") ## Prevent partial or missing dates from being set to NA dtc_datepart( c(NA, "", "2021", "2021-12", "2021-12-25", "2021-12-25T12:00:00"), partial_as_na = FALSE ) - # |--> c(NA, "", "2021", "2021-12", "2021-12-25", "2021-12-25") +# |--> c(NA, "", "2021", "2021-12", "2021-12-25", "2021-12-25") } diff --git a/man/dtc_timepart.Rd b/man/dtc_timepart.Rd index cb821ed2..46c1a88f 100644 --- a/man/dtc_timepart.Rd +++ b/man/dtc_timepart.Rd @@ -28,21 +28,21 @@ and not extracted. dtc_timepart( c(NA, "", "2021-12-25", "2021-12-25T12", "2021-12-25T12:30", "2021-12-25T12:30:59") ) - # |--> c(NA, NA, NA, NA, "12:30", "12:30") +# |--> c(NA, NA, NA, NA, "12:30", "12:30") ## Prevent partial or missing times from being set to NA dtc_timepart( c(NA, "", "2021-12-25", "2021-12-25T12", "2021-12-25T12:30", "2021-12-25T12:30:59"), partial_as_na = FALSE ) - # |--> c(NA, "", "", "12", "12:30", "12:30") +# |--> c(NA, "", "", "12", "12:30", "12:30") ## Do not ignore seconds, partial or missing times set to NA dtc_timepart( c(NA, "", "2021-12-25", "2021-12-25T12", "2021-12-25T12:30", "2021-12-25T12:30:59"), ignore_seconds = FALSE ) - # |--> c(NA, NA, NA, NA, NA, "12:30:59") +# |--> c(NA, NA, NA, NA, NA, "12:30:59") ## Do not ignore seconds and prevent partial or missing times from being set to NA dtc_timepart( @@ -50,6 +50,6 @@ dtc_timepart( partial_as_na = FALSE, ignore_seconds = FALSE ) - # |--> c(NA, "", "", "12", "12:30", "12:30:59") +# |--> c(NA, "", "", "12", "12:30", "12:30:59") }