Customizing PoCDART

Customizing PoCDART Dashboard


Once your associated REDCap project is up and running, you need to customize the R code associated with your PoCDART Dashboard. If you have not already downloaded the PoCDART git repository from our associated site, please do so now. If you already have the repository downloaded, please perform the following steps:

  • Move the contents of the repository to a directory in your shiny-server (/srv/shiny-server/*) - name it in some way associated with your REDCap project for clarity if you have multiple dashboards running.
  • Create a keys.R file and place it into the shiny_code_repo/redcap_api/ directory. Use the following as a template:
api_url <- "<url to your redcap api>"
offnetwork_url <- "<url to your redcap api>"
getRedcapToken <- function(key_name) {
  keys <- c("<project specific name>" = "<project specific api key>")
  return(keys[key_name])
}

With these steps complete, you've setup the necessary pieces for your dashboard to import and export data from your REDCap project. Next, we begin customizing the global_variables.R and cron.R files.

Customizing the cron.R files


dart_cron.R and update_cron.R are both triggered by Cron Jobs, and as such need to set the correct working directory early on. Perform the following:

Change setwd("/srv/shiny-server/pocdart") to setwd("/srv/shiny-server/<project specific directory>")

 

Customizing global_variables.R


The script global_variables.R stores a number of variables used by PoCDART in order to render, process, and schedule assessments. We're going to step through variable by variable for customization purposes

assay_list: A named list used to define the "endpoint" and "repeating" assessments. Simply replace the instruments in the example code with the instrument names used in your events

public_survey_url: If using REDCap surveys to include new patients, replace this with the public survey URL from your project

FREQUENCY: A numeric value indicating the time between assessments.

EXPIRATION: A numeric value indicating the number of days after the assessment is due to automatically expire the survey

INVITE: A numeric value indicating when the patient may take the survey ahead of time.

FUTUREWINDOW: A numeric value indicating the number of days before the assessment the patient should show up as 'Upcoming'

admission_form - The REDCap instrument name where patients are registered and demographic information is stored. Update to match your REDCap instance

starting_instrument - The REDCap instrument name that begins the assessment for admission and repeating events. Update to match your REDCap instance.

discharge_instrument - The REDCap instrument name that begins the assessment for discharge events. Update to match your REDCap instance.

expiration_instrument - The REDCap instrument name associated with an expiration instrument, used for storing information about why the survey was missed. Update to match your REDCap instance.

survey_key - Calls the key.R file generated earlier to get the API Key. Update to call the <project specific name> used in the keys.R file

events - A list of events associated with admission, repeating, and discharge. Update to match your REDCap instance.

project_string - A string used for associating projects with variables. Update to a desired project specific string

 

Add a comment or report a problem with this page

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.