Skip to content

Commit

Permalink
Minor improvements to README/vignettes (#993)
Browse files Browse the repository at this point in the history
Fixes #992
  • Loading branch information
edelarua authored Jan 31, 2024
1 parent 8460dc6 commit 29069a5
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 58 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@ These modules include, but are not limited to:

<!-- markdownlint-disable MD007 MD030 -->
- Data visualizations:
- forest plots (`tm_g_forest_rsp`/`tm_g_forest_tte`)
- line plots (`tm_g_lineplot`)
- `Kaplan-Meier` plots (`tm_g_km`)
- Forest plots (`tm_g_forest_rsp()`/`tm_g_forest_tte()`)
- Line plots (`tm_g_lineplot()`)
- Kaplan-Meier plots (`tm_g_km()`)
- ...
- Statistical model fits:
- `MMRM` (`tm_a_mmrm`)
- logistic regression (`tm_t_logistic`)
- Cox regression (`tm_t_coxreg`)
- MMRM (`tm_a_mmrm()`)
- Logistic regression (`tm_t_logistic()`)
- Cox regression (`tm_t_coxreg()`)
- ...
- Summary tables:
- unique patients (`tm_t_summary`)
- exposure across patients (`tm_t_exposure`)
- change from baseline for parameters (`tm_t_summary_by`)
- Unique patients (`tm_t_summary()`)
- Exposure across patients (`tm_t_exposure()`)
- Change from baseline for parameters (`tm_t_summary_by()`)
- ...
- Patient-level profile modules:
- table of basic information about chosen patient (`tm_t_pp_basic_info`)
- plot of patient vitals over time (`tm_g_pp_vitals`)
- general timeline for individual patients (`tm_g_pp_patient_timeline`)
- Table of basic information about chosen patient (`tm_t_pp_basic_info()`)
- Plot of patient vitals over time (`tm_g_pp_vitals()`)
- General timeline for individual patients (`tm_g_pp_patient_timeline()`)
- ...

<!-- markdownlint-enable MD007 MD030 -->

Most of the modules in `teal.modules.clinical` use functions from the R package [tern](https://insightsengineering.github.io/tern/) in order to produce their output.
Most modules in the package are implemented using functions from the R package [`tern`](https://insightsengineering.github.io/tern/) in order to produce their output.

Please see [teal gallery](https://insightsengineering.github.io/teal.gallery/main/) and [TLG Catalog](https://insightsengineering.github.io/tlg-catalog/) for examples of `teal` apps created using modules from this package.
Please see the [Teal Gallery](https://insightsengineering.github.io/teal.gallery/) and [TLG Catalog](https://insightsengineering.github.io/tlg-catalog/) for examples of `shiny` apps created using modules from this package.

## Installation

From July 2023 `insightsengineering` packages are available on [r-universe](https://r-universe.dev/).
As of July 2023, all `insightsengineering` packages are available on [r-universe](https://r-universe.dev/).

```r
# stable versions
Expand All @@ -61,7 +61,7 @@ install.packages('teal.modules.clinical', repos = c('https://insightsengineering
install.packages('teal.modules.clinical', repos = c('https://pharmaverse.r-universe.dev', 'https://cloud.r-project.org'))
```

See package vignettes `browseVignettes(package = "teal.modules.clinical")` for usage of this package.
See package vignettes (`browseVignettes(package = "teal.modules.clinical")`) for usage of this package.

## Acknowledgment

Expand Down
6 changes: 6 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
ADAE
ADSL
ADaM
ANCOVA
Evaluable
Facetting
Forkers
Getter
Hoffmann
Kaplan
MMRM
NSE
Rua
SMQ
TLG
UI
Univariable
Expand Down
92 changes: 50 additions & 42 deletions vignettes/teal-modules-clinical.Rmd
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
---
title: "Getting started with teal.modules.clinical"
title: "Getting Started with {teal.modules.clinical}"
author: "NEST CoreDev Team"
date: "01.04.2022"
output:
rmarkdown::html_document:
theme: "spacelab"
highlight: "kate"
toc: true
toc_float: true
date: "`r Sys.Date()`"
vignette: >
%\VignetteIndexEntry{Getting started}
%\VignetteIndexEntry{Getting Started}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

### Introduction

`teal.modules.clinical` is a package implementing a number of `teal` modules helpful for exploring clinical
trials data, specifically targeted towards data following the [`ADaM`](https://www.cdisc.org/standards/foundational/adam)
standards. `teal.modules.clinical` modules can be used with data other than `ADaM` standard clinical data, but some
features of the package will make little sense then.
trials data, specifically targeted towards data following the [ADaM](https://www.cdisc.org/standards/foundational/adam)
standards. `teal.modules.clinical` modules can be used with data other than ADaM standard clinical data, but some
features of the package are tailored towards data of this type.

The concepts presented here require knowledge about the core features of `teal`, specifically on how to launch a `teal`
application and how to pass data into it. Therefore, it is highly recommended to refer to the [`README`](https://insightsengineering.github.io/teal/index.html) file and
the introductory [`vignette`](https://insightsengineering.github.io/teal/articles/teal.html) of the `teal` package.
application and how to pass data into it. Therefore, it is highly recommended to refer to the [home page](https://insightsengineering.github.io/teal/index.html) and
[introductory vignette](https://insightsengineering.github.io/teal/articles/teal.html) of the `teal` package.

### Main Features

### Main features
The package provides ready-to-use `teal` modules you can embed in your `teal` application. The modules
generate highly customizable tables, plots and outputs often used in exploratory data analysis, e.g.:
generate highly customizable tables, plots, and outputs often used in exploratory data analysis, including:

- `ANCOVA` - `tm_t_ancova()`
- cox regression - `tm_t_coxreg()`
- ANCOVA - `tm_t_ancova()`
- Cox regression - `tm_t_coxreg()`
- Kaplan-Meier plot - `tm_g_km()`
- logistic regression - `tm_t_logistic()`
- bar chart - `tm_g_barchart_simple()`
- confidence interval plot - `tm_g_ci()`
- binary outcome response table - `tm_t_binary_outcome()`
- summary of adverse events table - `tm_t_events_summary()`
- `SMQ` table - `tm_t_smq()`
- `time to event` table - `tm_t_tte()`
- Logistic regression - `tm_t_logistic()`
- Bar chart - `tm_g_barchart_simple()`
- Confidence interval plot - `tm_g_ci()`
- Binary outcome response table - `tm_t_binary_outcome()`
- Summary of adverse events table - `tm_t_events_summary()`
- SMQ table - `tm_t_smq()`
- Time-to-event table - `tm_t_tte()`

The library also offers a group of patient profile modules targeted for clinical statisticians and physicians
who want to review data on a per patient basis. The modules present data about patient's adverse events,
their severity, the current therapy, their laboratory results and more.

See [`package functions / modules`](https://insightsengineering.github.io/teal.modules.clinical/reference/index.html).
See the full index of package functions & modules [here](https://insightsengineering.github.io/teal.modules.clinical/reference/index.html).

### A simple application
A `teal.modules.clinical` module needs to be embedded inside a `shiny` / `teal` application to interact with it.
### A Simple Application

A `teal.modules.clinical` module needs to be embedded inside a `shiny`/`teal` application to interact with it.
A simple application including a bar chart module could look like this:

```r
Expand Down Expand Up @@ -82,28 +80,34 @@ if (interactive()) shiny::shinyApp(app$ui, app$server)
```

`teal.modules.clinical` exports modules and needs support from other libraries to run a `teal` app and flesh out its
functionality. In the example above, `tm_g_barchart_simple` is the only function from `teal.modules.clinical` where as
`init` is a `teal` function, `data_extract_spec`, `select_spec` and `variable_choices` are `teal.transform` functions
and `cdisc_data` are `teal.data` functions.
functionality. In the example above, `tm_g_barchart_simple()` is the only function from `teal.modules.clinical` whereas
`init()` is a `teal` function, `data_extract_spec()`, `select_spec()`, and `variable_choices()` are `teal.transform`
functions, and `cdisc_data()` is a `teal.data` function.

Let's break the above app down into pieces:

Let's break the above app into pieces:
```r
library(teal.modules.clinical)
library(nestcolor)
```
The above lines load the libraries used in this example. We will use the example data provided in the `teal.modules.clinical` package:

The above lines load the libraries used in this example. We will use the example data provided in the
`teal.modules.clinical` package:

```r
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
```
`nestcolor` is an optional package that can be loaded in to apply the standardized NEST color palette to all module plots.

`nestcolor` is an optional package that can be loaded in to apply the standardized NEST color palette to all module
plots.

There is no need to load `teal` as `teal.modules.clinical` already depends on it.

In the next step, we use `teal` to create `shiny` `ui` and `server` functions so we can launch using `shiny`. The `data`
argument tells `teal` about the input data - the two `ADaM` datasets `adsl` and `adae` - and the `modules`
argument indicates the modules included in the application. Here, we include only one - `tm_g_barchart_simple`.
In the next step, we use `teal` to create `shiny` UI and server functions that we can launch using `shiny`. The `data`
argument tells `teal` about the input data - the ADaM datasets ADSL and ADAE - and the `modules`
argument indicates the modules included in the application. Here, we include only one module: `tm_g_barchart_simple()`.

```r
app <- teal::init(
data = teal.data::cdisc_data(
Expand All @@ -126,15 +130,18 @@ app <- teal::init(
)
```

Ultimately, the example uses `shiny` to launch the application:
Finally, we use `shiny` to launch the application:

```r
if (interactive()) shiny::shinyApp(app$ui, app$server)
```

Some of `teal.modules.clinical` modules allow specifying arguments using `teal.transform::choices_selected` such as
`tm_t_summary` module in this example:
Some `teal.modules.clinical` modules allow for the specification of arguments using
`teal.transform::choices_selected()`, such as the `tm_t_summary()` module in the following example.

```r
ADSL <- tmc_ex_adsl

app <- teal::init(
data = teal.data::cdisc_data(ADSL = ADSL, code = "ADSL <- tmc_ex_adsl"),
modules = list(
Expand All @@ -149,8 +156,9 @@ app <- teal::init(
)
)
)

if (interactive()) shiny::shinyApp(app$ui, app$server)
```

Refer to the [API reference](https://insightsengineering.github.io/teal.modules.clinical/reference/index.html) of the
specific modules for more examples and information on the level of customization available.
Please refer to the [API reference](https://insightsengineering.github.io/teal.modules.clinical/reference/index.html)
of specific modules for more examples and information on the customization options available.

0 comments on commit 29069a5

Please sign in to comment.