pharmaverse / sdtm.oak

An EDC and Data Standard agnostic SDTM data transformation engine that automates the transformation of raw clinical data in ODM format to SDTM based on standard mapping algorithms
https://pharmaverse.github.io/sdtm.oak/
Apache License 2.0
25 stars 7 forks source link

Examples for unexported functions #63

Closed ramiromagno closed 2 months ago

ramiromagno commented 3 months ago

As the first submission to CRAN approaches, and given that we have example code in the Examples section of unexported functions, as per CRAN requirements, we will have either to omit these examples or to export these functions.

I think we should try to convert those examples to unit tests, and remove the examples, while leaving the unexported functions as such.

Here is the output of a quick grep on "sdtm.oak:::":

cnd_df.R:#' sdtm.oak:::new_cnd_df(dat = df, cnd = c(FALSE, NA, TRUE))
cnd_df.R:#' sdtm.oak:::is_cnd_df(df)
cnd_df.R:#' cnd_df <- sdtm.oak:::new_cnd_df(dat = df, cnd = c(FALSE, NA, TRUE))
cnd_df.R:#' sdtm.oak:::is_cnd_df(cnd_df)
cnd_df.R:#' sdtm.oak:::get_cnd_df_cnd(df)
cnd_df.R:#' cnd_df <- sdtm.oak:::new_cnd_df(dat = df, cnd = c(FALSE, NA, TRUE))
cnd_df.R:#' sdtm.oak:::get_cnd_df_cnd(cnd_df)
cnd_df.R:#' sdtm.oak:::get_cnd_df_cnd_sum(df)
cnd_df.R:#' cnd_df <- sdtm.oak:::new_cnd_df(dat = df, cnd = c(FALSE, NA, TRUE))
cnd_df.R:#' sdtm.oak:::get_cnd_df_cnd_sum(cnd_df)
cnd_df.R:#' cnd_df <- sdtm.oak:::new_cnd_df(dat = df, cnd = c(FALSE, NA, TRUE))
cnd_df.R:#' sdtm.oak:::is_cnd_df(cnd_df)
cnd_df.R:#' sdtm.oak:::is_cnd_df(sdtm.oak:::rm_cnd_df(cnd_df))
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > 2)
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > 2 & y)
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > 2, y)
cnd_df.R:#' sdtm.oak:::eval_conditions(df_with_na, x > 2, .na = FALSE)
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > w)
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > w, .env = env)
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > w, .env = list(w = 3))
cnd_df.R:#' sdtm.oak:::eval_conditions(df, x > w, .env = tibble::tibble(w = 4))
ct.R:#' all.equal(ct_spec_01, sdtm.oak:::assert_ct_spec(ct_spec_01))
ct.R:#' # assertion; `sdtm.oak:::ct_spec_vars()` defines their names.
ct.R:#' (req_vars <- sdtm.oak:::ct_spec_vars())
ct.R:#' sdtm.oak:::assert_ct_spec(ct_spec_01[req_vars])
ct.R:#' try(sdtm.oak:::assert_ct_spec(ct_spec_01[opt_vars]))
ct.R:#' sdtm.oak:::assert_ct_clst(ct_spec = ct_spec, ct_clst = "C71113")
ct.R:#' sdtm.oak:::assert_ct_clst(ct_spec = ct_spec, ct_clst = NULL, optional = TRUE)
ct.R:#' try(sdtm.oak:::assert_ct_clst(ct_spec = ct_spec, ct_clst = NULL, optional = FALSE))
ct.R:#' sdtm.oak:::ct_mappings(ct_spec = ct_spec_01)
ct.R:#' sdtm.oak:::ct_mappings(ct_spec = ct_spec_01) |>
derive_seq.R:#' sdtm.oak:::is_seq_name("AESEQ")
derive_seq.R:#' sdtm.oak:::is_seq_name("AEseq")
derive_seq.R:#' sdtm.oak:::is_seq_name("AESEQUENCE")
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_na(c("10", NA_character_))
dtc_create_iso8601.R:#' sdtm.oak:::zero_pad_whole_number(c(-1, 0, 1))
dtc_create_iso8601.R:#' sdtm.oak:::zero_pad_whole_number(c(-1, 0, 1, 10, 99, 100), n = 2)
dtc_create_iso8601.R:#' sdtm.oak:::zero_pad_whole_number(c(-1, 0, 1, 10, 99, 100), n = 3)
dtc_create_iso8601.R:#' sdtm.oak:::yy_to_yyyy(0:5)
dtc_create_iso8601.R:#' sdtm.oak:::yy_to_yyyy(2000:2005)
dtc_create_iso8601.R:#' sdtm.oak:::yy_to_yyyy(90:99)
dtc_create_iso8601.R:#' sdtm.oak:::yy_to_yyyy(1990:1999)
dtc_create_iso8601.R:#' sdtm.oak:::yy_to_yyyy(65:72)
dtc_create_iso8601.R:#' sdtm.oak:::yy_to_yyyy(1965:1972)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_two_digits(x)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_year(c("0", "1", "2", "50", "68", "69", "90", "99", "00"))
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_year(c("67", "68", "69", "70"))
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_year(c("1967", "1968", "1969", "1970"))
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_year(as.character(0:50), cutoff_2000 = 25)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_year(as.character(1900:1950), cutoff_2000 = 25)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_mon(c(NA, "0", "1", "2", "10", "11", "12"))
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_mon(c("13", "99", "100", "-1"))
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_mon(mon)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_sec(c(NA, "0", "1", "10", "59", "99", "100"))
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_truncate(x)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_truncate("-----T-:-:-", empty_as_na = TRUE)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_truncate("-----T-:-:-", empty_as_na = FALSE)
dtc_create_iso8601.R:#' sdtm.oak:::iso8601_truncate(
dtc_create_iso8601.R:#' sdtm.oak:::format_iso8601(m)
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020", "y")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020-05", "y")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020-05", "y-m")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020-05-11", "y-m-d")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020 05 11", "y m d")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020  05  11", "y m d")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020  05  11", "y\\s+m\\s+d")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020      05     11", "y\\s+m\\s+d")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020-05-11 11:45", "y-m-d H:M")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("2020-05-11 11:45:15.6", "y-m-d H:M:S")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm(c("2002-05-11 11:45", "-05-11 11:45"), "y-m-d H:M")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm(c("2002-05-11 11:45", "-05-11 11:45"), "-m-d H:M")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm(c("2002-05-11 11:45", "-05-11 11:45"), c("y-m-d H:M", "-m-d H:M"))
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("05 feb 1985 12 55 02", "d m y H M S")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm("12 55 02 05 feb 1985", "H M S d m y")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm(c("2020-05-18", "2020-UN-18", "2020-UNK-UN"), "y-m-d")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm(c("2020-05-18", "2020-UN-18", "2020-UNK-UN"), "y-m-d", na = "UN")
dtc_parse_dttm.R:#' sdtm.oak:::parse_dttm(c("2020-05-18", "2020-UN-18", "2020-UNK-UN"), "y-m-d", na = c("UN", "UNK"))
dtc_problems.R:#' dttm2 <- sdtm.oak:::add_problems(dttm, is_problem, dtc)
dtc_problems.R:#' sdtm.oak:::problems(dttm2)
dtc_problems.R:#' sdtm.oak:::any_problems(list(sdtm.oak:::parse_dttm("1980-06-18", "y-m-d")))
dtc_problems.R:#' sdtm.oak:::any_problems(list(sdtm.oak:::parse_dttm("1980-06-18", "ymd")))
dtc_problems.R:#' cap_matrix_date <- sdtm.oak:::parse_dttm(date, "y-m-d")
dtc_problems.R:#' cap_matrix_time <- sdtm.oak:::parse_dttm(time, "H:M:S")
dtc_problems.R:#' sdtm.oak:::any_problems(cap_matrices)
dtc_utils.R:#' sdtm.oak:::assert_dtc_fmt(c("ymd", "y m d", "dmy", "HM", "H:M:S", "y-m-d H:M:S"))
dtc_utils.R:#'   sdtm.oak:::assert_dtc_fmt("y years m months d days")
dtc_utils.R:#' sdtm.oak:::assert_dtc_format("ymd")
dtc_utils.R:#' sdtm.oak:::assert_dtc_format(c("ymd", "y-m-d"))
dtc_utils.R:#' sdtm.oak:::assert_dtc_format(list(c("ymd", "y-m-d"), "H:M:S"))
dtc_utils.R:#'   sdtm.oak:::assert_dtc_format("year, month, day")
dtc_utils.R:#' sdtm.oak:::assert_capture_matrix(m)
dtc_utils.R:#'   sdtm.oak:::assert_capture_matrix(character())
dtc_utils.R:#'   sdtm.oak:::assert_capture_matrix(matrix(data = NA_character_, nrow = 0, ncol = 0))
dtc_utils.R:#'   sdtm.oak:::assert_capture_matrix(matrix(data = NA_character_, nrow = 1))
dtc_utils.R:#' sdtm.oak:::complete_capture_matrix(matrix(data = NA_character_, nrow = 0, ncol = 0))
dtc_utils.R:#' sdtm.oak:::complete_capture_matrix(matrix(data = NA_character_, nrow = 1))
dtc_utils.R:#' # sdtm.oak:::complete_capture_matrix(m)
dtc_utils.R:#' # sdtm.oak:::complete_capture_matrix(m)
dtc_utils.R:#' # sdtm.oak:::complete_capture_matrix(m)
dtc_utils.R:#' sdtm.oak:::coalesce_capture_matrices(m_dates, m_times)
dtc_utils.R:#' sdtm.oak:::coalesce_capture_matrices(m_times, m_dates)
dtc_utils.R:#' sdtm.oak:::coalesce_capture_matrices(m_dates)
dtc_utils.R:#' sdtm.oak:::coalesce_capture_matrices(m_times)
oak_id_vars.R:#' sdtm.oak:::contains_oak_id_vars(oak_id_vars())
oak_id_vars.R:#' sdtm.oak:::contains_oak_id_vars(character())
oak_id_vars.R:#' sdtm.oak:::contains_oak_id_vars(c("oak_id", "raw_source"))
parse_dttm_fmt.R:#' sdtm.oak:::regex_or(c("jan", "feb"))
parse_dttm_fmt.R:#' paste0(sdtm.oak:::regex_or(c("jan", "feb"), .close = TRUE), r"{\d{2}}")
parse_dttm_fmt.R:#' sdtm.oak:::fmt_rg()
parse_dttm_fmt.R:#' sdtm.oak:::fmt_rg(mon = r"[\b\d|\d{2}]")
parse_dttm_fmt.R:#' sdtm.oak:::fmt_rg(na = "UNK")
parse_dttm_fmt.R:#' sdtm.oak:::fmt_rg(year_na = "UNK")
parse_dttm_fmt.R:#' sdtm.oak:::parse_dttm_fmt("ymd")
parse_dttm_fmt.R:#' sdtm.oak:::parse_dttm_fmt("H:M:S")
parse_dttm_fmt.R:#' sdtm.oak:::parse_dttm_fmt("ymd HMS")
parse_dttm_fmt.R:#' sdtm.oak:::parse_dttm_fmt("yymmdd HHMMSS")
parse_dttm_fmt.R:#' sdtm.oak:::parse_dttm_fmt("year y")
parse_dttm_fmt.R:#' sdtm.oak:::parse_dttm_fmt(
parse_dttm_fmt.R:#' sdtm.oak:::dttm_fmt_to_regex("y")
parse_dttm_fmt.R:#' sdtm.oak:::dttm_fmt_to_regex("y", anchored = FALSE)
parse_dttm_fmt.R:#' sdtm.oak:::dttm_fmt_to_regex("m")
parse_dttm_fmt.R:#' sdtm.oak:::dttm_fmt_to_regex("ymd")
parse_dttm_fmt.R:#' sdtm.oak:::dttm_fmt_to_regex("ymd HH:MM:SS")
recode.R:#' sdtm.oak:::index_for_recode(x = 1:5, from = c(2, 4))
recode.R:#' sdtm.oak:::recode(x,
recode.R:#' sdtm.oak:::recode(
recode.R:#' sdtm.oak:::recode(