set_script_run_time ( )
-#> [1] "2024-01-30 19:47:23 UTC"
+#> [1] "2024-02-28 16:32:39 UTC"
set_script_run_time ( fake_runtime =
as.POSIXct ( "2021-02-23 02:23:00" ,
tz= "" ,
diff --git a/reference/set_super_api_token.html b/reference/set_super_api_token.html
index 1a045a8..37fa0c6 100644
--- a/reference/set_super_api_token.html
+++ b/reference/set_super_api_token.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/suspend_users_with_no_primary_email.html b/reference/suspend_users_with_no_primary_email.html
index 20d97a7..a0a6b77 100644
--- a/reference/suspend_users_with_no_primary_email.html
+++ b/reference/suspend_users_with_no_primary_email.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/sync_metadata.html b/reference/sync_metadata.html
index 50f79a6..79827c5 100644
--- a/reference/sync_metadata.html
+++ b/reference/sync_metadata.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/sync_table.html b/reference/sync_table.html
index ce3c1f0..25d5f59 100644
--- a/reference/sync_table.html
+++ b/reference/sync_table.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/sync_table_2.html b/reference/sync_table_2.html
index c81d783..ed68c7d 100644
--- a/reference/sync_table_2.html
+++ b/reference/sync_table_2.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/sync_table_test_user_data_result.html b/reference/sync_table_test_user_data_result.html
index 8f38899..75c064e 100644
--- a/reference/sync_table_test_user_data_result.html
+++ b/reference/sync_table_test_user_data_result.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/unnest_job_summary_data_json_object.html b/reference/unnest_job_summary_data_json_object.html
index 009757f..cbde1a0 100644
--- a/reference/unnest_job_summary_data_json_object.html
+++ b/reference/unnest_job_summary_data_json_object.html
@@ -32,7 +32,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/update_production_allocation_state.html b/reference/update_production_allocation_state.html
index 7c90959..2ab1df5 100644
--- a/reference/update_production_allocation_state.html
+++ b/reference/update_production_allocation_state.html
@@ -12,7 +12,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/update_redcap_email_addresses.html b/reference/update_redcap_email_addresses.html
index 5fbe85d..19a8f76 100644
--- a/reference/update_redcap_email_addresses.html
+++ b/reference/update_redcap_email_addresses.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/update_redcap_email_addresses_test_data.html b/reference/update_redcap_email_addresses_test_data.html
index 612a5a3..75549bd 100644
--- a/reference/update_redcap_email_addresses_test_data.html
+++ b/reference/update_redcap_email_addresses_test_data.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/user_rights_test_data.html b/reference/user_rights_test_data.html
index 58d4e10..10a57ed 100644
--- a/reference/user_rights_test_data.html
+++ b/reference/user_rights_test_data.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/verify_log_connectivity.html b/reference/verify_log_connectivity.html
index 492b47d..df64723 100644
--- a/reference/verify_log_connectivity.html
+++ b/reference/verify_log_connectivity.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/verify_log_dependencies.html b/reference/verify_log_dependencies.html
index d4fd14b..1943633 100644
--- a/reference/verify_log_dependencies.html
+++ b/reference/verify_log_dependencies.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/verify_log_env_variables.html b/reference/verify_log_env_variables.html
index 7ae78f6..0f9c728 100644
--- a/reference/verify_log_env_variables.html
+++ b/reference/verify_log_env_variables.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_allocations.html b/reference/write_allocations.html
index 7ac1487..d58a010 100644
--- a/reference/write_allocations.html
+++ b/reference/write_allocations.html
@@ -12,7 +12,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_debug_job_log_entry.html b/reference/write_debug_job_log_entry.html
index c99baff..dc03ca7 100644
--- a/reference/write_debug_job_log_entry.html
+++ b/reference/write_debug_job_log_entry.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_error_job_log_entry.html b/reference/write_error_job_log_entry.html
index 18ed182..7e9d2ab 100644
--- a/reference/write_error_job_log_entry.html
+++ b/reference/write_error_job_log_entry.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_error_log_entry.html b/reference/write_error_log_entry.html
index e776f0f..13a656a 100644
--- a/reference/write_error_log_entry.html
+++ b/reference/write_error_log_entry.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_info_log_entry.html b/reference/write_info_log_entry.html
index 852d650..d83e0cc 100644
--- a/reference/write_info_log_entry.html
+++ b/reference/write_info_log_entry.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_success_job_log_entry.html b/reference/write_success_job_log_entry.html
index 4efd689..df58143 100644
--- a/reference/write_success_job_log_entry.html
+++ b/reference/write_success_job_log_entry.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_summary_metrics.html b/reference/write_summary_metrics.html
index 10883e5..8798993 100644
--- a/reference/write_summary_metrics.html
+++ b/reference/write_summary_metrics.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/reference/write_to_sql_db.html b/reference/write_to_sql_db.html
index d3fe229..0a3c4d5 100644
--- a/reference/write_to_sql_db.html
+++ b/reference/write_to_sql_db.html
@@ -10,7 +10,7 @@
redcapcustodian
- 1.19.0
+ 1.20.0
diff --git a/search.json b/search.json
index d99256b..be50cd1 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"/articles/credential-scraping.html","id":"api-token-scraping-and-fabricating","dir":"Articles","previous_headings":"","what":"API Token Scraping and Fabricating","title":"Credential Scraping","text":"Using credential management tools requires .env files populated database credentials REDCap instance, following examples use one production instance (prod.env) one local instance (local_1134.env). local_1134.env file:","code":"INSTANCE=local_1134 TIME_ZONE=America/New_York # REDCap API endpoint, REDCap webroot + \"/api/\" URI=https://localhost:11134/api/ # REDCap DB Credentials REDCAP_DB_NAME=redcap REDCAP_DB_HOST=127.0.0.1 REDCAP_DB_USER=redcap REDCAP_DB_PASSWORD=redcap123 REDCAP_DB_PORT=3306"},{"path":"/articles/credential-scraping.html","id":"preparation","dir":"Articles","previous_headings":"API Token Scraping and Fabricating","what":"Preparation","title":"Credential Scraping","text":"following block creates credentials directory sqlite database store credentials.","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) # fetching all extant API tokens and adding them to storage ################# dir.create(\"credentials\") # creates file if one does not exist file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") # SQLite friendly schema credentials_sql <- \"CREATE TABLE IF NOT EXISTS `credentials` ( `redcap_uri` TEXT NOT NULL, `server_short_name` varchar(128) NOT NULL, `username` varchar(191) NOT NULL, `project_id` int(10) NOT NULL, `project_display_name` TEXT NOT NULL, `project_short_name` varchar(128) DEFAULT NULL, `token` varchar(64) NOT NULL, `comment` varchar(256) DEFAULT NULL ); \" dbExecute(file_conn, credentials_sql) dbDisconnect(file_conn)"},{"path":"/articles/credential-scraping.html","id":"scraping-a-servers-api-tokens-and-putting-them-in-a-local-sqlite-db-for-use","dir":"Articles","previous_headings":"API Token Scraping and Fabricating","what":"Scraping a server’s API tokens and putting them in a local sqlite DB for use","title":"Credential Scraping","text":"Fetching extant API tokens adding storage","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) # fetching all extant API tokens and adding them to storage ################# file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") dbExecute(file_conn, credentials_sql) load_dot_env(\"prod.env\") username <- \"your_redcap_username\" source_conn <- connect_to_redcap_db() source_credentials <- scrape_user_api_tokens(source_conn, username) # alter credentials to match local schema source_credentials_upload <- source_credentials %>% mutate( redcap_uri = Sys.getenv(\"URI\"), server_short_name = tolower(Sys.getenv(\"INSTANCE\")) ) %>% # remove duplicates anti_join( tbl(file_conn, \"credentials\") %>% collect() ) dbAppendTable(file_conn, \"credentials\", source_credentials_upload) dbDisconnect(file_conn) dbDisconnect(source_conn)"},{"path":"/articles/credential-scraping.html","id":"creating-api-tokens-for-all-local-projects","dir":"Articles","previous_headings":"API Token Scraping and Fabricating","what":"Creating API tokens for all local projects","title":"Credential Scraping","text":"","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") load_dot_env(\"local_1134.env\") # note, this will close any other connections target_conn <- connect_to_redcap_db() local_credentials <- scrape_user_api_tokens(target_conn, \"admin\") # specify a subset of project_ids rather than making tokens for all target_pids <- tbl(target_conn, \"redcap_projects\") %>% select(project_id) %>% filter(project_id > 15) %>% filter(!project_id %in% local(local_credentials$project_id)) %>% collect() %>% pull(project_id) # create tokens individually for(pid in target_pids) { set_project_api_token(target_conn, \"admin\", pid) } # gather newly created tokens and insert them into local storage local_credentials <- scrape_user_api_tokens(target_conn, \"admin\") local_credentials_upload <- local_credentials %>% mutate( redcap_uri = Sys.getenv(\"URI\"), server_short_name = tolower(Sys.getenv(\"INSTANCE\")) ) %>% # remove duplicates anti_join( tbl(file_conn, \"credentials\") %>% collect() ) dbAppendTable(file_conn, \"credentials\", local_credentials_upload) dbDisconnect(file_conn) dbDisconnect(target_conn)"},{"path":"/articles/credential-scraping.html","id":"syncing-a-production-project-to-your-local-instance","dir":"Articles","previous_headings":"","what":"Syncing a production project to your local instance","title":"Credential Scraping","text":"completing previous 2 sections. following chink uses credentials saved copy project metadata source project ()","code":"library(redcapcustodian) library(tidyverse) file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") source_username <- \"your_production_username\" source_credentials <- tbl(file_conn, \"credentials\") %>% filter(source_username) %>% filter(server_short_name == \"prod\") %>% collect() %>% filter( str_detect(project_display_name, \"The big important project\") ) %>% unnest() local_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == \"admin\") %>% filter(server_short_name == \"local_1134\") %>% collect() %>% # adjust url to make REDCapR's validation processes happy mutate(redcap_uri = str_replace(redcap_uri, \"https\", \"http\")) %>% mutate(redcap_uri = str_replace(redcap_uri, \"localhost\", \"127.0.0.1\")) %>% filter( str_detect(project_display_name, \"The big important project\") ) %>% unnest() sync_metadata(source_credentials, local_credentials, strip_action_tags = TRUE) dbDisconnect(file_conn)"},{"path":"/articles/credential-scraping.html","id":"large-data-dictionaries-and-xdebugredcap-docker-compose","dir":"Articles","previous_headings":"Syncing a production project to your local instance","what":"Large data dictionaries and XDebug/REDCap Docker Compose","title":"Credential Scraping","text":"REDCap instance hosted machine (docker container) using xdebug, metadata may large, case ’ll see error message like : Alter following file <-rdc-instance>/redcap-overrides/web/php/80-xdebug.ini set arbitrarily large stack frame limit, least equal number fields data dictionary","code":"The REDCapR write/import metadata operation was not successful. The error message was:\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t
REDCap crashed due to an unexpected PHP fatal error!<\/b> \\n\\t\\t\\t\\t\\tError message:<\/b> Uncaught Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in /var/www/html/redcap_v11.3.4/Classes/LogicParser.php:280\\ # solution: https://stackoverflow.com/a/65997576/7418735 xdebug.max_nesting_level="},{"path":"/articles/custom_rscript.html","id":"writing-your-own-redcapcustodian-rscripts","dir":"Articles","previous_headings":"","what":"Writing your own redcapcustodian Rscripts","title":"Custom Rscript","text":"basic use, redcapcustodian need load library Rscript. automate report ETL already redcapcustodian, need build image, write configuration file instantiate container image config file. Yet allows extensive customization builds upon framework provides.","code":""},{"path":"/articles/custom_rscript.html","id":"writing-your-own-rscripts","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Writing your own Rscripts","title":"Custom Rscript","text":"can write Rscript accomplish task one REDCap hosts projects. script load redcapcustodian package. make script clone redcap custodian repository, copy contents study_template new folder Rename Rstudio project match study’s name: can open new project Rstudio. first redcapcustodian project, might help follow example vignette(\"friday-call-demo\") RStudio. example created present REDCap Custodian REDCap community. first REDCap Custodian rodeo, might remember need , offer guide help avoid mis-steps.","code":"git clone git@github.com:ctsit/redcapcustodian.git cp -r redcapcustodian/site_template my.study cd ../my.study mv example.Rproj my.study.Rproj open my.study.Rproj"},{"path":"/articles/custom_rscript.html","id":"configure-your-interfaces","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Configure your interfaces","title":"Custom Rscript","text":"’ll need talk least REDCap MySQL database. probably want . Rename example.env testing.env configure development computer. file composed five sections. INSTANCE names REDCap system instance ’ll talking . file assumes talking one REDCap script. tools multiple-instances. TIME_ZONE local timezone REDCap instance. Note REDCap time facts local time. MariaDB driver Lubridate library default UTC. can get complicated. careful time. details see stupid_date_tricks.R Many scripts need send emails developers, REDCap Admin study coordinator. Set email values appropriately site study needs. need talk directly REDCap database, ’ll need provide credentials database. development work, enter credentials local MySQL Database. task study working might need database tables. might hold data need REDCap data fit well REDCap data model. REDCap projects large (think 30K records ) might want mirror REDCap project MySQL run performant queries. describes need, best mix tables REDCap tables. second MySQL table credentials scripts need access secrets. “ETL” prefix nothing special, means “Extract, Transform, Load”–common term database management. can use prefix like, want use prefix. database connection functions depend . REDCap Custodian provides rich framework logging success failure automated processes. default, logs activity MySQL databse choosing. REDCap database. ’s completely reasonable log study’s activity study database, don’t study database, shared logging database good thing. Make sure set LOG_DB_ values.","code":"INSTANCE=Development TIME_ZONE=America/New_York # Email config EMAIL_TO=you@example.org EMAIL_CC= EMAIL_FROM=please-do-not-reply@example.org SMTP_SERVER=smtp.example.org # REDCap DB Credentials REDCAP_DB_NAME=DB_NAME REDCAP_DB_HOST=DB_HOST REDCAP_DB_USER=DB_USER REDCAP_DB_PASSWORD=DB_PASSWORD REDCAP_DB_PORT=3306 # ETL DB Credentials ETL_DB_NAME= ETL_DB_HOST= ETL_DB_USER= ETL_DB_PASSWORD= ETL_DB_SCHEMA= ETL_DB_PORT= # Log DB Credentials LOG_DB_NAME= LOG_DB_HOST= LOG_DB_USER= LOG_DB_PASSWORD= LOG_DB_SCHEMA= LOG_DB_PORT="},{"path":"/articles/custom_rscript.html","id":"redcap-api-credential-management","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"REDCap API credential management","title":"Custom Rscript","text":"’s possible credential management environment variables, quickly gets tedious. get’s tedious manage multiple API tokens. address , REDCap custodian provides credential management functions help make use local dataset REDCAp API credentials. See vignette(\"credential-scraping\") example . Read Scraping server’s API tokens putting local sqlite DB","code":""},{"path":"/articles/custom_rscript.html","id":"create-your-scripts-in-the-right-folder","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Create your scripts in the right folder","title":"Custom Rscript","text":"Create scripts move clean data etl folder. Create reports reports folder. aren’t rules, useful conventions. excluded package build process make package code folders won’t cause warnings build.","code":""},{"path":"/articles/custom_rscript.html","id":"tiny-script-example","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Tiny script example","title":"Custom Rscript","text":"REDCap custodian includes example report script describe REDCap users REDCap User Lifecycle. provides example report run REDCap system. also example report output University Florida CTSI REDCap system annotations explain tells history activity UF system.","code":""},{"path":"/articles/custom_rscript.html","id":"logging","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Logging","title":"Custom Rscript","text":"REDCap Custodian provides valuable logging reduce stress running unattended jobs writing data important things. use logging need create MySQL/Maria DB, put credentials environment file described , load redcapcustodian package script, initialize logging. can also log success end script log warnings failure script can detect . ’s actual script makes changes redcap backend logs : script generated log record log database: job_summary_data JSON object data updated. ’s hard humans read 100% machine parsable. query job log, use favorite DB client. Tidyverse developer, dplyr::tbl() fantastic DB client.","code":"library(tidyverse) library(redcapcustodian) library(rcc.billing) library(DBI) library(dotenv) init_etl(\"update_project_billable_attribute\") conn <- connect_to_redcap_db() diff_output <- update_billable_by_ownership(conn) sync_activity <- redcapcustodian::sync_table( conn = conn, table_name = \"redcap_entity_project_ownership\", primary_key = \"id\", data_diff_output = diff_output, insert = F, update = T, delete = F ) activity_log <- diff_output$update_records %>% select(pid, billable, updated) log_job_success(jsonlite::toJSON(activity_log)) dbDisconnect(conn) INSERT INTO `rcc_job_log` (`job_duration`, `job_summary_data`, `level`, `log_date`, `script_name`, `script_run_time`) VALUES (80.16091799736023, '[{\\\"pid\\\":15,\\\"billable\\\":1,\\\"updated\\\":1657139254},{\\\"pid\\\":16,\\\"billable\\\":1,\\\"updated\\\":1657139254},{\\\"pid\\\":22,\\\"billable\\\":1,\\\"updated\\\":1657139254}]', 'SUCCESS', '2022-07-06 20:28:54.494426', 'update_project_billable_attribute', '2022-07-06 20:27:34.322926');"},{"path":"/articles/custom_rscript.html","id":"writing-good-data-management-code","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Writing good data management code","title":"Custom Rscript","text":"big topic cover central entire effort can’t entirely ignored. best favor can customers, use good tools. CTS-, identified toolset allows us efficient programming. strongly recommend tools: R 99% data programming. RStudio easiest possible integrated development environment R programming. Tidyverse effective dialect R code . REDCapR 99% REDCap API access. DBI dplyr::tbl() access SQL tables. ’s also wise good software development workflow. CTS-use tools rules: Use version control code. one developer, code review everything. one developer, use Github workflow pull requests, review, merges manage code review. Never put secrets code. Put secrets environment variables, datasets, systems. Never put secrets version control. Don’t put configuration code. Instead put environment variables datasets. Stop think architecture study lifecycle. Don’t mix two studies one git repository. Don’t afraid make R package just one study. Think names things. Pick good names. Don’t afraid rename poorly named things.","code":""},{"path":"/articles/custom_rscript.html","id":"automation-with-container-infrastructure","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Automation with container infrastructure","title":"Custom Rscript","text":"need something run periodically, need make easy run dependencies packaged need schedule . modern way package dependencies put container, add application run container. REDCap Custodian supports containerization Docker. ./study_template/Dockerfile template can use containerize RScript RMarkdown. Adapt needs build container ./build.sh. good container infrastructure, use build deploy containers. Running automated R Markdown reports docker requires use Rmd renderer. render_report.R contains functionality knit Rmd Qmd, email log job run. Rmd/Qmd script name passed command line argument render_report.R via cron. Refer sample_report example cron job.","code":""},{"path":"/articles/custom_rscript.html","id":"automation-with-linux-and-cron","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Automation with Linux and cron","title":"Custom Rscript","text":"container management infrastructure available , support provides Linux hosts, build one , install Docker , give sudo su access. allow build run docker images host. Login, git clone redcapcustodian’s git repository, cd repository build image: study repository: clone private repository, ’ll need deployment key. See Deploy Keys instructions. ’ve built study container Docker host, create cron entry run right parameters secrets. run script, etl/update_project_billable_attribute.R regularly host call ‘prod’, create cron entry : build script -d option automatically deploy cron file build time. place cron file ./cron/ folder root repository, build ./build.sh -d, build script copy file /etc/cron.d give guaranteed unique name.","code":"git clone git@github.com:ctsit/redcapcustodian.git cd redcapcustodian sudo ./build.sh git clone git@github.com:ctsit/rcc.billing.git cd rcc.billing sudo ./build.sh sudo su cat <> prod/cron/update_project_billable_attribute # run update_project_billable_attribute at 6:07 a.m. 7 6 * * * root /usr/bin/docker run --rm --env-file /rcc/rcc.billing/prod.env rcc.billing Rscript rcc.billing/etl/update_project_billable_attribute.R END"},{"path":"/articles/custom_rscript.html","id":"using-version-control","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Using version control","title":"Custom Rscript","text":"go road writing scripts, concerned preserving . One best ways via git version control. Initialize new software repository ./.study folder. add remote pointing new empty repository GitHub, GitLab, BitBucket favorite Git repository hosting service, push new repo.","code":""},{"path":"/articles/custom_rscript.html","id":"adding-a-custom-package","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Adding a custom package","title":"Custom Rscript","text":"want complex things redcapcustodian Rscripts share custom code , might want add R package just redcapcustodian work. redcapcustodian supports development package within ./.study/ folder. RStudio team’s packaging guidelines excellent guide package development. might seem like lot take , solve common problems. help write better code. don’t need submit package CRAN get value packaging guidelines. build latest version package build task container, uncomment lines task’s Dockerfile customize package name:","code":"# Add, build, and install this study's package ADD .. /home/rocker/my.study RUN R CMD build my.study RUN R CMD INSTALL my.study*.tar.gz RUN rm -rf my.study"},{"path":"/articles/delete-erroneous-survey-reminders.html","id":"activation","dir":"Articles","previous_headings":"","what":"Activation","title":"Deleting Erroneous Survey Reminders","text":"want use system, follow instructions REDCap Custodian make new R Project study_template don’t already project. revise cron/delete_erroneous_survey_reminders uncommenting cron line adjusting frequency needs. build deploy R Project.","code":""},{"path":"/articles/developer_notes.html","id":"release-and-deployment","dir":"Articles","previous_headings":"","what":"Release and Deployment","title":"Developer Notes for REDCap Custodian","text":"project uses Git Flow workflow releases. Every release versioned ChangeLog entry describes new features bug fixes. Every release also accompanied updated VERSION manual revision version number DESCRIPTION. latter tells devtools version number changes. former allows image builds tagged built build.sh deploy new release Linux host, execute series commands equivalent home directory host:","code":"git clone git@github.com:ctsit/redcapcustodian.git cd redcapcustodian git pull sudo ./build.sh"},{"path":"/articles/developer_notes.html","id":"local-logging-for-development-work","dir":"Articles","previous_headings":"","what":"Local logging for development work","title":"Developer Notes for REDCap Custodian","text":"development work, ’s useful local log database. allows initialize logging test scripts without throwing error even test write log success failure. REDCap Custodian provides example logging system form docker-compose.yml database schema ./rcc.log.db/. can start logging database commands: default, PHPMyAdmin interface accessible http://localhost:9080/. configuration parameters defined ./rcc.log.db/.env. parameters used ./study_template/example.env. Using example values local environment files allow scripts across redcap custodian projects allow share logging database. =======","code":"cd ./rcc.log.db/ docker-compose up -d"},{"path":"/articles/friday-call-demo-setup.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"setup instructions demonstration features REDCap Custodian R package. setup steps, demonstrate : Create local credentials database Fetch store API tokens credentials database Create load fake data REDCap projects want test . prelude demonstration moving data REDCap projects described vignette(\"friday-call-demo\").","code":""},{"path":"/articles/friday-call-demo-setup.html","id":"prequisites","dir":"Articles","previous_headings":"","what":"Prequisites","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"want , recommend things setup development testing environment: Install R, Rstudio, tidyverse packages Install redcapcustodian github Clone redcap-docker-compose git repo Create local REDCap redcap-docker-compose Create new project Rstudio. Note R project, REDCap project, Copy local.env.txt .env root new project folder. also need REDCap projects play . , ’s great. demo, need two REDCap projects exist. Please make projects XML files: main biospecimen. Name project main.xml: “Demo Main” Name project biospecimen.xml: “Demo Biospecimen” talk projects code, ’ll need API tokens. Add main biospecimen projects. project want play . changes place, can start developing scripts use REDCap Custodian.","code":""},{"path":"/articles/friday-call-demo-setup.html","id":"fetch-and-store-api-tokens","dir":"Articles","previous_headings":"","what":"Fetch and store API Tokens","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"First, load R packages: , make database hold credentials: Now, fetch API tokens write local credentials DB.","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) library(lubridate) dir.create(here::here(\"credentials\")) # creates file if one does not exist file_conn <- DBI::dbConnect(RSQLite::SQLite(), here::here(\"credentials/credentials.db\")) # SQLite friendly schema credentials_sql <- \"CREATE TABLE IF NOT EXISTS `credentials` ( `redcap_uri` TEXT NOT NULL, `server_short_name` varchar(128) NOT NULL, `username` varchar(191) NOT NULL, `project_id` int(10) NOT NULL, `project_display_name` TEXT NOT NULL, `project_short_name` varchar(128) DEFAULT NULL, `token` varchar(64) NOT NULL, `comment` varchar(256) DEFAULT NULL ); \" dbExecute(file_conn, credentials_sql) # fetching all extant API tokens and adding them to storage ################# load_dot_env(here::here(\"local.env.txt\")) my_username <- \"admin\" source_conn <- connect_to_redcap_db() scraped_credentials <- scrape_user_api_tokens(source_conn, my_username) # alter credentials to match local schema source_credentials_upload <- scraped_credentials %>% mutate( redcap_uri = Sys.getenv(\"URI\"), server_short_name = tolower(Sys.getenv(\"INSTANCE\")) ) %>% # remove duplicates anti_join( tbl(file_conn, \"credentials\") %>% collect() ) dbAppendTable(file_conn, \"credentials\", source_credentials_upload) DBI::dbDisconnect(source_conn)"},{"path":"/articles/friday-call-demo-setup.html","id":"make-test-data-and-write-it-to-your-test-projects","dir":"Articles","previous_headings":"","what":"Make test data and write it to your test projects","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"generate records main project port Biospecimen project. First, access credential database get credentials REDCap project want read . use Beasley’s REDCapR library interact REDCap via API. REDCapR allows specify forms, fields, event names, time frames interest. even allows REDCap filtering. isn’t necessary understand following block typically won’t populating project random data.","code":"source_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == my_username) %>% collect() %>% filter(str_detect(project_display_name, \"Demo Main\")) %>% unnest() # Disconnect when your done with the database dbDisconnect(file_conn) record_count_to_create <- 50 collection_events <- 5 tubes_per_collection <- 30 record_columns <- c( \"record_id\", \"redcap_event_name\", \"sample_collected_date\", \"tmp_event_id\", paste0(\"tube_id\", 1:tubes_per_collection), paste0(\"tube_specimen_type\", 1:tubes_per_collection), paste0(\"tube_volume\", 1:tubes_per_collection) ) # create empty dataframe and set column names simulated_data <- data.frame( matrix(ncol = length(record_columns), nrow = 0) ) %>% mutate(across(everything(), as.character)) colnames(simulated_data) <- record_columns # create base entries for each event # NOTE: may be a bit slow as for-loops are not generally used in R for (record_id in 1:record_count_to_create) { for (event_id in 1:collection_events) { simulated_data <- simulated_data %>% add_row( record_id = as.character(record_id), redcap_event_name = paste0(\"event_\", event_id, \"_arm_1\"), tmp_event_id = as.character(event_id), # used to generate tube IDs later sample_collected_date = sample( seq(ymd(\"2020-03-01\"), ymd(\"2022-06-01\"), by = \"day\"), size = 1, replace = T ) %>% as.character() ) } } # group to ensure simulated data is consistent with a single collection event simulated_data <- simulated_data %>% group_by(record_id, redcap_event_name) # simulate individual samples for (tube in 1:tubes_per_collection) { simulated_data <- simulated_data %>% mutate( \"tube_id{tube}\" := paste0( record_id, \"-\", str_pad(tmp_event_id, width = 2, side = \"left\", pad = \"0\"), \"-\", str_pad(tube, width = 2, side = \"left\", pad = \"0\") ), \"tube_specimen_type{tube}\" := sample(1:4, size = 1), \"tube_volume{tube}\" := sample(2:4, size = 1) ) } # remove temporary column used in simulation simulated_data <- simulated_data %>% ungroup() %>% select(-tmp_event_id) # upload data to REDCap REDCapR::redcap_write( redcap_uri = source_credentials$redcap_uri, token = source_credentials$token, ds_to_write = simulated_data )"},{"path":"/articles/friday-call-demo.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"REDCap Custodian Friday Call Demo","text":"demonstration features REDCap Custodian R package. demonstrate : Fetch store API tokens database Get data REDCap project Transform data Write another project Review logs job ’ll talk automate whole process.","code":""},{"path":"/articles/friday-call-demo.html","id":"prequisites","dir":"Articles","previous_headings":"","what":"Prequisites","title":"REDCap Custodian Friday Call Demo","text":"Follow steps run code provided vignette(\"friday-call-demo-setup\").","code":""},{"path":"/articles/friday-call-demo.html","id":"premise","dir":"Articles","previous_headings":"","what":"Premise","title":"REDCap Custodian Friday Call Demo","text":"big important project many rows data many rows coming every week, researcher asks build biorepository project biospecimens collected protocol. want anyone transcribe existing data, automatically copy every day. transcription, typos, overtime.","code":""},{"path":"/articles/friday-call-demo.html","id":"get-some-data-from-a-redcap-project","dir":"Articles","previous_headings":"","what":"Get some data from a REDCap project","title":"REDCap Custodian Friday Call Demo","text":"First, load R packages: Next, connect credential database. read credentials REDCap project want read . point, ’s time read portions project data interest . task, want read identifiers collected data can write Biospecimen tracking project customer’s requirements biorepository require us transformations writing. ’s easy dplyr library Now write data target project","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) library(lubridate) load_dot_env(here::here(\"local.env.txt\")) init_etl(\"friday_call_demo\") file_conn <- DBI::dbConnect(RSQLite::SQLite(), here::here(\"credentials/credentials.db\")) my_username <- \"admin\" source_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == my_username) %>% collect() %>% filter(str_detect(project_display_name, \"Demo Main\")) %>% unnest() record_count_to_create <- 50 collection_events <- 5 tubes_per_collection <- 30 fields_to_read <- c( \"record_id\", \"redcap_event_name\", \"sample_collected_date\", paste0(\"tube_id\", 1:tubes_per_collection), paste0(\"tube_specimen_type\", 1:tubes_per_collection), paste0(\"tube_volume\", 1:tubes_per_collection) ) source_project_data <- REDCapR::redcap_read( redcap_uri = source_credentials$redcap_uri, token = source_credentials$token, fields = fields_to_read ) # Validate that data was retrieved and alert regarding issues if (!source_project_data$success) { warning(\"Data was not successfully read from REDCap\") } # Append the event number to the subject_id to make the record_id needed in the biorepository new_target_project_data <- source_project_data$data %>% rename(subject_id = record_id) %>% mutate(record_id = paste0( subject_id, \"-\", str_replace(redcap_event_name, \"event_\", \"\") %>% str_replace(., \"_arm_1\", \"\"))) %>% select(record_id, everything()) %>% rename(date_draw = sample_collected_date) target_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == my_username) %>% collect() %>% filter(str_detect(project_display_name, \"Demo Biospecimen\")) %>% unnest() # Want to know exactly what is getting updated in the target project? Fetch that data then anti-join with the new data set target_fields_to_read <- c( \"record_id\", \"redcap_event_name\", \"sample_collected_date\" ) old_target_project_data <- REDCapR::redcap_read( redcap_uri = target_credentials$redcap_uri, token = target_credentials$token, fields = target_fields_to_read ) if (old_target_project_data$success) { target_project_data <- new_target_project_data %>% dplyr::anti_join(old_target_project_data$data) } else { target_project_data <- new_target_project_data } # now write that small dataset result <- REDCapR::redcap_write( ds_to_write = slice_head(target_project_data, prop=0.5), redcap_uri = target_credentials$redcap_uri, token = target_credentials$token ) # now log what we did if (result$success) { log_job_success(jsonlite::toJSON(target_project_data)) } else { log_job_failure(jsonlite::toJSON(result)) }"},{"path":"/articles/friday-call-demo.html","id":"review-the-logs-of-what-the-job-did","dir":"Articles","previous_headings":"","what":"Review the logs of what the job did","title":"REDCap Custodian Friday Call Demo","text":"automated jobs, ’s important record happened. REDCap Custodian writes logs can review actions later.","code":"# Get the connection to the log database log_con <- get_package_scope_var(\"log_con\") # Look at the entire log of jobs run tbl(log_con, \"rcc_job_log\") %>% collect() %>% view() # Read the summary of the last 'friday_call_demo' job tbl(log_con, \"rcc_job_log\") %>% filter(script_name == \"friday_call_demo\") %>% collect() %>% arrange(desc(log_date)) %>% head(n=1) %>% pull(job_summary_data) %>% jsonlite::fromJSON() %>% view()"},{"path":"/articles/job_logging.html","id":"behind-the-scenes","dir":"Articles","previous_headings":"","what":"Behind the scenes","title":"Job Logging","text":"’s tiny script, lot happening. Let’s decode ’s going lines.","code":""},{"path":"/articles/job_logging.html","id":"librarydotenv","dir":"Articles","previous_headings":"Behind the scenes","what":"library(dotenv)","title":"Job Logging","text":"REDCap Custodian uses dotenv package read files name-value pairs environment script. default reads .env current directory. make logging work correctly, .env file need stanza like : “LOG_DB_*” strings environment variable names redcapcustodian uses locate MySQL DB stores logging data. need use names values need point MySQL table MySQL server.","code":"LOG_DB_NAME=rcc_log LOG_DB_HOST=127.0.0.1 LOG_DB_USER=rcc_log LOG_DB_PASSWORD=password LOG_DB_PORT=9000"},{"path":"/articles/job_logging.html","id":"init_etl","dir":"Articles","previous_headings":"Behind the scenes","what":"init_etl()","title":"Job Logging","text":"init_etl(\"my_useful_script\") sets script_name env variable “my_useful_script”, sets script_run_time env variable current date time, verifies connection database described “LOG_DB_*” environment variables. database , init_etl() quietly exits. database see","code":"Warning: Failed to connect to log DB: rcc_log_bad The reason given was: Error: Failed to connect: Access denied for user 'rcc_log'@'%' to database 'rcc_log_bad'"},{"path":"/articles/job_logging.html","id":"log_job_success","dir":"Articles","previous_headings":"Behind the scenes","what":"log_job_success()","title":"Job Logging","text":"log_job_success(\"worked!\") writes row logging database like example .","code":""},{"path":"/articles/job_logging.html","id":"failed-jobs","dir":"Articles","previous_headings":"","what":"Failed jobs","title":"Job Logging","text":"jobs fail, might want log condition, , call log_job_failure(). log_job_success(), can provide message give detail went wrong.","code":"log_job_failure(\"input dataframe was empty\")"},{"path":"/articles/job_logging.html","id":"more-detailed-messages","dir":"Articles","previous_headings":"","what":"More detailed messages","title":"Job Logging","text":"Logging “worked!” “input dataframe empty” fine, often, want provide detail job’s activities. Chances useful facts R objects already. simple matter assemble objects list, convert list object text string using JSON libraries, use string job’s message. wanted report updates made ‘iris’ database, might log like : summary value can contain number JSON-encoded objects. said, plan carefully. Ask questions want answer later job run. package authors found common questions posed “value change?”, “() set value?”, “change?” Store little information needed answer questions succinctly. provide lots different objects, might make pile log data sift later. ’ve found can usually meet needs including minimal dataframes data written job. multiple jobs writing dataset, consider value self-consistency across jobs. every update operation invoice table logged object named invoice_updates, can easily search across jobs.","code":"init_etl(\"iris_updater\") # Do some stuff # ... iris_updates <- iris |> dplyr::sample_n(3) |> select(Sepal.Length, Species) # ... # success! log_message <- dplyr::lst(iris_updates) log_job_success(jsonlite::toJSON(log_message))"},{"path":"/articles/job_logging.html","id":"reading-back-log-data","dir":"Articles","previous_headings":"","what":"Reading back log data","title":"Job Logging","text":"Reading back log data presents challenges. answering “? ? ? ?” questions often search across multiple log events find job run made change. can filter log data time frame jobs interest, still search multiple job summaries find one made change care . encoded job summary data JSON, ’ll need decode , jsonlite::fromJSON vectorized. ’ll iterate log records. Also, ’ll want unnest job summary objects returned jsonlite::fromJSON. REDCap Custodian provides function unnest_job_summary_data_json_object() help operations. e.g., output unnest_job_summary_data_json_object, unnested, look like: Example output unnest_job_summary_data_json_object","code":"log_conn <- get_package_scope_var(\"log_con\") log_data <- dplyr::tbl(log_conn, \"rcc_job_log\") |> dplyr::filter(script_name == \"iris_updater\") |> dplyr::collect() |> dplyr::slice_tail(n = 3) unnest_job_summary_data_json_object(log_data) |> unnest(cols = \"iris_updates\") |> kbl() |> kable_styling()"},{"path":"/articles/randomization-management.html","id":"moving-a-production-project-with-allocated-randomization-records","dir":"Articles","previous_headings":"","what":"Moving a Production project with allocated randomization records","title":"Randomization Management","text":"tools created allow production project randomization turned moved another REDCap project. REDCap doesn’t allow , work done backend database reads write. tables involved REDCap project IDs, randomization IDs, eventIDs, allocations IDs embedded, work requires multiple transformations writing randomization configuration target project. example use randomization management functions copy allocated randomizations shown . script functions calls designed fit workflow:","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(lubridate) library(dotenv) init_etl(\"copy_allocated_randomization\") source_conn <- connect_to_redcap_db() # specify a second database connection if the target project is on another host target_conn <- source_conn source_project_id <- 18 target_project_id <- 25 # get and print importable allocations if we need them for reference allocations <- export_allocation_tables_from_project( conn = source_conn, project_id_to_export = source_project_id ) target_directory = \"output\" if (!fs::dir_exists(here::here(target_directory))) { fs::dir_create(here::here(target_directory)) } walk(c(0,1), write_allocations, allocations, target_directory) # Configure randomization on the target project target_project_randomization_state <- create_randomization_row( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) target_project_allocation_state <- create_allocation_rows( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) # Update randomization on the target project target_project_allocation_update <- update_production_allocation_state( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_rid = target_project_randomization_state$rid ) # Enable randomization on the target enable_randomization_on_a_preconfigured_project_in_production( target_conn = target_conn, target_project_id = target_project_id ) DBI::dbDisconnect(source_conn)"},{"path":"/articles/randomization-management.html","id":"preparation","dir":"Articles","previous_headings":"Moving a Production project with allocated randomization records","what":"Preparation","title":"Randomization Management","text":"Start production project randomization turned configured, data entered records randomized. source project. Note project ID. Copy/clone source project. Either use Copy Project button REDCap Project Setup, XML export import. new project target project. Note project ID. Turn randomization target project copy/cloning process turned . probably seems strange, ’s needed allow data import randomization field trick REDCap moving project production data “randomization” field assignments allocation table. reconfiguration work needed target project. able move fields forms events needed. said, change names stratification randomization fields. Copy script set values source target project ids. Run copy_allocated_randomization.R script. mirror randomization configuration source project target project. cloned project Copy Project button, script complain configuration data exists. fine. Regardless cloned project, script complain met requirements turn randomization. supposed see warning point.","code":""},{"path":"/articles/randomization-management.html","id":"activation","dir":"Articles","previous_headings":"Moving a Production project with allocated randomization records","what":"Activation","title":"Randomization Management","text":"Take source project offline. changes occurred data source project since cloned , re-export data source project import target project. Immediately move target project production. Immediately re-run copy_allocated_randomization.R script. turn randomization target project. Revoke access source project. done.","code":""},{"path":"/articles/randomization-management.html","id":"limitations","dir":"Articles","previous_headings":"","what":"Limitations","title":"Randomization Management","text":"randomization management tools support DAG group_ids randomization variables. , don’t needed project inspired tools. try use project uses DAGs randomization configuration. tools support changing randomization configuration. might form good foundation , support .","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Philip Chase. Author, maintainer. Laurence James-Woodley. Author. Kyle Chesney. Author. Taryn Stoffs. Contributor. Michael Bentz. Author. Christopher Barnes. Contributor.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Chase P, James-Woodley L, Chesney K, Bentz M (2024). redcapcustodian: Data automation R-centric workflows nod towards REDCap. R package version 1.19.0, https://github.com/ctsit/redcapcustodian/, https://project-redcap.org, https://ctsit.github.io/redcapcustodian/.","code":"@Manual{, title = {redcapcustodian: Data automation for R-centric workflows with a nod towards REDCap}, author = {Philip Chase and Laurence James-Woodley and Kyle Chesney and Michael Bentz}, year = {2024}, note = {R package version 1.19.0, https://github.com/ctsit/redcapcustodian/, https://project-redcap.org}, url = {https://ctsit.github.io/redcapcustodian/}, }"},{"path":"/index.html","id":"redcap-custodian","dir":"","previous_headings":"","what":"Data automation for R-centric workflows with a nod towards REDCap","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"package simplifies data management activities REDCap systems. provides framework automating data extraction, transformation, loading (ETL) work. supports ETL work within REDCap, REDCap projects, REDCap systems, REDCap database. provides extensible set R functions, Docker image, RStudio Project template upon REDCap team can build ETL tasks serve REDCap systems customers.","code":""},{"path":"/index.html","id":"operating-environment","dir":"","previous_headings":"","what":"Operating environment","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"redcapcustodian R package can referenced R script needs ETL work REDCap data target. facilitate automation, repository also provides Dockerfile provides R, redcapcustodian package, required packages. Dockerfile build.sh can used build Docker image named redcapcustodian can serve foundation containers serve specific tasks. build upon foundation, repository also provides folder, study_template can copied new folder used starting point RStudio project, R package, Docker image address needs single study data management project. tools designed simplify development reduce burden automating data reporting recurring data management tasks. automated environment, ETL job system Rscript run via Docker. report RMarkdown file run via Docker. design assumes Docker containers hosted Linux host API access one REDCap systems, mail server, MySQL database, , optionally, REDCap database . sites without container infrastructure, image can instantiated container via cron job documented files study_template/crons/. file folder runs single job. run job, cron script must copied /etc/cron.d/ folder Linux host. build.sh script builds redcapcustodian container upon containers built study template depend.","code":""},{"path":"/index.html","id":"how-to-use-this-project","dir":"","previous_headings":"","what":"How to use this project","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"repository provides three elements designed used together manage data single study data-management project. provides R package, redcapcustodian provides functions facilitate credential management, database connections, data comparison, data synchronization, logging. provides Dockerfile rolls-redcapcustodian package, dependencies several recommended R packages typically needed working REDCap. repository also provides study_template can used starting point repository Docker container house run study’s custom RScript, Rmarkdown, R package. REDCap Custodian package can used custom RScript simply installing loading package RStudio: use Docker container, ’ll need checkout repository git build Dockerfile. Mac Linux computer steps look like : procedure use study template involved, offers reward well. See Writing redcapcustodian Rscripts. might also help look Developer Notes","code":"install.packages(\"devtools\") devtools::install_github(\"ctsit/redcapcustodian\") library(redcapcustodian) git clone git@github.com:ctsit/redcapcustodian.git cd redcapcustodian ./build.sh"},{"path":"/index.html","id":"areas-of-redcap-interest","dir":"","previous_headings":"","what":"Areas of REDCap interest","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"much REDCap Custodian repository package automating workflows, package includes tools specific REDCap. API token management, see Credential Scraping tools procedures moving production projects use randomization, See Randomization Management bulk rights expiration, see function expire_user_project_rights() get history projects REDCap system, see get_project_life_cycle(). runs speedy queries REDCap log event tables get events life cycle every project system. delete survey reminders persist survey completion, see Deleting Erroneous Survey Reminders","code":""},{"path":"/reference/build_etl_job_log_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"Builds formatted rcc_job_log data frame source data","code":""},{"path":"/reference/build_etl_job_log_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"","code":"build_etl_job_log_df(job_duration, job_summary, level)"},{"path":"/reference/build_etl_job_log_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"job_duration, job duration seconds job_summary, summary job performed level, log level (DEBUG, ERROR, INFO)","code":""},{"path":"/reference/build_etl_job_log_df.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"df_etl_log_job, df matching rcc_job_log table","code":""},{"path":"/reference/build_etl_job_log_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"","code":"if (FALSE) { build_etl_job_log_df( job_duration, job_summary, level ) }"},{"path":"/reference/build_formatted_df_from_result.html","id":null,"dir":"Reference","previous_headings":"","what":"Builds formatted data frame from source data — build_formatted_df_from_result","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"Builds formatted data frame source data","code":""},{"path":"/reference/build_formatted_df_from_result.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"","code":"build_formatted_df_from_result( result, database_written, table_written, log_level, pk_col )"},{"path":"/reference/build_formatted_df_from_result.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"result, df log database_written, database etl wrote table_written, table etl wrote log_level, log level (DEBUG, ERROR, INFO) pk_col, dataframe col use primary_key","code":""},{"path":"/reference/build_formatted_df_from_result.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"df_etl_log, df matching etl_log table","code":""},{"path":"/reference/build_formatted_df_from_result.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"","code":"if (FALSE) { build_formatted_df_from_result( result, database_written, table_written, log_level, pk_col ) }"},{"path":"/reference/connect_to_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to db — connect_to_db","title":"Connect to db — connect_to_db","text":"Connect db","code":""},{"path":"/reference/connect_to_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to db — connect_to_db","text":"","code":"connect_to_db(drv, prefix = \"\", continue_on_error = FALSE)"},{"path":"/reference/connect_to_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect to db — connect_to_db","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection). prefix, continue_on_error TRUE continue execution error, FALSE quit non interactive sessions error","code":""},{"path":"/reference/connect_to_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to db — connect_to_db","text":"S4 object. Run ?dbConnect information","code":""},{"path":"/reference/connect_to_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to db — connect_to_db","text":"","code":"if (FALSE) { # connect to db using [prefix]_DB_* environment variables con <- connect_to_db(drv = RMariaDB::MariaDB(), prefix = \"RCC\") # connect to sqlite db con <- connect_to_db(drv = RSQLite::SQLite()) }"},{"path":"/reference/connect_to_log_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to the log db — connect_to_log_db","title":"Connect to the log db — connect_to_log_db","text":"Connect log db","code":""},{"path":"/reference/connect_to_log_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to the log db — connect_to_log_db","text":"","code":"connect_to_log_db(drv, continue_on_error = FALSE)"},{"path":"/reference/connect_to_log_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect to the log db — connect_to_log_db","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection). continue_on_error TRUE continue execution error, FALSE quit non interactive sessions error","code":""},{"path":"/reference/connect_to_log_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to the log db — connect_to_log_db","text":"S4 object. Run ?dbConnect information","code":""},{"path":"/reference/connect_to_log_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to the log db — connect_to_log_db","text":"","code":"if (FALSE) { # connect to log db using LOG_DB_* environment variables con <- connect_to_log_db() # connect to sqlite log db con <- connect_to_log_db(drv = RSQLite::SQLite()) }"},{"path":"/reference/connect_to_redcap_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"Connect Primary REDCap MySQL Database Assigns package-scoped conn","code":""},{"path":"/reference/connect_to_redcap_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"","code":"connect_to_redcap_db()"},{"path":"/reference/connect_to_redcap_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"S4 object. Run ?dbConnect information","code":""},{"path":"/reference/connect_to_redcap_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() }"},{"path":"/reference/convert_schema_to_sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"Converts MySQL schema file sqlite schema. Facilitates easier creation -memory (.e. sqlite) tables.","code":""},{"path":"/reference/convert_schema_to_sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"","code":"convert_schema_to_sqlite(schema_file_path)"},{"path":"/reference/convert_schema_to_sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"schema_file_path, path schema file convert","code":""},{"path":"/reference/convert_schema_to_sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"translated schema character string","code":""},{"path":"/reference/convert_schema_to_sqlite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"","code":"if (FALSE) { mem_conn <- DBI::dbConnect(RSQLite::SQLite(), dbname = \":memory:\") translated_schema <- convert_schema_to_sqlite(\"~/documents/my_cool_schema.sql\") DBI::dbSendQuery(mem_conn, schema) }"},{"path":"/reference/copy_entire_table_to_db.html","id":null,"dir":"Reference","previous_headings":"","what":"copy_entire_table_to_db — copy_entire_table_to_db","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"Copy entire DBI table one DBI connection another. developer tool designed aid testing development. designed called via purrr::walk2() clone sets tables data-driven way ephemeral database created, generally Duck DB. Limitations table referenced table_name must exist target_conn. function suitable cloning small tables. called via purrr::walk2(), tables vector table names copied single target_conn DBI object even source table different source_conn DBI objects.","code":""},{"path":"/reference/copy_entire_table_to_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"","code":"copy_entire_table_to_db(source_conn, table_name, target_conn)"},{"path":"/reference/copy_entire_table_to_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"source_conn - DBI connection object holds source table table_name - name table copied target_conn - DBI connection object table copied","code":""},{"path":"/reference/copy_entire_table_to_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"result","code":""},{"path":"/reference/copy_entire_table_to_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"","code":"# Build the objects need for testing test_data <- dplyr::tribble( ~a, ~b, ~c, ~d, \"asdf\", 1, TRUE, lubridate::ymd_hms(\"2023-01-14 12:34:56\"), \"qwer\", 2, FALSE, lubridate::ymd_hms(\"2016-01-14 12:34:56\") ) table_name <- \"test_data\" source_conn <- DBI::dbConnect(duckdb::duckdb(), dbdir = \":memory:\") DBI::dbWriteTable(conn = source_conn, name = table_name, value = test_data) # copy the table target_conn <- DBI::dbConnect(duckdb::duckdb(), dbdir = \":memory:\") copy_entire_table_to_db( source_conn = source_conn, table_name = table_name, target_conn = target_conn ) dplyr::collect(dplyr::tbl(target_conn, table_name)) #> # A tibble: 2 × 4 #> a b c d #> #> 1 asdf 1 TRUE 2023-01-14 12:34:56 #> 2 qwer 2 FALSE 2016-01-14 12:34:56 DBI::dbDisconnect(source_conn, shutdown = TRUE) DBI::dbDisconnect(target_conn, shutdown = TRUE) if (FALSE) { library(tidyverse) library(lubridate) library(dotenv) library(DBI) library(RMariaDB) library(redcapcustodian) init_etl(\"my_script_name\") rc_conn <- connect_to_redcap_db() log_conn <- get_package_scope_var(\"log_con\") # describe the tables you want to clone test_tables <- tribble( ~conn, ~table, rc_conn, \"redcap_user_information\", rc_conn, \"redcap_projects\", log_conn, \"redcap_summary_metrics\" ) # make the target DB and clone the tables target_conn <- DBI::dbConnect( duckdb::duckdb(), dbdir = \":memory:\" ) purrr::walk2( test_tables$conn, test_tables$table, copy_table_to_db, target_conn ) # Enumerate the tables you copied if you like DBI::dbListTables(target_conn) # replace original connection objects rc_conn <- target_conn log_conn <- target_conn # At this point you can do destructive things on the original # connection objects because they point at the ephemeral # copies of the tables. }"},{"path":"/reference/create_allocation_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"create_allocation_rows — create_allocation_rows","title":"create_allocation_rows — create_allocation_rows","text":"Create rows redcap_randomization_allocation table mirror another project.","code":""},{"path":"/reference/create_allocation_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create_allocation_rows — create_allocation_rows","text":"","code":"create_allocation_rows( source_conn, target_conn, source_project_id, target_project_id )"},{"path":"/reference/create_allocation_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create_allocation_rows — create_allocation_rows","text":"source_conn - DBI connection object pointing REDCap database houses source project. target_conn - DBI connection object pointing REDCap database houses target project. source_project_id - project ID REDCap project contains randomization cloned. target_project_id - project ID REDCap project receive mirrored randomization data.","code":""},{"path":"/reference/create_allocation_rows.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create_allocation_rows — create_allocation_rows","text":"- dataframe containing current allocation rows target project.","code":""},{"path":"/reference/create_allocation_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create_allocation_rows — create_allocation_rows","text":"","code":"if (FALSE) { target_project_allocation_state <- create_allocation_rows( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) }"},{"path":"/reference/create_randomization_row.html","id":null,"dir":"Reference","previous_headings":"","what":"create_randomization_row — create_randomization_row","title":"create_randomization_row — create_randomization_row","text":"Create single row redcap_randomization table mirrors another project.","code":""},{"path":"/reference/create_randomization_row.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create_randomization_row — create_randomization_row","text":"","code":"create_randomization_row( source_conn, target_conn, source_project_id, target_project_id )"},{"path":"/reference/create_randomization_row.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create_randomization_row — create_randomization_row","text":"source_conn - DBI connection object pointing REDCap database houses source project. target_conn - DBI connection object pointing REDCap database houses target project. source_project_id - project ID REDCap project contains randomization cloned. target_project_id - project ID REDCap project receive mirrored randomization data.","code":""},{"path":"/reference/create_randomization_row.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create_randomization_row — create_randomization_row","text":"- dataframe containing current randomization row target project.","code":""},{"path":"/reference/create_randomization_row.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create_randomization_row — create_randomization_row","text":"","code":"if (FALSE) { target_project_randomization_state <- create_randomization_row( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) }"},{"path":"/reference/create_test_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a test table from package schema and data files — create_test_table","title":"Create a test table from package schema and data files — create_test_table","text":"Creates tables files inst/testdata match patterns _schema.sql .csv","code":""},{"path":"/reference/create_test_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a test table from package schema and data files — create_test_table","text":"","code":"create_test_table(conn, table_name, data_file = NA_character_, empty = F)"},{"path":"/reference/create_test_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a test table from package schema and data files — create_test_table","text":"conn DBI Connection object table_name name table used testing data_file name file alternative contents `table_name` empty boolean request table created empty","code":""},{"path":"/reference/create_test_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a test table from package schema and data files — create_test_table","text":"NA","code":""},{"path":"/reference/create_test_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a test table from package schema and data files — create_test_table","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") create_test_table(conn, \"redcap_user_information\") }"},{"path":"/reference/create_test_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"wrapper around create_test_table create tables, specified subset ","code":""},{"path":"/reference/create_test_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"","code":"create_test_tables(conn, table_names = c())"},{"path":"/reference/create_test_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"conn DBI Connection object table_names character list names tables wish create, nothing provided, result get_test_table_names used create test tables","code":""},{"path":"/reference/create_test_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"NA","code":""},{"path":"/reference/create_test_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") create_test_tables(conn) # create all test tables }"},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"Create REDCap data dictionary dataframe","code":""},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"","code":"dataframe_to_redcap_dictionary(df, form_name, record_id_col = NULL)"},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"df dataframe generate data dictionary form_name form name display REDCap record_id_col column dataframe uniquely identifies record","code":""},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"redcap data dictionary","code":""},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"","code":"if (FALSE) { df <- data.frame( pk_col = c(\"a1\", \"a2\", \"a3\"), integer_col = c(1, 2, 3), numeric_col = 5.9, character_col = c(\"a\", \"b\", \"c\"), date_col = as.Date(\"2011-03-07\"), date_time_col = as.POSIXct(strptime(\"2011-03-27 01:30:00\", \"%Y-%m-%d %H:%M:%S\")), email_col = c(\"test@example.com\", \"test.2@example.edu\", \"3test@example.net\") ) redcap_data_dictionary <- dataframe_to_redcap_dictionary(df, \"test_form\") redcap_data_dictionary <- dataframe_to_redcap_dictionary(df, \"test_form\", \"character_col\") }"},{"path":"/reference/dataset_diff.html","id":null,"dir":"Reference","previous_headings":"","what":"dataset_diff — dataset_diff","title":"dataset_diff — dataset_diff","text":"returns differences source target data list dataframes records updated, inserted, deleted, update target facts source.","code":""},{"path":"/reference/dataset_diff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dataset_diff — dataset_diff","text":"","code":"dataset_diff(source, source_pk, target, target_pk, insert = T, delete = T)"},{"path":"/reference/dataset_diff.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"dataset_diff — dataset_diff","text":"source - dataframe content needs reflected target source_pk - primary key source target - data frame needs reflect source target_pk - primary key target insert - compute return insert records delete - compute return delete records","code":""},{"path":"/reference/dataset_diff.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"dataset_diff — dataset_diff","text":"list dataframes update_records - column redcap user_ids / institutional IDs insert_records - column authoritative email address user_id NA insert NA delete_records ... - Additional columns allowed return data frame NA delete NA","code":""},{"path":"/reference/dataset_diff.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dataset_diff — dataset_diff","text":"goal allow intelligent one-way synchronization source target datasets using database CRUD operations. two assumptions source target: 1. Columns source subset columns target. 2. target_pk appear source.","code":""},{"path":"/reference/dataset_diff.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"dataset_diff — dataset_diff","text":"","code":"if (FALSE) { dataset_diff(source = dataset_diff_test_user_data$source, source_pk = \"username\", target = dataset_diff_test_user_data$target, target_pk = \"ui_id\" ) }"},{"path":"/reference/dataset_diff_test_bar_bang.html","id":null,"dir":"Reference","previous_headings":"","what":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"list test inputs outputs dataset_diff","code":""},{"path":"/reference/dataset_diff_test_bar_bang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"","code":"dataset_diff_test_bar_bang"},{"path":"/reference/dataset_diff_test_bar_bang.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"list 5 variables: source tibble source data source_pk character primary key source data target tibble target data target_pk character primary key target data result list dataset_diff output","code":""},{"path":"/reference/dataset_diff_test_bar_bang.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"DETAILS","code":""},{"path":"/reference/dataset_diff_test_user_data.html","id":null,"dir":"Reference","previous_headings":"","what":"dataset_diff_test_user_data — dataset_diff_test_user_data","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"list test inputs outputs dataset_diff","code":""},{"path":"/reference/dataset_diff_test_user_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"","code":"dataset_diff_test_user_data"},{"path":"/reference/dataset_diff_test_user_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"list 5 variables: source tibble source data source_pk character primary key source data target tibble target data target_pk character primary key target data result list dataset_diff output","code":""},{"path":"/reference/dataset_diff_test_user_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"DETAILS","code":""},{"path":"/reference/delete_project.html","id":null,"dir":"Reference","previous_headings":"","what":"Delete a Project from REDCap — delete_project","title":"Delete a Project from REDCap — delete_project","text":"Deletes specified projects REDCap system setting `date_deleted` field. also log event appropriate `log_event_table` project.","code":""},{"path":"/reference/delete_project.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Delete a Project from REDCap — delete_project","text":"","code":"delete_project(project_id, conn)"},{"path":"/reference/delete_project.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Delete a Project from REDCap — delete_project","text":"project_id project ID vector project IDs deleted. conn DBI connection object database holds `redcap_projects` `redcap_log_event*` tables.","code":""},{"path":"/reference/delete_project.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Delete a Project from REDCap — delete_project","text":"list containing: n: number projects deleted number_rows_logged: number rows logged deletion event project_ids_deleted: vector project IDs deleted data: data frame input project_id status trying delete ","code":""},{"path":"/reference/delete_project.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Delete a Project from REDCap — delete_project","text":"","code":"if (FALSE) { conn <- DBI::dbConnect(...) delete_project(c(1,2,3), conn) }"},{"path":"/reference/disable_non_interactive_quit.html","id":null,"dir":"Reference","previous_headings":"","what":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","title":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","text":"Prevent quit_non_interactive_run quitting. meant used outside tests. See test-write.R example.","code":""},{"path":"/reference/disable_non_interactive_quit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","text":"","code":"disable_non_interactive_quit()"},{"path":"/reference/disable_non_interactive_quit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","text":"","code":"if (FALSE) { disable_non_interactive_quit() }"},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":null,"dir":"Reference","previous_headings":"","what":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"Turn randomization target project already moved production randomization configured.","code":""},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"","code":"enable_randomization_on_a_preconfigured_project_in_production( target_conn, target_project_id )"},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"target_conn - DBI connection object pointing REDCap database houses target project. target_project_id - project ID REDCap project receive mirrored randomization data.","code":""},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"logical indicating success failure operation","code":""},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"","code":"if (FALSE) { enable_randomization_on_a_preconfigured_project_in_production( target_conn = target_conn, target_project_id = target_project_id ) }"},{"path":"/reference/evaluate_checksums.html","id":null,"dir":"Reference","previous_headings":"","what":"evaluate_checksums — evaluate_checksums","title":"evaluate_checksums — evaluate_checksums","text":"Transform output `get_table_checksum()` source target copy MySQL database copy operation compare checksums.","code":""},{"path":"/reference/evaluate_checksums.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"evaluate_checksums — evaluate_checksums","text":"","code":"evaluate_checksums(source_checksums, target_checksums)"},{"path":"/reference/evaluate_checksums.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"evaluate_checksums — evaluate_checksums","text":"source_checksums output `get_table_checksum()` source MySQL database database copy operation target_checksums output `get_table_checksum()` target MySQL database database copy operation","code":""},{"path":"/reference/evaluate_checksums.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"evaluate_checksums — evaluate_checksums","text":"dataframe columns: table MySQL table name checksum_source checksum source table returned \"CHECKSUM TABLE \" checksum_target checksum target table returned \"CHECKSUM TABLE \" elapsed_time_source elapsed time required query fetch checksum source table elapsed_time_target elapsed time required query fetch checksum target table matches boolean indicating source target checksums match","code":""},{"path":"/reference/evaluate_checksums.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"evaluate_checksums — evaluate_checksums","text":"","code":"if (FALSE) { evaluate_checksums(source_checksums, target_checksums) }"},{"path":"/reference/expire_user_project_rights.html","id":null,"dir":"Reference","previous_headings":"","what":"Expire user rights to REDCap projects — expire_user_project_rights","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"Expire user rights one REDCap projects based list users expire users exclude expiration","code":""},{"path":"/reference/expire_user_project_rights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"","code":"expire_user_project_rights( conn, project_ids, usernames = NULL, all_users_except = NULL, expiration_date = as.Date(NA) )"},{"path":"/reference/expire_user_project_rights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"conn, DBI Connection object REDCap database project_ids, vector project IDs whose users need expiration usernames, vector usernames expire across vector project IDs all_users_except, vector usernames excluded expiration expiration_date, expiration date applied users. Defaults today.","code":""},{"path":"/reference/expire_user_project_rights.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"list update count data written updates - number records revised data - dataframe changes applied redcap_user_rights","code":""},{"path":"/reference/expire_user_project_rights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"","code":"conn <- DBI::dbConnect(RSQLite::SQLite(), dbname = \":memory:\") DBI::dbCreateTable( conn, name = \"redcap_user_rights\", fields = user_rights_test_data$redcap_user_rights ) DBI::dbAppendTable( conn, name = \"redcap_user_rights\", value = user_rights_test_data$redcap_user_rights ) #> [1] 27 usernames <- c(\"bob\", \"dan\") expire_user_project_rights( conn = conn, project_ids = c(34), usernames = usernames ) #> $updates #> [1] 2 #> #> $data #> # A tibble: 2 × 3 #> project_id username expiration #> #> 1 34 bob 2024-01-30 #> 2 34 dan 2024-01-30 #>"},{"path":"/reference/export_allocation_tables_from_project.html","id":null,"dir":"Reference","previous_headings":"","what":"export_allocation_tables_from_project — export_allocation_tables_from_project","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"Export randomization allocation data project REDCap randomization tables form reflects allocation tables REDCap requests import","code":""},{"path":"/reference/export_allocation_tables_from_project.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"","code":"export_allocation_tables_from_project(conn, project_id_to_export)"},{"path":"/reference/export_allocation_tables_from_project.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"conn - DBI connection object pointing REDCap database houses project interest project_id_to_export - project ID REDCap project contains randomization exported.","code":""},{"path":"/reference/export_allocation_tables_from_project.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"dataframe shape REDCap randomization table CSVs","code":""},{"path":"/reference/export_allocation_tables_from_project.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"","code":"if (FALSE) { allocations <- export_allocation_tables_from_project( conn = source_conn, project_id_to_export = source_project_id ) }"},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":null,"dir":"Reference","previous_headings":"","what":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"Connect imap mailbox, identify bad email addresses referenced bounce messages sent `messages_since_date`, extract data emails.","code":""},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"","code":"get_bad_emails_from_individual_emails( username, password, url = \"imaps://outlook.office365.com\", messages_since_date )"},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"username username IMAP mailbox password password IMAP mailbox url IMAP URL host houses mailbox messages_since_date sent date oldest message inspected","code":""},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"dataframe bounced email addresses emailcharacter email address bounced","code":""},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"","code":"if (FALSE) { get_bad_emails_from_individual_emails( username = \"jdoe\", password = \"jane_does_password\", url =\"imaps://outlook.office365.com\", messages_since_date = as.Date(\"2022-01-01\", format = \"%Y-%m-%d\") ) }"},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":null,"dir":"Reference","previous_headings":"","what":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"Connect imap mailbox, identify LISTSERV digest emails sent `messages_since_date`, extract bounced email addresses digest messages.","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"","code":"get_bad_emails_from_listserv_digest( username, password, url = \"imaps://outlook.office365.com\", messages_since_date )"},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"username username IMAP mailbox password password IMAP mailbox url IMAP URL host houses mailbox messages_since_date sent date oldest message inspected","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"dataframe bad email addresses email - column bad email address","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"","code":"if (FALSE) { get_bad_emails_from_listserv_digest( username = \"jdoe\", password = \"jane_does_password\", url =\"imaps://outlook.office365.com\", messages_since_date = as.Date(\"2022-01-01\", format = \"%Y-%m-%d\") ) }"},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":null,"dir":"Reference","previous_headings":"","what":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"example output get_bad_emails_from_listserv_digest aligns related tests","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"","code":"get_bad_emails_from_listserv_digest_test_output"},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"data frame 7 rows 1 variables: email character bad email address found querying listserv error digests","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"DETAILS","code":""},{"path":"/reference/get_current_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Fetches the current time in system time zone — get_current_time","title":"Fetches the current time in system time zone — get_current_time","text":"Fetches current time system time zone","code":""},{"path":"/reference/get_current_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fetches the current time in system time zone — get_current_time","text":"","code":"get_current_time()"},{"path":"/reference/get_current_time.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fetches the current time in system time zone — get_current_time","text":"duration object representing current time","code":""},{"path":"/reference/get_current_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fetches the current time in system time zone — get_current_time","text":"","code":"if (FALSE) { get_current_time() }"},{"path":"/reference/get_institutional_person_data.html","id":null,"dir":"Reference","previous_headings":"","what":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"template function fetching authoritative email address data institutional data","code":""},{"path":"/reference/get_institutional_person_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"","code":"get_institutional_person_data(user_ids = c(NA_character_))"},{"path":"/reference/get_institutional_person_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"user_ids optional vector REDCap user IDs used query institutional data","code":""},{"path":"/reference/get_institutional_person_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"Dataframe user_id - column redcap user_ids / institutional IDs email - column authoritative email address user_id ... - Additional columns allowed return data frame","code":""},{"path":"/reference/get_institutional_person_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"","code":"redcap_users <- c(\"jane_doe\", \"john_q_public\") get_institutional_person_data(user_ids = redcap_users) #> # A tibble: 2 × 2 #> user_id email #> #> 1 jane_doe jane_doe@example.org #> 2 john_q_public john_q_public@example.org"},{"path":"/reference/get_job_duration.html","id":null,"dir":"Reference","previous_headings":"","what":"Provide the exact length of the time span between start time and end time — get_job_duration","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"Provide exact length time span start time end time","code":""},{"path":"/reference/get_job_duration.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"","code":"get_job_duration(start_time, end_time)"},{"path":"/reference/get_job_duration.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"start_time, lubridate::duration object representing start time end_time, lubridate::duration object representing end time","code":""},{"path":"/reference/get_job_duration.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"exact length time span start time end time","code":""},{"path":"/reference/get_job_duration.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"","code":"if (FALSE) { get_job_duration( start_time = get_script_run_time(), end_time = get_current_time() ) }"},{"path":"/reference/get_package_scope_var.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the value from the redcapcustodian.env environment — get_package_scope_var","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"Get value redcapcustodian.env environment","code":""},{"path":"/reference/get_package_scope_var.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"","code":"get_package_scope_var(key)"},{"path":"/reference/get_package_scope_var.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"key identifying string lookup","code":""},{"path":"/reference/get_package_scope_var.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"","code":"if (FALSE) { get_package_scope_var(\"hello\") }"},{"path":"/reference/get_project_life_cycle.html","id":null,"dir":"Reference","previous_headings":"","what":"get_project_life_cycle — get_project_life_cycle","title":"get_project_life_cycle — get_project_life_cycle","text":"get_project_life_cycle runs speedy queries REDCap log event tables get events life cycle every project system.","code":""},{"path":"/reference/get_project_life_cycle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_project_life_cycle — get_project_life_cycle","text":"","code":"get_project_life_cycle( rc_conn, start_date = as.Date(NA), cache_file = NA_character_, read_cache = TRUE )"},{"path":"/reference/get_project_life_cycle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get_project_life_cycle — get_project_life_cycle","text":"rc_conn - DBI connection REDCap database start_date - optional minimum date query results cache_file - optional path cache_file. Defaults NA. read_cache - boolean indicate cache read. Defaults TRUE","code":""},{"path":"/reference/get_project_life_cycle.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_project_life_cycle — get_project_life_cycle","text":"- dataframe redcap_log_event rows added columns: `log_event_table` index event table read `event_date` date object event `description_base_name` description project report level details removed","code":""},{"path":"/reference/get_project_life_cycle.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_project_life_cycle — get_project_life_cycle","text":"redcap_log_event table among largest redcap tables. test instance script developed, 2.2m rows production system 29m rows corresponding redcap_data table. row count millions completely normal. fastest way query query `object_type == \"redcap_projects\"`. , query can filtered `ts >= start_date`` make even faster allow incremental queries. comes small cost descriptions included searching `object_type == \"redcap_projects\"`: Create project (API) Create project folder Delete project bookmark Send request copy project Send request create project Send request delete project Send request move project production status Among things, loss means tell requested things requested . Deletion Events Notes Every project deletion composed multiple events. simplest event deletion user followed permanent deletion system via cron job 30 days later. admins can always , users allowed delete non-production projects. production projects, users must submit request delete. admin deletes project. 30 days later system permanently delete project via cron job. project can undeleted permanent deletion /changes status, sequences can sub-loops intermingle. address wanted project deleted got done, one must find last \"Send request delete project\" \"Delete project\" event get username \"Permanently delete project\" event verify deletion. request delete event precede \"Permanently delete project\" event, username request consider deleter. admin executed task just custodian.","code":""},{"path":"/reference/get_project_life_cycle.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"get_project_life_cycle — get_project_life_cycle","text":"","code":"if (FALSE) { project_life_cycle <- get_project_life_cycle(rc_conn = rc_conn, read_cache = TRUE) }"},{"path":"/reference/get_redcap_db_connection.html","id":null,"dir":"Reference","previous_headings":"","what":"Get connection to the primary REDCap database — get_redcap_db_connection","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"Get connection primary REDCap database","code":""},{"path":"/reference/get_redcap_db_connection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"","code":"get_redcap_db_connection()"},{"path":"/reference/get_redcap_db_connection.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"existing connection object REDCap database","code":""},{"path":"/reference/get_redcap_db_connection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() }"},{"path":"/reference/get_redcap_email_revisions.html","id":null,"dir":"Reference","previous_headings":"","what":"Get redcap user email revisions — get_redcap_email_revisions","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"Get redcap user email revisions","code":""},{"path":"/reference/get_redcap_email_revisions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"","code":"get_redcap_email_revisions(bad_redcap_user_emails, person)"},{"path":"/reference/get_redcap_email_revisions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"bad_redcap_user_emails bad redcap user email data person institutional person data keyed user_id","code":""},{"path":"/reference/get_redcap_email_revisions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"dataframe columns: ui_id - ui_id associated user REDCap's redcap_user_information table username - REDCap username email_field_name - name column containing email address corrected_email - corrected email address placed column email_field_name","code":""},{"path":"/reference/get_redcap_email_revisions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") bad_emails <- get_bad_redcap_user_emails() persons <- get_institutional_person_data(conn) email_revisions <- get_redcap_email_revisions(bad_emails, persons) }"},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"list test inputs outputs get_redcap_email_revisions","code":""},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"","code":"get_redcap_email_revisions_test_data"},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"list 3 tibbles: bad_redcap_user_emails tibble bad email address redcap usernames person tibble corrected email addresses corresponding usernames output tibble output get_redcap_email_revisions","code":""},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"DETAILS","code":""},{"path":"/reference/get_redcap_emails.html","id":null,"dir":"Reference","previous_headings":"","what":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"Get user emails redcap_user_information tall data","code":""},{"path":"/reference/get_redcap_emails.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"","code":"get_redcap_emails(conn)"},{"path":"/reference/get_redcap_emails.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"conn DBI Connection object","code":""},{"path":"/reference/get_redcap_emails.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"list 2 dataframes: wide, relevant email columns redcap_user_information tall, wide data pivoted include email_field_name email columns","code":""},{"path":"/reference/get_redcap_emails.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") create_test_table(conn, \"redcap_user_information\") get_redcap_emails(conn) }"},{"path":"/reference/get_redcap_emails_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"get_redcap_emails_test_data — get_redcap_emails_test_data","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"test data mock get_redcap_emails","code":""},{"path":"/reference/get_redcap_emails_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"","code":"get_redcap_emails_test_data"},{"path":"/reference/get_redcap_emails_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"object class list length 2.","code":""},{"path":"/reference/get_redcap_emails_test_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"list 2 dataframes: wide, relevant email columns redcap_user_information tall, wide data pivoted include email_field_name email columns","code":""},{"path":"/reference/get_redcap_emails_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"DETAILS","code":""},{"path":"/reference/get_script_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Fetches the package-scoped value of script_name — get_script_name","title":"Fetches the package-scoped value of script_name — get_script_name","text":"Fetches package-scoped value script_name","code":""},{"path":"/reference/get_script_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fetches the package-scoped value of script_name — get_script_name","text":"","code":"get_script_name()"},{"path":"/reference/get_script_run_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Fetches the package-scoped value of script_run_time — get_script_run_time","title":"Fetches the package-scoped value of script_run_time — get_script_run_time","text":"Fetches package-scoped value script_run_time","code":""},{"path":"/reference/get_script_run_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fetches the package-scoped value of script_run_time — get_script_run_time","text":"","code":"get_script_run_time()"},{"path":"/reference/get_script_run_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fetches the package-scoped value of script_run_time — get_script_run_time","text":"","code":"get_script_run_time() #> NULL"},{"path":"/reference/get_table_checksum.html","id":null,"dir":"Reference","previous_headings":"","what":"get_table_checksum — get_table_checksum","title":"get_table_checksum — get_table_checksum","text":"Fetch checksum MySQL table accessed via DBI connection object.","code":""},{"path":"/reference/get_table_checksum.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_table_checksum — get_table_checksum","text":"","code":"get_table_checksum(table_name, conn)"},{"path":"/reference/get_table_checksum.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get_table_checksum — get_table_checksum","text":"table_name name table database described `conn` conn DBI Connection object MySQL database","code":""},{"path":"/reference/get_table_checksum.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_table_checksum — get_table_checksum","text":"one row dataframe columns: host MySQL host name found DBI connection object database_name MySQL database name returned query table MySQL table name checksum checksum returned \"CHECKSUM TABLE \" elapsed_time elapsed time required query fetch checksum","code":""},{"path":"/reference/get_table_checksum.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"get_table_checksum — get_table_checksum","text":"","code":"if (FALSE) { get_table_checksum(\"redcap_user_information\", rc_conn) }"},{"path":"/reference/get_test_table_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"Provides list table names schema data files part package","code":""},{"path":"/reference/get_test_table_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"","code":"get_test_table_names()"},{"path":"/reference/get_test_table_names.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"list table names schema data files part package","code":""},{"path":"/reference/get_test_table_names.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"","code":"get_test_table_names() #> [1] \"redcap_projects\" \"redcap_user_information\""},{"path":"/reference/init_etl.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize all etl dependencies — init_etl","title":"Initialize all etl dependencies — init_etl","text":"Initialize etl dependencies","code":""},{"path":"/reference/init_etl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize all etl dependencies — init_etl","text":"","code":"init_etl( script_name = \"\", fake_runtime = NULL, log_db_drv = RMariaDB::MariaDB() )"},{"path":"/reference/init_etl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize all etl dependencies — init_etl","text":"script_name name passed set_script_name fake_runtime optional asserted script run time passed set_script_run_time, defaults time function called log_db_drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/init_etl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize all etl dependencies — init_etl","text":"","code":"if (FALSE) { init_etl(\"name_of_file\") }"},{"path":"/reference/init_log_con.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"Initialize connection log db set redcapcustodian.env$log_con","code":""},{"path":"/reference/init_log_con.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"","code":"init_log_con(drv = RMariaDB::MariaDB())"},{"path":"/reference/init_log_con.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/init_log_con.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"","code":"if (FALSE) { # use a sqlite db instead init_log_con(drv = RSQLite::SQLite()) }"},{"path":"/reference/is_db_con.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if the provided connection is a DBI connection object — is_db_con","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"Check provided connection DBI connection object","code":""},{"path":"/reference/is_db_con.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"","code":"is_db_con(con)"},{"path":"/reference/is_db_con.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"con DBI connection","code":""},{"path":"/reference/is_db_con.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"result test","code":""},{"path":"/reference/is_db_con.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"","code":"if (FALSE) { conn = connect_to_local_db() is_db_con( con = conn ) }"},{"path":"/reference/is_on_ci.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if ","title":"Check if ","text":"Check \"CI\" environment variable set TRUE","code":""},{"path":"/reference/is_on_ci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if ","text":"","code":"is_on_ci()"},{"path":"/reference/is_on_ci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if ","text":"TRUE/FALSE","code":""},{"path":"/reference/is_on_ci.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check if ","text":"","code":"if (FALSE) { is_on_ci() }"},{"path":"/reference/log_event_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"log_event_tables — log_event_tables","title":"log_event_tables — log_event_tables","text":"vector names 9 redcap log event tables","code":""},{"path":"/reference/log_event_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"log_event_tables — log_event_tables","text":"","code":"log_event_tables"},{"path":"/reference/log_event_tables.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"log_event_tables — log_event_tables","text":"vector 9 elements","code":""},{"path":"/reference/log_event_tables.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"log_event_tables — log_event_tables","text":"DETAILS","code":""},{"path":"/reference/log_job_debug.html","id":null,"dir":"Reference","previous_headings":"","what":"Log a job debug entry — log_job_debug","title":"Log a job debug entry — log_job_debug","text":"Log job debug entry","code":""},{"path":"/reference/log_job_debug.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log a job debug entry — log_job_debug","text":"","code":"log_job_debug(summary)"},{"path":"/reference/log_job_debug.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log a job debug entry — log_job_debug","text":"summary, job summary","code":""},{"path":"/reference/log_job_debug.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Log a job debug entry — log_job_debug","text":"","code":"if (FALSE) { log_job_debug( summary = \"Job debug step\" ) }"},{"path":"/reference/log_job_failure.html","id":null,"dir":"Reference","previous_headings":"","what":"Log a failed job run — log_job_failure","title":"Log a failed job run — log_job_failure","text":"Log failed job run","code":""},{"path":"/reference/log_job_failure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log a failed job run — log_job_failure","text":"","code":"log_job_failure(summary)"},{"path":"/reference/log_job_failure.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log a failed job run — log_job_failure","text":"summary, job summary","code":""},{"path":"/reference/log_job_failure.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Log a failed job run — log_job_failure","text":"","code":"if (FALSE) { log_job_failure( summary = \"Job failed\" ) }"},{"path":"/reference/log_job_success.html","id":null,"dir":"Reference","previous_headings":"","what":"Log a successful job run — log_job_success","title":"Log a successful job run — log_job_success","text":"Log successful job run","code":""},{"path":"/reference/log_job_success.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log a successful job run — log_job_success","text":"","code":"log_job_success(summary)"},{"path":"/reference/log_job_success.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log a successful job run — log_job_success","text":"summary, job summary","code":""},{"path":"/reference/log_job_success.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Log a successful job run — log_job_success","text":"","code":"if (FALSE) { log_job_success( summary = \"Job succeeded\" ) }"},{"path":"/reference/mutate_columns_to_posixct.html","id":null,"dir":"Reference","previous_headings":"","what":"mutate_columns_to_posixct — mutate_columns_to_posixct","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"Mutates column data types POSIXct. Especially useful working -memory tables dates often converted int.","code":""},{"path":"/reference/mutate_columns_to_posixct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"","code":"mutate_columns_to_posixct(data, column_names)"},{"path":"/reference/mutate_columns_to_posixct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"data - dataframe mutate column_names - vector column names mutate","code":""},{"path":"/reference/mutate_columns_to_posixct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"input dataframe revised data types","code":""},{"path":"/reference/mutate_columns_to_posixct.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"","code":"if (FALSE) { time_columns <- c(\"created\", \"updated\") mutate_columns_to_posixct(data, time_columns) }"},{"path":"/reference/project_life_cycle_descriptions.html","id":null,"dir":"Reference","previous_headings":"","what":"project_life_cycle_descriptions — project_life_cycle_descriptions","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"character vector descriptions used redcap_log_event table describe different stages life cycle REDCap Project","code":""},{"path":"/reference/project_life_cycle_descriptions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"","code":"project_life_cycle_descriptions"},{"path":"/reference/project_life_cycle_descriptions.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"character vector 24 elements","code":""},{"path":"/reference/project_life_cycle_descriptions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"DETAILS","code":""},{"path":"/reference/project_purpose_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"project_purpose_labels — project_purpose_labels","title":"project_purpose_labels — project_purpose_labels","text":"tibble project purpose IDs project purposes reflect meaning used `purpose` column `redcap_projects` table","code":""},{"path":"/reference/project_purpose_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_purpose_labels — project_purpose_labels","text":"","code":"project_purpose_labels"},{"path":"/reference/project_purpose_labels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_purpose_labels — project_purpose_labels","text":"data frame 5 rows 2 variables: id double primary key project_purpose character redcap project purpose","code":""},{"path":"/reference/project_purpose_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_purpose_labels — project_purpose_labels","text":"DETAILS","code":""},{"path":"/reference/project_purpose_other_research_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"project_purpose_other_research_labels — project_purpose_other_research_labels","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"tibble project purpose IDs labels reflect meaning used `purpose_other` column `redcap_projects` table","code":""},{"path":"/reference/project_purpose_other_research_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"","code":"project_purpose_other_research_labels"},{"path":"/reference/project_purpose_other_research_labels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"data frame 5 rows 2 variables: id double primary key project_purpose_other_research character redcap purpose research","code":""},{"path":"/reference/project_purpose_other_research_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"DETAILS","code":""},{"path":"/reference/project_status_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"project_status_labels — project_status_labels","title":"project_status_labels — project_status_labels","text":"tibble project status IDs project statuses reflect meaning used `status` column `redcap_projects` table","code":""},{"path":"/reference/project_status_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_status_labels — project_status_labels","text":"","code":"project_status_labels"},{"path":"/reference/project_status_labels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_status_labels — project_status_labels","text":"data frame 4 rows 2 variables: id double primary key project_status character redcap project status","code":""},{"path":"/reference/project_status_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_status_labels — project_status_labels","text":"DETAILS","code":""},{"path":"/reference/quit_non_interactive_run.html","id":null,"dir":"Reference","previous_headings":"","what":"Quit a non interactive R session — quit_non_interactive_run","title":"Quit a non interactive R session — quit_non_interactive_run","text":"Quit non interactive R session","code":""},{"path":"/reference/quit_non_interactive_run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Quit a non interactive R session — quit_non_interactive_run","text":"","code":"quit_non_interactive_run()"},{"path":"/reference/quit_non_interactive_run.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Quit a non interactive R session — quit_non_interactive_run","text":"","code":"if (FALSE) { quit_non_interactive_run() }"},{"path":"/reference/read_project_data.html","id":null,"dir":"Reference","previous_headings":"","what":"read_project_data Read data from a REDCap project — read_project_data","title":"read_project_data Read data from a REDCap project — read_project_data","text":"read_project_data Read data REDCap project","code":""},{"path":"/reference/read_project_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read_project_data Read data from a REDCap project — read_project_data","text":"","code":"read_project_data(..., conn, project_pid, server_short_name = as.character(NA))"},{"path":"/reference/read_project_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read_project_data Read data from a REDCap project — read_project_data","text":"... parameters pass `REDCapR::redcap_read` conn Connection object credentials database project_pid project PID REDCap system. string used search REDCap custodian credentials database locate `token` `redcap_uri` server_short_name optional name server houses REDCap project interest. prevent project PID clashes.","code":""},{"path":"/reference/read_project_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"read_project_data Read data from a REDCap project — read_project_data","text":"dataframe data read REDCap project","code":""},{"path":"/reference/read_project_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read_project_data Read data from a REDCap project — read_project_data","text":"","code":"if (FALSE) { library(redcapcustodian) library(DBI) dotenv::load_dot_env(\"testing.env\") init_etl(\"dummy\") support_data <- read_project_data( conn = DBI::dbConnect(RSQLite::SQLite(), Sys.getenv(\"CREDENTIALS_DB\")), project_pid = Sys.getenv(\"MY_PROJECT_PID\")) }"},{"path":"/reference/read_project_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"read_project_metadata Read data from a REDCap project — read_project_metadata","title":"read_project_metadata Read data from a REDCap project — read_project_metadata","text":"read_project_metadata Read data REDCap project","code":""},{"path":"/reference/read_project_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read_project_metadata Read data from a REDCap project — read_project_metadata","text":"","code":"read_project_metadata( ..., conn, project_pid, server_short_name = as.character(NA) )"},{"path":"/reference/read_project_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read_project_metadata Read data from a REDCap project — read_project_metadata","text":"... parameters pass `REDCapR::redcap_metadata_read` conn Connection object credentials database project_pid project PID REDCap system. string used search REDCap custodian credentials database locate `token` `redcap_uri` server_short_name optional name server houses REDCap project interest. prevent project PID clashes.","code":""},{"path":"/reference/read_project_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"read_project_metadata Read data from a REDCap project — read_project_metadata","text":"dataframe metadata read REDCap project","code":""},{"path":"/reference/read_project_metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read_project_metadata Read data from a REDCap project — read_project_metadata","text":"","code":"if (FALSE) { library(redcapcustodian) library(DBI) dotenv::load_dot_env(\"testing.env\") init_etl(\"dummy\") support_data <- read_project_metadata( conn = DBI::dbConnect(RSQLite::SQLite(), Sys.getenv(\"CREDENTIALS_DB\")), project_pid = Sys.getenv(\"MY_PROJECT_PID\")) }"},{"path":"/reference/scrape_user_api_tokens.html","id":null,"dir":"Reference","previous_headings":"","what":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"Gather API tokens specified REDCap server given user","code":""},{"path":"/reference/scrape_user_api_tokens.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"","code":"scrape_user_api_tokens(conn, username_to_scrape = Sys.info()[[\"user\"]])"},{"path":"/reference/scrape_user_api_tokens.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"conn DBI database connection REDCap instance, get_redcap_db_connection username_to_scrape REDCap username, defaults system's username","code":""},{"path":"/reference/scrape_user_api_tokens.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"dataframe tokens assigned user containing following: project_id - project ID REDCap (0 super token) username - username REDCap token - API token associated project ID project_display_name - name project appears REDCap GUI","code":""},{"path":"/reference/scrape_user_api_tokens.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() my_credentials <- scrape_user_api_tokens(conn, \"admin\") }"},{"path":"/reference/send_email.html","id":null,"dir":"Reference","previous_headings":"","what":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"wrapper function sends email (via sendmailR) reporting outcome another function","code":""},{"path":"/reference/send_email.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"","code":"send_email( email_body, email_subject = \"\", email_to = \"\", email_cc = \"\", email_from = \"\" )"},{"path":"/reference/send_email.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"email_body contents email email_subject subject line email email_to email addresses primary recipient(s), separate recipient addresses spaces email_cc email addresses cc'd recipient(s), separate recipient addresses spaces email_from email addresses sender","code":""},{"path":"/reference/send_email.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"returned value","code":""},{"path":"/reference/send_email.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"","code":"if (FALSE) { message <- paste(\"Failed REDCap data import to\", project_title, \"\\nThe reason given was:\", error_message) email_subject <- paste(\"FAILED |\", script_name, \"|\", Sys.getenv(\"INSTANCE\"), \"|\", script_run_time) send_email(message, email_subject) }"},{"path":"/reference/set_package_scope_var.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"Assign value redcapcustodian.env environment, retrievable get_package_scope_var Assign value redcapcustodian.env environment, retrievable get_package_scope_var","code":""},{"path":"/reference/set_package_scope_var.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"","code":"set_package_scope_var(key, value) set_package_scope_var(key, value)"},{"path":"/reference/set_package_scope_var.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"key identifying string store lookup key value value store","code":""},{"path":"/reference/set_package_scope_var.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"","code":"if (FALSE) { set_package_scope_var(\"hello\", \"world\") hello <- get_package_scope_var(\"hello\") } if (FALSE) { set_package_scope_var(\"hello\", \"world\") hello <- get_package_scope_var(\"hello\") }"},{"path":"/reference/set_project_api_token.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"Generate API token REDCap project assign specified user","code":""},{"path":"/reference/set_project_api_token.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"","code":"set_project_api_token(conn, username, project_id)"},{"path":"/reference/set_project_api_token.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"conn DBI database connection, get_redcap_db_connection username REDCap username user must already access project, .e. must appear project's User Rights project_id project id project wish generate token","code":""},{"path":"/reference/set_project_api_token.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"nothing","code":""},{"path":"/reference/set_project_api_token.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() my_new_token <- set_project_api_token(conn, \"admin\", 15) }"},{"path":"/reference/set_script_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","title":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","text":"Assigns package-scoped script_name. default sourced focused RStudio window calling command (e.g. Rscript script_name.R)","code":""},{"path":"/reference/set_script_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","text":"","code":"set_script_name(script_name = \"\")"},{"path":"/reference/set_script_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","text":"script_name optional arg override calling script","code":""},{"path":"/reference/set_script_run_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Sets the package-scoped value of script_run_time — set_script_run_time","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"Sets package-scoped value script_run_time","code":""},{"path":"/reference/set_script_run_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"","code":"set_script_run_time(fake_runtime = lubridate::NA_POSIXct_)"},{"path":"/reference/set_script_run_time.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"fake_runtime asserted script run time","code":""},{"path":"/reference/set_script_run_time.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"package-scoped value script_run_time","code":""},{"path":"/reference/set_script_run_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"","code":"set_script_run_time() #> [1] \"2024-01-30 19:47:23 UTC\" set_script_run_time(fake_runtime = as.POSIXct(\"2021-02-23 02:23:00\", tz=\"\", format=\"%Y-%m-%d %H:%M:%OS\") ) #> [1] \"2021-02-23 02:23:00 UTC\""},{"path":"/reference/set_super_api_token.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"Generate set Super API token provided REDCap user","code":""},{"path":"/reference/set_super_api_token.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"","code":"set_super_api_token(conn, username)"},{"path":"/reference/set_super_api_token.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"conn DBI database connection, get_redcap_db_connection username REDCap username","code":""},{"path":"/reference/set_super_api_token.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"newly created super token","code":""},{"path":"/reference/set_super_api_token.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() my_new_super_token <- set_super_api_token(conn, \"admin\") }"},{"path":"/reference/suspend_users_with_no_primary_email.html","id":null,"dir":"Reference","previous_headings":"","what":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"Suspends users primary email redcap_user_information","code":""},{"path":"/reference/suspend_users_with_no_primary_email.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"","code":"suspend_users_with_no_primary_email(conn)"},{"path":"/reference/suspend_users_with_no_primary_email.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"conn DBI Connection object","code":""},{"path":"/reference/suspend_users_with_no_primary_email.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"","code":"if (FALSE) { suspend_users_with_no_primary_email(conn) }"},{"path":"/reference/sync_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"Sync data dictionary source project target project using credential objects","code":""},{"path":"/reference/sync_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"","code":"sync_metadata( source_credentials, target_credentials, strip_action_tags = FALSE )"},{"path":"/reference/sync_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"source_credentials dataframe containing following columns: redcap_uri - uri API endpoint REDCap host token - REDCap API token specific project dataframe contain credentials project wish copy target_credentials dataframe containing following columns: redcap_uri - uri API endpoint REDCap host token - REDCap API token specific project dataframe contain credentials project wish overwrite strip_action_tags Optional toggle remove action tags, useful porting development environment; defaults FALSE","code":""},{"path":"/reference/sync_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"nothing","code":""},{"path":[]},{"path":"/reference/sync_metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"","code":"if (FALSE) { source_credentials <- REDCapR::retrieve_credential_local( path_credential = \"source_credentials.csv\", project_id = 31 ) target_credentials <- REDCapR::retrieve_credential_local( path_credential = \"target_credentials.csv\", project_id = 25 ) sync_metadata(source_credentials, target_credentials) }"},{"path":"/reference/sync_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a MySQL Database using the result of dataset_diff — sync_table","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"Write MySQL Database using result dataset_diff","code":""},{"path":"/reference/sync_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"","code":"sync_table( conn, table_name, primary_key, data_diff_output, insert = F, update = T, delete = F )"},{"path":"/reference/sync_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"conn DBI database connection table_name name table write primary_key name primary key (vector multiple keys) table write data_diff_output list dataframes returned dataset_diff insert boolean toggle use insert dataframe insert rows table_name update boolean toggle use updates dataframe update rows table_name delete boolean toggle use delete dataframe delete rows table_name","code":""},{"path":"/reference/sync_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"named list values: insert_n - number rows inserted table_name update_n - number rows updated table_name delete_n - number rows deleted table_name","code":""},{"path":"/reference/sync_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() ... diff_output <- dataset_diff( source = updates, source_pk = \"id\", target = original_table, target_pk = \"id\" ) sync_table( conn = con, table_name = table_name, primary_key = primary_key, data_diff_output = diff_output ) }"},{"path":"/reference/sync_table_2.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"Write MySQL Database based diff source target datasets.","code":""},{"path":"/reference/sync_table_2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"","code":"sync_table_2( conn, table_name, source, source_pk, target, target_pk, insert = F, update = T, delete = F )"},{"path":"/reference/sync_table_2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"conn DBI database connection table_name name table write source - dataframe content needs reflected target source_pk - primary key source target - data frame needs reflect source target_pk - primary key target insert boolean toggle use insert dataframe insert rows table_name update boolean toggle use updates dataframe update rows table_name delete boolean toggle use delete dataframe delete rows table_name","code":""},{"path":"/reference/sync_table_2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"named list values: insert_records - dataframe inserts update_records - dataframe updates delete_records - dataframe deletions insert_n - number rows inserted table_name update_n - number rows updated table_name delete_n - number rows deleted table_name","code":""},{"path":"/reference/sync_table_2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() ... sync_table_2( conn = con, table_name = table_name, source = updates, source_pk = \"id\", target = original_table, target_pk = \"id\" ) }"},{"path":"/reference/sync_table_test_user_data_result.html","id":null,"dir":"Reference","previous_headings":"","what":"sync_table_test_user_data_result — sync_table_test_user_data_result","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"output sync_table dataset_diff_test_user_data used input","code":""},{"path":"/reference/sync_table_test_user_data_result.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"","code":"sync_table_test_user_data_result"},{"path":"/reference/sync_table_test_user_data_result.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"data frame 4 rows 3 variables: ui_id double primary key username character redcap username user_email character primary email address","code":""},{"path":"/reference/sync_table_test_user_data_result.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"DETAILS","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":null,"dir":"Reference","previous_headings":"","what":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"REDCap Custodian logging provide field, `job_summary_data`, store arbitrary details job. contents defined entirely script, practice, easy encode data frame list data frames JSON object, become common practice. Yet using data can bit complex `jsonlite::fromJSON` vectorized. need read multiple job log records, iteration required use JSON object `job_summary_data`. function addresses need accepting dataframe job summary logs unnesting JSON object(s) `job_summary_data` equivalent R objects. Use `objects_to_include` limit unnested objects similar geometry. Dissimilar objects unnested together.","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"","code":"unnest_job_summary_data_json_object(log_data, objects_to_include = NA)"},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"log_data - dataframe job summary logs objects_to_include - optional vector JSON objects job_summary_data un-nested","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"- input dataframe job summary logs `job_summary_data` replaced R objects JSON-encoded therein.","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"","code":"if (FALSE) { library(redcapcustodian) library(RMariaDB) library(DBI) library(tidyverse) library(dotenv) init_etl(\"pbc_scratch\") log_conn <- get_package_scope_var(\"log_con\") log_data <- tbl(log_conn, \"rcc_job_log\") %>% dplyr::filter(script_name == \"warn_owners_of_impending_bill\") |> collect() unnest_job_summary_data_json_object(log_data) # Read a more complex object log_data_2 <- tbl(log_conn, \"rcc_job_log\") |> dplyr::filter( script_name == \"create_and_send_new_redcap_prod_per_project_line_items\" & level == \"SUCCESS\" ) %>% collect() # Fails due to dissimilar objects unnest_job_summary_data_json_object(log_data_2) # error is \"Can't recycle `service_instance` (size 27) to match `invoice_line_item` (size 79).\" # When separated, the objects can be unnested unnest_job_summary_data_json_object(log_data_2, objects_to_include = c(\"service_instance\")) unnest_job_summary_data_json_object(log_data_2, objects_to_include = c(\"invoice_line_item\")) }"},{"path":"/reference/update_production_allocation_state.html","id":null,"dir":"Reference","previous_headings":"","what":"update_production_allocation_state — update_production_allocation_state","title":"update_production_allocation_state — update_production_allocation_state","text":"Update producition rows redcap_randomization_allocation table mirror another project.","code":""},{"path":"/reference/update_production_allocation_state.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"update_production_allocation_state — update_production_allocation_state","text":"","code":"update_production_allocation_state( source_conn, target_conn, source_project_id, target_rid )"},{"path":"/reference/update_production_allocation_state.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"update_production_allocation_state — update_production_allocation_state","text":"source_conn - DBI connection object pointing REDCap database houses source project. target_conn - DBI connection object pointing REDCap database houses target project. source_project_id - project ID REDCap project contains randomization cloned. target_rid - randomization id REDCap project receive updated randomization data.","code":""},{"path":"/reference/update_production_allocation_state.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"update_production_allocation_state — update_production_allocation_state","text":"- list output sync_table_2 update randomization allocation table.","code":""},{"path":"/reference/update_production_allocation_state.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"update_production_allocation_state — update_production_allocation_state","text":"","code":"if (FALSE) { target_project_allocation_update <- update_production_allocation_state( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_rid = target_project_randomization_state$rid ) }"},{"path":"/reference/update_redcap_email_addresses.html","id":null,"dir":"Reference","previous_headings":"","what":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"Updates bad redcap email addresses redcap_user_information","code":""},{"path":"/reference/update_redcap_email_addresses.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"","code":"update_redcap_email_addresses( conn, redcap_email_revisions, redcap_email_original )"},{"path":"/reference/update_redcap_email_addresses.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"conn DBI Connection object redcap_email_revisions df returned get_redcap_email_revisions redcap_email_original df original redcap_user_information email data","code":""},{"path":"/reference/update_redcap_email_addresses.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() bad_emails <- get_bad_emails_from_listserv_digest( username = \"jdoe\", password = \"jane_does_password\", url = \"imaps://outlook.office365.com\", messages_since_date = as.Date(\"2022-01-01\", format = \"%Y-%m-%d\") ) bad_redcap_user_emails <- get_redcap_emails(conn)$tall %>% filter(email %in% bad_emails) person_data <- get_institutional_person_data() redcap_email_revisions <- get_redcap_email_revisions(bad_redcap_email_output, person_data) update_redcap_email_addresses( conn, redcap_email_revisions, redcap_email_original = get_redcap_emails(conn)$wide ) }"},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"list test inputs outputs update_redcap_email_addresses","code":""},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"","code":"update_redcap_email_addresses_test_data"},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"list 1 variables: output tibble email data read backfrom redcap_user_information","code":""},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"DETAILS","code":""},{"path":"/reference/user_rights_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"user_rights_test_data — user_rights_test_data","title":"user_rights_test_data — user_rights_test_data","text":"named list dataframes used test functions written manage user rights","code":""},{"path":"/reference/user_rights_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"user_rights_test_data — user_rights_test_data","text":"","code":"user_rights_test_data"},{"path":"/reference/user_rights_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"user_rights_test_data — user_rights_test_data","text":"named list 3 dataframes: redcap_user_information REDCap Core table redcap_user_rights REDCap Core table redcap_user_roles REDCap Core table","code":""},{"path":"/reference/user_rights_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"user_rights_test_data — user_rights_test_data","text":"DETAILS","code":""},{"path":"/reference/verify_log_connectivity.html","id":null,"dir":"Reference","previous_headings":"","what":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"Attempts connect DB using LOG_DB_* environment variables. Returns empty list connection established, returns `error_list` entry otherwise.","code":""},{"path":"/reference/verify_log_connectivity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"","code":"verify_log_connectivity(drv = RMariaDB::MariaDB())"},{"path":"/reference/verify_log_connectivity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/verify_log_connectivity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"`error_list` entry","code":""},{"path":"/reference/verify_log_connectivity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"","code":"if (FALSE) { verify_log_connectivity(RMariaDB::MariaDB()) }"},{"path":"/reference/verify_log_dependencies.html","id":null,"dir":"Reference","previous_headings":"","what":"Verifies all dependencies required to write log entries. — verify_log_dependencies","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"Verifies dependencies required write log entries.","code":""},{"path":"/reference/verify_log_dependencies.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"","code":"verify_log_dependencies(drv = RMariaDB::MariaDB())"},{"path":"/reference/verify_log_dependencies.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/verify_log_dependencies.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"list `error_list` entries.","code":""},{"path":"/reference/verify_log_dependencies.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"","code":"if (FALSE) { verify_log_dependencies( drv = RMariaDB::MariaDB() ) }"},{"path":"/reference/verify_log_env_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"Verifies required environment variables set. Returns empty list necessary environment variables set, returns list errors otherwise.","code":""},{"path":"/reference/verify_log_env_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"","code":"verify_log_env_variables()"},{"path":"/reference/verify_log_env_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"list `error_list` entries.","code":""},{"path":"/reference/verify_log_env_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"","code":"if (FALSE) { verify_log_env_variables() }"},{"path":"/reference/write_allocations.html","id":null,"dir":"Reference","previous_headings":"","what":"write_allocations — write_allocations","title":"write_allocations — write_allocations","text":"Write development production randomization allocation table form loaded.","code":""},{"path":"/reference/write_allocations.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"write_allocations — write_allocations","text":"","code":"write_allocations(project_status_to_write, allocations, target_directory = \".\")"},{"path":"/reference/write_allocations.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"write_allocations — write_allocations","text":"project_status_to_write - value project_status export. Use 0 development. Use 1 Production allocations - dataframe randomization allocation data exported `export_allocation_tables_from_project` target_directory - directory function write files","code":""},{"path":"/reference/write_allocations.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"write_allocations — write_allocations","text":"full path allocations file","code":""},{"path":"/reference/write_allocations.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"write_allocations — write_allocations","text":"","code":"if (FALSE) { # get and print importable allocations if we need them for reference allocations <- export_allocation_tables_from_project( conn = source_conn, project_id_to_export = source_project_id ) # write both files walk(c(0,1), write_allocations, allocations, \"output\") }"},{"path":"/reference/write_debug_job_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write a debug log entry for the job — write_debug_job_log_entry","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"Write debug log entry job","code":""},{"path":"/reference/write_debug_job_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"","code":"write_debug_job_log_entry(con, job_duration, job_summary)"},{"path":"/reference/write_debug_job_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"con, DB connection job_duration, duration job seconds job_summary, summary job performed JSON","code":""},{"path":"/reference/write_debug_job_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"","code":"if (FALSE) { write_debug_job_log_entry( conn = con, job_duration = 30, job_summary = as.json(\"Update vaccination status\") ) }"},{"path":"/reference/write_error_job_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an error log entry for the job — write_error_job_log_entry","title":"Write an error log entry for the job — write_error_job_log_entry","text":"Write error log entry job","code":""},{"path":"/reference/write_error_job_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an error log entry for the job — write_error_job_log_entry","text":"","code":"write_error_job_log_entry(con, job_duration, job_summary)"},{"path":"/reference/write_error_job_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an error log entry for the job — write_error_job_log_entry","text":"con, DB connection job_duration, duration job seconds job_summary, summary job performed JSON","code":""},{"path":"/reference/write_error_job_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an error log entry for the job — write_error_job_log_entry","text":"","code":"if (FALSE) { write_error_job_log_entry( conn = con, job_duration = 30, job_summary = as.json(\"Update vaccination status\") ) }"},{"path":"/reference/write_error_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an error log entry — write_error_log_entry","title":"Write an error log entry — write_error_log_entry","text":"Write error log entry","code":""},{"path":"/reference/write_error_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an error log entry — write_error_log_entry","text":"","code":"write_error_log_entry(conn, target_db_name, table_written = NULL, df, pk_col)"},{"path":"/reference/write_error_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an error log entry — write_error_log_entry","text":"conn, DB connection target_db_name, database write table_written, table written df, data write pk_col, dataframe col use primary_key","code":""},{"path":"/reference/write_error_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an error log entry — write_error_log_entry","text":"","code":"if (FALSE) { write_error_log_entry( conn = con, target_db_name = rc_case, table_written = \"cases\", df = data_written, pk_col = \"record_id\" ) }"},{"path":"/reference/write_info_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an info log entry — write_info_log_entry","title":"Write an info log entry — write_info_log_entry","text":"Write info log entry","code":""},{"path":"/reference/write_info_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an info log entry — write_info_log_entry","text":"","code":"write_info_log_entry(conn, target_db_name, table_written = NULL, df, pk_col)"},{"path":"/reference/write_info_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an info log entry — write_info_log_entry","text":"conn, DB connection target_db_name, database write table_written, table written df, data write pk_col, dataframe col use primary_key","code":""},{"path":"/reference/write_info_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an info log entry — write_info_log_entry","text":"","code":"if (FALSE) { write_info_log_entry( conn = con, target_db_name = rc_case, table_written = \"cases\", df = data_written, pk_col = \"record_id\", ) }"},{"path":"/reference/write_project_data.html","id":null,"dir":"Reference","previous_headings":"","what":"write_project_data Write data from a REDCap project — write_project_data","title":"write_project_data Write data from a REDCap project — write_project_data","text":"write_project_data Write data REDCap project","code":""},{"path":"/reference/write_project_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"write_project_data Write data from a REDCap project — write_project_data","text":"","code":"write_project_data( ..., conn, project_pid, server_short_name = as.character(NA) )"},{"path":"/reference/write_project_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"write_project_data Write data from a REDCap project — write_project_data","text":"... parameters pass `REDCapR::redcap_write` conn Connection object credentials database project_pid project PID REDCap system. string used search REDCap custodian credentials database locate `token` `redcap_uri` server_short_name optional name server houses REDCap project interest. prevent project PID clashes.","code":""},{"path":"/reference/write_project_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"write_project_data Write data from a REDCap project — write_project_data","text":"dataframe data write REDCap project","code":""},{"path":"/reference/write_project_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"write_project_data Write data from a REDCap project — write_project_data","text":"","code":"if (FALSE) { library(redcapcustodian) library(DBI) dotenv::load_dot_env(\"testing.env\") init_etl(\"dummy\") support_data <- write_project_data( conn = DBI::dbConnect(RSQLite::SQLite(), Sys.getenv(\"CREDENTIALS_DB\")), project_pid = Sys.getenv(\"MY_PROJECT_PID\")) }"},{"path":"/reference/write_success_job_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an success job log entry — write_success_job_log_entry","title":"Write an success job log entry — write_success_job_log_entry","text":"Write success job log entry","code":""},{"path":"/reference/write_success_job_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an success job log entry — write_success_job_log_entry","text":"","code":"write_success_job_log_entry(con, job_duration, job_summary)"},{"path":"/reference/write_success_job_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an success job log entry — write_success_job_log_entry","text":"con, DB connection job_duration, duration job seconds job_summary, summary job performed JSON","code":""},{"path":"/reference/write_success_job_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an success job log entry — write_success_job_log_entry","text":"","code":"if (FALSE) { write_success_job_log_entry( conn = con, job_duration = 30, job_summary = as.json(\"Update vaccination status\") ) }"},{"path":"/reference/write_summary_metrics.html","id":null,"dir":"Reference","previous_headings":"","what":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"Format write summary metrics redcap_summary_metrics table LOG_DB","code":""},{"path":"/reference/write_summary_metrics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"","code":"write_summary_metrics( reporting_period_start, reporting_period_end, metric_type, metric_dataframe, conn = NULL )"},{"path":"/reference/write_summary_metrics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"reporting_period_start datetime object, e.g. ymd_hms(\"2022-11-01 00:00:00\") reporting_period_end datetime object, e.g. ymd_hms(\"2022-12-01 00:00:00\") metric_type character string representing metric type, e.g. \"flux\", \"state\" metric_dataframe wide data frame key-value pairs single row data conn DBI connection object database holds `redcap_summary_metrics` table. Can left NULL connection available package scope var \"log_con\".","code":""},{"path":"/reference/write_summary_metrics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"nothing","code":""},{"path":"/reference/write_summary_metrics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"","code":"if (FALSE) { write_summary_metrics( reporting_period_start = ymd_hms(\"2022-01-01 00:00:00\", tz=Sys.getenv(\"TIME_ZONE\")), reporting_period_end = ceiling_date(reporting_period_start, \"month\", change_on_boundary = T), metric_type = \"state\", metric_dataframe = my_cool_df, conn = my_conn ) }"},{"path":"/reference/write_to_sql_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"Write MySQL Database error checking email alerting failure","code":""},{"path":"/reference/write_to_sql_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"","code":"write_to_sql_db( conn, table_name, df_to_write, schema, overwrite, db_name, is_log_con = FALSE, continue_on_error = FALSE, ... )"},{"path":"/reference/write_to_sql_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"conn DBI database connection table_name name table write df_to_write data frame write _table_name_ schema database write overwrite logical controls whether overwrite table db_name name database written is_log_con FALSE log failures, TRUE attempt log errors continue_on_error TRUE continue execution error, FALSE quit non interactive sessions error ... Additional parameters passed DBI::dbWriteTable","code":""},{"path":"/reference/write_to_sql_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"value returned","code":""},{"path":"/reference/write_to_sql_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"","code":"if (FALSE) { write_to_sql_db( conn = con, table_name = \"my_table\", df_to_write = rule_output, schema = Sys.getenv(\"ETL_DB_SCHEMA\"), overwrite = FALSE, db_name = Sys.getenv(\"ETL_DB_NAME\"), append = TRUE ) }"},{"path":"/news/index.html","id":"redcapcustodian-1190-released-2024-01-30","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.19.0 (released 2024-01-30)","title":"redcapcustodian 1.19.0 (released 2024-01-30)","text":"Add REDCapR wrapper functions (@ljwoodley, #147, #148)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1180-released-2024-01-10","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.18.0 (released 2024-01-10)","title":"redcapcustodian 1.18.0 (released 2024-01-10)","text":"Update Dockerfile verse:4.3.2 (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1174-released-2023-11-22","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.4 (released 2023-11-22)","title":"redcapcustodian 1.17.4 (released 2023-11-22)","text":"Turn code chunks job_logging.Rmd fix pkgdown::deploy_to_branch() errors (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1173-released-2023-11-21","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.3 (released 2023-11-21)","title":"redcapcustodian 1.17.3 (released 2023-11-21)","text":"Fix 4 intermittent test failures caused environment vars (@pbchase, #143) Fix error test ‘init_etl properly sets script name, script run time, initializes log connection’ (@pbchase, #143) Fix 11 warnings dplyr::all_equal() tests (@pbchase, #143) Address lots pkgdown::build_site() complaints garbage-collected connections (@pbchase, @ChemiKyle, #143) Address pkgdown::build_site() complaints non-parsable code examples (@pbchase, @ChemiKyle, #104, #143) Update vignettes/job_logging.Rmd fix build errors (@pbchase, #143)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1172-released-2023-11-17","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.2 (released 2023-11-17)","title":"redcapcustodian 1.17.2 (released 2023-11-17)","text":"Update vignettes/job_logging.Rmd fix build errors (@pbchase, #142)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1171-released-2023-11-17","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.1 (released 2023-11-17)","title":"redcapcustodian 1.17.1 (released 2023-11-17)","text":"Fix build failures caused vignettes/job_logging.Rmd (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1170-released-2023-11-17","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.0 (released 2023-11-17)","title":"redcapcustodian 1.17.0 (released 2023-11-17)","text":"Add job_logging vignette (@pbchase, #113, #115) Add objects_to_include param unnest_job_summary_data_json_object() (@pbchase, #112, #115)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1160-released-2023-11-16","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.16.0 (released 2023-11-16)","title":"redcapcustodian 1.16.0 (released 2023-11-16)","text":"Add MySQL database comparison tools (@pbchase, @ChemiKyle, #140)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1150-released-2023-10-31","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.15.0 (released 2023-10-31)","title":"redcapcustodian 1.15.0 (released 2023-10-31)","text":"Fix test data get_redcap_email_revisions() (@pbchase) Add delete_project() (@ljwoodley, #139) Add dataframe_to_redcap_dictionary() (@ljwoodley, #136)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1141-released-2023-08-24","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.14.1 (released 2023-08-24)","title":"redcapcustodian 1.14.1 (released 2023-08-24)","text":"Update etl/delete_erroneous_survey_reminders.R (@pbchase, #137)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1140-released-2023-08-14","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.14.0 (released 2023-08-14)","title":"redcapcustodian 1.14.0 (released 2023-08-14)","text":"Fix build issues Apple silicon (@pbchase, #133, #134) Add delete_erroneous_survey_reminders.R (@pbchase, #131, #132)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1131-released-2023-08-04","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.13.1 (released 2023-08-04)","title":"redcapcustodian 1.13.1 (released 2023-08-04)","text":"update render_report handle qmd files (@ljwoodley, #117, #129) Add LICENSE (@pbchase, #119, #124)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1130-released-2023-06-23","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.13.0 (released 2023-06-23)","title":"redcapcustodian 1.13.0 (released 2023-06-23)","text":"Add project_purpose_other_research_labels.rda (@pbchase, #123) Add project_status_labels project_purpose_labels (@pbchase, #122) Add conn parameter write_summary_metrics() (@pbchase, #122) Add copy_entire_table_to_db() (@pbchase, #122) Update render_report.R support quarto files (@pbchase, #118)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1120-released-2023-06-02","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.12.0 (released 2023-06-02)","title":"redcapcustodian 1.12.0 (released 2023-06-02)","text":"Add unnest_job_summary_data_json_object() (@pbchase, #111) Fix Version DESCRIPTION (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1110-released-2023-05-10","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.11.0 (released 2023-05-10)","title":"redcapcustodian 1.11.0 (released 2023-05-10)","text":"Add description_base_name get_project_life_cycle() output. (@pbchase, #110) Expand list descriptions project_life_cycle_descriptions include modern descriptions.(@pbchase, #110)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1100-released-2023-04-24","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.10.0 (released 2023-04-24)","title":"redcapcustodian 1.10.0 (released 2023-04-24)","text":"Add project_life_cycle_descriptions (@pbchase, #106) Add get_project_life_cycle() (@pbchase, #106)","code":""},{"path":"/news/index.html","id":"redcapcustodian-190-released-2023-04-24","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.9.0 (released 2023-04-24)","title":"redcapcustodian 1.9.0 (released 2023-04-24)","text":"Add quarto tlmgr packages needs pdf generation (@pbchase, #107)","code":""},{"path":"/news/index.html","id":"redcapcustodian-181-released-2023-03-20","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.8.1 (released 2023-03-20)","title":"redcapcustodian 1.8.1 (released 2023-03-20)","text":"Update NEWS.md DESCRIPTION comply pkgdown (@pbchase, #103)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-8-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.8.0 (released 2023-03-17)","text":"Add log database system dev work (@pbchase, #110)","code":""},{"path":"/news/index.html","id":"changed-1-8-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.8.0 (released 2023-03-17)","text":"Fix ORCIDs DESCRIPTION (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-7-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.7.0 (released 2023-03-17)","text":"Add pkgdown website (@pbchase, #102)","code":""},{"path":"/news/index.html","id":"changed-1-7-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.7.0 (released 2023-03-17)","text":"Revise package title away REDCap towards automation (@pbchase) Remove publication_date .zenodo.json (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-6-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.6.0 (released 2023-02-21)","text":"Add randomization management functions sample ETL (@pbchase, #99) Add batch_size parm dbx calls sync_table_2 (@pbchase) Add batch_size parm dbx calls sync_table Prevents possible error: Expression tree large (maximum depth 1000) (@ChemiKyle, #96)","code":""},{"path":"/news/index.html","id":"changed-1-6-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.6.0 (released 2023-02-21)","text":"Update testing image used github (@pbchase) Eschew deprecated tidyselect features (@pbchase, #98) Modernize tests sync_table_2 (@pbchase) Address fatal bug sync_table caused delete = T records delete (@ChemiKyle, #97)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-5-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.5.0 (released 2023-01-25)","text":"Create write_summary_metrics function, corresponding schema test (@ChemiKyle, #95) Add render_report /report (@ljwoodley, #93) Port convert_schema_to_sqlite rcc.billing, altering accept path sql file input (@ChemiKyle, #94) Port mutate_columns_to_posixct rcc.billing (@ChemiKyle, #94)","code":""},{"path":"/news/index.html","id":"changed-1-5-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.5.0 (released 2023-01-25)","text":"Ignore local credentials DBs (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-4-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.4.1 (released 2022-12-15)","text":"Install latex packages directly Dockerfile (@ljwoodley, #91)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-4-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.4.0 (released 2022-12-13)","text":"Switch Dockerfile tidyverse verse (@ljwoodley, #90) Add render_report.R render Rmds (@ljwoodley, #90)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-3-2","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.3.2 (released 2022-09-14)","text":"Specify package na.exclude() (@pbchase) escape . treat literal character instead wildcard gsub statements (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-3-1","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.3.1 (released 2022-08-30)","text":"Remove remants site concept (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-3-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.3.0 (released 2022-08-29)","text":"Add get_bad_emails_from_individual_emails function (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-2-2","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.2.2 (released 2022-08-26)","text":"Modernize container add dependencies (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-2-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.2.1 (released 2022-08-26)","text":"Move schema files package space (@pbchase) Correct send_email using email_to email_cc (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-2-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.2.0 (released 2022-08-25)","text":"Add email_from email_cc params send_email function, default env value (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-1-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.1.1 (released 2022-08-24)","text":"Fix test search results get_bad_emails_from_listserv_digest (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-1-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.1.0 (released 2022-08-08)","text":"Add logging Friday Call demo (@pbchase)","code":""},{"path":"/news/index.html","id":"changed-1-1-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.1.0 (released 2022-08-08)","text":"Define username tube count variables friday call demo (@ChemiKyle) Move fake data section setup file Friday Call Demo (@pbchase) Move credential creation scraping main friday call auxiliary setup file (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-0-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.0.0 (released 2022-08-02)","text":"Add logging suspend_users_with_no_primary_email (@pbchase) Add sync_table2 merge dataset_diff sync_table (@pbchase) Add expire_user_project_rights (@pbchase)","code":""},{"path":"/news/index.html","id":"changed-1-0-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.0.0 (released 2022-08-02)","text":"Use sync_table_2 update_redcap_email_addresses (@pbchase) Refactor tests test data related cleanup_bad_email_addresses.R (@pbchase) Remove credentials public image (@mbentz-uf) Fix deployment cron file (@pbchase) Add common directories template ignore files (@pbchase) Fix ADD .study (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-7-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.7.0 (released 2022-07-17)","text":"Add package Dockerfile (@pbchase) Add send_email function adapted stp (@ChemiKyle) Add DOI badge README (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-6-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.6.1 (released 2022-07-13)","text":"Fix typo description (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-6-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.6.0 (released 2022-07-13)","text":"Add resources publication (@pbchase) Add friday-call-demo.Rmd (@ChemiKyle, @pbchase)","code":""},{"path":"/news/index.html","id":"changed-0-6-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.6.0 (released 2022-07-13)","text":"Update ignore files respect new features (@pbchase) Replace reference stp rcc.billing (@ChemiKyle) Enlarge job_summary_data field rcc_job_log (@pbchase) Add new content custom_rscript (@pbchase) Make docs study-centric (@pbchase) Update DESCRIPTION init_etl.Rd satisfy R 4.2.1 (@pbchase) Use *_PORT_DB connect_to_db, defaulting 3306 (@ChemiKyle) Move credentials DB (@pbchase) Reduce earliest_date cleanup_bad_email_addresses.R (@pbchase) Use MariaDB default driver init_etl (@pbchase) Update username my_username avoid tautological filter credential gathering (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-5-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.5.1 (released 2022-06-24)","text":"Export email-fixing functions (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-5-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.5.0 (released 2022-06-23)","text":"Add first version demonstration script (@pbchase) Add sync_table (@ChemiKyle) Add dataset_diff (@pbchase) Add multi_instance.R (@ChemiKyle) Add sync_metadata using credentials (@ChemiKyle) Add scrape_user_api_tokens (@ChemiKyle) Add set_super_api_token (@ChemiKyle) Add set_project_api_token (@ChemiKyle) Add ETL job logging(@mbentz-uf) Add cleanup_bad_email_addresses (@ljwoodley)","code":""},{"path":"/news/index.html","id":"changed-0-5-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.5.0 (released 2022-06-23)","text":"Ignore site_template build (@pbchase) Ignore ./output/ (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-4-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.4.1 (released 2022-03-04)","text":"Fix build.sh deployment bugs (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-4-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.4.0 (released 2022-03-03)","text":"Remove host image concet deploy site project (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-3-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.3.0 (released 2022-03-03)","text":"Add mRpostman writexl Dockerfile (@pbchase) Add suspend_users_with_no_primary_email (@ljwoodley) Add update_redcap_email_addresses (@ljwoodley)","code":""},{"path":"/news/index.html","id":"changed-0-3-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.3.0 (released 2022-03-03)","text":"Fix get_redcap_email_revisions match initial implementation allows create data result user suspension (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-2-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.2.0 (released 2022-02-16)","text":"Add get_redcap_email_revisions (@mbentz-uf) Add automated tests (@mbentz-uf) Add create_test_tables (@ChemiKyle) Add test tables (@ChemiKyle) Add get_bad_emails_from_listserv_digest (@pbchase) Add get_institutional_person_data (@pbchase) Add get_redcap_emails (@pbchase) Add create_test_table (@pbchase) Add site concept docs (@pbchase) Add add_get_redcap_db_connection (@pbchase) Store rc_conn env (@pbchase) Add add_connect_to_redcap_db (@pbchase) Add basic logging (@mbentz-uf)","code":""},{"path":[]},{"path":"/news/index.html","id":"summary-0-1-0","dir":"Changelog","previous_headings":"","what":"Summary","title":"redcapcustodian 0.1.0 (released 2021-06-22)","text":"Initial commit redcapcustodian Scripted image building. Scripted deployment. redcapcustodian R package testthat redcapcustodian tests Host-specific customization R scripts Host-specific customization cron-files Host-specific customization environment files","code":""}]
+[{"path":"/articles/credential-scraping.html","id":"api-token-scraping-and-fabricating","dir":"Articles","previous_headings":"","what":"API Token Scraping and Fabricating","title":"Credential Scraping","text":"Using credential management tools requires .env files populated database credentials REDCap instance, following examples use one production instance (prod.env) one local instance (local_1134.env). local_1134.env file:","code":"INSTANCE=local_1134 TIME_ZONE=America/New_York # REDCap API endpoint, REDCap webroot + \"/api/\" URI=https://localhost:11134/api/ # REDCap DB Credentials REDCAP_DB_NAME=redcap REDCAP_DB_HOST=127.0.0.1 REDCAP_DB_USER=redcap REDCAP_DB_PASSWORD=redcap123 REDCAP_DB_PORT=3306"},{"path":"/articles/credential-scraping.html","id":"preparation","dir":"Articles","previous_headings":"API Token Scraping and Fabricating","what":"Preparation","title":"Credential Scraping","text":"following block creates credentials directory sqlite database store credentials.","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) # fetching all extant API tokens and adding them to storage ################# dir.create(\"credentials\") # creates file if one does not exist file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") # SQLite friendly schema credentials_sql <- \"CREATE TABLE IF NOT EXISTS `credentials` ( `redcap_uri` TEXT NOT NULL, `server_short_name` varchar(128) NOT NULL, `username` varchar(191) NOT NULL, `project_id` int(10) NOT NULL, `project_display_name` TEXT NOT NULL, `project_short_name` varchar(128) DEFAULT NULL, `token` varchar(64) NOT NULL, `comment` varchar(256) DEFAULT NULL ); \" dbExecute(file_conn, credentials_sql) dbDisconnect(file_conn)"},{"path":"/articles/credential-scraping.html","id":"scraping-a-servers-api-tokens-and-putting-them-in-a-local-sqlite-db-for-use","dir":"Articles","previous_headings":"API Token Scraping and Fabricating","what":"Scraping a server’s API tokens and putting them in a local sqlite DB for use","title":"Credential Scraping","text":"Fetching extant API tokens adding storage","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) # fetching all extant API tokens and adding them to storage ################# file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") dbExecute(file_conn, credentials_sql) load_dot_env(\"prod.env\") username <- \"your_redcap_username\" source_conn <- connect_to_redcap_db() source_credentials <- scrape_user_api_tokens(source_conn, username) # alter credentials to match local schema source_credentials_upload <- source_credentials %>% mutate( redcap_uri = Sys.getenv(\"URI\"), server_short_name = tolower(Sys.getenv(\"INSTANCE\")) ) %>% # remove duplicates anti_join( tbl(file_conn, \"credentials\") %>% collect() ) dbAppendTable(file_conn, \"credentials\", source_credentials_upload) dbDisconnect(file_conn) dbDisconnect(source_conn)"},{"path":"/articles/credential-scraping.html","id":"creating-api-tokens-for-all-local-projects","dir":"Articles","previous_headings":"API Token Scraping and Fabricating","what":"Creating API tokens for all local projects","title":"Credential Scraping","text":"","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") load_dot_env(\"local_1134.env\") # note, this will close any other connections target_conn <- connect_to_redcap_db() local_credentials <- scrape_user_api_tokens(target_conn, \"admin\") # specify a subset of project_ids rather than making tokens for all target_pids <- tbl(target_conn, \"redcap_projects\") %>% select(project_id) %>% filter(project_id > 15) %>% filter(!project_id %in% local(local_credentials$project_id)) %>% collect() %>% pull(project_id) # create tokens individually for(pid in target_pids) { set_project_api_token(target_conn, \"admin\", pid) } # gather newly created tokens and insert them into local storage local_credentials <- scrape_user_api_tokens(target_conn, \"admin\") local_credentials_upload <- local_credentials %>% mutate( redcap_uri = Sys.getenv(\"URI\"), server_short_name = tolower(Sys.getenv(\"INSTANCE\")) ) %>% # remove duplicates anti_join( tbl(file_conn, \"credentials\") %>% collect() ) dbAppendTable(file_conn, \"credentials\", local_credentials_upload) dbDisconnect(file_conn) dbDisconnect(target_conn)"},{"path":"/articles/credential-scraping.html","id":"syncing-a-production-project-to-your-local-instance","dir":"Articles","previous_headings":"","what":"Syncing a production project to your local instance","title":"Credential Scraping","text":"completing previous 2 sections. following chink uses credentials saved copy project metadata source project ()","code":"library(redcapcustodian) library(tidyverse) file_conn <- DBI::dbConnect(RSQLite::SQLite(), \"credentials/credentials.db\") source_username <- \"your_production_username\" source_credentials <- tbl(file_conn, \"credentials\") %>% filter(source_username) %>% filter(server_short_name == \"prod\") %>% collect() %>% filter( str_detect(project_display_name, \"The big important project\") ) %>% unnest() local_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == \"admin\") %>% filter(server_short_name == \"local_1134\") %>% collect() %>% # adjust url to make REDCapR's validation processes happy mutate(redcap_uri = str_replace(redcap_uri, \"https\", \"http\")) %>% mutate(redcap_uri = str_replace(redcap_uri, \"localhost\", \"127.0.0.1\")) %>% filter( str_detect(project_display_name, \"The big important project\") ) %>% unnest() sync_metadata(source_credentials, local_credentials, strip_action_tags = TRUE) dbDisconnect(file_conn)"},{"path":"/articles/credential-scraping.html","id":"large-data-dictionaries-and-xdebugredcap-docker-compose","dir":"Articles","previous_headings":"Syncing a production project to your local instance","what":"Large data dictionaries and XDebug/REDCap Docker Compose","title":"Credential Scraping","text":"REDCap instance hosted machine (docker container) using xdebug, metadata may large, case ’ll see error message like : Alter following file <-rdc-instance>/redcap-overrides/web/php/80-xdebug.ini set arbitrarily large stack frame limit, least equal number fields data dictionary","code":"The REDCapR write/import metadata operation was not successful. The error message was:\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t
REDCap crashed due to an unexpected PHP fatal error!<\/b> \\n\\t\\t\\t\\t\\tError message:<\/b> Uncaught Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in /var/www/html/redcap_v11.3.4/Classes/LogicParser.php:280\\ # solution: https://stackoverflow.com/a/65997576/7418735 xdebug.max_nesting_level="},{"path":"/articles/custom_rscript.html","id":"writing-your-own-redcapcustodian-rscripts","dir":"Articles","previous_headings":"","what":"Writing your own redcapcustodian Rscripts","title":"Custom Rscript","text":"basic use, redcapcustodian need load library Rscript. automate report ETL already redcapcustodian, need build image, write configuration file instantiate container image config file. Yet allows extensive customization builds upon framework provides.","code":""},{"path":"/articles/custom_rscript.html","id":"writing-your-own-rscripts","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Writing your own Rscripts","title":"Custom Rscript","text":"can write Rscript accomplish task one REDCap hosts projects. script load redcapcustodian package. make script clone redcap custodian repository, copy contents study_template new folder Rename Rstudio project match study’s name: can open new project Rstudio. first redcapcustodian project, might help follow example vignette(\"friday-call-demo\") RStudio. example created present REDCap Custodian REDCap community. first REDCap Custodian rodeo, might remember need , offer guide help avoid mis-steps.","code":"git clone git@github.com:ctsit/redcapcustodian.git cp -r redcapcustodian/site_template my.study cd ../my.study mv example.Rproj my.study.Rproj open my.study.Rproj"},{"path":"/articles/custom_rscript.html","id":"configure-your-interfaces","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Configure your interfaces","title":"Custom Rscript","text":"’ll need talk least REDCap MySQL database. probably want . Rename example.env testing.env configure development computer. file composed five sections. INSTANCE names REDCap system instance ’ll talking . file assumes talking one REDCap script. tools multiple-instances. TIME_ZONE local timezone REDCap instance. Note REDCap time facts local time. MariaDB driver Lubridate library default UTC. can get complicated. careful time. details see stupid_date_tricks.R Many scripts need send emails developers, REDCap Admin study coordinator. Set email values appropriately site study needs. need talk directly REDCap database, ’ll need provide credentials database. development work, enter credentials local MySQL Database. task study working might need database tables. might hold data need REDCap data fit well REDCap data model. REDCap projects large (think 30K records ) might want mirror REDCap project MySQL run performant queries. describes need, best mix tables REDCap tables. second MySQL table credentials scripts need access secrets. “ETL” prefix nothing special, means “Extract, Transform, Load”–common term database management. can use prefix like, want use prefix. database connection functions depend . REDCap Custodian provides rich framework logging success failure automated processes. default, logs activity MySQL databse choosing. REDCap database. ’s completely reasonable log study’s activity study database, don’t study database, shared logging database good thing. Make sure set LOG_DB_ values.","code":"INSTANCE=Development TIME_ZONE=America/New_York # Email config EMAIL_TO=you@example.org EMAIL_CC= EMAIL_FROM=please-do-not-reply@example.org SMTP_SERVER=smtp.example.org # REDCap DB Credentials REDCAP_DB_NAME=DB_NAME REDCAP_DB_HOST=DB_HOST REDCAP_DB_USER=DB_USER REDCAP_DB_PASSWORD=DB_PASSWORD REDCAP_DB_PORT=3306 # ETL DB Credentials ETL_DB_NAME= ETL_DB_HOST= ETL_DB_USER= ETL_DB_PASSWORD= ETL_DB_SCHEMA= ETL_DB_PORT= # Log DB Credentials LOG_DB_NAME= LOG_DB_HOST= LOG_DB_USER= LOG_DB_PASSWORD= LOG_DB_SCHEMA= LOG_DB_PORT="},{"path":"/articles/custom_rscript.html","id":"redcap-api-credential-management","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"REDCap API credential management","title":"Custom Rscript","text":"’s possible credential management environment variables, quickly gets tedious. get’s tedious manage multiple API tokens. address , REDCap custodian provides credential management functions help make use local dataset REDCAp API credentials. See vignette(\"credential-scraping\") example . Read Scraping server’s API tokens putting local sqlite DB","code":""},{"path":"/articles/custom_rscript.html","id":"create-your-scripts-in-the-right-folder","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Create your scripts in the right folder","title":"Custom Rscript","text":"Create scripts move clean data etl folder. Create reports reports folder. aren’t rules, useful conventions. excluded package build process make package code folders won’t cause warnings build.","code":""},{"path":"/articles/custom_rscript.html","id":"tiny-script-example","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Tiny script example","title":"Custom Rscript","text":"REDCap custodian includes example report script describe REDCap users REDCap User Lifecycle. provides example report run REDCap system. also example report output University Florida CTSI REDCap system annotations explain tells history activity UF system.","code":""},{"path":"/articles/custom_rscript.html","id":"logging","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Logging","title":"Custom Rscript","text":"REDCap Custodian provides valuable logging reduce stress running unattended jobs writing data important things. use logging need create MySQL/Maria DB, put credentials environment file described , load redcapcustodian package script, initialize logging. can also log success end script log warnings failure script can detect . ’s actual script makes changes redcap backend logs : script generated log record log database: job_summary_data JSON object data updated. ’s hard humans read 100% machine parsable. query job log, use favorite DB client. Tidyverse developer, dplyr::tbl() fantastic DB client.","code":"library(tidyverse) library(redcapcustodian) library(rcc.billing) library(DBI) library(dotenv) init_etl(\"update_project_billable_attribute\") conn <- connect_to_redcap_db() diff_output <- update_billable_by_ownership(conn) sync_activity <- redcapcustodian::sync_table( conn = conn, table_name = \"redcap_entity_project_ownership\", primary_key = \"id\", data_diff_output = diff_output, insert = F, update = T, delete = F ) activity_log <- diff_output$update_records %>% select(pid, billable, updated) log_job_success(jsonlite::toJSON(activity_log)) dbDisconnect(conn) INSERT INTO `rcc_job_log` (`job_duration`, `job_summary_data`, `level`, `log_date`, `script_name`, `script_run_time`) VALUES (80.16091799736023, '[{\\\"pid\\\":15,\\\"billable\\\":1,\\\"updated\\\":1657139254},{\\\"pid\\\":16,\\\"billable\\\":1,\\\"updated\\\":1657139254},{\\\"pid\\\":22,\\\"billable\\\":1,\\\"updated\\\":1657139254}]', 'SUCCESS', '2022-07-06 20:28:54.494426', 'update_project_billable_attribute', '2022-07-06 20:27:34.322926');"},{"path":"/articles/custom_rscript.html","id":"writing-good-data-management-code","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Writing good data management code","title":"Custom Rscript","text":"big topic cover central entire effort can’t entirely ignored. best favor can customers, use good tools. CTS-, identified toolset allows us efficient programming. strongly recommend tools: R 99% data programming. RStudio easiest possible integrated development environment R programming. Tidyverse effective dialect R code . REDCapR 99% REDCap API access. DBI dplyr::tbl() access SQL tables. ’s also wise good software development workflow. CTS-use tools rules: Use version control code. one developer, code review everything. one developer, use Github workflow pull requests, review, merges manage code review. Never put secrets code. Put secrets environment variables, datasets, systems. Never put secrets version control. Don’t put configuration code. Instead put environment variables datasets. Stop think architecture study lifecycle. Don’t mix two studies one git repository. Don’t afraid make R package just one study. Think names things. Pick good names. Don’t afraid rename poorly named things.","code":""},{"path":"/articles/custom_rscript.html","id":"automation-with-container-infrastructure","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Automation with container infrastructure","title":"Custom Rscript","text":"need something run periodically, need make easy run dependencies packaged need schedule . modern way package dependencies put container, add application run container. REDCap Custodian supports containerization Docker. ./study_template/Dockerfile template can use containerize RScript RMarkdown. Adapt needs build container ./build.sh. good container infrastructure, use build deploy containers. Running automated R Markdown reports docker requires use Rmd renderer. render_report.R contains functionality knit Rmd Qmd, email log job run. Rmd/Qmd script name passed command line argument render_report.R via cron. Refer sample_report example cron job.","code":""},{"path":"/articles/custom_rscript.html","id":"automation-with-linux-and-cron","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Automation with Linux and cron","title":"Custom Rscript","text":"container management infrastructure available , support provides Linux hosts, build one , install Docker , give sudo su access. allow build run docker images host. Login, git clone redcapcustodian’s git repository, cd repository build image: study repository: clone private repository, ’ll need deployment key. See Deploy Keys instructions. ’ve built study container Docker host, create cron entry run right parameters secrets. run script, etl/update_project_billable_attribute.R regularly host call ‘prod’, create cron entry : build script -d option automatically deploy cron file build time. place cron file ./cron/ folder root repository, build ./build.sh -d, build script copy file /etc/cron.d give guaranteed unique name.","code":"git clone git@github.com:ctsit/redcapcustodian.git cd redcapcustodian sudo ./build.sh git clone git@github.com:ctsit/rcc.billing.git cd rcc.billing sudo ./build.sh sudo su cat <> prod/cron/update_project_billable_attribute # run update_project_billable_attribute at 6:07 a.m. 7 6 * * * root /usr/bin/docker run --rm --env-file /rcc/rcc.billing/prod.env rcc.billing Rscript rcc.billing/etl/update_project_billable_attribute.R END"},{"path":"/articles/custom_rscript.html","id":"using-version-control","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Using version control","title":"Custom Rscript","text":"go road writing scripts, concerned preserving . One best ways via git version control. Initialize new software repository ./.study folder. add remote pointing new empty repository GitHub, GitLab, BitBucket favorite Git repository hosting service, push new repo.","code":""},{"path":"/articles/custom_rscript.html","id":"adding-a-custom-package","dir":"Articles","previous_headings":"Writing your own redcapcustodian Rscripts","what":"Adding a custom package","title":"Custom Rscript","text":"want complex things redcapcustodian Rscripts share custom code , might want add R package just redcapcustodian work. redcapcustodian supports development package within ./.study/ folder. RStudio team’s packaging guidelines excellent guide package development. might seem like lot take , solve common problems. help write better code. don’t need submit package CRAN get value packaging guidelines. build latest version package build task container, uncomment lines task’s Dockerfile customize package name:","code":"# Add, build, and install this study's package ADD .. /home/rocker/my.study RUN R CMD build my.study RUN R CMD INSTALL my.study*.tar.gz RUN rm -rf my.study"},{"path":"/articles/delete-erroneous-survey-reminders.html","id":"activation","dir":"Articles","previous_headings":"","what":"Activation","title":"Deleting Erroneous Survey Reminders","text":"want use system, follow instructions REDCap Custodian make new R Project study_template don’t already project. revise cron/delete_erroneous_survey_reminders uncommenting cron line adjusting frequency needs. build deploy R Project.","code":""},{"path":"/articles/developer_notes.html","id":"release-and-deployment","dir":"Articles","previous_headings":"","what":"Release and Deployment","title":"Developer Notes for REDCap Custodian","text":"project uses Git Flow workflow releases. Every release versioned ChangeLog entry describes new features bug fixes. Every release also accompanied updated VERSION manual revision version number DESCRIPTION. latter tells devtools version number changes. former allows image builds tagged built build.sh deploy new release Linux host, execute series commands equivalent home directory host:","code":"git clone git@github.com:ctsit/redcapcustodian.git cd redcapcustodian git pull sudo ./build.sh"},{"path":"/articles/developer_notes.html","id":"local-logging-for-development-work","dir":"Articles","previous_headings":"","what":"Local logging for development work","title":"Developer Notes for REDCap Custodian","text":"development work, ’s useful local log database. allows initialize logging test scripts without throwing error even test write log success failure. REDCap Custodian provides example logging system form docker-compose.yml database schema ./rcc.log.db/. can start logging database commands: default, PHPMyAdmin interface accessible http://localhost:9080/. configuration parameters defined ./rcc.log.db/.env. parameters used ./study_template/example.env. Using example values local environment files allow scripts across redcap custodian projects allow share logging database. =======","code":"cd ./rcc.log.db/ docker-compose up -d"},{"path":"/articles/friday-call-demo-setup.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"setup instructions demonstration features REDCap Custodian R package. setup steps, demonstrate : Create local credentials database Fetch store API tokens credentials database Create load fake data REDCap projects want test . prelude demonstration moving data REDCap projects described vignette(\"friday-call-demo\").","code":""},{"path":"/articles/friday-call-demo-setup.html","id":"prequisites","dir":"Articles","previous_headings":"","what":"Prequisites","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"want , recommend things setup development testing environment: Install R, Rstudio, tidyverse packages Install redcapcustodian github Clone redcap-docker-compose git repo Create local REDCap redcap-docker-compose Create new project Rstudio. Note R project, REDCap project, Copy local.env.txt .env root new project folder. also need REDCap projects play . , ’s great. demo, need two REDCap projects exist. Please make projects XML files: main biospecimen. Name project main.xml: “Demo Main” Name project biospecimen.xml: “Demo Biospecimen” talk projects code, ’ll need API tokens. Add main biospecimen projects. project want play . changes place, can start developing scripts use REDCap Custodian.","code":""},{"path":"/articles/friday-call-demo-setup.html","id":"fetch-and-store-api-tokens","dir":"Articles","previous_headings":"","what":"Fetch and store API Tokens","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"First, load R packages: , make database hold credentials: Now, fetch API tokens write local credentials DB.","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) library(lubridate) dir.create(here::here(\"credentials\")) # creates file if one does not exist file_conn <- DBI::dbConnect(RSQLite::SQLite(), here::here(\"credentials/credentials.db\")) # SQLite friendly schema credentials_sql <- \"CREATE TABLE IF NOT EXISTS `credentials` ( `redcap_uri` TEXT NOT NULL, `server_short_name` varchar(128) NOT NULL, `username` varchar(191) NOT NULL, `project_id` int(10) NOT NULL, `project_display_name` TEXT NOT NULL, `project_short_name` varchar(128) DEFAULT NULL, `token` varchar(64) NOT NULL, `comment` varchar(256) DEFAULT NULL ); \" dbExecute(file_conn, credentials_sql) # fetching all extant API tokens and adding them to storage ################# load_dot_env(here::here(\"local.env.txt\")) my_username <- \"admin\" source_conn <- connect_to_redcap_db() scraped_credentials <- scrape_user_api_tokens(source_conn, my_username) # alter credentials to match local schema source_credentials_upload <- scraped_credentials %>% mutate( redcap_uri = Sys.getenv(\"URI\"), server_short_name = tolower(Sys.getenv(\"INSTANCE\")) ) %>% # remove duplicates anti_join( tbl(file_conn, \"credentials\") %>% collect() ) dbAppendTable(file_conn, \"credentials\", source_credentials_upload) DBI::dbDisconnect(source_conn)"},{"path":"/articles/friday-call-demo-setup.html","id":"make-test-data-and-write-it-to-your-test-projects","dir":"Articles","previous_headings":"","what":"Make test data and write it to your test projects","title":"REDCap Custodian Friday Call Demo Credentials Setup","text":"generate records main project port Biospecimen project. First, access credential database get credentials REDCap project want read . use Beasley’s REDCapR library interact REDCap via API. REDCapR allows specify forms, fields, event names, time frames interest. even allows REDCap filtering. isn’t necessary understand following block typically won’t populating project random data.","code":"source_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == my_username) %>% collect() %>% filter(str_detect(project_display_name, \"Demo Main\")) %>% unnest() # Disconnect when your done with the database dbDisconnect(file_conn) record_count_to_create <- 50 collection_events <- 5 tubes_per_collection <- 30 record_columns <- c( \"record_id\", \"redcap_event_name\", \"sample_collected_date\", \"tmp_event_id\", paste0(\"tube_id\", 1:tubes_per_collection), paste0(\"tube_specimen_type\", 1:tubes_per_collection), paste0(\"tube_volume\", 1:tubes_per_collection) ) # create empty dataframe and set column names simulated_data <- data.frame( matrix(ncol = length(record_columns), nrow = 0) ) %>% mutate(across(everything(), as.character)) colnames(simulated_data) <- record_columns # create base entries for each event # NOTE: may be a bit slow as for-loops are not generally used in R for (record_id in 1:record_count_to_create) { for (event_id in 1:collection_events) { simulated_data <- simulated_data %>% add_row( record_id = as.character(record_id), redcap_event_name = paste0(\"event_\", event_id, \"_arm_1\"), tmp_event_id = as.character(event_id), # used to generate tube IDs later sample_collected_date = sample( seq(ymd(\"2020-03-01\"), ymd(\"2022-06-01\"), by = \"day\"), size = 1, replace = T ) %>% as.character() ) } } # group to ensure simulated data is consistent with a single collection event simulated_data <- simulated_data %>% group_by(record_id, redcap_event_name) # simulate individual samples for (tube in 1:tubes_per_collection) { simulated_data <- simulated_data %>% mutate( \"tube_id{tube}\" := paste0( record_id, \"-\", str_pad(tmp_event_id, width = 2, side = \"left\", pad = \"0\"), \"-\", str_pad(tube, width = 2, side = \"left\", pad = \"0\") ), \"tube_specimen_type{tube}\" := sample(1:4, size = 1), \"tube_volume{tube}\" := sample(2:4, size = 1) ) } # remove temporary column used in simulation simulated_data <- simulated_data %>% ungroup() %>% select(-tmp_event_id) # upload data to REDCap REDCapR::redcap_write( redcap_uri = source_credentials$redcap_uri, token = source_credentials$token, ds_to_write = simulated_data )"},{"path":"/articles/friday-call-demo.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"REDCap Custodian Friday Call Demo","text":"demonstration features REDCap Custodian R package. demonstrate : Fetch store API tokens database Get data REDCap project Transform data Write another project Review logs job ’ll talk automate whole process.","code":""},{"path":"/articles/friday-call-demo.html","id":"prequisites","dir":"Articles","previous_headings":"","what":"Prequisites","title":"REDCap Custodian Friday Call Demo","text":"Follow steps run code provided vignette(\"friday-call-demo-setup\").","code":""},{"path":"/articles/friday-call-demo.html","id":"premise","dir":"Articles","previous_headings":"","what":"Premise","title":"REDCap Custodian Friday Call Demo","text":"big important project many rows data many rows coming every week, researcher asks build biorepository project biospecimens collected protocol. want anyone transcribe existing data, automatically copy every day. transcription, typos, overtime.","code":""},{"path":"/articles/friday-call-demo.html","id":"get-some-data-from-a-redcap-project","dir":"Articles","previous_headings":"","what":"Get some data from a REDCap project","title":"REDCap Custodian Friday Call Demo","text":"First, load R packages: Next, connect credential database. read credentials REDCap project want read . point, ’s time read portions project data interest . task, want read identifiers collected data can write Biospecimen tracking project customer’s requirements biorepository require us transformations writing. ’s easy dplyr library Now write data target project","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(dotenv) library(lubridate) load_dot_env(here::here(\"local.env.txt\")) init_etl(\"friday_call_demo\") file_conn <- DBI::dbConnect(RSQLite::SQLite(), here::here(\"credentials/credentials.db\")) my_username <- \"admin\" source_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == my_username) %>% collect() %>% filter(str_detect(project_display_name, \"Demo Main\")) %>% unnest() record_count_to_create <- 50 collection_events <- 5 tubes_per_collection <- 30 fields_to_read <- c( \"record_id\", \"redcap_event_name\", \"sample_collected_date\", paste0(\"tube_id\", 1:tubes_per_collection), paste0(\"tube_specimen_type\", 1:tubes_per_collection), paste0(\"tube_volume\", 1:tubes_per_collection) ) source_project_data <- REDCapR::redcap_read( redcap_uri = source_credentials$redcap_uri, token = source_credentials$token, fields = fields_to_read ) # Validate that data was retrieved and alert regarding issues if (!source_project_data$success) { warning(\"Data was not successfully read from REDCap\") } # Append the event number to the subject_id to make the record_id needed in the biorepository new_target_project_data <- source_project_data$data %>% rename(subject_id = record_id) %>% mutate(record_id = paste0( subject_id, \"-\", str_replace(redcap_event_name, \"event_\", \"\") %>% str_replace(., \"_arm_1\", \"\"))) %>% select(record_id, everything()) %>% rename(date_draw = sample_collected_date) target_credentials <- tbl(file_conn, \"credentials\") %>% filter(username == my_username) %>% collect() %>% filter(str_detect(project_display_name, \"Demo Biospecimen\")) %>% unnest() # Want to know exactly what is getting updated in the target project? Fetch that data then anti-join with the new data set target_fields_to_read <- c( \"record_id\", \"redcap_event_name\", \"sample_collected_date\" ) old_target_project_data <- REDCapR::redcap_read( redcap_uri = target_credentials$redcap_uri, token = target_credentials$token, fields = target_fields_to_read ) if (old_target_project_data$success) { target_project_data <- new_target_project_data %>% dplyr::anti_join(old_target_project_data$data) } else { target_project_data <- new_target_project_data } # now write that small dataset result <- REDCapR::redcap_write( ds_to_write = slice_head(target_project_data, prop=0.5), redcap_uri = target_credentials$redcap_uri, token = target_credentials$token ) # now log what we did if (result$success) { log_job_success(jsonlite::toJSON(target_project_data)) } else { log_job_failure(jsonlite::toJSON(result)) }"},{"path":"/articles/friday-call-demo.html","id":"review-the-logs-of-what-the-job-did","dir":"Articles","previous_headings":"","what":"Review the logs of what the job did","title":"REDCap Custodian Friday Call Demo","text":"automated jobs, ’s important record happened. REDCap Custodian writes logs can review actions later.","code":"# Get the connection to the log database log_con <- get_package_scope_var(\"log_con\") # Look at the entire log of jobs run tbl(log_con, \"rcc_job_log\") %>% collect() %>% view() # Read the summary of the last 'friday_call_demo' job tbl(log_con, \"rcc_job_log\") %>% filter(script_name == \"friday_call_demo\") %>% collect() %>% arrange(desc(log_date)) %>% head(n=1) %>% pull(job_summary_data) %>% jsonlite::fromJSON() %>% view()"},{"path":"/articles/job_logging.html","id":"behind-the-scenes","dir":"Articles","previous_headings":"","what":"Behind the scenes","title":"Job Logging","text":"’s tiny script, lot happening. Let’s decode ’s going lines.","code":""},{"path":"/articles/job_logging.html","id":"librarydotenv","dir":"Articles","previous_headings":"Behind the scenes","what":"library(dotenv)","title":"Job Logging","text":"REDCap Custodian uses dotenv package read files name-value pairs environment script. default reads .env current directory. make logging work correctly, .env file need stanza like : “LOG_DB_*” strings environment variable names redcapcustodian uses locate MySQL DB stores logging data. need use names values need point MySQL table MySQL server.","code":"LOG_DB_NAME=rcc_log LOG_DB_HOST=127.0.0.1 LOG_DB_USER=rcc_log LOG_DB_PASSWORD=password LOG_DB_PORT=9000"},{"path":"/articles/job_logging.html","id":"init_etl","dir":"Articles","previous_headings":"Behind the scenes","what":"init_etl()","title":"Job Logging","text":"init_etl(\"my_useful_script\") sets script_name env variable “my_useful_script”, sets script_run_time env variable current date time, verifies connection database described “LOG_DB_*” environment variables. database , init_etl() quietly exits. database see","code":"Warning: Failed to connect to log DB: rcc_log_bad The reason given was: Error: Failed to connect: Access denied for user 'rcc_log'@'%' to database 'rcc_log_bad'"},{"path":"/articles/job_logging.html","id":"log_job_success","dir":"Articles","previous_headings":"Behind the scenes","what":"log_job_success()","title":"Job Logging","text":"log_job_success(\"worked!\") writes row logging database like example .","code":""},{"path":"/articles/job_logging.html","id":"failed-jobs","dir":"Articles","previous_headings":"","what":"Failed jobs","title":"Job Logging","text":"jobs fail, might want log condition, , call log_job_failure(). log_job_success(), can provide message give detail went wrong.","code":"log_job_failure(\"input dataframe was empty\")"},{"path":"/articles/job_logging.html","id":"more-detailed-messages","dir":"Articles","previous_headings":"","what":"More detailed messages","title":"Job Logging","text":"Logging “worked!” “input dataframe empty” fine, often, want provide detail job’s activities. Chances useful facts R objects already. simple matter assemble objects list, convert list object text string using JSON libraries, use string job’s message. wanted report updates made ‘iris’ database, might log like : summary value can contain number JSON-encoded objects. said, plan carefully. Ask questions want answer later job run. package authors found common questions posed “value change?”, “() set value?”, “change?” Store little information needed answer questions succinctly. provide lots different objects, might make pile log data sift later. ’ve found can usually meet needs including minimal dataframes data written job. multiple jobs writing dataset, consider value self-consistency across jobs. every update operation invoice table logged object named invoice_updates, can easily search across jobs.","code":"init_etl(\"iris_updater\") # Do some stuff # ... iris_updates <- iris |> dplyr::sample_n(3) |> select(Sepal.Length, Species) # ... # success! log_message <- dplyr::lst(iris_updates) log_job_success(jsonlite::toJSON(log_message))"},{"path":"/articles/job_logging.html","id":"reading-back-log-data","dir":"Articles","previous_headings":"","what":"Reading back log data","title":"Job Logging","text":"Reading back log data presents challenges. answering “? ? ? ?” questions often search across multiple log events find job run made change. can filter log data time frame jobs interest, still search multiple job summaries find one made change care . encoded job summary data JSON, ’ll need decode , jsonlite::fromJSON vectorized. ’ll iterate log records. Also, ’ll want unnest job summary objects returned jsonlite::fromJSON. REDCap Custodian provides function unnest_job_summary_data_json_object() help operations. e.g., output unnest_job_summary_data_json_object, unnested, look like:","code":"log_conn <- get_package_scope_var(\"log_con\") log_data <- dplyr::tbl(log_conn, \"rcc_job_log\") |> dplyr::filter(script_name == \"iris_updater\") |> dplyr::collect() |> dplyr::slice_tail(n = 3) unnest_job_summary_data_json_object(log_data) |> unnest(cols = \"iris_updates\") |> kbl() |> kable_styling()"},{"path":"/articles/randomization-management.html","id":"moving-a-production-project-with-allocated-randomization-records","dir":"Articles","previous_headings":"","what":"Moving a Production project with allocated randomization records","title":"Randomization Management","text":"tools created allow production project randomization turned moved another REDCap project. REDCap doesn’t allow , work done backend database reads write. tables involved REDCap project IDs, randomization IDs, eventIDs, allocations IDs embedded, work requires multiple transformations writing randomization configuration target project. example use randomization management functions copy allocated randomizations shown . script functions calls designed fit workflow:","code":"library(redcapcustodian) library(DBI) library(tidyverse) library(lubridate) library(dotenv) init_etl(\"copy_allocated_randomization\") source_conn <- connect_to_redcap_db() # specify a second database connection if the target project is on another host target_conn <- source_conn source_project_id <- 18 target_project_id <- 25 # get and print importable allocations if we need them for reference allocations <- export_allocation_tables_from_project( conn = source_conn, project_id_to_export = source_project_id ) target_directory = \"output\" if (!fs::dir_exists(here::here(target_directory))) { fs::dir_create(here::here(target_directory)) } walk(c(0,1), write_allocations, allocations, target_directory) # Configure randomization on the target project target_project_randomization_state <- create_randomization_row( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) target_project_allocation_state <- create_allocation_rows( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) # Update randomization on the target project target_project_allocation_update <- update_production_allocation_state( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_rid = target_project_randomization_state$rid ) # Enable randomization on the target enable_randomization_on_a_preconfigured_project_in_production( target_conn = target_conn, target_project_id = target_project_id ) DBI::dbDisconnect(source_conn)"},{"path":"/articles/randomization-management.html","id":"preparation","dir":"Articles","previous_headings":"Moving a Production project with allocated randomization records","what":"Preparation","title":"Randomization Management","text":"Start production project randomization turned configured, data entered records randomized. source project. Note project ID. Copy/clone source project. Either use Copy Project button REDCap Project Setup, XML export import. new project target project. Note project ID. Turn randomization target project copy/cloning process turned . probably seems strange, ’s needed allow data import randomization field trick REDCap moving project production data “randomization” field assignments allocation table. reconfiguration work needed target project. able move fields forms events needed. said, change names stratification randomization fields. Copy script set values source target project ids. Run copy_allocated_randomization.R script. mirror randomization configuration source project target project. cloned project Copy Project button, script complain configuration data exists. fine. Regardless cloned project, script complain met requirements turn randomization. supposed see warning point.","code":""},{"path":"/articles/randomization-management.html","id":"activation","dir":"Articles","previous_headings":"Moving a Production project with allocated randomization records","what":"Activation","title":"Randomization Management","text":"Take source project offline. changes occurred data source project since cloned , re-export data source project import target project. Immediately move target project production. Immediately re-run copy_allocated_randomization.R script. turn randomization target project. Revoke access source project. done.","code":""},{"path":"/articles/randomization-management.html","id":"limitations","dir":"Articles","previous_headings":"","what":"Limitations","title":"Randomization Management","text":"randomization management tools support DAG group_ids randomization variables. , don’t needed project inspired tools. try use project uses DAGs randomization configuration. tools support changing randomization configuration. might form good foundation , support .","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Philip Chase. Author, maintainer. Laurence James-Woodley. Author. Kyle Chesney. Author. Taryn Stoffs. Contributor. Michael Bentz. Author. Christopher Barnes. Contributor.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Chase P, James-Woodley L, Chesney K, Bentz M (2024). redcapcustodian: Data automation R-centric workflows nod towards REDCap. R package version 1.20.0, https://github.com/ctsit/redcapcustodian/, https://project-redcap.org, https://ctsit.github.io/redcapcustodian/.","code":"@Manual{, title = {redcapcustodian: Data automation for R-centric workflows with a nod towards REDCap}, author = {Philip Chase and Laurence James-Woodley and Kyle Chesney and Michael Bentz}, year = {2024}, note = {R package version 1.20.0, https://github.com/ctsit/redcapcustodian/, https://project-redcap.org}, url = {https://ctsit.github.io/redcapcustodian/}, }"},{"path":"/index.html","id":"redcap-custodian","dir":"","previous_headings":"","what":"Data automation for R-centric workflows with a nod towards REDCap","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"package simplifies data management activities REDCap systems. provides framework automating data extraction, transformation, loading (ETL) work. supports ETL work within REDCap, REDCap projects, REDCap systems, REDCap database. provides extensible set R functions, Docker image, RStudio Project template upon REDCap team can build ETL tasks serve REDCap systems customers.","code":""},{"path":"/index.html","id":"operating-environment","dir":"","previous_headings":"","what":"Operating environment","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"redcapcustodian R package can referenced R script needs ETL work REDCap data target. facilitate automation, repository also provides Dockerfile provides R, redcapcustodian package, required packages. Dockerfile build.sh can used build Docker image named redcapcustodian can serve foundation containers serve specific tasks. build upon foundation, repository also provides folder, study_template can copied new folder used starting point RStudio project, R package, Docker image address needs single study data management project. tools designed simplify development reduce burden automating data reporting recurring data management tasks. automated environment, ETL job system Rscript run via Docker. report RMarkdown file run via Docker. design assumes Docker containers hosted Linux host API access one REDCap systems, mail server, MySQL database, , optionally, REDCap database . sites without container infrastructure, image can instantiated container via cron job documented files study_template/crons/. file folder runs single job. run job, cron script must copied /etc/cron.d/ folder Linux host. build.sh script builds redcapcustodian container upon containers built study template depend.","code":""},{"path":"/index.html","id":"how-to-use-this-project","dir":"","previous_headings":"","what":"How to use this project","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"repository provides three elements designed used together manage data single study data-management project. provides R package, redcapcustodian provides functions facilitate credential management, database connections, data comparison, data synchronization, logging. provides Dockerfile rolls-redcapcustodian package, dependencies several recommended R packages typically needed working REDCap. repository also provides study_template can used starting point repository Docker container house run study’s custom RScript, Rmarkdown, R package. REDCap Custodian package can used custom RScript simply installing loading package RStudio: use Docker container, ’ll need checkout repository git build Dockerfile. Mac Linux computer steps look like : procedure use study template involved, offers reward well. See Writing redcapcustodian Rscripts. might also help look Developer Notes","code":"install.packages(\"devtools\") devtools::install_github(\"ctsit/redcapcustodian\") library(redcapcustodian) git clone git@github.com:ctsit/redcapcustodian.git cd redcapcustodian ./build.sh"},{"path":"/index.html","id":"areas-of-redcap-interest","dir":"","previous_headings":"","what":"Areas of REDCap interest","title":"Data automation for R-centric workflows with a nod towards REDCap","text":"much REDCap Custodian repository package automating workflows, package includes tools specific REDCap. API token management, see Credential Scraping tools procedures moving production projects use randomization, See Randomization Management bulk rights expiration, see function expire_user_project_rights() get history projects REDCap system, see get_project_life_cycle(). runs speedy queries REDCap log event tables get events life cycle every project system. delete survey reminders persist survey completion, see Deleting Erroneous Survey Reminders","code":""},{"path":"/reference/build_etl_job_log_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"Builds formatted rcc_job_log data frame source data","code":""},{"path":"/reference/build_etl_job_log_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"","code":"build_etl_job_log_df(job_duration, job_summary, level)"},{"path":"/reference/build_etl_job_log_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"job_duration, job duration seconds job_summary, summary job performed level, log level (DEBUG, ERROR, INFO)","code":""},{"path":"/reference/build_etl_job_log_df.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"df_etl_log_job, df matching rcc_job_log table","code":""},{"path":"/reference/build_etl_job_log_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Builds formatted rcc_job_log data frame from source data — build_etl_job_log_df","text":"","code":"if (FALSE) { build_etl_job_log_df( job_duration, job_summary, level ) }"},{"path":"/reference/build_formatted_df_from_result.html","id":null,"dir":"Reference","previous_headings":"","what":"Builds formatted data frame from source data — build_formatted_df_from_result","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"Builds formatted data frame source data","code":""},{"path":"/reference/build_formatted_df_from_result.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"","code":"build_formatted_df_from_result( result, database_written, table_written, log_level, pk_col )"},{"path":"/reference/build_formatted_df_from_result.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"result, df log database_written, database etl wrote table_written, table etl wrote log_level, log level (DEBUG, ERROR, INFO) pk_col, dataframe col use primary_key","code":""},{"path":"/reference/build_formatted_df_from_result.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"df_etl_log, df matching etl_log table","code":""},{"path":"/reference/build_formatted_df_from_result.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Builds formatted data frame from source data — build_formatted_df_from_result","text":"","code":"if (FALSE) { build_formatted_df_from_result( result, database_written, table_written, log_level, pk_col ) }"},{"path":"/reference/connect_to_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to db — connect_to_db","title":"Connect to db — connect_to_db","text":"Connect db","code":""},{"path":"/reference/connect_to_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to db — connect_to_db","text":"","code":"connect_to_db(drv, prefix = \"\", continue_on_error = FALSE)"},{"path":"/reference/connect_to_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect to db — connect_to_db","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection). prefix, continue_on_error TRUE continue execution error, FALSE quit non interactive sessions error","code":""},{"path":"/reference/connect_to_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to db — connect_to_db","text":"S4 object. Run ?dbConnect information","code":""},{"path":"/reference/connect_to_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to db — connect_to_db","text":"","code":"if (FALSE) { # connect to db using [prefix]_DB_* environment variables con <- connect_to_db(drv = RMariaDB::MariaDB(), prefix = \"RCC\") # connect to sqlite db con <- connect_to_db(drv = RSQLite::SQLite()) }"},{"path":"/reference/connect_to_log_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to the log db — connect_to_log_db","title":"Connect to the log db — connect_to_log_db","text":"Connect log db","code":""},{"path":"/reference/connect_to_log_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to the log db — connect_to_log_db","text":"","code":"connect_to_log_db(drv, continue_on_error = FALSE)"},{"path":"/reference/connect_to_log_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect to the log db — connect_to_log_db","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection). continue_on_error TRUE continue execution error, FALSE quit non interactive sessions error","code":""},{"path":"/reference/connect_to_log_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to the log db — connect_to_log_db","text":"S4 object. Run ?dbConnect information","code":""},{"path":"/reference/connect_to_log_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to the log db — connect_to_log_db","text":"","code":"if (FALSE) { # connect to log db using LOG_DB_* environment variables con <- connect_to_log_db() # connect to sqlite log db con <- connect_to_log_db(drv = RSQLite::SQLite()) }"},{"path":"/reference/connect_to_redcap_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"Connect Primary REDCap MySQL Database Assigns package-scoped conn","code":""},{"path":"/reference/connect_to_redcap_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"","code":"connect_to_redcap_db()"},{"path":"/reference/connect_to_redcap_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"S4 object. Run ?dbConnect information","code":""},{"path":"/reference/connect_to_redcap_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to the Primary REDCap MySQL Database\nAssigns package-scoped conn — connect_to_redcap_db","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() }"},{"path":"/reference/convert_schema_to_sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"Converts MySQL schema file sqlite schema. Facilitates easier creation -memory (.e. sqlite) tables.","code":""},{"path":"/reference/convert_schema_to_sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"","code":"convert_schema_to_sqlite(schema_file_path)"},{"path":"/reference/convert_schema_to_sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"schema_file_path, path schema file convert","code":""},{"path":"/reference/convert_schema_to_sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"translated schema character string","code":""},{"path":"/reference/convert_schema_to_sqlite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Converts a MySQL schema file to a sqlite schema.\nFacilitates easier creation of in-memory (i.e. sqlite) tables. — convert_schema_to_sqlite","text":"","code":"if (FALSE) { mem_conn <- DBI::dbConnect(RSQLite::SQLite(), dbname = \":memory:\") translated_schema <- convert_schema_to_sqlite(\"~/documents/my_cool_schema.sql\") DBI::dbSendQuery(mem_conn, schema) }"},{"path":"/reference/copy_entire_table_to_db.html","id":null,"dir":"Reference","previous_headings":"","what":"copy_entire_table_to_db — copy_entire_table_to_db","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"Copy entire DBI table one DBI connection another. developer tool designed aid testing development. designed called via purrr::walk2() clone sets tables data-driven way ephemeral database created, generally Duck DB. Limitations table referenced table_name must exist target_conn. function suitable cloning small tables. called via purrr::walk2(), tables vector table names copied single target_conn DBI object even source table different source_conn DBI objects.","code":""},{"path":"/reference/copy_entire_table_to_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"","code":"copy_entire_table_to_db(source_conn, table_name, target_conn)"},{"path":"/reference/copy_entire_table_to_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"source_conn - DBI connection object holds source table table_name - name table copied target_conn - DBI connection object table copied","code":""},{"path":"/reference/copy_entire_table_to_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"result","code":""},{"path":"/reference/copy_entire_table_to_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"copy_entire_table_to_db — copy_entire_table_to_db","text":"","code":"# Build the objects need for testing test_data <- dplyr::tribble( ~a, ~b, ~c, ~d, \"asdf\", 1, TRUE, lubridate::ymd_hms(\"2023-01-14 12:34:56\"), \"qwer\", 2, FALSE, lubridate::ymd_hms(\"2016-01-14 12:34:56\") ) table_name <- \"test_data\" source_conn <- DBI::dbConnect(duckdb::duckdb(), dbdir = \":memory:\") DBI::dbWriteTable(conn = source_conn, name = table_name, value = test_data) # copy the table target_conn <- DBI::dbConnect(duckdb::duckdb(), dbdir = \":memory:\") copy_entire_table_to_db( source_conn = source_conn, table_name = table_name, target_conn = target_conn ) dplyr::collect(dplyr::tbl(target_conn, table_name)) #> # A tibble: 2 × 4 #> a b c d #> #> 1 asdf 1 TRUE 2023-01-14 12:34:56 #> 2 qwer 2 FALSE 2016-01-14 12:34:56 DBI::dbDisconnect(source_conn, shutdown = TRUE) DBI::dbDisconnect(target_conn, shutdown = TRUE) if (FALSE) { library(tidyverse) library(lubridate) library(dotenv) library(DBI) library(RMariaDB) library(redcapcustodian) init_etl(\"my_script_name\") rc_conn <- connect_to_redcap_db() log_conn <- get_package_scope_var(\"log_con\") # describe the tables you want to clone test_tables <- tribble( ~conn, ~table, rc_conn, \"redcap_user_information\", rc_conn, \"redcap_projects\", log_conn, \"redcap_summary_metrics\" ) # make the target DB and clone the tables target_conn <- DBI::dbConnect( duckdb::duckdb(), dbdir = \":memory:\" ) purrr::walk2( test_tables$conn, test_tables$table, copy_table_to_db, target_conn ) # Enumerate the tables you copied if you like DBI::dbListTables(target_conn) # replace original connection objects rc_conn <- target_conn log_conn <- target_conn # At this point you can do destructive things on the original # connection objects because they point at the ephemeral # copies of the tables. }"},{"path":"/reference/create_allocation_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"create_allocation_rows — create_allocation_rows","title":"create_allocation_rows — create_allocation_rows","text":"Create rows redcap_randomization_allocation table mirror another project.","code":""},{"path":"/reference/create_allocation_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create_allocation_rows — create_allocation_rows","text":"","code":"create_allocation_rows( source_conn, target_conn, source_project_id, target_project_id )"},{"path":"/reference/create_allocation_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create_allocation_rows — create_allocation_rows","text":"source_conn - DBI connection object pointing REDCap database houses source project. target_conn - DBI connection object pointing REDCap database houses target project. source_project_id - project ID REDCap project contains randomization cloned. target_project_id - project ID REDCap project receive mirrored randomization data.","code":""},{"path":"/reference/create_allocation_rows.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create_allocation_rows — create_allocation_rows","text":"- dataframe containing current allocation rows target project.","code":""},{"path":"/reference/create_allocation_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create_allocation_rows — create_allocation_rows","text":"","code":"if (FALSE) { target_project_allocation_state <- create_allocation_rows( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) }"},{"path":"/reference/create_randomization_row.html","id":null,"dir":"Reference","previous_headings":"","what":"create_randomization_row — create_randomization_row","title":"create_randomization_row — create_randomization_row","text":"Create single row redcap_randomization table mirrors another project.","code":""},{"path":"/reference/create_randomization_row.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create_randomization_row — create_randomization_row","text":"","code":"create_randomization_row( source_conn, target_conn, source_project_id, target_project_id )"},{"path":"/reference/create_randomization_row.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create_randomization_row — create_randomization_row","text":"source_conn - DBI connection object pointing REDCap database houses source project. target_conn - DBI connection object pointing REDCap database houses target project. source_project_id - project ID REDCap project contains randomization cloned. target_project_id - project ID REDCap project receive mirrored randomization data.","code":""},{"path":"/reference/create_randomization_row.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create_randomization_row — create_randomization_row","text":"- dataframe containing current randomization row target project.","code":""},{"path":"/reference/create_randomization_row.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"create_randomization_row — create_randomization_row","text":"","code":"if (FALSE) { target_project_randomization_state <- create_randomization_row( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_project_id = target_project_id ) }"},{"path":"/reference/create_test_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a test table from package schema and data files — create_test_table","title":"Create a test table from package schema and data files — create_test_table","text":"Creates tables files inst/testdata match patterns _schema.sql .csv","code":""},{"path":"/reference/create_test_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a test table from package schema and data files — create_test_table","text":"","code":"create_test_table(conn, table_name, data_file = NA_character_, empty = F)"},{"path":"/reference/create_test_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a test table from package schema and data files — create_test_table","text":"conn DBI Connection object table_name name table used testing data_file name file alternative contents `table_name` empty boolean request table created empty","code":""},{"path":"/reference/create_test_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a test table from package schema and data files — create_test_table","text":"NA","code":""},{"path":"/reference/create_test_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a test table from package schema and data files — create_test_table","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") create_test_table(conn, \"redcap_user_information\") }"},{"path":"/reference/create_test_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"wrapper around create_test_table create tables, specified subset ","code":""},{"path":"/reference/create_test_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"","code":"create_test_tables(conn, table_names = c())"},{"path":"/reference/create_test_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"conn DBI Connection object table_names character list names tables wish create, nothing provided, result get_test_table_names used create test tables","code":""},{"path":"/reference/create_test_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"NA","code":""},{"path":"/reference/create_test_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A wrapper around create_test_table to create all tables, or a specified subset of them — create_test_tables","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") create_test_tables(conn) # create all test tables }"},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"Create REDCap data dictionary dataframe","code":""},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"","code":"dataframe_to_redcap_dictionary(df, form_name, record_id_col = NULL)"},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"df dataframe generate data dictionary form_name form name display REDCap record_id_col column dataframe uniquely identifies record","code":""},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"redcap data dictionary","code":""},{"path":"/reference/dataframe_to_redcap_dictionary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a REDCap data dictionary from a dataframe — dataframe_to_redcap_dictionary","text":"","code":"if (FALSE) { df <- data.frame( pk_col = c(\"a1\", \"a2\", \"a3\"), integer_col = c(1, 2, 3), numeric_col = 5.9, character_col = c(\"a\", \"b\", \"c\"), date_col = as.Date(\"2011-03-07\"), date_time_col = as.POSIXct(strptime(\"2011-03-27 01:30:00\", \"%Y-%m-%d %H:%M:%S\")), email_col = c(\"test@example.com\", \"test.2@example.edu\", \"3test@example.net\") ) redcap_data_dictionary <- dataframe_to_redcap_dictionary(df, \"test_form\") redcap_data_dictionary <- dataframe_to_redcap_dictionary(df, \"test_form\", \"character_col\") }"},{"path":"/reference/dataset_diff.html","id":null,"dir":"Reference","previous_headings":"","what":"dataset_diff — dataset_diff","title":"dataset_diff — dataset_diff","text":"returns differences source target data list dataframes records updated, inserted, deleted, update target facts source.","code":""},{"path":"/reference/dataset_diff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dataset_diff — dataset_diff","text":"","code":"dataset_diff(source, source_pk, target, target_pk, insert = T, delete = T)"},{"path":"/reference/dataset_diff.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"dataset_diff — dataset_diff","text":"source - dataframe content needs reflected target source_pk - primary key source target - data frame needs reflect source target_pk - primary key target insert - compute return insert records delete - compute return delete records","code":""},{"path":"/reference/dataset_diff.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"dataset_diff — dataset_diff","text":"list dataframes update_records - column redcap user_ids / institutional IDs insert_records - column authoritative email address user_id NA insert NA delete_records ... - Additional columns allowed return data frame NA delete NA","code":""},{"path":"/reference/dataset_diff.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dataset_diff — dataset_diff","text":"goal allow intelligent one-way synchronization source target datasets using database CRUD operations. two assumptions source target: 1. Columns source subset columns target. 2. target_pk appear source.","code":""},{"path":"/reference/dataset_diff.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"dataset_diff — dataset_diff","text":"","code":"if (FALSE) { dataset_diff(source = dataset_diff_test_user_data$source, source_pk = \"username\", target = dataset_diff_test_user_data$target, target_pk = \"ui_id\" ) }"},{"path":"/reference/dataset_diff_test_bar_bang.html","id":null,"dir":"Reference","previous_headings":"","what":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"list test inputs outputs dataset_diff","code":""},{"path":"/reference/dataset_diff_test_bar_bang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"","code":"dataset_diff_test_bar_bang"},{"path":"/reference/dataset_diff_test_bar_bang.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"list 5 variables: source tibble source data source_pk character primary key source data target tibble target data target_pk character primary key target data result list dataset_diff output","code":""},{"path":"/reference/dataset_diff_test_bar_bang.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dataset_diff_test_bar_bang — dataset_diff_test_bar_bang","text":"DETAILS","code":""},{"path":"/reference/dataset_diff_test_user_data.html","id":null,"dir":"Reference","previous_headings":"","what":"dataset_diff_test_user_data — dataset_diff_test_user_data","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"list test inputs outputs dataset_diff","code":""},{"path":"/reference/dataset_diff_test_user_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"","code":"dataset_diff_test_user_data"},{"path":"/reference/dataset_diff_test_user_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"list 5 variables: source tibble source data source_pk character primary key source data target tibble target data target_pk character primary key target data result list dataset_diff output","code":""},{"path":"/reference/dataset_diff_test_user_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dataset_diff_test_user_data — dataset_diff_test_user_data","text":"DETAILS","code":""},{"path":"/reference/delete_project.html","id":null,"dir":"Reference","previous_headings":"","what":"Delete a Project from REDCap — delete_project","title":"Delete a Project from REDCap — delete_project","text":"Deletes specified projects REDCap system setting `date_deleted` field. also log event appropriate `log_event_table` project.","code":""},{"path":"/reference/delete_project.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Delete a Project from REDCap — delete_project","text":"","code":"delete_project(project_id, conn)"},{"path":"/reference/delete_project.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Delete a Project from REDCap — delete_project","text":"project_id project ID vector project IDs deleted. conn DBI connection object database holds `redcap_projects` `redcap_log_event*` tables.","code":""},{"path":"/reference/delete_project.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Delete a Project from REDCap — delete_project","text":"list containing: n: number projects deleted number_rows_logged: number rows logged deletion event project_ids_deleted: vector project IDs deleted data: data frame input project_id status trying delete ","code":""},{"path":"/reference/delete_project.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Delete a Project from REDCap — delete_project","text":"","code":"if (FALSE) { conn <- DBI::dbConnect(...) delete_project(c(1,2,3), conn) }"},{"path":"/reference/disable_non_interactive_quit.html","id":null,"dir":"Reference","previous_headings":"","what":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","title":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","text":"Prevent quit_non_interactive_run quitting. meant used outside tests. See test-write.R example.","code":""},{"path":"/reference/disable_non_interactive_quit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","text":"","code":"disable_non_interactive_quit()"},{"path":"/reference/disable_non_interactive_quit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Prevent quit_non_interactive_run from quitting.\nThis is not meant to be used outside of tests. See test-write.R for an example. — disable_non_interactive_quit","text":"","code":"if (FALSE) { disable_non_interactive_quit() }"},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":null,"dir":"Reference","previous_headings":"","what":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"Turn randomization target project already moved production randomization configured.","code":""},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"","code":"enable_randomization_on_a_preconfigured_project_in_production( target_conn, target_project_id )"},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"target_conn - DBI connection object pointing REDCap database houses target project. target_project_id - project ID REDCap project receive mirrored randomization data.","code":""},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"logical indicating success failure operation","code":""},{"path":"/reference/enable_randomization_on_a_preconfigured_project_in_production.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"enable_randomization_on_a_preconfigured_project_in_production — enable_randomization_on_a_preconfigured_project_in_production","text":"","code":"if (FALSE) { enable_randomization_on_a_preconfigured_project_in_production( target_conn = target_conn, target_project_id = target_project_id ) }"},{"path":"/reference/evaluate_checksums.html","id":null,"dir":"Reference","previous_headings":"","what":"evaluate_checksums — evaluate_checksums","title":"evaluate_checksums — evaluate_checksums","text":"Transform output `get_table_checksum()` source target copy MySQL database copy operation compare checksums.","code":""},{"path":"/reference/evaluate_checksums.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"evaluate_checksums — evaluate_checksums","text":"","code":"evaluate_checksums(source_checksums, target_checksums)"},{"path":"/reference/evaluate_checksums.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"evaluate_checksums — evaluate_checksums","text":"source_checksums output `get_table_checksum()` source MySQL database database copy operation target_checksums output `get_table_checksum()` target MySQL database database copy operation","code":""},{"path":"/reference/evaluate_checksums.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"evaluate_checksums — evaluate_checksums","text":"dataframe columns: table MySQL table name checksum_source checksum source table returned \"CHECKSUM TABLE \" checksum_target checksum target table returned \"CHECKSUM TABLE \" elapsed_time_source elapsed time required query fetch checksum source table elapsed_time_target elapsed time required query fetch checksum target table matches boolean indicating source target checksums match","code":""},{"path":"/reference/evaluate_checksums.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"evaluate_checksums — evaluate_checksums","text":"","code":"if (FALSE) { evaluate_checksums(source_checksums, target_checksums) }"},{"path":"/reference/expire_user_project_rights.html","id":null,"dir":"Reference","previous_headings":"","what":"Expire user rights to REDCap projects — expire_user_project_rights","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"Expire user rights one REDCap projects based list users expire users exclude expiration","code":""},{"path":"/reference/expire_user_project_rights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"","code":"expire_user_project_rights( conn, project_ids, usernames = NULL, all_users_except = NULL, expiration_date = as.Date(NA) )"},{"path":"/reference/expire_user_project_rights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"conn, DBI Connection object REDCap database project_ids, vector project IDs whose users need expiration usernames, vector usernames expire across vector project IDs all_users_except, vector usernames excluded expiration expiration_date, expiration date applied users. Defaults today.","code":""},{"path":"/reference/expire_user_project_rights.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"list update count data written updates - number records revised data - dataframe changes applied redcap_user_rights","code":""},{"path":"/reference/expire_user_project_rights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Expire user rights to REDCap projects — expire_user_project_rights","text":"","code":"conn <- DBI::dbConnect(RSQLite::SQLite(), dbname = \":memory:\") DBI::dbCreateTable( conn, name = \"redcap_user_rights\", fields = user_rights_test_data$redcap_user_rights ) DBI::dbAppendTable( conn, name = \"redcap_user_rights\", value = user_rights_test_data$redcap_user_rights ) #> [1] 27 usernames <- c(\"bob\", \"dan\") expire_user_project_rights( conn = conn, project_ids = c(34), usernames = usernames ) #> $updates #> [1] 2 #> #> $data #> # A tibble: 2 × 3 #> project_id username expiration #> #> 1 34 bob 2024-02-28 #> 2 34 dan 2024-02-28 #>"},{"path":"/reference/export_allocation_tables_from_project.html","id":null,"dir":"Reference","previous_headings":"","what":"export_allocation_tables_from_project — export_allocation_tables_from_project","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"Export randomization allocation data project REDCap randomization tables form reflects allocation tables REDCap requests import","code":""},{"path":"/reference/export_allocation_tables_from_project.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"","code":"export_allocation_tables_from_project(conn, project_id_to_export)"},{"path":"/reference/export_allocation_tables_from_project.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"conn - DBI connection object pointing REDCap database houses project interest project_id_to_export - project ID REDCap project contains randomization exported.","code":""},{"path":"/reference/export_allocation_tables_from_project.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"dataframe shape REDCap randomization table CSVs","code":""},{"path":"/reference/export_allocation_tables_from_project.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"export_allocation_tables_from_project — export_allocation_tables_from_project","text":"","code":"if (FALSE) { allocations <- export_allocation_tables_from_project( conn = source_conn, project_id_to_export = source_project_id ) }"},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":null,"dir":"Reference","previous_headings":"","what":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"Connect imap mailbox, identify bad email addresses referenced bounce messages sent `messages_since_date`, extract data emails.","code":""},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"","code":"get_bad_emails_from_individual_emails( username, password, url = \"imaps://outlook.office365.com\", messages_since_date )"},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"username username IMAP mailbox password password IMAP mailbox url IMAP URL host houses mailbox messages_since_date sent date oldest message inspected","code":""},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"dataframe bounced email addresses emailcharacter email address bounced","code":""},{"path":"/reference/get_bad_emails_from_individual_emails.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scrape an inbox for bad email addresses in bounce messages — get_bad_emails_from_individual_emails","text":"","code":"if (FALSE) { get_bad_emails_from_individual_emails( username = \"jdoe\", password = \"jane_does_password\", url =\"imaps://outlook.office365.com\", messages_since_date = as.Date(\"2022-01-01\", format = \"%Y-%m-%d\") ) }"},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":null,"dir":"Reference","previous_headings":"","what":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"Connect imap mailbox, identify LISTSERV digest emails sent `messages_since_date`, extract bounced email addresses digest messages.","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"","code":"get_bad_emails_from_listserv_digest( username, password, url = \"imaps://outlook.office365.com\", messages_since_date )"},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"username username IMAP mailbox password password IMAP mailbox url IMAP URL host houses mailbox messages_since_date sent date oldest message inspected","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"dataframe bad email addresses email - column bad email address","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Enumerate bad email addresses described in LISTSERV email digests — get_bad_emails_from_listserv_digest","text":"","code":"if (FALSE) { get_bad_emails_from_listserv_digest( username = \"jdoe\", password = \"jane_does_password\", url =\"imaps://outlook.office365.com\", messages_since_date = as.Date(\"2022-01-01\", format = \"%Y-%m-%d\") ) }"},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":null,"dir":"Reference","previous_headings":"","what":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"example output get_bad_emails_from_listserv_digest aligns related tests","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"","code":"get_bad_emails_from_listserv_digest_test_output"},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"data frame 7 rows 1 variables: email character bad email address found querying listserv error digests","code":""},{"path":"/reference/get_bad_emails_from_listserv_digest_test_output.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_bad_emails_from_listserv_digest_test_output — get_bad_emails_from_listserv_digest_test_output","text":"DETAILS","code":""},{"path":"/reference/get_current_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Fetches the current time in system time zone — get_current_time","title":"Fetches the current time in system time zone — get_current_time","text":"Fetches current time system time zone","code":""},{"path":"/reference/get_current_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fetches the current time in system time zone — get_current_time","text":"","code":"get_current_time()"},{"path":"/reference/get_current_time.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fetches the current time in system time zone — get_current_time","text":"duration object representing current time","code":""},{"path":"/reference/get_current_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fetches the current time in system time zone — get_current_time","text":"","code":"if (FALSE) { get_current_time() }"},{"path":"/reference/get_institutional_person_data.html","id":null,"dir":"Reference","previous_headings":"","what":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"template function fetching authoritative email address data institutional data","code":""},{"path":"/reference/get_institutional_person_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"","code":"get_institutional_person_data(user_ids = c(NA_character_))"},{"path":"/reference/get_institutional_person_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"user_ids optional vector REDCap user IDs used query institutional data","code":""},{"path":"/reference/get_institutional_person_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"Dataframe user_id - column redcap user_ids / institutional IDs email - column authoritative email address user_id ... - Additional columns allowed return data frame","code":""},{"path":"/reference/get_institutional_person_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A template function for fetching authoritative email address data\nand other institutional data — get_institutional_person_data","text":"","code":"redcap_users <- c(\"jane_doe\", \"john_q_public\") get_institutional_person_data(user_ids = redcap_users) #> # A tibble: 2 × 2 #> user_id email #> #> 1 jane_doe jane_doe@example.org #> 2 john_q_public john_q_public@example.org"},{"path":"/reference/get_job_duration.html","id":null,"dir":"Reference","previous_headings":"","what":"Provide the exact length of the time span between start time and end time — get_job_duration","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"Provide exact length time span start time end time","code":""},{"path":"/reference/get_job_duration.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"","code":"get_job_duration(start_time, end_time)"},{"path":"/reference/get_job_duration.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"start_time, lubridate::duration object representing start time end_time, lubridate::duration object representing end time","code":""},{"path":"/reference/get_job_duration.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"exact length time span start time end time","code":""},{"path":"/reference/get_job_duration.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Provide the exact length of the time span between start time and end time — get_job_duration","text":"","code":"if (FALSE) { get_job_duration( start_time = get_script_run_time(), end_time = get_current_time() ) }"},{"path":"/reference/get_package_scope_var.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the value from the redcapcustodian.env environment — get_package_scope_var","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"Get value redcapcustodian.env environment","code":""},{"path":"/reference/get_package_scope_var.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"","code":"get_package_scope_var(key)"},{"path":"/reference/get_package_scope_var.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"key identifying string lookup","code":""},{"path":"/reference/get_package_scope_var.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the value from the redcapcustodian.env environment — get_package_scope_var","text":"","code":"if (FALSE) { get_package_scope_var(\"hello\") }"},{"path":"/reference/get_project_life_cycle.html","id":null,"dir":"Reference","previous_headings":"","what":"get_project_life_cycle — get_project_life_cycle","title":"get_project_life_cycle — get_project_life_cycle","text":"get_project_life_cycle runs speedy queries REDCap log event tables get events life cycle every project system.","code":""},{"path":"/reference/get_project_life_cycle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_project_life_cycle — get_project_life_cycle","text":"","code":"get_project_life_cycle( rc_conn, start_date = as.Date(NA), cache_file = NA_character_, read_cache = TRUE )"},{"path":"/reference/get_project_life_cycle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get_project_life_cycle — get_project_life_cycle","text":"rc_conn - DBI connection REDCap database start_date - optional minimum date query results cache_file - optional path cache_file. Defaults NA. read_cache - boolean indicate cache read. Defaults TRUE","code":""},{"path":"/reference/get_project_life_cycle.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_project_life_cycle — get_project_life_cycle","text":"- dataframe redcap_log_event rows added columns: `log_event_table` index event table read `event_date` date object event `description_base_name` description project report level details removed","code":""},{"path":"/reference/get_project_life_cycle.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_project_life_cycle — get_project_life_cycle","text":"redcap_log_event table among largest redcap tables. test instance script developed, 2.2m rows production system 29m rows corresponding redcap_data table. row count millions completely normal. fastest way query query `object_type == \"redcap_projects\"`. , query can filtered `ts >= start_date`` make even faster allow incremental queries. comes small cost descriptions included searching `object_type == \"redcap_projects\"`: Create project (API) Create project folder Delete project bookmark Send request copy project Send request create project Send request delete project Send request move project production status Among things, loss means tell requested things requested . Deletion Events Notes Every project deletion composed multiple events. simplest event deletion user followed permanent deletion system via cron job 30 days later. admins can always , users allowed delete non-production projects. production projects, users must submit request delete. admin deletes project. 30 days later system permanently delete project via cron job. project can undeleted permanent deletion /changes status, sequences can sub-loops intermingle. address wanted project deleted got done, one must find last \"Send request delete project\" \"Delete project\" event get username \"Permanently delete project\" event verify deletion. request delete event precede \"Permanently delete project\" event, username request consider deleter. admin executed task just custodian.","code":""},{"path":"/reference/get_project_life_cycle.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"get_project_life_cycle — get_project_life_cycle","text":"","code":"if (FALSE) { project_life_cycle <- get_project_life_cycle(rc_conn = rc_conn, read_cache = TRUE) }"},{"path":"/reference/get_redcap_credentials.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve REDCap Credentials Based on Specified Parameters — get_redcap_credentials","title":"Retrieve REDCap Credentials Based on Specified Parameters — get_redcap_credentials","text":"Fetches REDCap credentials CREDENTIALS_DB, allowing filtering based project ID, server short name, project short name, username. least one filtering criterion must provided.","code":""},{"path":"/reference/get_redcap_credentials.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve REDCap Credentials Based on Specified Parameters — get_redcap_credentials","text":"","code":"get_redcap_credentials( project_pid = NA, server_short_name = NA, project_short_name = NA, username = NA )"},{"path":"/reference/get_redcap_credentials.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve REDCap Credentials Based on Specified Parameters — get_redcap_credentials","text":"project_pid Optional project ID filtering. server_short_name Optional server short name filtering. project_short_name Optional project short name filtering. username Optional username filtering.","code":""},{"path":"/reference/get_redcap_credentials.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve REDCap Credentials Based on Specified Parameters — get_redcap_credentials","text":"dataframe filtered REDCap credentials, including 'url' column added convenience.","code":""},{"path":"/reference/get_redcap_credentials.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve REDCap Credentials Based on Specified Parameters — get_redcap_credentials","text":"","code":"if (FALSE) { source_credentials <- get_redcap_credentials(project_pid = \"123\") prod_credentials <- get_redcap_credentials(server_short_name = \"prod\") target_credentials <- prod_credentials |> filter(str_detect(project_name, \"biospecimens\")) }"},{"path":"/reference/get_redcap_db_connection.html","id":null,"dir":"Reference","previous_headings":"","what":"Get connection to the primary REDCap database — get_redcap_db_connection","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"Get connection primary REDCap database","code":""},{"path":"/reference/get_redcap_db_connection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"","code":"get_redcap_db_connection()"},{"path":"/reference/get_redcap_db_connection.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"existing connection object REDCap database","code":""},{"path":"/reference/get_redcap_db_connection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get connection to the primary REDCap database — get_redcap_db_connection","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() }"},{"path":"/reference/get_redcap_email_revisions.html","id":null,"dir":"Reference","previous_headings":"","what":"Get redcap user email revisions — get_redcap_email_revisions","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"Get redcap user email revisions","code":""},{"path":"/reference/get_redcap_email_revisions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"","code":"get_redcap_email_revisions(bad_redcap_user_emails, person)"},{"path":"/reference/get_redcap_email_revisions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"bad_redcap_user_emails bad redcap user email data person institutional person data keyed user_id","code":""},{"path":"/reference/get_redcap_email_revisions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"dataframe columns: ui_id - ui_id associated user REDCap's redcap_user_information table username - REDCap username email_field_name - name column containing email address corrected_email - corrected email address placed column email_field_name","code":""},{"path":"/reference/get_redcap_email_revisions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get redcap user email revisions — get_redcap_email_revisions","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") bad_emails <- get_bad_redcap_user_emails() persons <- get_institutional_person_data(conn) email_revisions <- get_redcap_email_revisions(bad_emails, persons) }"},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"list test inputs outputs get_redcap_email_revisions","code":""},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"","code":"get_redcap_email_revisions_test_data"},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"list 3 tibbles: bad_redcap_user_emails tibble bad email address redcap usernames person tibble corrected email addresses corresponding usernames output tibble output get_redcap_email_revisions","code":""},{"path":"/reference/get_redcap_email_revisions_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_redcap_email_revisions_test_data — get_redcap_email_revisions_test_data","text":"DETAILS","code":""},{"path":"/reference/get_redcap_emails.html","id":null,"dir":"Reference","previous_headings":"","what":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"Get user emails redcap_user_information tall data","code":""},{"path":"/reference/get_redcap_emails.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"","code":"get_redcap_emails(conn)"},{"path":"/reference/get_redcap_emails.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"conn DBI Connection object","code":""},{"path":"/reference/get_redcap_emails.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"list 2 dataframes: wide, relevant email columns redcap_user_information tall, wide data pivoted include email_field_name email columns","code":""},{"path":"/reference/get_redcap_emails.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get all user emails in redcap_user_information as tall data — get_redcap_emails","text":"","code":"if (FALSE) { conn <- dbConnect(RSQLite::SQLite(), dbname = \":memory:\") create_test_table(conn, \"redcap_user_information\") get_redcap_emails(conn) }"},{"path":"/reference/get_redcap_emails_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"get_redcap_emails_test_data — get_redcap_emails_test_data","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"test data mock get_redcap_emails","code":""},{"path":"/reference/get_redcap_emails_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"","code":"get_redcap_emails_test_data"},{"path":"/reference/get_redcap_emails_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"object class list length 2.","code":""},{"path":"/reference/get_redcap_emails_test_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"list 2 dataframes: wide, relevant email columns redcap_user_information tall, wide data pivoted include email_field_name email columns","code":""},{"path":"/reference/get_redcap_emails_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_redcap_emails_test_data — get_redcap_emails_test_data","text":"DETAILS","code":""},{"path":"/reference/get_script_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Fetches the package-scoped value of script_name — get_script_name","title":"Fetches the package-scoped value of script_name — get_script_name","text":"Fetches package-scoped value script_name","code":""},{"path":"/reference/get_script_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fetches the package-scoped value of script_name — get_script_name","text":"","code":"get_script_name()"},{"path":"/reference/get_script_run_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Fetches the package-scoped value of script_run_time — get_script_run_time","title":"Fetches the package-scoped value of script_run_time — get_script_run_time","text":"Fetches package-scoped value script_run_time","code":""},{"path":"/reference/get_script_run_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fetches the package-scoped value of script_run_time — get_script_run_time","text":"","code":"get_script_run_time()"},{"path":"/reference/get_script_run_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fetches the package-scoped value of script_run_time — get_script_run_time","text":"","code":"get_script_run_time() #> NULL"},{"path":"/reference/get_table_checksum.html","id":null,"dir":"Reference","previous_headings":"","what":"get_table_checksum — get_table_checksum","title":"get_table_checksum — get_table_checksum","text":"Fetch checksum MySQL table accessed via DBI connection object.","code":""},{"path":"/reference/get_table_checksum.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_table_checksum — get_table_checksum","text":"","code":"get_table_checksum(table_name, conn)"},{"path":"/reference/get_table_checksum.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get_table_checksum — get_table_checksum","text":"table_name name table database described `conn` conn DBI Connection object MySQL database","code":""},{"path":"/reference/get_table_checksum.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_table_checksum — get_table_checksum","text":"one row dataframe columns: host MySQL host name found DBI connection object database_name MySQL database name returned query table MySQL table name checksum checksum returned \"CHECKSUM TABLE \" elapsed_time elapsed time required query fetch checksum","code":""},{"path":"/reference/get_table_checksum.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"get_table_checksum — get_table_checksum","text":"","code":"if (FALSE) { get_table_checksum(\"redcap_user_information\", rc_conn) }"},{"path":"/reference/get_test_table_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"Provides list table names schema data files part package","code":""},{"path":"/reference/get_test_table_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"","code":"get_test_table_names()"},{"path":"/reference/get_test_table_names.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"list table names schema data files part package","code":""},{"path":"/reference/get_test_table_names.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Provides a list of table names which have schema and data files as part of the package — get_test_table_names","text":"","code":"get_test_table_names() #> [1] \"redcap_projects\" \"redcap_user_information\""},{"path":"/reference/init_etl.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize all etl dependencies — init_etl","title":"Initialize all etl dependencies — init_etl","text":"Initialize etl dependencies","code":""},{"path":"/reference/init_etl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize all etl dependencies — init_etl","text":"","code":"init_etl( script_name = \"\", fake_runtime = NULL, log_db_drv = RMariaDB::MariaDB() )"},{"path":"/reference/init_etl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize all etl dependencies — init_etl","text":"script_name name passed set_script_name fake_runtime optional asserted script run time passed set_script_run_time, defaults time function called log_db_drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/init_etl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize all etl dependencies — init_etl","text":"","code":"if (FALSE) { init_etl(\"name_of_file\") }"},{"path":"/reference/init_log_con.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"Initialize connection log db set redcapcustodian.env$log_con","code":""},{"path":"/reference/init_log_con.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"","code":"init_log_con(drv = RMariaDB::MariaDB())"},{"path":"/reference/init_log_con.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/init_log_con.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize the connection to the log db and set redcapcustodian.env$log_con — init_log_con","text":"","code":"if (FALSE) { # use a sqlite db instead init_log_con(drv = RSQLite::SQLite()) }"},{"path":"/reference/is_db_con.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if the provided connection is a DBI connection object — is_db_con","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"Check provided connection DBI connection object","code":""},{"path":"/reference/is_db_con.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"","code":"is_db_con(con)"},{"path":"/reference/is_db_con.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"con DBI connection","code":""},{"path":"/reference/is_db_con.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"result test","code":""},{"path":"/reference/is_db_con.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check if the provided connection is a DBI connection object — is_db_con","text":"","code":"if (FALSE) { conn = connect_to_local_db() is_db_con( con = conn ) }"},{"path":"/reference/is_on_ci.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if ","title":"Check if ","text":"Check \"CI\" environment variable set TRUE","code":""},{"path":"/reference/is_on_ci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if ","text":"","code":"is_on_ci()"},{"path":"/reference/is_on_ci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if ","text":"TRUE/FALSE","code":""},{"path":"/reference/is_on_ci.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check if ","text":"","code":"if (FALSE) { is_on_ci() }"},{"path":"/reference/log_event_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"log_event_tables — log_event_tables","title":"log_event_tables — log_event_tables","text":"vector names 9 redcap log event tables","code":""},{"path":"/reference/log_event_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"log_event_tables — log_event_tables","text":"","code":"log_event_tables"},{"path":"/reference/log_event_tables.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"log_event_tables — log_event_tables","text":"vector 9 elements","code":""},{"path":"/reference/log_event_tables.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"log_event_tables — log_event_tables","text":"DETAILS","code":""},{"path":"/reference/log_job_debug.html","id":null,"dir":"Reference","previous_headings":"","what":"Log a job debug entry — log_job_debug","title":"Log a job debug entry — log_job_debug","text":"Log job debug entry","code":""},{"path":"/reference/log_job_debug.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log a job debug entry — log_job_debug","text":"","code":"log_job_debug(summary)"},{"path":"/reference/log_job_debug.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log a job debug entry — log_job_debug","text":"summary, job summary","code":""},{"path":"/reference/log_job_debug.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Log a job debug entry — log_job_debug","text":"","code":"if (FALSE) { log_job_debug( summary = \"Job debug step\" ) }"},{"path":"/reference/log_job_failure.html","id":null,"dir":"Reference","previous_headings":"","what":"Log a failed job run — log_job_failure","title":"Log a failed job run — log_job_failure","text":"Log failed job run","code":""},{"path":"/reference/log_job_failure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log a failed job run — log_job_failure","text":"","code":"log_job_failure(summary)"},{"path":"/reference/log_job_failure.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log a failed job run — log_job_failure","text":"summary, job summary","code":""},{"path":"/reference/log_job_failure.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Log a failed job run — log_job_failure","text":"","code":"if (FALSE) { log_job_failure( summary = \"Job failed\" ) }"},{"path":"/reference/log_job_success.html","id":null,"dir":"Reference","previous_headings":"","what":"Log a successful job run — log_job_success","title":"Log a successful job run — log_job_success","text":"Log successful job run","code":""},{"path":"/reference/log_job_success.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log a successful job run — log_job_success","text":"","code":"log_job_success(summary)"},{"path":"/reference/log_job_success.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log a successful job run — log_job_success","text":"summary, job summary","code":""},{"path":"/reference/log_job_success.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Log a successful job run — log_job_success","text":"","code":"if (FALSE) { log_job_success( summary = \"Job succeeded\" ) }"},{"path":"/reference/mutate_columns_to_posixct.html","id":null,"dir":"Reference","previous_headings":"","what":"mutate_columns_to_posixct — mutate_columns_to_posixct","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"Mutates column data types POSIXct. Especially useful working -memory tables dates often converted int.","code":""},{"path":"/reference/mutate_columns_to_posixct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"","code":"mutate_columns_to_posixct(data, column_names)"},{"path":"/reference/mutate_columns_to_posixct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"data - dataframe mutate column_names - vector column names mutate","code":""},{"path":"/reference/mutate_columns_to_posixct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"input dataframe revised data types","code":""},{"path":"/reference/mutate_columns_to_posixct.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"mutate_columns_to_posixct — mutate_columns_to_posixct","text":"","code":"if (FALSE) { time_columns <- c(\"created\", \"updated\") mutate_columns_to_posixct(data, time_columns) }"},{"path":"/reference/project_life_cycle_descriptions.html","id":null,"dir":"Reference","previous_headings":"","what":"project_life_cycle_descriptions — project_life_cycle_descriptions","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"character vector descriptions used redcap_log_event table describe different stages life cycle REDCap Project","code":""},{"path":"/reference/project_life_cycle_descriptions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"","code":"project_life_cycle_descriptions"},{"path":"/reference/project_life_cycle_descriptions.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"character vector 24 elements","code":""},{"path":"/reference/project_life_cycle_descriptions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_life_cycle_descriptions — project_life_cycle_descriptions","text":"DETAILS","code":""},{"path":"/reference/project_purpose_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"project_purpose_labels — project_purpose_labels","title":"project_purpose_labels — project_purpose_labels","text":"tibble project purpose IDs project purposes reflect meaning used `purpose` column `redcap_projects` table","code":""},{"path":"/reference/project_purpose_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_purpose_labels — project_purpose_labels","text":"","code":"project_purpose_labels"},{"path":"/reference/project_purpose_labels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_purpose_labels — project_purpose_labels","text":"data frame 5 rows 2 variables: id double primary key project_purpose character redcap project purpose","code":""},{"path":"/reference/project_purpose_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_purpose_labels — project_purpose_labels","text":"DETAILS","code":""},{"path":"/reference/project_purpose_other_research_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"project_purpose_other_research_labels — project_purpose_other_research_labels","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"tibble project purpose IDs labels reflect meaning used `purpose_other` column `redcap_projects` table","code":""},{"path":"/reference/project_purpose_other_research_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"","code":"project_purpose_other_research_labels"},{"path":"/reference/project_purpose_other_research_labels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"data frame 5 rows 2 variables: id double primary key project_purpose_other_research character redcap purpose research","code":""},{"path":"/reference/project_purpose_other_research_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_purpose_other_research_labels — project_purpose_other_research_labels","text":"DETAILS","code":""},{"path":"/reference/project_status_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"project_status_labels — project_status_labels","title":"project_status_labels — project_status_labels","text":"tibble project status IDs project statuses reflect meaning used `status` column `redcap_projects` table","code":""},{"path":"/reference/project_status_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"project_status_labels — project_status_labels","text":"","code":"project_status_labels"},{"path":"/reference/project_status_labels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"project_status_labels — project_status_labels","text":"data frame 4 rows 2 variables: id double primary key project_status character redcap project status","code":""},{"path":"/reference/project_status_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"project_status_labels — project_status_labels","text":"DETAILS","code":""},{"path":"/reference/quit_non_interactive_run.html","id":null,"dir":"Reference","previous_headings":"","what":"Quit a non interactive R session — quit_non_interactive_run","title":"Quit a non interactive R session — quit_non_interactive_run","text":"Quit non interactive R session","code":""},{"path":"/reference/quit_non_interactive_run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Quit a non interactive R session — quit_non_interactive_run","text":"","code":"quit_non_interactive_run()"},{"path":"/reference/quit_non_interactive_run.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Quit a non interactive R session — quit_non_interactive_run","text":"","code":"if (FALSE) { quit_non_interactive_run() }"},{"path":"/reference/scrape_user_api_tokens.html","id":null,"dir":"Reference","previous_headings":"","what":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"Gather API tokens specified REDCap server given user","code":""},{"path":"/reference/scrape_user_api_tokens.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"","code":"scrape_user_api_tokens(conn, username_to_scrape = Sys.info()[[\"user\"]])"},{"path":"/reference/scrape_user_api_tokens.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"conn DBI database connection REDCap instance, get_redcap_db_connection username_to_scrape REDCap username, defaults system's username","code":""},{"path":"/reference/scrape_user_api_tokens.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"dataframe tokens assigned user containing following: project_id - project ID REDCap (0 super token) username - username REDCap token - API token associated project ID project_display_name - name project appears REDCap GUI","code":""},{"path":"/reference/scrape_user_api_tokens.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Gather all API tokens on a specified REDCap server for a given user — scrape_user_api_tokens","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() my_credentials <- scrape_user_api_tokens(conn, \"admin\") }"},{"path":"/reference/send_email.html","id":null,"dir":"Reference","previous_headings":"","what":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"wrapper function sends email (via sendmailR) reporting outcome another function","code":""},{"path":"/reference/send_email.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"","code":"send_email( email_body, email_subject = \"\", email_to = \"\", email_cc = \"\", email_from = \"\" )"},{"path":"/reference/send_email.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"email_body contents email email_subject subject line email email_to email addresses primary recipient(s), separate recipient addresses spaces email_cc email addresses cc'd recipient(s), separate recipient addresses spaces email_from email addresses sender","code":""},{"path":"/reference/send_email.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"returned value","code":""},{"path":"/reference/send_email.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A wrapper function that sends an email (via sendmailR) reporting the outcome of another function — send_email","text":"","code":"if (FALSE) { message <- paste(\"Failed REDCap data import to\", project_title, \"\\nThe reason given was:\", error_message) email_subject <- paste(\"FAILED |\", script_name, \"|\", Sys.getenv(\"INSTANCE\"), \"|\", script_run_time) send_email(message, email_subject) }"},{"path":"/reference/set_package_scope_var.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"Assign value redcapcustodian.env environment, retrievable get_package_scope_var Assign value redcapcustodian.env environment, retrievable get_package_scope_var","code":""},{"path":"/reference/set_package_scope_var.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"","code":"set_package_scope_var(key, value) set_package_scope_var(key, value)"},{"path":"/reference/set_package_scope_var.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"key identifying string store lookup key value value store","code":""},{"path":"/reference/set_package_scope_var.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign a value to the redcapcustodian.env environment, retrievable with get_package_scope_var — set_package_scope_var","text":"","code":"if (FALSE) { set_package_scope_var(\"hello\", \"world\") hello <- get_package_scope_var(\"hello\") } if (FALSE) { set_package_scope_var(\"hello\", \"world\") hello <- get_package_scope_var(\"hello\") }"},{"path":"/reference/set_project_api_token.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"Generate API token REDCap project assign specified user","code":""},{"path":"/reference/set_project_api_token.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"","code":"set_project_api_token(conn, username, project_id)"},{"path":"/reference/set_project_api_token.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"conn DBI database connection, get_redcap_db_connection username REDCap username user must already access project, .e. must appear project's User Rights project_id project id project wish generate token","code":""},{"path":"/reference/set_project_api_token.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"nothing","code":""},{"path":"/reference/set_project_api_token.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate an API token for a REDCap project and assign it to a specified user — set_project_api_token","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() my_new_token <- set_project_api_token(conn, \"admin\", 15) }"},{"path":"/reference/set_script_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","title":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","text":"Assigns package-scoped script_name. default sourced focused RStudio window calling command (e.g. Rscript script_name.R)","code":""},{"path":"/reference/set_script_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","text":"","code":"set_script_name(script_name = \"\")"},{"path":"/reference/set_script_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assigns package-scoped script_name. \nBy default this is sourced from the focused RStudio window or\nthe calling command (e.g. Rscript script_name.R) — set_script_name","text":"script_name optional arg override calling script","code":""},{"path":"/reference/set_script_run_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Sets the package-scoped value of script_run_time — set_script_run_time","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"Sets package-scoped value script_run_time","code":""},{"path":"/reference/set_script_run_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"","code":"set_script_run_time(fake_runtime = lubridate::NA_POSIXct_)"},{"path":"/reference/set_script_run_time.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"fake_runtime asserted script run time","code":""},{"path":"/reference/set_script_run_time.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"package-scoped value script_run_time","code":""},{"path":"/reference/set_script_run_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sets the package-scoped value of script_run_time — set_script_run_time","text":"","code":"set_script_run_time() #> [1] \"2024-02-28 16:32:39 UTC\" set_script_run_time(fake_runtime = as.POSIXct(\"2021-02-23 02:23:00\", tz=\"\", format=\"%Y-%m-%d %H:%M:%OS\") ) #> [1] \"2021-02-23 02:23:00 UTC\""},{"path":"/reference/set_super_api_token.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"Generate set Super API token provided REDCap user","code":""},{"path":"/reference/set_super_api_token.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"","code":"set_super_api_token(conn, username)"},{"path":"/reference/set_super_api_token.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"conn DBI database connection, get_redcap_db_connection username REDCap username","code":""},{"path":"/reference/set_super_api_token.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"newly created super token","code":""},{"path":"/reference/set_super_api_token.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate and set a Super API token for a provided REDCap user — set_super_api_token","text":"","code":"if (FALSE) { conn <- get_redcap_db_connection() my_new_super_token <- set_super_api_token(conn, \"admin\") }"},{"path":"/reference/suspend_users_with_no_primary_email.html","id":null,"dir":"Reference","previous_headings":"","what":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"Suspends users primary email redcap_user_information","code":""},{"path":"/reference/suspend_users_with_no_primary_email.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"","code":"suspend_users_with_no_primary_email(conn)"},{"path":"/reference/suspend_users_with_no_primary_email.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"conn DBI Connection object","code":""},{"path":"/reference/suspend_users_with_no_primary_email.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Suspends users with no primary email in redcap_user_information — suspend_users_with_no_primary_email","text":"","code":"if (FALSE) { suspend_users_with_no_primary_email(conn) }"},{"path":"/reference/sync_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"Sync data dictionary source project target project using credential objects","code":""},{"path":"/reference/sync_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"","code":"sync_metadata( source_credentials, target_credentials, strip_action_tags = FALSE )"},{"path":"/reference/sync_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"source_credentials dataframe containing following columns: redcap_uri - uri API endpoint REDCap host token - REDCap API token specific project dataframe contain credentials project wish copy target_credentials dataframe containing following columns: redcap_uri - uri API endpoint REDCap host token - REDCap API token specific project dataframe contain credentials project wish overwrite strip_action_tags Optional toggle remove action tags, useful porting development environment; defaults FALSE","code":""},{"path":"/reference/sync_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"nothing","code":""},{"path":[]},{"path":"/reference/sync_metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sync data dictionary of a source project to a target project using credential objects — sync_metadata","text":"","code":"if (FALSE) { source_credentials <- REDCapR::retrieve_credential_local( path_credential = \"source_credentials.csv\", project_id = 31 ) target_credentials <- REDCapR::retrieve_credential_local( path_credential = \"target_credentials.csv\", project_id = 25 ) sync_metadata(source_credentials, target_credentials) }"},{"path":"/reference/sync_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a MySQL Database using the result of dataset_diff — sync_table","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"Write MySQL Database using result dataset_diff","code":""},{"path":"/reference/sync_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"","code":"sync_table( conn, table_name, primary_key, data_diff_output, insert = F, update = T, delete = F )"},{"path":"/reference/sync_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"conn DBI database connection table_name name table write primary_key name primary key (vector multiple keys) table write data_diff_output list dataframes returned dataset_diff insert boolean toggle use insert dataframe insert rows table_name update boolean toggle use updates dataframe update rows table_name delete boolean toggle use delete dataframe delete rows table_name","code":""},{"path":"/reference/sync_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"named list values: insert_n - number rows inserted table_name update_n - number rows updated table_name delete_n - number rows deleted table_name","code":""},{"path":"/reference/sync_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write to a MySQL Database using the result of dataset_diff — sync_table","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() ... diff_output <- dataset_diff( source = updates, source_pk = \"id\", target = original_table, target_pk = \"id\" ) sync_table( conn = con, table_name = table_name, primary_key = primary_key, data_diff_output = diff_output ) }"},{"path":"/reference/sync_table_2.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"Write MySQL Database based diff source target datasets.","code":""},{"path":"/reference/sync_table_2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"","code":"sync_table_2( conn, table_name, source, source_pk, target, target_pk, insert = F, update = T, delete = F )"},{"path":"/reference/sync_table_2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"conn DBI database connection table_name name table write source - dataframe content needs reflected target source_pk - primary key source target - data frame needs reflect source target_pk - primary key target insert boolean toggle use insert dataframe insert rows table_name update boolean toggle use updates dataframe update rows table_name delete boolean toggle use delete dataframe delete rows table_name","code":""},{"path":"/reference/sync_table_2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"named list values: insert_records - dataframe inserts update_records - dataframe updates delete_records - dataframe deletions insert_n - number rows inserted table_name update_n - number rows updated table_name delete_n - number rows deleted table_name","code":""},{"path":"/reference/sync_table_2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write to a MySQL Database based on the diff of source and target datasets. — sync_table_2","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() ... sync_table_2( conn = con, table_name = table_name, source = updates, source_pk = \"id\", target = original_table, target_pk = \"id\" ) }"},{"path":"/reference/sync_table_test_user_data_result.html","id":null,"dir":"Reference","previous_headings":"","what":"sync_table_test_user_data_result — sync_table_test_user_data_result","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"output sync_table dataset_diff_test_user_data used input","code":""},{"path":"/reference/sync_table_test_user_data_result.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"","code":"sync_table_test_user_data_result"},{"path":"/reference/sync_table_test_user_data_result.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"data frame 4 rows 3 variables: ui_id double primary key username character redcap username user_email character primary email address","code":""},{"path":"/reference/sync_table_test_user_data_result.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"sync_table_test_user_data_result — sync_table_test_user_data_result","text":"DETAILS","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":null,"dir":"Reference","previous_headings":"","what":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"REDCap Custodian logging provide field, `job_summary_data`, store arbitrary details job. contents defined entirely script, practice, easy encode data frame list data frames JSON object, become common practice. Yet using data can bit complex `jsonlite::fromJSON` vectorized. need read multiple job log records, iteration required use JSON object `job_summary_data`. function addresses need accepting dataframe job summary logs unnesting JSON object(s) `job_summary_data` equivalent R objects. Use `objects_to_include` limit unnested objects similar geometry. Dissimilar objects unnested together.","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"","code":"unnest_job_summary_data_json_object(log_data, objects_to_include = NA)"},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"log_data - dataframe job summary logs objects_to_include - optional vector JSON objects job_summary_data un-nested","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"- input dataframe job summary logs `job_summary_data` replaced R objects JSON-encoded therein.","code":""},{"path":"/reference/unnest_job_summary_data_json_object.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"unnest_job_summary_data_json_object — unnest_job_summary_data_json_object","text":"","code":"if (FALSE) { library(redcapcustodian) library(RMariaDB) library(DBI) library(tidyverse) library(dotenv) init_etl(\"pbc_scratch\") log_conn <- get_package_scope_var(\"log_con\") log_data <- tbl(log_conn, \"rcc_job_log\") %>% dplyr::filter(script_name == \"warn_owners_of_impending_bill\") |> collect() unnest_job_summary_data_json_object(log_data) # Read a more complex object log_data_2 <- tbl(log_conn, \"rcc_job_log\") |> dplyr::filter( script_name == \"create_and_send_new_redcap_prod_per_project_line_items\" & level == \"SUCCESS\" ) %>% collect() # Fails due to dissimilar objects unnest_job_summary_data_json_object(log_data_2) # error is \"Can't recycle `service_instance` (size 27) to match `invoice_line_item` (size 79).\" # When separated, the objects can be unnested unnest_job_summary_data_json_object(log_data_2, objects_to_include = c(\"service_instance\")) unnest_job_summary_data_json_object(log_data_2, objects_to_include = c(\"invoice_line_item\")) }"},{"path":"/reference/update_production_allocation_state.html","id":null,"dir":"Reference","previous_headings":"","what":"update_production_allocation_state — update_production_allocation_state","title":"update_production_allocation_state — update_production_allocation_state","text":"Update producition rows redcap_randomization_allocation table mirror another project.","code":""},{"path":"/reference/update_production_allocation_state.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"update_production_allocation_state — update_production_allocation_state","text":"","code":"update_production_allocation_state( source_conn, target_conn, source_project_id, target_rid )"},{"path":"/reference/update_production_allocation_state.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"update_production_allocation_state — update_production_allocation_state","text":"source_conn - DBI connection object pointing REDCap database houses source project. target_conn - DBI connection object pointing REDCap database houses target project. source_project_id - project ID REDCap project contains randomization cloned. target_rid - randomization id REDCap project receive updated randomization data.","code":""},{"path":"/reference/update_production_allocation_state.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"update_production_allocation_state — update_production_allocation_state","text":"- list output sync_table_2 update randomization allocation table.","code":""},{"path":"/reference/update_production_allocation_state.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"update_production_allocation_state — update_production_allocation_state","text":"","code":"if (FALSE) { target_project_allocation_update <- update_production_allocation_state( source_conn = source_conn, target_conn = target_conn, source_project_id = source_project_id, target_rid = target_project_randomization_state$rid ) }"},{"path":"/reference/update_redcap_email_addresses.html","id":null,"dir":"Reference","previous_headings":"","what":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"Updates bad redcap email addresses redcap_user_information","code":""},{"path":"/reference/update_redcap_email_addresses.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"","code":"update_redcap_email_addresses( conn, redcap_email_revisions, redcap_email_original )"},{"path":"/reference/update_redcap_email_addresses.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"conn DBI Connection object redcap_email_revisions df returned get_redcap_email_revisions redcap_email_original df original redcap_user_information email data","code":""},{"path":"/reference/update_redcap_email_addresses.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Updates bad redcap email addresses in redcap_user_information — update_redcap_email_addresses","text":"","code":"if (FALSE) { conn <- connect_to_redcap_db() bad_emails <- get_bad_emails_from_listserv_digest( username = \"jdoe\", password = \"jane_does_password\", url = \"imaps://outlook.office365.com\", messages_since_date = as.Date(\"2022-01-01\", format = \"%Y-%m-%d\") ) bad_redcap_user_emails <- get_redcap_emails(conn)$tall %>% filter(email %in% bad_emails) person_data <- get_institutional_person_data() redcap_email_revisions <- get_redcap_email_revisions(bad_redcap_email_output, person_data) update_redcap_email_addresses( conn, redcap_email_revisions, redcap_email_original = get_redcap_emails(conn)$wide ) }"},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"list test inputs outputs update_redcap_email_addresses","code":""},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"","code":"update_redcap_email_addresses_test_data"},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"list 1 variables: output tibble email data read backfrom redcap_user_information","code":""},{"path":"/reference/update_redcap_email_addresses_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"update_redcap_email_addresses_test_data — update_redcap_email_addresses_test_data","text":"DETAILS","code":""},{"path":"/reference/user_rights_test_data.html","id":null,"dir":"Reference","previous_headings":"","what":"user_rights_test_data — user_rights_test_data","title":"user_rights_test_data — user_rights_test_data","text":"named list dataframes used test functions written manage user rights","code":""},{"path":"/reference/user_rights_test_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"user_rights_test_data — user_rights_test_data","text":"","code":"user_rights_test_data"},{"path":"/reference/user_rights_test_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"user_rights_test_data — user_rights_test_data","text":"named list 3 dataframes: redcap_user_information REDCap Core table redcap_user_rights REDCap Core table redcap_user_roles REDCap Core table","code":""},{"path":"/reference/user_rights_test_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"user_rights_test_data — user_rights_test_data","text":"DETAILS","code":""},{"path":"/reference/verify_log_connectivity.html","id":null,"dir":"Reference","previous_headings":"","what":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"Attempts connect DB using LOG_DB_* environment variables. Returns empty list connection established, returns `error_list` entry otherwise.","code":""},{"path":"/reference/verify_log_connectivity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"","code":"verify_log_connectivity(drv = RMariaDB::MariaDB())"},{"path":"/reference/verify_log_connectivity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/verify_log_connectivity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"`error_list` entry","code":""},{"path":"/reference/verify_log_connectivity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Attempts to connect to the DB using all LOG_DB_* environment variables. Returns an empty list if a connection is established, returns an `error_list` entry otherwise. — verify_log_connectivity","text":"","code":"if (FALSE) { verify_log_connectivity(RMariaDB::MariaDB()) }"},{"path":"/reference/verify_log_dependencies.html","id":null,"dir":"Reference","previous_headings":"","what":"Verifies all dependencies required to write log entries. — verify_log_dependencies","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"Verifies dependencies required write log entries.","code":""},{"path":"/reference/verify_log_dependencies.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"","code":"verify_log_dependencies(drv = RMariaDB::MariaDB())"},{"path":"/reference/verify_log_dependencies.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"drv, object inherits DBIDriver (e.g. RMariaDB::MariaDB()), existing DBIConnection object (order clone existing connection).","code":""},{"path":"/reference/verify_log_dependencies.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"list `error_list` entries.","code":""},{"path":"/reference/verify_log_dependencies.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Verifies all dependencies required to write log entries. — verify_log_dependencies","text":"","code":"if (FALSE) { verify_log_dependencies( drv = RMariaDB::MariaDB() ) }"},{"path":"/reference/verify_log_env_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"Verifies required environment variables set. Returns empty list necessary environment variables set, returns list errors otherwise.","code":""},{"path":"/reference/verify_log_env_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"","code":"verify_log_env_variables()"},{"path":"/reference/verify_log_env_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"list `error_list` entries.","code":""},{"path":"/reference/verify_log_env_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Verifies all required environment variables are set. Returns an empty list if all necessary environment variables are set, returns a list of errors otherwise. — verify_log_env_variables","text":"","code":"if (FALSE) { verify_log_env_variables() }"},{"path":"/reference/write_allocations.html","id":null,"dir":"Reference","previous_headings":"","what":"write_allocations — write_allocations","title":"write_allocations — write_allocations","text":"Write development production randomization allocation table form loaded.","code":""},{"path":"/reference/write_allocations.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"write_allocations — write_allocations","text":"","code":"write_allocations(project_status_to_write, allocations, target_directory = \".\")"},{"path":"/reference/write_allocations.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"write_allocations — write_allocations","text":"project_status_to_write - value project_status export. Use 0 development. Use 1 Production allocations - dataframe randomization allocation data exported `export_allocation_tables_from_project` target_directory - directory function write files","code":""},{"path":"/reference/write_allocations.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"write_allocations — write_allocations","text":"full path allocations file","code":""},{"path":"/reference/write_allocations.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"write_allocations — write_allocations","text":"","code":"if (FALSE) { # get and print importable allocations if we need them for reference allocations <- export_allocation_tables_from_project( conn = source_conn, project_id_to_export = source_project_id ) # write both files walk(c(0,1), write_allocations, allocations, \"output\") }"},{"path":"/reference/write_debug_job_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write a debug log entry for the job — write_debug_job_log_entry","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"Write debug log entry job","code":""},{"path":"/reference/write_debug_job_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"","code":"write_debug_job_log_entry(con, job_duration, job_summary)"},{"path":"/reference/write_debug_job_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"con, DB connection job_duration, duration job seconds job_summary, summary job performed JSON","code":""},{"path":"/reference/write_debug_job_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write a debug log entry for the job — write_debug_job_log_entry","text":"","code":"if (FALSE) { write_debug_job_log_entry( conn = con, job_duration = 30, job_summary = as.json(\"Update vaccination status\") ) }"},{"path":"/reference/write_error_job_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an error log entry for the job — write_error_job_log_entry","title":"Write an error log entry for the job — write_error_job_log_entry","text":"Write error log entry job","code":""},{"path":"/reference/write_error_job_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an error log entry for the job — write_error_job_log_entry","text":"","code":"write_error_job_log_entry(con, job_duration, job_summary)"},{"path":"/reference/write_error_job_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an error log entry for the job — write_error_job_log_entry","text":"con, DB connection job_duration, duration job seconds job_summary, summary job performed JSON","code":""},{"path":"/reference/write_error_job_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an error log entry for the job — write_error_job_log_entry","text":"","code":"if (FALSE) { write_error_job_log_entry( conn = con, job_duration = 30, job_summary = as.json(\"Update vaccination status\") ) }"},{"path":"/reference/write_error_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an error log entry — write_error_log_entry","title":"Write an error log entry — write_error_log_entry","text":"Write error log entry","code":""},{"path":"/reference/write_error_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an error log entry — write_error_log_entry","text":"","code":"write_error_log_entry(conn, target_db_name, table_written = NULL, df, pk_col)"},{"path":"/reference/write_error_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an error log entry — write_error_log_entry","text":"conn, DB connection target_db_name, database write table_written, table written df, data write pk_col, dataframe col use primary_key","code":""},{"path":"/reference/write_error_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an error log entry — write_error_log_entry","text":"","code":"if (FALSE) { write_error_log_entry( conn = con, target_db_name = rc_case, table_written = \"cases\", df = data_written, pk_col = \"record_id\" ) }"},{"path":"/reference/write_info_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an info log entry — write_info_log_entry","title":"Write an info log entry — write_info_log_entry","text":"Write info log entry","code":""},{"path":"/reference/write_info_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an info log entry — write_info_log_entry","text":"","code":"write_info_log_entry(conn, target_db_name, table_written = NULL, df, pk_col)"},{"path":"/reference/write_info_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an info log entry — write_info_log_entry","text":"conn, DB connection target_db_name, database write table_written, table written df, data write pk_col, dataframe col use primary_key","code":""},{"path":"/reference/write_info_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an info log entry — write_info_log_entry","text":"","code":"if (FALSE) { write_info_log_entry( conn = con, target_db_name = rc_case, table_written = \"cases\", df = data_written, pk_col = \"record_id\", ) }"},{"path":"/reference/write_success_job_log_entry.html","id":null,"dir":"Reference","previous_headings":"","what":"Write an success job log entry — write_success_job_log_entry","title":"Write an success job log entry — write_success_job_log_entry","text":"Write success job log entry","code":""},{"path":"/reference/write_success_job_log_entry.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write an success job log entry — write_success_job_log_entry","text":"","code":"write_success_job_log_entry(con, job_duration, job_summary)"},{"path":"/reference/write_success_job_log_entry.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write an success job log entry — write_success_job_log_entry","text":"con, DB connection job_duration, duration job seconds job_summary, summary job performed JSON","code":""},{"path":"/reference/write_success_job_log_entry.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write an success job log entry — write_success_job_log_entry","text":"","code":"if (FALSE) { write_success_job_log_entry( conn = con, job_duration = 30, job_summary = as.json(\"Update vaccination status\") ) }"},{"path":"/reference/write_summary_metrics.html","id":null,"dir":"Reference","previous_headings":"","what":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"Format write summary metrics redcap_summary_metrics table LOG_DB","code":""},{"path":"/reference/write_summary_metrics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"","code":"write_summary_metrics( reporting_period_start, reporting_period_end, metric_type, metric_dataframe, conn = NULL )"},{"path":"/reference/write_summary_metrics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"reporting_period_start datetime object, e.g. ymd_hms(\"2022-11-01 00:00:00\") reporting_period_end datetime object, e.g. ymd_hms(\"2022-12-01 00:00:00\") metric_type character string representing metric type, e.g. \"flux\", \"state\" metric_dataframe wide data frame key-value pairs single row data conn DBI connection object database holds `redcap_summary_metrics` table. Can left NULL connection available package scope var \"log_con\".","code":""},{"path":"/reference/write_summary_metrics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"nothing","code":""},{"path":"/reference/write_summary_metrics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format and write summary metrics to the redcap_summary_metrics table in your LOG_DB — write_summary_metrics","text":"","code":"if (FALSE) { write_summary_metrics( reporting_period_start = ymd_hms(\"2022-01-01 00:00:00\", tz=Sys.getenv(\"TIME_ZONE\")), reporting_period_end = ceiling_date(reporting_period_start, \"month\", change_on_boundary = T), metric_type = \"state\", metric_dataframe = my_cool_df, conn = my_conn ) }"},{"path":"/reference/write_to_sql_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"Write MySQL Database error checking email alerting failure","code":""},{"path":"/reference/write_to_sql_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"","code":"write_to_sql_db( conn, table_name, df_to_write, schema, overwrite, db_name, is_log_con = FALSE, continue_on_error = FALSE, ... )"},{"path":"/reference/write_to_sql_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"conn DBI database connection table_name name table write df_to_write data frame write _table_name_ schema database write overwrite logical controls whether overwrite table db_name name database written is_log_con FALSE log failures, TRUE attempt log errors continue_on_error TRUE continue execution error, FALSE quit non interactive sessions error ... Additional parameters passed DBI::dbWriteTable","code":""},{"path":"/reference/write_to_sql_db.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"value returned","code":""},{"path":"/reference/write_to_sql_db.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write to a MySQL Database with error checking and email alerting on failure — write_to_sql_db","text":"","code":"if (FALSE) { write_to_sql_db( conn = con, table_name = \"my_table\", df_to_write = rule_output, schema = Sys.getenv(\"ETL_DB_SCHEMA\"), overwrite = FALSE, db_name = Sys.getenv(\"ETL_DB_NAME\"), append = TRUE ) }"},{"path":"/news/index.html","id":"redcapcustodian-1200-released-2024-02-28","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.20.0 (released 2024-02-28)","title":"redcapcustodian 1.20.0 (released 2024-02-28)","text":"Add get_redcap_credentials() (@ljwoodley, #149, #151) Revert “add redcap wrapper functions” (@ljwoodley, #149, #150)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1190-released-2024-01-30","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.19.0 (released 2024-01-30)","title":"redcapcustodian 1.19.0 (released 2024-01-30)","text":"Add REDCapR wrapper functions (@ljwoodley, #147, #148)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1180-released-2024-01-10","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.18.0 (released 2024-01-10)","title":"redcapcustodian 1.18.0 (released 2024-01-10)","text":"Update Dockerfile verse:4.3.2 (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1174-released-2023-11-22","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.4 (released 2023-11-22)","title":"redcapcustodian 1.17.4 (released 2023-11-22)","text":"Turn code chunks job_logging.Rmd fix pkgdown::deploy_to_branch() errors (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1173-released-2023-11-21","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.3 (released 2023-11-21)","title":"redcapcustodian 1.17.3 (released 2023-11-21)","text":"Fix 4 intermittent test failures caused environment vars (@pbchase, #143) Fix error test ‘init_etl properly sets script name, script run time, initializes log connection’ (@pbchase, #143) Fix 11 warnings dplyr::all_equal() tests (@pbchase, #143) Address lots pkgdown::build_site() complaints garbage-collected connections (@pbchase, @ChemiKyle, #143) Address pkgdown::build_site() complaints non-parsable code examples (@pbchase, @ChemiKyle, #104, #143) Update vignettes/job_logging.Rmd fix build errors (@pbchase, #143)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1172-released-2023-11-17","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.2 (released 2023-11-17)","title":"redcapcustodian 1.17.2 (released 2023-11-17)","text":"Update vignettes/job_logging.Rmd fix build errors (@pbchase, #142)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1171-released-2023-11-17","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.1 (released 2023-11-17)","title":"redcapcustodian 1.17.1 (released 2023-11-17)","text":"Fix build failures caused vignettes/job_logging.Rmd (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1170-released-2023-11-17","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.17.0 (released 2023-11-17)","title":"redcapcustodian 1.17.0 (released 2023-11-17)","text":"Add job_logging vignette (@pbchase, #113, #115) Add objects_to_include param unnest_job_summary_data_json_object() (@pbchase, #112, #115)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1160-released-2023-11-16","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.16.0 (released 2023-11-16)","title":"redcapcustodian 1.16.0 (released 2023-11-16)","text":"Add MySQL database comparison tools (@pbchase, @ChemiKyle, #140)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1150-released-2023-10-31","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.15.0 (released 2023-10-31)","title":"redcapcustodian 1.15.0 (released 2023-10-31)","text":"Fix test data get_redcap_email_revisions() (@pbchase) Add delete_project() (@ljwoodley, #139) Add dataframe_to_redcap_dictionary() (@ljwoodley, #136)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1141-released-2023-08-24","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.14.1 (released 2023-08-24)","title":"redcapcustodian 1.14.1 (released 2023-08-24)","text":"Update etl/delete_erroneous_survey_reminders.R (@pbchase, #137)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1140-released-2023-08-14","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.14.0 (released 2023-08-14)","title":"redcapcustodian 1.14.0 (released 2023-08-14)","text":"Fix build issues Apple silicon (@pbchase, #133, #134) Add delete_erroneous_survey_reminders.R (@pbchase, #131, #132)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1131-released-2023-08-04","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.13.1 (released 2023-08-04)","title":"redcapcustodian 1.13.1 (released 2023-08-04)","text":"update render_report handle qmd files (@ljwoodley, #117, #129) Add LICENSE (@pbchase, #119, #124)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1130-released-2023-06-23","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.13.0 (released 2023-06-23)","title":"redcapcustodian 1.13.0 (released 2023-06-23)","text":"Add project_purpose_other_research_labels.rda (@pbchase, #123) Add project_status_labels project_purpose_labels (@pbchase, #122) Add conn parameter write_summary_metrics() (@pbchase, #122) Add copy_entire_table_to_db() (@pbchase, #122) Update render_report.R support quarto files (@pbchase, #118)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1120-released-2023-06-02","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.12.0 (released 2023-06-02)","title":"redcapcustodian 1.12.0 (released 2023-06-02)","text":"Add unnest_job_summary_data_json_object() (@pbchase, #111) Fix Version DESCRIPTION (@pbchase)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1110-released-2023-05-10","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.11.0 (released 2023-05-10)","title":"redcapcustodian 1.11.0 (released 2023-05-10)","text":"Add description_base_name get_project_life_cycle() output. (@pbchase, #110) Expand list descriptions project_life_cycle_descriptions include modern descriptions.(@pbchase, #110)","code":""},{"path":"/news/index.html","id":"redcapcustodian-1100-released-2023-04-24","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.10.0 (released 2023-04-24)","title":"redcapcustodian 1.10.0 (released 2023-04-24)","text":"Add project_life_cycle_descriptions (@pbchase, #106) Add get_project_life_cycle() (@pbchase, #106)","code":""},{"path":"/news/index.html","id":"redcapcustodian-190-released-2023-04-24","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.9.0 (released 2023-04-24)","title":"redcapcustodian 1.9.0 (released 2023-04-24)","text":"Add quarto tlmgr packages needs pdf generation (@pbchase, #107)","code":""},{"path":"/news/index.html","id":"redcapcustodian-181-released-2023-03-20","dir":"Changelog","previous_headings":"","what":"redcapcustodian 1.8.1 (released 2023-03-20)","title":"redcapcustodian 1.8.1 (released 2023-03-20)","text":"Update NEWS.md DESCRIPTION comply pkgdown (@pbchase, #103)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-8-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.8.0 (released 2023-03-17)","text":"Add log database system dev work (@pbchase, #110)","code":""},{"path":"/news/index.html","id":"changed-1-8-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.8.0 (released 2023-03-17)","text":"Fix ORCIDs DESCRIPTION (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-7-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.7.0 (released 2023-03-17)","text":"Add pkgdown website (@pbchase, #102)","code":""},{"path":"/news/index.html","id":"changed-1-7-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.7.0 (released 2023-03-17)","text":"Revise package title away REDCap towards automation (@pbchase) Remove publication_date .zenodo.json (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-6-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.6.0 (released 2023-02-21)","text":"Add randomization management functions sample ETL (@pbchase, #99) Add batch_size parm dbx calls sync_table_2 (@pbchase) Add batch_size parm dbx calls sync_table Prevents possible error: Expression tree large (maximum depth 1000) (@ChemiKyle, #96)","code":""},{"path":"/news/index.html","id":"changed-1-6-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.6.0 (released 2023-02-21)","text":"Update testing image used github (@pbchase) Eschew deprecated tidyselect features (@pbchase, #98) Modernize tests sync_table_2 (@pbchase) Address fatal bug sync_table caused delete = T records delete (@ChemiKyle, #97)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-5-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.5.0 (released 2023-01-25)","text":"Create write_summary_metrics function, corresponding schema test (@ChemiKyle, #95) Add render_report /report (@ljwoodley, #93) Port convert_schema_to_sqlite rcc.billing, altering accept path sql file input (@ChemiKyle, #94) Port mutate_columns_to_posixct rcc.billing (@ChemiKyle, #94)","code":""},{"path":"/news/index.html","id":"changed-1-5-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.5.0 (released 2023-01-25)","text":"Ignore local credentials DBs (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-4-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.4.1 (released 2022-12-15)","text":"Install latex packages directly Dockerfile (@ljwoodley, #91)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-4-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.4.0 (released 2022-12-13)","text":"Switch Dockerfile tidyverse verse (@ljwoodley, #90) Add render_report.R render Rmds (@ljwoodley, #90)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-3-2","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.3.2 (released 2022-09-14)","text":"Specify package na.exclude() (@pbchase) escape . treat literal character instead wildcard gsub statements (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-3-1","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.3.1 (released 2022-08-30)","text":"Remove remants site concept (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-3-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.3.0 (released 2022-08-29)","text":"Add get_bad_emails_from_individual_emails function (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-2-2","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.2.2 (released 2022-08-26)","text":"Modernize container add dependencies (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-2-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.2.1 (released 2022-08-26)","text":"Move schema files package space (@pbchase) Correct send_email using email_to email_cc (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-2-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.2.0 (released 2022-08-25)","text":"Add email_from email_cc params send_email function, default env value (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-1-1-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.1.1 (released 2022-08-24)","text":"Fix test search results get_bad_emails_from_listserv_digest (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-1-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.1.0 (released 2022-08-08)","text":"Add logging Friday Call demo (@pbchase)","code":""},{"path":"/news/index.html","id":"changed-1-1-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.1.0 (released 2022-08-08)","text":"Define username tube count variables friday call demo (@ChemiKyle) Move fake data section setup file Friday Call Demo (@pbchase) Move credential creation scraping main friday call auxiliary setup file (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-1-0-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 1.0.0 (released 2022-08-02)","text":"Add logging suspend_users_with_no_primary_email (@pbchase) Add sync_table2 merge dataset_diff sync_table (@pbchase) Add expire_user_project_rights (@pbchase)","code":""},{"path":"/news/index.html","id":"changed-1-0-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 1.0.0 (released 2022-08-02)","text":"Use sync_table_2 update_redcap_email_addresses (@pbchase) Refactor tests test data related cleanup_bad_email_addresses.R (@pbchase) Remove credentials public image (@mbentz-uf) Fix deployment cron file (@pbchase) Add common directories template ignore files (@pbchase) Fix ADD .study (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-7-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.7.0 (released 2022-07-17)","text":"Add package Dockerfile (@pbchase) Add send_email function adapted stp (@ChemiKyle) Add DOI badge README (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-6-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.6.1 (released 2022-07-13)","text":"Fix typo description (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-6-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.6.0 (released 2022-07-13)","text":"Add resources publication (@pbchase) Add friday-call-demo.Rmd (@ChemiKyle, @pbchase)","code":""},{"path":"/news/index.html","id":"changed-0-6-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.6.0 (released 2022-07-13)","text":"Update ignore files respect new features (@pbchase) Replace reference stp rcc.billing (@ChemiKyle) Enlarge job_summary_data field rcc_job_log (@pbchase) Add new content custom_rscript (@pbchase) Make docs study-centric (@pbchase) Update DESCRIPTION init_etl.Rd satisfy R 4.2.1 (@pbchase) Use *_PORT_DB connect_to_db, defaulting 3306 (@ChemiKyle) Move credentials DB (@pbchase) Reduce earliest_date cleanup_bad_email_addresses.R (@pbchase) Use MariaDB default driver init_etl (@pbchase) Update username my_username avoid tautological filter credential gathering (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-5-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.5.1 (released 2022-06-24)","text":"Export email-fixing functions (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-5-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.5.0 (released 2022-06-23)","text":"Add first version demonstration script (@pbchase) Add sync_table (@ChemiKyle) Add dataset_diff (@pbchase) Add multi_instance.R (@ChemiKyle) Add sync_metadata using credentials (@ChemiKyle) Add scrape_user_api_tokens (@ChemiKyle) Add set_super_api_token (@ChemiKyle) Add set_project_api_token (@ChemiKyle) Add ETL job logging(@mbentz-uf) Add cleanup_bad_email_addresses (@ljwoodley)","code":""},{"path":"/news/index.html","id":"changed-0-5-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.5.0 (released 2022-06-23)","text":"Ignore site_template build (@pbchase) Ignore ./output/ (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"changed-0-4-1","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.4.1 (released 2022-03-04)","text":"Fix build.sh deployment bugs (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-4-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.4.0 (released 2022-03-03)","text":"Remove host image concet deploy site project (@pbchase)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-3-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.3.0 (released 2022-03-03)","text":"Add mRpostman writexl Dockerfile (@pbchase) Add suspend_users_with_no_primary_email (@ljwoodley) Add update_redcap_email_addresses (@ljwoodley)","code":""},{"path":"/news/index.html","id":"changed-0-3-0","dir":"Changelog","previous_headings":"","what":"Changed","title":"redcapcustodian 0.3.0 (released 2022-03-03)","text":"Fix get_redcap_email_revisions match initial implementation allows create data result user suspension (@ChemiKyle)","code":""},{"path":[]},{"path":"/news/index.html","id":"added-0-2-0","dir":"Changelog","previous_headings":"","what":"Added","title":"redcapcustodian 0.2.0 (released 2022-02-16)","text":"Add get_redcap_email_revisions (@mbentz-uf) Add automated tests (@mbentz-uf) Add create_test_tables (@ChemiKyle) Add test tables (@ChemiKyle) Add get_bad_emails_from_listserv_digest (@pbchase) Add get_institutional_person_data (@pbchase) Add get_redcap_emails (@pbchase) Add create_test_table (@pbchase) Add site concept docs (@pbchase) Add add_get_redcap_db_connection (@pbchase) Store rc_conn env (@pbchase) Add add_connect_to_redcap_db (@pbchase) Add basic logging (@mbentz-uf)","code":""},{"path":[]},{"path":"/news/index.html","id":"summary-0-1-0","dir":"Changelog","previous_headings":"","what":"Summary","title":"redcapcustodian 0.1.0 (released 2021-06-22)","text":"Initial commit redcapcustodian Scripted image building. Scripted deployment. redcapcustodian R package testthat redcapcustodian tests Host-specific customization R scripts Host-specific customization cron-files Host-specific customization environment files","code":""}]
diff --git a/sitemap.xml b/sitemap.xml
index 9d5f987..148768f 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -132,6 +132,9 @@
/reference/get_project_life_cycle.html
+
+ /reference/get_redcap_credentials.html
+
/reference/get_redcap_db_connection.html
@@ -204,12 +207,6 @@
/reference/quit_non_interactive_run.html
-
- /reference/read_project_data.html
-
-
- /reference/read_project_metadata.html
-
/reference/scrape_user_api_tokens.html
@@ -285,9 +282,6 @@
/reference/write_info_log_entry.html
-
- /reference/write_project_data.html
-
/reference/write_success_job_log_entry.html