diff --git a/_pkgdown.yml b/_pkgdown.yml index 7539e8eb..e59b58b6 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: https://pages.github.com/SafetyGraphics/safetyGraphics +url: https://safetygraphics.github.io/safetyGraphics template: params: @@ -68,10 +68,6 @@ reference: - settingsMappingUI - settingsCode - settingsCodeUI - - title: Data - desc: Data sets used in the apps - contents: - - meta - title: Helper Functions desc: Utility functions used in the apps contents: @@ -86,4 +82,5 @@ reference: - makeChartParams - makeChartSummary - makeMapping + - makeMeta - prepareChart diff --git a/docs/404.html b/docs/404.html index 1013dc52..8da3389f 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,66 +1,27 @@ - - - - + + + + - Page not found (404) • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - -
-
- + +
+ + + - - -
+
+
-
+ + - - diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index b5b04273..a621d578 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,66 +1,12 @@ - - - - - - - -License • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -License • safetyGraphics - - + + - - -
-
- -
- -
+
+
-
- +
- - + + diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 96f3686c..4d36dbb6 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -1,66 +1,12 @@ - - - - - - - -MIT License • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MIT License • safetyGraphics - - + + - - -
-
- -
- -
+
+
-
- +
- - + + diff --git a/docs/articles/Cookbook.html b/docs/articles/Cookbook.html index 8c1cafed..fe4fe789 100644 --- a/docs/articles/Cookbook.html +++ b/docs/articles/Cookbook.html @@ -19,6 +19,8 @@ + +
+
-
-

-Cookbook Vignette

-

This vignette contains a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios. For a general overview of the app see this vignette. For more details about adding custom charts, see this vignette.

-
-

-Setup and installation

+
+

Cookbook Vignette +

+

This vignette contains a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios.

+
+
+

Overview +

+

Most of the customization shown here is done by changing 4 key parameters in the safetyGraphicsApp() function:

+
    +
  • +domainData – Domain-level Study Data
  • +
  • +mapping – List identifying the key columns/fields in your data
  • +
  • +charts – Define the charts used in the app.
  • +
  • +meta – Metadata table with info about required columns and fields
  • +
+

domainData and mapping generally change for every study, while charts and meta can generally be re-used across many studies.

+

The examples here are generally provided with minimal explanation. For a more detailed discussion of the logic behind these examples see the Chart Configuration Vignette or our 2021 R/Pharma Workshop

+
+
+

Setup and installation +

safetyGraphics requires R v4 or higher. These examples have been tested using RStudio v1.4, but should work on other platforms with proper configuration.

-

You can install safetyGraphics from CRAN like any other R package:

-
install.packages("safetyGraphics")
-library("safetyGraphics")
+

You can install safetyGraphics from CRAN like any other R package:

+
install.packages("safetyGraphics")
+library("safetyGraphics")

Or to use the most recent development version from GitHub, call:

-
devtools::install_github("safetyGraphics/safetyCharts", ref="dev")
-library(safetyCharts)
-devtools::install_github("safetyGraphics/safetyGraphics", ref="dev")
-library(safetyGraphics)
-safetyGraphics::safetyGraphicsApp()
-
-
-

-Example 1 - Default App

+
devtools::install_github("safetyGraphics/safetyCharts", ref="dev")
+library(safetyCharts)
+devtools::install_github("safetyGraphics/safetyGraphics", ref="dev")
+library(safetyGraphics)
+safetyGraphics::safetyGraphicsApp()
+
+

Example 1 - Default App +

To run the app with no customizations using sample AdAM data from the {safetyData} package, install the package and run:

-
safetyGraphics::safetyGraphicsApp()
-
-
-

-Example 2 - SDTM Data

-

The data passed in to the safetyGraphics app can be customized using the data parameter in safetyGraphicsApp(). For example, to run the app with SDTM data saved in {safetyData}, call:

-
sdtm <- list(
-    dm=safetyData::sdtm_dm,
-    aes=safetyData::sdtm_ae,
-    labs=safetyData::sdtm_lb
-)
-
-safetyGraphics::safetyGraphicsApp(domainData=sdtm)
-
-
-

-Example 3 - Single Data Domain

+
safetyGraphics::safetyGraphicsApp()
+
+
+
+

Loading Custom Data +

+

The next several examples focus on study-specific customizations for loading and mapping data.

+
+

Example 2 - SDTM Data +

+

The data passed in to the safetyGraphics app can be customized using the domainData parameter in safetyGraphicsApp(). For example, to run the app with SDTM data saved in {safetyData}, call:

+
sdtm <- list(
+    dm=safetyData::sdtm_dm,
+    aes=safetyData::sdtm_ae,
+    labs=safetyData::sdtm_lb
+)
+
+safetyGraphics::safetyGraphicsApp(domainData=sdtm)
+
+
+

Example 3 - Single Data Domain +

Running the app for a single data domain, is similar:

-
justLabs <- list(labs=safetyData::adam_adlbc)
-safetyGraphics::safetyGraphicsApp(domainData=justLabs)
+
justLabs <- list(labs=safetyData::adam_adlbc)
+safetyGraphics::safetyGraphicsApp(domainData=justLabs)

Note that charts with missing data are automatically dropped and the filtering tab is not present since it requires demographics data by default.

-
-

-Example 4 - Drop Unwanted Charts

-

Users can also generate a list of charts and then drop charts that they don’t want to include. For example, if you wanted to drop charts with type of “htmlwidgets” you could run this code.

-
library(purrr)
-charts <- makeChartConfig() #gets charts from safetyCharts pacakge by default
-notWidgets <- charts %>% purrr::keep(~.x$type != "htmlwidget")
-safetyGraphicsApp(charts=notWidgets)
-
-
-

-Example 6 - Add a chart

-

The code below adds a new simple chart showing participants’ age distribution by sex.

-
ageDist <- function(data, settings){
-    p<-ggplot(data = data, aes_(x=as.name(settings$age_col))) +
-        geom_histogram() + 
-        facet_wrap(as.name(settings$sex_col))
-    return(p)
-}
-ageDist_chart<-list(
-    env="safetyGraphics",
-    name="ageDist",
-    label="Age Distribution",
-    type="plot",
-    domain="dm",
-    workflow=list(
-        main="ageDist"
-    )
-)
-charts <- makeChartConfig() 
-charts$ageDist<-ageDist_chart
-safetyGraphicsApp(charts=charts)
-

For extensive details on adding and customizing different types of charts, see this vignette.

-
-
-

-Example 7 - Non-standard data

+
+

Example 4 - Loading other data formats +

+

Users can also import data from a wide-variety of data formats using standard R workflows and then initialize the app. The example below initializes the app using lab data saved as a sas transport file (.xpt)

+
xptLabs <- haven::read_xpt('https://github.com/phuse-org/phuse-scripts/blob/master/data/adam/cdiscpilot01/adlbc.xpt?raw=true')
+safetyGraphics::safetyGraphicsApp(domainData=list(labs=xptLabs))
+
+
+

Example 5 - Non-standard data +

Next, let’s initialize the the app with non-standard data. {safetyGraphics} automatically detects AdAM and SDTM data when possible, but for non-standard data, the user must provide a data mapping. This can be done in the app using the data/mapping tab, or can be done when the app is initialized by passing a mapping list to safetyGraphicsApp(). For example:

-
notAdAM <- list(labs=safetyData::adam_adlbc %>% rename(id = USUBJID))
-idMapping<- list(labs=list(id_col="id"))
-safetyGraphicsApp(domainData=notAdAM, mapping=idMapping)
-
-
-

-Example 8 - Non-standard data #2

-

For a more realistic example, consider this labs data set (csv). The data can be loaded in to safetyGraphics with the code below, but several items in the mapping page need to be filled in:

-
labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv")
-safetyGraphics::safetyGraphicsApp(domainData=list(labs=labs))
+
notAdAM <- list(labs=safetyData::adam_adlbc %>% rename(id = USUBJID))
+idMapping<- list(labs=list(id_col="id"))
+safetyGraphicsApp(domainData=notAdAM, mapping=idMapping)
+
+
+

Example 6 - Non-standard data #2 +

+

For a more realistic example, consider this labs data set (csv). The data can be loaded in to safetyGraphics with the code below, but several items in the mapping page need to be filled in:

+
labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv")
+safetyGraphics::safetyGraphicsApp(domainData=list(labs=labs))

drawing

Fortunately there is no need to re-enter this mapping information in every time you re-start the app. After filling in these values once, you can export code to restart the app with the specified settings pre-populated. First, click on the setting icon in the header and then on “code” to see this page:

The YAML code provided here captures the updates you’ve made on the mapping page. To re-start the app with those settings, just save these YAML code in a new file called customSettings.yaml in your working directory, and then call:

-
labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv")
-customMapping <- read_yaml("customSettings.yaml")
-safetyGraphics::safetyGraphicsApp(
-    domainData=list(labs=labs),
-    mapping=customMapping   
-)
+
labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv")
+customMapping <- read_yaml("customSettings.yaml")
+safetyGraphics::safetyGraphicsApp(
+    domainData=list(labs=labs),
+    mapping=customMapping   
+)

Note, that for more complex customizations, the setting page also provides a .zip file with a fully re-usable version of the app.

+
+
+

Custom Charts +

+

The remaining examples focus on creating charts that are reusable across many studies. For extensive details on adding and customizing different types of charts, see this vignette.

+
+

Example 7 - Drop Unwanted Charts +

+

Users can also generate a list of charts and then drop charts that they don’t want to include. For example, if you wanted to drop charts with type of “htmlwidgets” you could run this code.

+
library(purrr)
+charts <- makeChartConfig() #gets charts from safetyCharts pacakge by default
+notWidgets <- charts %>% purrr::keep(~.x$type != "htmlwidget")
+safetyGraphicsApp(charts=notWidgets)
+
+
+

Example 8 - Edit Default Charts +

+

Users can also make modifications to the default charts by editing the list of charts directly.

+
charts <- makeChartConfig() #gets charts from safetyCharts pacakge by default
+charts$aeTimelines$label <- "An AMAZING timeline"
+safetyGraphicsApp(charts=charts)
+
+
+

Example 9 - Add Hello World Custom Chart +

+

This example creates a simple “hello world” chart that is not linked to the data or mapping loaded in the app.

+
helloWorld <- function(data, settings){
+    plot(-1:1, -1:1)
+    text(runif(20, -1,1),runif(20, -1,1),"Hello World")
+}
+
+# Chart Configuration
+helloworld_chart<-list(
+    env="safetyGraphics",
+    name="HelloWorld",
+    label="Hello World!",
+    type="plot",
+    domain="aes",
+    workflow=list(
+        main="helloWorld"
+    )
+)
+
+safetyGraphicsApp(charts=list(helloworld_chart))
+
+
+

Example 10 - Add a custom chart using data and settings +

+

The code below adds a new simple chart showing participants’ age distribution by sex.

+
ageDist <- function(data, settings){
+    p<-ggplot(data = data, aes(x=.data[[settings$age_col]])) +
+        geom_histogram() + 
+        facet_wrap(settings$sex_col)
+    return(p)
+}
+
+ageDist_chart<-list(
+    env="safetyGraphics",
+    name="ageDist",
+    label="Age Distribution",
+    type="plot",
+    domain="dm",
+    workflow=list(
+        main="ageDist"
+    )
+)
+charts <- makeChartConfig() 
+charts$ageDist<-ageDist_chart
+safetyGraphicsApp(charts=charts)
+
+
+

Example 11 - Create a Hello World Data Domain and Chart +

+

Here we extend example 9 to include the creating of a new data domain with custom metadata, which is bound to the chart object as chart$meta. See ?makeMeta for more detail about the creation of custom metadata.

+
helloMeta <- tribble(
+    ~text_key, ~domain, ~label,       ~standard_hello, ~description,
+    "x_col",   "hello", "x position", "x",             "x position for points in hello world chart",   
+    "y_col",   "hello", "y position", "y",             "y position for points in hello world chart"   
+) %>% mutate(
+    col_key = text_key,
+    type="column"
+)
+
+helloData<-data.frame(x=runif(50, -1,1), y=runif(50, -1,1))
+
+helloWorld <- function(data, settings){
+    plot(-1:1, -1:1)
+    text(data[[settings$x_col]], data[[settings$y_col]], "Custom Hello Domain!")
+}
+
+helloChart<-prepareChart(
+    list(
+        env="safetyGraphics",
+        name="HelloWorld",
+        label="Hello World!",
+        type="plot",
+        domain="hello",
+        workflow=list(
+            main="helloWorld"
+        ), 
+        meta=helloMeta
+    )
+)
+
+charts <- makeChartConfig()
+charts$hello <- helloChart #Easy to combine default and custom charts
+data<-list(
+    labs=safetyData::adam_adlbc, 
+    aes=safetyData::adam_adae, 
+    dm=safetyData::adam_adsl,
+    hello=helloData
+)
+
+#no need to specify meta since safetyGraphics::makeMeta() will generate the correct list by default. 
+safetyGraphicsApp(
+    domainData=data, 
+    charts=charts
+)
+
+
+

Example 13 - Create an ECG Data Domain & Chart +

+

This example defines a custom ECG data domain and adapts an existing chart for usage there. See this PR for a full implementation of the ECG domain in safetyCharts.

+
adeg <- readr::read_csv("https://physionet.org/files/ecgcipa/1.0.0/adeg.csv?download")
+
+ecg_meta <-tibble::tribble(
+    ~text_key, ~domain,                      ~label,                               ~description, ~standard_adam, ~standard_sdtm,
+    "id_col",   "custom_ecg",                 "ID column", "Unique subject identifier variable name.",      "USUBJID",      "USUBJID",
+    "value_col",   "custom_ecg",              "Value column",                 "QT result variable name.",         "AVAL",     "EGSTRESN",
+    "measure_col",   "custom_ecg",            "Measure column",                 "QT measure variable name",        "PARAM",       "EGTEST",
+"studyday_col",   "custom_ecg",          "Study Day column",                  "Visit day variable name",          "ADY",         "EGDY",
+    "visit_col",   "custom_ecg",              "Visit column",                      "Visit variable name",         "ATPT",        "EGTPT",
+    "visitn_col",   "custom_ecg",       "Visit number column",               "Visit number variable name",        "ATPTN",             NA,
+    "period_col",   "custom_ecg",             "Period column",                     "Period variable name",      "APERIOD",             NA,
+    "unit_col",   "custom_ecg",               "Unit column",            "Unit of measure variable name",        "AVALU",     "EGSTRESU"
+) %>% mutate(
+    col_key = text_key,
+    type="column"
+)
+
+qtOutliers<-prepare_chart(read_yaml('https://raw.githubusercontent.com/SafetyGraphics/safetyCharts/dev/inst/config/safetyOutlierExplorer.yaml') )
+qtOutliers$label <- "QT Outlier explorer"
+qtOutliers$domain <- "custom_ecg"
+qtOutliers$meta <- ecg_meta
+
+safetyGraphicsApp(
+    meta=ecg_meta, 
+    domainData=list(custom_ecg=adeg), 
+    charts=list(qtOutliers)
+)
+
@@ -221,11 +369,13 @@

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.2.

@@ -234,5 +384,7 @@

+ + diff --git a/docs/articles/Cookbook_files/header-attrs-2.13/header-attrs.js b/docs/articles/Cookbook_files/header-attrs-2.13/header-attrs.js new file mode 100644 index 00000000..dd57d92e --- /dev/null +++ b/docs/articles/Cookbook_files/header-attrs-2.13/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/articles/TechnicalFAQ.html b/docs/articles/TechnicalFAQ.html index 7fd91d2e..0143e58a 100644 --- a/docs/articles/TechnicalFAQ.html +++ b/docs/articles/TechnicalFAQ.html @@ -19,6 +19,8 @@ + +
+
-
-

-Technical FAQ Vignette

+
+

Technical FAQ Vignette +

This vignette answers frequently asked technical questions about {safetyGraphics}. It addressees questions on a variety of technical topics including Qualification and Validation status, Common Data Pipelines and Security.

-

Whenever new questions come in, we’ll update the version of this FAQ in our wiki - so check there first if you have a question. We’ll update the vignette on CRAN whenever a new version of the package is released.

-
-
-

-Validation, Quality Control and Testing

-
-

-Q: Is the safetyGraphics package validated?

-

A: As of the version 2 release, the safetyGraphics package is intended for exploratory use only and is not validated or qualified per 21 CFR Part 11. No warranty or guarantees are included as part of the package. Further, any formal validation should be fit for purpose and follow your organization’s procedures. That said, extensive quality checks are built in to the package (see the question below for details) and in to many of charts that are included by default. We follow the work of R Validation hub closely, and may release validation guidance based on the approach described in their white paper at a future date.

-
-
-

-Q: Can I validate charts created by safetyGraphics?

+

Whenever new questions come in, we’ll update the version of this FAQ in our wiki - so check there first if you have a question. We’ll update the vignette on CRAN whenever a new version of the package is released.

+
+
+

Contributing +

+
+

Q: Can I contribute code to the project? +

+

A: Yes. Check out our contributor guidelines. Feel free to follow-up with questions on the discussion board.

+
+
+

Q: Can I join the working group? +

+

A: Yes. Fill out this Google Form and we’ll get in touch.

+
+
+
+

Validation, Quality Control and Testing +

+
+

Q: Is the safetyGraphics package validated? +

+

A: As of the version 2 release, the safetyGraphics package is intended for exploratory use only and is not validated or qualified per 21 CFR Part 11. No warranty or guarantees are included as part of the package. Further, any formal validation should be fit for purpose and follow your organization’s procedures. That said, extensive quality checks are built in to the package (see the question below for details) and into many of charts that are included by default. The R Consortium has guidance on usage of R in Regulated Trials and we also follow the work of R Validation hub closely, and may release validation guidance based on the approach described in their white paper at a future date.

+
+
+

Q: Can I validate charts created by safetyGraphics? +

A: Study-specific instances of most safetyGraphics charts can be exported either as an R script or as a standalone html report. It may be possible to treat those outputs as standard TLFs (Tables, Listings and Figures) and conduct QC/Validation on them using standard statistical SOPs. Consult with your companies procedures to confirm.

-
-

-Q: What testing/QC process for safetyGraphics?

-

A: Several layers of quality control are included in our standard development workflow including: - Over 200 automated unit tests with testthat that run automatically via Continuous integration with GitHub actions. - Automated unit tests for shiny modules run via a headless browser using shinytest. - Pass all standard R checks in R cmd check - Full code review of all new functionality documented in GitHub PR. - Issue tracking in GitHub - Formal Alpha/Beta user testing before major releases - Basic user tests conducted before minor release

+
+

Q: What testing/QC process for safetyGraphics? +

+

A: Several layers of quality control are included in our standard development workflow including: - Over 200 automated unit tests with testthat that run automatically via Continuous integration with GitHub actions. - Automated unit tests for shiny modules run via a headless browser using shinytest. - Pass all standard R checks in R cmd check - Full code review of all new functionality documented in GitHub PR. - Issue tracking in GitHub - Formal Alpha/Beta user testing before major releases - Basic user tests conducted before minor release

+
+
+

Q: Is the safetyGraphics app ready for “production” use? +

+

A: As of the v2 release, safetyGraphics is mostly used in an exploratory fashion for a variety of use cases. The details of a ‘production’ implementation of safetyGraphics in a GxP environment would largely be dictated the intended use of the tool. For example, using safetyGraphics as your primary safety oversight platform would likely require more work than using it as a supplemental exploratory tool for biostatisticians.

+

That said, the issues surrounding a ‘production’ deployment are mostly technical and operational at this point and could likely be overcome by a motivated organization with ample technical expertise. Some of the issues that would need to be addressed in a production deployment:

+
    +
  • Qualification documentation (Organization-specific)
  • +
  • Formalized deployment pipeline for Shiny with proper authentication and security (Organization-specific)
  • +
  • App Maintenance model (Organization-specific)
  • +
  • Data pipeline for study set-up and customization (Organization-specific)
  • +
  • Issues with big data set performance in htmlwidget renderers
  • +
+

Many of these issues aren’t specific to safetyGraphics and may be easier to address for an organization that has experience using R and Shiny in production. As discussed above, there is a significant push towards using R for many aspects of clinical trials. We plan to keep safetyGraphics up to date with emerging best practices and will provide supporting documentation whenever possible.

+

Finally, it is worth noting “Productionize” and “Validate” are slightly different. Joe Cheng (the primary author of Shiny) has a nice talk on this topic from a software engineering perspective.

-
-

-Use Cases, Data Sources and Deployment

-
-

-Q: What are some common use cases for safetyGraphics?

+
+

Use Cases, Data Sources and Deployment +

+
+

Q: I can see that the software has the MIT license, so does this essentially mean that any company would be free to use the software without restriction? +

+

A: Yes. The package is open source and free to use. Here’s a link to the license and a quick summary of how it works.

+
+
+

Q: What are some common use cases for safetyGraphics? +

A: safetyGraphics graphics has been used in a variety of ways. Some of the most common use cases thus far are: - Analysts exploring safety data - Clinicians monitoring ongoing studies - Analysts and Clinicians evaluating safety signals in completed studies

-

As an open source tool with a flexible data pipeline, many other use cases have been discussed: - Data review by Data Safety Monitoring Boards (link) - Submissions to FDA (link) - Visualizing Analysis results data (link) - Risk based monitoring

-
-
-

-Q: Do I have to use a certain data standard with safetyGraphics?

-

A: No. Any standard (or non-standard) data can be loaded as long as it meets the minimum data requirements for the selected data domain. Metadata capturing default CDISC standards are included with the app (see ?safetyGraphics::meta) so that data mappings can be automatically populated when AdAM and SDTM data are loaded. Other data standards require the user to manually complete the data mapping in the mapping tab - see the cookbook vignette for examples.

-
-
-

-Q: What data sources does safetyGraphics support? How do I load custom data?

-

A: This topic is covered in detail in the [Loading data section of the Introductory vignette]https://github.com/SafetyGraphics/safetyGraphics/wiki/Intro#loading-study-data)safetyGraphics is designed to support a flexible data pipeline that supports many data types. In short, data can be loaded using the the dataDomains parameter in the safetyGraphicsApp() function or via the safetyGraphicsInit() graphical user interface.

-

safetyGraphicsApp() - custom data can be loaded via the dataDomains parameter, which should be a list containing dataframes or tibbles for each clinical domain; that list can be populated by importing data from any number of sources including databases, sas files or any number of other sources. See the cookbook vignette for some basic examples of loading custom data.

+

As an open source tool with a flexible data pipeline, many other use cases have been discussed: - Data review by Data Safety Monitoring Boards (link) - Visualizing Analysis results data (link) - Risk based monitoring

+
+
+

Q: Do I have to use a certain data standard with safetyGraphics? +

+

A: No. Any standard (or non-standard) data can be loaded as long as it meets the minimum data requirements for the selected data domain. Metadata capturing default CDISC standards are included with the app (see ?safetyGraphics::meta) so that data mappings can be automatically populated when AdAM and SDTM data are loaded. Other data standards require the user to manually complete the data mapping in the mapping tab - see the cookbook vignette for examples.

+
+
+

Q: What data sources does safetyGraphics support? How do I load custom data? +

+

A: This topic is covered in detail in the Loading data section of the Introductory vignette. safetyGraphics is designed to support a flexible data pipeline that supports many data types. In short, data can be loaded using the dataDomains parameter in the safetyGraphicsApp() function or via the safetyGraphicsInit() graphical user interface.

+

safetyGraphicsApp() - custom data can be loaded via the dataDomains parameter, which should be a list containing dataframes or tibbles for each clinical domain; that list can be populated by importing data from any number of sources including databases, sas files or any number of other sources. See the cookbook vignette for some basic examples of loading custom data.

safetyGraphicsInit() - allows users to load tabular data from a variety of sources using the point-and-click interface provided in the {datamods} package.

-

More detail is provided in the Loading data section of the Introductory vignette

-
-
-

-Q: How can the safetyGraphics app be shared?

-

A: The safetyGraphics app can be shared using standard shiny methodology. More details for a specific use cases are given in the next few questions. Charts created by safetyGraphics can also be exported and re-used. Charts created with htmlwidgets are especially flexible and can be used in many contexts - including in web applications outside of R.

-
-
-

-Q: Can I deploy safetyGraphics to shinyapps.io to explore trial data from my organization?

-

