R/CreateArgFunctions.R

Defines functions createGetExposureStatusArgs createSelectSubjectsToIncludeArgs createGetDbCaseCrossoverDataArgs

Documented in createGetDbCaseCrossoverDataArgs createGetExposureStatusArgs createSelectSubjectsToIncludeArgs

# This file has been autogenerated. Do not change by hand. 

#' Create a parameter object for the function getDbCaseCrossoverData
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param useNestingCohort                    Should the study be nested in a cohort (e.g. people with
#'                                            a specific indication)? If not, the study will be nested
#'                                            in the general population.
#' @param useObservationEndAsNestingEndDate   When using a nesting cohort, should the observation
#'                                            period end date be used instead of the cohort end date?
#' @param getVisits                           Get data on visits? This is needed when performing a
#'                                            time- case-control study and matching on visit date is
#'                                            requested later on.
#' @param studyStartDate                      A calendar date specifying the minimum date where data is
#'                                            used. Date format is 'yyyymmdd'.
#' @param studyEndDate                        A calendar date specifying the maximum date where data is
#'                                            used. Date format is 'yyyymmdd'.
#' @param getTimeControlData                  Should data for time controls be fetched? (needed for
#'                                            case-time-control analyses).
#' @param maxNestingCohortSize                If the nesting cohort is larger than this number it will
#'                                            be sampled to this size. maxCohortSize = 0 indicates no
#'                                            maximum size. (needed for case-time-control analyses).
#' @param maxCasesPerOutcome                  If there are more than this number of cases for a single
#'                                            outcome cases will be sampled to this size.
#'                                            maxCasesPerOutcome = 0 indicates no maximum size.
#'
#' @export
createGetDbCaseCrossoverDataArgs <- function(useNestingCohort = FALSE,
                                             useObservationEndAsNestingEndDate = TRUE,
                                             getVisits = FALSE,
                                             studyStartDate = "",
                                             studyEndDate = "",
                                             getTimeControlData = FALSE,
                                             maxNestingCohortSize = 1e+07,
                                             maxCasesPerOutcome = 5e+05) {
  analysis <- list()
  for (name in names(formals(createGetDbCaseCrossoverDataArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}

#' Create a parameter object for the function selectSubjectsToInclude
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param firstOutcomeOnly   Use the first outcome per person?
#' @param washoutPeriod      Minimum required numbers of days of observation for inclusion as either
#'                           case or control.
#' @param matchingCriteria   If provided, a case-time-control analysis will be performed and controls
#'                           will be matched based on these criteria.
#' @param minAge             Minimum age at which patient time will be included in the analysis. Note
#'                           that information prior to the min age is still used to determine exposure
#'                           status after the minimum age (e.g. when a prescription was started just
#'                           prior to reaching the minimum age). Also, outcomes occurring before the
#'                           minimum age is reached will be considered as prior outcomes when using
#'                           first outcomes only. Age should be specified in years, but non-integer
#'                           values are allowed. If not specified, no age restriction will be applied.
#' @param maxAge             Maximum age at which patient time will be included in the analysis. Age
#'                           should be specified in years, but non-integer values are allowed. If not
#'                           specified, no age restriction will be applied.
#'
#' @export
createSelectSubjectsToIncludeArgs <- function(firstOutcomeOnly = TRUE,
                                              washoutPeriod = 180,
                                              matchingCriteria = NULL,
                                              minAge = NULL,
                                              maxAge = NULL) {
  analysis <- list()
  for (name in names(formals(createSelectSubjectsToIncludeArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}

#' Create a parameter object for the function getExposureStatus
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param firstExposureOnly      Should only the first exposure per subject be included?
#' @param riskWindowStart        The start of the risk window (in days) relative to the index date.
#'                               This number should be non-positive.
#' @param riskWindowEnd          The end of the risk window (in days) relative to the index date. This
#'                               number should be non-positive.
#' @param controlWindowOffsets   Offsets in days of the control windows relative to the case window.
#'
#' @export
createGetExposureStatusArgs <- function(firstExposureOnly = FALSE,
                                        riskWindowStart = -30,
                                        riskWindowEnd = 0,
                                        controlWindowOffsets = c(-60)) {
  analysis <- list()
  for (name in names(formals(createGetExposureStatusArgs))) {
    analysis[[name]] <- get(name)
  }
  class(analysis) <- "args"
  return(analysis)
}
OHDSI/CaseCrossover documentation built on Nov. 21, 2020, 7:03 a.m.