R/check_prostate_redcap.R
    check_prostate_redcap.RdRun sequential quality control checks and
thereby restrict the pts and smp datasets
to cases that pass certain criteria. trt (treatment) data are
passed along without changes.
check_prostate_redcap(
  data,
  qc_crit_pts = qc_criteria_pts(),
  qc_crit_smp = qc_criteria_smp(),
  qc_level_pts = NULL,
  qc_level_smp = NULL,
  recommended_only = FALSE,
  time_origin = c("seq", "dx", "adt", "met")
)List with elements pts and smp,
returned by load_prostate_redcap.
Criteria for checking the pts tibble.
Defaults to the return of the qc_criteria_pts function.
Custom criteria can be supplied instead.
Criteria for checking the smp tibble.
Defaults to the return of the qc_criteria_smp function.
Custom criteria can be supplied instead.
Level of QC that the return pts tibble
will be restricted to. By default, all QC steps in qc_crit_pts
will be applied. A integer index (row) number of
qc_crit_pts can be provided instead to perform
less strict exclusions. qc_level_pts = 1 will perform
no exclusions.
As qc_level_pts, for smp.
Return qc'd pts and smp
restricted to variables that are recommended for use in analyses?
Defaults to FALSE but is recommended for use.
Time origin for follow-up time scales: sequencing
("seq"), diagnosis ("dx"), from initiation of androgen
deprivaiton therapy "adt", or from metastasis ("met")?
Provide multiple origins as, e.g., c("dx", "seq").
Returns all variables by default or if recommended_only = FALSE.
List:
pts: Patient-level data after QC.
smp: Sample-level data after QC.
qc_pts: Tibble of sequential exclusions for pts.
qc_smp: Tibble of sequential exclusions for smp.
The qc_pts and qc_smp tibbles can be used to extract
information on which records failed which QC step.
Overview of analysis-ready data elements: https://stopsack.github.io/prostateredcap/articles/dataelements.html
if (FALSE) {
# Process output of load_prostate_redcap():
pts_smp_qc <- check_prostate_redcap(pts_smp, recommended_only = TRUE)
}