A: No, we advise against loading non-authorized, private, or non-deidentified patient data outside of your organization’s firewall. Consult with your IT and QA first. There is huge risk associated with confidentiality, IP, and patient privacy. Also refer to ShinyApps.io Chapter 8 Security and Compliance.

-
- -
-
-

-Misc.

-
-

-Q: How do I avoid R not choking on the huge volume of lab data? (from @AlbrechtDurer)

-

A: This is a very good question @AlbrechtDurer, and in my experience the answer is complex and varies for different use cases. Focusing on specific toxicities helps, but probably isn’t enough in really big studies. In those cases, I think the most important thing is to design a good data pipeline that includes both a database backend (as opposed to loading all of your study data each time you initialize the app) and visualizations that summarize the data in a reasonable way (as opposed to just plotting every single data point in a scatter plot no matter what). Fortunately this is all doable in R, and improvements in this area are our radar for safetyGraphics after v2 goes live.

+

More detail is provided in the Loading data section of the Introductory vignette

+
+
+

Is data loaded in to the safetyGraphics app secure? +

+

Since the safetyGraphics app typically uses data subject to GxP regulations, data security is extremely important and should always be discussed with your organizations IT and regulatory departments before loading any study data in to the application. No warranty or guarantees are included as part of the package.

+

Just like the discussion regarding Validation and Quality Control, data security requirements are dictated by the intended use of the app and should be fit for purpose. There are many different ways to run shiny applications, and the security implications of each approach varies. For example, having statisticians run the app locally using R Studio is quite different than deploying the app on a service like shinyapps.io. This complexity is all the more reason to discuss with IT. There are many resources - related to data security for clinical trials in general (1, 2, 3) and discussing data security in shiny (4, 5, 6) - that could help to facilitate these discussion.

+
+
+

Q: How can the safetyGraphics app be shared? +

+

A: The safetyGraphics app can be shared using standard shiny methodology. More details for specific use cases are given in the next few questions. Charts created by safetyGraphics can also be exported and re-used. Charts created with htmlwidgets are especially flexible and can be used in many contexts - including in web applications outside of R.

+
+
+

Q: Do you recommend deploying the app to a dedicated server for internal usage? +

+

A: It depends a bit on your use-case and how the app is hosted. For example, analysts using the data in an exploratory fashion can probably just run it from RStudio, but if multiple medical monitors using the app for medical monitoring in active studies probably need a more robust (and possibly validated) set up using Shiny Server, RStudio Connect or something similar.

+
+
+

Q: Can I deploy safetyGraphics to shinyapps.io to explore trial data from my organization? +

+

A: We advise against loading non-authorized, private, or non-deidentified patient data outside of your organization’s firewall. Consult with your IT and QA first. There is huge risk associated with confidentiality, IP, and patient privacy. Also refer to ShinyApps.io Chapter 8 Security and Compliance.

+
+
+

+Q: Can I deploy safetyGraphics to an internal RStudio Connect server? +

+

A: Yes. The script below should be easy to deploy via the RStudio interface or by running rsconnect::deployApp() and can easily be customized to support custom data and charts.

+
# Launch the ShinyApp (Do not remove this comment)
+library(safetyGraphics) 
+safetyGraphics::safetyGraphicsApp(runNow = FALSE)
+
+
+
+

Misc. +

+
+

Q: How do I avoid R not choking on the huge volume of lab data? (from @AlbrechtDurer) +

+

A: Several of the JavaScript charts build using htmlwidgets do have performance issues with very large data sets. Focusing on specific toxicities helps, but probably isn’t enough for really big studies. In those cases, I think the most important thing is to design a your data pipeline to include both a database backend (as opposed to loading all of your study data each time you initialize the app) and visualizations that summarize the data in a reasonable way (as opposed to just plotting every single data point in a scatter plot no matter what). Fortunately this is all doable in R, and improvements in this area are on our road map for future releases of safetyGraphics.

@@ -219,11 +239,13 @@

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.2.

@@ -232,5 +254,7 @@

+ + diff --git a/docs/articles/TechnicalFAQ_files/header-attrs-2.13/header-attrs.js b/docs/articles/TechnicalFAQ_files/header-attrs-2.13/header-attrs.js new file mode 100644 index 00000000..dd57d92e --- /dev/null +++ b/docs/articles/TechnicalFAQ_files/header-attrs-2.13/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/articles/chartConfiguration.html b/docs/articles/chartConfiguration.html index 6a8e07ee..46bd3c10 100644 --- a/docs/articles/chartConfiguration.html +++ b/docs/articles/chartConfiguration.html @@ -19,6 +19,8 @@ + +
+
-
-

-Chart Configuration Vignette

+
+

Chart Configuration Vignette +

The {safetyGraphics} shiny app can be used to display a wide variety of charts. This vignette provides details about the charting process including step-by-step instructions for adding new charts and technical specifications, but first we need to talk about a 2nd package …

-
-

-Introducing {safetyCharts}

+
+

Introducing {safetyCharts} +

While this is technically a vignette for {safetyGraphics}, the {safetyCharts} package is just as important here. The roles of the packages can be summarized in just a few words:

The {safetyGraphics} platform displays charts from {safetyCharts}.

This relationship is central to the technical framework for the safetyGraphics app. By itself, the safetyGraphics platform really doesn’t do much! In fact, none of the content on the Charts tab is actually found in the safetyGraphics package; it’s all imported from elsewhere! As you’ve probably guessed, the default charts live in the safetyCharts package. safetyCharts has over a dozen charts that are configured to work with {safetyGraphics}, but can also easily be used independently.

While {safetyGraphics} and {safetyCharts} are designed to work seamlessly together, users can also add charts from other packages. In fact, several charts in {safetyCharts} are just wrappers that load charts from other packages for use in {safetyGraphics}. The rest of this vignette provides a series of step-by-step examples detailing how this process works for different types of charts.

-
-

-{safetyGraphics} Chart Components

+
+

{safetyGraphics} Chart Components +

To add a chart to safetyGraphics, two components are required:

  1. A Configuration Object
  2. A Chart Function
-

The configuration file captures metadata about the chart for use in the app and is typically saved as a YAML file. Several example configuration files are provided in the examples below, and YAML Configuration files for {safetyCharts} are saved here.

+

The configuration file captures metadata about the chart for use in the app and is typically saved as a YAML file. Several example configuration files are provided in the examples below, and YAML Configuration files for {safetyCharts} are saved here.

The chart function typically takes a list of settings and a list of data as inputs and returns a chart object ready to be displayed in the app. Details of charting functions vary somewhat for different chart types, as explained in the examples below.

A full technical specification of this chart configuration framework is provided in Appendix 1.

-
-

-Example 1 - Hello World

+
+

Example 1 - Hello World +

Once you’ve created the configuration and chart functions, the chart can be added to the app via the charts parameter in safetyGraphicsApp(). Consider this simple “Hello World” example:

-
# Chart Function
-helloWorld <- function(data, settings){
-    plot(-1:1, -1:1)
-    text(runif(20, -1,1),runif(20, -1,1),"Hello World")
-}
+
# Chart Function
+helloWorld <- function(data, settings){
+    plot(-1:1, -1:1)
+    text(runif(20, -1,1),runif(20, -1,1),"Hello World")
+}
 
-# Chart Configuration
-helloworld_chart<-list(
-    env="safetyGraphics",
-    name="HelloWorld",
-    label="Hello World!",
-    type="plot",
-    domain="aes",
-    workflow=list(
-        main="helloWorld"
-    )
-)
+# Chart Configuration
+helloworld_chart<-list(
+    env="safetyGraphics",
+    name="HelloWorld",
+    label="Hello World!",
+    type="plot",
+    domain="aes",
+    workflow=list(
+        main="helloWorld"
+    )
+)
 
-safetyGraphicsApp(charts=list(helloworld_chart))
+safetyGraphicsApp(charts=list(helloworld_chart))

It’s also easy to add a custom chart to the default charts provided in {safetyCharts} using the makeChartConfig() function:

-
charts <- makeChartConfig(packages="safetyCharts") # or just makeChartConfig() since safetyCharts is included by default
-charts$helloworld<-helloworld_chart
-safetyGraphicsApp(charts=charts)
+
charts <- makeChartConfig(packages="safetyCharts") # or just makeChartConfig() since safetyCharts is included by default
+charts$helloworld<-helloworld_chart
+safetyGraphicsApp(charts=charts)

Here’s our Hello World the chart running in the app:

-
-

-Example 2 - Static Outlier Explorer

+
+

Example 2 - Static Outlier Explorer +

Now let’s consider a more complex example that makes use of the data and settings provided in safetyGraphics. In this section, we use {ggplot2} to create a spaghetti plot for tracking outliers in lab data. First, consider the following code which creates a stand-alone plot for a single data set:

-
# Use sample clinical trial data sets from the {safetyData} package
-library(safetyData) 
-library(ggplot2)
-library(dplyr)
+
# Use sample clinical trial data sets from the {safetyData} package
+library(safetyData) 
+library(ggplot2)
+library(dplyr)
 
-# Define data mapping using a format similar to a reactive safetyGraphics mapping 
-settings <- list(
-    id_col="USUBJID",
-    value_col="LBSTRESN",
-    measure_col="LBTEST",
-    studyday_col="LBDY"
-)
+# Define data mapping using a format similar to a reactive safetyGraphics mapping 
+settings <- list(
+    id_col="USUBJID",
+    value_col="LBSTRESN",
+    measure_col="LBTEST",
+    studyday_col="LBDY"
+)
 
-# Define a plotting function that takes data and settings as inputs 
-spaghettiPlot <- function( data, settings ){
-    # define plot aes - note use of standard evaluation! 
-    plot_aes <- aes_(
-        x=as.name(settings$studyday_col), 
-        y=as.name(settings$value_col), 
-        group=as.name(settings$id_col)
-    )
+# Define a plotting function that takes data and settings as inputs 
+spaghettiPlot <- function( data, settings ){
+    # define plot aes - note use of standard evaluation! 
+    plot_aes <- aes(
+        x=.data[[settings$studyday_col]], 
+        y=.data[[settings$value_col]], 
+        group=.data[[settings$id_col]]
+    )
 
-    #create the plot
-    p<-ggplot(data = data, plot_aes) +
-        geom_path(alpha=0.15) + 
-        facet_wrap(
-            as.name(settings$measure_col),
-            scales="free_y"
-        )
-    return(p)
-}
+    #create the plot
+    p<-ggplot(data = data, plot_aes) +
+        geom_path(alpha=0.15) + 
+        facet_wrap(
+            settings$measure_col,
+            scales="free_y"
+        )
+    return(p)
+}
 
-spaghettiPlot(
-    safetyData::sdtm_lb %>% 
-        filter(LBTEST %in% c("Albumin","Bilirubin","Calcium","Chloride")), 
-    settings
-)
+spaghettiPlot( + safetyData::sdtm_lb %>% + filter(LBTEST %in% c("Albumin","Bilirubin","Calcium","Chloride")), + settings +)

Running the code above should create a plot with 4 panels:

-

With minor modifications, this chart can be added to the {safetyGraphics} shiny app, which allows us to create the chart with any mappings/data combination loaded in the app. The spaghettiPlot() function above is already written to work with safetyGraphics, so we just need to create the chart configuration object. This time we’ll capture the configuration in a YAML file.

+

With minor modifications, this chart can be added to the {safetyGraphics} shiny app, which allows us to create the chart with any mappings/data combination loaded in the app. The spaghettiPlot() function above is already written to work with safetyGraphics, so we just need to create the chart configuration object. This time we’ll capture the configuration in a YAML file.

env: safetyGraphics
 label: Spaghetti Plot
+name: spaghettiPlot
 type: plot
 domain: 
-  - labs
+    - labs
 workflow:
-  main: spaghettiPlot
+    main: spaghettiPlot
 links:
-  safetyCharts: https://github.com/SafetyGraphics/safetycharts
+ safetyCharts: https://github.com/SafetyGraphics/safetycharts

With the charting function loaded in to our session and the configuration file saved in our working directory as spaghetti.yaml, we can add the chart to the app as follows:

-
library(yaml)
-charts <- makeChartConfig()
-charts$spaghetti<-prepareChart(read_yaml('spaghetti.yaml'))
-safetyGraphicsApp(charts=charts)
+
library(yaml)
+charts <- makeChartConfig()
+charts$spaghetti<-prepareChart(read_yaml('spaghetti.yaml'))
+safetyGraphicsApp(charts=charts)

Under the charts tab, you’ll see:

If you look closely at the spaghettiPlot() code above, you’ll noticed some details that make the chart work in the app:

  • The chart function is written as a function taking data and settings as inputs. This is the expected parameterization for most charts in {safetyGraphics}.
  • -
  • The references to settings use parameters that are defined on the mapping tab. Behind the scenes, these are defined in the safetyGraphics::meta.
  • +
  • The references to settings use parameters that are defined on the mapping tab. Behind the scenes, these are defined in the safetyGraphics::meta.
  • The spaghettiPlot function is referenced in the main item the YAML workflow. This tells the app which function to use to draw the chart.
  • +
  • We’re using the .data[[]] pronoun in the chart function to access columns in the data based on the current settings. See these references for a lot more detail about functional programming in the tidyverse: + +
-

These details allow users to dynamically define data attributes for any labs data set, allowing the chart to be reused across many different types of data.

-

This example is inspired by safetyCharts::safety_outlier_explorer - the charting function and yaml configuration file on are GitHub.

+

This example is inspired by safetyCharts::safety_outlier_explorer - the charting function and yaml configuration file on are GitHub.

-
-

-Example 3 - Shiny Module

-

{safetyGraphics} also supports defining charts as Shiny Modules. Once you’re familiar with modules, they are relatively straightforward to use with safetyGraphics.

-

Let’s take a look at a simple module that extends the functionality of the static chart from the example above. Once again, this example is based upon safetyCharts, and you can see the code and config on GitHub.

+
+

Example 3 - Shiny Module +

+

{safetyGraphics} also supports defining charts as Shiny Modules. Once you’re familiar with modules, they are relatively straightforward to use with safetyGraphics.

+

Let’s take a look at a simple module that extends the functionality of the static chart from the example above. Once again, this example is based upon safetyCharts, and you can see the code and config on GitHub.

The config object for a module differs from a static chart is that the workflow section of the YAML file must specify ui and server functions instead of a main charting function. This example defines a simple UI function that allows users to select which lab measurements should be included in the spaghetti plot from example 1:

-
safetyOutlierExplorer_ui <- function(id) {
-    ns <- NS(id) 
-    sidebar<-sidebarPanel(
-        selectizeInput(
-            ns("measures"), 
-            "Select Measures", 
-            multiple=TRUE, 
-            choices=c("")
-        )
-    )
-    main<-mainPanel(plotOutput(ns("outlierExplorer")))
-    ui<-fluidPage(
-        sidebarLayout(
-            sidebar,
-            main,
-            position = c("right"),
-            fluid=TRUE
-        )
-    )
-    return(ui)
-}
-

Next we define a server function that populates the control for selecting measurements and then draws the plot using safetyCharts::safety_outlier_explorer() charting function - which is based on the spaghetti() function ! Note that the server function takes a single reactive params object containing the data (params$data) and settings (param$settings) as input.

