CHOP-CGTInformatics / REDCapTidieR

Makes it easy to read REDCap Projects into R
https://chop-cgtinformatics.github.io/REDCapTidieR/
Other
33 stars 8 forks source link

[FEATURE] Improve error messages for `parse_labels()` failures #130

Closed ezraporter closed 1 year ago

ezraporter commented 1 year ago

Feature Request Description

parse_labels() currently has two distinct errors for problematic labels: https://github.com/CHOP-CGTInformatics/REDCapTidieR/blob/f1ed7ac6f7edf4984b16796a74c3f58780306f45/R/utils.R#L127-L130

https://github.com/CHOP-CGTInformatics/REDCapTidieR/blob/f1ed7ac6f7edf4984b16796a74c3f58780306f45/R/utils.R#L148-L151

The fix in #129 made it clear that we can't reliably tell these cases apart. For example consider the string: "raw1, label1 | raw2, label2". Inserting an extra | anywhere would create a new raw-label pair without a comma which causes the first error above to fire. The second error becomes redundant and it never fired.

Proposed Solution

Simplify our erroring scheme so that a single error is thrown that warns generally about commas or pipes in the labels.

Checklist

ezraporter commented 1 year ago

Agreed that we should convert this to a single warning with the information that there may be a stray comma or pipe in select_choices_or_calculations