REDCapR icon indicating copy to clipboard operation
REDCapR copied to clipboard

Pipes in checkbox entry

Open wibeasley opened this issue 2 years ago • 1 comments

@BlairCooper, if you're itching for a regex challenge (similar to #500, #501, #502)... what can you do if the entry contains pipes?

I think I'm ok documenting that users shouldn't use pipes and expect this to work correctly. But if you're up for it, I'm curious if any solution exists.

image

From data dictionary:

"1, American Indian/Alaska Native | -2, Asian | 3, Native Hawaiian |or| Other Pacific Islander | 4, Black or African American | 5, White | 66, Unknown / Not Reported"

wibeasley avatar Jul 15 '23 17:07 wibeasley

I'm certain that this is impossible. Deconstructing the problem:

REDCap identifies codes and labels on the algorithm [code] [first comma] [label] [line break]

There's no restriction on [label] preventing the user from including commas or or pipes.

Unfortunately, when the API pushes out the definitions, it replaces the line break with a pipe. So there is no dedicated character for delimiting one code-label pairing from another. Quite literally, what we receive from the API is fundamentally different than what REDCap is parsing on its side.

So the combination of 1) replacing the line break with the pipe, and 2) allowing both pipes and commas in the label makes it impossible to generalize a solution that can properly parse labels that include a pipe.

nutterb avatar Oct 14 '23 00:10 nutterb