vubiostat / redcapAPI

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

Test Failure on Missing Summary - Hard to Reproduce #339

Closed spgarbet closed 8 months ago

spgarbet commented 8 months ago

One of our automated environments is reporting the following failure:

Failure ('test-356-missingSummary.R:58:5'): Missing values are correctly identified around branching logic
missingSummary(...) not identical to `DesiredOutput`.
Component "redcap_data_access_group": Modes: character, logical
Component "redcap_data_access_group": target is character, current is logical
[ FAIL 1 | WARN 0 | SKIP 15 | PASS 2141 ]
Error: Test failures

I've tried reproducing an environment to match and cannot reproduce the error. I can make a similar error message happen with the following:

> expect_identical(NA_character_, NA)
Error: NA_character_ not identical to NA.
Types not compatible: character is not logical
> expect_identical(NA, NA_character_)
Error: NA not identical to NA_character_.
Modes: logical, character
target is logical, current is character

But note the first order fails to reproduce the wording, and the second call has the order reversed.

spgarbet commented 8 months ago

Aside, should missingSummary be updated?

> missingSummary(rcon,
+                      exportRecordsArgs = list(fields = "record_id", 
+                                               records = as.character(1:20), 
+                                               forms = "branching_logic"))
Please use exportRecordsTyped instead. exportRecords is will undergo breaking changes in version 3.0.0.
  record_id redcap_event_name redcap_data_access_group redcap_repeat_instrument redcap_repeat_instance n_missing
1         1     event_1_arm_1                       NA                       NA                     NA         6
                                                                                missing
1 row_purpose, prereq_radio, prereq_number, prereq_date, prereq_yesno, no_prereq_number
spgarbet commented 8 months ago

Reproduced message:

> expect_identical(list(x=c(NA_character_, NA_character_)), list(x=c(NA,NA)))
Error: list(x = c(NA_character_, NA_character_)) not identical to list(x = c(NA, NA)).
Component "x": Modes: character, logical
Component "x": target is character, current is logical
spgarbet commented 8 months ago

340 solves this.