Skip to content

Commit

Permalink
rename to more accurate datetime_range_begin & datetime_range_end
Browse files Browse the repository at this point in the history
ref #321 & #323
  • Loading branch information
wibeasley committed Mar 2, 2021
1 parent 432d033 commit 48bb132
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description: Encapsulates functions to streamline calls from R to the REDCap
University. The Application Programming Interface (API) offers an avenue
to access and modify data programmatically, improving the capacity for
literate and reproducible programming.
Version: 0.11.1.9003
Version: 0.11.1.9004
Authors@R: c(person("Will", "Beasley", role = c("aut", "cre"), email =
"[email protected]", comment = c(ORCID = "0000-0002-5613-5006")),
person("David", "Bard", role = "ctb"),
Expand Down
24 changes: 12 additions & 12 deletions R/redcap-read-oneshot-eav.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
#' will only return the records (or record-events, if a longitudinal project)
#' where the logic evaluates as TRUE. An blank/empty string returns all
#' records.
#' @param date_range_begin To return only records that have been created or
#' @param datetime_range_begin To return only records that have been created or
#' modified *after* a given datetime, provide a
#' [POSIXct]
#' (https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html)
#' value.
#' If not specified, REDCap will assume no begin time.
#' @param date_range_end To return only records that have been created or
#' @param datetime_range_end To return only records that have been created or
#' modified *before* a given datetime, provide a
#' [POSIXct]
#' (https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html)
Expand Down Expand Up @@ -150,8 +150,8 @@ redcap_read_oneshot_eav <- function(
# placeholder: export_survey_fields
export_data_access_groups = FALSE,
filter_logic = "",
date_range_begin = as.POSIXct(NA),
date_range_end = as.POSIXct(NA),
datetime_range_begin = as.POSIXct(NA),
datetime_range_end = as.POSIXct(NA),

# placeholder: guess_type
# placeholder: guess_max
Expand All @@ -178,8 +178,8 @@ redcap_read_oneshot_eav <- function(
# placeholder: export_survey_fields
checkmate::assert_logical( export_data_access_groups , any.missing=FALSE, len=1)
checkmate::assert_character(filter_logic , any.missing=FALSE, len=1, pattern="^.{0,}$")
checkmate::assert_posixct( date_range_begin , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( date_range_end , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( datetime_range_begin , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( datetime_range_end , any.missing=TRUE , len=1, null.ok=TRUE)

# placeholder: checkmate::assert_logical( guess_type , any.missing=FALSE, len=1)
# placeholder: checkmate::assert_integerish(guess_max , any.missing=FALSE, len=1, lower=1)
Expand All @@ -195,8 +195,8 @@ redcap_read_oneshot_eav <- function(
events_collapsed <- collapse_vector(events , events_collapsed)
export_data_access_groups <- ifelse(export_data_access_groups, "true", "false")
filter_logic <- filter_logic_prepare(filter_logic)
date_range_begin <- dplyr::coalesce(strftime(date_range_begin, "%Y-%m-%d %H:%M:%S"), "")
date_range_end <- dplyr::coalesce(strftime(date_range_end , "%Y-%m-%d %H:%M:%S"), "")
datetime_range_begin<- dplyr::coalesce(strftime(datetime_range_begin, "%Y-%m-%d %H:%M:%S"), "")
datetime_range_end <- dplyr::coalesce(strftime(datetime_range_end , "%Y-%m-%d %H:%M:%S"), "")
verbose <- verbose_prepare(verbose)

if (1L <= nchar(fields_collapsed) )
Expand All @@ -211,8 +211,8 @@ redcap_read_oneshot_eav <- function(
rawOrLabelHeaders = raw_or_label_headers,
exportDataAccessGroups = export_data_access_groups,
filterLogic = filter_logic,
dateRangeBegin = date_range_begin,
dateRangeEnd = date_range_end
dateRangeBegin = datetime_range_begin,
dateRangeEnd = datetime_range_end
# record, fields, forms & events are specified below
)

Expand Down Expand Up @@ -360,8 +360,8 @@ redcap_read_oneshot_eav <- function(
records_collapsed = records_collapsed,
fields_collapsed = fields_collapsed,
filter_logic = filter_logic,
date_range_begin = date_range_begin,
date_range_end = date_range_end,
datetime_range_begin= datetime_range_begin,
datetime_range_end = datetime_range_end,
events_collapsed = events_collapsed,
elapsed_seconds = kernel$elapsed_seconds,
raw_text = kernel$raw_text
Expand Down
24 changes: 12 additions & 12 deletions R/redcap-read-oneshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
#' filtering the data to be returned by this API method, in which the API will
#' only return the records (or record-events, if a longitudinal project) where
#' the logic evaluates as TRUE. An blank/empty string returns all records.
#' @param date_range_begin To return only records that have been created or
#' @param datetime_range_begin To return only records that have been created or
#' modified *after* a given datetime, provide a
#' [POSIXct](https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html)
#' value.
#' If not specified, REDCap will assume no begin time.
#' @param date_range_end To return only records that have been created or
#' @param datetime_range_end To return only records that have been created or
#' modified *before* a given datetime, provide a
#' [POSIXct](https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html)
#' value.
Expand Down Expand Up @@ -169,8 +169,8 @@ redcap_read_oneshot <- function(
export_survey_fields = FALSE,
export_data_access_groups = FALSE,
filter_logic = "",
date_range_begin = as.POSIXct(NA),
date_range_end = as.POSIXct(NA),
datetime_range_begin = as.POSIXct(NA),
datetime_range_end = as.POSIXct(NA),

col_types = NULL,
guess_type = TRUE,
Expand Down Expand Up @@ -198,8 +198,8 @@ redcap_read_oneshot <- function(
checkmate::assert_logical( export_survey_fields , any.missing=FALSE, len=1)
checkmate::assert_logical( export_data_access_groups , any.missing=FALSE, len=1)
checkmate::assert_character(filter_logic , any.missing=FALSE, len=1, pattern="^.{0,}$")
checkmate::assert_posixct( date_range_begin , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( date_range_end , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( datetime_range_begin , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( datetime_range_end , any.missing=TRUE , len=1, null.ok=TRUE)

checkmate::assert_logical( guess_type , any.missing=FALSE, len=1)
checkmate::assert_integerish(guess_max , any.missing=FALSE, len=1, lower=1)
Expand All @@ -214,8 +214,8 @@ redcap_read_oneshot <- function(
forms_collapsed <- collapse_vector(forms , forms_collapsed)
events_collapsed <- collapse_vector(events , events_collapsed)
filter_logic <- filter_logic_prepare(filter_logic)
date_range_begin <- dplyr::coalesce(strftime(date_range_begin, "%Y-%m-%d %H:%M:%S"), "")
date_range_end <- dplyr::coalesce(strftime(date_range_end , "%Y-%m-%d %H:%M:%S"), "")
datetime_range_begin<- dplyr::coalesce(strftime(datetime_range_begin, "%Y-%m-%d %H:%M:%S"), "")
datetime_range_end <- dplyr::coalesce(strftime(datetime_range_end , "%Y-%m-%d %H:%M:%S"), "")
verbose <- verbose_prepare(verbose)

if (1L <= nchar(fields_collapsed) )
Expand All @@ -233,8 +233,8 @@ redcap_read_oneshot <- function(
exportSurveyFields = tolower(as.character(export_survey_fields)),
exportDataAccessGroups = tolower(as.character(export_data_access_groups)),
filterLogic = filter_logic,
dateRangeBegin = date_range_begin,
dateRangeEnd = date_range_end
dateRangeBegin = datetime_range_begin,
dateRangeEnd = datetime_range_end
# record, fields, forms & events are specified below
)

Expand Down Expand Up @@ -334,8 +334,8 @@ redcap_read_oneshot <- function(
forms_collapsed = forms_collapsed,
events_collapsed = events_collapsed,
filter_logic = filter_logic,
date_range_begin = date_range_begin,
date_range_end = date_range_end,
datetime_range_begin = datetime_range_begin,
datetime_range_end = datetime_range_end,
elapsed_seconds = kernel$elapsed_seconds,
raw_text = kernel$raw_text
)
Expand Down
28 changes: 14 additions & 14 deletions R/redcap-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
#' filtering the data to be returned by this API method, in which the API
#' will only return the records (or record-events, if a longitudinal project)
#' where the logic evaluates as TRUE. An blank/empty string returns all records.
#' @param date_range_begin To return only records that have been created or
#' @param datetime_range_begin To return only records that have been created or
#' modified *after* a given datetime, provide a
#' [POSIXct](https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html)
#' value.
#' If not specified, REDCap will assume no begin time.
#' @param date_range_end To return only records that have been created or
#' @param datetime_range_end To return only records that have been created or
#' modified *before* a given datetime, provide a
#' [POSIXct](https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.POSIXlt.html)
#' value.
Expand Down Expand Up @@ -182,8 +182,8 @@ redcap_read <- function(
export_survey_fields = FALSE,
export_data_access_groups = FALSE,
filter_logic = "",
date_range_begin = as.POSIXct(NA),
date_range_end = as.POSIXct(NA),
datetime_range_begin = as.POSIXct(NA),
datetime_range_end = as.POSIXct(NA),

col_types = NULL,
guess_type = TRUE,
Expand Down Expand Up @@ -211,8 +211,8 @@ redcap_read <- function(
# placeholder: returnFormat
checkmate::assert_logical( export_survey_fields , any.missing=FALSE, len=1)
checkmate::assert_logical( export_data_access_groups , any.missing=FALSE, len=1)
checkmate::assert_posixct( date_range_begin , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( date_range_end , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( datetime_range_begin , any.missing=TRUE , len=1, null.ok=TRUE)
checkmate::assert_posixct( datetime_range_end , any.missing=TRUE , len=1, null.ok=TRUE)

checkmate::assert_logical( guess_type , any.missing=FALSE, len=1)

Expand Down Expand Up @@ -259,8 +259,8 @@ redcap_read <- function(
forms_collapsed = forms_collapsed,
events_collapsed = events_collapsed,
filter_logic = filter_logic,
date_range_begin = date_range_begin,
date_range_end = date_range_end,
datetime_range_begin = datetime_range_begin,
datetime_range_end = datetime_range_end,
guess_type = guess_type,
verbose = verbose,
config_options = config_options
Expand All @@ -277,8 +277,8 @@ redcap_read <- function(
forms_collapsed = "failed in initial batch call",
events_collapsed = "failed in initial batch call",
filter_logic = "failed in initial batch call",
date_range_begin = "failed in initial batch call",
date_range_end = "failed in initial batch call",
datetime_range_begin = "failed in initial batch call",
datetime_range_end = "failed in initial batch call",
elapsed_seconds = elapsed_seconds,
status_code = initial_call$status_code,
outcome_messages = outcome_messages,
Expand Down Expand Up @@ -326,8 +326,8 @@ redcap_read <- function(
export_survey_fields = export_survey_fields,
export_data_access_groups = export_data_access_groups,
filter_logic = filter_logic,
date_range_begin = date_range_begin,
date_range_end = date_range_end,
datetime_range_begin = datetime_range_begin,
datetime_range_end = datetime_range_end,

col_types = col_types,
guess_type = FALSE,
Expand Down Expand Up @@ -388,8 +388,8 @@ redcap_read <- function(
forms_collapsed = forms_collapsed,
events_collapsed = events_collapsed,
filter_logic = filter_logic,
date_range_begin = date_range_begin,
date_range_end = date_range_end,
datetime_range_begin= datetime_range_begin,
datetime_range_end = datetime_range_end,

elapsed_seconds = elapsed_seconds
)
Expand Down
8 changes: 4 additions & 4 deletions man/redcap_read.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/redcap_read_oneshot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/redcap_read_oneshot_eav.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-read-batch-simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ test_that("date-range", {
redcap_read(
redcap_uri = credential$redcap_uri,
token = credential$token,
date_range_begin = start,
date_range_end = stop
datetime_range_begin = start,
datetime_range_end = stop
)
)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-read-oneshot-eav.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ test_that("date-range", {
REDCapR:::redcap_read_oneshot_eav(
redcap_uri = credential$redcap_uri,
token = credential$token,
date_range_begin = start,
date_range_end = stop
datetime_range_begin = start,
datetime_range_end = stop
)
)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-read-oneshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ test_that("date-range", {
redcap_read_oneshot(
redcap_uri = credential$redcap_uri,
token = credential$token,
date_range_begin = start,
date_range_end = stop
datetime_range_begin = start,
datetime_range_end = stop
)
)

Expand Down

0 comments on commit 48bb132

Please sign in to comment.