diff --git a/NEWS.md b/NEWS.md index 44ea5f95..dfbe34a8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -71,6 +71,9 @@ This will help extract forms from longitudinal & repeating projects. * `redcap_file_upload_oneshot()` to `redcap_file_upload_opneshot()` * `redcap_download_instrument()` to `redcap_instrument_download()` +* `redcap_dag_read()` has new `data_access_group_id` field (introduced maybe in [13.1.0](https://community.projectredcap.org/articles/13/index.html)) (#459) +* `redcap_users_export()` has new `mycap_participants` field (introduced maybe in [13.0.0](https://community.projectredcap.org/articles/13/index.html)) (#459) + Version 1.1.0 (released 2022-08-10) ========================================================== diff --git a/inst/test-data/specific-redcapr/users-export/with-dags--user.R b/inst/test-data/specific-redcapr/users-export/with-dags--user.R index 07e30c02..37ffe159 100644 --- a/inst/test-data/specific-redcapr/users-export/with-dags--user.R +++ b/inst/test-data/specific-redcapr/users-export/with-dags--user.R @@ -14,6 +14,6 @@ structure(list(username = c("unittestphifree", "wbeasleya"), TRUE), mobile_app_download_data = c(FALSE, TRUE), record_create = c(FALSE, TRUE), record_rename = c(FALSE, FALSE), record_delete = c(FALSE, FALSE), lock_records_all_forms = c(FALSE, FALSE), lock_records = c(FALSE, - FALSE), lock_records_customization = c(FALSE, FALSE), forms_export = c("demographics:1", - "demographics:1")), row.names = c(NA, -2L), class = c("tbl_df", -"tbl", "data.frame")) + FALSE), lock_records_customization = c(FALSE, FALSE), mycap_participants = c(0, + 0), forms_export = c("demographics:1", "demographics:1")), row.names = c(NA, +-2L), class = c("tbl_df", "tbl", "data.frame")) diff --git a/inst/test-data/specific-redcapr/users-export/without-dags--user.R b/inst/test-data/specific-redcapr/users-export/without-dags--user.R index 464338d1..7350bb58 100644 --- a/inst/test-data/specific-redcapr/users-export/without-dags--user.R +++ b/inst/test-data/specific-redcapr/users-export/without-dags--user.R @@ -15,6 +15,7 @@ structure(list(username = c("unittestphifree", "wbeasleya"), FALSE), mobile_app_download_data = c(FALSE, FALSE), record_create = c(TRUE, TRUE), record_rename = c(FALSE, FALSE), record_delete = c(FALSE, FALSE), lock_records_all_forms = c(FALSE, FALSE), lock_records = c(FALSE, - FALSE), lock_records_customization = c(FALSE, FALSE), forms_export = c("demographics:1,health:1,race_and_ethnicity:1", + FALSE), lock_records_customization = c(FALSE, FALSE), mycap_participants = c(0, + 0), forms_export = c("demographics:1,health:1,race_and_ethnicity:1", "demographics:1,health:1,race_and_ethnicity:1")), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame")) diff --git a/playgrounds/eav-playground-2.R b/playgrounds/eav-playground-2.R index bf732ca9..ee588a89 100644 --- a/playgrounds/eav-playground-2.R +++ b/playgrounds/eav-playground-2.R @@ -87,7 +87,7 @@ ds_eav_possible <- # ds_form_pt <- # ds_metadata %>% # dplyr::filter(.data$field_type == "complete") %>% -# dplyr::select(.data$field_name, .data$form_name) %>% +# dplyr::select("field_name", "form_name") %>% # dplyr::inner_join(ds_eav, by = "field_name") %>% # dplyr::mutate( # .default_check = dplyr::i @@ -107,10 +107,10 @@ ds_eav_2 <- value = dplyr::if_else(.data$checkbox, as.character(!is.na(.data$value)), .data$value), ) %>% dplyr::right_join(ds_eav_possible, by = c("record", "event_id", "field_name")) %>% - dplyr::select(-.data$field_type, -.data$field_name_base, -.data$checkbox) %>% + dplyr::select(-"field_type", -"field_name_base", -"checkbox") %>% dplyr::left_join( ds_metadata %>% - dplyr::select(.data$field_name, .data$field_name_base, .data$field_type), + dplyr::select("field_name", "field_name_base", "field_type"), by = "field_name" ) %>% dplyr::mutate( @@ -120,7 +120,7 @@ ds_eav_2 <- ds <- ds_eav_2 %>% - dplyr::select(-.data$field_type, -.data$field_name_base) %>% + dplyr::select(-"field_type", -"field_name_base") %>% # dplyr::slice(1:46) %>% # dplyr::group_by(record, redcap_repeat_instrument, redcap_repeat_instance, event_id, field_name) %>% # dplyr::summarise(n = dplyr::n(), .groups = "drop") %>% @@ -130,8 +130,8 @@ ds <- # tidyr::drop_na(event_id) %>% # TODO: need a good fix for repeats tidyr::pivot_wider( # Everything else is considered an ID column id_cols = !!.fields_plumbing, - names_from = .data$field_name, - values_from = .data$value + names_from = "field_name", + values_from = "value" ) %>% dplyr::select(!!.fields_to_return) # dplyr::select(.data = ., !!intersect(variables_to_keep, colnames(.))) @@ -144,7 +144,7 @@ ds[[.record_id_name]] <- NULL ds <- ds %>% dplyr::rename( - !!.record_id_name := .data$record + !!.record_id_name := "record" ) %>% readr::type_convert(col_types)# |> # View() diff --git a/tests/testthat/test-dag-read.R b/tests/testthat/test-dag-read.R index 32c64c00..dca4236a 100644 --- a/tests/testthat/test-dag-read.R +++ b/tests/testthat/test-dag-read.R @@ -19,15 +19,17 @@ test_that("smoke", { test_that("dag-default", { testthat::skip_on_cran() expected_data <- - structure( - list(data_access_group_name = c("dag_1", "dag_2"), - unique_group_name = c("dag_1", "dag_2")), row.names = c(NA, - -2L), spec = structure(list(cols = list(data_access_group_name = structure(list(), class = c("collector_character", + structure(list(data_access_group_name = c("dag_1", "dag_2"), + unique_group_name = c("dag_1", "dag_2"), data_access_group_id = c(36, + 37)), row.names = c(NA, -2L), spec = structure(list(cols = list( + data_access_group_name = structure(list(), class = c("collector_character", "collector")), unique_group_name = structure(list(), class = c("collector_character", + "collector")), data_access_group_id = structure(list(), class = c("collector_double", "collector"))), default = structure(list(), class = c("collector_guess", "collector")), delim = ","), class = "col_spec"), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame") ) + # dput(actual$data) actual <- redcap_dag_read( redcap_uri = credential_1$redcap_uri, @@ -45,13 +47,16 @@ test_that("dag-default", { testthat::skip_on_cran() expected_data <- structure( - list(data_access_group_name = character(0), unique_group_name = character(0)), row.names = integer(0), spec = structure(list( + list(data_access_group_name = character(0), unique_group_name = character(0), + data_access_group_id = character(0)), row.names = integer(0), spec = structure(list( cols = list(data_access_group_name = structure(list(), class = c("collector_character", "collector")), unique_group_name = structure(list(), class = c("collector_character", + "collector")), data_access_group_id = structure(list(), class = c("collector_character", "collector"))), default = structure(list(), class = c("collector_guess", "collector")), delim = ","), class = "col_spec"), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame") ) + # dput(actual$data) actual <- redcap_dag_read( diff --git a/tests/testthat/test-version.R b/tests/testthat/test-version.R index 27e26fd9..e39d29c7 100644 --- a/tests/testthat/test-version.R +++ b/tests/testthat/test-version.R @@ -24,12 +24,12 @@ test_that("version-successful", { verbose = FALSE ) - expected <- package_version("12.5.5") + expected <- package_version("13.1.0") version_good <- (expected <= actual) expect_true(version_good) }) -test_that("version-unuccessful-bad-token", { +test_that("version-unsuccessful-bad-token", { testthat::skip_on_cran() actual <- redcap_version(