00:00

Mastering Calculated Fields in REDCap

Learn how to utilize Calculated Fields in REDCap for various mathematical calculations, date manipulations, and data quality checks. Understand the different functions and techniques available, such as common mathematical operations, special functions, and conditional logic. Discover how to expand beyond Calculated Fields using @CALCTEXT and @CALCDATE action tags. Gain insights on the order of operations, data recalculation, and utilizing Data Quality Rule H. Watch a live demonstration to see these concepts in action.

paus
Download Presentation

Mastering Calculated Fields in REDCap

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simple and Complex Calculations in REDCap – Chris Kadolph

  2. What will we cover? • What is a Calculated Field? • What can you use inside a Calculated Field? • What types of calculations can you make? • Other Considerations • Expanding beyond the Calculated Field • Demonstration!

  3. What is a Calculated Field? • A "calc" is a special field type allows you to use math, special functions, and other techniques to calculate a value.

  4. What can you use inside a Calculated Field? • Common mathematical operations • Add (+), Subtract (-), Multiply (*), Divide (/) • Piped REDCap fields • i.e. [weight] • Special Functions • Conditional Logic (if) • Date Logic (datediff) • Numeric Functions (abs, mean, round, etc.) • Text Functions (contains, concat, length, etc.) • Refer to the Special Function documentation built right into the designer!

  5. What types of calculations can you make? • Common Mathematical Calculations • BMI • Aggregate Scores • Common Date Calculations • Age • Age based on a certain date • Distance between two dates (i.e. years, days)

  6. All "calc" results must be numeric!

  7. Other Considerations • Calc fields react to the other fields they depend on • Order matters! • Calc fields will also recalculate after the instrument/survey is saved • Data Quality Rule H can be used to check for, and correct, any invalid or outdated values.

  8. Expanding beyond the Calculated Field • @CALCTEXT • A special action tag that can be used on standard text fields • These can perform all the same calculations as a normal "calc" field • The result does not have to be numeric! • @CALCDATE • Another action tag that can be used to calculate a date based on another date and an offset (years, months, days, etc.) • The target field as well as the source field must use date validation

  9. DateDiff Quick Reference Guide • datediff([date1], [date2], 'd') OR • datediff([date1], [date2], 'd', false) • The distance between [date1] and [date2] is x days. • Result is always positive • Order does not matter • datediff([date1], [date2], 'd', true) • To go from [date1] to [date2], we must [ADD|SUBTRACT] x days • Result can be positive or negative • Order matters • Example scenarios: • Generating reminders to users of upcoming visits, 2 days in advance • datediff('today', [visit_date], 'd', true) <= 2 • Knowing when a visit date was missed (in the past, i.e. yesterday) • datediff('today', [visit_date], 'd', true) < 0

  10. Demonstration! https://redcap.link/rcd2023calcs

More Related