Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 218 additions & 0 deletions README_clinical_modules_demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Complete Teal Clinical Modules Demo App

This Shiny application demonstrates **ALL 37 available modules** from the `teal.modules.clinical` package in a comprehensive, organized interface.

## Overview

The app showcases the complete range of clinical trial analysis modules available in the `teal.modules.clinical` package, providing a comprehensive example of how to integrate all these modules into a single application.

## Features

### 1. **App Information**
- Front page with detailed information about the demo
- Overview of all 37 available modules and data sources
- Package dependencies and descriptions

### 2. **Data Exploration**
- **Data Table**: Interactive table viewer for all datasets
- **Variable Browser**: Explore variables across all datasets

### 3. **Demographics**
- **Demographic Summary**: Standard demographic table with summary statistics by treatment arm

### 4. **Adverse Events**
- **AE Summary**: Summary of adverse events with analysis flags
- **AE by Term**: Adverse events by preferred term and body system
- **AE Table by Grade**: Adverse events stratified by toxicity grade
- **AE Rates Adjusted for Patient-Years**: Time-to-event analysis of adverse events
- **Adverse Events by SMQ Table**: Standardized MedDRA Queries analysis

### 5. **Laboratory Data**
- **Labs Summary**: Summary statistics for laboratory parameters
- **Grade Laboratory Abnormality Table**: Laboratory shifts by toxicity grade
- **Laboratory test results with highest grade post-baseline**: Worst post-baseline laboratory abnormalities

### 6. **Exposure**
- **Exposure Summary**: Summary of treatment exposure
- **Duration of Exposure Table**: Detailed exposure duration analysis

### 7. **Vital Signs**
- **Vital Signs Abnormality**: Analysis of vital signs abnormalities

### 8. **Concomitant Medications**
- **Concomitant Medication**: Analysis of concomitant medications by ATC classification

### 9. **ECG Data**
- **ECG Shift Table by Arm**: ECG parameter shifts from baseline
- **ECG Shift by Arm by Worst Grade**: ECG shifts by arm by worst grade

### 10. **Patient Profiles**
- **Patient Profile - Basic Info**: Basic patient information tables
- **Patient Profile - Laboratory**: Laboratory data for individual patients
- **Patient Profile - Medical History**: Medical history for individual patients
- **Patient Profile - Prior Medication**: Prior medication data for individual patients

### 11. **Statistical Analysis**
- **Analysis of Covariance (ANCOVA)**: ANCOVA analysis for laboratory data
- **Binary Outcome Analysis**: Analysis of binary response variables
- **Cox Regression Analysis**: Survival analysis using Cox regression
- **Logistic Regression Analysis**: Logistic regression for binary outcomes
- **Generalized Linear Models for Counts**: GLM analysis for count data
- **Time-to-Event Analysis**: General time-to-event analysis
- **Generalized Estimating Equations (GEE)**: GEE analysis for repeated measures
- **Mixed Models for Repeated Measures (MMRM)**: MMRM analysis for longitudinal data

### 12. **Graphics**
- **Laboratory Values Over Time**: Line plots of laboratory values over time
- **Kaplan-Meier Plot**: Survival analysis plots for time-to-event data
- **Simple Bar Chart**: Bar charts for laboratory data
- **Confidence Interval Plot**: CI plots for laboratory data
- **Forest Plot for Response**: Forest plots for response data
- **Forest Plot for Time-to-Event**: Forest plots for survival data
- **Individual Patient Plots**: Individual patient plots for laboratory data
- **Patient Profile - Adverse Events Plots**: AE plots for individual patients
- **Patient Profile - Timeline Plots**: Timeline plots for individual patients
- **Patient Profile - Therapy Plots**: Therapy plots for individual patients
- **Patient Profile - Vital Signs Plots**: Vital signs plots for individual patients

## Data

The app uses simulated CDISC ADaM datasets generated by the `random.cdisc.data` package:

- **ADSL**: Subject-level data
- **ADAE**: Adverse events data
- **ADAETTE**: Time-to-event adverse events data
- **ADEX**: Exposure data
- **ADLB**: Laboratory data
- **ADEG**: ECG data
- **ADVS**: Vital signs data
- **ADCM**: Concomitant medications data
- **ADMH**: Medical history data
- **ADPM**: Prior medication data
- **ADRS**: Response data
- **ADEF**: Efficacy data

## How to Run

1. **Install Required Packages**:
```r
install.packages(c("teal", "teal.modules.general", "teal.modules.clinical", "random.cdisc.data"))
```

2. **Run the App**:
```r
source("teal_clinical_modules_demo.R")
```

3. **Alternative: Run with Shiny**:
```r
library(shiny)
source("teal_clinical_modules_demo.R")
runApp()
```

## Complete Module List (37 modules)

