Mighty Components for ADaM Generation

Reusable code templates (components) for the 'mighty' framework, used to generate Analysis Data Model (ADaM) programs. Components are 'Mustache' templates documented with 'roxygen2'-like tags. They can be retrieved from local directories, 'GitHub' or URLs, rendered with study-specific parameters, validated, evaluated, and unit tested with code coverage.


mighty.component mighty.component website

R-CMD-check

mighty.component provides reusable code templates, called components, for the {mighty} framework, used to generate ADaM programs. Components are Mustache templates documented with roxygen-like tags. Retrieve them from local directories, GitHub or URLs, then render, validate, evaluate and test them.

Installation

# Install the released version from CRAN:
install.packages("mighty.component")
# Install the development version from GitHub:
pak::pak("NovoNordisk-OpenSource/mighty.component")

Usage

Get a component by name from a repo. Repos can be local directories, github::owner/repo/subdir@ref or url::https://.... With several repos, they are searched in order and the first match is used.

library(mighty.component)

repo <- system.file("examples", package = "mighty.component")
ady <- get_component("ady", repos = repo)
ady
#> <mighty_component/R6>
#> ady: Analysis relative day
#> Type: column
#> Parameters:
#> • domain: `character` Name of new domain being created
#> • variable: `character` Name of new variable to create
#> • date: `character` Name of date variable to use
#> Depends:
#> • {{{domain}}}.{{{date}}}
#> • {{{domain}}}.TRTSDT
#> Outputs:
#> • {{{variable}}}

Render it with study-specific parameters:

ady$render(domain = "ADAE", variable = "ASTDY", date = "ASTDT")
#> <mighty_component_rendered/mighty_component/R6>
#> ady: Analysis relative day
#> Type: column
#> Depends:
#> • ADAE.ASTDT
#> • ADAE.TRTSDT
#> Outputs:
#> • ASTDY
#> Code:
#> ADAE <- ADAE |>
#>   dplyr::mutate(
#>     ASTDY = admiral::compute_duration(
#>       start_date = TRTSDT,
#>       end_date = ASTDT,
#>       in_unit = 'days',
#>       out_unit = 'days',
#>       add_one = TRUE
#>     )
#>   )

Rendered components can be evaluated with $eval(), written to a script with $stream(), and unit tested with get_test_component(). See vignette("mighty-component") for details.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("mighty.component")

0.2.0 by Aksel Thomsen, 6 hours ago


https://novonordisk-opensource.github.io/mighty.component/, https://github.com/NovoNordisk-OpenSource/mighty.component


Report a bug at https://github.com/NovoNordisk-OpenSource/mighty.component/issues


Browse source code at https://github.com/cran/mighty.component


Authors: Aksel Thomsen [aut, cre] , Matthew Phelps [aut] , Novo Nordisk A/S [cph]


Documentation:   PDF Manual  


Apache License (>= 2) license


Imports cli, glue, R6, rlang, S7, whisker, withr, xml2, xmlparsedata, zephyr

Suggests admiral, callr, covr, curl, dplyr, gh, httr2, knitr, pharmaverseadam, remotes, rmarkdown, testthat, tibble, tidyr


See at CRAN