This PR provides support for Data Access Groups (DAGs) primarily by introducing a new argument to read_redcap() in the form of export_data_access_groups which plugs directly into our REDCapR::redcap_read_oneshot() call (and is identical to the argument used there).
Unlike in redcap_read_oneshot(), I opted to make the default TRUE to both follow suit with export_survey_fields and because there's nothing to really lose if no DAGs are found. Instead, DAGs will be auto-added if they are detected and the same behavior exists in REDCapR (although the default there is FALSE).
To supplement this, two new REDCapTidieR test databases were made using DAGs for a non-longitudinal and a longitudinal database. Mocks were also updated, so you may want to add these environ vars to your files once you generate your own API keys (see /inst/misc/fake_credentials for names).
Proposed Changes
List changes below in bullet format:
Add support for DAGs to read_redcap() and updated associated clean_*/distill_* functions
This is very similar to logic we already included for survey fields
Add redcap_data_access_group/"REDCap Data Access Group" to labels
Update mocks and vignette mocks
Add tests using new mocks to confirm new column and label
I think these could be made better and am open to suggestions!
Issue Addressed
Closes #57
PR Checklist
Before submitting this PR, please check and verify below that the submission meets the below criteria:
[x] New/revised functions have associated tests
[x] New/revised functions that update downstream outputs have associated static testing files (.RDS) updated under inst/testdata/create_test_data.R
[x] New tests that make API calls use httptest::with_mock_api and any new mocks were added to tests/testthat/fixtures/create_httptest_mocks.R
[x] New/revised functions use appropriate naming conventions
Description
This PR provides support for Data Access Groups (DAGs) primarily by introducing a new argument to
read_redcap()
in the form ofexport_data_access_groups
which plugs directly into ourREDCapR::redcap_read_oneshot()
call (and is identical to the argument used there).Unlike in
redcap_read_oneshot()
, I opted to make the defaultTRUE
to both follow suit withexport_survey_fields
and because there's nothing to really lose if no DAGs are found. Instead, DAGs will be auto-added if they are detected and the same behavior exists inREDCapR
(although the default there isFALSE
).To supplement this, two new REDCapTidieR test databases were made using DAGs for a non-longitudinal and a longitudinal database. Mocks were also updated, so you may want to add these environ vars to your files once you generate your own API keys (see
/inst/misc/fake_credentials
for names).Proposed Changes
List changes below in bullet format:
read_redcap()
and updated associatedclean_*
/distill_*
functionsredcap_data_access_group
/"REDCap Data Access Group" to labelsIssue Addressed
Closes #57
PR Checklist
Before submitting this PR, please check and verify below that the submission meets the below criteria:
.RDS
) updated underinst/testdata/create_test_data.R
httptest::with_mock_api
and any new mocks were added totests/testthat/fixtures/create_httptest_mocks.R
usethis::use_dev_version()
Code Review
This section to be used by the reviewer and developers during Code Review after PR submission
Code Review Checklist