-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exportBulkRecords exportRecordsTyped choice string does not appear to be formatted for choices redcapAPI_2.8.5 #344
Comments
@dpfindll, could you get a screen shot of how the choices are defined for the giq_1a property. The error indicates that there is something in the choices definition that violates the assumption in our text matching. It would help to see this definition in order to diagnose the problem. |
This will show it as well:
|
I think the code is confused because the value is repeated in the text description. Here's the source of the rejection of the select_choices in the library.
|
Possible workaround for now: Change it to "0,0 - Not at all|1,|2,|3,|4,|5,|6, 6 - Very" For @nutterb and I to consider is if this is an error in the library. |
Thank you for the quick response. Is there a way to make this change to the redcap project from the API or does this change need to be made from the redcap project? I have many fields formatted this way. |
This is a REDCap project change. I think the current version of REDCap does it in the format we expected, but older projects might have had definitions like this. I suspect you set this project up a few years back (please correct me if that's wrong). If we patch the library it'll take a few days to get something through the process. |
Correct, this is an older project. Thank you for all the quick responses and your time. |
We were so close to having this right! We have two regexes for evaluating the multiple choice strings
The strict form matches the current format of [code],[label]. The non-string form matches the older form of [label]. But this particular case uses both in the same definition. I'll see if I can blend them, and then determine what kind of chaos it creates down stream. @dpfindll you say you have a lot of fields formatted like this. Are they all in this mixed style. It looks like things would start to work if you only had to fix the mixed style (but if that's still a lot of fields, not very feasible). |
@nutterb we have several thousand fields, but it looks like its only this particular form with 50 fields in the mixed style. I will try standardizing on [code], [label] |
So I managed to put together a very ugly regex that, in principle, satisfies the constraint of matching choice string with a mix of legacy and strict formats. After really thinking about it though, permitting this mix essentially decimates any meaningful assumptions of what a choice string should look like. I think we could just as well reduce this check to "does not start nor end with either a comma or pipe." This also means that if a user formats a set of choices that would be problematic in parsing the choices (for instance, if they put a pipe character in the label), instead of throwing an error that the string can't be interpreted as choices, create an incomprehensible choice matrix and spit out a lot of missing values. And it will do it quietly without any notice to the user about what is wrong. I'm actually quite confident that we would come to regret this change. I think this may be a case where we are better off developing a script to convert the meta data into the strict format so that it can be reuploaded to the project and work correctly. Lines 101 to 134 in 515c39c
|
I'm going to write up a function to convert your metadata. You should be able to upload it to your project (with approval from your REDCap Administrator) and convert these without quite as much effort. Stay tuned.... |
Try running this and let me know if that corrects the formats of the fields with the mixed formats. In fact, this should convert all of the legacy formatted variables to the modern format.
|
That being the case, then maybe it should be documented how to repair it in the troubleshooting section. Could it be a support function, e.g. |
Afternoon,
I'm running into an issue exporting my data using the exportBulkRecords and exportRecordsTyped. I must be doing something wrong and this is a simple fix. Is this an error with my data in redcap or with the updated API? Any help would be appreciated.
Thanks,
David
The text was updated successfully, but these errors were encountered: