validateDatainBranchingLogic: Generate custom codes and evaluate based on branching logics

validate_data_in_branching_logicR Documentation

Generate custom codes and evaluate based on branching logics

Description

This is a utility function that uses branching logic to validate data entry workflow for errors of omission.

Usage

validate_data_in_branching_logic(rec, metadataName = "metadata.formatted",
  dataName = "data.raw",
  ipno_var = stop("Provide variable name for IP Number"),
  dateOfEntry_var = stop("Provide variable name for date of entry"),
  recordID_var = stop("Provide variable name for record ID"),
  hospitalID_var = stop("Provide variable name for hospitals"),
  individual.vars = stop("Provide a list of variables to be validated individually"),
  n.groups = NULL, group.names = NULL, validateTreatmentDates = F,
  treatmentFormName = NULL, dischargeDateVar = NULL,
  admissionDateVar = NULL)

Arguments

rec

Single record in the data

metadataName

Metadata name

dataName

Data name

ipno_var

Name of variable for patient IP Number

dateOfEntry_var

Name of variable that captures the date of entry

recordID_var

Name of variable that uniquely identifies records

hospitalID_var

Name of variable that holds the hospital code

individual.vars

A character name of the object containing variables to be validated individually

n.groups

Numebr of groups provided in group.names

group.names

A vector of character names of the objects containing variables to be validated as a group

validateTreatmentDates

Logical. If FALSE, treatment dates will not be validated

treatmentFormName

Name of the treatment section in the metadata. This is required if validateTreatmentDates is TRUE

dischargeDateVar

Name of variable that holds the date of discharge. This is required if validateTreatmentDates is TRUE

dischargeDateVar

Name of variable that holds the date of admission. This is required if validateTreatmentDates is TRUE

Details

Using the redcap metadata's newly created variable f.branching_logic, code is generated that validates data entry during the data capture process.

Value

A data frame with details of the errors.


smockin/RedcapData documentation built on Feb. 2, 2023, 3:19 a.m.