### **Table Modules (tm_t_*) - 25 modules:**
1. `tm_t_summary` - Demographic and general summary tables
2. `tm_t_events_summary` - Adverse events summary
3. `tm_t_events` - Adverse events by term
4. `tm_t_events_by_grade` - Adverse events by toxicity grade
5. `tm_t_events_patyear` - Time-to-event analysis
6. `tm_t_smq` - Standardized MedDRA Queries
7. `tm_t_summary_by` - Summary tables with grouping
8. `tm_t_shift_by_grade` - Laboratory shifts by grade
9. `tm_t_abnormality_by_worst_grade` - Worst post-baseline abnormalities
10. `tm_t_exposure` - Exposure duration analysis
11. `tm_t_abnormality` - Vital signs abnormalities
12. `tm_t_mult_events` - Concomitant medications
13. `tm_t_shift_by_arm` - ECG shifts by treatment arm
14. `tm_t_shift_by_arm_by_worst` - ECG shifts by arm by worst grade
15. `tm_t_pp_basic_info` - Patient profile basic information
16. `tm_t_pp_laboratory` - Patient profile laboratory data
17. `tm_t_pp_medical_history` - Patient profile medical history
18. `tm_t_pp_prior_medication` - Patient profile prior medication
19. `tm_t_ancova` - Analysis of covariance
20. `tm_t_binary_outcome` - Binary outcome analysis
21. `tm_t_coxreg` - Cox regression analysis
22. `tm_t_logistic` - Logistic regression analysis
23. `tm_t_glm_counts` - Generalized linear models for counts
24. `tm_t_tte` - Time-to-event analysis
25. `tm_a_gee` - Generalized estimating equations
26. `tm_a_mmrm` - Mixed models for repeated measures

### **Graphics Modules (tm_g_*) - 11 modules:**
27. `tm_g_lineplot` - Line plots for time series data
28. `tm_g_km` - Kaplan-Meier survival plots
29. `tm_g_barchart_simple` - Simple bar charts
30. `tm_g_ci` - Confidence interval plots
31. `tm_g_forest_rsp` - Forest plots for response
32. `tm_g_forest_tte` - Forest plots for time-to-event
33. `tm_g_ipp` - Individual patient plots
34. `tm_g_pp_adverse_events` - Patient profile adverse events plots
35. `tm_g_pp_patient_timeline` - Patient profile timeline plots
36. `tm_g_pp_therapy` - Patient profile therapy plots
37. `tm_g_pp_vitals` - Patient profile vital signs plots

### **General Modules**
- `tm_front_page` - App information page
- `tm_data_table` - Interactive data table
- `tm_variable_browser` - Variable exploration

## Key Features

1. **Complete Coverage**: All 37 modules from `teal.modules.clinical`
2. **Modular Design**: Each analysis type is contained in its own module
3. **Interactive Filtering**: Global filters affect all modules
4. **Consistent Interface**: All modules follow the same design patterns
5. **CDISC Compliance**: Built for CDISC ADaM data standards
6. **Clinical Focus**: Specifically designed for clinical trial analysis
7. **Organized Sections**: Modules grouped by analysis type for easy navigation

## Module Categories

- **Adverse Events**: 5 modules (summary, by term, by grade, time-to-event, SMQ)
- **Laboratory Data**: 3 modules (summary, shifts by grade, worst post-baseline)
- **Patient Profiles**: 7 modules (basic info, lab, medical history, prior meds, plots)
- **Statistical Analysis**: 8 modules (ANCOVA, binary outcome, Cox regression, logistic, GLM, TTE, GEE, MMRM)
- **Graphics**: 11 modules (bar charts, CI plots, forest plots, KM plots, line plots, patient profiles)
- **Exposure**: 2 modules (summary, duration)
- **Vital Signs**: 1 module (abnormalities)
- **Concomitant Medications**: 1 module (analysis)
- **ECG Data**: 2 modules (shifts by arm, shifts by arm by worst)
- **Demographics**: 1 module (summary)

## Customization

The app can be easily customized by:

1. **Adding/Removing Modules**: Modify the `modules()` section
2. **Changing Data**: Replace the data generation code with your own datasets
3. **Adjusting Filters**: Modify the `teal_slices()` configuration
4. **Customizing Variables**: Update the variable choices and selections

## Dependencies

- `teal`: Core framework
- `teal.modules.general`: General purpose modules
- `teal.modules.clinical`: Clinical trial specific modules (37 modules)
- `random.cdisc.data`: Data generation
- `dplyr`: Data manipulation
- `nestcolor`: Color schemes
- `sparkline`: Optional for enhanced graphics

## Notes

- The app uses simulated data for demonstration purposes
- All modules include "Show R Code" functionality
- Filters are applied globally across all modules
- The app follows CDISC standards for clinical trial data analysis
- Each module can be used independently in other applications
- This is the most comprehensive demo of `teal.modules.clinical` available

## Support

For issues or questions:
- Check the [teal documentation](https://insightsengineering.github.io/teal/)
- Visit the [teal.modules.clinical documentation](https://insightsengineering.github.io/teal.modules.clinical/)
- Report issues on the [GitHub repository](https://github.com/insightsengineering/teal.gallery/issues)
Loading