checking for partially-returned datasets
Showing 1 of 16 files from the diff.
R/redcap-read.R
changed.
Other files ignored by Codecov
tests/testthat/test-read-oneshot.R
has changed.
REDCapR.Rproj
has changed.
tests/testthat/test-read-superwide.R
has changed.
tests/testthat/test-read-batch-simple.R
has changed.
utility/refresh.R
has changed.
NEWS.md
has changed.
inst/test-data/super-wide-3/generate-dictionary.R
has changed.
@@ -268,7 +268,7 @@
Loading
268 | 268 | token = token, |
|
269 | 269 | records_collapsed = records_collapsed, |
|
270 | 270 | fields_collapsed = metadata$data$field_name[id_position], |
|
271 | - | forms_collapsed = forms_collapsed, |
|
271 | + | # forms_collapsed = forms_collapsed, |
|
272 | 272 | events_collapsed = events_collapsed, |
|
273 | 273 | filter_logic = filter_logic, |
|
274 | 274 | datetime_range_begin = datetime_range_begin, |
@@ -303,7 +303,7 @@
Loading
303 | 303 | # Continue as intended if the initial query succeeded. -------------------- |
|
304 | 304 | unique_ids <- sort(unique(initial_call$data[[id_position]])) |
|
305 | 305 | ||
306 | - | if (all(nchar(unique_ids)==32L)) |
|
306 | + | if (0L < length(unique_ids) & all(nchar(unique_ids)==32L)) |
|
307 | 307 | warn_hash_record_id() # nocov |
|
308 | 308 | ||
309 | 309 | ds_glossary <- REDCapR::create_batch_glossary(row_count=length(unique_ids), batch_size=batch_size) |
@@ -325,6 +325,11 @@
Loading
325 | 325 | min(selected_ids), " through ", max(selected_ids), |
|
326 | 326 | " (ie, ", length(selected_ids), " unique subject records)." |
|
327 | 327 | ) |
|
328 | + | # message( |
|
329 | + | # "\nReading batch ", i, " of ", nrow(ds_glossary), ", with subjects ", |
|
330 | + | # paste(selected_ids, collapse = ','), |
|
331 | + | # "\n(ie, ", length(selected_ids), " unique subject records)." |
|
332 | + | # ) |
|
328 | 333 | } |
|
329 | 334 | read_result <- REDCapR::redcap_read_oneshot( |
|
330 | 335 | redcap_uri = redcap_uri, |
@@ -391,6 +396,30 @@
Loading
391 | 396 | ) |
|
392 | 397 | } |
|
393 | 398 | ||
399 | + | unique_ids_actual <- sort(unique(ds_stacked[[id_position]])) |
|
400 | + | ids_missing_rows <- setdiff(unique_ids, unique_ids_actual) |
|
401 | + | ||
402 | + | if (0L < length(ids_missing_rows)) { |
|
403 | + | message_template <- |
|
404 | + | paste0( |
|
405 | + | "There are %i subject(s) that are missing rows in the returned dataset. ", |
|
406 | + | "REDCap's PHP code is likely trying to process too much text in one bite.\n\n", |
|
407 | + | "Common solutions this problem are:\n", |
|
408 | + | " - specifying only the records you need (w/ `records`)\n", |
|
409 | + | " - specifying only the fields you need (w/ `fields`)\n", |
|
410 | + | " - specifying only the forms you need (w/ `forms`)\n", |
|
411 | + | " - specifying a subset w/ `filter_logic`\n", |
|
412 | + | " - reduce `batch_size`\n\n", |
|
413 | + | "The missing ids are:\n", |
|
414 | + | "%s." |
|
415 | + | ) |
|
416 | + | stop(sprintf( |
|
417 | + | message_template, |
|
418 | + | length(ids_missing_rows), |
|
419 | + | paste(ids_missing_rows, collapse=",") |
|
420 | + | )) |
|
421 | + | } |
|
422 | + | ||
394 | 423 | elapsed_seconds <- as.numeric(difftime( Sys.time(), start_time, units="secs")) |
|
395 | 424 | status_code_combined <- paste(lst_status_code , collapse="; ") |
|
396 | 425 | outcome_message_combined <- paste(lst_outcome_message, collapse="; ") |
Files | Coverage |
---|---|
R | 96.16% |
Project Totals (36 files) | 96.16% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.