# Optimizing Real World Data Collection: Improving the UX/UI of REDCap via Branching Logic

Image credit: Sakura

Objectives for the Optimizing Real World Data Collection Tutorial Series

Overview

• Real World Data (RWD) - that is data accumulated outside of well-structured clinical trials - is an important source of clinical information that can help fill knowledge gaps that result from the highly-controlled setting of sponsored-intervention studies, such as randomized-controlled trials (RCTs)
• Data collection in the heterogenous environment of the “real-world setting” (RWS) is an important complement to sponsored-intervention studies
• RWD, while suffering from limitations in internal validity, often has superior external validity compared to RCTs
• Nevertheless, there are significant inherent challenges of collecting highly unstructured data in the real-world setting
• Therefore, strategies to facilitate the collection of RWD are sorely needed
• In this series of tutorial posts, we aim to provide a learning repository for readers to become familiar with available resources that can enhance Real World Data capture
• We will cover topics aimed at optimizing instrument development in REDCAp to ensure a seamless user experience/user interface (UX/UI) for data abstractors, and cover built-in tools essential to managing quality control of captured RWD

Overview of REDCap

• REDCap is a user-friendly, web-based research electronic data capture platform utilized by researchers worldwide to collect structured data for statistical analysis.1,2
• It is a powerful, secure, and HIPAA compliant database building solution created by Vanderbilt University in 2004 that allows development and deployment of subject facing surveys as well as forms for data capture by data entry personnel
• Our lab has adopted REDCap as the data collection platform for our rare tumor patient registries. We have additionally deployed modules built in REDCap to streamline and analyze operations in the multidisciplinary clinic setting

### Branching Logic: Tutorial Overview

#### Key Points

• Intelligent branching of fields streamlines the data abstraction process and is one important method of real-time quality control of data entry. Furthermore, it optimizes the UX/UI interface by removing irrelevant/ not applicable questions from view. This reduces clicks for the user as they are only required to capture data elements relevant to that specific encounter based on previously collected data through conditional logic.
• After this lesson, you will:
• Understand common uses of branching logic in REDCap
• Gain familiarity with the basic syntax of branching logic in REDCap
• Understand the different options REDCap provides for creating branching logic
• Skill Level: Beginner

### Uses for Branching Logic in REDCap

REDCap allows for conditional logic, that is making the display of a particular field, or set of fields, contingent upon what was entered for fields elsewhere, either within the same form or within the same group of forms. This ability to “branch” fields helps maximize the user experience for the data entry person, and also powerfully contributes to quality control of data entry in real-time.

#### Common scenarios

A certain set of fields is germane only for a specific subgroup of subjects.

• For example, you might be interested in collecting prior pregnancy details only if a subject had a history of being assigned to female sex at birth, or, even more specifically, if the subject confirms a history of prior pregnancy.

• If you are interested specifically in details of medical immunosuppressants, you may condition capturing data on specific medications/agents and circumstances of administration only if the subject confirms having history of being on immunosuppressants.

A complex set of fields may be useful to display only in cases where the associated data is accessible to the data entry person.

• For example, you might want to display a set of fields for capture of details on tumor histopathology only when the data entry person specifies that the tumor has been biopsied and associated reports are available.

A calculated field is calculable (and therefore useful for display) only if a set of fields have appropriate values entered in.

• Display a calculated field with the BMI of a patient, only if there is data entered for the patient’s height and weight.

### Syntax of REDCap Branching

There are many types of fields in REDCap which can provide the values upon which you may construct your branching logic. These include free-text number fields, multiple choice fields (whether radio-buttons or dropdowns), checkbox fields, as well as calculated fields. You may branch on values of fields that are visible on page to the data entry person, or on values of calculated fields that might be only visible to the database architect (through the use of the @HIDDEN action tag). Ultimately, the values captured by the fields above are all stored as numbers, allowing for deployment of conditional logic as described below.

• The basic syntax of REDCap branching logic employs Logical and Boolean operators.

Logical operators
Equals =
Does not equal <>
Greater than >
Less than <
Boolean operators
Must satisfy all of multiple conditions AND
Must satisfy one of multiple conditions OR

Notes

• Variable names must be contained within square brackets (ex. [field1]).

• For multiple-choice radio-button or dropdown fields, each option is assigned a corresponding numerical output. For example, “Yes” may be assigned 1, and “No” may be assigned 0.

• For example, consider branching a set of fields concerning number of pregnancies and associated outcomes on the field below.

• The branching logic [pregnancy_hx] = 1, in this case, would display a field only if the answer to [pregnancy_hx] was “Yes.”

• To branch on a checklist field (ex, [checklist]), you must use the following syntax: [checklist(1)] = 1 (describes case where the specific checkbox designated as #1 has been checked off) versus [checklist(1)] = '0' (describes case where checkbox #1 has not been checked).

• Using the value 0 in conditional logic is a common source of error. The condition [examplefield] = 0 is satisfied if the data entered into this field numerically equates to zero, or if this field was left empty. Use single or double quotes ('0' or "0") to specify zero as the entered field value.

• If you would like to display a field only if another reference field has data entered into it (regardless of the exact value), the branching logic would be [referencefield] <> '', or [referencefield] <> "" (empty quotes).

### Methods of Input for REDCap Branching

There are 3 ways to construct branching logic in REDCap:

• Two are accessed through the Online Designer by clicking the branching icon for the field.

• This opens the Online Designer’s Branching Logic interface, with the 2 available methods.

1. The Advanced Branching Logic Syntax box, in which you type in the desired conditional logic (combination of conditional and Boolean operators) by hand. This is the most flexible option and is useful for more complex branching.

1. The Drag-N-Drop Logic Builder which generates a bank of field choices (combinations of fields with different available values) for whichever instrument (i.e. form) in the record that you specify. You may drag the desired choices from the bank on the left to the selection box on the right. You may drag more than one field choice into the selection box and specify the “ALL” or “ANY” options as your Boolean operators.

2. The third option is to input the conditional logic directly into the Data Dictionary spreadsheet and then upload back into REDCap. This is particularly useful for generating repetitive structures, as you can copy and paste cells in bulk.

• To do this, the steps are:

2. Edit the branching logic in the appropriate column (columns not relevant to the topic have been hidden below) and save the spreadsheet.