vubiostat / redcapAPI

R interface to REDCap (http://www.project-redcap.org/)
21 stars 27 forks source link

Peculiarity in exportRecordsTyped #387

Closed berryld1 closed 5 months ago

berryld1 commented 6 months ago

Not sure this is a bug - maybe not desirable behavior?

image

First call to exportRecordsTyped() - I'm asking for the record id field and a secondary unique identifier field. Gets out one row of data.

Second call to exportRecordsTyped() - add to that two more fields, which occur on a repeating instrument, which does not yet have any data in the project. Gets no data out.

Third call to exportRecordsTyped() - add to that filter_empty_rows = F. Gets out one row of data, as call #1.

I think there's an assumption on the part of exportRecordsTyped(), if I'm only asking for id fields, they are considered data and get returned. But if I'm asking for id fields + other fields, the eRT() assumes I really only care about the other fields, and I'm just asking for the IDs for the sake of, well, identifying things. So if other fields have no data, then eRT() thinks there's no data I care about.

This seems like a bad assumption.

filter_empty_rows = F solves it; still, seems to me, non-empty rows should be returned regardless if their only non-emptiness is identifiers?

Also, I know I owe you closing the loop on #381. I will do it instanter!

spgarbet commented 6 months ago

The problem is the identifier always has a value. Therefore filterEmptyRows would never filter anything. I don't see an alternative.

berryld1 commented 5 months ago

Ah, yes, fair enough - I see. I just need to always remember filterEmptyRows = F!