sibis-platform / ncanda-data-integration

This is the Data Integration, MRI, and Bioinformatics Component of the National Consortium on Alcohol and NeuroDevelopment in Adolescence (NCANDA), funded by the NIAAA.
https://www.nitrc.org/projects/ncanda-datacore
BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

Add specific precision to calculated fields in Redcap datadicts #329

Open shippy opened 5 years ago

shippy commented 5 years ago

(Technically not a codebase change, but not sure where else this should go.)

Currently, any Redcap calculation results in a float. The float precision varies between:

This results in value instability. Opening "Visit notes" instrument in Redcap recomputes all calc fields using the Javascript driver in the used browser. See e.g. on this record how the value fluctuates.

Two things are annoying about this:

  1. We cannot guarantee equal precision between releases,
  2. An annoying UX side-effect is that opening any form with a calculated field results in the form changing, and then prompting the user to save or discard changes on exit.

Per Redcap Community Forums, rounding to a specified precision is the best practice here. This means wrapping any calculation with this issue in round() and specifying precision as second argument.