diff --git a/dev/26/apple-touch-icon-120x120.png b/dev/26/apple-touch-icon-120x120.png index c38351a..ab3c986 100644 Binary files a/dev/26/apple-touch-icon-120x120.png and b/dev/26/apple-touch-icon-120x120.png differ diff --git a/dev/26/apple-touch-icon-152x152.png b/dev/26/apple-touch-icon-152x152.png index cbb3f1e..c76cece 100644 Binary files a/dev/26/apple-touch-icon-152x152.png and b/dev/26/apple-touch-icon-152x152.png differ diff --git a/dev/26/apple-touch-icon-180x180.png b/dev/26/apple-touch-icon-180x180.png index 3e6c304..c24c90f 100644 Binary files a/dev/26/apple-touch-icon-180x180.png and b/dev/26/apple-touch-icon-180x180.png differ diff --git a/dev/26/apple-touch-icon-60x60.png b/dev/26/apple-touch-icon-60x60.png index 952ca26..c478058 100644 Binary files a/dev/26/apple-touch-icon-60x60.png and b/dev/26/apple-touch-icon-60x60.png differ diff --git a/dev/26/apple-touch-icon-76x76.png b/dev/26/apple-touch-icon-76x76.png index 8b19143..11703e3 100644 Binary files a/dev/26/apple-touch-icon-76x76.png and b/dev/26/apple-touch-icon-76x76.png differ diff --git a/dev/26/apple-touch-icon.png b/dev/26/apple-touch-icon.png index 834b4f7..4705c9a 100644 Binary files a/dev/26/apple-touch-icon.png and b/dev/26/apple-touch-icon.png differ diff --git a/dev/26/articles/ep_spec_strata_w_events.html b/dev/26/articles/ep_spec_strata_w_events.html index 7005bab..c01178a 100644 --- a/dev/26/articles/ep_spec_strata_w_events.html +++ b/dev/26/articles/ep_spec_strata_w_events.html @@ -121,8 +121,12 @@

Overview

The only_strata_with_events endpoint parameter specifies whether the endpoint upon completion in the {chef} framework will -include all strata levels or only those levels that contain events. By -default, all levels will be included in the endpoint.

+include all strata levels or only those levels that contain events.By +default, all levels will be included in the endpoint

+

If there is at least one event in one of the treatment arms for a +given strata level, then that strata level with be included in the +endpoint for both treatment arms regardsless of whether one of the +treatment arms has no events in that stratum.

This feature is useful in cases where the endpoint specification contains groups and strata that result in many 100s or 1000s of combinations and where only the combinations with events are of @@ -197,7 +201,9 @@

Ex 7.1

Thus we have 23 SOCs x (4 + 12) = 368 combinations, i.e. 368 rows in the output data. Specifically, let us consider SOC “Eye Disorder” and print the the subset of the output data that covers that SOC (see -below). As expected 4 + 12 = 16 rows are provided.

+below). As expected 4 + 12 = 16 rows are provided. We also notice that +two of the strata levels for RACE has no event +(n = 0), which leads to the next example.

#>                                                                       stat_filter
 #>                                                                            <char>
 #>  1:                                       TOTAL_ == "total" & TRT01A == "Placebo"
@@ -256,8 +262,13 @@ 
Ex 7.2 endpoint_label = "AESOC: <AESOC>", only_strata_with_events = TRUE )
-

Now the number of combination in the output has been reduced to -256.

+

Now the number of combination in the output has been reduced to 256. +Let us revisit the SOC “Eye Disorder” and print all rows in the output +that related to that SOC (see below). We notice that 2 strata levels for +RACE are not present anymore (“BLACK OR AFRICAN AMERICAN”, +“AMERICAN INDIAN OR ALASKA NATIVE”) since they have no events c.f. +example 7.1., which effectively reducing the number of rows/combinations +to 8.

#>                                             stat_filter fn_name
 #>                                                  <char>  <char>
 #> 1:              TOTAL_ == "total" & TRT01A == "Placebo"       n
diff --git a/dev/26/articles/qc.html b/dev/26/articles/qc.html
index fc52acc..94ec914 100644
--- a/dev/26/articles/qc.html
+++ b/dev/26/articles/qc.html
@@ -244,7 +244,7 @@ 

Integration testingx1[(event), .N, by = .(TRT01A)][order(TRT01A)][, as.double(N)] expect_identical(actual$stat_result_value, expected) }) -#> v Setting active project to '/tmp/Rtmp2mVPdU/testproj1ca0561a9d83' +#> v Setting active project to '/tmp/Rtmpmb3dbo/testproj1c8f1bdf7a1e' #> v Writing 'R/packages.R' #> v Writing 'pipeline/pipeline_01.R' #> * Edit 'pipeline/pipeline_01.R' @@ -254,23 +254,23 @@

Integration testing#> * Edit 'R/mk_endpoint_def.R' #> Loading required package: targets #> ▶ dispatched target ep -#> ● completed target ep [0.031 seconds] +#> ● completed target ep [0.029 seconds] #> ▶ dispatched target ep_id -#> ● completed target ep_id [0.01 seconds] +#> ● completed target ep_id [0.009 seconds] #> ▶ dispatched branch ep_fn_map_a9f94f07 -#> ● completed branch ep_fn_map_a9f94f07 [0.029 seconds] +#> ● completed branch ep_fn_map_a9f94f07 [0.025 seconds] #> ● completed pattern ep_fn_map #> ▶ dispatched target user_def_fn -#> ● completed target user_def_fn [0.004 seconds] +#> ● completed target user_def_fn [0.003 seconds] #> ▶ dispatched target study_data -#> ● completed target study_data [0.04 seconds] +#> ● completed target study_data [0.037 seconds] #> ▶ dispatched target fn_map_tibble -#> ● completed target fn_map_tibble [0.005 seconds] +#> ● completed target fn_map_tibble [0.004 seconds] #> ▶ dispatched branch ep_and_data_a9f94f07 -#> ● completed branch ep_and_data_a9f94f07 [0.009 seconds] +#> ● completed branch ep_and_data_a9f94f07 [0.008 seconds] #> ● completed pattern ep_and_data #> ▶ dispatched branch fn_map_3a0d9b8d -#> ● completed branch fn_map_3a0d9b8d [0.001 seconds] +#> ● completed branch fn_map_3a0d9b8d [0 seconds] #> ● completed pattern fn_map #> ▶ dispatched branch analysis_data_container_5d792ea5 #> ● completed branch analysis_data_container_5d792ea5 [0 seconds] @@ -279,48 +279,48 @@

Integration testing#> ● completed branch ep_with_data_key_5d792ea5 [0 seconds] #> ● completed pattern ep_with_data_key #> ▶ dispatched branch ep_expanded_0ccac0a6 -#> ● completed branch ep_expanded_0ccac0a6 [0.043 seconds] +#> ● completed branch ep_expanded_0ccac0a6 [0.039 seconds] #> ● completed pattern ep_expanded #> ▶ dispatched branch ep_event_index_74b91187 -#> ● completed branch ep_event_index_74b91187 [0.006 seconds] +#> ● completed branch ep_event_index_74b91187 [0.005 seconds] #> ● completed pattern ep_event_index #> ▶ dispatched branch ep_crit_endpoint_191245c4 -#> ● completed branch ep_crit_endpoint_191245c4 [0.003 seconds] +#> ● completed branch ep_crit_endpoint_191245c4 [0.004 seconds] #> ● completed pattern ep_crit_endpoint #> ▶ dispatched branch ep_crit_by_strata_by_trt_de417ba1 #> ● completed branch ep_crit_by_strata_by_trt_de417ba1 [0.009 seconds] #> ● completed pattern ep_crit_by_strata_by_trt #> ▶ dispatched branch ep_crit_by_strata_across_trt_45e05d00 -#> ● completed branch ep_crit_by_strata_across_trt_45e05d00 [0.004 seconds] +#> ● completed branch ep_crit_by_strata_across_trt_45e05d00 [0.003 seconds] #> ● completed pattern ep_crit_by_strata_across_trt #> ▶ dispatched branch ep_prep_by_strata_across_trt_fbfeb90e -#> ● completed branch ep_prep_by_strata_across_trt_fbfeb90e [0.042 seconds] +#> ● completed branch ep_prep_by_strata_across_trt_fbfeb90e [0.038 seconds] #> ● completed pattern ep_prep_by_strata_across_trt #> ▶ dispatched branch ep_prep_across_strata_across_trt_fbfeb90e -#> ● completed branch ep_prep_across_strata_across_trt_fbfeb90e [0.014 seconds] +#> ● completed branch ep_prep_across_strata_across_trt_fbfeb90e [0.013 seconds] #> ● completed pattern ep_prep_across_strata_across_trt #> ▶ dispatched branch ep_prep_by_strata_by_trt_fbfeb90e -#> ● completed branch ep_prep_by_strata_by_trt_fbfeb90e [0.075 seconds] +#> ● completed branch ep_prep_by_strata_by_trt_fbfeb90e [0.066 seconds] #> ● completed pattern ep_prep_by_strata_by_trt #> ▶ dispatched target ep_rejected #> ● completed target ep_rejected [0 seconds] #> ▶ dispatched branch ep_stat_by_strata_across_trt_c5b9f3c4 -#> ● completed branch ep_stat_by_strata_across_trt_c5b9f3c4 [0.141 seconds] +#> ● completed branch ep_stat_by_strata_across_trt_c5b9f3c4 [0.122 seconds] #> ● completed pattern ep_stat_by_strata_across_trt #> ▶ dispatched branch ep_stat_across_strata_across_trt_c2630227 -#> ● completed branch ep_stat_across_strata_across_trt_c2630227 [0.033 seconds] +#> ● completed branch ep_stat_across_strata_across_trt_c2630227 [0.028 seconds] #> ● completed pattern ep_stat_across_strata_across_trt #> ▶ dispatched branch ep_stat_by_strata_by_trt_b1e90d49 -#> ● completed branch ep_stat_by_strata_by_trt_b1e90d49 [0.042 seconds] +#> ● completed branch ep_stat_by_strata_by_trt_b1e90d49 [0.039 seconds] #> ● completed pattern ep_stat_by_strata_by_trt #> ▶ dispatched target ep_stat_nested #> ● completed target ep_stat_nested [0 seconds] #> ▶ dispatched target ep_stat -#> ● completed target ep_stat [0.013 seconds] -#> ▶ ended pipeline [0.88 seconds] +#> ● completed target ep_stat [0.012 seconds] +#> ▶ ended pipeline [0.801 seconds] #> v Restoring original working directory: '/home/runner/work/ramnog/ramnog/vignettes/' #> v Setting active project to '<no active project>' -#> v Deleting temporary project: '/tmp/Rtmp2mVPdU/testproj1ca0561a9d83/' +#> v Deleting temporary project: '/tmp/Rtmpmb3dbo/testproj1c8f1bdf7a1e/' #> Test passed

diff --git a/dev/26/articles/ramnog.html b/dev/26/articles/ramnog.html index 6f22c00..8e4d813 100644 --- a/dev/26/articles/ramnog.html +++ b/dev/26/articles/ramnog.html @@ -285,20 +285,20 @@

4. Run the analysis pipeline
## Loading required package: targets
 ## ▶ dispatched target ep
-## ● completed target ep [0.031 seconds]
+## ● completed target ep [0.028 seconds]
 ## ▶ dispatched target ep_id
-## ● completed target ep_id [0.01 seconds]
+## ● completed target ep_id [0.009 seconds]
 ## ▶ dispatched branch ep_fn_map_c85cfecb
-## ● completed branch ep_fn_map_c85cfecb [0.029 seconds]
+## ● completed branch ep_fn_map_c85cfecb [0.026 seconds]
 ## ● completed pattern ep_fn_map
 ## ▶ dispatched target user_def_fn
-## ● completed target user_def_fn [0.003 seconds]
+## ● completed target user_def_fn [0.002 seconds]
 ## ▶ dispatched target study_data
-## ● completed target study_data [0.043 seconds]
+## ● completed target study_data [0.04 seconds]
 ## ▶ dispatched target fn_map_tibble
-## ● completed target fn_map_tibble [0.005 seconds]
+## ● completed target fn_map_tibble [0.004 seconds]
 ## ▶ dispatched branch ep_and_data_c85cfecb
-## ● completed branch ep_and_data_c85cfecb [0.009 seconds]
+## ● completed branch ep_and_data_c85cfecb [0.008 seconds]
 ## ● completed pattern ep_and_data
 ## ▶ dispatched branch fn_map_9cf81814
 ## ● completed branch fn_map_9cf81814 [0 seconds]
@@ -310,10 +310,10 @@ 

4. Run the analysis pipeline## ● completed branch ep_with_data_key_a4b422b1 [0 seconds] ## ● completed pattern ep_with_data_key ## ▶ dispatched branch ep_expanded_e741f3f8 -## ● completed branch ep_expanded_e741f3f8 [0.025 seconds] +## ● completed branch ep_expanded_e741f3f8 [0.023 seconds] ## ● completed pattern ep_expanded ## ▶ dispatched branch ep_event_index_5f7976c8 -## ● completed branch ep_event_index_5f7976c8 [0.003 seconds] +## ● completed branch ep_event_index_5f7976c8 [0.004 seconds] ## ● completed pattern ep_event_index ## ▶ dispatched branch ep_crit_endpoint_3da7fd1e ## ● completed branch ep_crit_endpoint_3da7fd1e [0.003 seconds] @@ -331,7 +331,7 @@

4. Run the analysis pipeline## ● completed branch ep_prep_across_strata_across_trt_89480a2b [0.001 seconds] ## ● completed pattern ep_prep_across_strata_across_trt ## ▶ dispatched branch ep_prep_by_strata_by_trt_89480a2b -## ● completed branch ep_prep_by_strata_by_trt_89480a2b [0.033 seconds] +## ● completed branch ep_prep_by_strata_by_trt_89480a2b [0.031 seconds] ## ● completed pattern ep_prep_by_strata_by_trt ## ▶ dispatched target ep_rejected ## ● completed target ep_rejected [0 seconds] @@ -339,7 +339,7 @@

4. Run the analysis pipeline## ● completed branch ep_stat_by_strata_across_trt_a72d712a [0 seconds] ## ● completed pattern ep_stat_by_strata_across_trt ## ▶ dispatched branch ep_stat_across_strata_across_trt_b2713725 -## ● completed branch ep_stat_across_strata_across_trt_b2713725 [0.001 seconds] +## ● completed branch ep_stat_across_strata_across_trt_b2713725 [0 seconds] ## ● completed pattern ep_stat_across_strata_across_trt ## ▶ dispatched branch ep_stat_by_strata_by_trt_9535dd36 ## ● completed branch ep_stat_by_strata_by_trt_9535dd36 [0.011 seconds] @@ -348,7 +348,7 @@

4. Run the analysis pipeline## ● completed target ep_stat_nested [0 seconds] ## ▶ dispatched target ep_stat ## ● completed target ep_stat [0.004 seconds] -## ▶ ended pipeline [0.525 seconds] +## ▶ ended pipeline [0.501 seconds] ##

