From 3ca9a648f8446df5631a9aeb45480adf0da2f26c Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Tue, 19 Nov 2024 15:46:03 +0000 Subject: [PATCH 1/9] # 48 updated discription of initial package release in NEWS.md. --- NEWS.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 391abd3..ae6198e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,4 @@ # admiralmetabolic 0.1.0 -- Initial package release focused on `<>` - -Note that after first release you should then start maintaining this `NEWS.md` file for every user-facing update. -You should categorize the updates under title sections for New Features, Updates of Existing Functions, -Breaking Changes, Documentation, Various. -Each update should also reference the original issue by adding at the end: (#ISSUE-NUMBER) +- Initial package release mainly focused on obesity indicators +(e.g. Waist to Hip Ratio, Waist to Height Ratio). From 7125359c199bab81c3d01aba154325f7b0cc265d Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Mon, 2 Dec 2024 01:18:49 +0000 Subject: [PATCH 2/9] # 48 Added subsections of "New features" and "Documentation". --- NEWS.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index ae6198e..ed62339 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,15 @@ # admiralmetabolic 0.1.0 -- Initial package release mainly focused on obesity indicators -(e.g. Waist to Hip Ratio, Waist to Height Ratio). +- Initial package release mainly focused on obesity therapeutic area +(e.g. functions for Waist to Hip Ratio, Waist to Height Ratio). + +## New Features + +- The new function "'derive_param_waisthip'" is provided to derive parameters for Waist to Hip Ratio. (#33 & #52) +- The new function "'derive_param_waisthgt'" is provided to derive parameters for Waist to Height Ratio. (#33 & #52) + +## Documentation + +- New vignette "Creating a Metabolic ADVS ADaM" has been created. (#28) +- New vignette "Creating a Control of Eating Questionnaire ADaM" has been created. (#53) +- New template scripts for ADVS "'ad_advs.R'" has been created. (#35) From a267ccc37946c06fbc5d57c8da06803cf4ccdc36 Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Mon, 2 Dec 2024 01:27:14 +0000 Subject: [PATCH 3/9] # 48 Updated WORDLIST to pass spellcheck. --- inst/WORDLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index c469925..0aee8a8 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -41,3 +41,6 @@ PARAMCD prm admiraldev github +param +waisthgt +waisthip From 2524dd832119b7540e3d4c355e421e68c3061c67 Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Mon, 2 Dec 2024 01:42:33 +0000 Subject: [PATCH 4/9] #48 Pulled from origin/main to resolve conflict. --- _pkgdown.yml | 2 + vignettes/adcoeq.Rmd | 223 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 vignettes/adcoeq.Rmd diff --git a/_pkgdown.yml b/_pkgdown.yml index d93adec..2f5349c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -71,6 +71,8 @@ navbar: menu: - text: Creating a Metabolic ADVS href: articles/advs.html + - text: Creating a Control of Eating Questionnaire ADaM + href: articles/adcoeq.html history: icon: fa-history href: articles/website-versions.html diff --git a/vignettes/adcoeq.Rmd b/vignettes/adcoeq.Rmd new file mode 100644 index 0000000..0264dd0 --- /dev/null +++ b/vignettes/adcoeq.Rmd @@ -0,0 +1,223 @@ +--- +title: "Creating a Control of Eating Questionnaire ADaM" +output: + rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Creating a Control of Eating Questionnaire ADaM} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +library(admiraldev) +``` + +# License + +Note that University of Leeds are the copyright holders of the Control of Eating Questionnaire (CoEQ) and the test +data included within `{admiralmetabolic}` as well as the ADCOEQ code are for +not-for-profit use only within `{admiralmetabolic}` and pharmaverse-related +examples/documentation. Any persons or companies wanting to use the CoEQ should +request a license to do so from the following [link](https://licensing.leeds.ac.uk/product/control-of-eating-questionnaire-coeq). + +# Introduction + +This article describes creating a Control of Eating Questionnaire ADaM for clinical trials. + +We advise you first consult the `{admiral}` [Creating Questionnaire ADaMs vignette](https://pharmaverse.github.io/admiral/articles/questionnaires.html). +The programming workflow around creating the general set-up of an `ADQS` using `{admiral}` functions is the same. In this vignette, we focus on the Control of Eating Questionnaire and avoid repeating information and maintaining the same content in two places. As such, the code in this vignette is not completely executable; we recommend consulting the ADQS template script to view the full workflow. + +**Note**: *All examples assume CDISC SDTM and/or ADaM format as input unless otherwise specified.* + +## Required Packages + +The examples of this vignette require the following packages. + +```{r, warning=FALSE, message=FALSE} +library(admiral) +library(admiralmetabolic) +library(pharmaversesdtm) +library(dplyr) +``` + +# Programming Workflow + +- [Read in Data](#readdata) +- [Original items](#original_items) +- [Derive the four Subscales](#subscales) +- [Remaining ADCOEQ Set-up](#adcoeq_end) + + + +## Read in Data {#readdata} + +To start, all data frames needed for the creation of the ADaM dataset should be loaded into the global environment. Reading data will usually be a company specific process, however, for the purpose of this vignette, we will use example data from `{pharmaversesdtm}` and `{admiral}`. We will utilize `DM`, `QS` and `ADSL`. + + +In this vignette we use example data for the CoEQ. +The example `QS` data (`qs_metabolic`) is included in the `{admiralmetabolic}` package. + +```{r, message=FALSE, warning=FALSE} +dm_metabolic <- admiralmetabolic::dm_metabolic +qs_metabolic <- admiralmetabolic::qs_metabolic +admiral_adsl <- admiral::admiral_adsl + +dm <- convert_blanks_to_na(dm_metabolic) +qs <- convert_blanks_to_na(qs_metabolic) +admiral_adsl <- convert_blanks_to_na(admiral_adsl) +``` + +Within this vignette, `DM` is used as the basis for `ADSL`: +```{r eval=TRUE} +# Retrieve required variables from admiral ADSL for this vignette that are not present in DM dataset +adsl <- dm %>% + select(-DOMAIN) %>% + mutate(TRT01P = ARM, TRT01A = ACTARM) %>% + derive_vars_merged( + dataset_add = admiral_adsl, + by_vars = exprs(USUBJID), + new_vars = exprs(TRTSDT, TRTEDT) + ) +``` + +## Original Items {#original_items} + +The original items, i.e. the answers to the questionnaire questions, can be handled in the same way as in an [{admiral} BDS finding ADaM](https://pharmaverse.github.io/admiral/articles/bds_finding.html). + +```{r eval=TRUE} +adcoeq1 <- qs %>% + # Add ADSL variables + derive_vars_merged( + dataset_add = adsl, + by_vars = exprs(STUDYID, USUBJID), + new_vars = exprs(TRTSDT, TRTEDT, TRT01P, TRT01A) + ) %>% + # Add analysis parameter variables + mutate( + PARAMCD = QSTESTCD, + PARAM = QSTEST, + PARCAT1 = QSCAT + ) %>% + # Add timing variables + derive_vars_dt(new_vars_prefix = "A", dtc = QSDTC) %>% + derive_vars_dy(reference_date = TRTSDT, source_vars = exprs(ADT)) %>% + mutate( + AVISIT = if_else(ADT <= TRTSDT, "BASELINE", VISIT), + AVISITN = if_else(ADT <= TRTSDT, 0, VISITNUM) + ) +``` + +```{r echo=FALSE} +dataset_vignette( + arrange(adcoeq1, USUBJID, PARCAT1, ADY, PARAMCD), + display_vars = exprs(USUBJID, PARAMCD, PARAM, PARCAT1, QSSTRESN, ADY, AVISIT) +) +``` + +The analysis values (`AVAL` and `AVALC`) for most original items are set directly from `QSSTRESN` and `QSORRES`, respectively. However, CoEQ item 6 (`COEQ06`) requires a manual transformation, where we invert the original scores. This transformation is performed because CoEQ item 6 is used in calculating the subscale for "Positive Mood," where its original scores indicate anxiety. + + +In cases where `QSSTRESN` values require transformation, it is recommended to keep the original `QSSTRESN` values in the ADaM dataset for traceability. + +```{r eval=TRUE} +adcoeq2 <- adcoeq1 %>% + # Add analysis value variables + mutate( + AVAL = if_else(PARAMCD == "COEQ06", 100 - QSSTRESN, QSSTRESN), + AVALC = if_else(PARAMCD == "COEQ20", QSORRES, NA_character_) + ) +``` + +```{r echo=FALSE} +dataset_vignette( + arrange(adcoeq2, USUBJID, PARCAT1, ADY, PARAMCD), + display_vars = exprs(USUBJID, PARAMCD, PARAM, PARCAT1, QSSTRESN, ADY, AVISIT, AVALC, AVAL), + filter = PARAMCD %in% c("COEQ01", "COEQ02", "COEQ03", "COEQ04", "COEQ05", "COEQ06", "COEQ07", "COEQ08", "COEQ09", "COEQ20") +) +``` + +For deriving visits based on time-windows, see `{admiral}` [Visit and Period Variables](https://pharmaverse.github.io/admiral/articles/visits_periods.html). + + +## Derive the four Subscales {#subscales} + +For the Control of Eating Questionnaire, four subscales are derived. These subscales are derived as the sum or the average across a subset of the various items/questions. + +The subscales are defined as follows: + +* Craving Control: Calculate average of items 9, 10, 11, 12 and 19. + +* Craving for Sweet: Calculate average of items 3, 13, 14 and 15. + +* Craving for Savoury: Calculate average of items 4, 16, 17 and 18. + +* Positive Mood: Calculate average of items 5, 7, 8 and 6 (reversed). + +These parameters can be derived by `derive_summary_records()`: +```{r eval=TRUE} +adcoeq3 <- adcoeq2 %>% + call_derivation( + derivation = derive_summary_records, + variable_params = list( + params( + filter_add = PARAMCD %in% c("COEQ09", "COEQ10", "COEQ11", "COEQ12", "COEQ19"), + set_values_to = exprs( + AVAL = mean(AVAL, na.rm = TRUE), + PARAMCD = "COEQCRCO", + PARAM = "COEQ - Craving Control" + ) + ), + params( + filter_add = PARAMCD %in% c("COEQ03", "COEQ13", "COEQ14", "COEQ15"), + set_values_to = exprs( + AVAL = mean(AVAL, na.rm = TRUE), + PARAMCD = "COEQCRSW", + PARAM = "COEQ - Craving for Sweet" + ) + ), + params( + filter_add = PARAMCD %in% c("COEQ04", "COEQ16", "COEQ17", "COEQ18"), + set_values_to = exprs( + AVAL = mean(AVAL, na.rm = TRUE), + PARAMCD = "COEQCRSA", + PARAM = "COEQ - Craving for Savoury" + ) + ), + params( + filter_add = PARAMCD %in% c("COEQ05", "COEQ07", "COEQ08", "COEQ06"), + set_values_to = exprs( + AVAL = mean(AVAL, na.rm = TRUE), + PARAMCD = "COEQPOMO", + PARAM = "COEQ - Positive Mood" + ) + ) + ), + dataset_add = adcoeq2, + by_vars = exprs(STUDYID, USUBJID, AVISIT, AVISITN, ADT, ADY, PARCAT1, TRTSDT, TRTEDT, TRT01P, TRT01A) + ) +``` + +```{r echo=FALSE} +dataset_vignette( + arrange(adcoeq3, USUBJID, ADY, PARAMCD), + display_vars = exprs(USUBJID, PARAMCD, PARAM, AVAL, ADY, AVISIT), + filter = PARAMCD %in% c("COEQCRCO", "COEQCRSW", "COEQCRSA", "COEQPOMO") +) +``` + +## Remaining ADCOEQ Set-up {#adcoeq_end} + +The `{admiral}` [Creating Questionnaire ADaMs vignette](https://pharmaverse.github.io/admiral/articles/questionnaires.html) +describes further steps, including, how to calculate the change from baseline variables, and how to add parameters for questionnaire completion. + +# Example Scripts {#example} + +ADaM | Sample Code +---- | -------------- +ADCOEQ | [ad_adcoeq.R](https://github.com/pharmaverse/admiralmetabolic/blob/main/inst/templates/ad_adcoeq.R){target="_blank"} + From d278320449339a7035d064d1b9aad3f2846d741a Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Tue, 3 Dec 2024 05:21:49 +0000 Subject: [PATCH 5/9] #48 updated subsection from "New Features" to "Functions". --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index ed62339..d65b6ec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,7 @@ - Initial package release mainly focused on obesity therapeutic area (e.g. functions for Waist to Hip Ratio, Waist to Height Ratio). -## New Features +## Functions - The new function "'derive_param_waisthip'" is provided to derive parameters for Waist to Hip Ratio. (#33 & #52) - The new function "'derive_param_waisthgt'" is provided to derive parameters for Waist to Height Ratio. (#33 & #52) From 487afd9af47cc61a44f78a662c94910de351164f Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Wed, 4 Dec 2024 09:37:10 +0000 Subject: [PATCH 6/9] #48 updated wordings. --- NEWS.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index d65b6ec..b56ac63 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,11 +5,11 @@ ## Functions -- The new function "'derive_param_waisthip'" is provided to derive parameters for Waist to Hip Ratio. (#33 & #52) -- The new function "'derive_param_waisthgt'" is provided to derive parameters for Waist to Height Ratio. (#33 & #52) +- The function `derive_param_waisthip()` for deriving Waist to Hip Ratio. (#33 & #52) +- The function `derive_param_waisthgt()` for deriving Waist to Height Ratio. (#33 & #52) ## Documentation -- New vignette "Creating a Metabolic ADVS ADaM" has been created. (#28) -- New vignette "Creating a Control of Eating Questionnaire ADaM" has been created. (#53) -- New template scripts for ADVS "'ad_advs.R'" has been created. (#35) +- Vignette "Creating a Metabolic ADVS ADaM". (#28) +- Vignette "Creating a Control of Eating Questionnaire ADaM". (#53) +- ADVS template scripts `ad_advs.R` which creates a Vital Sign Analysis Dataset with metabolic specific derivations. (#35) From 041240a0e5cdcacb2464a21f3991d65f6e59a5fe Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Wed, 4 Dec 2024 09:41:50 +0000 Subject: [PATCH 7/9] #48 deleted example --- NEWS.md | 1 - 1 file changed, 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b56ac63..a5e1f6a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,6 @@ # admiralmetabolic 0.1.0 - Initial package release mainly focused on obesity therapeutic area -(e.g. functions for Waist to Hip Ratio, Waist to Height Ratio). ## Functions From 694384b459c7f468734c2e18d088d0d2d534bafd Mon Sep 17 00:00:00 2001 From: Shunsuke Goto <111881867+kiwi5104679@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:59:46 +0900 Subject: [PATCH 8/9] #48 Added a period. Co-authored-by: Anders Askeland --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a5e1f6a..ba3a623 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # admiralmetabolic 0.1.0 -- Initial package release mainly focused on obesity therapeutic area +- Initial package release mainly focused on obesity therapeutic area. ## Functions From be3ef0a7d4a9a4a4f1f6b95dccf0eff1a907df38 Mon Sep 17 00:00:00 2001 From: Shunsuke Goto Date: Wed, 18 Dec 2024 02:42:11 +0000 Subject: [PATCH 9/9] #48 updated description. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index c440ab9..1d7f1dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: admiralmetabolic Title: Metabolism Extension Package for ADaM in 'R' Asset Library -Version: 0.0.0 +Version: 0.1.0 Authors@R: c( person("Edoardo", "Mancini", , "edoardo.mancini@roche.com", role = c("aut", "cre")), person("Anders", "Askeland", , "iakd@novonordisk.com", role = "aut")