Skip to content
Open
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
4 changes: 0 additions & 4 deletions .github/workflows/link_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ jobs:
Rscript -e 'install.packages("fs")'
shell: bash

- name: Switch .qmd to .md
run: Rscript R/switch.R
shell: bash

- name: Link Checker
uses: lycheeverse/lychee-action@v1.8.0
with:
Expand Down
38 changes: 22 additions & 16 deletions R/switch.R
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
#' fixes link-check problem
#' Finds whether any files use the string: "(.mailto:" for linking email adresses
#' then just replaces with: "(mailto:" as is markdown standard
#' Fixes link-check problem
#' - Finds files that use the string "(.mailto:" and corrects to "(mailto:"
#' - Updates links to `.qmd` files to point to `.md` files.
#'
#' @param file_list vector of filenames
#'
#' @return messages only. side effect is: changes files.
#' @return messages. Side effect: modifies files.
modify_files <- function(file_list) {
# Create an empty vector to store the file names that contain the string
# Create an empty vector to store file names that need modifications
matching_files <- c()

# Iterate over each file in the directory
# Iterate over each file to check for issues
for (file in file_list) {
# Read the contents of the file
file_contents <- readLines(file)

# Check if the file contains the string "(.mailto:"
if (any(grepl("\\(\\.mailto:", file_contents))) {
# Check if the file contains the string "(.mailto:" OR references to `.qmd` files
if (any(grepl("\\(\\.mailto:", file_contents)) || any(grepl("\\.qmd\\)", file_contents))) {
# Add the file name to the vector
matching_files <- c(matching_files, file)
}
}

# Iterate over the matching files
# Iterate over the matching files to apply fixes
for (file in matching_files) {
# Read the contents of the file
file_contents <- readLines(file)

# Remove the "." from each line that contains the string
# Fix email links
modified_contents <- gsub("\\(\\.mailto:", "(mailto:", file_contents)

# Update links to `.qmd` files to point to `.md` files
# Matches patterns like `[text](filename.qmd)` and replaces `.qmd` with `.md`
modified_contents <- gsub("\\.qmd\\)", ".md)", modified_contents)

# Write the modified contents back to the file
writeLines(modified_contents, file)

# Print a message indicating the modification has been made
# Print a message indicating what modifications have been made
message("Modified file:", file, "\n")
}

# Print the list of matching files
# Print a list of matching files that were modified
message("Matching files:", matching_files, "\n")
}

# get all qmd files
# Get all `.qmd` files
all_qmd <- list.files(full.names = FALSE, all.files = FALSE, pattern = ".qmd$", recursive = TRUE)

# modify if needed the link to email problem for link checker
# Modify files to fix email links and update `.qmd` references
modify_files(all_qmd)
# get filenames ending with .md

# Generate a list of `.md` filenames that will replace `.qmd` files
all_md <- gsub(".qmd$", ".md", all_qmd)
# rename all files

# Rename all `.qmd` files to `.md`
file.rename(all_qmd, all_md)
111 changes: 111 additions & 0 deletions adam/index.qmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,114 @@
---
title: "ADaM"
---

## Overview

This section provides end-to-end examples for creating Analysis Data Model (ADaM) datasets using pharmaverse packages. ADaM is a CDISC standard designed to facilitate efficient generation, replication, and review of clinical trial statistical analyses.

The examples demonstrate how to leverage multiple pharmaverse packages together, including `{admiral}`, `{metacore}`, `{metatools}`, and `{xportr}`, to build analysis-ready datasets from SDTM data.

All examples use SDTM datasets from `{pharmaversesdtm}` as input, ensuring consistency and reproducibility.

## Examples

### Subject-Level Analysis Dataset (`ADSL`)

- **[ADSL (Subject-Level Analysis Dataset)](adsl.qmd)** - Create the foundational subject-level dataset containing demographic, treatment, and study participation information.

::: {.callout-tip}
## Start Here
`ADSL` is the foundation for most other ADaM datasets. We recommend starting with this example if you're new to ADaM development with pharmaverse packages. `ADSL` contains one record per subject and serves as the basis for merging subject-level variables into other ADaM datasets.
:::

### Basic Data Structure (BDS) Analysis Datasets

BDS datasets follow a standard structure with one observation per subject per analysis parameter per analysis timepoint. These are commonly used for efficacy and safety analyses.

- **[`ADVS` (Vital Signs Analysis)](advs.qmd)** - Generate vital signs analysis dataset with baseline and change from baseline calculations.
- **[`ADRS` (Response Analysis)](adrs.qmd)** - Create response analysis dataset for oncology efficacy endpoints.

### Occurrence Data Structure (OCCDS) Analysis Datasets

OCCDS datasets have one observation per subject per occurrence of an event, capturing multiple events per subject.

- **[`ADAE` (Adverse Events Analysis)](adae.qmd)** - Build an analysis dataset for adverse events with derived variables for analysis and reporting.

### Time-to-Event Analysis Dataset (`ADTTE`)

- **[`ADTTE` (Time-to-Event Analysis)](adtte.qmd)** - Develop oncology time-to-event analysis dataset for survival analyses, including censoring and event derivations.

### Pharmacokinetic Analysis Datasets

- **[`ADPC` (Pharmacokinetic Concentrations)](adpc.qmd)** - Build pharmacokinetic concentration analysis dataset with timepoint derivations.
- **[`ADPPK` (Population Pharmacokinetic)](adppk.qmd)** - Create population pharmacokinetic analysis dataset for modeling and simulation.

## Quick Reference

| Dataset Type | Example | Key Packages | Structure |
|--------------|---------|--------------|-----------|
| **Subject-Level** | [`ADSL`](adsl.qmd) | admiral, metacore, metatools, xportr | One record per subject |
| **BDS - Vitals** | [`ADVS`](advs.qmd) | admiral, metacore, metatools, xportr | One record per subject per parameter per timepoint |
| **BDS - Response** | [`ADRS`](adrs.qmd) | admiral, metacore, metatools, xportr | One record per subject per parameter per timepoint |
| **OCCDS - Safety** | [`ADAE`](adae.qmd) | admiral, metacore, metatools, xportr | One record per subject per event |
| **Time-to-Event** | [`ADTTE`](adtte.qmd) | admiral, metacore, metatools, xportr | One record per subject per parameter |
| **PK Concentration** | [`ADPC`](adpc.qmd) | admiral, metacore, metatools, xportr | One record per subject per timepoint per analyte |
| **Population PK** | [`ADPPK`](adppk.qmd) | admiral, metacore, metatools, xportr | One record per subject per timepoint |

## Workflow Overview

Each example demonstrates a consistent workflow for creating ADaM datasets:

1. **Data Input** - Load SDTM datasets and required metadata specifications
2. **Derivations** - Apply ADaM derivation functions to create analysis variables (e.g., baseline flags, change from baseline, derived parameters)
3. **Metadata Application** - Use metadata specifications to control dataset attributes, labels, and formats
4. **Validation** - Perform dataset checks and validation against specifications
5. **Export** - Create SAS transport files ready for regulatory submission

::: {.callout-note}
## Dataset Dependencies

Most ADaM datasets require `ADSL` as input for subject-level variables. The typical flow is:

**SDTM datasets** → **`ADSL`** → **Other ADaM datasets** → **TLGs**
:::

## Key Packages Used

- **[`{admiral}`](https://pharmaverse.github.io/admiral/)** - Core ADaM derivations and functions for creating analysis datasets following CDISC standards
- **[`{metacore}`](https://atorus-research.github.io/metacore/)** - Metadata and specifications management, storing variable-level metadata
- **[`{metatools}`](https://pharmaverse.github.io/metatools/)** - Dataset building and validation using metadata, applying specifications to datasets
- **[`{xportr}`](https://atorus-research.github.io/xportr/)** - SAS transport file creation and eSub compliance checks for regulatory submissions

## Meet the `{admiral}` Family

The `{admiral}` ecosystem includes specialized extension packages for different therapeutic areas and study types:

- **[Admiral Family Overview](https://pharmaverse.org/e2eclinical/adam/)** - Explore the complete admiral family
- **Extension Packages** - These packages provide additional therapeutic area support, for example including functions for oncology endpoints such as RECIST v1.1 for solid tumors (`{admiralonco}`)
- **Additional extensions** - Packages for other therapeutic areas are under development

Each extension package builds on `{admiral}` core functionality while providing domain-specific derivations.

## Additional Resources

::: {.callout-note}
## Learn More

- [CDISC ADaM Implementation Guide](https://www.cdisc.org/standards/foundational/adam) - Official ADaM standard documentation and data structure specifications
- [{admiral} Documentation](https://pharmaverse.github.io/admiral/) - Comprehensive guide to admiral functions, workflows, and best practices
- [Pharmaverse E2E Clinical Reporting](https://pharmaverse.org/e2eclinical/) - Complete list of pharmaverse packages supporting the full clinical reporting pipeline
:::

## Common Derivations Across Examples

While each ADaM dataset has unique requirements, several derivation patterns appear across multiple examples:

- **Baseline derivations** - Identifying and flagging baseline records
- **Change from baseline** - Calculating analysis values relative to baseline
- **Analysis flags** - Creating indicators for analysis populations and key events
- **Date/time imputations** - Handling partial or missing dates
- **Treatment variables** - Deriving planned and actual treatment information
- **Parameter derivations** - Creating derived or calculated parameters

These common patterns are demonstrated throughout the examples, showing how `{admiral}` functions can be reused across different dataset types.
40 changes: 40 additions & 0 deletions digit_files/index.qmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
---
title: "Documents"
---

## Overview

This section contains examples for generating various document outputs from clinical trial data using pharmaverse packages. These examples demonstrate how to create professional reports, presentations, and other document formats commonly used in pharmaceutical research and regulatory submissions.

The examples leverage R's document generation capabilities combined with pharmaverse tools to automate the creation of formatted outputs.

## Examples

The following document generation examples are available:

### Word Documents

- **[DOCX Output](docx.qmd)** - Learn how to generate Microsoft Word documents from R, including tables, listings, and formatted text. This is particularly useful for creating clinical study reports and documentation that require Word format.

### PowerPoint Presentations

- **[Auto Slider](autoslider.qmd)** - Create automated PowerPoint presentations with clinical trial outputs. This example demonstrates how to programmatically generate slides containing tables, figures, and analysis results, streamlining the creation of study presentations and data review meetings.

## Use Cases

These document generation capabilities are valuable for:

- Clinical study reports (CSRs)
- Statistical analysis plans (SAPs)
- Data review meetings
- Regulatory submission documents
- Study team presentations
- Internal stakeholder communications

## Getting Started

Each example demonstrates:

- Setting up document templates
- Populating documents with analysis results
- Formatting and styling outputs
- Automating repetitive document creation tasks

These tools can significantly reduce the time and effort required to produce professional documentation from your clinical trial analyses.
55 changes: 55 additions & 0 deletions esub/index.qmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
---
title: "eSubmission"
---

## Overview

This section provides examples for preparing electronic submissions (eSubmissions) to regulatory agencies using pharmaverse packages. eSubmissions are a critical component of the drug approval process, requiring properly formatted and validated datasets along with comprehensive documentation.

The examples demonstrate how to leverage pharmaverse tools to ensure your submissions meet regulatory requirements and follow industry best practices.

## Examples

In our [eSubmission example](esub.qmd), you will find ever-evolving guidance on creating and checking all of the key clinical reporting components of an eSubmission when using R and open source

### Analysis Data Reviewer's Guide

- **[ADRG (Analysis Data Reviewer's Guide)](esub.qmd)** - Learn how to create an Analysis Data Reviewer's Guide, a key document in regulatory submissions. The ADRG provides reviewers with essential information about the analysis datasets, data structures, and derivations used in the submission. This example demonstrates how to document dataset specifications, define.xml generation, and other critical components of a complete eSubmission package.

## Key Components of eSubmissions

Successful electronic submissions typically include:

- **Datasets** - Properly formatted SDTM and ADaM datasets in SAS transport (XPT) format
- **Define.xml** - Machine-readable dataset and variable definitions
- **Reviewers Guides** - Comprehensive guide to the tabulation and analysis datasets and derivations
- **Readable Code** - Accessible and understandable TLG programs for key endpoints

## Regulatory Standards

eSubmissions must comply with various regulatory standards and guidance:

- **CDISC Standards** - SDTM, ADaM, Define-XML specifications
- **FDA Guidance** - Study Data Technical Conformance Guide
- **ICH Guidelines** - International standards for data standards and eCTD

## Key Packages Used

- **`{xportr}`** - Creating SAS transport files and performing eSub checks
- **`{metacore}`** - Managing metadata and specifications
- **`{metatools}`** - Working with metadata and specifications to format and check data
- **Various pharmaverse packages** - Dataset creation and validation

## Getting Started

The examples demonstrate:

- Preparing analysis datasets for submission
- Generating required documentation
- Validating datasets against specifications
- Creating submission-ready packages

Following these examples will help ensure your submissions meet regulatory requirements and facilitate efficient review by regulatory agencies.

## Resources

For more information on eSubmissions and regulatory requirements, consult:
- [CDISC website](https://www.cdisc.org/)
- [FDA Study Data Standards Resources](https://www.fda.gov/industry/fda-data-standards-advisory-board/study-data-standards-resources)
Loading