Then, to see the results, you load the cached step of the pipeline corresponding to the results. In our case it will be diff --git a/dev/26/favicon-16x16.png b/dev/26/favicon-16x16.png index 04dc1b9..202b285 100644 Binary files a/dev/26/favicon-16x16.png and b/dev/26/favicon-16x16.png differ diff --git a/dev/26/favicon-32x32.png b/dev/26/favicon-32x32.png index 144c75b..d5cadb4 100644 Binary files a/dev/26/favicon-32x32.png and b/dev/26/favicon-32x32.png differ diff --git a/dev/26/pkgdown.yml b/dev/26/pkgdown.yml index aa0f7f2..0cd401f 100644 --- a/dev/26/pkgdown.yml +++ b/dev/26/pkgdown.yml @@ -20,7 +20,7 @@ articles: ramnog: ramnog.html results_datamodel: results_datamodel.html results_datamodel2tfl: results_datamodel2tfl.html -last_built: 2024-04-17T13:55Z +last_built: 2024-04-17T14:26Z urls: reference: https://hta-pharma.github.io/ramnog/reference article: https://hta-pharma.github.io/ramnog/articles diff --git a/dev/26/search.json b/dev/26/search.json index ff05ff0..79525ff 100644 --- a/dev/26/search.json +++ b/dev/26/search.json @@ -1 +1 @@ -[{"path":"https://hta-pharma.github.io/ramnog/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Novo Nordisk /S, Danish company registration . 24256790 Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"context---why-debugging-is-different","dir":"Articles","previous_headings":"","what":"Context - why debugging is different","title":"Debugging","text":"{chef} pipeline, execution environment managed {targets}, take place working environment. side-effect, straightforward reproduce errors trace back source. Specifically: target {targets} pipeline run new R session closes upon completion hitting error. means working environment clean every run, beneficial reproducibility can make harder debug state led error might readily accessible. {targets} uses caching mechanism avoid re-running successful tasks. feature enhances efficiency, can make debugging tricky. Understanding whether bug due current code cached results might straightforward Sometimes, error messages {targets} pipeline can cryptic informative, making harder figure ’s going wrong. Debugging often requires interactively running code inspect objects states. However, {targets} designed non-interactive batch (sometimes parallel) execution, can make interactive debugging less straightforward. example, just insert browser() function errored like interactive debugging.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"chef-style-debugging","dir":"Articles","previous_headings":"","what":"{chef} style debugging","title":"Debugging","text":"common errors due errors stemming improper user inputs (e.g. user-supplied functions generate input ADaM datasets, contain statistical methods). debug , easiest programmer access state program time errored-. Errors stemming user function split two types: Firstly, relating function formals specifically whether function inputs match supplied {chef}. Secondly, errors arise evaluation function validation output. errors can come bug functions causing crashing runtime, functions return invalid output.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"input-errors","dir":"Articles","previous_headings":"{chef} style debugging","what":"Input errors","title":"Debugging","text":"Input errors stems mismatch expected arguments function arguments {chef} supplies. Errors domain stem improperly defined statistical functions instance statistical functions applied wrong statistical types endpoint specification. function user can define {chef} supplies predefined set arguments (data, statistics, criteria). arguments always supplied, function must either exhaustive function definition, recommended include dots (…) function definition allow functions ignore arguments, required specific function.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"examples","dir":"Articles","previous_headings":"{chef} style debugging > Input errors","what":"Examples:","title":"Debugging","text":"-defined function function require arguments supplied. example, expect---supplied argument specific_arg clearly described well arguments {chef} supplies (study_metadata) full function argument specification. -defined function function explicitly require supplied arguments also doesn’t dots (…) included catch surplus arguments. -defined example function expect supplied study_metadata argument. example also shows optional arguments (default values) displayed.","code":"# Given a data_prepare function: my_data <- function(study_metadata, specific_arg){ #... } # Would give rise to the following error: Function (my_data) of type (data_prepare) expects argument(s) which is not supplied: specific_arg Supplied arguments: study_metadata Expected arguments: (required, [optional]) specific_arg, study_metadata [] # Given a data_prepare function: my_data <- function(arg_w_default=2){ #... } # Would give rise to the following error: Function (my_data) of type (data_prepare) is supplied arguments it does not expect: study_metadata Supplied arguments: study_metadata Expected arguments: (required, [optional]) [my_def_arg] Either state all supplied args explicitely or use dots (...) as a passthrough (recommended)."},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"evaluation-and-validation-errors","dir":"Articles","previous_headings":"{chef} style debugging","what":"Evaluation and validation errors","title":"Debugging","text":"{chef} built-helpers provide user state pipeline user-supplied function errors-. using helpers, programmer can access workspace (.e., objects functions) point error. can debug interactively like normal R debugging. broad terms {chef} supply user function input parameters lead erroneous evaluation. {chef} supply debugging sessions function crashes function output compliant. (Statistical output, Criterion output) failures evaluation error message contain keyword EVALUATE non-conforming outputs result errors VALIDATE keyword. Sample error messages can seen following.","code":"# Error message wrt. validation Error during evaluation of: log(1) Failed to VALIDATE function output with error: Expected (data.table::data.table) Found: numeric # Error message wrt. evaluation Error during evaluation of: P-interaction Failed to EVALUATE function with error: Error : argument \"cell_index\" is missing, with no default"},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"debugging-session","dir":"Articles","previous_headings":"{chef} style debugging > Evaluation and validation errors","what":"Debugging session:","title":"Debugging","text":"evaluation fails output non-compliant {chef} collect inputs function function write file new environment object. debugging environment written debugging subfolder current working directory .RDS file. problem can investigated using built-function chef::load_debug_session() loading directly session using readRDS().","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"debugging-example","dir":"Articles","previous_headings":"{chef} style debugging > Evaluation and validation errors","what":"Debugging example:","title":"Debugging","text":"example review debugging flow faulty stat method. define endpoint single statistic. setup pipeline described End--End examples. execute pipeline tar_make() can check output messages target run: ▶ indicates starting target evaluation ●, ✖ indicates successful failed evaluation respectably. Console output can see pipeline failed evaluation target-step ep_stat_by_strata_by_trt. Furthermore, can view Last error get meaningful error message. shows failed evaluate function aliased n_sub error message Calculation impossible can inspect problem running suggested command: - chef::load_debug_session('/tmp/RtmpCiXPPf/testproj275bcd76287e8d/debug/n_sub.Rdata') can play around function, given supplied inputs. toy example simply function throws error - simple error fix. However, tool provides possiblity explore tinker functions context fail pipeline. NB. mentioned console message - remember update changes source code!","code":"mk_ep_def <- function() { ep <- chef::mk_endpoint_str( ..., # The rest of the input parameters. stat_by_strata_by_trt = list(\"n_sub\" = n_sub), ) } tar_make() Loading required package: targets ▶ start target ep ● built target ep [0.038 seconds] ▶ start target ep_id ● built target ep_id [0.001 seconds] (...) # We ignore some other upstream target evaluations. ▶ start target ep_stat_by_strata_by_trt ✖ error target ep_stat_by_strata_by_trt ▶ end pipeline [3.556 seconds] Error: Error running targets::tar_make() Error messages: targets::tar_meta(fields = error, complete_only = TRUE) Debugging guide: https://books.ropensci.org/targets/debugging.html How to ask for help: https://books.ropensci.org/targets/help.html Last error: Error during evaluation of: n_sub Failed to EVALUATE function with error: Error in fn_callable[[1]](dat = dat[[1]], treatment_var = treatment_var, : Calculation impossible! --- Debugging session created: Launch with: chef::load_debug_session('/tmp/RtmpCiXPPf/testproj275bcd76287e8d/debug/n_sub.Rdata') ---"},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"targets-style-debugging","dir":"Articles","previous_headings":"","what":"Targets style debugging","title":"Debugging","text":"several approaches debugging pipeline erroring . Find much details targets manual: clean R session, load inputs target producing error via tar_load(names = c( System setup","what":"Updating the workflows","title":"DevOps","text":"workflows updated ramnog repository. workflows consumer repositories simply consume workflows ramnog repository main branch. possible, keep updates workflows within two main workflows (Check Package Release Package). Thus, updates consumer repositories needed. - Remember can use conditions inside workflows run different steps based event-type. Note: testing update may want create new branch ramnog repository update workflows consumer repositories point new branch. allow test changes without affecting main branch.","code":"on: push: branches: [main, stage, dev] pull_request: branches: [main, stage, dev] workflow_dispatch: name: Check Package 📦 jobs: check: name: Checks (from ramnog) uses: hta-pharma/ramnog/.github/workflows/Check-package.yaml@feature/new-workflow # <-- new branch"},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"pre-commit-hooks","dir":"Articles","previous_headings":"","what":"Pre-commit hooks","title":"DevOps","text":"Pre-commit hooks tool allows run set checks code commit . built standard git hooks, easier manage share across projects. pre-commit hooks run every commit. hooks fail, commit aborted. downside need install pre-commit package machine activate given repository. Individual setup pre-commit hooks described pre-commit documentation. Install pre-commit Individual user space (use pip pipx installed) Install pre-commit hooks repository. NOTE: needs run root repository Run files check works: pre-commit hook requires python environment. python installed, can install using conda pyenv. python3 installed get error python available may need specify python3 used. can done either following (asumming linux environment):","code":"pipx install pre-commit pre-commit install pre-commit run --all-files # Create a symlink for python3 in the python bin sudo ln -s /usr/bin/python3 /usr/bin/python # Install the python-is-python3 package sudo apt-get install python-is-python3"},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"usage","dir":"Articles","previous_headings":"Pre-commit hooks","what":"Usage","title":"DevOps","text":"hooks run whenever create commit. hooks fail, commit aborted. hooks automatically fix issues, others report issues. Even hooks automatically fix issues, still need add changes commit commit .","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"system-setup-1","dir":"Articles","previous_headings":"Pre-commit hooks","what":"System setup","title":"DevOps","text":"pre-commits run defined .pre-commit-config.yaml file root repository. file exists repositories ramnog ecosystem. {chef}, {chefStats}, {chefCriteria} pre-commit configs identical points org-hook ramnog. org-hook custom hook defined ramnog repository. hook defined hooks folder ramnog repository. org-hook points script runs pre-commit using standard pre-commit config template. template likewise stored ramnog repository.","code":"repos: - repo: https://github.com/hta-pharma/ramnog rev: v0.1.1 hooks: - id: org-hook - id: org-hook name: org-wide hooks language: script entry: ./run-org-hooks verbose: true require_serial: true repos: - repo: https://github.com/lorenzwalthert/precommit rev: v0.4.0 hooks: - id: readme-rmd-rendered - id: parsable-R - id: no-browser-statement (...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"updating-the-run-hooks","dir":"Articles","previous_headings":"Pre-commit hooks > System setup","what":"Updating the run hooks:","title":"DevOps","text":"order update hooks, need update shared-pre-commit-config.yaml file ramnog repository. Furthemore, hooks consumer repos (chef*) needs updated version hosted ramnog. need either tag ramnog repository following changes update rev chef*/.pre-commit-config.yaml files new tag. Updating rev chef*/.pre-commit-config.yaml file trigger pre-commit hooks update hooks next commit. command pre-commit auto-update can used update consumer hooks. Alternatively can update consumer rev latest commit hash ramnog repository.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_overview.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Endpoint Specification","text":"endpoint specifications comprise central input {chef} contains instructions produce statistics endpoints. specifications contain instructions data use endpoint, statistics include, statistics calculated, group population, criteria must met include endpoint final dossier. specifications must organized data table row contains endpoint specification rows processed independently may represent one endpoints. One single specification may contain instructions produce multiple endpoints e.g. different severity levels system organ classes. result processing endpoint specifications {chef} set statistics, structured long-formatted data table can processed downstream modules e.g. format raw results endpoint tables. scope {chef}. Many components endpoint specifications consist references custom functions outside {chef}, provide high flexibility defining endpoints. endpoint specifications associated custom functions must supplied user inputs {chef} part package. endpoint definition created calling function mk_endpoint_str. endpoint parameters required others optional. Optional parameters default set empty calling mk_endpoint_str, user type endpoint parameters every time required relevant endpoint specification. summary, endpoint specifications can considered cooking recipe along set ingredients (trial data) cooking tools (custom functions) handed chef, {chef}, prepares endpoints. details internal steps {chef} see Getting Started Pipelines.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"ADaM Data","text":"endpoint needs generated single analysis data set containing information one ADaM data sets. analysis data set created custom ADaM function written trial programmer referenced endpoint specification via data_prepare parameter. ADaM function contains instructions ADaM data sets join, join, custom variables e.g., new groupings, create (). three requirements ADaM function: must exactly one input argument study_metadata endpoint specification parameter, preferably 1-element list, contains relevant information study may used read ADaM data sets. information needed, leave study_metadata unused function set empty list() endpoint specification. must return data.table object. work data.table, can converting tibble data.frame object data.table object end function via data.table::.data.table(my_data_frame). returned table must contain ADAM variables (derived variables) mentioned endpoint specification also subject ID variable USUBJID. summary, analysis data set generation controlled following two parameters endpoint specification: data_prepare: Reference custom function returns single consolidated analysis table contains ADaM data needed endpoint. study_metadata: Object containing study specifics relevant reading ADAM data. Must parsed input ADaM ADSL functions. May empty needed.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"ex-1-1","dir":"Articles","previous_headings":"","what":"ADaM Data","title":"ADaM Data","text":"example ADAM function first reads ADSL data table {pharmaverseadam}, filters two treatment arms, enriches derived variable. merges enriched ADSL ADAE {pharmaverseadam} return single table ADaM information ADSL ADAE:","code":"# Example of ADaM function that merges information from ADSL and ADAE mk_adam_ex1_1 <- function(study_metadata) { # Read ADSL from {pharmaverseadam} adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c('Placebo', 'Xanomeline High Dose')] # New derived ADSL variable adsl[, AGEGR2 := data.table::fcase(AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\")] # Read ADAE from {pharmaverseadam} adae <- data.table::as.data.table(pharmaverseadam::adae) # Merge ADSL and ADAE adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F], by = \"USUBJID\", all = TRUE) return(adae_out) }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"ex-1-2","dir":"Articles","previous_headings":"","what":"ADaM Data","title":"ADaM Data","text":"might also cases information several ADAM tables required endpoint. example returns ADaM information example addition baseline body weight extracted ADVS. information three ADaM tables merged returned single analysis data set:","code":"# Example of ADaM function that merges information from three ADaM tables mk_adam_ex1_2 <- function(study_metadata) { # Read ADSL from {pharmaverseadam} adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c('Placebo', 'Xanomeline High Dose')] # New derived ADSL variable adsl[, AGEGR2 := data.table::fcase(AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\")] # Read ADAE from {pharmaverseadam} adae <- data.table::as.data.table(pharmaverseadam::adae) # Read ADVS from {pharmaverseadam} advs <- data.table::as.data.table(pharmaverseadam::advs) # Identify baseline body weight advs_bw <- advs[advs$PARAMCD == \"WEIGHT\" & advs$VISIT == \"BASELINE\"] # Create new variable bw_baseline advs_bw[[\"bw_baseline\"]] <- advs_bw[[\"AVAL\"]] # Merge ADSL, ADAE and baseline body weight from ADVS ax_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F], by = \"USUBJID\", all.x = TRUE) |> merge(x=_, advs_bw[, c(\"bw_baseline\", \"USUBJID\")], by = \"USUBJID\", all.x = TRUE) return(ax_out) }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"ex-1-3","dir":"Articles","previous_headings":"Examples","what":"Ex 1.3","title":"ADaM Data","text":"ADaM functions, defined, need linked corresponding endpoint specifications via data_prepare parameter. creation endpoint specification facilitated mk_endpoint_str function wherein data_prepare parameter established. following example, mk_adam_ex1_2 function utilized produce analysis data intended endpoint.","code":"# Example of endpoint specification of ADaM function. # The dots must be replaced with other required parameters. ep_spec_ex1_3 <- chef::mk_endpoint_str( data_prepare = mk_adam_ex1_2, ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Endpoint Events","text":"Events records analysis data defined ‘positives’ context endpoint. example, adverse events certain type may events one endpoint, demographic endpoint subjects analysis data (comply period filter) events. Since events bounded rows analysis data, entity event fixed. depends analysis data. may e.g. set visits, measurements, subjects. endpoint definition event controlled via following endpoint specification parameters: period_var: Name flag variable analysis data set indicates record contained required time slot event. period_value: value period_var indicates record required time slot. endpoint_filter: optional parameter contains free text endpoint filter adds period filter defined period_var period_value. group_by: optional parameter splits analysis data exclusive groups injected endpoint. adds narrowing endpoint events disregards events outside group specific endpoint. Let us investigate parameters affect set events exposed endpoint. Initially, input data returned data_prepare filtered create analysis data using population filter c.f. Analysis population. Next, endpoint events analysis data identified according filters . Within endpoint , cell statistics also slices analysis data e.g. strata treatment arm combinations. strata work independently event definition, within strata may event non-events. See Strata details. illustrations depict four possible cases combining event specification parameters.   Case : period filter (period_value period_var) applied case analysis data records meet period filter events. Case B: period filter endpoint filter active. Case C: setup case addition endpoint grouping events restricted within group element. case illustrates setup one group levels (group 1). Case D: setup case B addition endpoint grouping events restricted within group element. case illustrates setup one group levels (group 1).","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-1","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"three examples syntax supplying period filter, endpoint filter endpoint grouping, respectively, endpoint specification.","code":"# Example of partial endpoint specification with period filter ep_spec_ex4_1_1 <- chef::mk_endpoint_str( period_var = \"ANL01FL\" period_value = \"Y\", ...) # Example of partial endpoint specification with endpoint filtering ep_spec_ex4_1_2 <- chef::mk_endpoint_str( endpoint_filter = 'ASEV == \"MILD\"', ...) # Example of partial endpoint specification with endpoint grouping ep_spec_ex4_1_3 <- chef::mk_endpoint_str( group_by = list(list(AESEV = c(\"MILD\", \"MODERATE\", \"SERVERE\"))), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-2","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"may also state group levels lazy manner case group levels analysis data set applied. useful group variable many levels e.g., system organ class (SOC), leave certain group levels. example supply lazy grouping SOC.","code":"# Example of partial endpoint specification with lazy endpoint grouping ep_spec_ex4_2 <- chef::mk_endpoint_str( group_by = list(list(AESOC = c())), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-3","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"case want combine groups multiple variables can state dimension grouping group_by parameter. useful e.g., generating endpoint combination adverse event severity SOC exemplified lazy grouping:","code":"# Example of partial endpoint specification with lazy endpoint grouping on multiple variables ep_spec_ex4_3 <- chef::mk_endpoint_str( group_by = list(list(AESEV = c(), AESOC = c())), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-4","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"continuation previews example, interested mild adverse events can replace grouping AESEV endpoint filter filters AESEV.","code":"# Example of partial endpoint specification with endpoint filter and lazy grouping ep_spec_ex4_4 <- chef::mk_endpoint_str( endpoint_filter = 'ASEV == \"MILD\"', group_by = list(list(AESOC = c())), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Endpoint Label","text":"endpoint user option specify label describes content endpoint. parsed string via endpoint_label parameter endpoint specification. string may contain references parameters endpoint specification encapsulated <>. references dynamically evaluated respective values parameters. endpoint label unique endpoint, references optional. Label referencing particularly useful endpoint grouping applied, resolves endpoint group level. case may dynamically refer group level present endpoints. dynamic labeling may also convenient way refer important parameters identifies endpoint e.g., pop_var, period_var endpoint_filter.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"ex-6-1","dir":"Articles","previous_headings":"","what":"Endpoint Label","title":"Endpoint Label","text":"Suppose define endpoint specification endpoint safety analysis population (SAFFL = \"Y\") grouped adverse event severity AESEV three levels: MILD, MODERATE, SERVERE. Note assumes SAFFL AESEV variables analysis data set. setup may specify dynamic endpoint label refer population severity: resolve three endpoints following labels:","code":"# Example of partial endpoint specification of analysis population ep_spec_ex6_1 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", group_by = list(list(AESEV = c())), endpoint_label = \"Example: - adverse events\", ...) \"Example: SAFFL - MILD adverse events\" \"Example: SAFFL - MODERATE adverse events\" \"Example: SAFFL - SERVERE adverse events\""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"ex-6-2","dir":"Articles","previous_headings":"","what":"Endpoint Label","title":"Endpoint Label","text":"extension previous example, suppose want consider subjects ages 18-64 years via age group variable AGEGR1 analysis data set. addition, want update endpoint label refer filter. look like : , resolve three endpoints now endpoint labels:","code":"# Example of partial endpoint specification of analysis population ep_spec_ex6_2 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", endpoint_filter = \"AGEGR1 == '18-64'\", group_by = list(list(AESEV = c())), endpoint_label = \"Example: - adverse events / \", ...) \"Example: SAFFL - MILD adverse events / AGEGR1 == '18-64'\" \"Example: SAFFL - MODERATE adverse events / AGEGR1 == '18-64'\" \"Example: SAFFL - SERVERE adverse events / AGEGR1 == '18-64'\""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"ex-6-3","dir":"Articles","previous_headings":"","what":"Endpoint Label","title":"Endpoint Label","text":"provide references endpoint label, simply returned static string. Hence, modify label previous example follows: get following endpoint labels:","code":"# Example of partial endpoint specification of analysis population ep_spec_ex6_3 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", endpoint_filter = \"AGEGR1 == '18-64'\", group_by = list(list(AESEV = c())), endpoint_label = \"Example of a fixed endpoint label\", ...) \"Example of a fixed endpoint label\" \"Example of a fixed endpoint label\" \"Example of a fixed endpoint label\""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_population_def.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Analysis Population","text":"analysis data constitutes records input data set relevant statistics endpoint. can controlled via following endpoint specification parameters filters analysis data analysis population: pop_var: Name flag variable input data set indicates record eligible analysis endpoint. pop_value: value pop_var indicates record eligible. custom_pop_filter: optional parameter contains free text population filter adds filter formed pop_var pop_value. Recommended ad-hoc testing different sub populations. approach records irrelevant endpoint removed early stage, relevant analysis population exposed statistical functions criteria functions.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_population_def.html","id":"ex-3-1","dir":"Articles","previous_headings":"","what":"Analysis Population","title":"Analysis Population","text":"example specification analysis data using safety population flag (assumed present input data returned data_prepare:","code":"# Example of partial endpoint specification of population filter ep_spec_ex3_1 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_population_def.html","id":"ex-3-2","dir":"Articles","previous_headings":"","what":"Analysis Population","title":"Analysis Population","text":"population may filtered adding custom filter. example, addition population filter example may add custom filter subjects aged least 55 years inlcuded population.","code":"# Example of partial endpoint specification of analysis population ep_spec_ex3_2 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", custom_pop_filter = \"AGE >= 55\", ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Strata","text":"stratify_by endpoint parameter specifies variables analysis data set population sliced endpoint granular comparison treatment arm effects. key properties stratify_by parameter: stratify_by list() object list may empty stratification needed. Regardless whether srtata specified (meet strata criteria c.f. Criteria methods) , endpoint statistics always derived total analysis population endpoint. total can considered special stratum one level. stratum values required stratify_by. relevant statistics applied stratum. strata variables applied independently, .e. strata combined. e.g. stratify age group gender, cross combination SEX=\"F\" & AGEGR=\"<65\". cross combinations two stratum variables B required, either: Create derived variable data_prepare combines B stratify new variable. Use endpoint_filter group_by group filter data stratify B within group level.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"ex-5-1","dir":"Articles","previous_headings":"","what":"Strata","title":"Strata","text":"","code":"# Example of partial endpoint specification with a strata definition ep_spec_ex5_2 <- chef::mk_endpoint_str( stratify_by = list(c(\"SEX\")), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"ex-5-2","dir":"Articles","previous_headings":"","what":"Strata","title":"Strata","text":"Two strata set:","code":"# Example of partial endpoint specification with a strata definition ep_spec_ex5_2 <- chef::mk_endpoint_str( stratify_by = list(c(\"SEX\", \"AGEGGR1\")), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"ex-5-3","dir":"Articles","previous_headings":"","what":"Strata","title":"Strata","text":"strata, case total present endpoint:","code":"# Example of partial endpoint specification with a strata definition ep_spec_ex5_3 <- chef::mk_endpoint_str( stratify_by = list(), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Processing of strata without events","text":"only_strata_with_events endpoint parameter specifies whether endpoint upon completion {chef} framework include strata levels levels contain events. default, levels included endpoint. feature useful cases endpoint specification contains groups strata result many 100s 1000s combinations combinations events interest. case only_strata_with_events set TRUE, may significantly reduce number combinations.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"examples","dir":"Articles","previous_headings":"","what":"Examples","title":"Processing of strata without events","text":"","code":"mk_adae <- function(study_metadata) { adae <- data.table::as.data.table(pharmaverseadam::adae) adsl <- data.table::as.data.table(pharmaverseadam::adsl) adsl[, AGEGR2 := data.table::fcase( AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\" )] adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) adae_out[] }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"ex-7-1","dir":"Articles","previous_headings":"","what":"Processing of strata without events","title":"Processing of strata without events","text":"Let us consider following endpoint specification, mk_adae defined Quick Start, grouping performed SOC (System Organ Class) stratification performed race. default, strata levels included, .e. only_strata_with_events = FALSE. setup note: TRT01A 2 treatment arms analysis data due custom_pop_filter group_by: AESOC 23 levels stratify_by: RACE 4 levels stat_by_strata_by_trt: 2 statistics per combination group level strata level strata implies: TOTAL: 2 treatment arms x 2 statistics = 4 combinations RACE: 2 treatment arms x 3 races x 2 statistics = 12 combinations Thus 23 SOCs x (4 + 12) = 368 combinations, .e. 368 rows output data. Specifically, let us consider SOC “Eye Disorder” print subset output data covers SOC (see ). expected 4 + 12 = 16 rows provided.","code":"ep_spec_ex7_1 <- chef::mk_endpoint_str( data_prepare = mk_adae, study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", custom_pop_filter = \"TRT01A %in% c('Placebo', 'Xanomeline High Dose') & !is.na(AESOC)\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"RACE\")), stat_by_strata_by_trt = list(N = chefStats::n_subj, n = chefStats::n_subj_event), endpoint_label = \"AESOC: \", only_strata_with_events = FALSE ) #> stat_filter #> #> 1: TOTAL_ == \"total\" & TRT01A == \"Placebo\" #> 2: TOTAL_ == \"total\" & TRT01A == \"Placebo\" #> 3: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" #> 4: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" #> 5: RACE == \"WHITE\" & TRT01A == \"Placebo\" #> 6: RACE == \"WHITE\" & TRT01A == \"Placebo\" #> 7: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Placebo\" #> 8: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Placebo\" #> 9: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Placebo\" #> 10: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Placebo\" #> 11: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" #> 12: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" #> 13: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Xanomeline High Dose\" #> 14: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Xanomeline High Dose\" #> 15: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Xanomeline High Dose\" #> 16: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Xanomeline High Dose\" #> fn_name stat_result_value #> #> 1: n 4 #> 2: N 69 #> 3: n 1 #> 4: N 70 #> 5: n 4 #> 6: N 63 #> 7: n 0 #> 8: N 6 #> 9: n 0 #> 10: N 0 #> 11: n 1 #> 12: N 61 #> 13: n 0 #> 14: N 8 #> 15: n 0 #> 16: N 1"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"ex-7-2","dir":"Articles","previous_headings":"","what":"Processing of strata without events","title":"Processing of strata without events","text":"Now suppose interested combinations group levels strata levels example 7.1 events. accomplish may specify only_strata_with_events = TRUE. Now number combination output reduced 256.","code":"ep_spec_ex7_2 <- chef::mk_endpoint_str( data_prepare = mk_adae, study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", custom_pop_filter = \"TRT01A %in% c('Placebo', 'Xanomeline High Dose') & !is.na(AESOC)\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"RACE\")), stat_by_strata_by_trt = list(N = chefStats::n_subj, n = chefStats::n_subj_event), endpoint_label = \"AESOC: \", only_strata_with_events = TRUE ) #> stat_filter fn_name #> #> 1: TOTAL_ == \"total\" & TRT01A == \"Placebo\" n #> 2: TOTAL_ == \"total\" & TRT01A == \"Placebo\" N #> 3: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" n #> 4: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" N #> 5: RACE == \"WHITE\" & TRT01A == \"Placebo\" n #> 6: RACE == \"WHITE\" & TRT01A == \"Placebo\" N #> 7: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" n #> 8: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" N #> stat_result_value #> #> 1: 4 #> 2: 69 #> 3: 1 #> 4: 70 #> 5: 4 #> 6: 63 #> 7: 1 #> 8: 61"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_treatment_arms.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Treatment Arms","text":"treatment arm specifications used split analysis data separate treatment arm assessed compared endpoint. endpoint specification following two parameters must set: treatment_var: Name variable analysis data set contains treatment arms. treatment_refval: value treatment_var corresponds reference/intervention. may used asymmetric statistics compare treatment effects.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_treatment_arms.html","id":"ex-2-1","dir":"Articles","previous_headings":"","what":"Treatment Arms","title":"Treatment Arms","text":"example partial endpoint specification treatment arm specifications:","code":"# Example of endpoint specification of treatment arms. ep_spec_ex2_1 <- chef::mk_endpoint_str( treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"endpoint-types","dir":"Articles","previous_headings":"","what":"Endpoint types","title":"Endpoint Catalog","text":"Binary type 1 Binary type 2 Demographics Continuous outcomes endpoints , note endpoint specification must contain statistics strata treatment arm (N, n, %), strata across treatment arms (RR, , P-value) across strata treatment arms (P-value interaction) must calculated two strata (Age, Sex). statistical functions come library statistical functions {chefStats}. assume endpoint concerns adverse events must applied full safety population set (SAFFL=\"Y\"). also need functions produce clinical data pass data_prepare. Since examlple analyses adverse events, need version ADAE dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example functions : Let us consider different variations endpoint specification cases . examples demonstrate apply statistics either full population, grouping system organ class (SOCs) severity, filtered severity. Note set SOCs trimmed according endpoint criterion function (ep_crit_min_subev_by_trt), SOCs least 5 subjects events least one treatment arm included. criteria function come library criteria functions found {chefCriteria}. get results match table , can group endpoints AESOC, within AESOC grouping, stratify AEDECOD. framing , can see need statistic (n number subjects event E number events) every combination endpoint group (AESOC) stratification level (AEDECOD). statistical functions come chefStats. assume endpoint concerns adverse events must applied full safety population set (SAFFL=\"Y\"). also need functions produce clinical data pass data_prepare. Since examlple analyses adverse events, need version ADAE dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example functions : table contains continuous variables (Age, Body Weight Baseline) categorical variables (Age Group, Sex) different statistics applied. endpoint split two endpoint specifications, one continuous variables (case 5), one categorical variables (case 6). categorical variables (Age Group Sex), see need statistic stratification level category (e.g. AGEGR1 < 65 AGEGR1 >= 65). clear get results need, need one statistic per stratification level treatment level. Thus supply statistical function stat_by_strata_by_trt argument endpoint specification. continuous variables less obvious. However, consider TOTAL stratification just like age sex, albeit single level, can see also need one statistic per strata level treatment level, use stat_by_strata_by_trt cases single statistical function applied, (chefStats::demographics_continuous() chefStats::demographics_categorical() respectively) compactly supplies required statistics one function call. Alternatively, can define separate functions statistics apply individually endpoint specification. also need functions produce clinical data pass data_prepare. Since example analyzes body weight, need version ADVS dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example matches needs analysis: show define demographic endpoints continuous variables categorical variables table contains statistics baseline characteristics, well change--baseline. observe mean SD calculated combination treatment arm, strata (total age), time (baseline, week 8 16). defining time (AVISIT) endpoint grouping can obtain statistics one endpoint specification. implies : mean SD calculated treatment strata levels (stat_by_strata_by_trt) analysis data columns containing baseline (VALUE_BASELINE) change baseline column (VALUE_CHANGE). Number subjects (N) also calculated treatment strata level (stat_by_strata_by_trt). endpoint grouping (AVISIT) Hedge’s G calculated strata level across treatment arms (stat_by_strata_across_trt). also need functions produce clinical data pass data_prepare. Since example analyses laboratory data, need version ADLB dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example matches needs analysis: endpoint specification showing summary statistics baseline change baseline shown ","code":"# Merge ADSL and ADAE from {pharmaverseadam} mk_adae <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADAE adae <- data.table::as.data.table(pharmaverseadam::adae) # Merge ADSL and ADAE adam_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) return(adam_out) } # Merge ADSL and ADAE from {pharmaverseadam} mk_adae <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADAE adae <- data.table::as.data.table(pharmaverseadam::adae) # Merge ADSL and ADAE adam_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) return(adam_out) } ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, pop_var = \"SAFFL\", pop_value = \"Y\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"AEDECOD\")), stat_by_strata_by_trt = list(chefStats::n_subj_event, chefStats::n_event) ) # Merge ADSL and ADVS from {pharmaverseadam} mk_advs <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADVS advs <- data.table::as.data.table(pharmaverseadam::advs) # Identify baseline body weight advs_bw <- advs[advs$PARAMCD == \"WEIGHT\" & advs$VISIT == \"BASELINE\"] # Create new variable BW_BASELINE advs_bw[[\"BW_BASELINE\"]] <- advs_bw[[\"AVAL\"]] # Merge ADSL, ADAE and baseline body weight from ADVS adam_out <- merge(adsl, advs_bw[, c(\"BW_BASELINE\", \"USUBJID\")], by = \"USUBJID\", all.x = TRUE) return(adam_out) } # Merge ADSL and ADLB from {pharmaverseadam} mk_adlb <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADLB adlb_0 <- data.table::as.data.table(pharmaverseadam::adlb) adlb_1 <- adlb_0[adlb_0[[\"PARAMCD\"]] == \"SODIUM\" & adlb_0[[\"AVISIT\"]] %in% c(\"Baseline\", \"Week 8\", \"Week 16\"), ] adlb2 <- merge(adlb_1, adlb_1[adlb_1$AVISIT == \"Baseline\", c(\"USUBJID\", \"AVAL\")], by = \"USUBJID\", all.x = TRUE ) adlb2[[\"VALUE_BASELINE\"]] <- adlb2[[\"AVAL.y\"]] adlb2[[\"VALUE_CHANGE\"]] <- adlb2[[\"AVAL.x\"]] - adlb2[[\"AVAL.y\"]] # Merge ADSL and ADLB adam_out <- merge(adsl, adlb2[, c( \"USUBJID\", \"PARAMCD\", \"AVISIT\", \"VALUE_BASELINE\", \"VALUE_CHANGE\", \"ANL01FL\" )], by = \"USUBJID\", all.x = TRUE) return(adam_out) } chef::mk_endpoint_str( data_prepare = mk_adlb, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_value = \"Y\", group_by = list(list(AVISIT = c())), stratify_by = list(c(\"AGEGR2\")), stat_by_strata_by_trt = list( \"n_sub\" = chefStats::n_subj, \"mean: VALUE_BASELINE\" = c(chefStats::mean_value, var = \"VALUE_BASELINE\"), \"mean: VALUE_CHANGE\" = c(chefStats::mean_value, var = \"VALUE_CHANGE\"), \"sd: VALUE_BASELINE\" = c(chefStats::sd_value, var = \"VALUE_BASELINE\"), \"sd: VALUE_CHANGE\" = c(chefStats::sd_value, var = \"VALUE_CHANGE\") ), stat_by_strata_across_trt = list(hedgesg), endpoint_label = \"Baseline and change from baseline on SODIUM - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-1-adverse-events-base-form","dir":"Articles","previous_headings":"Endpoint types","what":"Case 1: Adverse events (base form)","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), endpoint_label = \"Adverse events - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-2-adverse-events-grouped-by-system-organ-class","dir":"Articles","previous_headings":"Endpoint types","what":"Case 2: Adverse events grouped by system organ class","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), crit_endpoint = list( c( ep_crit_min_subev_by_trt, min_n_subev = 5, requirement_type = \"any\" ) ), endpoint_label = \"Adverse events - - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-3-mild-adverse-events-grouped-by-system-organ-class","dir":"Articles","previous_headings":"Endpoint types","what":"Case 3: Mild adverse events grouped by system organ class","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", endpoint_filter = 'ASEV == \"MILD\"', group_by = list(list(AESOC = c())), stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), crit_endpoint = list( c( ep_crit_min_subev_by_trt, min_n_subev = 5, requirement_type = \"any\" ) ), endpoint_label = \"Mild adverse events - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-4-adverse-events-grouped-by-severity-and-system-organ-class","dir":"Articles","previous_headings":"Endpoint types","what":"Case 4: Adverse events grouped by severity and system organ class","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", group_by = list(list(ASEV = c(), AESOC = c())), stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), crit_endpoint = list( c( ep_crit_min_subev_by_trt, min_n_subev = 5, requirement_type = \"any\" ) ), endpoint_label = \" adverse events - - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-1-baseline-characteristics-of-analysis-population-continuous-variables","dir":"Articles","previous_headings":"Endpoint types","what":"Case 1: Baseline characteristics of analysis population (continuous variables)","title":"Endpoint Catalog","text":"","code":"chef::mk_endpoint_str( data_prepare = mk_advs, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", stat_by_strata_by_trt = list( c(demographics_continuous, var = \"AGE\" ), c(demographics_continuous, var = \"BW_BASELINE\" ) ), endpoint_label = \"Demographics endpoint (categorical measures)\" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-2-baseline-characteristics-of-analysis-population-categorical-variables","dir":"Articles","previous_headings":"Endpoint types","what":"Case 2: Baseline characteristics of analysis population (categorical variables)","title":"Endpoint Catalog","text":"collect two endpoint specifications cover complete endpoint:","code":"chef::mk_endpoint_str( data_prepare = mk_advs, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list(c(demographics_counts)), endpoint_label = \"Demographics endpoint (categorical measures)\" ) ep_spec <- rbind(ep_spec_pt1, ep_spec_pt2)"},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Criteria Methods","text":"vignette provides short introduction idea analysis criteria. analysis request authorities detail overall set endpoints, irrespective underlying study data. example, might request analysis serious adverse events system organ class, gender. analyses may contain many cells zeros, low counts. ensure analyses contain meaningfully amounts data included, request may additionally include certain criteria inclusion analysis, threshold minimum number records, events, subjects. logic analysis inclusion criteria handled functions supplied crit_endpoint, crit_by_strata_by_trt, crit_by_strata_across_trt arguments defining endpoint mk_endpoints_str().","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"criteria-levels","dir":"Articles","previous_headings":"","what":"Criteria levels","title":"Criteria Methods","text":"Currently, {chef} supports analysis inclusion criteria three parts analysis output, colors corresponding figure : entire endpoint stat_by_strata_by_trt stat_by_strata_across_trt stat_across_strata_across_trt criteria functions hierarchical; failure meet criteria Level (Entire Endpoint) implies automatic failure Levels B C. Similarly, passing Level failing Level B results failure Level C. endpoint satisfy certain criterion, associated statistical functions execute reduce compute time. instance, endpoint meet criteria Level B, strata across treatment arms analyses performed. However, analyses Totals still proceed. important note criteria optional. every endpoint definition needs incorporate three levels criteria. analyses may criteria, others might require criteria endpoint strata. NOTE crit_by_strata_across_trt criterion gate-keep stat_by_strata_across_trt stat_across_strata_across_trt (stippled box). stat_across_strata_across_trt seen lower hierarchical criteria ladder stat_by_strata_across_trt - however seperate criterion time therefore included default.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"function-formals","dir":"Articles","previous_headings":"","what":"Function formals","title":"Criteria Methods","text":"Chef supplies number parameters criterion functions. parameters vary according statistical method. Note crit_by_strata_by_trt, crit_by_strata_across_trt formals functions identical.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"input-specifications","dir":"Articles","previous_headings":"Function formals","what":"Input specifications","title":"Criteria Methods","text":"criteria functions served broad set parameters. reflects need flexibility criteria functions. flexibility allows set criteria affect specific stratum based specific stratum information shared across multiple strata. allows create criteria functions target one stratum act across whole strata: Criteria1 requires endpoint strata GENDER must balanced. (ie approx 50/50 distribution.) (requires stratify_by parameter) Criteria2 requires endpoint strata (GENDER, AGE) must balanced. (requires stratify_by parameter) may also also design criteria endpoints, includes case enough subjects relevant strata. See Examples NB Similar stat methods require criteria function include ellipses (...) wildcard parameter. convenience, since need explicitly state used parameters function definition. However, importantly ensure criteria function define today also work tomorrow, {chef} may supply parameters criteria functions. Endpoint criteria functions Strata criteria functions","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"output-specifications","dir":"Articles","previous_headings":"Function formals","what":"Output specifications","title":"Criteria Methods","text":"output criteria function must simple boolean (TRUE FALSE)","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"example-functions","dir":"Articles","previous_headings":"Function formals","what":"Example functions","title":"Criteria Methods","text":"two examples showcasing write criteria functions. within scope {chef} package provide library criteria functions. Endpoint criteria functions Strata criteria functions Generic criteria function: Allows control endpoint inclusion based count subjects events arms. function generic can specified mk_endpoint_str curried beforehand (Stat methods-Currying) include across strata treatment arm analysis least X subjects events treatment arm. requirement_type==“” just single cell (stratum + treatment arm) needs included.","code":"ep_criteria.treatment_arms_minimum_unique_event_count <- function( dat, event_index, treatment_var, subjectid_var, minimum_event_count, requirement_type = c(\"any\", \"all\") ... ) # rows with events dat_events <- dat[J(event_index),] # Bolean of whether the count of unique subjects # within each treatment arm is above the minimum count. dat_lvl_above_threshold <- dat_events[ , list(\"is_above_minimum\" = data.table::uniqueN(subjectid_var)>=minimum_event_count), by=treatment_var ] if requirement_type == \"any\": return( any(dat_lvl_above_threshold$V1) ) return( all(dat_lvl_above_threshold$V1) ) ep_strata_criteria.strata_treatment_arm_minimum_unique_count <- function( dat, event_index, treatment_var, subjectid_var, strata_var, minimum_event_count, requirement_type = c(\"any\", \"all\") ... ) # rows with events dat_events <- dat[J(event_index),] # Bolean of whether the count of unique subjects # within each treatment arm is above the minimum count. dat_lvl_above_threshold <- dat_events[ , list(\"is_above_minimum\" = data.table::uniqueN(subjectid_var)>=minimum_event_count), by=c(treatment_var, strata_var) ] if requirement_type == \"any\": return( any(dat_lvl_above_threshold$is_above_minimum) ) return( all(dat_lvl_above_threshold$is_above_minimum) )"},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"applying-criteria-functions","dir":"Articles","previous_headings":"Function formals","what":"Applying criteria functions","title":"Criteria Methods","text":"Criteria functions supplied mk_endpoint_str function used gatekeep statistical function run. example endpoint : look population event E_XYZ. interested endpoint see least 5 subjects arms event E_XYZ. interested getting descriptive statistic strata (say GENDER, AGEGRP) levels within least 1 subject. Finally, run across treatment arm statistics least 5 subject stratum treatment arm. requirements/gates implemented currying functions given Examples section.","code":"# R/project_criteria.R # Curry the general criteria functions from [Examples](#examples) crit_accept_endpoint.5_subjects_any_treatment_arm <- purrr:partial( ep_criteria.treatment_arms_minimum_unique_event_count, minimum_event_count = 5, requirement_type = \"any\" ) crit_strata.1_subject_all_treatment_strata <- purrr:partial( ep_sg_criteria.sg_treatment_arm_minimum_unique_count, minimum_event_count = 1, requirement_type = \"all\" ) crit_strata.5_subject_all_treatment_strata <- purrr:partial( ep_sg_criteria.sg_treatment_arm_minimum_unique_count, minimum_event_count = 5, requirement_type = \"all\" ) # R/project_endpoints.R endpoint_XYZ <- chef::mk_endpoint_str( ..., # Setting the rest of the inputs crit_endpoint = list(crit_accept_endpoint.5_subjects_any_treatment_arm), crit_by_strata_by_trt = list(crit_strata.1_subject_all_treatment_strata), crit_by_strata_across_trt = list(crit_strata.5_subject_all_treatment_strata) )"},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_stat.html","id":"statistical-method-types","dir":"Articles","previous_headings":"","what":"Statistical method types","title":"Statistical Methods","text":"{chef} framework categorizes statistical functions three main categories depending operate stratification levels treatment levels. Operations can either done per stratification level treatment level, can operate across levels. Figure 1 shows typical table safety analysis color codes result based function type creates : Figure 1 Table 1 provides description three function types, color coded outputs produce table 1 : Table 1 function type also determines function applied. example figure 1, stat_by_strata_by_trt function called combination stratification level treatment level, well TOTALS treatment level: SEX == “MALE” & TRT == “TreatmentA” SEX == “FEMALE” & TRT == “TreatmentA” SEX == “MALE” & TRT == “TreatmentB” SEX == “FEMALE” & TRT == “TreatmentB” AGE == “<65” & TRT == “TreatmentA” AGE == “>=65” & TRT == “TreatmentA” AGE == “<65” & TRT == “TreatmentB” AGE == “>=65” & TRT == “TreatmentB” TOTAL_ == “total” & TRT == “TreatmentA” TOTAL_ == “total” & TRT == “TreatmentB” Whereas stat_across_strata_across_trt called per stratification “group”, .e.: strata_var == “SEX” strata_var == “AGE”","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_stat.html","id":"project-specific-statistical-functions","dir":"Articles","previous_headings":"","what":"Project-specific statistical functions","title":"Statistical Methods","text":"need statistical function exist {chefStats}, writing adding chefStats package, way can used others - please see documentation chefStats package details. sometimes might make sense. case can always reference custom function endpoint specification stored R/ directory project folder. example want new function my_custom_stats_function type stat_by_strata_by_trt . first define function: ’s save R/, can reference endpoint specification just like chefStats functions: Important: custom function relies external packages, need add packages packages.R file R/.","code":"my_custom_function <- function( # function arguments here ){ # Function does something here } chef::mk_endpoint_str( ..., # other arguments to mk_endpoint_str stat_by_strata_by_trt = my_custom_function)"},{"path":"https://hta-pharma.github.io/ramnog/articles/qc.html","id":"unit-testing","dir":"Articles","previous_headings":"","what":"Unit testing","title":"Quality control for ramnog ecosystem","text":"package contains unit tests functionality package responsible . means, example, responsibility unit-tests {chefStats} ensure statistical functions written chefStats produce result supposed produce.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/qc.html","id":"integration-testing","dir":"Articles","previous_headings":"","what":"Integration testing","title":"Quality control for ramnog ecosystem","text":"Integration testing verifies framework produces expected results integration testing done via {testthat} framework, essentially unit-tests cover many different units goal compare results analysis run via ramnog expected results done manual calculation analysis. example, unit test ensure results endpoint definition defined run via chef match calculated manually","code":"testthat::test_that(\"Valide stats when one strata level is not found\", { # SETUP ------------------------------------------------------------------- testr::create_local_project() mk_adae <- function(study_metadata) { adsl <- pharmaverseadam::adsl |> data.table::setDT() adae <- pharmaverseadam::adae |> data.table::setDT() adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F], by = \"USUBJID\", all = TRUE) adae_out[TRT01A %in% c('Placebo', 'Xanomeline High Dose'),] } mk_ep_def <- function() { chef::mk_endpoint_str( study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", stratify_by = list(c(\"SEX\")), data_prepare = mk_adae, endpoint_label = \"A\", custom_pop_filter = \"SEX == 'F'\", group_by = list(list(AESEV = c())), stat_by_strata_by_trt = list( \"N\" = chefStats::n_subj, \"E\" = chefStats::n_event, \"N subj E\" = chefStats::n_subj_event ), stat_by_strata_across_trt = list(\"RR\" = chefStats::RR, \"OR\" = chefStats::OR), stat_across_strata_across_trt = list(\"P-interaction\" = chefStats::p_val_interaction) ) } chef::use_chef( pipeline_dir = \"pipeline\", r_functions_dir = \"R/\", pipeline_id = \"01\", mk_endpoint_def_fn = mk_ep_def, mk_adam_fn = list(mk_adae) ) # ACT --------------------------------------------------------------------- targets::tar_make() targets::tar_load(ep_stat) # EXPECT ------------------------------------------------------------------ # Manually calculated expected results x <- mk_adae(study_metadata = NULL) # Relative Risk actual <- ep_stat[endpoint_group_filter == \"AESEV == \\\"SEVERE\\\"\" & fn_name == \"RR\" & stat_filter == \"SEX == \\\"F\\\"\" & stat_result_label == \"RR\", stat_result_value] x1 <- x[SEX == \"F\" & SAFFL == \"Y\"] x1[, event := FALSE] x1[AESEV == \"SEVERE\", event := TRUE] |> data.table::setorder(-event) x1_unique <- unique(x1, by = \"USUBJID\", fromLast = FALSE) two_by_two <- x1_unique[, .N, by = .(TRT01A, event)][order(TRT01A, event)] # Outcome, exposed a <- two_by_two[TRT01A == \"Xanomeline High Dose\" & (event), N] # No outcome, exposed b <- two_by_two[TRT01A == \"Xanomeline High Dose\" & !(event), N] # Outcome, not exposed c <- two_by_two[TRT01A == \"Placebo\" & (event), N] # No outcome, not exposed d <- two_by_two[TRT01A == \"Placebo\" & !(event), N] expected <- (a / sum(a, b)) / (c / sum(c, d)) expect_identical(actual, expected) # Number of Events actual <- ep_stat[endpoint_group_filter == \"AESEV == \\\"SEVERE\\\"\" & fn_name == \"E\" & strata_var == \"SEX\"] expected <- x1[(event), .N, by = .(TRT01A)][order(TRT01A)][, as.double(N)] expect_identical(actual$stat_result_value, expected) }) #> v Setting active project to '/tmp/Rtmp2mVPdU/testproj1ca0561a9d83' #> v Writing 'R/packages.R' #> v Writing 'pipeline/pipeline_01.R' #> * Edit 'pipeline/pipeline_01.R' #> * Edit 'R/mk_adae.R' #> i Renaming \"mk_ep_def\" to \"mk_endpoint_def.R\" #> #> * Edit 'R/mk_endpoint_def.R' #> Loading required package: targets #> ▶ dispatched target ep #> ● completed target ep [0.031 seconds] #> ▶ dispatched target ep_id #> ● completed target ep_id [0.01 seconds] #> ▶ dispatched branch ep_fn_map_a9f94f07 #> ● completed branch ep_fn_map_a9f94f07 [0.029 seconds] #> ● completed pattern ep_fn_map #> ▶ dispatched target user_def_fn #> ● completed target user_def_fn [0.004 seconds] #> ▶ dispatched target study_data #> ● completed target study_data [0.04 seconds] #> ▶ dispatched target fn_map_tibble #> ● completed target fn_map_tibble [0.005 seconds] #> ▶ dispatched branch ep_and_data_a9f94f07 #> ● completed branch ep_and_data_a9f94f07 [0.009 seconds] #> ● completed pattern ep_and_data #> ▶ dispatched branch fn_map_3a0d9b8d #> ● completed branch fn_map_3a0d9b8d [0.001 seconds] #> ● completed pattern fn_map #> ▶ dispatched branch analysis_data_container_5d792ea5 #> ● completed branch analysis_data_container_5d792ea5 [0 seconds] #> ● completed pattern analysis_data_container #> ▶ dispatched branch ep_with_data_key_5d792ea5 #> ● completed branch ep_with_data_key_5d792ea5 [0 seconds] #> ● completed pattern ep_with_data_key #> ▶ dispatched branch ep_expanded_0ccac0a6 #> ● completed branch ep_expanded_0ccac0a6 [0.043 seconds] #> ● completed pattern ep_expanded #> ▶ dispatched branch ep_event_index_74b91187 #> ● completed branch ep_event_index_74b91187 [0.006 seconds] #> ● completed pattern ep_event_index #> ▶ dispatched branch ep_crit_endpoint_191245c4 #> ● completed branch ep_crit_endpoint_191245c4 [0.003 seconds] #> ● completed pattern ep_crit_endpoint #> ▶ dispatched branch ep_crit_by_strata_by_trt_de417ba1 #> ● completed branch ep_crit_by_strata_by_trt_de417ba1 [0.009 seconds] #> ● completed pattern ep_crit_by_strata_by_trt #> ▶ dispatched branch ep_crit_by_strata_across_trt_45e05d00 #> ● completed branch ep_crit_by_strata_across_trt_45e05d00 [0.004 seconds] #> ● completed pattern ep_crit_by_strata_across_trt #> ▶ dispatched branch ep_prep_by_strata_across_trt_fbfeb90e #> ● completed branch ep_prep_by_strata_across_trt_fbfeb90e [0.042 seconds] #> ● completed pattern ep_prep_by_strata_across_trt #> ▶ dispatched branch ep_prep_across_strata_across_trt_fbfeb90e #> ● completed branch ep_prep_across_strata_across_trt_fbfeb90e [0.014 seconds] #> ● completed pattern ep_prep_across_strata_across_trt #> ▶ dispatched branch ep_prep_by_strata_by_trt_fbfeb90e #> ● completed branch ep_prep_by_strata_by_trt_fbfeb90e [0.075 seconds] #> ● completed pattern ep_prep_by_strata_by_trt #> ▶ dispatched target ep_rejected #> ● completed target ep_rejected [0 seconds] #> ▶ dispatched branch ep_stat_by_strata_across_trt_c5b9f3c4 #> ● completed branch ep_stat_by_strata_across_trt_c5b9f3c4 [0.141 seconds] #> ● completed pattern ep_stat_by_strata_across_trt #> ▶ dispatched branch ep_stat_across_strata_across_trt_c2630227 #> ● completed branch ep_stat_across_strata_across_trt_c2630227 [0.033 seconds] #> ● completed pattern ep_stat_across_strata_across_trt #> ▶ dispatched branch ep_stat_by_strata_by_trt_b1e90d49 #> ● completed branch ep_stat_by_strata_by_trt_b1e90d49 [0.042 seconds] #> ● completed pattern ep_stat_by_strata_by_trt #> ▶ dispatched target ep_stat_nested #> ● completed target ep_stat_nested [0 seconds] #> ▶ dispatched target ep_stat #> ● completed target ep_stat [0.013 seconds] #> ▶ ended pipeline [0.88 seconds] #> v Restoring original working directory: '/home/runner/work/ramnog/ramnog/vignettes/' #> v Setting active project to '' #> v Deleting temporary project: '/tmp/Rtmp2mVPdU/testproj1ca0561a9d83/' #> Test passed"},{"path":"https://hta-pharma.github.io/ramnog/articles/qc.html","id":"cicd","dir":"Articles","previous_headings":"","what":"CI/CD","title":"Quality control for ramnog ecosystem","text":"Please see DevOps vignette details CI/CD infrastructure.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"set-up-project-infrastructure","dir":"Articles","previous_headings":"","what":"1. Set up project infrastructure","title":"Quick Start","text":"assumes set RStudio project (equivalent). done , first. setup chef project need: functions used make ADaM data ingested chef pipeline R function produces endpoint specification object analysis/statistical functions sourced R packages (like chefStats chefCriteria) script containing library() calls package needed pipeline run pipeline/ directory targets pipeline(s) /defined targets.yml file tracking different pipelines file file structure look like : {chef} convenience function set infrastructure : sets following file structure: now need know file R/ . _targets.yml pipeline_01.R explanation, see vignette(\"pipeline\").","code":"/ |-- R/ |--- mk_endpoint_definition.R |--- mk_adam.R |--- packages.R |-- pipeline/ |--- pipeline_01.R |-- _targets.yaml library(chef) chef::use_chef( pipeline_id = \"01\" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"specify-an-endpoint","dir":"Articles","previous_headings":"","what":"1. Specify an endpoint","title":"Quick Start","text":"Endpoint specifications need created inside function, case function defined mk_endpoint_definition.R endpoint created using chef::mk_endpoint_str() function. explanation specify endpoints, see vignette(\"endpoint_definitions\"). specify minimal working endpoint based adae dataset supplied {pharmaverseadam}. modifying R/mk_endpoint_definition.R file looks like : might notice couple things specification: stratify_by field refer variable called AGEGR2, however ADAE dataset {pharmaverseadam} contain variable. derive variable inside mk_adae (see next section).","code":"mk_endpoint_def <- function() { chef::mk_endpoint_str( study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", stratify_by = list(c(\"AGEGR2\")), data_prepare = mk_adae, endpoint_label = \"A\", custom_pop_filter = \"TRT01A %in% c('Placebo', 'Xanomeline High Dose')\", stat_by_strata_by_trt = list(\"N_subj_event\" = c(chefStats::n_subj_event)) ) }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"define-the-input-dataset","dir":"Articles","previous_headings":"","what":"2. Define the input dataset","title":"Quick Start","text":"also need provide chef ADAE input data set corresponds endpoint specified . read make data sets, see vignette(\"mk_adam\"). can see strata based AGEGR2, can derived AGE variable ADSL. now, write simple ADaM function mk_adae merges ADSL data set (enriched AGEGR2) onto ADAE data set, thereby creating input data set.","code":"mk_adae <- function(study_metadata) { adae <- data.table::as.data.table(pharmaverseadam::adae) adsl <- data.table::as.data.table(pharmaverseadam::adsl) adsl[, AGEGR2 := data.table::fcase( AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\" )] adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) adae_out[] }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"define-the-analysis-methods","dir":"Articles","previous_headings":"","what":"3. Define the analysis methods","title":"Quick Start","text":"Now specified endpoint analyzed, defined analysis data set {chef}, need define analysis . goal analysis count number events experiencing event. need define function makes calculations, give function chef. want result per treatment arm - strata combination, must provide function stat_by_strata_by_trt argument endpoint specification. already argument set chefStats::n_subj_event example endpoint specification ","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"run-the-analysis-pipeline","dir":"Articles","previous_headings":"","what":"4. Run the analysis pipeline","title":"Quick Start","text":"Now inputs defined, can run pipeline. achieved call tar_make() {targets} package. Targets show steps pipeline executed long step took: , see results, load cached step pipeline corresponding results. case ep_stat, load sessions object call Now ep_stat R object like . Thus can look results simply running However, lot extra data included object, lets look column subsection first 5 rows:","code":"targets::tar_make() ## Loading required package: targets ## ▶ dispatched target ep ## ● completed target ep [0.031 seconds] ## ▶ dispatched target ep_id ## ● completed target ep_id [0.01 seconds] ## ▶ dispatched branch ep_fn_map_c85cfecb ## ● completed branch ep_fn_map_c85cfecb [0.029 seconds] ## ● completed pattern ep_fn_map ## ▶ dispatched target user_def_fn ## ● completed target user_def_fn [0.003 seconds] ## ▶ dispatched target study_data ## ● completed target study_data [0.043 seconds] ## ▶ dispatched target fn_map_tibble ## ● completed target fn_map_tibble [0.005 seconds] ## ▶ dispatched branch ep_and_data_c85cfecb ## ● completed branch ep_and_data_c85cfecb [0.009 seconds] ## ● completed pattern ep_and_data ## ▶ dispatched branch fn_map_9cf81814 ## ● completed branch fn_map_9cf81814 [0 seconds] ## ● completed pattern fn_map ## ▶ dispatched branch analysis_data_container_a4b422b1 ## ● completed branch analysis_data_container_a4b422b1 [0.001 seconds] ## ● completed pattern analysis_data_container ## ▶ dispatched branch ep_with_data_key_a4b422b1 ## ● completed branch ep_with_data_key_a4b422b1 [0 seconds] ## ● completed pattern ep_with_data_key ## ▶ dispatched branch ep_expanded_e741f3f8 ## ● completed branch ep_expanded_e741f3f8 [0.025 seconds] ## ● completed pattern ep_expanded ## ▶ dispatched branch ep_event_index_5f7976c8 ## ● completed branch ep_event_index_5f7976c8 [0.003 seconds] ## ● completed pattern ep_event_index ## ▶ dispatched branch ep_crit_endpoint_3da7fd1e ## ● completed branch ep_crit_endpoint_3da7fd1e [0.003 seconds] ## ● completed pattern ep_crit_endpoint ## ▶ dispatched branch ep_crit_by_strata_by_trt_1786b781 ## ● completed branch ep_crit_by_strata_by_trt_1786b781 [0.008 seconds] ## ● completed pattern ep_crit_by_strata_by_trt ## ▶ dispatched branch ep_crit_by_strata_across_trt_6a441418 ## ● completed branch ep_crit_by_strata_across_trt_6a441418 [0.004 seconds] ## ● completed pattern ep_crit_by_strata_across_trt ## ▶ dispatched branch ep_prep_by_strata_across_trt_89480a2b ## ● completed branch ep_prep_by_strata_across_trt_89480a2b [0.002 seconds] ## ● completed pattern ep_prep_by_strata_across_trt ## ▶ dispatched branch ep_prep_across_strata_across_trt_89480a2b ## ● completed branch ep_prep_across_strata_across_trt_89480a2b [0.001 seconds] ## ● completed pattern ep_prep_across_strata_across_trt ## ▶ dispatched branch ep_prep_by_strata_by_trt_89480a2b ## ● completed branch ep_prep_by_strata_by_trt_89480a2b [0.033 seconds] ## ● completed pattern ep_prep_by_strata_by_trt ## ▶ dispatched target ep_rejected ## ● completed target ep_rejected [0 seconds] ## ▶ dispatched branch ep_stat_by_strata_across_trt_a72d712a ## ● completed branch ep_stat_by_strata_across_trt_a72d712a [0 seconds] ## ● completed pattern ep_stat_by_strata_across_trt ## ▶ dispatched branch ep_stat_across_strata_across_trt_b2713725 ## ● completed branch ep_stat_across_strata_across_trt_b2713725 [0.001 seconds] ## ● completed pattern ep_stat_across_strata_across_trt ## ▶ dispatched branch ep_stat_by_strata_by_trt_9535dd36 ## ● completed branch ep_stat_by_strata_by_trt_9535dd36 [0.011 seconds] ## ● completed pattern ep_stat_by_strata_by_trt ## ▶ dispatched target ep_stat_nested ## ● completed target ep_stat_nested [0 seconds] ## ▶ dispatched target ep_stat ## ● completed target ep_stat [0.004 seconds] ## ▶ ended pipeline [0.525 seconds] ## targets::tar_load(ep_stat) ep_stat ep_stat[, .( treatment_var, treatment_refval, strata_var, stat_filter, stat_result_label, stat_result_description, stat_result_qualifiers, stat_result_value )] |> head() ## treatment_var treatment_refval strata_var ## ## 1: TRT01A Xanomeline High Dose TOTAL_ ## 2: TRT01A Xanomeline High Dose TOTAL_ ## 3: TRT01A Xanomeline High Dose AGEGR2 ## 4: TRT01A Xanomeline High Dose AGEGR2 ## 5: TRT01A Xanomeline High Dose AGEGR2 ## 6: TRT01A Xanomeline High Dose AGEGR2 ## stat_filter stat_result_label ## ## 1: TOTAL_ == \"total\" & TRT01A == \"Placebo\" n ## 2: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" n ## 3: AGEGR2 == \"AGE < 70\" & TRT01A == \"Placebo\" n ## 4: AGEGR2 == \"AGE >= 70\" & TRT01A == \"Placebo\" n ## 5: AGEGR2 == \"AGE < 70\" & TRT01A == \"Xanomeline High Dose\" n ## 6: AGEGR2 == \"AGE >= 70\" & TRT01A == \"Xanomeline High Dose\" n ## stat_result_description stat_result_qualifiers stat_result_value ## ## 1: Number of subjects with events 86 ## 2: Number of subjects with events 72 ## 3: Number of subjects with events 22 ## 4: Number of subjects with events 64 ## 5: Number of subjects with events 18 ## 6: Number of subjects with events 54"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"pass-the-data-on-to-tfl-formatting","dir":"Articles","previous_headings":"","what":"5. Pass the data on to TFL formatting","title":"Quick Start","text":"Now data produced, can pass TFL formatting (outside scope {chef}).","code":""},{"path":"https://hta-pharma.github.io/ramnog/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Matthew David Phelps. Author. Nicolai Skov Johnsen. Author. Henrik Sparre Spiegelhauer. Author. Christian Haargaard Olsen. Author, maintainer.","code":""},{"path":"https://hta-pharma.github.io/ramnog/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Matthew David Phelps, Nicolai Skov Johnsen, Henrik Sparre Spiegelhauer, Christian Haargaard Olsen (2024). ramnog: Facilitating AMNOG style analysis pipelines. R package version 0.1.2, https://github.com/hta-pharma/ramnog, https://app.codecov.io/gh/hta-pharma/ramnog, https://hta-pharma.github.io/ramnog/.","code":"@Manual{, title = {ramnog: Facilitating AMNOG style analysis pipelines}, author = {{Matthew David Phelps} and {Nicolai Skov Johnsen} and {Henrik Sparre Spiegelhauer} and {Christian Haargaard Olsen}}, year = {2024}, note = {R package version 0.1.2, https://github.com/hta-pharma/ramnog, https://app.codecov.io/gh/hta-pharma/ramnog}, url = {https://hta-pharma.github.io/ramnog/}, }"},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"r-packages-for-amnog-analyses-","dir":"","previous_headings":"","what":"R packages for AMNOG analyses","title":"Facilitating AMNOG style analysis pipelines","text":"Ramnog collection packages setting pipelines AMNOG-style HTA analyses aim ramnog statistician/programmer can set AMNOG-type analyses minimal familiarity R. get started, check Quick Start guide","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"aim","dir":"","previous_headings":"","what":"Aim","title":"Facilitating AMNOG style analysis pipelines","text":"aim {ramnog} programmer write minimal code, programming, set-new AMNOG-type analyses. study, programmer need make, adjust, check following four types code: definition endpoint (group endpoints). set ADaM functions makes modifications existing ADaM datasets (e.g., new age grouping ADSL), makes new ADaM datasets none exist required output. (needed) Define set criteria endpoint included results. library criteria stored companion package {chefCriteria}. specification statistical functions used summarize/analyze data. library functions provided {chefStats} package. core principal frameworks design modularity. core functionality framework resides {chef} change slowly, functionality subject frequent changes sectioned packages ({chefStats} {chefCriteria}).","code":""},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Facilitating AMNOG style analysis pipelines","text":"welcome contributions code base. Please see contributing vignette information contribute.","code":""},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Facilitating AMNOG style analysis pipelines","text":"packages available install GitHub:","code":"remotes::install_github(\"hta-pharma/ramnog\")"},{"path":"https://hta-pharma.github.io/ramnog/reference/dummy_fn.html","id":null,"dir":"Reference","previous_headings":"","what":"Title — dummy_fn","title":"Title — dummy_fn","text":"exists import data.table","code":""},{"path":"https://hta-pharma.github.io/ramnog/reference/dummy_fn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Title — dummy_fn","text":"","code":"dummy_fn()"},{"path":"https://hta-pharma.github.io/ramnog/reference/dummy_fn.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Title — dummy_fn","text":"Nothing.","code":""}] +[{"path":"https://hta-pharma.github.io/ramnog/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Novo Nordisk /S, Danish company registration . 24256790 Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"context---why-debugging-is-different","dir":"Articles","previous_headings":"","what":"Context - why debugging is different","title":"Debugging","text":"{chef} pipeline, execution environment managed {targets}, take place working environment. side-effect, straightforward reproduce errors trace back source. Specifically: target {targets} pipeline run new R session closes upon completion hitting error. means working environment clean every run, beneficial reproducibility can make harder debug state led error might readily accessible. {targets} uses caching mechanism avoid re-running successful tasks. feature enhances efficiency, can make debugging tricky. Understanding whether bug due current code cached results might straightforward Sometimes, error messages {targets} pipeline can cryptic informative, making harder figure ’s going wrong. Debugging often requires interactively running code inspect objects states. However, {targets} designed non-interactive batch (sometimes parallel) execution, can make interactive debugging less straightforward. example, just insert browser() function errored like interactive debugging.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"chef-style-debugging","dir":"Articles","previous_headings":"","what":"{chef} style debugging","title":"Debugging","text":"common errors due errors stemming improper user inputs (e.g. user-supplied functions generate input ADaM datasets, contain statistical methods). debug , easiest programmer access state program time errored-. Errors stemming user function split two types: Firstly, relating function formals specifically whether function inputs match supplied {chef}. Secondly, errors arise evaluation function validation output. errors can come bug functions causing crashing runtime, functions return invalid output.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"input-errors","dir":"Articles","previous_headings":"{chef} style debugging","what":"Input errors","title":"Debugging","text":"Input errors stems mismatch expected arguments function arguments {chef} supplies. Errors domain stem improperly defined statistical functions instance statistical functions applied wrong statistical types endpoint specification. function user can define {chef} supplies predefined set arguments (data, statistics, criteria). arguments always supplied, function must either exhaustive function definition, recommended include dots (…) function definition allow functions ignore arguments, required specific function.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"examples","dir":"Articles","previous_headings":"{chef} style debugging > Input errors","what":"Examples:","title":"Debugging","text":"-defined function function require arguments supplied. example, expect---supplied argument specific_arg clearly described well arguments {chef} supplies (study_metadata) full function argument specification. -defined function function explicitly require supplied arguments also doesn’t dots (…) included catch surplus arguments. -defined example function expect supplied study_metadata argument. example also shows optional arguments (default values) displayed.","code":"# Given a data_prepare function: my_data <- function(study_metadata, specific_arg){ #... } # Would give rise to the following error: Function (my_data) of type (data_prepare) expects argument(s) which is not supplied: specific_arg Supplied arguments: study_metadata Expected arguments: (required, [optional]) specific_arg, study_metadata [] # Given a data_prepare function: my_data <- function(arg_w_default=2){ #... } # Would give rise to the following error: Function (my_data) of type (data_prepare) is supplied arguments it does not expect: study_metadata Supplied arguments: study_metadata Expected arguments: (required, [optional]) [my_def_arg] Either state all supplied args explicitely or use dots (...) as a passthrough (recommended)."},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"evaluation-and-validation-errors","dir":"Articles","previous_headings":"{chef} style debugging","what":"Evaluation and validation errors","title":"Debugging","text":"{chef} built-helpers provide user state pipeline user-supplied function errors-. using helpers, programmer can access workspace (.e., objects functions) point error. can debug interactively like normal R debugging. broad terms {chef} supply user function input parameters lead erroneous evaluation. {chef} supply debugging sessions function crashes function output compliant. (Statistical output, Criterion output) failures evaluation error message contain keyword EVALUATE non-conforming outputs result errors VALIDATE keyword. Sample error messages can seen following.","code":"# Error message wrt. validation Error during evaluation of: log(1) Failed to VALIDATE function output with error: Expected (data.table::data.table) Found: numeric # Error message wrt. evaluation Error during evaluation of: P-interaction Failed to EVALUATE function with error: Error : argument \"cell_index\" is missing, with no default"},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"debugging-session","dir":"Articles","previous_headings":"{chef} style debugging > Evaluation and validation errors","what":"Debugging session:","title":"Debugging","text":"evaluation fails output non-compliant {chef} collect inputs function function write file new environment object. debugging environment written debugging subfolder current working directory .RDS file. problem can investigated using built-function chef::load_debug_session() loading directly session using readRDS().","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"debugging-example","dir":"Articles","previous_headings":"{chef} style debugging > Evaluation and validation errors","what":"Debugging example:","title":"Debugging","text":"example review debugging flow faulty stat method. define endpoint single statistic. setup pipeline described End--End examples. execute pipeline tar_make() can check output messages target run: ▶ indicates starting target evaluation ●, ✖ indicates successful failed evaluation respectably. Console output can see pipeline failed evaluation target-step ep_stat_by_strata_by_trt. Furthermore, can view Last error get meaningful error message. shows failed evaluate function aliased n_sub error message Calculation impossible can inspect problem running suggested command: - chef::load_debug_session('/tmp/RtmpCiXPPf/testproj275bcd76287e8d/debug/n_sub.Rdata') can play around function, given supplied inputs. toy example simply function throws error - simple error fix. However, tool provides possiblity explore tinker functions context fail pipeline. NB. mentioned console message - remember update changes source code!","code":"mk_ep_def <- function() { ep <- chef::mk_endpoint_str( ..., # The rest of the input parameters. stat_by_strata_by_trt = list(\"n_sub\" = n_sub), ) } tar_make() Loading required package: targets ▶ start target ep ● built target ep [0.038 seconds] ▶ start target ep_id ● built target ep_id [0.001 seconds] (...) # We ignore some other upstream target evaluations. ▶ start target ep_stat_by_strata_by_trt ✖ error target ep_stat_by_strata_by_trt ▶ end pipeline [3.556 seconds] Error: Error running targets::tar_make() Error messages: targets::tar_meta(fields = error, complete_only = TRUE) Debugging guide: https://books.ropensci.org/targets/debugging.html How to ask for help: https://books.ropensci.org/targets/help.html Last error: Error during evaluation of: n_sub Failed to EVALUATE function with error: Error in fn_callable[[1]](dat = dat[[1]], treatment_var = treatment_var, : Calculation impossible! --- Debugging session created: Launch with: chef::load_debug_session('/tmp/RtmpCiXPPf/testproj275bcd76287e8d/debug/n_sub.Rdata') ---"},{"path":"https://hta-pharma.github.io/ramnog/articles/debugging.html","id":"targets-style-debugging","dir":"Articles","previous_headings":"","what":"Targets style debugging","title":"Debugging","text":"several approaches debugging pipeline erroring . Find much details targets manual: clean R session, load inputs target producing error via tar_load(names = c( System setup","what":"Updating the workflows","title":"DevOps","text":"workflows updated ramnog repository. workflows consumer repositories simply consume workflows ramnog repository main branch. possible, keep updates workflows within two main workflows (Check Package Release Package). Thus, updates consumer repositories needed. - Remember can use conditions inside workflows run different steps based event-type. Note: testing update may want create new branch ramnog repository update workflows consumer repositories point new branch. allow test changes without affecting main branch.","code":"on: push: branches: [main, stage, dev] pull_request: branches: [main, stage, dev] workflow_dispatch: name: Check Package 📦 jobs: check: name: Checks (from ramnog) uses: hta-pharma/ramnog/.github/workflows/Check-package.yaml@feature/new-workflow # <-- new branch"},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"pre-commit-hooks","dir":"Articles","previous_headings":"","what":"Pre-commit hooks","title":"DevOps","text":"Pre-commit hooks tool allows run set checks code commit . built standard git hooks, easier manage share across projects. pre-commit hooks run every commit. hooks fail, commit aborted. downside need install pre-commit package machine activate given repository. Individual setup pre-commit hooks described pre-commit documentation. Install pre-commit Individual user space (use pip pipx installed) Install pre-commit hooks repository. NOTE: needs run root repository Run files check works: pre-commit hook requires python environment. python installed, can install using conda pyenv. python3 installed get error python available may need specify python3 used. can done either following (asumming linux environment):","code":"pipx install pre-commit pre-commit install pre-commit run --all-files # Create a symlink for python3 in the python bin sudo ln -s /usr/bin/python3 /usr/bin/python # Install the python-is-python3 package sudo apt-get install python-is-python3"},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"usage","dir":"Articles","previous_headings":"Pre-commit hooks","what":"Usage","title":"DevOps","text":"hooks run whenever create commit. hooks fail, commit aborted. hooks automatically fix issues, others report issues. Even hooks automatically fix issues, still need add changes commit commit .","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"system-setup-1","dir":"Articles","previous_headings":"Pre-commit hooks","what":"System setup","title":"DevOps","text":"pre-commits run defined .pre-commit-config.yaml file root repository. file exists repositories ramnog ecosystem. {chef}, {chefStats}, {chefCriteria} pre-commit configs identical points org-hook ramnog. org-hook custom hook defined ramnog repository. hook defined hooks folder ramnog repository. org-hook points script runs pre-commit using standard pre-commit config template. template likewise stored ramnog repository.","code":"repos: - repo: https://github.com/hta-pharma/ramnog rev: v0.1.1 hooks: - id: org-hook - id: org-hook name: org-wide hooks language: script entry: ./run-org-hooks verbose: true require_serial: true repos: - repo: https://github.com/lorenzwalthert/precommit rev: v0.4.0 hooks: - id: readme-rmd-rendered - id: parsable-R - id: no-browser-statement (...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/dev_devops.html","id":"updating-the-run-hooks","dir":"Articles","previous_headings":"Pre-commit hooks > System setup","what":"Updating the run hooks:","title":"DevOps","text":"order update hooks, need update shared-pre-commit-config.yaml file ramnog repository. Furthemore, hooks consumer repos (chef*) needs updated version hosted ramnog. need either tag ramnog repository following changes update rev chef*/.pre-commit-config.yaml files new tag. Updating rev chef*/.pre-commit-config.yaml file trigger pre-commit hooks update hooks next commit. command pre-commit auto-update can used update consumer hooks. Alternatively can update consumer rev latest commit hash ramnog repository.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_overview.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Endpoint Specification","text":"endpoint specifications comprise central input {chef} contains instructions produce statistics endpoints. specifications contain instructions data use endpoint, statistics include, statistics calculated, group population, criteria must met include endpoint final dossier. specifications must organized data table row contains endpoint specification rows processed independently may represent one endpoints. One single specification may contain instructions produce multiple endpoints e.g. different severity levels system organ classes. result processing endpoint specifications {chef} set statistics, structured long-formatted data table can processed downstream modules e.g. format raw results endpoint tables. scope {chef}. Many components endpoint specifications consist references custom functions outside {chef}, provide high flexibility defining endpoints. endpoint specifications associated custom functions must supplied user inputs {chef} part package. endpoint definition created calling function mk_endpoint_str. endpoint parameters required others optional. Optional parameters default set empty calling mk_endpoint_str, user type endpoint parameters every time required relevant endpoint specification. summary, endpoint specifications can considered cooking recipe along set ingredients (trial data) cooking tools (custom functions) handed chef, {chef}, prepares endpoints. details internal steps {chef} see Getting Started Pipelines.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"ADaM Data","text":"endpoint needs generated single analysis data set containing information one ADaM data sets. analysis data set created custom ADaM function written trial programmer referenced endpoint specification via data_prepare parameter. ADaM function contains instructions ADaM data sets join, join, custom variables e.g., new groupings, create (). three requirements ADaM function: must exactly one input argument study_metadata endpoint specification parameter, preferably 1-element list, contains relevant information study may used read ADaM data sets. information needed, leave study_metadata unused function set empty list() endpoint specification. must return data.table object. work data.table, can converting tibble data.frame object data.table object end function via data.table::.data.table(my_data_frame). returned table must contain ADAM variables (derived variables) mentioned endpoint specification also subject ID variable USUBJID. summary, analysis data set generation controlled following two parameters endpoint specification: data_prepare: Reference custom function returns single consolidated analysis table contains ADaM data needed endpoint. study_metadata: Object containing study specifics relevant reading ADAM data. Must parsed input ADaM ADSL functions. May empty needed.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"ex-1-1","dir":"Articles","previous_headings":"","what":"ADaM Data","title":"ADaM Data","text":"example ADAM function first reads ADSL data table {pharmaverseadam}, filters two treatment arms, enriches derived variable. merges enriched ADSL ADAE {pharmaverseadam} return single table ADaM information ADSL ADAE:","code":"# Example of ADaM function that merges information from ADSL and ADAE mk_adam_ex1_1 <- function(study_metadata) { # Read ADSL from {pharmaverseadam} adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c('Placebo', 'Xanomeline High Dose')] # New derived ADSL variable adsl[, AGEGR2 := data.table::fcase(AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\")] # Read ADAE from {pharmaverseadam} adae <- data.table::as.data.table(pharmaverseadam::adae) # Merge ADSL and ADAE adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F], by = \"USUBJID\", all = TRUE) return(adae_out) }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"ex-1-2","dir":"Articles","previous_headings":"","what":"ADaM Data","title":"ADaM Data","text":"might also cases information several ADAM tables required endpoint. example returns ADaM information example addition baseline body weight extracted ADVS. information three ADaM tables merged returned single analysis data set:","code":"# Example of ADaM function that merges information from three ADaM tables mk_adam_ex1_2 <- function(study_metadata) { # Read ADSL from {pharmaverseadam} adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c('Placebo', 'Xanomeline High Dose')] # New derived ADSL variable adsl[, AGEGR2 := data.table::fcase(AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\")] # Read ADAE from {pharmaverseadam} adae <- data.table::as.data.table(pharmaverseadam::adae) # Read ADVS from {pharmaverseadam} advs <- data.table::as.data.table(pharmaverseadam::advs) # Identify baseline body weight advs_bw <- advs[advs$PARAMCD == \"WEIGHT\" & advs$VISIT == \"BASELINE\"] # Create new variable bw_baseline advs_bw[[\"bw_baseline\"]] <- advs_bw[[\"AVAL\"]] # Merge ADSL, ADAE and baseline body weight from ADVS ax_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F], by = \"USUBJID\", all.x = TRUE) |> merge(x=_, advs_bw[, c(\"bw_baseline\", \"USUBJID\")], by = \"USUBJID\", all.x = TRUE) return(ax_out) }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_adam_data.html","id":"ex-1-3","dir":"Articles","previous_headings":"Examples","what":"Ex 1.3","title":"ADaM Data","text":"ADaM functions, defined, need linked corresponding endpoint specifications via data_prepare parameter. creation endpoint specification facilitated mk_endpoint_str function wherein data_prepare parameter established. following example, mk_adam_ex1_2 function utilized produce analysis data intended endpoint.","code":"# Example of endpoint specification of ADaM function. # The dots must be replaced with other required parameters. ep_spec_ex1_3 <- chef::mk_endpoint_str( data_prepare = mk_adam_ex1_2, ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Endpoint Events","text":"Events records analysis data defined ‘positives’ context endpoint. example, adverse events certain type may events one endpoint, demographic endpoint subjects analysis data (comply period filter) events. Since events bounded rows analysis data, entity event fixed. depends analysis data. may e.g. set visits, measurements, subjects. endpoint definition event controlled via following endpoint specification parameters: period_var: Name flag variable analysis data set indicates record contained required time slot event. period_value: value period_var indicates record required time slot. endpoint_filter: optional parameter contains free text endpoint filter adds period filter defined period_var period_value. group_by: optional parameter splits analysis data exclusive groups injected endpoint. adds narrowing endpoint events disregards events outside group specific endpoint. Let us investigate parameters affect set events exposed endpoint. Initially, input data returned data_prepare filtered create analysis data using population filter c.f. Analysis population. Next, endpoint events analysis data identified according filters . Within endpoint , cell statistics also slices analysis data e.g. strata treatment arm combinations. strata work independently event definition, within strata may event non-events. See Strata details. illustrations depict four possible cases combining event specification parameters.   Case : period filter (period_value period_var) applied case analysis data records meet period filter events. Case B: period filter endpoint filter active. Case C: setup case addition endpoint grouping events restricted within group element. case illustrates setup one group levels (group 1). Case D: setup case B addition endpoint grouping events restricted within group element. case illustrates setup one group levels (group 1).","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-1","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"three examples syntax supplying period filter, endpoint filter endpoint grouping, respectively, endpoint specification.","code":"# Example of partial endpoint specification with period filter ep_spec_ex4_1_1 <- chef::mk_endpoint_str( period_var = \"ANL01FL\" period_value = \"Y\", ...) # Example of partial endpoint specification with endpoint filtering ep_spec_ex4_1_2 <- chef::mk_endpoint_str( endpoint_filter = 'ASEV == \"MILD\"', ...) # Example of partial endpoint specification with endpoint grouping ep_spec_ex4_1_3 <- chef::mk_endpoint_str( group_by = list(list(AESEV = c(\"MILD\", \"MODERATE\", \"SERVERE\"))), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-2","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"may also state group levels lazy manner case group levels analysis data set applied. useful group variable many levels e.g., system organ class (SOC), leave certain group levels. example supply lazy grouping SOC.","code":"# Example of partial endpoint specification with lazy endpoint grouping ep_spec_ex4_2 <- chef::mk_endpoint_str( group_by = list(list(AESOC = c())), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-3","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"case want combine groups multiple variables can state dimension grouping group_by parameter. useful e.g., generating endpoint combination adverse event severity SOC exemplified lazy grouping:","code":"# Example of partial endpoint specification with lazy endpoint grouping on multiple variables ep_spec_ex4_3 <- chef::mk_endpoint_str( group_by = list(list(AESEV = c(), AESOC = c())), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_event_def.html","id":"ex-4-4","dir":"Articles","previous_headings":"","what":"Endpoint Events","title":"Endpoint Events","text":"continuation previews example, interested mild adverse events can replace grouping AESEV endpoint filter filters AESEV.","code":"# Example of partial endpoint specification with endpoint filter and lazy grouping ep_spec_ex4_4 <- chef::mk_endpoint_str( endpoint_filter = 'ASEV == \"MILD\"', group_by = list(list(AESOC = c())), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Endpoint Label","text":"endpoint user option specify label describes content endpoint. parsed string via endpoint_label parameter endpoint specification. string may contain references parameters endpoint specification encapsulated <>. references dynamically evaluated respective values parameters. endpoint label unique endpoint, references optional. Label referencing particularly useful endpoint grouping applied, resolves endpoint group level. case may dynamically refer group level present endpoints. dynamic labeling may also convenient way refer important parameters identifies endpoint e.g., pop_var, period_var endpoint_filter.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"ex-6-1","dir":"Articles","previous_headings":"","what":"Endpoint Label","title":"Endpoint Label","text":"Suppose define endpoint specification endpoint safety analysis population (SAFFL = \"Y\") grouped adverse event severity AESEV three levels: MILD, MODERATE, SERVERE. Note assumes SAFFL AESEV variables analysis data set. setup may specify dynamic endpoint label refer population severity: resolve three endpoints following labels:","code":"# Example of partial endpoint specification of analysis population ep_spec_ex6_1 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", group_by = list(list(AESEV = c())), endpoint_label = \"Example: - adverse events\", ...) \"Example: SAFFL - MILD adverse events\" \"Example: SAFFL - MODERATE adverse events\" \"Example: SAFFL - SERVERE adverse events\""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"ex-6-2","dir":"Articles","previous_headings":"","what":"Endpoint Label","title":"Endpoint Label","text":"extension previous example, suppose want consider subjects ages 18-64 years via age group variable AGEGR1 analysis data set. addition, want update endpoint label refer filter. look like : , resolve three endpoints now endpoint labels:","code":"# Example of partial endpoint specification of analysis population ep_spec_ex6_2 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", endpoint_filter = \"AGEGR1 == '18-64'\", group_by = list(list(AESEV = c())), endpoint_label = \"Example: - adverse events / \", ...) \"Example: SAFFL - MILD adverse events / AGEGR1 == '18-64'\" \"Example: SAFFL - MODERATE adverse events / AGEGR1 == '18-64'\" \"Example: SAFFL - SERVERE adverse events / AGEGR1 == '18-64'\""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_label.html","id":"ex-6-3","dir":"Articles","previous_headings":"","what":"Endpoint Label","title":"Endpoint Label","text":"provide references endpoint label, simply returned static string. Hence, modify label previous example follows: get following endpoint labels:","code":"# Example of partial endpoint specification of analysis population ep_spec_ex6_3 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", endpoint_filter = \"AGEGR1 == '18-64'\", group_by = list(list(AESEV = c())), endpoint_label = \"Example of a fixed endpoint label\", ...) \"Example of a fixed endpoint label\" \"Example of a fixed endpoint label\" \"Example of a fixed endpoint label\""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_population_def.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Analysis Population","text":"analysis data constitutes records input data set relevant statistics endpoint. can controlled via following endpoint specification parameters filters analysis data analysis population: pop_var: Name flag variable input data set indicates record eligible analysis endpoint. pop_value: value pop_var indicates record eligible. custom_pop_filter: optional parameter contains free text population filter adds filter formed pop_var pop_value. Recommended ad-hoc testing different sub populations. approach records irrelevant endpoint removed early stage, relevant analysis population exposed statistical functions criteria functions.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_population_def.html","id":"ex-3-1","dir":"Articles","previous_headings":"","what":"Analysis Population","title":"Analysis Population","text":"example specification analysis data using safety population flag (assumed present input data returned data_prepare:","code":"# Example of partial endpoint specification of population filter ep_spec_ex3_1 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_population_def.html","id":"ex-3-2","dir":"Articles","previous_headings":"","what":"Analysis Population","title":"Analysis Population","text":"population may filtered adding custom filter. example, addition population filter example may add custom filter subjects aged least 55 years inlcuded population.","code":"# Example of partial endpoint specification of analysis population ep_spec_ex3_2 <- chef::mk_endpoint_str( pop_var = \"SAFFL\", pop_value = \"Y\", custom_pop_filter = \"AGE >= 55\", ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Strata","text":"stratify_by endpoint parameter specifies variables analysis data set population sliced endpoint granular comparison treatment arm effects. key properties stratify_by parameter: stratify_by list() object list may empty stratification needed. Regardless whether srtata specified (meet strata criteria c.f. Criteria methods) , endpoint statistics always derived total analysis population endpoint. total can considered special stratum one level. stratum values required stratify_by. relevant statistics applied stratum. strata variables applied independently, .e. strata combined. e.g. stratify age group gender, cross combination SEX=\"F\" & AGEGR=\"<65\". cross combinations two stratum variables B required, either: Create derived variable data_prepare combines B stratify new variable. Use endpoint_filter group_by group filter data stratify B within group level.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"ex-5-1","dir":"Articles","previous_headings":"","what":"Strata","title":"Strata","text":"","code":"# Example of partial endpoint specification with a strata definition ep_spec_ex5_2 <- chef::mk_endpoint_str( stratify_by = list(c(\"SEX\")), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"ex-5-2","dir":"Articles","previous_headings":"","what":"Strata","title":"Strata","text":"Two strata set:","code":"# Example of partial endpoint specification with a strata definition ep_spec_ex5_2 <- chef::mk_endpoint_str( stratify_by = list(c(\"SEX\", \"AGEGGR1\")), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_def.html","id":"ex-5-3","dir":"Articles","previous_headings":"","what":"Strata","title":"Strata","text":"strata, case total present endpoint:","code":"# Example of partial endpoint specification with a strata definition ep_spec_ex5_3 <- chef::mk_endpoint_str( stratify_by = list(), ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Processing of strata without events","text":"only_strata_with_events endpoint parameter specifies whether endpoint upon completion {chef} framework include strata levels levels contain events.default, levels included endpoint least one event one treatment arms given strata level, strata level included endpoint treatment arms regardsless whether one treatment arms events stratum. feature useful cases endpoint specification contains groups strata result many 100s 1000s combinations combinations events interest. case only_strata_with_events set TRUE, may significantly reduce number combinations.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"examples","dir":"Articles","previous_headings":"","what":"Examples","title":"Processing of strata without events","text":"","code":"mk_adae <- function(study_metadata) { adae <- data.table::as.data.table(pharmaverseadam::adae) adsl <- data.table::as.data.table(pharmaverseadam::adsl) adsl[, AGEGR2 := data.table::fcase( AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\" )] adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) adae_out[] }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"ex-7-1","dir":"Articles","previous_headings":"","what":"Processing of strata without events","title":"Processing of strata without events","text":"Let us consider following endpoint specification, mk_adae defined Quick Start, grouping performed SOC (System Organ Class) stratification performed race. default, strata levels included, .e. only_strata_with_events = FALSE. setup note: TRT01A 2 treatment arms analysis data due custom_pop_filter group_by: AESOC 23 levels stratify_by: RACE 4 levels stat_by_strata_by_trt: 2 statistics per combination group level strata level strata implies: TOTAL: 2 treatment arms x 2 statistics = 4 combinations RACE: 2 treatment arms x 3 races x 2 statistics = 12 combinations Thus 23 SOCs x (4 + 12) = 368 combinations, .e. 368 rows output data. Specifically, let us consider SOC “Eye Disorder” print subset output data covers SOC (see ). expected 4 + 12 = 16 rows provided. also notice two strata levels RACE event (n = 0), leads next example.","code":"ep_spec_ex7_1 <- chef::mk_endpoint_str( data_prepare = mk_adae, study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", custom_pop_filter = \"TRT01A %in% c('Placebo', 'Xanomeline High Dose') & !is.na(AESOC)\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"RACE\")), stat_by_strata_by_trt = list(N = chefStats::n_subj, n = chefStats::n_subj_event), endpoint_label = \"AESOC: \", only_strata_with_events = FALSE ) #> stat_filter #> #> 1: TOTAL_ == \"total\" & TRT01A == \"Placebo\" #> 2: TOTAL_ == \"total\" & TRT01A == \"Placebo\" #> 3: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" #> 4: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" #> 5: RACE == \"WHITE\" & TRT01A == \"Placebo\" #> 6: RACE == \"WHITE\" & TRT01A == \"Placebo\" #> 7: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Placebo\" #> 8: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Placebo\" #> 9: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Placebo\" #> 10: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Placebo\" #> 11: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" #> 12: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" #> 13: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Xanomeline High Dose\" #> 14: RACE == \"BLACK OR AFRICAN AMERICAN\" & TRT01A == \"Xanomeline High Dose\" #> 15: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Xanomeline High Dose\" #> 16: RACE == \"AMERICAN INDIAN OR ALASKA NATIVE\" & TRT01A == \"Xanomeline High Dose\" #> fn_name stat_result_value #> #> 1: n 4 #> 2: N 69 #> 3: n 1 #> 4: N 70 #> 5: n 4 #> 6: N 63 #> 7: n 0 #> 8: N 6 #> 9: n 0 #> 10: N 0 #> 11: n 1 #> 12: N 61 #> 13: n 0 #> 14: N 8 #> 15: n 0 #> 16: N 1"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_strata_w_events.html","id":"ex-7-2","dir":"Articles","previous_headings":"","what":"Processing of strata without events","title":"Processing of strata without events","text":"Now suppose interested combinations group levels strata levels example 7.1 events. accomplish may specify only_strata_with_events = TRUE. Now number combination output reduced 256. Let us revisit SOC “Eye Disorder” print rows output related SOC (see ). notice 2 strata levels RACE present anymore (“BLACK AFRICAN AMERICAN”, “AMERICAN INDIAN ALASKA NATIVE”) since events c.f. example 7.1., effectively reducing number rows/combinations 8.","code":"ep_spec_ex7_2 <- chef::mk_endpoint_str( data_prepare = mk_adae, study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", custom_pop_filter = \"TRT01A %in% c('Placebo', 'Xanomeline High Dose') & !is.na(AESOC)\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"RACE\")), stat_by_strata_by_trt = list(N = chefStats::n_subj, n = chefStats::n_subj_event), endpoint_label = \"AESOC: \", only_strata_with_events = TRUE ) #> stat_filter fn_name #> #> 1: TOTAL_ == \"total\" & TRT01A == \"Placebo\" n #> 2: TOTAL_ == \"total\" & TRT01A == \"Placebo\" N #> 3: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" n #> 4: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" N #> 5: RACE == \"WHITE\" & TRT01A == \"Placebo\" n #> 6: RACE == \"WHITE\" & TRT01A == \"Placebo\" N #> 7: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" n #> 8: RACE == \"WHITE\" & TRT01A == \"Xanomeline High Dose\" N #> stat_result_value #> #> 1: 4 #> 2: 69 #> 3: 1 #> 4: 70 #> 5: 4 #> 6: 63 #> 7: 1 #> 8: 61"},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_treatment_arms.html","id":"overview","dir":"Articles","previous_headings":"","what":"Overview","title":"Treatment Arms","text":"treatment arm specifications used split analysis data separate treatment arm assessed compared endpoint. endpoint specification following two parameters must set: treatment_var: Name variable analysis data set contains treatment arms. treatment_refval: value treatment_var corresponds reference/intervention. may used asymmetric statistics compare treatment effects.","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/articles/ep_spec_treatment_arms.html","id":"ex-2-1","dir":"Articles","previous_headings":"","what":"Treatment Arms","title":"Treatment Arms","text":"example partial endpoint specification treatment arm specifications:","code":"# Example of endpoint specification of treatment arms. ep_spec_ex2_1 <- chef::mk_endpoint_str( treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", ...)"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"endpoint-types","dir":"Articles","previous_headings":"","what":"Endpoint types","title":"Endpoint Catalog","text":"Binary type 1 Binary type 2 Demographics Continuous outcomes endpoints , note endpoint specification must contain statistics strata treatment arm (N, n, %), strata across treatment arms (RR, , P-value) across strata treatment arms (P-value interaction) must calculated two strata (Age, Sex). statistical functions come library statistical functions {chefStats}. assume endpoint concerns adverse events must applied full safety population set (SAFFL=\"Y\"). also need functions produce clinical data pass data_prepare. Since examlple analyses adverse events, need version ADAE dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example functions : Let us consider different variations endpoint specification cases . examples demonstrate apply statistics either full population, grouping system organ class (SOCs) severity, filtered severity. Note set SOCs trimmed according endpoint criterion function (ep_crit_min_subev_by_trt), SOCs least 5 subjects events least one treatment arm included. criteria function come library criteria functions found {chefCriteria}. get results match table , can group endpoints AESOC, within AESOC grouping, stratify AEDECOD. framing , can see need statistic (n number subjects event E number events) every combination endpoint group (AESOC) stratification level (AEDECOD). statistical functions come chefStats. assume endpoint concerns adverse events must applied full safety population set (SAFFL=\"Y\"). also need functions produce clinical data pass data_prepare. Since examlple analyses adverse events, need version ADAE dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example functions : table contains continuous variables (Age, Body Weight Baseline) categorical variables (Age Group, Sex) different statistics applied. endpoint split two endpoint specifications, one continuous variables (case 5), one categorical variables (case 6). categorical variables (Age Group Sex), see need statistic stratification level category (e.g. AGEGR1 < 65 AGEGR1 >= 65). clear get results need, need one statistic per stratification level treatment level. Thus supply statistical function stat_by_strata_by_trt argument endpoint specification. continuous variables less obvious. However, consider TOTAL stratification just like age sex, albeit single level, can see also need one statistic per strata level treatment level, use stat_by_strata_by_trt cases single statistical function applied, (chefStats::demographics_continuous() chefStats::demographics_categorical() respectively) compactly supplies required statistics one function call. Alternatively, can define separate functions statistics apply individually endpoint specification. also need functions produce clinical data pass data_prepare. Since example analyzes body weight, need version ADVS dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example matches needs analysis: show define demographic endpoints continuous variables categorical variables table contains statistics baseline characteristics, well change--baseline. observe mean SD calculated combination treatment arm, strata (total age), time (baseline, week 8 16). defining time (AVISIT) endpoint grouping can obtain statistics one endpoint specification. implies : mean SD calculated treatment strata levels (stat_by_strata_by_trt) analysis data columns containing baseline (VALUE_BASELINE) change baseline column (VALUE_CHANGE). Number subjects (N) also calculated treatment strata level (stat_by_strata_by_trt). endpoint grouping (AVISIT) Hedge’s G calculated strata level across treatment arms (stat_by_strata_across_trt). also need functions produce clinical data pass data_prepare. Since example analyses laboratory data, need version ADLB dataset. exact nature clinical dataset differ project--project, library data prep functions can source . Instead define example matches needs analysis: endpoint specification showing summary statistics baseline change baseline shown ","code":"# Merge ADSL and ADAE from {pharmaverseadam} mk_adae <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADAE adae <- data.table::as.data.table(pharmaverseadam::adae) # Merge ADSL and ADAE adam_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) return(adam_out) } # Merge ADSL and ADAE from {pharmaverseadam} mk_adae <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADAE adae <- data.table::as.data.table(pharmaverseadam::adae) # Merge ADSL and ADAE adam_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) return(adam_out) } ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, pop_var = \"SAFFL\", pop_value = \"Y\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"AEDECOD\")), stat_by_strata_by_trt = list(chefStats::n_subj_event, chefStats::n_event) ) # Merge ADSL and ADVS from {pharmaverseadam} mk_advs <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADVS advs <- data.table::as.data.table(pharmaverseadam::advs) # Identify baseline body weight advs_bw <- advs[advs$PARAMCD == \"WEIGHT\" & advs$VISIT == \"BASELINE\"] # Create new variable BW_BASELINE advs_bw[[\"BW_BASELINE\"]] <- advs_bw[[\"AVAL\"]] # Merge ADSL, ADAE and baseline body weight from ADVS adam_out <- merge(adsl, advs_bw[, c(\"BW_BASELINE\", \"USUBJID\")], by = \"USUBJID\", all.x = TRUE) return(adam_out) } # Merge ADSL and ADLB from {pharmaverseadam} mk_adlb <- function(study_metadata) { # Read ADSL adsl <- data.table::as.data.table(pharmaverseadam::adsl) # Filter treatment arms adsl <- adsl[adsl$TRT01A %in% c(\"Placebo\", \"Xanomeline High Dose\")] # New derived ADSL age group variable adsl[, AGEGR2 := data.table::fcase(AGE < 65, \"AGE < 65\", AGE >= 65, \"AGE >= 65\", default = NA )] # Read ADLB adlb_0 <- data.table::as.data.table(pharmaverseadam::adlb) adlb_1 <- adlb_0[adlb_0[[\"PARAMCD\"]] == \"SODIUM\" & adlb_0[[\"AVISIT\"]] %in% c(\"Baseline\", \"Week 8\", \"Week 16\"), ] adlb2 <- merge(adlb_1, adlb_1[adlb_1$AVISIT == \"Baseline\", c(\"USUBJID\", \"AVAL\")], by = \"USUBJID\", all.x = TRUE ) adlb2[[\"VALUE_BASELINE\"]] <- adlb2[[\"AVAL.y\"]] adlb2[[\"VALUE_CHANGE\"]] <- adlb2[[\"AVAL.x\"]] - adlb2[[\"AVAL.y\"]] # Merge ADSL and ADLB adam_out <- merge(adsl, adlb2[, c( \"USUBJID\", \"PARAMCD\", \"AVISIT\", \"VALUE_BASELINE\", \"VALUE_CHANGE\", \"ANL01FL\" )], by = \"USUBJID\", all.x = TRUE) return(adam_out) } chef::mk_endpoint_str( data_prepare = mk_adlb, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_value = \"Y\", group_by = list(list(AVISIT = c())), stratify_by = list(c(\"AGEGR2\")), stat_by_strata_by_trt = list( \"n_sub\" = chefStats::n_subj, \"mean: VALUE_BASELINE\" = c(chefStats::mean_value, var = \"VALUE_BASELINE\"), \"mean: VALUE_CHANGE\" = c(chefStats::mean_value, var = \"VALUE_CHANGE\"), \"sd: VALUE_BASELINE\" = c(chefStats::sd_value, var = \"VALUE_BASELINE\"), \"sd: VALUE_CHANGE\" = c(chefStats::sd_value, var = \"VALUE_CHANGE\") ), stat_by_strata_across_trt = list(hedgesg), endpoint_label = \"Baseline and change from baseline on SODIUM - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-1-adverse-events-base-form","dir":"Articles","previous_headings":"Endpoint types","what":"Case 1: Adverse events (base form)","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), endpoint_label = \"Adverse events - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-2-adverse-events-grouped-by-system-organ-class","dir":"Articles","previous_headings":"Endpoint types","what":"Case 2: Adverse events grouped by system organ class","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", group_by = list(list(AESOC = c())), stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), crit_endpoint = list( c( ep_crit_min_subev_by_trt, min_n_subev = 5, requirement_type = \"any\" ) ), endpoint_label = \"Adverse events - - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-3-mild-adverse-events-grouped-by-system-organ-class","dir":"Articles","previous_headings":"Endpoint types","what":"Case 3: Mild adverse events grouped by system organ class","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", endpoint_filter = 'ASEV == \"MILD\"', group_by = list(list(AESOC = c())), stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), crit_endpoint = list( c( ep_crit_min_subev_by_trt, min_n_subev = 5, requirement_type = \"any\" ) ), endpoint_label = \"Mild adverse events - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-4-adverse-events-grouped-by-severity-and-system-organ-class","dir":"Articles","previous_headings":"Endpoint types","what":"Case 4: Adverse events grouped by severity and system organ class","title":"Endpoint Catalog","text":"","code":"ep_spec <- chef::mk_endpoint_str( data_prepare = mk_adae, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", group_by = list(list(ASEV = c(), AESOC = c())), stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list( chefStats::n_subj, chefStats::n_subj_event, cheStats::p_subj_event ), stat_by_strata_across_trt = list( chefStats::RR, chefStats::OR, chefStats::p_val ), stat_across_strata_across_trt = list(chefStats::pval_interaction), crit_endpoint = list( c( ep_crit_min_subev_by_trt, min_n_subev = 5, requirement_type = \"any\" ) ), endpoint_label = \" adverse events - - \" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-1-baseline-characteristics-of-analysis-population-continuous-variables","dir":"Articles","previous_headings":"Endpoint types","what":"Case 1: Baseline characteristics of analysis population (continuous variables)","title":"Endpoint Catalog","text":"","code":"chef::mk_endpoint_str( data_prepare = mk_advs, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", stat_by_strata_by_trt = list( c(demographics_continuous, var = \"AGE\" ), c(demographics_continuous, var = \"BW_BASELINE\" ) ), endpoint_label = \"Demographics endpoint (categorical measures)\" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/example_ep_spec.html","id":"case-2-baseline-characteristics-of-analysis-population-categorical-variables","dir":"Articles","previous_headings":"Endpoint types","what":"Case 2: Baseline characteristics of analysis population (categorical variables)","title":"Endpoint Catalog","text":"collect two endpoint specifications cover complete endpoint:","code":"chef::mk_endpoint_str( data_prepare = mk_advs, treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", pop_var = \"SAFFL\", pop_value = \"Y\", stratify_by = list(c(\"AGEGR2\", \"SEX\")), stat_by_strata_by_trt = list(c(demographics_counts)), endpoint_label = \"Demographics endpoint (categorical measures)\" ) ep_spec <- rbind(ep_spec_pt1, ep_spec_pt2)"},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Criteria Methods","text":"vignette provides short introduction idea analysis criteria. analysis request authorities detail overall set endpoints, irrespective underlying study data. example, might request analysis serious adverse events system organ class, gender. analyses may contain many cells zeros, low counts. ensure analyses contain meaningfully amounts data included, request may additionally include certain criteria inclusion analysis, threshold minimum number records, events, subjects. logic analysis inclusion criteria handled functions supplied crit_endpoint, crit_by_strata_by_trt, crit_by_strata_across_trt arguments defining endpoint mk_endpoints_str().","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"criteria-levels","dir":"Articles","previous_headings":"","what":"Criteria levels","title":"Criteria Methods","text":"Currently, {chef} supports analysis inclusion criteria three parts analysis output, colors corresponding figure : entire endpoint stat_by_strata_by_trt stat_by_strata_across_trt stat_across_strata_across_trt criteria functions hierarchical; failure meet criteria Level (Entire Endpoint) implies automatic failure Levels B C. Similarly, passing Level failing Level B results failure Level C. endpoint satisfy certain criterion, associated statistical functions execute reduce compute time. instance, endpoint meet criteria Level B, strata across treatment arms analyses performed. However, analyses Totals still proceed. important note criteria optional. every endpoint definition needs incorporate three levels criteria. analyses may criteria, others might require criteria endpoint strata. NOTE crit_by_strata_across_trt criterion gate-keep stat_by_strata_across_trt stat_across_strata_across_trt (stippled box). stat_across_strata_across_trt seen lower hierarchical criteria ladder stat_by_strata_across_trt - however seperate criterion time therefore included default.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"function-formals","dir":"Articles","previous_headings":"","what":"Function formals","title":"Criteria Methods","text":"Chef supplies number parameters criterion functions. parameters vary according statistical method. Note crit_by_strata_by_trt, crit_by_strata_across_trt formals functions identical.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"input-specifications","dir":"Articles","previous_headings":"Function formals","what":"Input specifications","title":"Criteria Methods","text":"criteria functions served broad set parameters. reflects need flexibility criteria functions. flexibility allows set criteria affect specific stratum based specific stratum information shared across multiple strata. allows create criteria functions target one stratum act across whole strata: Criteria1 requires endpoint strata GENDER must balanced. (ie approx 50/50 distribution.) (requires stratify_by parameter) Criteria2 requires endpoint strata (GENDER, AGE) must balanced. (requires stratify_by parameter) may also also design criteria endpoints, includes case enough subjects relevant strata. See Examples NB Similar stat methods require criteria function include ellipses (...) wildcard parameter. convenience, since need explicitly state used parameters function definition. However, importantly ensure criteria function define today also work tomorrow, {chef} may supply parameters criteria functions. Endpoint criteria functions Strata criteria functions","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"output-specifications","dir":"Articles","previous_headings":"Function formals","what":"Output specifications","title":"Criteria Methods","text":"output criteria function must simple boolean (TRUE FALSE)","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"example-functions","dir":"Articles","previous_headings":"Function formals","what":"Example functions","title":"Criteria Methods","text":"two examples showcasing write criteria functions. within scope {chef} package provide library criteria functions. Endpoint criteria functions Strata criteria functions Generic criteria function: Allows control endpoint inclusion based count subjects events arms. function generic can specified mk_endpoint_str curried beforehand (Stat methods-Currying) include across strata treatment arm analysis least X subjects events treatment arm. requirement_type==“” just single cell (stratum + treatment arm) needs included.","code":"ep_criteria.treatment_arms_minimum_unique_event_count <- function( dat, event_index, treatment_var, subjectid_var, minimum_event_count, requirement_type = c(\"any\", \"all\") ... ) # rows with events dat_events <- dat[J(event_index),] # Bolean of whether the count of unique subjects # within each treatment arm is above the minimum count. dat_lvl_above_threshold <- dat_events[ , list(\"is_above_minimum\" = data.table::uniqueN(subjectid_var)>=minimum_event_count), by=treatment_var ] if requirement_type == \"any\": return( any(dat_lvl_above_threshold$V1) ) return( all(dat_lvl_above_threshold$V1) ) ep_strata_criteria.strata_treatment_arm_minimum_unique_count <- function( dat, event_index, treatment_var, subjectid_var, strata_var, minimum_event_count, requirement_type = c(\"any\", \"all\") ... ) # rows with events dat_events <- dat[J(event_index),] # Bolean of whether the count of unique subjects # within each treatment arm is above the minimum count. dat_lvl_above_threshold <- dat_events[ , list(\"is_above_minimum\" = data.table::uniqueN(subjectid_var)>=minimum_event_count), by=c(treatment_var, strata_var) ] if requirement_type == \"any\": return( any(dat_lvl_above_threshold$is_above_minimum) ) return( all(dat_lvl_above_threshold$is_above_minimum) )"},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_criteria.html","id":"applying-criteria-functions","dir":"Articles","previous_headings":"Function formals","what":"Applying criteria functions","title":"Criteria Methods","text":"Criteria functions supplied mk_endpoint_str function used gatekeep statistical function run. example endpoint : look population event E_XYZ. interested endpoint see least 5 subjects arms event E_XYZ. interested getting descriptive statistic strata (say GENDER, AGEGRP) levels within least 1 subject. Finally, run across treatment arm statistics least 5 subject stratum treatment arm. requirements/gates implemented currying functions given Examples section.","code":"# R/project_criteria.R # Curry the general criteria functions from [Examples](#examples) crit_accept_endpoint.5_subjects_any_treatment_arm <- purrr:partial( ep_criteria.treatment_arms_minimum_unique_event_count, minimum_event_count = 5, requirement_type = \"any\" ) crit_strata.1_subject_all_treatment_strata <- purrr:partial( ep_sg_criteria.sg_treatment_arm_minimum_unique_count, minimum_event_count = 1, requirement_type = \"all\" ) crit_strata.5_subject_all_treatment_strata <- purrr:partial( ep_sg_criteria.sg_treatment_arm_minimum_unique_count, minimum_event_count = 5, requirement_type = \"all\" ) # R/project_endpoints.R endpoint_XYZ <- chef::mk_endpoint_str( ..., # Setting the rest of the inputs crit_endpoint = list(crit_accept_endpoint.5_subjects_any_treatment_arm), crit_by_strata_by_trt = list(crit_strata.1_subject_all_treatment_strata), crit_by_strata_across_trt = list(crit_strata.5_subject_all_treatment_strata) )"},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_stat.html","id":"statistical-method-types","dir":"Articles","previous_headings":"","what":"Statistical method types","title":"Statistical Methods","text":"{chef} framework categorizes statistical functions three main categories depending operate stratification levels treatment levels. Operations can either done per stratification level treatment level, can operate across levels. Figure 1 shows typical table safety analysis color codes result based function type creates : Figure 1 Table 1 provides description three function types, color coded outputs produce table 1 : Table 1 function type also determines function applied. example figure 1, stat_by_strata_by_trt function called combination stratification level treatment level, well TOTALS treatment level: SEX == “MALE” & TRT == “TreatmentA” SEX == “FEMALE” & TRT == “TreatmentA” SEX == “MALE” & TRT == “TreatmentB” SEX == “FEMALE” & TRT == “TreatmentB” AGE == “<65” & TRT == “TreatmentA” AGE == “>=65” & TRT == “TreatmentA” AGE == “<65” & TRT == “TreatmentB” AGE == “>=65” & TRT == “TreatmentB” TOTAL_ == “total” & TRT == “TreatmentA” TOTAL_ == “total” & TRT == “TreatmentB” Whereas stat_across_strata_across_trt called per stratification “group”, .e.: strata_var == “SEX” strata_var == “AGE”","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/methods_stat.html","id":"project-specific-statistical-functions","dir":"Articles","previous_headings":"","what":"Project-specific statistical functions","title":"Statistical Methods","text":"need statistical function exist {chefStats}, writing adding chefStats package, way can used others - please see documentation chefStats package details. sometimes might make sense. case can always reference custom function endpoint specification stored R/ directory project folder. example want new function my_custom_stats_function type stat_by_strata_by_trt . first define function: ’s save R/, can reference endpoint specification just like chefStats functions: Important: custom function relies external packages, need add packages packages.R file R/.","code":"my_custom_function <- function( # function arguments here ){ # Function does something here } chef::mk_endpoint_str( ..., # other arguments to mk_endpoint_str stat_by_strata_by_trt = my_custom_function)"},{"path":"https://hta-pharma.github.io/ramnog/articles/qc.html","id":"unit-testing","dir":"Articles","previous_headings":"","what":"Unit testing","title":"Quality control for ramnog ecosystem","text":"package contains unit tests functionality package responsible . means, example, responsibility unit-tests {chefStats} ensure statistical functions written chefStats produce result supposed produce.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/qc.html","id":"integration-testing","dir":"Articles","previous_headings":"","what":"Integration testing","title":"Quality control for ramnog ecosystem","text":"Integration testing verifies framework produces expected results integration testing done via {testthat} framework, essentially unit-tests cover many different units goal compare results analysis run via ramnog expected results done manual calculation analysis. example, unit test ensure results endpoint definition defined run via chef match calculated manually","code":"testthat::test_that(\"Valide stats when one strata level is not found\", { # SETUP ------------------------------------------------------------------- testr::create_local_project() mk_adae <- function(study_metadata) { adsl <- pharmaverseadam::adsl |> data.table::setDT() adae <- pharmaverseadam::adae |> data.table::setDT() adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F], by = \"USUBJID\", all = TRUE) adae_out[TRT01A %in% c('Placebo', 'Xanomeline High Dose'),] } mk_ep_def <- function() { chef::mk_endpoint_str( study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", stratify_by = list(c(\"SEX\")), data_prepare = mk_adae, endpoint_label = \"A\", custom_pop_filter = \"SEX == 'F'\", group_by = list(list(AESEV = c())), stat_by_strata_by_trt = list( \"N\" = chefStats::n_subj, \"E\" = chefStats::n_event, \"N subj E\" = chefStats::n_subj_event ), stat_by_strata_across_trt = list(\"RR\" = chefStats::RR, \"OR\" = chefStats::OR), stat_across_strata_across_trt = list(\"P-interaction\" = chefStats::p_val_interaction) ) } chef::use_chef( pipeline_dir = \"pipeline\", r_functions_dir = \"R/\", pipeline_id = \"01\", mk_endpoint_def_fn = mk_ep_def, mk_adam_fn = list(mk_adae) ) # ACT --------------------------------------------------------------------- targets::tar_make() targets::tar_load(ep_stat) # EXPECT ------------------------------------------------------------------ # Manually calculated expected results x <- mk_adae(study_metadata = NULL) # Relative Risk actual <- ep_stat[endpoint_group_filter == \"AESEV == \\\"SEVERE\\\"\" & fn_name == \"RR\" & stat_filter == \"SEX == \\\"F\\\"\" & stat_result_label == \"RR\", stat_result_value] x1 <- x[SEX == \"F\" & SAFFL == \"Y\"] x1[, event := FALSE] x1[AESEV == \"SEVERE\", event := TRUE] |> data.table::setorder(-event) x1_unique <- unique(x1, by = \"USUBJID\", fromLast = FALSE) two_by_two <- x1_unique[, .N, by = .(TRT01A, event)][order(TRT01A, event)] # Outcome, exposed a <- two_by_two[TRT01A == \"Xanomeline High Dose\" & (event), N] # No outcome, exposed b <- two_by_two[TRT01A == \"Xanomeline High Dose\" & !(event), N] # Outcome, not exposed c <- two_by_two[TRT01A == \"Placebo\" & (event), N] # No outcome, not exposed d <- two_by_two[TRT01A == \"Placebo\" & !(event), N] expected <- (a / sum(a, b)) / (c / sum(c, d)) expect_identical(actual, expected) # Number of Events actual <- ep_stat[endpoint_group_filter == \"AESEV == \\\"SEVERE\\\"\" & fn_name == \"E\" & strata_var == \"SEX\"] expected <- x1[(event), .N, by = .(TRT01A)][order(TRT01A)][, as.double(N)] expect_identical(actual$stat_result_value, expected) }) #> v Setting active project to '/tmp/Rtmpmb3dbo/testproj1c8f1bdf7a1e' #> v Writing 'R/packages.R' #> v Writing 'pipeline/pipeline_01.R' #> * Edit 'pipeline/pipeline_01.R' #> * Edit 'R/mk_adae.R' #> i Renaming \"mk_ep_def\" to \"mk_endpoint_def.R\" #> #> * Edit 'R/mk_endpoint_def.R' #> Loading required package: targets #> ▶ dispatched target ep #> ● completed target ep [0.029 seconds] #> ▶ dispatched target ep_id #> ● completed target ep_id [0.009 seconds] #> ▶ dispatched branch ep_fn_map_a9f94f07 #> ● completed branch ep_fn_map_a9f94f07 [0.025 seconds] #> ● completed pattern ep_fn_map #> ▶ dispatched target user_def_fn #> ● completed target user_def_fn [0.003 seconds] #> ▶ dispatched target study_data #> ● completed target study_data [0.037 seconds] #> ▶ dispatched target fn_map_tibble #> ● completed target fn_map_tibble [0.004 seconds] #> ▶ dispatched branch ep_and_data_a9f94f07 #> ● completed branch ep_and_data_a9f94f07 [0.008 seconds] #> ● completed pattern ep_and_data #> ▶ dispatched branch fn_map_3a0d9b8d #> ● completed branch fn_map_3a0d9b8d [0 seconds] #> ● completed pattern fn_map #> ▶ dispatched branch analysis_data_container_5d792ea5 #> ● completed branch analysis_data_container_5d792ea5 [0 seconds] #> ● completed pattern analysis_data_container #> ▶ dispatched branch ep_with_data_key_5d792ea5 #> ● completed branch ep_with_data_key_5d792ea5 [0 seconds] #> ● completed pattern ep_with_data_key #> ▶ dispatched branch ep_expanded_0ccac0a6 #> ● completed branch ep_expanded_0ccac0a6 [0.039 seconds] #> ● completed pattern ep_expanded #> ▶ dispatched branch ep_event_index_74b91187 #> ● completed branch ep_event_index_74b91187 [0.005 seconds] #> ● completed pattern ep_event_index #> ▶ dispatched branch ep_crit_endpoint_191245c4 #> ● completed branch ep_crit_endpoint_191245c4 [0.004 seconds] #> ● completed pattern ep_crit_endpoint #> ▶ dispatched branch ep_crit_by_strata_by_trt_de417ba1 #> ● completed branch ep_crit_by_strata_by_trt_de417ba1 [0.009 seconds] #> ● completed pattern ep_crit_by_strata_by_trt #> ▶ dispatched branch ep_crit_by_strata_across_trt_45e05d00 #> ● completed branch ep_crit_by_strata_across_trt_45e05d00 [0.003 seconds] #> ● completed pattern ep_crit_by_strata_across_trt #> ▶ dispatched branch ep_prep_by_strata_across_trt_fbfeb90e #> ● completed branch ep_prep_by_strata_across_trt_fbfeb90e [0.038 seconds] #> ● completed pattern ep_prep_by_strata_across_trt #> ▶ dispatched branch ep_prep_across_strata_across_trt_fbfeb90e #> ● completed branch ep_prep_across_strata_across_trt_fbfeb90e [0.013 seconds] #> ● completed pattern ep_prep_across_strata_across_trt #> ▶ dispatched branch ep_prep_by_strata_by_trt_fbfeb90e #> ● completed branch ep_prep_by_strata_by_trt_fbfeb90e [0.066 seconds] #> ● completed pattern ep_prep_by_strata_by_trt #> ▶ dispatched target ep_rejected #> ● completed target ep_rejected [0 seconds] #> ▶ dispatched branch ep_stat_by_strata_across_trt_c5b9f3c4 #> ● completed branch ep_stat_by_strata_across_trt_c5b9f3c4 [0.122 seconds] #> ● completed pattern ep_stat_by_strata_across_trt #> ▶ dispatched branch ep_stat_across_strata_across_trt_c2630227 #> ● completed branch ep_stat_across_strata_across_trt_c2630227 [0.028 seconds] #> ● completed pattern ep_stat_across_strata_across_trt #> ▶ dispatched branch ep_stat_by_strata_by_trt_b1e90d49 #> ● completed branch ep_stat_by_strata_by_trt_b1e90d49 [0.039 seconds] #> ● completed pattern ep_stat_by_strata_by_trt #> ▶ dispatched target ep_stat_nested #> ● completed target ep_stat_nested [0 seconds] #> ▶ dispatched target ep_stat #> ● completed target ep_stat [0.012 seconds] #> ▶ ended pipeline [0.801 seconds] #> v Restoring original working directory: '/home/runner/work/ramnog/ramnog/vignettes/' #> v Setting active project to '' #> v Deleting temporary project: '/tmp/Rtmpmb3dbo/testproj1c8f1bdf7a1e/' #> Test passed"},{"path":"https://hta-pharma.github.io/ramnog/articles/qc.html","id":"cicd","dir":"Articles","previous_headings":"","what":"CI/CD","title":"Quality control for ramnog ecosystem","text":"Please see DevOps vignette details CI/CD infrastructure.","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"set-up-project-infrastructure","dir":"Articles","previous_headings":"","what":"1. Set up project infrastructure","title":"Quick Start","text":"assumes set RStudio project (equivalent). done , first. setup chef project need: functions used make ADaM data ingested chef pipeline R function produces endpoint specification object analysis/statistical functions sourced R packages (like chefStats chefCriteria) script containing library() calls package needed pipeline run pipeline/ directory targets pipeline(s) /defined targets.yml file tracking different pipelines file file structure look like : {chef} convenience function set infrastructure : sets following file structure: now need know file R/ . _targets.yml pipeline_01.R explanation, see vignette(\"pipeline\").","code":"/ |-- R/ |--- mk_endpoint_definition.R |--- mk_adam.R |--- packages.R |-- pipeline/ |--- pipeline_01.R |-- _targets.yaml library(chef) chef::use_chef( pipeline_id = \"01\" )"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"specify-an-endpoint","dir":"Articles","previous_headings":"","what":"1. Specify an endpoint","title":"Quick Start","text":"Endpoint specifications need created inside function, case function defined mk_endpoint_definition.R endpoint created using chef::mk_endpoint_str() function. explanation specify endpoints, see vignette(\"endpoint_definitions\"). specify minimal working endpoint based adae dataset supplied {pharmaverseadam}. modifying R/mk_endpoint_definition.R file looks like : might notice couple things specification: stratify_by field refer variable called AGEGR2, however ADAE dataset {pharmaverseadam} contain variable. derive variable inside mk_adae (see next section).","code":"mk_endpoint_def <- function() { chef::mk_endpoint_str( study_metadata = list(), pop_var = \"SAFFL\", pop_value = \"Y\", treatment_var = \"TRT01A\", treatment_refval = \"Xanomeline High Dose\", stratify_by = list(c(\"AGEGR2\")), data_prepare = mk_adae, endpoint_label = \"A\", custom_pop_filter = \"TRT01A %in% c('Placebo', 'Xanomeline High Dose')\", stat_by_strata_by_trt = list(\"N_subj_event\" = c(chefStats::n_subj_event)) ) }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"define-the-input-dataset","dir":"Articles","previous_headings":"","what":"2. Define the input dataset","title":"Quick Start","text":"also need provide chef ADAE input data set corresponds endpoint specified . read make data sets, see vignette(\"mk_adam\"). can see strata based AGEGR2, can derived AGE variable ADSL. now, write simple ADaM function mk_adae merges ADSL data set (enriched AGEGR2) onto ADAE data set, thereby creating input data set.","code":"mk_adae <- function(study_metadata) { adae <- data.table::as.data.table(pharmaverseadam::adae) adsl <- data.table::as.data.table(pharmaverseadam::adsl) adsl[, AGEGR2 := data.table::fcase( AGE < 70, \"AGE < 70\", AGE >= 70, \"AGE >= 70\" )] adae_out <- merge(adsl, adae[, c(setdiff(names(adae), names(adsl)), \"USUBJID\"), with = F ], by = \"USUBJID\", all = TRUE) adae_out[] }"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"define-the-analysis-methods","dir":"Articles","previous_headings":"","what":"3. Define the analysis methods","title":"Quick Start","text":"Now specified endpoint analyzed, defined analysis data set {chef}, need define analysis . goal analysis count number events experiencing event. need define function makes calculations, give function chef. want result per treatment arm - strata combination, must provide function stat_by_strata_by_trt argument endpoint specification. already argument set chefStats::n_subj_event example endpoint specification ","code":""},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"run-the-analysis-pipeline","dir":"Articles","previous_headings":"","what":"4. Run the analysis pipeline","title":"Quick Start","text":"Now inputs defined, can run pipeline. achieved call tar_make() {targets} package. Targets show steps pipeline executed long step took: , see results, load cached step pipeline corresponding results. case ep_stat, load sessions object call Now ep_stat R object like . Thus can look results simply running However, lot extra data included object, lets look column subsection first 5 rows:","code":"targets::tar_make() ## Loading required package: targets ## ▶ dispatched target ep ## ● completed target ep [0.028 seconds] ## ▶ dispatched target ep_id ## ● completed target ep_id [0.009 seconds] ## ▶ dispatched branch ep_fn_map_c85cfecb ## ● completed branch ep_fn_map_c85cfecb [0.026 seconds] ## ● completed pattern ep_fn_map ## ▶ dispatched target user_def_fn ## ● completed target user_def_fn [0.002 seconds] ## ▶ dispatched target study_data ## ● completed target study_data [0.04 seconds] ## ▶ dispatched target fn_map_tibble ## ● completed target fn_map_tibble [0.004 seconds] ## ▶ dispatched branch ep_and_data_c85cfecb ## ● completed branch ep_and_data_c85cfecb [0.008 seconds] ## ● completed pattern ep_and_data ## ▶ dispatched branch fn_map_9cf81814 ## ● completed branch fn_map_9cf81814 [0 seconds] ## ● completed pattern fn_map ## ▶ dispatched branch analysis_data_container_a4b422b1 ## ● completed branch analysis_data_container_a4b422b1 [0.001 seconds] ## ● completed pattern analysis_data_container ## ▶ dispatched branch ep_with_data_key_a4b422b1 ## ● completed branch ep_with_data_key_a4b422b1 [0 seconds] ## ● completed pattern ep_with_data_key ## ▶ dispatched branch ep_expanded_e741f3f8 ## ● completed branch ep_expanded_e741f3f8 [0.023 seconds] ## ● completed pattern ep_expanded ## ▶ dispatched branch ep_event_index_5f7976c8 ## ● completed branch ep_event_index_5f7976c8 [0.004 seconds] ## ● completed pattern ep_event_index ## ▶ dispatched branch ep_crit_endpoint_3da7fd1e ## ● completed branch ep_crit_endpoint_3da7fd1e [0.003 seconds] ## ● completed pattern ep_crit_endpoint ## ▶ dispatched branch ep_crit_by_strata_by_trt_1786b781 ## ● completed branch ep_crit_by_strata_by_trt_1786b781 [0.008 seconds] ## ● completed pattern ep_crit_by_strata_by_trt ## ▶ dispatched branch ep_crit_by_strata_across_trt_6a441418 ## ● completed branch ep_crit_by_strata_across_trt_6a441418 [0.004 seconds] ## ● completed pattern ep_crit_by_strata_across_trt ## ▶ dispatched branch ep_prep_by_strata_across_trt_89480a2b ## ● completed branch ep_prep_by_strata_across_trt_89480a2b [0.002 seconds] ## ● completed pattern ep_prep_by_strata_across_trt ## ▶ dispatched branch ep_prep_across_strata_across_trt_89480a2b ## ● completed branch ep_prep_across_strata_across_trt_89480a2b [0.001 seconds] ## ● completed pattern ep_prep_across_strata_across_trt ## ▶ dispatched branch ep_prep_by_strata_by_trt_89480a2b ## ● completed branch ep_prep_by_strata_by_trt_89480a2b [0.031 seconds] ## ● completed pattern ep_prep_by_strata_by_trt ## ▶ dispatched target ep_rejected ## ● completed target ep_rejected [0 seconds] ## ▶ dispatched branch ep_stat_by_strata_across_trt_a72d712a ## ● completed branch ep_stat_by_strata_across_trt_a72d712a [0 seconds] ## ● completed pattern ep_stat_by_strata_across_trt ## ▶ dispatched branch ep_stat_across_strata_across_trt_b2713725 ## ● completed branch ep_stat_across_strata_across_trt_b2713725 [0 seconds] ## ● completed pattern ep_stat_across_strata_across_trt ## ▶ dispatched branch ep_stat_by_strata_by_trt_9535dd36 ## ● completed branch ep_stat_by_strata_by_trt_9535dd36 [0.011 seconds] ## ● completed pattern ep_stat_by_strata_by_trt ## ▶ dispatched target ep_stat_nested ## ● completed target ep_stat_nested [0 seconds] ## ▶ dispatched target ep_stat ## ● completed target ep_stat [0.004 seconds] ## ▶ ended pipeline [0.501 seconds] ## targets::tar_load(ep_stat) ep_stat ep_stat[, .( treatment_var, treatment_refval, strata_var, stat_filter, stat_result_label, stat_result_description, stat_result_qualifiers, stat_result_value )] |> head() ## treatment_var treatment_refval strata_var ## ## 1: TRT01A Xanomeline High Dose TOTAL_ ## 2: TRT01A Xanomeline High Dose TOTAL_ ## 3: TRT01A Xanomeline High Dose AGEGR2 ## 4: TRT01A Xanomeline High Dose AGEGR2 ## 5: TRT01A Xanomeline High Dose AGEGR2 ## 6: TRT01A Xanomeline High Dose AGEGR2 ## stat_filter stat_result_label ## ## 1: TOTAL_ == \"total\" & TRT01A == \"Placebo\" n ## 2: TOTAL_ == \"total\" & TRT01A == \"Xanomeline High Dose\" n ## 3: AGEGR2 == \"AGE < 70\" & TRT01A == \"Placebo\" n ## 4: AGEGR2 == \"AGE >= 70\" & TRT01A == \"Placebo\" n ## 5: AGEGR2 == \"AGE < 70\" & TRT01A == \"Xanomeline High Dose\" n ## 6: AGEGR2 == \"AGE >= 70\" & TRT01A == \"Xanomeline High Dose\" n ## stat_result_description stat_result_qualifiers stat_result_value ## ## 1: Number of subjects with events 86 ## 2: Number of subjects with events 72 ## 3: Number of subjects with events 22 ## 4: Number of subjects with events 64 ## 5: Number of subjects with events 18 ## 6: Number of subjects with events 54"},{"path":"https://hta-pharma.github.io/ramnog/articles/ramnog.html","id":"pass-the-data-on-to-tfl-formatting","dir":"Articles","previous_headings":"","what":"5. Pass the data on to TFL formatting","title":"Quick Start","text":"Now data produced, can pass TFL formatting (outside scope {chef}).","code":""},{"path":"https://hta-pharma.github.io/ramnog/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Matthew David Phelps. Author. Nicolai Skov Johnsen. Author. Henrik Sparre Spiegelhauer. Author. Christian Haargaard Olsen. Author, maintainer.","code":""},{"path":"https://hta-pharma.github.io/ramnog/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Matthew David Phelps, Nicolai Skov Johnsen, Henrik Sparre Spiegelhauer, Christian Haargaard Olsen (2024). ramnog: Facilitating AMNOG style analysis pipelines. R package version 0.1.2, https://github.com/hta-pharma/ramnog, https://app.codecov.io/gh/hta-pharma/ramnog, https://hta-pharma.github.io/ramnog/.","code":"@Manual{, title = {ramnog: Facilitating AMNOG style analysis pipelines}, author = {{Matthew David Phelps} and {Nicolai Skov Johnsen} and {Henrik Sparre Spiegelhauer} and {Christian Haargaard Olsen}}, year = {2024}, note = {R package version 0.1.2, https://github.com/hta-pharma/ramnog, https://app.codecov.io/gh/hta-pharma/ramnog}, url = {https://hta-pharma.github.io/ramnog/}, }"},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"r-packages-for-amnog-analyses-","dir":"","previous_headings":"","what":"R packages for AMNOG analyses","title":"Facilitating AMNOG style analysis pipelines","text":"Ramnog collection packages setting pipelines AMNOG-style HTA analyses aim ramnog statistician/programmer can set AMNOG-type analyses minimal familiarity R. get started, check Quick Start guide","code":""},{"path":[]},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"aim","dir":"","previous_headings":"","what":"Aim","title":"Facilitating AMNOG style analysis pipelines","text":"aim {ramnog} programmer write minimal code, programming, set-new AMNOG-type analyses. study, programmer need make, adjust, check following four types code: definition endpoint (group endpoints). set ADaM functions makes modifications existing ADaM datasets (e.g., new age grouping ADSL), makes new ADaM datasets none exist required output. (needed) Define set criteria endpoint included results. library criteria stored companion package {chefCriteria}. specification statistical functions used summarize/analyze data. library functions provided {chefStats} package. core principal frameworks design modularity. core functionality framework resides {chef} change slowly, functionality subject frequent changes sectioned packages ({chefStats} {chefCriteria}).","code":""},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Facilitating AMNOG style analysis pipelines","text":"welcome contributions code base. Please see contributing vignette information contribute.","code":""},{"path":"https://hta-pharma.github.io/ramnog/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Facilitating AMNOG style analysis pipelines","text":"packages available install GitHub:","code":"remotes::install_github(\"hta-pharma/ramnog\")"},{"path":"https://hta-pharma.github.io/ramnog/reference/dummy_fn.html","id":null,"dir":"Reference","previous_headings":"","what":"Title — dummy_fn","title":"Title — dummy_fn","text":"exists import data.table","code":""},{"path":"https://hta-pharma.github.io/ramnog/reference/dummy_fn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Title — dummy_fn","text":"","code":"dummy_fn()"},{"path":"https://hta-pharma.github.io/ramnog/reference/dummy_fn.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Title — dummy_fn","text":"Nothing.","code":""}]