-
safetyOutlierExplorer_server <- function(input, output, session, params) {
+
safetyOutlierExplorer_ui <- function(id) {
+    ns <- NS(id) 
+    sidebar<-sidebarPanel(
+        selectizeInput(
+            ns("measures"), 
+            "Select Measures", 
+            multiple=TRUE, 
+            choices=c("")
+        )
+    )
+    main<-mainPanel(plotOutput(ns("outlierExplorer")))
+    ui<-fluidPage(
+        sidebarLayout(
+            sidebar,
+            main,
+            position = c("right"),
+            fluid=TRUE
+        )
+    )
+    return(ui)
+}
+

Next we define a server function that populates the control for selecting measurements and then draws the plot using safetyCharts::safety_outlier_explorer() charting function - which is based on the spaghetti() function! Note that the server function takes a single reactive params object containing the data (params$data) and settings (param$settings) as input.

+
safetyOutlierExplorer_server <- function(input, output, session, params) {
 
-    ns <- session$ns
-    # Populate control with measures and select all by default
-    observe({
-        measure_col <- params()$settings$measure_col
-        measures <- unique(params()$data[[measure_col]])
-        updateSelectizeInput(
-            session, 
-            "measures",
-            choices = measures,
-            selected = measures
-        )
-    })
+    ns <- session$ns
+    # Populate control with measures and select all by default
+    observe({
+        measure_col <- params()$settings$measure_col
+        measures <- unique(params()$data[[measure_col]])
+        updateSelectizeInput(
+            session, 
+            "measures",
+            choices = measures,
+            selected = measures
+        )
+    })
 
-    # customize selected measures based on input
-    settingsR <- reactive({
-        settings <- params()$settings
-        settings$measure_values <- input$measures
-        return(settings)
-    })
+    # customize selected measures based on input
+    settingsR <- reactive({
+        settings <- params()$settings
+        settings$measure_values <- input$measures
+        return(settings)
+    })
 
-    #draw the chart
-    output$outlierExplorer <- renderPlot({safety_outlier_explorer(params()$data, settingsR())})
-}
+ #draw the chart + output$outlierExplorer <- renderPlot({safety_outlier_explorer(params()$data, settingsR())}) +}

Finally, the YAML configuration file looks like this - just the workflow and label changes from Example 1:

env: safetyGraphics
 label: Outlier Explorer - Module
+name: outlierExplorerMod
 type: module
 package: safetyCharts
 domain: 
-  - labs
+    - labs
 workflow:
-  ui: safetyOutlierExplorer_ui
-  server: safetyOutlierExplorer_server
+    ui: safetyOutlierExplorer_ui
+    server: safetyOutlierExplorer_server
 links:
-  safetyCharts: https://github.com/SafetyGraphics/safetycharts
+ safetyCharts: https://github.com/SafetyGraphics/safetycharts

Initializing the app as usual by adding it to the chart list: charts$outlierMod<-prepareChart(read_yaml('outlierMod.yaml'))

Unselecting a few measures gives the following display:

-
-

-Example 4 - htmlwidgets and init functions

-

You can also add custom htmlwidgets to safetyGraphics. In fact, many of the default charts imported from safetyCharts are javascript libraries that are imported as htmlwidgets. Like shiny modules, htmlwidgets are relatively simple to use once you are familiar with the basics.

+
+

Example 4 - htmlwidgets and init functions +

+

You can also add custom htmlwidgets to safetyGraphics. In fact, many of the default charts imported from safetyCharts are javascript libraries that are imported as htmlwidgets. Like shiny modules, htmlwidgets are relatively simple to use once you are familiar with the basics.

The biggest differences between widgets and other charts in safetyGraphics are:

  1. The widget must be contained in a package, which must be specified in the YAML file.
  2. The widget expects a widget item giving the name of the widget in the YAML workflow.
  3. -
  4. By default, the data and settings for a widget are passed in a list (list(data=data, settings=settings)) to the x parameter in htmlwidget::createWidget.
  5. +
  6. By default, the data and settings for a widget are passed in a list (list(data=data, settings=settings)) to the x parameter in htmlwidget::createWidget.

Items 1 and 2 above are simple enough, but #3 is likely to create problems unless the widget is designed specifically for usage with safetyGraphics. That is, if the widget isn’t expecting x$settings to be a list that it uses to configure the chart, it probably isn’t going to work as expected.

-

Fortunately, there’s a workaround built in to safetyGraphics in the form of init workflow functions. Init functions run before the chart is drawn, and can be used to create custom parameterizations. The init function should take data and settings as inputs and return params which should be a list which is then provided to the chart (see the appendix for more details). The init function for the the interactive AE Explorer is a good example. It starts by merging demographics and adverse event data and then proceeds to create a customized settings object to match the configuration requirements of the javascript chart renderer. This init function is then saved under workflow$init in the chart config object.

-

The rest of the chart configuration YAML is similar to the examples above, and the chart is once again by passing the chart config object to safetyGraphicsApp()

+

Fortunately, there’s a workaround built in to safetyGraphics in the form of init workflow functions. Init functions run before the chart is drawn, and can be used to create custom parameterizations. The init function should take data and settings as inputs and return params which should be a list which is then provided to the chart (see the appendix for more details). The init function for the the interactive AE Explorer is a good example. It starts by merging demographics and adverse event data and then proceeds to create a customized settings object to match the configuration requirements of the javascript chart renderer. This init function is then saved under workflow$init in the chart config object.

+

The rest of the chart configuration YAML is similar to the examples above, and the chart is once again by passing the chart config object to safetyGraphicsApp()

+
+
+

Example 5 - Adding a Chart in a New Data Domain +

+

All of our examples so far have been focused on creating charts in our 3 default data domains (labs, adverse events and demographics), but there is no requirement that limits charts to these three data types. The data domains in the app are determined by a meta data frame that defines the columns and fields used in safetyGraphics charts, and customizing meta allows us to create charts for any desired data domains.

+

Generally speaking there are 3 steps to add a chart in a new domain:

+
    +
  1. Create Metadata for a new data domain.
  2. +
  3. Define a chart using the new domain - like the examples above
  4. +
  5. Load data for the new domain
  6. +
+

Consider the following example, that modifies a chart from the labs domain for use on ECG data:

+
adeg <- readr::read_csv("https://physionet.org/files/ecgcipa/1.0.0/adeg.csv?download")
+
+ecg_meta <-tibble::tribble(
+    ~text_key, ~domain,                      ~label,                               ~description, ~standard_adam, ~standard_sdtm,
+    "id_col",   "custom_ecg",                 "ID column", "Unique subject identifier variable name.",      "USUBJID",      "USUBJID",
+    "value_col",   "custom_ecg",              "Value column",                 "QT result variable name.",         "AVAL",     "EGSTRESN",
+    "measure_col",   "custom_ecg",            "Measure column",                 "QT measure variable name",        "PARAM",       "EGTEST",
+    "studyday_col",   "custom_ecg",          "Study Day column",                  "Visit day variable name",          "ADY",         "EGDY",
+    "visit_col",   "custom_ecg",              "Visit column",                      "Visit variable name",         "ATPT",        "EGTPT",
+    "visitn_col",   "custom_ecg",       "Visit number column",               "Visit number variable name",        "ATPTN",             NA,
+    "period_col",   "custom_ecg",             "Period column",                     "Period variable name",      "APERIOD",             NA,
+    "unit_col",   "custom_ecg",               "Unit column",            "Unit of measure variable name",        "AVALU",     "EGSTRESU"
+) %>% mutate(
+    col_key = text_key,
+    type="column"
+)
+
+qtOutliers<-prepare_chart(read_yaml('https://raw.githubusercontent.com/SafetyGraphics/safetyCharts/dev/inst/config/safetyOutlierExplorer.yaml') )
+qtOutliers$label <- "QT Outlier explorer"
+qtOutliers$domain <- "custom_ecg"
+qtOutliers$meta <- ecg_meta
+
+safetyGraphicsApp(
+    domainData=list(custom_ecg=adeg), 
+    charts=list(qtOutliers)
+)
+

As of safetyGraphics v2.1, metadata can be saved directly to the chart object using chart$meta as shown in the example above.
+Alternatively, metadata can be saved as a data object in the chart$package namespace. Chart-specific metadata should be saved as meta_{chart$name} while domain-level metadata should be named meta_{chart$domain}. It’s fine to use a combination of these approaches as appropriate for your chart. See ?safetyGraphics::makeMeta for more detail.

-
-

-Appendix #1 - Chart Framework Technical Specifications

-
-

-Configuration Overview

+
+

Appendix #1 - Chart Framework Technical Specifications +

+
+

Configuration Overview +

-

The diagram above summarizes the various components of the safetyGraphics charting framework: - The safetyGraphicsApp() function allows users to specify which charts to include in the shiny app via the charts parameter, which expects a list of charts. - Each item in charts is itself defined as a list that provides configuration details for a single chart. These configuration lists have several required parameters, which are described in the technical specification below. - Configuration lists are typically saved as YAML files, but can be also be loaded directly as list objects as shown in the Hello World example above. - Needed functions are bound to the chart object via the prepareChart() function. See the documentation for chart$functions below for full details.

+

The diagram above summarizes the various components of the safetyGraphics charting framework:

+
    +
  • The safetyGraphicsApp() function allows users to specify which charts to include in the shiny app via the charts parameter, which expects a list of charts.
  • +
  • Each item in charts is itself defined as a list that provides configuration details for a single chart. These configuration lists have several required parameters, which are described in the technical specification below.
  • +
  • Configuration lists are typically saved as YAML files, but can be also be loaded directly as list objects as shown in the Hello World example above.
  • +
  • Needed functions are bound to the chart object via the prepareChart() function. See the documentation for chart$functions below for full details.
  • +
-
-

-Chart Specification

-

Each item in the charts list should be a list() with the following parameters: - env: Environment for the chart. Must be set to “safetyGraphics” or the chart is dropped. Type: character. Required - name: Name of the chart. Type: character. Required - type:: Type of chart. Valid options are: “plot”,“htmlwidget”,“html”,“table” and “module”. Type: character. Required - label: A short description of the chart. chart\(name is used if not provided. Type: *character*. *Optional* - `domain`: The data domain(s) used in the chart. Type: *character*. **Required** - `package`: The package where the {htmlwidget} is saved. Type: *character*. **Required** when `chart\)typeis "htmlwidget" -order: Order in which to display the chart. If order is a negative number, the chart is dropped. Defaults to 999999. Type: *Integer*. *Optional* -links: Named list of link names/urls to be shown in the chart header. Type: *list of character*. *Optional* -path: Full path of the YAML file. Auto-generated bymakeChartConfig()Type: *character* *optional* -workflow: Names of functions used to create the chart. Should be loaded in global environment or included inchart\(package` before calling `prepareChart()`. Supported parameters are listed below. Type: *list of character*. **Required** - `workflow\)main: name of the function to draw the chart. The function should takedataandsettingsparameters unless the input parameters are customized by aninitfunction. **Required**, unlesschart\(type` is "htmlwidget" or "module") - `workflow\)init: name of initialization function that runs before chart is drawn via the main function. Should take data and settings as input and return a list of parameters accepted by the main function. Optional - workflow$widget: name or widget saved in chart$package to be passed to htmlwidgets::createWidget Required when chart$type is “htmlwidget” - workflow$ui and workflow$server: names of functions to render shiny ui and server. Automatically generated in prepareChart() unless chart$type is “module”. Required when chart$type is ‘module’ - functions: a list of functions used to create the chart. Typically generated at runtime by prepareChart() using information in chart$workflow, chart$type and chart$package. Not recommended to generate manually. Type: list of functions. Required

+
+

Chart Specification +

+

Each item in the charts list should be a list() with the following parameters:

+
    +
  • +env: Environment for the chart. Must be set to “safetyGraphics” or the chart is dropped. Type: character. Required +
  • +
  • +name: Name of the chart. Type: character. Required +
  • +
  • +type:: Type of chart. Valid options are: “plot”,“htmlwidget”,“html”,“table” and “module”. Type: character. Required +
  • +
  • +label: A short description of the chart. chart$name is used if not provided. Type: character. Optional +
  • +
  • +domain: The data domain(s) used in the chart. Type: character. Required +
  • +
  • +package: The package where the {htmlwidget} is saved. Type: character. Required when chart$type is “htmlwidget”
  • +
  • +meta: Table of chart-specific metadata. Metadata can also be saved as {package}::meta_{chart} or {package::meta_{domain}. See ?safetyGraphics::makeMeta for more detail.
  • +
  • +order: Order in which to display the chart. If order is a negative number, the chart is dropped. Defaults to 999999. Type: Integer. Optional +
  • +
  • +links: Named list of link names/urls to be shown in the chart header. Type: list of character. Optional +
  • +
  • +path: Full path of the YAML file. Auto-generated by makeChartConfig() Type: character optional +
  • +
  • +workflow: Names of functions used to create the chart. Should be loaded in global environment or included in chart$package before calling prepareChart(). Supported parameters are listed below. Type: list of character. Required +
      +
    • +workflow$main: name of the function to draw the chart. The function should take data and settings parameters unless the input parameters are customized by an init function. Required, unless chart$type is “htmlwidget” or “module”)
    • +
    • +workflow$init: name of initialization function that runs before chart is drawn via themainfunction. Should takedataandsettingsas input and return a list of parameters accepted by themain` function. Optional +
    • +
    • +workflow$widget: name or widget saved in chart$package to be passed to htmlwidgets::createWidget Required when chart$type is “htmlwidget”
    • +
    • +workflow$ui and workflow$server: names of functions to render shiny ui and server. Automatically generated in prepareChart() unless chart$type is “module”. Required when chart$type is ‘module’
    • +
    +
  • +
  • +functions: a list of functions used to create the chart. Typically generated at runtime by prepareChart() using information in chart$workflow, chart$type and chart$package. Not recommended to generate manually. Type: list of functions. Required +
  • +
-
-

-Default Technical workflow

+
+

Default Technical workflow +

This appendix describe the technical process used to render a chart when safetyGraphicsApp() is called with the default parameters.

  1. @@ -333,7 +437,7 @@

  2. app_startup is called, which then immediately calls makeChartConfig().
  3. -makeChartConfig() looks for charts in the safetyCharts package (the default) since no path was specified. The function looks for the package in all current .libPaths() and then looks in the inst/config folder once the package is found.
  4. +makeChartConfig() looks for charts in the safetyCharts package (the default) since no path was specified. The function looks for the package in all current .libPaths() and then looks in the inst/config folder once the package is found.

  5. makeChartConfig loads YAML configuration files in the specified directories and saves them to a list. name and path parameters are added.
  6. @@ -350,7 +454,9 @@

  7. -app_startup returns the list of charts to safetyGraphicsApp which then then passes them along to safetyGraphicsServer as the charts parameter.
  8. +app_startup passes the updated list of charts to makeMeta assuming no meta object was provided. makeMeta combines metadata from all charts in to a single data.frame. Charts can save metadata as chart.meta, {package}::meta_{chart} or {package}::meta_{domain}. +
  9. +app_startup returns the list of charts and associated metadata to safetyGraphicsApp which then then passes them along to safetyGraphicsServer as the charts parameter.
  10. safetyGraphicsServer then creates modules for each chart. First, UIs are created via chartsNav() which then calls:
      @@ -394,11 +500,13 @@

      -

      Site built with pkgdown 1.6.1.

      +

      +

      Site built with pkgdown 2.0.2.

      @@ -407,5 +515,7 @@

      + + diff --git a/docs/articles/chartConfiguration_files/header-attrs-2.13/header-attrs.js b/docs/articles/chartConfiguration_files/header-attrs-2.13/header-attrs.js new file mode 100644 index 00000000..dd57d92e --- /dev/null +++ b/docs/articles/chartConfiguration_files/header-attrs-2.13/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/articles/index.html b/docs/articles/index.html index ad545bd5..771d4a03 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,66 +1,12 @@ - - - - - - - -Articles • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Articles • safetyGraphics - - + + - - -
      -
      -

- - -
+
+
Cookbook
+
+
Technical FAQ
+
+
Chart Configuration
+
+
Intro to Shiny App
+
+
-
- +
- - + + diff --git a/docs/articles/intro.html b/docs/articles/intro.html index 2e6fd1a4..081db8f2 100644 --- a/docs/articles/intro.html +++ b/docs/articles/intro.html @@ -19,6 +19,8 @@ + +
+
-
-

-Intro Vignette

+
+

Intro Vignette +

The safetyGraphics shiny app provides an easy-to-use shiny interface for creating shareable safety graphics for any study. This vignette provides an overview of the app’s functionality, shows how to initialize the app with your own study data, and provides links to technical resources explaining how to customize the app.

-
-

-safetyGraphics Demo

-

A demo of shiny application using data from the {safetyData} package is hosted here. The app can also be initialized with the safetyGraphicsApp() function in the R console - see Appendix 1 for details.

+
+

safetyGraphics Demo +

+

A demo of shiny application using data from the {safetyData} package is hosted here. The app can also be initialized with the safetyGraphicsApp() function in the R console - see Appendix 1 for details.

Let’s take a quick look at the various pages in the app.

-
-

-Home Tab

+
+

Home Tab +

A home page has a basic overview of the app.

-
-

-Mapping Tab

+
+

Mapping Tab +

The Mapping tab is used to tell charts which data columns and fields to use for various chart components.

This mapping process makes it easy to re-use charts across many different studies. You can see previews of the loaded data using the checkbox at the top of the page. The demo data has 3 data domains (labs, adverse events (aes) and demographics (dm)), but others can be added as well. The mapping tab is automatically filled in for common data standards, like the ADaM data shown here, but can also be filled in manually for non-standard data.

-
-

-Filtering Tab

+
+

Filtering Tab +

The Filtering tab allows users to interactively select which participants to include in charts.

-

This tab is created using the filter functionality included in the {datamods} package. Whenever data is filtered in this tab, those filtered data are used in all charts (across all data domains). Note that the number of participants selected is always shown in the upper right hand corner of the app.

+

This tab is created using the filter functionality included in the {datamods} package. Whenever data is filtered in this tab, those filtered data are used in all charts (across all data domains). Note that the number of participants selected is always shown in the upper right hand corner of the app.

-
-

-Charts Tab

-

Clicking the Charts tab opens a dropdown menu containing a series of charts related to clinical trial safety. Clicking the Hepatic Safety Explorer opens this page:

+
+

Charts Tab +

+

Clicking the Charts tab opens a dropdown menu containing a series of charts related to clinical trial safety. Clicking the Hepatic Safety Explorer opens this page:

-

safetyGraphics supports many different kinds of charts including web-based interactive graphics using {htmlwidgets} (like the chart shown above), static plots, plotly plots and custom shiny modules. Each chart has a header that provides details about the chart, links to chart-specific resources and buttons that allow users to download a stand-alone html report or a .R file that reproduces the chart. See the Chart Configuration Vignette for more detail about the safetyGraphics charting framework.

+

safetyGraphics supports many different kinds of charts including web-based interactive graphics using {htmlwidgets} (like the chart shown above), static plots, plotly plots and custom shiny modules. Each chart has a header that provides details about the chart, links to chart-specific resources and buttons that allow users to download a stand-alone html report or a .R file that reproduces the chart. See the Chart Configuration Vignette for more detail about the safetyGraphics charting framework.

-
-

-⚙️ (Settings) Tab

+
+

⚙️ (Settings) Tab +

Finally, the Settings tab - shown as a gear icon ⚙️ - contains technical details that can be used to customize/troubleshoot the app. Clicking on the “Code” sub-tab (shown below) allows you to download a zip file that can be used to re-open the app with with any customizations that have been made during your current session.

-
-

-Loading Study Data

+
+

Loading Study Data +

+

safetyGraphics supports a wide range of data formats and standards. Generally speaking, any clinical data can be loaded as long it meets the minimal data requirements described in appendix 2.

There are 2 primary ways to load your study data in to the safetyGraphics shiny app:

  1. Using safetyGraphicsInit() shiny interface
  2. Passing data directly to safetyGraphicsApp()
-
-

-Loading data with safetyGraphicsInit() -

+
+

Loading data with safetyGraphicsInit() +

The safetyGraphicsInit() function starts a simple app that allows users to select charts and then load the data required via a point-and-click interface as shown below:

The app dynamically determines which data sets are required for the selected charts and updates the “Data Loader” UI when the charts selection changes. Below, we’ve selected 2 charts from the labs domain - so the other data domains are automatically hidden.

-

Once you’ve picked charts, click the “Load” buttons in the “Data Loader” section to select data files for each domain. Data is loaded using the import functionality from the {datamods} package which allows you to select data loaded in your R session or load data files directly from your file system. datamods supports any file format that {rio} can handle including text files, Excel, SAS and SPSS format.

+

Once you’ve picked charts, click the “Load” buttons in the “Data Loader” section to select data files for each domain. Data is loaded using the import functionality from the {datamods} package which allows you to select data loaded in your R session or load data files directly from your file system. datamods supports any file format that {rio} can handle including text files, Excel, SAS and SPSS format.

Once you’ve loaded files for all of the active data domains, the “Run App” button will become active. Click it to initialize the app.

-
-

-Passing data to safetyGraphicsApp() -

+
+

Passing data to safetyGraphicsApp() +

You can also initialize the app with custom data directly from the R console. The basic workflow is as follows:

  1. Load your data in to the R session
  2. @@ -178,42 +179,70 @@

  3. Run safetyGraphicsApp() using the domainData to pass the list of data frames.

Here is a simple example that starts the app with SDTM data from the safetyData library:

-
library(safetyData)
-sdtm <- list(
-    dm=safetyData::sdtm_dm,
-    aes=safetyData::sdtm_ae,
-    labs=safetyData::sdtm_lb
-)
-
-safetyGraphics::safetyGraphicsApp(domainData=sdtm)
-

This example and other use cases are described in the safetyGraphics Cookbook - Advanced Examples Vignette.

-
-
-
-

-Additional Resources

-

Several additional vignettes are available for more advanced topics: - Chart Configuration Vignette - details about the charting process including technical specifications and step-by-step instructions - Cookbook Vignette - a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios - Technical FAQ Vignette Vignette - vignette discussing security, validation and other technical issues

-

The {safetyGraphics} app is maintained by the Interactive Safety Graphics (ISG) subteam of the ASA Biopharm-DIA Safety Working Group. You can learn more about the team and find links to recent presentations and publications at our home page.

-
-
-

-Appendix 1 - Initialization code

+
library(safetyData)
+sdtm <- list(
+    dm=safetyData::sdtm_dm,
+    aes=safetyData::sdtm_ae,
+    labs=safetyData::sdtm_lb
+)
+
+safetyGraphics::safetyGraphicsApp(domainData=sdtm)
+

This example and other use cases are described in cookbook vignette.

+
+
+

Large Data sets +

+

Use the maxFileSize option to load data sets larger than 5 mb in safetyGraphicsInit (e.g. safetyGraphicsinit(maxFileSize=100)). safetyGraphicsApp() does not have size limits for data files, but note that large data (>100 mb) may cause performance issues.

+
+
+
+

Additional Resources +

+

Several additional vignettes are available for more advanced topics:

+
    +
  • +Chart Configuration Vignette - details about the charting process including technical specifications and step-by-step instructions
  • +
  • +Cookbook Vignette - a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios
  • +
  • +Technical FAQ Vignette - vignette discussing security, validation and other technical issues
  • +
+

The {safetyGraphics} app is maintained by the Interactive Safety Graphics (ISG) subteam of the ASA Biopharm-DIA Safety Working Group. You can learn more about the team and find links to recent presentations and publications at our home page.

+
+
+

Appendix 1 - Initialization code +

We suggest running the app in RStudio with R version 4.0 or higher. The following code installs the {safetyGraphics} package and initializes the app demo:

-
install.packages('safetyGraphics')
-library(safetyGraphics)
-safetyGraphicsApp() 
+
install.packages('safetyGraphics')
+library(safetyGraphics)
+safetyGraphicsApp()

Or to use the initialization workflow:

-
install.packages('safetyGraphics')
-library(safetyGraphics)
-safetyGraphicsInit() 
+
install.packages('safetyGraphics')
+library(safetyGraphics)
+safetyGraphicsInit()

Or you can install the most recent development version of {safetyGraphics} and the companion package {safetyCharts} directly from GitHub:

-
install.packages("devtools")
-library(devtools)
-devtools::install_github("safetyGraphics/safetyGraphics") 
-library(safetyGraphics)
-devtools::install_github("safetyGraphics/safetyCharts") 
-library(safetyCharts)
-safetyGraphicsApp() #or safetyGraphicsInit()
+
install.packages("devtools")
+library(devtools)
+devtools::install_github("safetyGraphics/safetyGraphics") 
+library(safetyGraphics)
+devtools::install_github("safetyGraphics/safetyCharts") 
+library(safetyCharts)
+safetyGraphicsApp() #or safetyGraphicsInit()
+
+
+

Appendix 2 - Minimum Data Requirements +

+

Since the safetyGraphics framework supports adding custom charts (that may have custom settings), there are no universal data requirements for the app. However, the charts included by default version of the app are built to share requirements whenever possible. These requirements are captured in an included metadata file called safetyGraphics::meta.

+

The most basic requirements for the 3 default domains are:

+
    +
  • +Lab results (labs) domain - Expects one record per person per visit per lab measurement with columns for: Participant ID, lab result, lab name, lower limit of normal, upper limit of normal, study day, study visit (numeric), study visit (character). See safetyGraphics::meta %>% filter(domain=="labs") for additional details and optional columns used by some charts.
  • +
  • +Adverse Event (aes) domain - Expects one record per adverse event with columns for: Participant ID, AE Sequence, Study Day, AE Start day, AE end day, AE preferred term and AE body system. See safetyGraphics::meta %>% filter(domain=="aes") +
  • +
  • +Demographics (dm) domain - Expects one record per person with columns for: Participant ID, Sex, Race, Age and Study Treatment (optional) . See safetyGraphics::meta %>% filter(domain=="dm") for additional details.
  • +
@@ -228,11 +257,13 @@

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.2.

@@ -241,5 +272,7 @@

+ + diff --git a/docs/articles/intro_files/header-attrs-2.13/header-attrs.js b/docs/articles/intro_files/header-attrs-2.13/header-attrs.js new file mode 100644 index 00000000..dd57d92e --- /dev/null +++ b/docs/articles/intro_files/header-attrs-2.13/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/docs/authors.html b/docs/authors.html index 06c9745f..073d5c67 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,66 +1,12 @@ - - - - - - - -Authors • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Authors and Citation • safetyGraphics + + - - - - - -
-
-
- -
+
- @@ -167,22 +124,20 @@

Authors

-
- +
- - + + diff --git a/docs/index.html b/docs/index.html index 61553b1e..918f943f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -19,6 +19,8 @@ + +
-

R build status

-
- - - + + diff --git a/docs/reference/chartsTabUI.html b/docs/reference/chartsTabUI.html index 35138e28..779c8cd5 100644 --- a/docs/reference/chartsTabUI.html +++ b/docs/reference/chartsTabUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for chart module, designed to be re-used for each chart generated. — chartsTabUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for chart module, designed to be re-used for each chart generated. — chartsTabUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,47 +77,39 @@

UI for chart module, designed to be re-used for each chart generated.

UI for chart module, designed to be re-used for each chart generated.

-
chartsTabUI(id, chart)
- -

Arguments

- - - - - - - - - - -
id

module id

chart

list containing chart specifications like those returned by makeChartConfig.

+
+
chartsTabUI(id, chart)
+
+
+

Arguments

+
id
+

module id

+
chart
+

list containing chart specifications like those returned by makeChartConfig.

+
+
-
- +
- - + + diff --git a/docs/reference/detectStandard.html b/docs/reference/detectStandard.html index a4353dd4..85892c9b 100644 --- a/docs/reference/detectStandard.html +++ b/docs/reference/detectStandard.html @@ -1,67 +1,12 @@ - - - - - - - -Detect the data standard used for a data set — detectStandard • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Detect the data standard used for a data set — detectStandard • safetyGraphics - - + + - - -
-
- -
- -
+
@@ -141,271 +77,261 @@

Detect the data standard used for a data set

This function attempts to detect the clinical data standard used in a given R data frame.

-
detectStandard(data, domain = NULL, meta = safetyGraphics::meta)
- -

Arguments

- - - - - - - - - - - - - - -
data

A data frame in which to detect the data standard - required.

domain

the domain to evaluate - should match a value of meta$domain. Uses the first value in meta$domain if no value is provided.

meta

the metadata containing the data standards. - default = safetyGraphics::meta

- -

Value

+
+
detectStandard(data, domain = NULL, meta = NULL)
+
+
+

Arguments

+
data
+

A data frame in which to detect the data standard - required.

+
domain
+

the domain to evaluate - should match a value of meta$domain. Uses the first value in meta$domain if no value is provided.

+
meta
+

the metadata containing the data standards.

+
+
+

Value

A data frame describing the detected standard for each "text_key" in the provided metadata. Columns are "domain", "text_key", "column" and "standard".

-

Details

- -

This function compares the columns in the provided "data" with the required columns for a given data standard/domain combination. The function is designed to work with the SDTM and ADaM CDISC(https://www.cdisc.org/) standards for clinical trial data by default. Additional standards can be added by modifying the "meta" data set included as part of this package.

+
+
+

Details

+

This function compares the columns in the provided "data" with the required columns for a given data standard/domain combination. The function is designed to work with the SDTM and ADaM CDISC(https://www.cdisc.org/) standards for clinical trial data by default. Additional standards can be added by modifying the "meta" data set included as part of this package.

+
-

Examples

-
detectStandard(data=safetyData::adam_adae) #aes domain evaluated by default -
#> $details -#> $details$adam -#> $details$adam$standard -#> [1] "adam" -#> -#> $details$adam$mapping -#> # A tibble: 6 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 seq_col AESEQ TRUE -#> 3 stdy_col ASTDY TRUE -#> 4 endy_col AENDY TRUE -#> 5 term_col AETERM TRUE -#> 6 bodsys_col AEBODSYS TRUE -#> -#> $details$adam$total_count -#> [1] 6 -#> -#> $details$adam$valid_count -#> [1] 6 -#> -#> $details$adam$invalid_count -#> [1] 0 -#> -#> $details$adam$match_percent -#> [1] 1 -#> -#> $details$adam$match -#> [1] "full" -#> -#> $details$adam$label -#> [1] "ADaM" -#> -#> -#> $details$sdtm -#> $details$sdtm$standard -#> [1] "sdtm" -#> -#> $details$sdtm$mapping -#> # A tibble: 6 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 seq_col AESEQ TRUE -#> 3 stdy_col NA FALSE -#> 4 endy_col NA FALSE -#> 5 term_col AETERM TRUE -#> 6 bodsys_col AEBODSYS TRUE -#> -#> $details$sdtm$total_count -#> [1] 6 -#> -#> $details$sdtm$valid_count -#> [1] 4 -#> -#> $details$sdtm$invalid_count -#> [1] 2 -#> -#> $details$sdtm$match_percent -#> [1] 0.6666667 -#> -#> $details$sdtm$match -#> [1] "partial" -#> -#> $details$sdtm$label -#> [1] "Partial SDTM" -#> -#> $details$sdtm$details -#> [1] "(4/6 cols/fields matched)" -#> -#> -#> -#> $standard -#> [1] "adam" -#> -#> $label -#> [1] "ADaM" -#> -#> $standard_percent -#> [1] 1 -#> -#> $mapping -#> # A tibble: 6 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 seq_col AESEQ TRUE -#> 3 stdy_col ASTDY TRUE -#> 4 endy_col AENDY TRUE -#> 5 term_col AETERM TRUE -#> 6 bodsys_col AEBODSYS TRUE -#>
detectStandard(data=safetyData::adam_adlbc,domain="labs" ) -
#> $details -#> $details$adam -#> $details$adam$standard -#> [1] "adam" -#> -#> $details$adam$mapping -#> # A tibble: 12 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 value_col AVAL TRUE -#> 3 measure_col PARAM TRUE -#> 4 normal_col_low A1LO TRUE -#> 5 normal_col_high A1HI TRUE -#> 6 studyday_col ADY TRUE -#> 7 visit_col VISIT TRUE -#> 8 visitn_col VISITNUM TRUE -#> 9 measure_values--ALT Alanine Aminotransferase (U/L) TRUE -#> 10 measure_values--AST Aspartate Aminotransferase (U/L) TRUE -#> 11 measure_values--TB Bilirubin (umol/L) TRUE -#> 12 measure_values--ALP Alkaline Phosphatase (U/L) TRUE -#> -#> $details$adam$total_count -#> [1] 12 -#> -#> $details$adam$valid_count -#> [1] 12 -#> -#> $details$adam$invalid_count -#> [1] 0 -#> -#> $details$adam$match_percent -#> [1] 1 -#> -#> $details$adam$match -#> [1] "full" -#> -#> $details$adam$label -#> [1] "ADaM" -#> -#> -#> $details$sdtm -#> $details$sdtm$standard -#> [1] "sdtm" -#> -#> $details$sdtm$mapping -#> # A tibble: 13 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 value_col LBSTRESN TRUE -#> 3 measure_col NA FALSE -#> 4 normal_col_low NA FALSE -#> 5 normal_col_high NA FALSE -#> 6 studyday_col NA FALSE -#> 7 visit_col VISIT TRUE -#> 8 visitn_col VISITNUM TRUE -#> 9 measure_values--ALT NA FALSE -#> 10 measure_values--AST NA FALSE -#> 11 measure_values--TB NA FALSE -#> 12 measure_values--ALP NA FALSE -#> 13 unit_col NA FALSE -#> -#> $details$sdtm$total_count -#> [1] 13 -#> -#> $details$sdtm$valid_count -#> [1] 4 -#> -#> $details$sdtm$invalid_count -#> [1] 9 -#> -#> $details$sdtm$match_percent -#> [1] 0.3076923 -#> -#> $details$sdtm$match -#> [1] "partial" -#> -#> $details$sdtm$label -#> [1] "Partial SDTM" -#> -#> $details$sdtm$details -#> [1] "(4/13 cols/fields matched)" -#> -#> -#> -#> $standard -#> [1] "adam" -#> -#> $label -#> [1] "ADaM" -#> -#> $standard_percent -#> [1] 1 -#> -#> $mapping -#> # A tibble: 12 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 value_col AVAL TRUE -#> 3 measure_col PARAM TRUE -#> 4 normal_col_low A1LO TRUE -#> 5 normal_col_high A1HI TRUE -#> 6 studyday_col ADY TRUE -#> 7 visit_col VISIT TRUE -#> 8 visitn_col VISITNUM TRUE -#> 9 measure_values--ALT Alanine Aminotransferase (U/L) TRUE -#> 10 measure_values--AST Aspartate Aminotransferase (U/L) TRUE -#> 11 measure_values--TB Bilirubin (umol/L) TRUE -#> 12 measure_values--ALP Alkaline Phosphatase (U/L) TRUE -#>
-
+
+

Examples

+
detectStandard(data=safetyData::adam_adae, meta=safetyCharts::meta_aes) 
+#> $details
+#> $details$adam
+#> $details$adam$standard
+#> [1] "adam"
+#> 
+#> $details$adam$mapping
+#> # A tibble: 8 × 3
+#> # Rowwise: 
+#>   text_key     current  valid
+#>   <chr>        <chr>    <lgl>
+#> 1 id_col       USUBJID  TRUE 
+#> 2 seq_col      AESEQ    TRUE 
+#> 3 stdy_col     ASTDY    TRUE 
+#> 4 endy_col     AENDY    TRUE 
+#> 5 term_col     AEDECOD  TRUE 
+#> 6 bodsys_col   AEBODSYS TRUE 
+#> 7 severity_col AESEV    TRUE 
+#> 8 serious_col  AESER    TRUE 
+#> 
+#> $details$adam$total_count
+#> [1] 8
+#> 
+#> $details$adam$valid_count
+#> [1] 8
+#> 
+#> $details$adam$invalid_count
+#> [1] 0
+#> 
+#> $details$adam$match_percent
+#> [1] 1
+#> 
+#> $details$adam$match
+#> [1] "full"
+#> 
+#> $details$adam$label
+#> [1] "ADaM"
+#> 
+#> 
+#> $details$sdtm
+#> $details$sdtm$standard
+#> [1] "sdtm"
+#> 
+#> $details$sdtm$mapping
+#> # A tibble: 8 × 3
+#> # Rowwise: 
+#>   text_key     current  valid
+#>   <chr>        <chr>    <lgl>
+#> 1 id_col       USUBJID  TRUE 
+#> 2 seq_col      AESEQ    TRUE 
+#> 3 stdy_col     NA       FALSE
+#> 4 endy_col     NA       FALSE
+#> 5 term_col     AEDECOD  TRUE 
+#> 6 bodsys_col   AEBODSYS TRUE 
+#> 7 severity_col AESEV    TRUE 
+#> 8 serious_col  AESER    TRUE 
+#> 
+#> $details$sdtm$total_count
+#> [1] 8
+#> 
+#> $details$sdtm$valid_count
+#> [1] 6
+#> 
+#> $details$sdtm$invalid_count
+#> [1] 2
+#> 
+#> $details$sdtm$match_percent
+#> [1] 0.75
+#> 
+#> $details$sdtm$match
+#> [1] "partial"
+#> 
+#> $details$sdtm$label
+#> [1] "Partial SDTM"
+#> 
+#> $details$sdtm$details
+#> [1] "(6/8 cols/fields matched)"
+#> 
+#> 
+#> 
+#> $standard
+#> [1] "adam"
+#> 
+#> $label
+#> [1] "ADaM"
+#> 
+#> $standard_percent
+#> [1] 1
+#> 
+#> $mapping
+#> # A tibble: 8 × 3
+#> # Rowwise: 
+#>   text_key     current  valid
+#>   <chr>        <chr>    <lgl>
+#> 1 id_col       USUBJID  TRUE 
+#> 2 seq_col      AESEQ    TRUE 
+#> 3 stdy_col     ASTDY    TRUE 
+#> 4 endy_col     AENDY    TRUE 
+#> 5 term_col     AEDECOD  TRUE 
+#> 6 bodsys_col   AEBODSYS TRUE 
+#> 7 severity_col AESEV    TRUE 
+#> 8 serious_col  AESER    TRUE 
+#> 
+detectStandard(data=safetyData::adam_adlbc,meta=safetyCharts::meta_labs, domain="labs" ) 
+#> $details
+#> $details$adam
+#> $details$adam$standard
+#> [1] "adam"
+#> 
+#> $details$adam$mapping
+#> # A tibble: 8 × 3
+#> # Rowwise: 
+#>   text_key        current  valid
+#>   <chr>           <chr>    <lgl>
+#> 1 id_col          USUBJID  TRUE 
+#> 2 value_col       AVAL     TRUE 
+#> 3 measure_col     PARAM    TRUE 
+#> 4 normal_col_low  A1LO     TRUE 
+#> 5 normal_col_high A1HI     TRUE 
+#> 6 studyday_col    ADY      TRUE 
+#> 7 visit_col       VISIT    TRUE 
+#> 8 visitn_col      VISITNUM TRUE 
+#> 
+#> $details$adam$total_count
+#> [1] 8
+#> 
+#> $details$adam$valid_count
+#> [1] 8
+#> 
+#> $details$adam$invalid_count
+#> [1] 0
+#> 
+#> $details$adam$match_percent
+#> [1] 1
+#> 
+#> $details$adam$match
+#> [1] "full"
+#> 
+#> $details$adam$label
+#> [1] "ADaM"
+#> 
+#> 
+#> $details$sdtm
+#> $details$sdtm$standard
+#> [1] "sdtm"
+#> 
+#> $details$sdtm$mapping
+#> # A tibble: 9 × 3
+#> # Rowwise: 
+#>   text_key        current  valid
+#>   <chr>           <chr>    <lgl>
+#> 1 id_col          USUBJID  TRUE 
+#> 2 value_col       LBSTRESN TRUE 
+#> 3 measure_col     NA       FALSE
+#> 4 normal_col_low  NA       FALSE
+#> 5 normal_col_high NA       FALSE
+#> 6 studyday_col    NA       FALSE
+#> 7 visit_col       VISIT    TRUE 
+#> 8 visitn_col      VISITNUM TRUE 
+#> 9 unit_col        NA       FALSE
+#> 
+#> $details$sdtm$total_count
+#> [1] 9
+#> 
+#> $details$sdtm$valid_count
+#> [1] 4
+#> 
+#> $details$sdtm$invalid_count
+#> [1] 5
+#> 
+#> $details$sdtm$match_percent
+#> [1] 0.4444444
+#> 
+#> $details$sdtm$match
+#> [1] "partial"
+#> 
+#> $details$sdtm$label
+#> [1] "Partial SDTM"
+#> 
+#> $details$sdtm$details
+#> [1] "(4/9 cols/fields matched)"
+#> 
+#> 
+#> 
+#> $standard
+#> [1] "adam"
+#> 
+#> $label
+#> [1] "ADaM"
+#> 
+#> $standard_percent
+#> [1] 1
+#> 
+#> $mapping
+#> # A tibble: 8 × 3
+#> # Rowwise: 
+#>   text_key        current  valid
+#>   <chr>           <chr>    <lgl>
+#> 1 id_col          USUBJID  TRUE 
+#> 2 value_col       AVAL     TRUE 
+#> 3 measure_col     PARAM    TRUE 
+#> 4 normal_col_low  A1LO     TRUE 
+#> 5 normal_col_high A1HI     TRUE 
+#> 6 studyday_col    ADY      TRUE 
+#> 7 visit_col       VISIT    TRUE 
+#> 8 visitn_col      VISITNUM TRUE 
+#> 
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/evaluateStandard.html b/docs/reference/evaluateStandard.html index a645811e..a4a199f4 100644 --- a/docs/reference/evaluateStandard.html +++ b/docs/reference/evaluateStandard.html @@ -1,67 +1,12 @@ - - - - - - - -Evaluate a data set against a data standard — evaluateStandard • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Evaluate a data set against a data standard — evaluateStandard • safetyGraphics - - + + - - -
-
- -
- -
+
@@ -141,156 +77,141 @@

Evaluate a data set against a data standard

Determines whether the required data elements in a data standard are found in a given data frame

-
evaluateStandard(data, meta, domain, standard)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
data

A data frame in which to detect the data standard

meta

the metadata containing the data standards.

domain

the domain to evaluate - should match a value of meta$domain

standard

standard to evaluate

- -

Value

+
+
evaluateStandard(data, meta, domain, standard)
+
+
+

Arguments

+
data
+

A data frame in which to detect the data standard

+
meta
+

the metadata containing the data standards.

+
domain
+

the domain to evaluate - should match a value of meta$domain

+
standard
+

standard to evaluate

+
+
+

Value

a list describing to what degree the data set matches the data standard. The "match" property describes compliance with the standard as "full", "partial" or "none". The "checks" property is a list of the data elements expected for the standard and whether they are "valid" in the given data set. "total_checks", "valid_checks" and "invalid_checks" provide counts of the specified checks. "match_percent" is calculated as valid_checks/total_checks. "mapping" is a data frame describing the detected standard for each "text_key" in the provided metadata. Columns are "text_key", "current" containing the name of the matched column or field value in the data and "match" a boolean indicating whether the data matches the standard.

+
-

Examples

-
# Match is TRUE -evaluateStandard( - data=safetyData::adam_adlbc, - meta=meta, - domain="labs", - standard="adam" -) -
#> $standard -#> [1] "adam" -#> -#> $mapping -#> # A tibble: 12 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 value_col AVAL TRUE -#> 3 measure_col PARAM TRUE -#> 4 normal_col_low A1LO TRUE -#> 5 normal_col_high A1HI TRUE -#> 6 studyday_col ADY TRUE -#> 7 visit_col VISIT TRUE -#> 8 visitn_col VISITNUM TRUE -#> 9 measure_values--ALT Alanine Aminotransferase (U/L) TRUE -#> 10 measure_values--AST Aspartate Aminotransferase (U/L) TRUE -#> 11 measure_values--TB Bilirubin (umol/L) TRUE -#> 12 measure_values--ALP Alkaline Phosphatase (U/L) TRUE -#> -#> $total_count -#> [1] 12 -#> -#> $valid_count -#> [1] 12 -#> -#> $invalid_count -#> [1] 0 -#> -#> $match_percent -#> [1] 1 -#> -#> $match -#> [1] "full" -#> -#> $label -#> [1] "ADaM" -#>
-# Match is FALSE -evaluateStandard( - data=safetyData::adam_adlbc, - meta=meta, - domain="labs", - standard="sdtm" -) -
#> $standard -#> [1] "sdtm" -#> -#> $mapping -#> # A tibble: 13 × 3 -#> # Rowwise: -#> text_key current valid -#> <chr> <chr> <lgl> -#> 1 id_col USUBJID TRUE -#> 2 value_col LBSTRESN TRUE -#> 3 measure_col NA FALSE -#> 4 normal_col_low NA FALSE -#> 5 normal_col_high NA FALSE -#> 6 studyday_col NA FALSE -#> 7 visit_col VISIT TRUE -#> 8 visitn_col VISITNUM TRUE -#> 9 measure_values--ALT NA FALSE -#> 10 measure_values--AST NA FALSE -#> 11 measure_values--TB NA FALSE -#> 12 measure_values--ALP NA FALSE -#> 13 unit_col NA FALSE -#> -#> $total_count -#> [1] 13 -#> -#> $valid_count -#> [1] 4 -#> -#> $invalid_count -#> [1] 9 -#> -#> $match_percent -#> [1] 0.3076923 -#> -#> $match -#> [1] "partial" -#> -#> $label -#> [1] "Partial SDTM" -#> -#> $details -#> [1] "(4/13 cols/fields matched)" -#>
-
+
+

Examples

+
# Match is TRUE
+evaluateStandard(
+ data=safetyData::adam_adlbc, 
+ meta=safetyCharts::meta_labs, 
+ domain="labs", 
+ standard="adam"
+) 
+#> $standard
+#> [1] "adam"
+#> 
+#> $mapping
+#> # A tibble: 8 × 3
+#> # Rowwise: 
+#>   text_key        current  valid
+#>   <chr>           <chr>    <lgl>
+#> 1 id_col          USUBJID  TRUE 
+#> 2 value_col       AVAL     TRUE 
+#> 3 measure_col     PARAM    TRUE 
+#> 4 normal_col_low  A1LO     TRUE 
+#> 5 normal_col_high A1HI     TRUE 
+#> 6 studyday_col    ADY      TRUE 
+#> 7 visit_col       VISIT    TRUE 
+#> 8 visitn_col      VISITNUM TRUE 
+#> 
+#> $total_count
+#> [1] 8
+#> 
+#> $valid_count
+#> [1] 8
+#> 
+#> $invalid_count
+#> [1] 0
+#> 
+#> $match_percent
+#> [1] 1
+#> 
+#> $match
+#> [1] "full"
+#> 
+#> $label
+#> [1] "ADaM"
+#> 
+
+# Match is FALSE
+evaluateStandard(
+ data=safetyData::adam_adlbc, 
+ meta=safetyCharts::meta_labs, 
+ domain="labs", 
+ standard="sdtm"
+) 
+#> $standard
+#> [1] "sdtm"
+#> 
+#> $mapping
+#> # A tibble: 9 × 3
+#> # Rowwise: 
+#>   text_key        current  valid
+#>   <chr>           <chr>    <lgl>
+#> 1 id_col          USUBJID  TRUE 
+#> 2 value_col       LBSTRESN TRUE 
+#> 3 measure_col     NA       FALSE
+#> 4 normal_col_low  NA       FALSE
+#> 5 normal_col_high NA       FALSE
+#> 6 studyday_col    NA       FALSE
+#> 7 visit_col       VISIT    TRUE 
+#> 8 visitn_col      VISITNUM TRUE 
+#> 9 unit_col        NA       FALSE
+#> 
+#> $total_count
+#> [1] 9
+#> 
+#> $valid_count
+#> [1] 4
+#> 
+#> $invalid_count
+#> [1] 5
+#> 
+#> $match_percent
+#> [1] 0.4444444
+#> 
+#> $match
+#> [1] "partial"
+#> 
+#> $label
+#> [1] "Partial SDTM"
+#> 
+#> $details
+#> [1] "(4/9 cols/fields matched)"
+#> 
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/filterTab.html b/docs/reference/filterTab.html index 0f35e442..5b60c5b9 100644 --- a/docs/reference/filterTab.html +++ b/docs/reference/filterTab.html @@ -1,67 +1,12 @@ - - - - - - - -Server for the filter module in datamods::filter_data_ui — filterTab • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for the filter module in datamods::filter_data_ui — filterTab • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,83 +77,64 @@

Server for the filter module in datamods::filter_data_ui

Server for the filter module in datamods::filter_data_ui

-
filterTab(
-  input,
-  output,
-  session,
-  domainData,
-  filterDomain,
-  current_mapping,
-  tabID = "Filtering",
-  filterVars = NULL
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

domainData

list of data files for each domain

filterDomain

domain to use for filtering (typically "dm")

current_mapping

current data mapping

tabID

ID for the tab containing the filter UI (used for testing)

filterVars

Variables to use for filtering (used for testing)

- -

Value

+
+
filterTab(
+  input,
+  output,
+  session,
+  domainData,
+  filterDomain,
+  current_mapping,
+  tabID = "Filtering",
+  filterVars = NULL
+)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
domainData
+

list of data files for each domain

+
filterDomain
+

domain to use for filtering (typically "dm")

+
current_mapping
+

current data mapping

+
tabID
+

ID for the tab containing the filter UI (used for testing)

+
filterVars
+

Variables to use for filtering (used for testing)

+
+
+

Value

filtered data set

+
+
-
- +
- - + + diff --git a/docs/reference/filterTabChecks.html b/docs/reference/filterTabChecks.html index 36b1a1f3..1236d90a 100644 --- a/docs/reference/filterTabChecks.html +++ b/docs/reference/filterTabChecks.html @@ -1,67 +1,12 @@ - - - - - - - -Checks for whether the current data and settings support a filter tab — filterTabChecks • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Checks for whether the current data and settings support a filter tab — filterTabChecks • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,54 +77,45 @@

Checks for whether the current data and settings support a filter tab

Checks for whether the current data and settings support a filter tab

-
filterTabChecks(domainData, filterDomain, current_mapping)
- -

Arguments

- - - - - - - - - - - - - - -
domainData

list of data files for each domain

filterDomain

domain to use for filtering (typically "dm")

current_mapping

current data mapping (REACTIVE)

- -

Value

+
+
filterTabChecks(domainData, filterDomain, current_mapping)
+
+
+

Arguments

+
domainData
+

list of data files for each domain

+
filterDomain
+

domain to use for filtering (typically "dm")

+
current_mapping
+

current data mapping (REACTIVE)

+
+
+

Value

reactive that returns a boolean indicating whether the checks passed and filtering can be initialized

+
+
-
- +
- - + + diff --git a/docs/reference/filterTabUI.html b/docs/reference/filterTabUI.html index 345f6c02..a51a4075 100644 --- a/docs/reference/filterTabUI.html +++ b/docs/reference/filterTabUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for the filter module in datamods::filter_data_ui — filterTabUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for the filter module in datamods::filter_data_ui — filterTabUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for the filter module in datamods::filter_data_ui

UI for the filter module in datamods::filter_data_ui

-
filterTabUI(id)
- -

Arguments

- - - - - - -
id

module id

+
+
filterTabUI(id)
+
+
+

Arguments

+
id
+

module id

+
+
-
- +
- - + + diff --git a/docs/reference/generateMappingList.html b/docs/reference/generateMappingList.html index b5d44702..312828f6 100644 --- a/docs/reference/generateMappingList.html +++ b/docs/reference/generateMappingList.html @@ -1,67 +1,12 @@ - - - - - - - -Convert mapping data.frame to a list — generateMappingList • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Convert mapping data.frame to a list — generateMappingList • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,51 +77,41 @@

Convert mapping data.frame to a list

Convert mapping data.frame to a list

-
generateMappingList(settingsDF, domain = NULL, pull = FALSE)
- -

Arguments

- - - - - - - - - - - - - - -
settingsDF

data frame containing current mapping

domain

mapping domain to return (returns all domains as a named list by default)

pull

call pull() the value for each parameter - needed for testing only. default: FALSE

+
+
generateMappingList(settingsDF, domain = NULL, pull = FALSE)
+
+
+

Arguments

+
settingsDF
+

data frame containing current mapping

+
domain
+

mapping domain to return (returns all domains as a named list by default)

+
pull
+

call pull() the value for each parameter - needed for testing only. default: FALSE

+
+
-
- +
- - + + diff --git a/docs/reference/hasColumn.html b/docs/reference/hasColumn.html index 6a0d6ed1..714b6cc7 100644 --- a/docs/reference/hasColumn.html +++ b/docs/reference/hasColumn.html @@ -1,67 +1,12 @@ - - - - - - - -Check whether a column is found in a data set — hasColumn • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Check whether a column is found in a data set — hasColumn • safetyGraphics - - + + - - -
-
- -
- -
+
@@ -141,55 +77,52 @@

Check whether a column is found in a data set

Checks whether a specified column is found in a specified data set

-
hasColumn(columnName, data)
- -

Arguments

- - - - - - - - - - -
columnName

The column to look for.

data

the data.frame to search.

- -

Value

+
+
hasColumn(columnName, data)
+
+
+

Arguments

+
columnName
+

The column to look for.

+
data
+

the data.frame to search.

+
+
+

Value

logical scalar. TRUE if the column is found. FALSE otherwise

+
-

Examples

-
safetyGraphics:::hasColumn(columnName="PARAM",data=safetyData::adam_adlbc) #TRUE -
#> [1] TRUE
safetyGraphics:::hasColumn(columnName="Not_a_column",data=safetyData::adam_adlbc) #FALSE -
#> [1] FALSE
-
+
+

Examples

+
safetyGraphics:::hasColumn(columnName="PARAM",data=safetyData::adam_adlbc) #TRUE
+#> [1] TRUE
+safetyGraphics:::hasColumn(columnName="Not_a_column",data=safetyData::adam_adlbc) #FALSE
+#> [1] FALSE
+
+
+
+
-
- +

- - + + diff --git a/docs/reference/hasField.html b/docs/reference/hasField.html index de95f94c..71303d31 100644 --- a/docs/reference/hasField.html +++ b/docs/reference/hasField.html @@ -1,67 +1,12 @@ - - - - - - - -Check whether a specified field value is found in a data set — hasField • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Check whether a specified field value is found in a data set — hasField • safetyGraphics - + + - - - -
-
- -
- -
+
@@ -141,70 +77,65 @@

Check whether a specified field value is found in a data set

This checks whether a specific value is found in a specified column in a specified data set

-
hasField(fieldValue, columnName, data)
- -

Arguments

- - - - - - - - - - - - - - -
fieldValue

A value to check for.

columnName

The column to check.

data

the data.frame to search.

- -

Value

+
+
hasField(fieldValue, columnName, data)
+
+
+

Arguments

+
fieldValue
+

A value to check for.

+
columnName
+

The column to check.

+
data
+

the data.frame to search.

+
+
+

Value

logical scalar. TRUE if field_value is found. FALSE otherwise

+
-

Examples

-
#TRUE -safetyGraphics:::hasField( - fieldValue="Bilirubin (umol/L)", - columnName="PARAM", - data=safetyData::adam_adlbc -) -
#> [1] TRUE
-#FALSE -safetyGraphics:::hasField( - fieldValue="Not_a_real_value", - columnName="", - data=safetyData::adam_adlbc -) -
#> [1] FALSE
-
+
+

Examples

+
#TRUE
+safetyGraphics:::hasField(
+ fieldValue="Bilirubin (umol/L)",
+ columnName="PARAM",
+ data=safetyData::adam_adlbc
+)
+#> [1] TRUE
+
+#FALSE
+safetyGraphics:::hasField(
+ fieldValue="Not_a_real_value",
+ columnName="",
+ data=safetyData::adam_adlbc
+)
+#> [1] FALSE
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/homeTab.html b/docs/reference/homeTab.html index 271b6714..2beb9445 100644 --- a/docs/reference/homeTab.html +++ b/docs/reference/homeTab.html @@ -1,67 +1,12 @@ - - - - - - - -Server for the filter module in datamods::filter_data_ui — homeTab • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for the filter module in datamods::filter_data_ui — homeTab • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,51 +77,41 @@

Server for the filter module in datamods::filter_data_ui

Server for the filter module in datamods::filter_data_ui

-
homeTab(input, output, session)
- -

Arguments

- - - - - - - - - - - - - - -
input

mod input

output

mod output

session

mod session

+
+
homeTab(input, output, session)
+
+
+

Arguments

+
input
+

mod input

+
output
+

mod output

+
session
+

mod session

+
+
-
- +
- - + + diff --git a/docs/reference/homeTabUI.html b/docs/reference/homeTabUI.html index a0f101f6..808bd9c4 100644 --- a/docs/reference/homeTabUI.html +++ b/docs/reference/homeTabUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for the home module — homeTabUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for the home module — homeTabUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for the home module

UI for the home module

-
homeTabUI(id)
- -

Arguments

- - - - - - -
id

module id

+
+
homeTabUI(id)
+
+
+

Arguments

+
id
+

module id

+
+
-
- +
- - + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 80d4ccf1..40a3985d 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function reference • safetyGraphics - - + + - - -
-
- -
- -
+
- - - - - - - - - - -
-

Main Shiny App Functions

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - -
+

Main Shiny App Functions

+

safetyGraphicsApp()

Run the core safetyGraphics App

+

safetyGraphicsInit()

App to select charts, load data and then initialize the core safetyGraphics app

-

Shiny Modules

-

Reusable Shiny Modules

+
+

Shiny Modules

+

Reusable Shiny Modules

+

safetyGraphicsServer()

Server for core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules.

+

safetyGraphicsUI()

UI for the core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules.

+

chartsTab()

Server for chart module, designed to be re-used for each chart generated.

+

chartsTabUI()

UI for chart module, designed to be re-used for each chart generated.

+

filterTab()

Server for the filter module in datamods::filter_data_ui

+

filterTabUI()

UI for the filter module in datamods::filter_data_ui

+

homeTab()

Server for the filter module in datamods::filter_data_ui

+

homeTabUI()

UI for the home module

+

loadCharts()

Server for the chart loading module used in safetyGraphicsInit()

+

loadChartsUI()

UI for the chart loading module used in safetyGraphicsInit()

+

loadData()

Server for the data loading module used in safetyGraphicsInit()

+

loadDataUI()

UI for the data loading module used in safetyGraphicsInit()

+

mappingTab()

Server for mapping tab covering of all data domains

+

mappingTabUI()

UI for mapping tab covering of all data domains

+

mappingDomain()

Server that facilitates the mapping of a full data domain

+

mappingDomainUI()

UI that facilitates the mapping of a full data domain

+

mappingColumn()

Server that facilitates the mapping of a column data (and any associated fields)

+

mappingColumnUI()

UI that facilitates the mapping of a column data (and any associated fields)

+

mappingSelect()

Server that facilitates the mapping of a single data element (column or field) with a simple select UI

+

mappingSelectUI()

UI that facilitates the mapping of a single data element (column or field) with a simple select UI

+

settingsTab()

Server for the setting page

+

settingsTabUI()

UI for the settings tab

+

settingsCharts()

Server for settings tab showing details for the charts loaded in the app

+

settingsChartsUI()

UI for settings tab showing details for the charts loaded in the app

+

settingsData()

Server for settings tab showing current data

+

settingsDataUI()

UI for settings tab showing current data

+

settingsMapping()

Server for settings tab showing current mapping

+

settingsMappingUI()

UI for settings tab showing current mapping

+

settingsCode()

Server for settings tab providing code to re-start the app with current data/settings

+

settingsCodeUI()

UI for settings tab providing code to re-start the app with current data/settings

-

Data

-

Data sets used in the apps

-
-

meta

-

Metadata data frame containing information about the data mapping used to configure safetyGraphics charts. One record per unique data mapping

-

Helper Functions

-

Utility functions used in the apps

+
+

Helper Functions

+

Utility functions used in the apps

+

app_startup()

Startup code for shiny app

+

chartsNav()

Adds a navbar tab that initializes the Chart Module UI

+

detectStandard()

Detect the data standard used for a data set

+

evaluateStandard()

Evaluate a data set against a data standard

+

filterTabChecks()

Checks for whether the current data and settings support a filter tab

+

generateMappingList()

Convert mapping data.frame to a list

+

makeChartConfig()

Make Chart Config

+

makeChartExport()

Make Chart Export

+

makeChartParams()

Make Chart Parameters

+

makeChartSummary()

html chart summary

+

makeMapping()

Create data mapping based on data standards and user input

+
+

makeMeta()

+

Create a metadata object table for a set of charts

prepareChart()

Prepare a chart object for safetyGraphics

- +
+
-
- +
- - + + diff --git a/docs/reference/loadCharts.html b/docs/reference/loadCharts.html index 93fc883a..56ed5e02 100644 --- a/docs/reference/loadCharts.html +++ b/docs/reference/loadCharts.html @@ -1,67 +1,12 @@ - - - - - - - -Server for the chart loading module used in safetyGraphicsInit() — loadCharts • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for the chart loading module used in safetyGraphicsInit() — loadCharts • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,43 @@

Server for the chart loading module used in safetyGraphicsInit()

Server for the chart loading module used in safetyGraphicsInit()

-
loadCharts(input, output, session, charts = makeChartConfig())
- -

Arguments

- - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

charts

list containing chart specifications like those returned by makeChartConfig.

+
+
loadCharts(input, output, session, charts = makeChartConfig())
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
charts
+

list containing chart specifications like those returned by makeChartConfig.

+
+
-
- +
- - + + diff --git a/docs/reference/loadChartsUI.html b/docs/reference/loadChartsUI.html index 707ef954..389688a6 100644 --- a/docs/reference/loadChartsUI.html +++ b/docs/reference/loadChartsUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for the chart loading module used in safetyGraphicsInit() — loadChartsUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for the chart loading module used in safetyGraphicsInit() — loadChartsUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,47 +77,39 @@

UI for the chart loading module used in safetyGraphicsInit()

UI for the chart loading module used in safetyGraphicsInit()

-
loadChartsUI(id, charts = makeChartConfig())
- -

Arguments

- - - - - - - - - - -
id

module id

charts

list containing chart specifications like those returned by makeChartConfig.

+
+
loadChartsUI(id, charts = makeChartConfig())
+
+
+

Arguments

+
id
+

module id

+
charts
+

list containing chart specifications like those returned by makeChartConfig.

+
+
-
- +
- - + + diff --git a/docs/reference/loadData.html b/docs/reference/loadData.html index cdbba372..7b091f4a 100644 --- a/docs/reference/loadData.html +++ b/docs/reference/loadData.html @@ -1,67 +1,12 @@ - - - - - - - -Server for the data loading module used in safetyGraphicsInit() — loadData • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for the data loading module used in safetyGraphicsInit() — loadData • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,43 @@

Server for the data loading module used in safetyGraphicsInit()

Server for the data loading module used in safetyGraphicsInit()

-
loadData(input, output, session, domain)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

domain

data domain to be loaded

+
+
loadData(input, output, session, domain)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
domain
+

data domain to be loaded

+
+
-
- +
- - + + diff --git a/docs/reference/loadDataUI.html b/docs/reference/loadDataUI.html index 9b93d9e4..460107fe 100644 --- a/docs/reference/loadDataUI.html +++ b/docs/reference/loadDataUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for the data loading module used in safetyGraphicsInit() — loadDataUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for the data loading module used in safetyGraphicsInit() — loadDataUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,47 +77,39 @@

UI for the data loading module used in safetyGraphicsInit()

UI for the data loading module used in safetyGraphicsInit()

-
loadDataUI(id, domain = NULL)
- -

Arguments

- - - - - - - - - - -
id

module id

domain

character vector with domains to be loaded

+
+
loadDataUI(id, domain = NULL)
+
+
+

Arguments

+
id
+

module id

+
domain
+

character vector with domains to be loaded

+
+
-
- +
- - + + diff --git a/docs/reference/makeChartConfig.html b/docs/reference/makeChartConfig.html index 9dbd58bc..4a597c81 100644 --- a/docs/reference/makeChartConfig.html +++ b/docs/reference/makeChartConfig.html @@ -1,67 +1,12 @@ - - - - - - - -Make Chart Config — makeChartConfig • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Make Chart Config — makeChartConfig • safetyGraphics - + + - - - -
-
- -
- -
+
@@ -141,38 +77,29 @@

Make Chart Config

Converts YAML chart configuration files to an R list and binds workflow functions. See the vignette about creating custom charts for more details.

-
makeChartConfig(
-  dirs,
-  packages = "safetyCharts",
-  packageLocation = "config",
-  sourceFiles = TRUE
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
dirs

path to one or more directories containing yaml config files (relative to working directory)

packages

installed packages names containing yaml config files in the /inst/packageLocation folder

packageLocation

inst folder where yaml config files (and possibly R functions referenced in yaml workflow) are located in packages

sourceFiles

boolean indicating whether to source all R files found in dirs.

- -

Value

- -

returns a named list of charts derived from YAML files. Each element of the list contains information about a single chart, and has the following parameters:

    -
  • "env" Environment for the chart. Must be set to "safetyGraphics" or the chart is dropped.

  • +
    +
    makeChartConfig(
    +  dirs,
    +  packages = "safetyCharts",
    +  packageLocation = "config",
    +  sourceFiles = FALSE
    +)
    +
    + +
    +

    Arguments

    +
    dirs
    +

    path to one or more directories containing yaml config files (relative to working directory)

    +
    packages
    +

    installed packages names containing yaml config files in the /inst/packageLocation folder

    +
    packageLocation
    +

    inst folder where yaml config files (and possibly R functions referenced in yaml workflow) are located in packages

    +
    sourceFiles
    +

    boolean indicating whether to source all R files found in dirs.

    +
    +
    +

    Value

    +

    returns a named list of charts derived from YAML files. Each element of the list contains information about a single chart, and has the following parameters:

    • "env" Environment for the chart. Must be set to "safetyGraphics" or the chart is dropped.

    • "name" Name of the chart. Also the name of the element in the list - e.g. charts$aeExplorer$name is "aeExplorer"

    • "label" Short description of the chart

    • "type" Type of chart; options are: 'htmlwidget', 'module', 'plot', 'table', 'html' or 'plotly'.

    • @@ -184,34 +111,29 @@

      Value

    • "links" Named list of link names/urls to be shown in the chart header.

    • "workflow" List of functions names used to render chart. See vignette for details.

    • "functions" List of functions for use in chart renderering. These functions must be located in the global environment or package field of the YAML config. Function names must include either the name or workflow fields of the YAML config.

    • -
    - +
+
-
- +
- - + + diff --git a/docs/reference/makeChartExport.html b/docs/reference/makeChartExport.html index 28b6a5b8..ac7c4113 100644 --- a/docs/reference/makeChartExport.html +++ b/docs/reference/makeChartExport.html @@ -1,67 +1,12 @@ - - - - - - - -Make Chart Export — makeChartExport • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Make Chart Export — makeChartExport • safetyGraphics - + + - - - -
-
- -
- -
+
@@ -141,50 +77,43 @@

Make Chart Export

Creates R code that allows chart to be exported

-
makeChartExport(chart, mapping)
- -

Arguments

- - - - - - - - - - -
chart

chart object like the one generated by makeChartConfig().

mapping

mapping object like the one generated by makeMapping().

- -

Value

+
+
makeChartExport(chart, mapping)
+
+
+

Arguments

+
chart
+

chart object like the one generated by makeChartConfig().

+
mapping
+

mapping object like the one generated by makeMapping().

+
+
+

Value

returns a character vector that can be saved as R code.

+
+
-
- +
- - + + diff --git a/docs/reference/makeChartParams.html b/docs/reference/makeChartParams.html index 2239afbc..048d24cb 100644 --- a/docs/reference/makeChartParams.html +++ b/docs/reference/makeChartParams.html @@ -1,67 +1,12 @@ - - - - - - - -Make Chart Parameters — makeChartParams • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Make Chart Parameters — makeChartParams • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,51 +77,41 @@

Make Chart Parameters

Updates raw data and mapping for use with a specific chart

-
makeChartParams(data, chart, mapping)
- -

Arguments

- - - - - - - - - - - - - - -
data

list of domain-level data

chart

list containing chart specifications

mapping

data frame with current mapping

+
+
makeChartParams(data, chart, mapping)
+
+
+

Arguments

+
data
+

list of domain-level data

+
chart
+

list containing chart specifications

+
mapping
+

data frame with current mapping

+
+
-
- +
- - + + diff --git a/docs/reference/makeChartSummary.html b/docs/reference/makeChartSummary.html index 5206d7cd..501e15ff 100644 --- a/docs/reference/makeChartSummary.html +++ b/docs/reference/makeChartSummary.html @@ -1,67 +1,12 @@ - - - - - - - -html chart summary — makeChartSummary • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -html chart summary — makeChartSummary • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,51 +77,41 @@

html chart summary

makes a nicely formatted html summary for a chart object

-
makeChartSummary(chart, showLinks = TRUE, class = "chart-header")
- -

Arguments

- - - - - - - - - - - - - - -
chart

list containing chart specifications

showLinks

boolean indicating whether to include links

class

character to include as class

+
+
makeChartSummary(chart, showLinks = TRUE, class = "chart-header")
+
+
+

Arguments

+
chart
+

list containing chart specifications

+
showLinks
+

boolean indicating whether to include links

+
class
+

character to include as class

+
+
-
- +
- - + + diff --git a/docs/reference/makeMapping.html b/docs/reference/makeMapping.html index 34aa3e2e..f261cbd4 100644 --- a/docs/reference/makeMapping.html +++ b/docs/reference/makeMapping.html @@ -1,67 +1,12 @@ - - - - - - - -Create data mapping based on data standards and user input — makeMapping • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Create data mapping based on data standards and user input — makeMapping • safetyGraphics - + + - - - -
-
- -
- -
+
@@ -141,62 +77,48 @@

Create data mapping based on data standards and user input

Create data mapping based on data standards and user input

-
makeMapping(domainData, meta, autoMapping, customMapping)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
domainData

named list of data.frames to be loaded in to the app. Sample AdAM data from the safetyData package used by default

meta

data frame containing the metadata for use in the app. See the preloaded file (?safetyGraphics::meta) for more data specifications and details. Defaults to safetyGraphics::meta.

autoMapping

boolean indicating whether the app should use safetyGraphics::detectStandard() to detect data standards and automatically generate mappings for the data provided. Values specified in the customMapping parameter overwrite auto-generated mappings when both are found. Defaults to true.

customMapping

optional list specifying initial mapping values within each data mapping (e.g. list(aes= list(id_col='USUBJID', seq_col='AESEQ')).

- -

Value

- -

List containing data standard information and mapping

    -
  • "mapping" Initial Data Mapping

  • -
  • "standards" List of domain level data standards (or NULL if autoMapping is false)

  • -
+
+
makeMapping(domainData, meta, autoMapping, customMapping)
+
+
+

Arguments

+
domainData
+

named list of data.frames to be loaded in to the app. Sample AdAM data from the safetyData package used by default

+
meta
+

data frame containing the metadata for use in the app.

+
autoMapping
+

boolean indicating whether the app should use safetyGraphics::detectStandard() to detect data standards and automatically generate mappings for the data provided. Values specified in the customMapping parameter overwrite auto-generated mappings when both are found. Defaults to true.

+
customMapping
+

optional list specifying initial mapping values within each data mapping (e.g. list(aes= list(id_col='USUBJID', seq_col='AESEQ')).

+
+
+

Value

+

List containing data standard information and mapping

  • "mapping" Initial Data Mapping

  • +
  • "standards" List of domain level data standards (or NULL if autoMapping is false)

  • +
+
-
- +
- - + + diff --git a/docs/reference/makeMeta.html b/docs/reference/makeMeta.html new file mode 100644 index 00000000..d7e91daa --- /dev/null +++ b/docs/reference/makeMeta.html @@ -0,0 +1,156 @@ + +Create a metadata object table for a set of charts — makeMeta • safetyGraphics + + +
+
+ + + +
+
+ + +
+

Generates metadata object for a list of charts. makeMeta() looks for metadata in 3 locations for each chart object:

  • Domain-level metadata saved as meta_chart$name in the chart$package namespace

  • +
  • Chart-specific metadata saved as meta_chart$domain in the chart$package namespace

  • +
  • Chart-specific metadata saved directly to the chart object as chart$meta +After checking all charts, all metadata files are stacked in to a single dataframe and returned. If duplicate metadata rows (domain + text_key) are found, an error is thrown.

  • +
+ +
+
makeMeta(charts)
+
+ +
+

Arguments

+
charts
+

list of safetyGraphics chart objects for which to create metadata

+
+
+

Value

+

tibble of metadata with the following columns:

domain
+

Data domain

+ +
text_key
+

Text key indicating the setting name. '--' delimiter indicates a field level data mapping

+ +
col_key
+

Key for the column mapping

+ +
field_key
+

Key for the field mapping (if any)

+ +
type
+

type of mapping - "field" or "column"

+ +
label
+

Label

+ +
description
+

Description

+ +
multiple
+

Mapping supports multiple columns/fields

+ +
standard_adam
+

Default values for the ADaM data standard

+ +
standard_sdtm
+

Default values for the SDTM data standard

+ + +
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.2.

+
+ +
+ + + + + + + + diff --git a/docs/reference/mappingColumn.html b/docs/reference/mappingColumn.html index a8d4bd7f..96afa46e 100644 --- a/docs/reference/mappingColumn.html +++ b/docs/reference/mappingColumn.html @@ -1,67 +1,12 @@ - - - - - - - -Server that facilitates the mapping of a column data (and any associated fields) — mappingColumn • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server that facilitates the mapping of a column data (and any associated fields) — mappingColumn • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,62 +77,49 @@

Server that facilitates the mapping of a column data (and any associated fie

Server that facilitates the mapping of a column data (and any associated fields)

-
mappingColumn(input, output, session, meta, data)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

meta

metadata data frame for the object

data

current data file for the domain

- -

Value

+
+
mappingColumn(input, output, session, meta, data)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
meta
+

metadata data frame for the object

+
data
+

current data file for the domain

+
+
+

Value

A reactive data.frame providing the current value for text_key associated with the selected column

+
+
-
- +
- - + + diff --git a/docs/reference/mappingColumnUI.html b/docs/reference/mappingColumnUI.html index 9d84936d..068b7431 100644 --- a/docs/reference/mappingColumnUI.html +++ b/docs/reference/mappingColumnUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI that facilitates the mapping of a column data (and any associated fields) — mappingColumnUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI that facilitates the mapping of a column data (and any associated fields) — mappingColumnUI • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,43 @@

UI that facilitates the mapping of a column data (and any associated fields)

UI that facilitates the mapping of a column data (and any associated fields)

-
mappingColumnUI(id, meta, data, mapping = NULL)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
id

module id

meta

metadata for the column (and related fields)

data

current data file for the domain

mapping

current data mapping for the column (and related fields)

+
+
mappingColumnUI(id, meta, data, mapping = NULL)
+
+
+

Arguments

+
id
+

module id

+
meta
+

metadata for the column (and related fields)

+
data
+

current data file for the domain

+
mapping
+

current data mapping for the column (and related fields)

+
+
-
- +
- - + + diff --git a/docs/reference/mappingDomain.html b/docs/reference/mappingDomain.html index 1cf44e69..0de30f59 100644 --- a/docs/reference/mappingDomain.html +++ b/docs/reference/mappingDomain.html @@ -1,67 +1,12 @@ - - - - - - - -Server that facilitates the mapping of a full data domain — mappingDomain • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server that facilitates the mapping of a full data domain — mappingDomain • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,62 +77,49 @@

Server that facilitates the mapping of a full data domain

Server that facilitates the mapping of a full data domain

-
mappingDomain(input, output, session, meta, data)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

meta

metadata for the domain

data

clinical data for the domain

- -

Value

+
+
mappingDomain(input, output, session, meta, data)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
meta
+

metadata for the domain

+
data
+

clinical data for the domain

+
+
+

Value

A reactive data frame containing the mapping for the domain

+
+
-
- +
- - + + diff --git a/docs/reference/mappingDomainUI.html b/docs/reference/mappingDomainUI.html index 3e43c745..bcd2fe14 100644 --- a/docs/reference/mappingDomainUI.html +++ b/docs/reference/mappingDomainUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI that facilitates the mapping of a full data domain — mappingDomainUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI that facilitates the mapping of a full data domain — mappingDomainUI • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,43 @@

UI that facilitates the mapping of a full data domain

UI that facilitates the mapping of a full data domain

-
mappingDomainUI(id, meta, data, mapping = NULL)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
id

module id

meta

metadata for the domain

data

data file for the domain

mapping

current data mapping

+
+
mappingDomainUI(id, meta, data, mapping = NULL)
+
+
+

Arguments

+
id
+

module id

+
meta
+

metadata for the domain

+
data
+

data file for the domain

+
mapping
+

current data mapping

+
+
-
- +
- - + + diff --git a/docs/reference/mappingSelect.html b/docs/reference/mappingSelect.html index 867d045e..3d7efbb1 100644 --- a/docs/reference/mappingSelect.html +++ b/docs/reference/mappingSelect.html @@ -1,67 +1,12 @@ - - - - - - - -Server that facilitates the mapping of a single data element (column or field) with a simple select UI — mappingSelect • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server that facilitates the mapping of a single data element (column or field) with a simple select UI — mappingSelect • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,54 +77,45 @@

Server that facilitates the mapping of a single data element (column or fiel

Server that facilitates the mapping of a single data element (column or field) with a simple select UI

-
mappingSelect(input, output, session)
- -

Arguments

- - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

- -

Value

+
+
mappingSelect(input, output, session)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
+
+

Value

A reactive containing the selected column

+
+
-
- +
- - + + diff --git a/docs/reference/mappingSelectUI.html b/docs/reference/mappingSelectUI.html index 07506b3d..fe6d3325 100644 --- a/docs/reference/mappingSelectUI.html +++ b/docs/reference/mappingSelectUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI that facilitates the mapping of a single data element (column or field) with a simple select UI — mappingSelectUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI that facilitates the mapping of a single data element (column or field) with a simple select UI — mappingSelectUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,58 +77,47 @@

UI that facilitates the mapping of a single data element (column or field) w

UI that facilitates the mapping of a single data element (column or field) with a simple select UI

-
mappingSelectUI(id, label, choices = NULL, default = NULL)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
id

unique id for the UI

label

label associated with the control

choices

a list of options for the control

default

default value for the control

- -

Value

+
+
mappingSelectUI(id, label, choices = NULL, default = NULL)
+
+
+

Arguments

+
id
+

unique id for the UI

+
label
+

label associated with the control

+
choices
+

a list of options for the control

+
default
+

default value for the control

+
+
+

Value

returns the selected value wrapped in a reactive().

+
+
-
- +
- - + + diff --git a/docs/reference/mappingTab.html b/docs/reference/mappingTab.html index ada00444..d3f852cd 100644 --- a/docs/reference/mappingTab.html +++ b/docs/reference/mappingTab.html @@ -1,67 +1,12 @@ - - - - - - - -Server for mapping tab covering of all data domains — mappingTab • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for mapping tab covering of all data domains — mappingTab • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,62 +77,49 @@

Server for mapping tab covering of all data domains

Server for mapping tab covering of all data domains

-
mappingTab(input, output, session, meta, domainData)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

meta

metadata for all domains

domainData

clinical data for all domains

- -

Value

+
+
mappingTab(input, output, session, meta, domainData)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
meta
+

metadata for all domains

+
domainData
+

clinical data for all domains

+
+
+

Value

list of mappings for all domains

+
+
-
- +
- - + + diff --git a/docs/reference/mappingTabUI.html b/docs/reference/mappingTabUI.html index 7ff3bf36..0267550a 100644 --- a/docs/reference/mappingTabUI.html +++ b/docs/reference/mappingTabUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for mapping tab covering of all data domains — mappingTabUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for mapping tab covering of all data domains — mappingTabUI • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,59 +77,45 @@

UI for mapping tab covering of all data domains

UI for mapping tab covering of all data domains

-
mappingTabUI(id, meta, domainData, mappings = NULL, standards = NULL)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
id

module id

meta

metadata for all domains

domainData

list of data files for each domain

mappings

optional data frame containing stacked mappings for all domains

standards

optional list of data standards like the ones generated by detectStandard()

+
+
mappingTabUI(id, meta, domainData, mappings = NULL, standards = NULL)
+
+
+

Arguments

+
id
+

module id

+
meta
+

metadata for all domains

+
domainData
+

list of data files for each domain

+
mappings
+

optional data frame containing stacked mappings for all domains

+
standards
+

optional list of data standards like the ones generated by detectStandard()

+
+
-
- +
- - + + diff --git a/docs/reference/prepareChart.html b/docs/reference/prepareChart.html index 4cb6f2af..4048c970 100644 --- a/docs/reference/prepareChart.html +++ b/docs/reference/prepareChart.html @@ -1,67 +1,12 @@ - - - - - - - -Prepare a chart object for safetyGraphics — prepareChart • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Prepare a chart object for safetyGraphics — prepareChart • safetyGraphics - + + - - - -
-
- -
- -
+
@@ -141,46 +77,41 @@

Prepare a chart object for safetyGraphics

Sets default values and binds needed functions to a chart object based on chart type.

-
prepareChart(chart)
- -

Arguments

- - - - - - -
chart

chart object like the one generated by makeChartConfig().

- -

Value

+
+
prepareChart(chart)
+
+
+

Arguments

+
chart
+

chart object like the one generated by makeChartConfig().

+
+
+

Value

returns the chart object with a new functions object added.

+
+
-
- +
- - + + diff --git a/docs/reference/safetyGraphicsApp.html b/docs/reference/safetyGraphicsApp.html index 1065f930..55735e8f 100644 --- a/docs/reference/safetyGraphicsApp.html +++ b/docs/reference/safetyGraphicsApp.html @@ -1,67 +1,12 @@ - - - - - - - -Run the core safetyGraphics App — safetyGraphicsApp • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Run the core safetyGraphics App — safetyGraphicsApp • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,76 +77,61 @@

Run the core safetyGraphics App

Run the core safetyGraphics App

-
safetyGraphicsApp(
-  domainData = list(labs = safetyData::adam_adlbc, aes = safetyData::adam_adae, dm =
-    safetyData::adam_adsl),
-  meta = safetyGraphics::meta,
-  charts = NULL,
-  mapping = NULL,
-  autoMapping = TRUE,
-  filterDomain = "dm",
-  chartSettingsPaths = NULL
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
domainData

named list of data.frames to be loaded in to the app. Sample AdAM data from the safetyData package used by default

meta

data frame containing the metadata for use in the app. See the preloaded file (?safetyGraphics::meta) for more data specifications and details. Defaults to safetyGraphics::meta.

charts

list of charts in the format produced by safetyGraphics::makeChartConfig()

mapping

list specifying the initial mapping values for each data mapping for each domain (e.g. list(aes= list(id_col='USUBJID', seq_col='AESEQ')).

autoMapping

boolean indicating whether the app should attempt to automatically detect data standards and generate mappings for the data provided. Values specified in the mapping parameter overwrite automatically generated mappings when both are found. Defaults to true.

filterDomain

domain used for the data/filter tab. Demographics ("dm") is used by default. Using a domain that is not one record per participant is not recommended.

chartSettingsPaths

path(s) where customization functions are saved relative to your working directory. All charts can have initialization (e.g. myChart_Init.R) and static charts can have charting functions (e.g. myGraphic_Chart.R). All R files in this folder are sourced and files with the correct naming convention are linked to the chart. See the Custom Charts vignette for more details.

+
+
safetyGraphicsApp(
+  domainData = list(labs = safetyData::adam_adlbc, aes = safetyData::adam_adae, dm =
+    safetyData::adam_adsl),
+  meta = NULL,
+  charts = NULL,
+  mapping = NULL,
+  autoMapping = TRUE,
+  filterDomain = "dm",
+  chartSettingsPaths = NULL,
+  runNow = TRUE
+)
+
+
+

Arguments

+
domainData
+

named list of data.frames to be loaded in to the app. Sample AdAM data from the safetyData package used by default

+
meta
+

data frame containing the metadata for use in the app. If no metadata is provided, metatdata is generated by makeMeta().

+
charts
+

list of charts in the format produced by safetyGraphics::makeChartConfig()

+
mapping
+

list specifying the initial mapping values for each data mapping for each domain (e.g. list(aes= list(id_col='USUBJID', seq_col='AESEQ')).

+
autoMapping
+

boolean indicating whether the app should attempt to automatically detect data standards and generate mappings for the data provided. Values specified in the mapping parameter overwrite automatically generated mappings when both are found. Defaults to true.

+
filterDomain
+

domain used for the data/filter tab. Demographics ("dm") is used by default. Using a domain that is not one record per participant is not recommended.

+
chartSettingsPaths
+

path(s) where customization functions are saved relative to your working directory. All charts can have initialization (e.g. myChart_Init.R) and static charts can have charting functions (e.g. myGraphic_Chart.R). All R files in this folder are sourced and files with the correct naming convention are linked to the chart. See the Custom Charts vignette for more details.

+
runNow
+

Should the shiny app object created be run directly? Helpful when writing functions to dispatch to shinyapps, rsconnect, or shinyproxy.

+
+
-
- +
- - + + diff --git a/docs/reference/safetyGraphicsInit.html b/docs/reference/safetyGraphicsInit.html index 4e13b67c..db656b9c 100644 --- a/docs/reference/safetyGraphicsInit.html +++ b/docs/reference/safetyGraphicsInit.html @@ -1,67 +1,12 @@ - - - - - - - -App to select charts, load data and then initialize the core safetyGraphics app — safetyGraphicsInit • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -App to select charts, load data and then initialize the core safetyGraphics app — safetyGraphicsInit • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,45 @@

App to select charts, load data and then initialize the core safetyGraphics

App to select charts, load data and then initialize the core safetyGraphics app

-
safetyGraphicsInit(
-  charts = makeChartConfig(),
-  delayTime = 1000,
-  maxFileSize = NULL
-)
- -

Arguments

- - - - - - - - - - - - - - -
charts

chart object

delayTime

time (in ms) between drawing app UI and starting server. Default set to 1000 (1 second), but could need to be higher on slow machine.

maxFileSize

maximum file size in MB allowed for file upload

+
+
safetyGraphicsInit(
+  charts = makeChartConfig(),
+  delayTime = 1000,
+  maxFileSize = NULL
+)
+
+
+

Arguments

+
charts
+

chart object

+
delayTime
+

time (in ms) between drawing app UI and starting server. Default set to 1000 (1 second), but could need to be higher on slow machine.

+
maxFileSize
+

maximum file size in MB allowed for file upload

+
+
-
- +
- - + + diff --git a/docs/reference/safetyGraphicsServer.html b/docs/reference/safetyGraphicsServer.html index 5ecd0eea..04fef849 100644 --- a/docs/reference/safetyGraphicsServer.html +++ b/docs/reference/safetyGraphicsServer.html @@ -1,67 +1,12 @@ - - - - - - - -Server for core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules. — safetyGraphicsServer • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules. — safetyGraphicsServer • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,80 +77,60 @@

Server for core safetyGraphics app including Home, Mapping, Filter, Charts a

This function returns a server function suitable for use in shiny::runApp()

-
safetyGraphicsServer(
-  input,
-  output,
-  session,
-  meta,
-  mapping,
-  domainData,
-  charts,
-  filterDomain
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

meta

data frame containing the metadata for use in the app. See the preloaded file (?safetyGraphics::meta) for more data specifications and details. Defaults to safetyGraphics::meta.

mapping

current mapping

domainData

named list of data.frames to be loaded in to the app.

charts

list of charts to include in the app

filterDomain

domain used for the data/filter tab. Demographics ("dm") is used by default. Using a domain that is not one record per participant is not recommended.

+
+
safetyGraphicsServer(
+  input,
+  output,
+  session,
+  meta,
+  mapping,
+  domainData,
+  charts,
+  filterDomain
+)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
meta
+

data frame containing the metadata for use in the app.

+
mapping
+

current mapping

+
domainData
+

named list of data.frames to be loaded in to the app.

+
charts
+

list of charts to include in the app

+
filterDomain
+

domain used for the data/filter tab. Demographics ("dm") is used by default. Using a domain that is not one record per participant is not recommended.

+
+
-
- +

- - + + diff --git a/docs/reference/safetyGraphicsUI.html b/docs/reference/safetyGraphicsUI.html index 8df0e044..3ad2244c 100644 --- a/docs/reference/safetyGraphicsUI.html +++ b/docs/reference/safetyGraphicsUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for the core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules. — safetyGraphicsUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for the core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules. — safetyGraphicsUI • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,59 +77,45 @@

UI for the core safetyGraphics app including Home, Mapping, Filter, Charts a

UI for the core safetyGraphics app including Home, Mapping, Filter, Charts and Settings modules.

-
safetyGraphicsUI(id, meta, domainData, mapping, standards)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
id

module ID

meta

data frame containing the metadata for use in the app. See the preloaded file (?safetyGraphics::meta) for more data specifications and details. Defaults to safetyGraphics::meta.

domainData

named list of data.frames to be loaded in to the app.

mapping

data.frame specifying the initial values for each data mapping. If no mapping is provided, the app will attempt to generate one via detectStandard()

standards

a list of information regarding data standards. Each list item should use the format returned by safetyGraphics::detectStandard.

+
+
safetyGraphicsUI(id, meta, domainData, mapping, standards)
+
+
+

Arguments

+
id
+

module ID

+
meta
+

data frame containing the metadata for use in the app.

+
domainData
+

named list of data.frames to be loaded in to the app.

+
mapping
+

data.frame specifying the initial values for each data mapping. If no mapping is provided, the app will attempt to generate one via detectStandard()

+
standards
+

a list of information regarding data standards. Each list item should use the format returned by safetyGraphics::detectStandard.

+
+
-
- +
- - + + diff --git a/docs/reference/setMappingListValue.html b/docs/reference/setMappingListValue.html index 2a64a5a7..a42e8161 100644 --- a/docs/reference/setMappingListValue.html +++ b/docs/reference/setMappingListValue.html @@ -1,67 +1,12 @@ - - - - - - - -Set the value for a given named parameter — setMappingListValue • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Set the value for a given named parameter — setMappingListValue • safetyGraphics - + + - - - -
-
- -
- -
+
@@ -141,68 +77,60 @@

Set the value for a given named parameter

Sets the value for a named parameter (key) to given value in a list (settings)

-
setMappingListValue(key, value, settings, forceCreate = FALSE)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
key

a list defining the position of parameter in the settings object.

value

the value to set

settings

The settings list used to generate a chart like eDISH()

forceCreate

Specifies whether the function should create a new list() when none exisits. This most commonly occurs when deeply nested objects.

- -

Value

+
+
setMappingListValue(key, value, settings, forceCreate = FALSE)
+
+
+

Arguments

+
key
+

a list defining the position of parameter in the settings object.

+
value
+

the value to set

+
settings
+

The settings list used to generate a chart like eDISH()

+
forceCreate
+

Specifies whether the function should create a new list() when none exisits. This most commonly occurs when deeply nested objects.

+
+
+

Value

the updated settings object

+
-

Examples

-
testSet<-list(a=list(b="myValue")) -safetyGraphics:::setMappingListValue(key=list("a","b"), value="notMyValue", settings=testSet) -
#> $a -#> $a$b -#> [1] "notMyValue" -#> -#>
#returns list(a=list(b="notMyValue"))) - -
+
+

Examples

+
testSet<-list(a=list(b="myValue"))
+safetyGraphics:::setMappingListValue(key=list("a","b"), value="notMyValue", settings=testSet) 
+#> $a
+#> $a$b
+#> [1] "notMyValue"
+#> 
+#> 
+#returns list(a=list(b="notMyValue")))
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/settingsCharts.html b/docs/reference/settingsCharts.html index 0eb8c4cb..e13b6e39 100644 --- a/docs/reference/settingsCharts.html +++ b/docs/reference/settingsCharts.html @@ -1,67 +1,12 @@ - - - - - - - -Server for settings tab showing details for the charts loaded in the app — settingsCharts • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for settings tab showing details for the charts loaded in the app — settingsCharts • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,43 @@

Server for settings tab showing details for the charts loaded in the app

Server for settings tab showing details for the charts loaded in the app

-
settingsCharts(input, output, session, charts)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

charts

list data frame summarizing the charts

+
+
settingsCharts(input, output, session, charts)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
charts
+

list data frame summarizing the charts

+
+
-
- +
- - + + diff --git a/docs/reference/settingsChartsUI.html b/docs/reference/settingsChartsUI.html index f039166c..0ffd7613 100644 --- a/docs/reference/settingsChartsUI.html +++ b/docs/reference/settingsChartsUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for settings tab showing details for the charts loaded in the app — settingsChartsUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for settings tab showing details for the charts loaded in the app — settingsChartsUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for settings tab showing details for the charts loaded in the app

UI for settings tab showing details for the charts loaded in the app

-
settingsChartsUI(id)
- -

Arguments

- - - - - - -
id

module id

+
+
settingsChartsUI(id)
+
+
+

Arguments

+
id
+

module id

+
+
-
- +
- - + + diff --git a/docs/reference/settingsCode.html b/docs/reference/settingsCode.html index 80c0c235..88b9ca4a 100644 --- a/docs/reference/settingsCode.html +++ b/docs/reference/settingsCode.html @@ -1,67 +1,12 @@ - - - - - - - -Server for settings tab providing code to re-start the app with current data/settings — settingsCode • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for settings tab providing code to re-start the app with current data/settings — settingsCode • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,63 +77,47 @@

Server for settings tab providing code to re-start the app with current data

Server for settings tab providing code to re-start the app with current data/settings

-
settingsCode(input, output, session, mapping, charts, domainData)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

mapping

mapping

charts

charts

domainData

data list

+
+
settingsCode(input, output, session, mapping, charts, domainData)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
mapping
+

mapping

+
charts
+

charts

+
domainData
+

data list

+
+
-
- +
- - + + diff --git a/docs/reference/settingsCodeUI.html b/docs/reference/settingsCodeUI.html index 543ec4f7..32b89bf1 100644 --- a/docs/reference/settingsCodeUI.html +++ b/docs/reference/settingsCodeUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for settings tab providing code to re-start the app with current data/settings — settingsCodeUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for settings tab providing code to re-start the app with current data/settings — settingsCodeUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for settings tab providing code to re-start the app with current data/set

UI for settings tab providing code to re-start the app with current data/settings

-
settingsCodeUI(id)
- -

Arguments

- - - - - - -
id

module ID

+
+
settingsCodeUI(id)
+
+
+

Arguments

+
id
+

module ID

+
+
-
- +
- - + + diff --git a/docs/reference/settingsData.html b/docs/reference/settingsData.html index fd0b7f86..4bb8b565 100644 --- a/docs/reference/settingsData.html +++ b/docs/reference/settingsData.html @@ -1,67 +1,12 @@ - - - - - - - -Server for settings tab showing current data — settingsData • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for settings tab showing current data — settingsData • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,55 +77,43 @@

Server for settings tab showing current data

Server for settings tab showing current data

-
settingsData(input, output, session, domains)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

domains

named list of the data.frames for each domain

+
+
settingsData(input, output, session, domains)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
domains
+

named list of the data.frames for each domain

+
+
-
- +
- - + + diff --git a/docs/reference/settingsDataUI.html b/docs/reference/settingsDataUI.html index 675a0629..42619ca3 100644 --- a/docs/reference/settingsDataUI.html +++ b/docs/reference/settingsDataUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for settings tab showing current data — settingsDataUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for settings tab showing current data — settingsDataUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for settings tab showing current data

UI for settings tab showing current data

-
settingsDataUI(id)
- -

Arguments

- - - - - - -
id

module id

+
+
settingsDataUI(id)
+
+
+

Arguments

+
id
+

module id

+
+
-
- +

- - + + diff --git a/docs/reference/settingsMapping.html b/docs/reference/settingsMapping.html index 71d4a20b..457fd910 100644 --- a/docs/reference/settingsMapping.html +++ b/docs/reference/settingsMapping.html @@ -1,67 +1,12 @@ - - - - - - - -Server for settings tab showing current mapping — settingsMapping • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for settings tab showing current mapping — settingsMapping • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,59 +77,45 @@

Server for settings tab showing current mapping

Server for settings tab showing current mapping

-
settingsMapping(input, output, session, metadata, mapping)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

metadata

Data mapping metadata used for initial loading of app

mapping

reactive data frame representing the current metadata mapping. columns = "domain", "text_id" and "current"

+
+
settingsMapping(input, output, session, metadata, mapping)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
metadata
+

Data mapping metadata used for initial loading of app

+
mapping
+

reactive data frame representing the current metadata mapping. columns = "domain", "text_id" and "current"

+
+
-
- +
- - + + diff --git a/docs/reference/settingsMappingUI.html b/docs/reference/settingsMappingUI.html index ac16a70b..e8ea6262 100644 --- a/docs/reference/settingsMappingUI.html +++ b/docs/reference/settingsMappingUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for settings tab showing current mapping — settingsMappingUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for settings tab showing current mapping — settingsMappingUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for settings tab showing current mapping

UI for settings tab showing current mapping

-
settingsMappingUI(id)
- -

Arguments

- - - - - - -
id

module id

+
+
settingsMappingUI(id)
+
+
+

Arguments

+
id
+

module id

+
+
-
- +
- - + + diff --git a/docs/reference/settingsTab.html b/docs/reference/settingsTab.html index 6e7d3907..7186a2ee 100644 --- a/docs/reference/settingsTab.html +++ b/docs/reference/settingsTab.html @@ -1,67 +1,12 @@ - - - - - - - -Server for the setting page — settingsTab • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Server for the setting page — settingsTab • safetyGraphics - - - - + + -
-
- -
- -
+
@@ -141,67 +77,49 @@

Server for the setting page

Server for the setting page

-
settingsTab(input, output, session, domains, metadata, mapping, charts)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
input

Shiny input object

output

Shiny output object

session

Shiny session object

domains

domains

metadata

metadata

mapping

mapping

charts

charts

+
+
settingsTab(input, output, session, domains, metadata, mapping, charts)
+
+
+

Arguments

+
input
+

Shiny input object

+
output
+

Shiny output object

+
session
+

Shiny session object

+
domains
+

domains

+
metadata
+

metadata

+
mapping
+

mapping

+
charts
+

charts

+
+
-
- +
- - + + diff --git a/docs/reference/settingsTabUI.html b/docs/reference/settingsTabUI.html index 0f54bae1..a91efbdf 100644 --- a/docs/reference/settingsTabUI.html +++ b/docs/reference/settingsTabUI.html @@ -1,67 +1,12 @@ - - - - - - - -UI for the settings tab — settingsTabUI • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -UI for the settings tab — settingsTabUI • safetyGraphics + + - - - - -
-
- -
- -
+
@@ -141,43 +77,37 @@

UI for the settings tab

UI for the settings tab

-
settingsTabUI(id)
- -

Arguments

- - - - - - -
id

module ID

+
+
settingsTabUI(id)
+
+
+

Arguments

+
id
+

module ID

+
+
-
- +
- - + + diff --git a/docs/reference/textKeysToList.html b/docs/reference/textKeysToList.html index 0d2ef132..47885c93 100644 --- a/docs/reference/textKeysToList.html +++ b/docs/reference/textKeysToList.html @@ -1,67 +1,12 @@ - - - - - - - -Helper function to convert keys from text to nested lists — textKeysToList • safetyGraphics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Helper function to convert keys from text to nested lists — textKeysToList • safetyGraphics - - + + - - -
-
- -
- -
+
@@ -141,70 +77,69 @@

Helper function to convert keys from text to nested lists

Convert settings keys from text vectors (using the "--" delimiter) to a list of lists

-
textKeysToList(textKeys)
- -

Arguments

- - - - - - -
textKeys

a list (or vector) of character keys using the "--" delimiter to indicate hierarchy

- -

Value

+
+
textKeysToList(textKeys)
+
+
+

Arguments

+
textKeys
+

a list (or vector) of character keys using the "--" delimiter to indicate hierarchy

+
+
+

Value

A list of unnamed lists, with position in the nested list indicating hierarchy

+
-

Examples

-
safetyGraphics:::textKeysToList("id_col") -
#> [[1]] -#> [[1]][[1]] -#> [1] "id_col" -#> -#>
#list(list("id_col")) - -#list(list("id_col"),list("measure_col","label")) -safetyGraphics:::textKeysToList(c("id_col","measure_col--label")) -
#> [[1]] -#> [[1]][[1]] -#> [1] "id_col" -#> -#> -#> [[2]] -#> [[2]][[1]] -#> [1] "measure_col" -#> -#> [[2]][[2]] -#> [1] "label" -#> -#>
-
+
+

Examples

+
safetyGraphics:::textKeysToList("id_col") 
+#> [[1]]
+#> [[1]][[1]]
+#> [1] "id_col"
+#> 
+#> 
+#list(list("id_col"))
+
+#list(list("id_col"),list("measure_col","label"))
+safetyGraphics:::textKeysToList(c("id_col","measure_col--label")) 
+#> [[1]]
+#> [[1]][[1]]
+#> [1] "id_col"
+#> 
+#> 
+#> [[2]]
+#> [[2]][[1]]
+#> [1] "measure_col"
+#> 
+#> [[2]][[2]]
+#> [1] "label"
+#> 
+#> 
+
+
+
+
-
- +
- - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 6760540d..b36fdc34 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,168 +1,273 @@ - https://pages.github.com/SafetyGraphics/safetyGraphics/index.html + https://safetygraphics.github.io/safetyGraphics/404.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/SafetyGraphics.html + https://safetygraphics.github.io/safetyGraphics/LICENSE-text.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/app_startup.html + https://safetygraphics.github.io/safetyGraphics/LICENSE.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/chartsNav.html + https://safetygraphics.github.io/safetyGraphics/articles/Cookbook.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/chartsTab.html + https://safetygraphics.github.io/safetyGraphics/articles/TechnicalFAQ.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/chartsTabUI.html + https://safetygraphics.github.io/safetyGraphics/articles/chartConfiguration.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/detectStandard.html + https://safetygraphics.github.io/safetyGraphics/articles/customWorkflows.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/evaluateStandard.html + https://safetygraphics.github.io/safetyGraphics/articles/index.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/filterTab.html + https://safetygraphics.github.io/safetyGraphics/articles/intro.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/filterTabChecks.html + https://safetygraphics.github.io/safetyGraphics/articles/shinyUserGuide.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/filterTabUI.html + https://safetygraphics.github.io/safetyGraphics/authors.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/generateMappingList.html + https://safetygraphics.github.io/safetyGraphics/index.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/hasColumn.html + https://safetygraphics.github.io/safetyGraphics/news/index.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/hasField.html + https://safetygraphics.github.io/safetyGraphics/reference/SafetyGraphics.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/homeTab.html + https://safetygraphics.github.io/safetyGraphics/reference/addChart.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/homeTabUI.html + https://safetygraphics.github.io/safetyGraphics/reference/addSetting.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/loadCharts.html + https://safetygraphics.github.io/safetyGraphics/reference/adlbc.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/loadChartsUI.html + https://safetygraphics.github.io/safetyGraphics/reference/app_startup.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/loadData.html + https://safetygraphics.github.io/safetyGraphics/reference/chartRenderer-shiny.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/loadDataUI.html + https://safetygraphics.github.io/safetyGraphics/reference/chartRenderer.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/makeChartConfig.html + https://safetygraphics.github.io/safetyGraphics/reference/chartsMetadata.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/makeChartExport.html + https://safetygraphics.github.io/safetyGraphics/reference/chartsNav.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/makeChartParams.html + https://safetygraphics.github.io/safetyGraphics/reference/chartsTab.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/makeChartSummary.html + https://safetygraphics.github.io/safetyGraphics/reference/chartsTabUI.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/makeMapping.html + https://safetygraphics.github.io/safetyGraphics/reference/checkColumn.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingColumn.html + https://safetygraphics.github.io/safetyGraphics/reference/checkField.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingColumnUI.html + https://safetygraphics.github.io/safetyGraphics/reference/checkNumeric.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingDomain.html + https://safetygraphics.github.io/safetyGraphics/reference/checkRequired.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingDomainUI.html + https://safetygraphics.github.io/safetyGraphics/reference/createChart.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingSelect.html + https://safetygraphics.github.io/safetyGraphics/reference/detectStandard.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingSelectUI.html + https://safetygraphics.github.io/safetyGraphics/reference/evaluateStandard.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingTab.html + https://safetygraphics.github.io/safetyGraphics/reference/filterTab.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/mappingTabUI.html + https://safetygraphics.github.io/safetyGraphics/reference/filterTabChecks.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/meta.html + https://safetygraphics.github.io/safetyGraphics/reference/filterTabUI.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/prepareChart.html + https://safetygraphics.github.io/safetyGraphics/reference/generateMappingList.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/safetyGraphicsApp.html + https://safetygraphics.github.io/safetyGraphics/reference/generateSettings.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/safetyGraphicsInit.html + https://safetygraphics.github.io/safetyGraphics/reference/generateShell.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/safetyGraphicsServer.html + https://safetygraphics.github.io/safetyGraphics/reference/getRequiredSettings.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/safetyGraphicsUI.html + https://safetygraphics.github.io/safetyGraphics/reference/getSettingKeys.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/setMappingListValue.html + https://safetygraphics.github.io/safetyGraphics/reference/getSettingValue.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsCharts.html + https://safetygraphics.github.io/safetyGraphics/reference/getSettingsMetadata.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsChartsUI.html + https://safetygraphics.github.io/safetyGraphics/reference/hasColumn.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsCode.html + https://safetygraphics.github.io/safetyGraphics/reference/hasField.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsCodeUI.html + https://safetygraphics.github.io/safetyGraphics/reference/homeTab.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsData.html + https://safetygraphics.github.io/safetyGraphics/reference/homeTabUI.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsDataUI.html + https://safetygraphics.github.io/safetyGraphics/reference/index.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsMapping.html + https://safetygraphics.github.io/safetyGraphics/reference/loadCharts.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsMappingUI.html + https://safetygraphics.github.io/safetyGraphics/reference/loadChartsUI.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsTab.html + https://safetygraphics.github.io/safetyGraphics/reference/loadData.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/settingsTabUI.html + https://safetygraphics.github.io/safetyGraphics/reference/loadDataUI.html - https://pages.github.com/SafetyGraphics/safetyGraphics/reference/textKeysToList.html + https://safetygraphics.github.io/safetyGraphics/reference/makeChartConfig.html - https://pages.github.com/SafetyGraphics/safetyGraphics/articles/Cookbook.html + https://safetygraphics.github.io/safetyGraphics/reference/makeChartExport.html - https://pages.github.com/SafetyGraphics/safetyGraphics/articles/TechnicalFAQ.html + https://safetygraphics.github.io/safetyGraphics/reference/makeChartParams.html - https://pages.github.com/SafetyGraphics/safetyGraphics/articles/chartConfiguration.html + https://safetygraphics.github.io/safetyGraphics/reference/makeChartSummary.html - https://pages.github.com/SafetyGraphics/safetyGraphics/articles/intro.html + https://safetygraphics.github.io/safetyGraphics/reference/makeMapping.html + + + https://safetygraphics.github.io/safetyGraphics/reference/makeMeta.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingColumn.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingColumnUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingDomain.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingDomainUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingSelect.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingSelectUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingTab.html + + + https://safetygraphics.github.io/safetyGraphics/reference/mappingTabUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/meta.html + + + https://safetygraphics.github.io/safetyGraphics/reference/prepareChart.html + + + https://safetygraphics.github.io/safetyGraphics/reference/removeCharts.html + + + https://safetygraphics.github.io/safetyGraphics/reference/removeSettings.html + + + https://safetygraphics.github.io/safetyGraphics/reference/safetyGraphicsApp.html + + + https://safetygraphics.github.io/safetyGraphics/reference/safetyGraphicsInit.html + + + https://safetygraphics.github.io/safetyGraphics/reference/safetyGraphicsServer.html + + + https://safetygraphics.github.io/safetyGraphics/reference/safetyGraphicsUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/setMappingListValue.html + + + https://safetygraphics.github.io/safetyGraphics/reference/setSettingsValue.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsCharts.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsChartsUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsCode.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsCodeUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsData.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsDataUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsMapping.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsMappingUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsMetadata.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsTab.html + + + https://safetygraphics.github.io/safetyGraphics/reference/settingsTabUI.html + + + https://safetygraphics.github.io/safetyGraphics/reference/standardsMetadata.html + + + https://safetygraphics.github.io/safetyGraphics/reference/textKeysToList.html + + + https://safetygraphics.github.io/safetyGraphics/reference/trimData.html + + + https://safetygraphics.github.io/safetyGraphics/reference/trimSettings.html + + + https://safetygraphics.github.io/safetyGraphics/reference/validateSettings.html diff --git a/vignettes/Cookbook.Rmd b/vignettes/Cookbook.Rmd index e3f3d1d0..34454ce4 100644 --- a/vignettes/Cookbook.Rmd +++ b/vignettes/Cookbook.Rmd @@ -11,9 +11,22 @@ vignette: > # Cookbook Vignette -This vignette contains a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios. For a general overview of the app see [this vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/Intro). For more details about adding custom charts, see [this vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/ChartConfiguration). +This vignette contains a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios. -## Setup and installation +# Overview + +Most of the customization shown here is done by changing 4 key parameters in the `safetyGraphicsApp()` function: + +- `domainData` – Domain-level Study Data +- `mapping` – List identifying the key columns/fields in your data +- `charts` – Define the charts used in the app. +- `meta` – Metadata table with info about required columns and fields + +`domainData` and `mapping` generally change for every study, while `charts` and `meta` can generally be re-used across many studies. + +The examples here are generally provided with minimal explanation. For a more detailed discussion of the logic behind these examples see the [Chart Configuration Vignette](ChartConfiguration.html) or our [2021 R/Pharma Workshop](https://github.com/SafetyGraphics/RPharma2021-Workshop) + +# Setup and installation safetyGraphics requires R v4 or higher. These examples have been tested using RStudio v1.4, but should work on other platforms with proper configuration. @@ -42,9 +55,13 @@ To run the app with no customizations using sample AdAM data from the {safetyDat safetyGraphics::safetyGraphicsApp() ``` +# Loading Custom Data + +The next several examples focus on study-specific customizations for loading and mapping data. + ## Example 2 - SDTM Data -The data passed in to the safetyGraphics app can be customized using the `data` parameter in `safetyGraphicsApp()`. For example, to run the app with SDTM data saved in `{safetyData}`, call: +The data passed in to the safetyGraphics app can be customized using the `domainData` parameter in `safetyGraphicsApp()`. For example, to run the app with SDTM data saved in `{safetyData}`, call: ``` sdtm <- list( @@ -67,7 +84,58 @@ safetyGraphics::safetyGraphicsApp(domainData=justLabs) Note that charts with missing data are automatically dropped and the filtering tab is not present since it requires demographics data by default. -## Example 4 - Drop Unwanted Charts +## Example 4 - Loading other data formats + +Users can also import data from a wide-variety of data formats using standard R workflows and then initialize the app. The example below initializes the app using lab data saved as a sas transport file (.xpt) + +``` +xptLabs <- haven::read_xpt('https://github.com/phuse-org/phuse-scripts/blob/master/data/adam/cdiscpilot01/adlbc.xpt?raw=true') +safetyGraphics::safetyGraphicsApp(domainData=list(labs=xptLabs)) +``` + +## Example 5 - Non-standard data + +Next, let's initialize the the app with non-standard data. {safetyGraphics} automatically detects AdAM and SDTM data when possible, but for non-standard data, the user must provide a data mapping. This can be done in the app using the data/mapping tab, or can be done when the app is initialized by passing a `mapping` list to `safetyGraphicsApp()`. For example: + +``` +notAdAM <- list(labs=safetyData::adam_adlbc %>% rename(id = USUBJID)) +idMapping<- list(labs=list(id_col="id")) +safetyGraphicsApp(domainData=notAdAM, mapping=idMapping) +``` + +## Example 6 - Non-standard data #2 + +For a more realistic example, consider [this labs data set (csv)](https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv). The data can be loaded in to safetyGraphics with the code below, but several items in the mapping page need to be filled in: + +``` +labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv") +safetyGraphics::safetyGraphicsApp(domainData=list(labs=labs)) +``` + +drawing + +Fortunately there is no need to re-enter this mapping information in every time you re-start the app. After filling in these values once, you can export code to restart the app *with the specified settings pre-populated*. First, click on the setting icon in the header and then on "code" to see this page: + + + +The YAML code provided here captures the updates you've made on the mapping page. To re-start the app with those settings, just save these YAML code in a new file called `customSettings.yaml` in your working directory, and then call: + +``` +labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv") +customMapping <- read_yaml("customSettings.yaml") +safetyGraphics::safetyGraphicsApp( + domainData=list(labs=labs), + mapping=customMapping +) +``` + +Note, that for more complex customizations, the setting page also provides a `.zip` file with a fully re-usable version of the app. + +# Custom Charts + +The remaining examples focus on creating charts that are reusable across many studies. For extensive details on adding and customizing different types of charts, see this [vignette](chartConfiguration.html). + +## Example 7 - Drop Unwanted Charts Users can also generate a list of charts and then drop charts that they don't want to include. For example, if you wanted to drop charts with `type` of "htmlwidgets" you could run this code. @@ -78,17 +146,53 @@ notWidgets <- charts %>% purrr::keep(~.x$type != "htmlwidget") safetyGraphicsApp(charts=notWidgets) ``` -## Example 6 - Add a chart +## Example 8 - Edit Default Charts + +Users can also make modifications to the default charts by editing the list of charts directly. + +``` +charts <- makeChartConfig() #gets charts from safetyCharts pacakge by default +charts$aeTimelines$label <- "An AMAZING timeline" +safetyGraphicsApp(charts=charts) +``` + +## Example 9 - Add Hello World Custom Chart + +This example creates a simple "hello world" chart that is not linked to the data or mapping loaded in the app. + +``` +helloWorld <- function(data, settings){ + plot(-1:1, -1:1) + text(runif(20, -1,1),runif(20, -1,1),"Hello World") +} + +# Chart Configuration +helloworld_chart<-list( + env="safetyGraphics", + name="HelloWorld", + label="Hello World!", + type="plot", + domain="aes", + workflow=list( + main="helloWorld" + ) +) + +safetyGraphicsApp(charts=list(helloworld_chart)) +``` + +## Example 10 - Add a custom chart using data and settings The code below adds a new simple chart showing participants' age distribution by sex. ``` ageDist <- function(data, settings){ - p<-ggplot(data = data, aes_(x=as.name(settings$age_col))) + + p<-ggplot(data = data, aes(x=.data[[settings$age_col]])) + geom_histogram() + - facet_wrap(as.name(settings$sex_col)) + facet_wrap(settings$sex_col) return(p) } + ageDist_chart<-list( env="safetyGraphics", name="ageDist", @@ -103,43 +207,91 @@ charts <- makeChartConfig() charts$ageDist<-ageDist_chart safetyGraphicsApp(charts=charts) ``` - -For extensive details on adding and customizing different types of charts, see this [vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/ChartConfiguration). -## Example 7 - Non-standard data +## Example 11 - Create a Hello World Data Domain and Chart -Next, let's initialize the the app with non-standard data. {safetyGraphics} automatically detects AdAM and SDTM data when possible, but for non-standard data, the user must provide a data mapping. This can be done in the app using the data/mapping tab, or can be done when the app is initialized by passing a `mapping` list to `safetyGraphicsApp()`. For example: +Here we extend example 9 to include the creating of a new data domain with custom metadata, which is bound to the chart object as `chart$meta`. See `?makeMeta` for more detail about the creation of custom metadata. -``` -notAdAM <- list(labs=safetyData::adam_adlbc %>% rename(id = USUBJID)) -idMapping<- list(labs=list(id_col="id")) -safetyGraphicsApp(domainData=notAdAM, mapping=idMapping) ``` -## Example 8 - Non-standard data #2 +helloMeta <- tribble( + ~text_key, ~domain, ~label, ~standard_hello, ~description, + "x_col", "hello", "x position", "x", "x position for points in hello world chart", + "y_col", "hello", "y position", "y", "y position for points in hello world chart" +) %>% mutate( + col_key = text_key, + type="column" +) -For a more realistic example, consider [this labs data set (csv)](https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv). The data can be loaded in to safetyGraphics with the code below, but several items in the mapping page need to be filled in: +helloData<-data.frame(x=runif(50, -1,1), y=runif(50, -1,1)) -``` -labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv") -safetyGraphics::safetyGraphicsApp(domainData=list(labs=labs)) -``` +helloWorld <- function(data, settings){ + plot(-1:1, -1:1) + text(data[[settings$x_col]], data[[settings$y_col]], "Custom Hello Domain!") +} -drawing +helloChart<-prepareChart( + list( + env="safetyGraphics", + name="HelloWorld", + label="Hello World!", + type="plot", + domain="hello", + workflow=list( + main="helloWorld" + ), + meta=helloMeta + ) +) -Fortunately there is no need to re-enter this mapping information in every time you re-start the app. After filling in these values once, you can export code to restart the app *with the specified settings pre-populated*. First, click on the setting icon in the header and then on "code" to see this page: +charts <- makeChartConfig() +charts$hello <- helloChart #Easy to combine default and custom charts +data<-list( + labs=safetyData::adam_adlbc, + aes=safetyData::adam_adae, + dm=safetyData::adam_adsl, + hello=helloData +) - +#no need to specify meta since safetyGraphics::makeMeta() will generate the correct list by default. +safetyGraphicsApp( + domainData=data, + charts=charts +) +``` -The YAML code provided here captures the updates you've made on the mapping page. To re-start the app with those settings, just save these YAML code in a new file called `customSettings.yaml` in your working directory, and then call: +## Example 13 - Create an ECG Data Domain & Chart + +This example defines a custom ECG data domain and adapts an existing chart for usage there. See [this PR](https://github.com/SafetyGraphics/safetyCharts/pull/90) for a full implementation of the ECG domain in safetyCharts. ``` -labs <- read.csv("https://raw.githubusercontent.com/SafetyGraphics/SafetyGraphics.github.io/master/pilot/SampleData_NoStandard.csv") -customMapping <- read_yaml("customSettings.yaml") -safetyGraphics::safetyGraphicsApp( - domainData=list(labs=labs), - mapping=customMapping + +adeg <- readr::read_csv("https://physionet.org/files/ecgcipa/1.0.0/adeg.csv?download") + +ecg_meta <-tibble::tribble( + ~text_key, ~domain, ~label, ~description, ~standard_adam, ~standard_sdtm, + "id_col", "custom_ecg", "ID column", "Unique subject identifier variable name.", "USUBJID", "USUBJID", + "value_col", "custom_ecg", "Value column", "QT result variable name.", "AVAL", "EGSTRESN", + "measure_col", "custom_ecg", "Measure column", "QT measure variable name", "PARAM", "EGTEST", +"studyday_col", "custom_ecg", "Study Day column", "Visit day variable name", "ADY", "EGDY", + "visit_col", "custom_ecg", "Visit column", "Visit variable name", "ATPT", "EGTPT", + "visitn_col", "custom_ecg", "Visit number column", "Visit number variable name", "ATPTN", NA, + "period_col", "custom_ecg", "Period column", "Period variable name", "APERIOD", NA, + "unit_col", "custom_ecg", "Unit column", "Unit of measure variable name", "AVALU", "EGSTRESU" +) %>% mutate( + col_key = text_key, + type="column" ) -``` -Note, that for more complex customizations, the setting page also provides a `.zip` file with a fully re-usable version of the app. +qtOutliers<-prepare_chart(read_yaml('https://raw.githubusercontent.com/SafetyGraphics/safetyCharts/dev/inst/config/safetyOutlierExplorer.yaml') ) +qtOutliers$label <- "QT Outlier explorer" +qtOutliers$domain <- "custom_ecg" +qtOutliers$meta <- ecg_meta + +safetyGraphicsApp( + meta=ecg_meta, + domainData=list(custom_ecg=adeg), + charts=list(qtOutliers) +) + +``` \ No newline at end of file diff --git a/vignettes/TechnicalFAQ.Rmd b/vignettes/TechnicalFAQ.Rmd index 571d7af9..d55a99b1 100644 --- a/vignettes/TechnicalFAQ.Rmd +++ b/vignettes/TechnicalFAQ.Rmd @@ -15,10 +15,20 @@ This vignette answers frequently asked technical questions about {safetyGraphics Whenever new questions come in, we'll update the version of [this FAQ in our wiki](https://github.com/SafetyGraphics/safetyGraphics/wiki/TechnicalFAQ/) - so check there first if you have a question. We'll update the vignette on CRAN whenever a new version of the package is released. +# Contributing + +## Q: Can I contribute code to the project? + +**A**: Yes. Check out our [contributor guidelines](https://github.com/SafetyGraphics/SafetyGraphics.github.io/blob/master/CONTRIBUTING.md). Feel free to follow-up with questions on the [discussion board](https://github.com/SafetyGraphics/safetyGraphics/discussions). + +## Q: Can I join the working group? + +**A**: Yes. Fill out this [Google Form](https://docs.google.com/forms/d/e/1FAIpQLSd4wkSfaajuj3iaVHirqj8L05S3yH7GVGwopufWRMmjif4IDg/viewform) and we'll get in touch. + # Validation, Quality Control and Testing ## Q: Is the safetyGraphics package validated? -**A**: As of the version 2 release, the safetyGraphics package is intended for exploratory use only and is not validated or qualified per [21 CFR Part 11](https://www.fda.gov/regulatory-information/search-fda-guidance-documents/part-11-electronic-records-electronic-signatures-scope-and-application). No warranty or guarantees are included as part of the package. Further, any formal validation should be fit for purpose and follow your organization's procedures. That said, extensive quality checks are built in to the package (see the question below for details) and in to many of charts that are included by default. We follow the work of [R Validation hub](https://www.pharmar.org/) closely, and may release validation guidance based on the approach described in their [white paper](https://www.pharmar.org/white-paper/) at a future date. +**A**: As of the version 2 release, the safetyGraphics package is intended for exploratory use only and is not validated or qualified per [21 CFR Part 11](https://www.fda.gov/regulatory-information/search-fda-guidance-documents/part-11-electronic-records-electronic-signatures-scope-and-application). No warranty or guarantees are included as part of the package. Further, any formal validation should be fit for purpose and follow your organization's procedures. That said, extensive quality checks are built in to the package (see the question below for details) and into many of charts that are included by default. The R Consortium has [guidance on usage of R in Regulated Trials](https://www.r-project.org/doc/R-FDA.pdf) and we also follow the work of [R Validation hub](https://www.pharmar.org/) closely, and may release validation guidance based on the approach described in their [white paper](https://www.pharmar.org/white-paper/) at a future date. ## Q: Can I validate charts created by safetyGraphics? **A**: Study-specific instances of most safetyGraphics charts can be exported either as an R script or as a standalone html report. It may be possible to treat those outputs as standard TLFs (Tables, Listings and Figures) and conduct QC/Validation on them using standard statistical SOPs. Consult with your companies procedures to confirm. @@ -33,7 +43,28 @@ Whenever new questions come in, we'll update the version of [this FAQ in our wik - Formal Alpha/Beta user testing before major releases - Basic user tests conducted before minor release +## Q: Is the safetyGraphics app ready for "production" use? + +A: As of the v2 release, safetyGraphics is mostly used in an exploratory fashion for a [variety of use cases](TechnicalFAQ.html#q-what-are-some-common-use-cases-for-safetygraphics). The details of a 'production' implementation of safetyGraphics in a GxP environment would largely be dictated the intended use of the tool. For example, using safetyGraphics as your primary safety oversight platform would likely require more work than using it as a supplemental exploratory tool for biostatisticians. + +That said, the issues surrounding a 'production' deployment are mostly technical and operational at this point and could likely be overcome by a motivated organization with ample technical expertise. Some of the issues that would need to be addressed in a production deployment: + +- Qualification documentation (Organization-specific) +- Formalized deployment pipeline for Shiny with proper authentication and security (Organization-specific) +- App Maintenance model (Organization-specific) +- Data pipeline for study set-up and customization (Organization-specific) +- Issues with big data set performance in htmlwidget renderers + +Many of these issues aren't specific to safetyGraphics and may be easier to address for an organization that has experience using R and Shiny in production. [As discussed above](https://github.com/SafetyGraphics/safetyGraphics/wiki/TechnicalFAQ.html#q-is-the-safetygraphics-package-validated), there is a significant push towards using R for many aspects of clinical trials. We plan to keep safetyGraphics up to date with emerging best practices and will provide supporting documentation whenever possible. + +Finally, it is worth noting "Productionize” and “Validate” are slightly different. Joe Cheng (the primary author of Shiny) has a [nice talk](https://www.rstudio.com/resources/rstudioconf-2019/shiny-in-production-principles-practices-and-tools/) on this topic from a software engineering perspective. + # Use Cases, Data Sources and Deployment + +## Q: I can see that the software has the MIT license, so does this essentially mean that any company would be free to use the software without restriction? + +**A**: Yes. The package is open source and free to use. Here's a link to the [license](https://github.com/SafetyGraphics/safetyGraphics/blob/dev/LICENSE.md) and a quick [summary](https://tldrlegal.com/license/mit-license) of how it works. + ## Q: What are some common use cases for safetyGraphics? **A**: safetyGraphics graphics has been used in a variety of ways. Some of the most common use cases thus far are: @@ -43,72 +74,54 @@ Whenever new questions come in, we'll update the version of [this FAQ in our wik As an open source tool with a flexible data pipeline, many other use cases have been discussed: - Data review by Data Safety Monitoring Boards ([link](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7833551/pdf/main.pdf)) -- Submissions to FDA ([link](https://phuse.s3.eu-central-1.amazonaws.com/Advance/Data+Visualisation+and+Open+Source+Technology/Interactive+Data+Visualizations+for+Decision+Making+in+Submissions+%E2%80%93%C2%A0PHUSE+Webinar.pdf)) - Visualizing Analysis results data ([link](https://github.com/phuse-org/aesummaries)) - Risk based monitoring ## Q: Do I have to use a certain data standard with safetyGraphics? -**A**: No. Any standard (or non-standard) data can be loaded as long as it meets the [minimum data requirements](https://github.com/SafetyGraphics/safetyGraphics/wiki/Intro#appendix-2---minimum-data-requirements) for the selected data domain. Metadata capturing default CDISC standards are included with the app (see `?safetyGraphics::meta`) so that data mappings can be automatically populated when AdAM and SDTM data are loaded. Other data standards require the user to manually complete the data mapping in the mapping tab - see the [cookbook vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/cookbook) for examples. +**A**: No. Any standard (or non-standard) data can be loaded as long as it meets the [minimum data requirements](Intro.html#appendix-2---minimum-data-requirements) for the selected data domain. Metadata capturing default CDISC standards are included with the app (see `?safetyGraphics::meta`) so that data mappings can be automatically populated when AdAM and SDTM data are loaded. Other data standards require the user to manually complete the data mapping in the mapping tab - see the [cookbook vignette](cookbook) for examples. ## Q: What data sources does safetyGraphics support? How do I load custom data? -**A**: This topic is covered in detail in the [Loading data section of the Introductory vignette]https://github.com/SafetyGraphics/safetyGraphics/wiki/Intro#loading-study-data)`safetyGraphics` is designed to support a flexible data pipeline that supports many data types. In short, data can be loaded using the the `dataDomains` parameter in the `safetyGraphicsApp()` function or via the `safetyGraphicsInit()` graphical user interface. +**A**: This topic is covered in detail in the [Loading data section of the Introductory vignette](Intro.html#loading-study-data). `safetyGraphics` is designed to support a flexible data pipeline that supports many data types. In short, data can be loaded using the `dataDomains` parameter in the `safetyGraphicsApp()` function or via the `safetyGraphicsInit()` graphical user interface. -`safetyGraphicsApp()` - custom data can be loaded via the `dataDomains` parameter, which should be a list containing `dataframes` or `tibbles` for each clinical domain; that list can be populated by importing data from any number of sources including databases, sas files or [any number of other sources](https://r4ds.had.co.nz/data-import.html). See the [cookbook vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/cookbook) for some basic examples of loading custom data. +`safetyGraphicsApp()` - custom data can be loaded via the `dataDomains` parameter, which should be a list containing `dataframes` or `tibbles` for each clinical domain; that list can be populated by importing data from any number of sources including databases, sas files or [any number of other sources](https://r4ds.had.co.nz/data-import.html). See the [cookbook vignette](cookbook.html) for some basic examples of loading custom data. `safetyGraphicsInit()` - allows users to load tabular data from a variety of sources using the point-and-click interface provided in the {datamods} package. -More detail is provided in the [Loading data section of the Introductory vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/Intro#loading-study-data) +More detail is provided in the [Loading data section of the Introductory vignette](Intro.html#loading-study-data) + +## Is data loaded in to the safetyGraphics app secure? + +Since the safetyGraphics app typically uses data subject to GxP regulations, data security is extremely important and should always be discussed with your organizations IT and regulatory departments before loading any study data in to the application. No warranty or guarantees are included as part of the package. + +Just like the discussion regarding [Validation and Quality Control](https://github.com/SafetyGraphics/safetyGraphics/wiki/TechnicalFAQ.html#validation-quality-control-and-testing), data security requirements are dictated by the intended use of the app and should be fit for purpose. There are many different ways to run shiny applications, and the security implications of each approach varies. For example, having statisticians run the app locally using R Studio is quite different than deploying the app on a service like shinyapps.io. This complexity is all the more reason to discuss with IT. There are many resources - related to data security for clinical trials in general ([1](https://www.hhs.gov/ohrp/sites/default/files/report-privacy-and-health-10-31-19.pdf), [2](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4943495/), [3](https://www.d-wise.com/blog/detailing-the-de-identification-and-data-transparency-boundaries-of-ema-policy-70-and-gdpr)) and discussing data security in shiny ([4](https://www.youtube.com/watch?v=5odJxZj9LE4), +[5](https://mastering-shiny.org/scaling-security.html#data), [6](https://support.rstudio.com/hc/en-us/articles/360042593974-R-and-R-Package-Security)) - that could help to facilitate these discussion. ## Q: How can the safetyGraphics app be shared? -**A**: The safetyGraphics app can be shared using [standard shiny methodology](https://shiny.rstudio.com/tutorial/written-tutorial/lesson7/). More details for a specific use cases are given in the next few questions. Charts created by safetyGraphics can also be exported and re-used. Charts created with [htmlwidgets](https://www.htmlwidgets.org/) are especially flexible and can be used in many contexts - including in web applications outside of R. +**A**: The safetyGraphics app can be shared using [standard shiny methodology](https://shiny.rstudio.com/tutorial/written-tutorial/lesson7/). More details for specific use cases are given in the next few questions. Charts created by safetyGraphics can also be exported and re-used. Charts created with [htmlwidgets](https://www.htmlwidgets.org/) are especially flexible and can be used in many contexts - including in web applications outside of R. + +## Q: Do you recommend deploying the app to a dedicated server for internal usage? + +**A**: It depends a bit on your use-case and how the app is hosted. For example, analysts using the data in an exploratory fashion can probably just run it from RStudio, but if multiple medical monitors using the app for medical monitoring in active studies probably need a more robust (and possibly validated) set up using [Shiny Server](https://github.com/rstudio/shiny-server/blob/master/README.md), [RStudio Connect](https://www.rstudio.com/products/connect/) or something similar. ## Q: Can I deploy `safetyGraphics` to shinyapps.io to explore trial data from my organization? -**A**: No, we advise against loading non-authorized, private, or non-deidentified patient data outside of your organization's firewall. Consult with your IT and QA first. There is huge risk associated with confidentiality, IP, and patient privacy. Also refer to [ShinyApps.io Chapter 8 Security and Compliance](https://docs.rstudio.com/shinyapps.io/security-and-compliance.html). +**A**: We advise against loading non-authorized, private, or non-deidentified patient data outside of your organization's firewall. Consult with your IT and QA first. There is huge risk associated with confidentiality, IP, and patient privacy. Also refer to [ShinyApps.io Chapter 8 Security and Compliance](https://docs.rstudio.com/shinyapps.io/security-and-compliance.html). -## **Q**: Can I deploy `safetyGraphics` to an internal [rsconnect](https://www.rstudio.com/products/connect/) server? +## **Q**: Can I deploy `safetyGraphics` to an internal [RStudio Connect](https://www.rstudio.com/products/connect/) server? -**A**: Yes - the easiest way to do this is likely to deploy a customized app using shiny modules. In general, you'll want to use wrap `safetyGraphicsServer()`, `safetyGraphicsUI()` and `app_startup()` in the context of `shiny_app` and then call rsconnect::deployApp(). The script below shows the code for the app deployed at [https://jwildfire.shinyapps.io/safetyGraphics/](https://jwildfire.shinyapps.io/safetyGraphics/) using demo data. +**A**: Yes. The [script below](https://github.com/SafetyGraphics/safetyGraphics/blob/dev/inst/deploy/app.R) should be easy to deploy via the RStudio interface or by running `rsconnect::deployApp()` and can easily be customized to support custom data and charts. ``` -library(safetyGraphics) -library(shiny) - -domainData<-list( - labs=safetyData::adam_adlbc, - aes=safetyData::adam_adae, - dm=safetyData::adam_adsl -) - -config <- app_startup( - domainData=domainData, - meta=safetyGraphics::meta, - autoMapping = TRUE, - filterDomain="dm" -) - -shinyApp( - ui = safetyGraphicsUI("sg",config$meta, config$domainData, config$mapping, config$standards), - server = function(input,output,session){ - callModule( - safetyGraphicsServer, - "sg", - config$meta, - config$mapping, - config$domainData, - config$charts, - config$filterDomain - ) - } -) - +# Launch the ShinyApp (Do not remove this comment) +library(safetyGraphics) +safetyGraphics::safetyGraphicsApp(runNow = FALSE) ``` # Misc. ## Q: How do I avoid R not choking on the huge volume of lab data? (from @AlbrechtDurer) -**A**: This is a very good question @AlbrechtDurer, and in my experience the answer is complex and varies for different use cases. Focusing on specific toxicities helps, but probably isn't enough in really big studies. In those cases, I think the most important thing is to design a good data pipeline that includes both a database backend (as opposed to loading all of your study data each time you initialize the app) and visualizations that summarize the data in a reasonable way (as opposed to just plotting every single data point in a scatter plot no matter what). Fortunately this is all doable in R, and improvements in this area are our radar for safetyGraphics after v2 goes live. +**A**: Several of the JavaScript charts build using htmlwidgets do have performance issues with very large data sets. Focusing on specific toxicities helps, but probably isn't enough for really big studies. In those cases, I think the most important thing is to design a your data pipeline to include both a database backend (as opposed to loading all of your study data each time you initialize the app) and visualizations that summarize the data in a reasonable way (as opposed to just plotting every single data point in a scatter plot no matter what). Fortunately this is all doable in R, and improvements in this area are on our road map for future releases of safetyGraphics. diff --git a/vignettes/chartConfiguration.Rmd b/vignettes/chartConfiguration.Rmd index 130a5c7c..e51e8046 100644 --- a/vignettes/chartConfiguration.Rmd +++ b/vignettes/chartConfiguration.Rmd @@ -17,8 +17,8 @@ The {safetyGraphics} shiny app can be used to display a wide variety of charts. While this is technically a vignette for {safetyGraphics}, the {safetyCharts} package is just as important here. The roles of the packages can be summarized in just a few words: - **The {safetyGraphics} platform displays charts from {safetyCharts}.** - +**The {safetyGraphics} platform displays charts from {safetyCharts}.** + This relationship is central to the technical framework for the safetyGraphics app. By itself, the `safetyGraphics` **platform** really doesn't do much! In fact, none of the content on the Charts tab is actually found in the `safetyGraphics` package; it's all imported from elsewhere! As you've probably guessed, the default charts live in the `safetyCharts` package. `safetyCharts` has over a dozen charts that are configured to work with {safetyGraphics}, but can also easily be used independently. While {safetyGraphics} and {safetyCharts} are designed to work seamlessly together, users can also add charts from other packages. In fact, several charts in {safetyCharts} are just wrappers that load charts from other packages for use in {safetyGraphics}. The rest of this vignette provides a series of step-by-step examples detailing how this process works for different types of charts. @@ -95,17 +95,17 @@ settings <- list( # Define a plotting function that takes data and settings as inputs spaghettiPlot <- function( data, settings ){ # define plot aes - note use of standard evaluation! - plot_aes <- aes_( - x=as.name(settings$studyday_col), - y=as.name(settings$value_col), - group=as.name(settings$id_col) + plot_aes <- aes( + x=.data[[settings$studyday_col]], + y=.data[[settings$value_col]], + group=.data[[settings$id_col]] ) #create the plot p<-ggplot(data = data, plot_aes) + geom_path(alpha=0.15) + facet_wrap( - as.name(settings$measure_col), + settings$measure_col, scales="free_y" ) return(p) @@ -127,13 +127,14 @@ With minor modifications, this chart can be added to the {safetyGraphics} shiny ``` env: safetyGraphics label: Spaghetti Plot +name: spaghettiPlot type: plot domain: - - labs + - labs workflow: - main: spaghettiPlot + main: spaghettiPlot links: - safetyCharts: https://github.com/SafetyGraphics/safetycharts + safetyCharts: https://github.com/SafetyGraphics/safetycharts ``` With the charting function loaded in to our session and the configuration file saved in our working directory as `spaghetti.yaml`, we can add the chart to the app as follows: @@ -150,10 +151,13 @@ Under the charts tab, you'll see: If you look closely at the `spaghettiPlot()` code above, you'll noticed some details that make the chart work in the app: - - The chart function is written as a function taking `data` and `settings` as inputs. This is the expected parameterization for most charts in {safetyGraphics}. +- The chart function is written as a function taking `data` and `settings` as inputs. This is the expected parameterization for most charts in {safetyGraphics}. - The references to `settings` use parameters that are defined on the mapping tab. Behind the scenes, these are defined in the `safetyGraphics::meta`. - The `spaghettiPlot` function is referenced in the `main` item the YAML `workflow`. This tells the app which function to use to draw the chart. - +- We're using the `.data[[]]` pronoun in the chart function to access columns in the data based on the current settings. See these references for a lot more detail about functional programming in the tidyverse: + - [Using ggplot2 in packages](https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-in-packages.html) + - [Programming with dplyr](https://dplyr.tidyverse.org/articles/programming.html) + - [Functional programming chapters in Advanced R](https://adv-r.hadley.nz/fp.html) These details allow users to dynamically define data attributes for any labs data set, allowing the chart to be reused across many different types of data. This example is inspired by `safetyCharts::safety_outlier_explorer` - the [charting function](https://github.com/SafetyGraphics/safetyCharts/blob/dev/R/safety_outlier_explorer.R) and [yaml configuration file](https://github.com/SafetyGraphics/safetyCharts/blob/dev/inst/config/safetyOutlierExplorerStatic.yaml) on are GitHub. @@ -190,7 +194,7 @@ safetyOutlierExplorer_ui <- function(id) { } ``` -Next we define a server function that populates the control for selecting measurements and then draws the plot using [`safetyCharts::safety_outlier_explorer()`](https://github.com/SafetyGraphics/safetyCharts/blob/dev/R/safety_outlier_explorer.R) charting function - which is based on the `spaghetti()` function ! Note that the server function takes a single reactive `params` object containing the data (`params$data`) and settings (`param$settings`) as input. +Next we define a server function that populates the control for selecting measurements and then draws the plot using [`safetyCharts::safety_outlier_explorer()`](https://github.com/SafetyGraphics/safetyCharts/blob/dev/R/safety_outlier_explorer.R) charting function - which is based on the `spaghetti()` function! Note that the server function takes a single reactive `params` object containing the data (`params$data`) and settings (`param$settings`) as input. ``` safetyOutlierExplorer_server <- function(input, output, session, params) { @@ -225,15 +229,16 @@ Finally, the YAML configuration file looks like this - just the workflow and la ``` env: safetyGraphics label: Outlier Explorer - Module +name: outlierExplorerMod type: module package: safetyCharts domain: - - labs + - labs workflow: - ui: safetyOutlierExplorer_ui - server: safetyOutlierExplorer_server + ui: safetyOutlierExplorer_ui + server: safetyOutlierExplorer_server links: - safetyCharts: https://github.com/SafetyGraphics/safetycharts + safetyCharts: https://github.com/SafetyGraphics/safetycharts ``` Initializing the app as usual by adding it to the chart list: @@ -257,7 +262,51 @@ Items 1 and 2 above are simple enough, but #3 is likely to create problems unles Fortunately, there's a workaround built in to safetyGraphics in the form of `init` workflow functions. Init functions run before the chart is drawn, and can be used to create custom parameterizations. The init function should take `data` and `settings` as inputs and return `params` which should be a list which is then provided to the chart (see the appendix for more details). The [init function](https://github.com/SafetyGraphics/safetyCharts/blob/dev/R/init_aeExplorer.R) for the the interactive [AE Explorer](https://github.com/RhoInc/aeexplorer) is a good example. It starts by [merging demographics and adverse event data](https://github.com/SafetyGraphics/safetyCharts/blob/c37f3ac7883b15ab3d8a36e597dec85728657fd7/R/init_aeExplorer.R#L16-L18) and then proceeds to [create a customized settings object](https://github.com/SafetyGraphics/safetyCharts/blob/c37f3ac7883b15ab3d8a36e597dec85728657fd7/R/init_aeExplorer.R#L20-L43) to match [the configuration requirements](https://github.com/RhoInc/aeexplorer/wiki/Configuration) of the javascript chart renderer. This init function is then saved under `workflow$init` in the chart config object. The rest of the [chart configuration YAML](https://github.com/SafetyGraphics/safetyCharts/blob/dev/inst/config/aeExplorer.yaml) is similar to the examples above, and the chart is once again by passing the chart config object to `safetyGraphicsApp()` - + +# Example 5 - Adding a Chart in a New Data Domain + +All of our examples so far have been focused on creating charts in our 3 default data domains (labs, adverse events and demographics), but there is no requirement that limits charts to these three data types. The data domains in the app are determined by a `meta` data frame that defines the columns and fields used in safetyGraphics charts, and customizing `meta` allows us to create charts for any desired data domains. + +Generally speaking there are 3 steps to add a chart in a new domain: + +1. Create Metadata for a new data domain. +2. Define a chart using the new domain - like the examples above +3. Load data for the new domain + +Consider the following example, that modifies a chart from the `labs` domain for use on ECG data: + +``` +adeg <- readr::read_csv("https://physionet.org/files/ecgcipa/1.0.0/adeg.csv?download") + +ecg_meta <-tibble::tribble( + ~text_key, ~domain, ~label, ~description, ~standard_adam, ~standard_sdtm, + "id_col", "custom_ecg", "ID column", "Unique subject identifier variable name.", "USUBJID", "USUBJID", + "value_col", "custom_ecg", "Value column", "QT result variable name.", "AVAL", "EGSTRESN", + "measure_col", "custom_ecg", "Measure column", "QT measure variable name", "PARAM", "EGTEST", + "studyday_col", "custom_ecg", "Study Day column", "Visit day variable name", "ADY", "EGDY", + "visit_col", "custom_ecg", "Visit column", "Visit variable name", "ATPT", "EGTPT", + "visitn_col", "custom_ecg", "Visit number column", "Visit number variable name", "ATPTN", NA, + "period_col", "custom_ecg", "Period column", "Period variable name", "APERIOD", NA, + "unit_col", "custom_ecg", "Unit column", "Unit of measure variable name", "AVALU", "EGSTRESU" +) %>% mutate( + col_key = text_key, + type="column" +) + +qtOutliers<-prepare_chart(read_yaml('https://raw.githubusercontent.com/SafetyGraphics/safetyCharts/dev/inst/config/safetyOutlierExplorer.yaml') ) +qtOutliers$label <- "QT Outlier explorer" +qtOutliers$domain <- "custom_ecg" +qtOutliers$meta <- ecg_meta + +safetyGraphicsApp( + domainData=list(custom_ecg=adeg), + charts=list(qtOutliers) +) +``` + +As of safetyGraphics v2.1, metadata can be saved directly to the chart object using `chart$meta` as shown in the example above. +Alternatively, metadata can be saved as a data object in the `chart$package` namespace. Chart-specific metadata should be saved as `meta_{chart$name}` while domain-level metadata should be named `meta_{chart$domain}`. It's fine to use a combination of these approaches as appropriate for your chart. See `?safetyGraphics::makeMeta` for more detail. + # Appendix #1 - Chart Framework Technical Specifications ## Configuration Overview @@ -265,6 +314,7 @@ The rest of the [chart configuration YAML](https://github.com/SafetyGraphics/saf The diagram above summarizes the various components of the safetyGraphics charting framework: + - The `safetyGraphicsApp()` function allows users to specify which charts to include in the shiny app via the `charts` parameter, which expects a `list` of charts. - Each item in `charts` is itself defined as a `list` that provides configuration details for a single chart. These configuration lists have several required parameters, which are described in the technical specification below. - Configuration lists are typically saved as YAML files, but can be also be loaded directly as list objects as shown in the Hello World example above. @@ -273,12 +323,14 @@ The diagram above summarizes the various components of the safetyGraphics charti ## Chart Specification Each item in the `charts` list should be a list() with the following parameters: + - `env`: Environment for the chart. Must be set to "safetyGraphics" or the chart is dropped. Type: *character*. **Required** - `name`: Name of the chart. Type: *character*. **Required** - `type:`: Type of chart. Valid options are: "plot","htmlwidget","html","table" and "module". Type: *character*. **Required** - `label`: A short description of the chart. chart$name is used if not provided. Type: *character*. *Optional* - `domain`: The data domain(s) used in the chart. Type: *character*. **Required** - `package`: The package where the {htmlwidget} is saved. Type: *character*. **Required** when `chart$type` is "htmlwidget" +- `meta`: Table of chart-specific metadata. Metadata can also be saved as `{package}::meta_{chart}` or `{package::meta_{domain}`. See `?safetyGraphics::makeMeta` for more detail. - `order`: Order in which to display the chart. If order is a negative number, the chart is dropped. Defaults to 999999. Type: *Integer*. *Optional* - `links`: Named list of link names/urls to be shown in the chart header. Type: *list of character*. *Optional* - `path`: Full path of the YAML file. Auto-generated by `makeChartConfig()` Type: *character* *optional* @@ -288,7 +340,7 @@ Each item in the `charts` list should be a list() with the following parameters: - `workflow$widget`: name or widget saved in `chart$package` to be passed to `htmlwidgets::createWidget` **Required** when `chart$type` is "htmlwidget" - `workflow$ui` and `workflow$server`: names of functions to render shiny ui and server. Automatically generated in `prepareChart()` unless `chart$type` is "module". **Required** when `chart$type` is 'module' - `functions`: a list of functions used to create the chart. Typically generated at runtime by `prepareChart()` using information in `chart$workflow`, `chart$type` and `chart$package`. Not recommended to generate manually. Type: *list of functions*. **Required** - + ## Default Technical workflow This appendix describe the technical process used to render a chart when safetyGraphicsApp() is called with the default parameters. @@ -299,16 +351,17 @@ This appendix describe the technical process used to render a chart when safetyG 4. `makeChartConfig` loads YAML configuration files in the specified directories and saves them to a list. `name` and `path` parameters are added. 5. `makeChartConfig` calls `prepareChart` for each chart configuration. `prepareChart` sets default values for `order`, `name` and `export`, and then binds relevant functions to a `chart$functions` list based on the chart's `type`, `workflow` and `package`. 6. That list of charts is then returned to `app_startup()` which runs a few actions on each chart: - - If `chart$functions` is missing, `prepareChart` is called (not relevant in the default workflow, but useful for adding custom charts) - - If `chart$order` is negative, the chart is dropped with a message. - - If `chart$env` is not "safetyGraphics", the chart is dropped with a message. - - If `chart$domains` has elements not found in the `dataDomains` passed to `app_startup(), the chart is dropped with a message. - - `charts` are re-ordered based on `chart$order` -7. `app_startup` returns the list of charts to `safetyGraphicsApp` which then then passes them along to `safetyGraphicsServer` as the `charts` parameter. -8. `safetyGraphicsServer` then creates modules for each chart. First, `UIs` are created via `chartsNav()` which then calls: + - If `chart$functions` is missing, `prepareChart` is called (not relevant in the default workflow, but useful for adding custom charts) + - If `chart$order` is negative, the chart is dropped with a message. + - If `chart$env` is not "safetyGraphics", the chart is dropped with a message. + - If `chart$domains` has elements not found in the `dataDomains` passed to `app_startup(), the chart is dropped with a message. + - `charts` are re-ordered based on `chart$order` +7. `app_startup` passes the updated list of charts to `makeMeta` assuming no `meta` object was provided. `makeMeta` combines metadata from all charts in to a single data.frame. Charts can save metadata as `chart.meta`, `{package}::meta_{chart}` or `{package}::meta_{domain}`. +8. `app_startup` returns the list of charts and associated metadata to `safetyGraphicsApp` which then then passes them along to `safetyGraphicsServer` as the `charts` parameter. +9. `safetyGraphicsServer` then creates modules for each chart. First, `UIs` are created via `chartsNav()` which then calls: - `makeChartSummary` to create the chart header with links and metadata and ... - `ChartsTabUI` which then calls `chart$functions$ui` to create the proper UI element based on `chart$type`. -8. Next, `safetyGraphicsServer` draws the charts using `chartsTab()` which: +10. Next, `safetyGraphicsServer` draws the charts using `chartsTab()` which: - Creates a reactive `params` object containing mappings and data using `makeChartParams()` which: - Subsets `domainData` based on `chart$domain` - Calls `charts$functions$init` if provided @@ -316,4 +369,4 @@ This appendix describe the technical process used to render a chart when safetyG - Chart is drawn using `chart$functions$server` and `chart$functions$main` - Button to download R script is added to header. Script is created by `makeChartExport()` - Button to download html report is added to header unless type="module". Report template is at "inst/reports/safetyGraphicsReport.Rmd" -9. Finally, `safetyGraphicsServer` passes the charts to `settingsTab`, which uses them to help populate the `charts` and `code` subtabs. +11. Finally, `safetyGraphicsServer` passes the charts to `settingsTab`, which uses them to help populate the `charts` and `code` subtabs. diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index 11631702..b08e4562 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -47,7 +47,7 @@ Clicking the Charts tab opens a dropdown menu containing a series of charts rela -safetyGraphics supports many different kinds of charts including web-based interactive graphics using {htmlwidgets} (like the chart shown above), static plots, plotly plots and custom shiny modules. Each chart has a header that provides details about the chart, links to chart-specific resources and buttons that allow users to download a stand-alone html report or a .R file that reproduces the chart. See the [Chart Configuration Vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/ChartConfiguration) for more detail about the safetyGraphics charting framework. +safetyGraphics supports many different kinds of charts including web-based interactive graphics using {htmlwidgets} (like the chart shown above), static plots, plotly plots and custom shiny modules. Each chart has a header that provides details about the chart, links to chart-specific resources and buttons that allow users to download a stand-alone html report or a .R file that reproduces the chart. See the [Chart Configuration Vignette](ChartConfiguration.html) for more detail about the safetyGraphics charting framework. ## ⚙️ (Settings) Tab @@ -57,6 +57,8 @@ Finally, the Settings tab - shown as a gear icon ⚙️ - contains technical de # Loading Study Data +safetyGraphics supports a wide range of data formats and standards. Generally speaking, any clinical data can be loaded as long it meets the minimal data requirements described in [appendix 2](Intro.html#appendix-2---minimum-data-requirements). + There are 2 primary ways to load your study data in to the safetyGraphics shiny app: 1. Using `safetyGraphicsInit()` shiny interface @@ -97,14 +99,19 @@ sdtm <- list( safetyGraphics::safetyGraphicsApp(domainData=sdtm) ``` -This example and other use cases are described in the `safetyGraphics Cookbook - Advanced Examples` Vignette. +This example and other use cases are described in [cookbook vignette](Cookbook.html). + +## Large Data sets + +Use the `maxFileSize` option to load data sets larger than 5 mb in `safetyGraphicsInit` (e.g. `safetyGraphicsinit(maxFileSize=100)`). `safetyGraphicsApp()` does not have size limits for data files, but note that large data (>100 mb) [may cause performance issues](TechnicalFAQ.html#q-how-do-i-avoid-r-not-choking-on-the-huge-volume-of-lab-data-from-albrechtdurer). # Additional Resources Several additional vignettes are available for more advanced topics: -- [Chart Configuration Vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/ChartConfiguration) - details about the charting process including technical specifications and step-by-step instructions -- [Cookbook Vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/Cookbook) - a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios -- [Technical FAQ Vignette](https://github.com/SafetyGraphics/safetyGraphics/wiki/TechnicalFAQ) Vignette - vignette discussing security, validation and other technical issues + +- [Chart Configuration Vignette](ChartConfiguration.html) - details about the charting process including technical specifications and step-by-step instructions +- [Cookbook Vignette](Cookbook.html) - a series of examples showing how to initialize the safetyGraphics Shiny app in different scenarios +- [Technical FAQ Vignette](TechnicalFAQ.html) - vignette discussing security, validation and other technical issues The {safetyGraphics} app is maintained by the Interactive Safety Graphics (ISG) subteam of the ASA Biopharm-DIA Safety Working Group. You can learn more about the team and find links to recent presentations and publications at our [home page](https://safetygraphics.github.io/). @@ -137,3 +144,13 @@ devtools::install_github("safetyGraphics/safetyCharts") library(safetyCharts) safetyGraphicsApp() #or safetyGraphicsInit() ``` + +# Appendix 2 - Minimum Data Requirements + +Since the `safetyGraphics` framework supports adding custom charts (that may have custom settings), there are no universal data requirements for the app. However, the charts included by default version of the app are built to share requirements whenever possible. These requirements are captured in an included metadata file called `safetyGraphics::meta`. + +The most basic requirements for the 3 default domains are: + +- **Lab results** (`labs`) domain - Expects one record per person per visit per lab measurement with columns for: Participant ID, lab result, lab name, lower limit of normal, upper limit of normal, study day, study visit (numeric), study visit (character). See `safetyGraphics::meta %>% filter(domain=="labs")` for additional details and optional columns used by some charts. +- **Adverse Event** (`aes`) domain - Expects one record per adverse event with columns for: Participant ID, AE Sequence, Study Day, AE Start day, AE end day, AE preferred term and AE body system. See `safetyGraphics::meta %>% filter(domain=="aes")` +- **Demographics** (`dm`) domain - Expects one record per person with columns for: Participant ID, Sex, Race, Age and Study Treatment (optional) . See `safetyGraphics::meta %>% filter(domain=="dm")` for additional details. \ No newline at end of file