From 40ae2f3a076662bb856c0d76d9e7f2c94bdbfb22 Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Thu, 24 Oct 2024 10:43:27 +0000 Subject: [PATCH 01/10] Closes #39: CoEQ test data --- R/data.R | 10 ++++ data-raw/qs_metabolic.R | 102 ++++++++++++++++++++++++++++++++++++++++ data/qs_metabolic.rda | Bin 0 -> 3617 bytes man/qs_metabolic.Rd | 22 +++++++++ 4 files changed, 134 insertions(+) create mode 100644 data-raw/qs_metabolic.R create mode 100644 data/qs_metabolic.rda create mode 100644 man/qs_metabolic.Rd diff --git a/R/data.R b/R/data.R index d44d3db..0cfc8f3 100644 --- a/R/data.R +++ b/R/data.R @@ -11,3 +11,13 @@ #' #' @source Constructed using `vs` from the `{pharmaversesdtm}` package and `dm_metabolic` from `{admiralmetabolic}` package "vs_metabolic" + +#' Example questionnaire dataset +#' +#' An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. Note that University +#' of Leeds are the copyright holders of the CoEQ and the test data included within `{admiralmetabolic}`is for not-for-profit use only. 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). +#' +#' @source Constructed using `dm_metabolic` from `{admiralmetabolic}` package +"qs_metabolic" diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R new file mode 100644 index 0000000..640f898 --- /dev/null +++ b/data-raw/qs_metabolic.R @@ -0,0 +1,102 @@ +#' Dataset: qs_metabolic +#' Description: Create QS test SDTM dataset for metabolic studies, +#' containing COEQ data (Control of Eating Questionnaire) +#' Note that University of Leeds are the copyright holders of the CoEQ and the test data included within +#' `{admiralmetabolic}`is for not-for-profit use only. 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). + +# Load libraries ---- + +library(tibble) +library(dplyr) +library(pharmaversesdtm) +library(purrr) + +# Set seed for random data generation ---- +set.seed(3.14159265) + +# Read input data ---- + +vs_metabolic <- admiralmetabolic::vs_metabolic + +# Set up questions, codes and categories ---- +coeq_structure <- tibble::tribble( + ~QSCAT, ~QSSCAT, ~QSTESTCD, ~QSTEST, + "COEQ", "EATING", "COEQ01", "How hungry have you felt?", + "COEQ", "EATING", "COEQ02", "How full have you felt?", + "COEQ", "EATING", "COEQ03", "How strong was your desire to eat sweet foods?", + "COEQ", "EATING", "COEQ04", "How strong was your desire to eat savoury foods?", + "COEQ", "EMOTIONS", "COEQ05", "How happy have you felt?", + "COEQ", "EMOTIONS", "COEQ06", "How anxious have you felt?", + "COEQ", "EMOTIONS", "COEQ07", "How alert have you felt?", + "COEQ", "EMOTIONS", "COEQ08", "How contented have you felt?", + "COEQ", "GENERAL CRAVINGS", "COEQ09", "During the last 7 days how often have you had food cravings?", + "COEQ", "GENERAL CRAVINGS", "COEQ10", "How strong have any food cravings been?", + "COEQ", "GENERAL CRAVINGS", "COEQ11", "How difficult has it been to resist any food cravings?", + "COEQ", "GENERAL CRAVINGS", "COEQ12", "How often have you eaten in response to food cravings?", + "COEQ", "GENERAL CRAVINGS", "COEQ13", "Chocolate or chocolate flavoured foods", + "COEQ", "SPECIFIC CRAVINGS", "COEQ14", "Other sweet foods (cakes, pastries, biscuits, etc)", + "COEQ", "SPECIFIC CRAVING", "COEQ15", "Fruit or fruit juice", + "COEQ", "SPECIFIC CRAVING", "COEQ16", "Dairy foods (cheese, yoghurts, milk, etc)", + "COEQ", "SPECIFIC CRAVING", "COEQ17", "Starchy foods (bread, rice, pasta, etc)", + "COEQ", "SPECIFIC CRAVING", "COEQ18", "Savoury foods (french fries, crisps, burgers, pizza, etc)", + "COEQ", "CONTROL EATING", "COEQ19", "Generally, how difficult has it been to control your eating?", + "COEQ", "CONTROL EATING", "COEQ20", "Which one food makes it most difficult for you to control eating?", + "COEQ", "CONTROL EATING", "COEQ21", "How difficult has it been to resist eating this food during the last 7 days?", +) + +# Use visit schedule and days from VS ---- +visit_schedule <- vs_metabolic %>% + select(STUDYID, USUBJID, VISIT, VISITNUM, VISITDY, VSDTC, VSDY) %>% + filter(!grepl("AMBUL|RETRIEVAL", VISIT)) %>% + rename(QSDTC = VSDTC, QSDY = VSDY) %>% + distinct() + +# Cross join to get questions at each visit ---- +qs_metabolic_shell <- visit_schedule %>% + dplyr::cross_join(coeq_structure) + +# Simulate question answers ---- +qs_metabolic_results <- qs_metabolic_shell %>% + mutate( + DOMAIN = "QS", + QSORRES = floor(runif(1) * 10) + round(runif(1)), + QSORRESU = "cm", + QSSTRESU = "cm", + QSSTRESN = QSORRES, + QSSTRESC = as.character(QSORRES), + QSBLFL = ifelse(VISIT == "BASELINE", "Y", NA_character_) + ) + +# Order variables, sort and add sequence number ---- +qs_metabolic_seq <- qs_metabolic_results %>% + select(STUDYID, USUBJID, DOMAIN, VISIT, VISITNUM, VISITDY, QSBLFL, QSDTC, QSDY, + QSCAT, QSSCAT, QSTEST, QSTESTCD, QSORRES, QSORRESU, QSSTRESC, QSSTRESN, QSSTRESU) %>% + arrange(STUDYID, USUBJID, VISITNUM, QSTESTCD) %>% + group_by(USUBJID) %>% + mutate(QSSEQ = row_number()) %>% + ungroup() + +# Add labels to variables that don't have them yet ---- +attr(qs_metabolic_seq$DOMAIN, "label") <- "Domain Abbreviation" +attr(qs_metabolic_seq$QSBLFL, "label") <- "Baseline Flag" +attr(qs_metabolic_seq$QSCAT, "label") <- "Category for Questionnaire" +attr(qs_metabolic_seq$QSSCAT, "label") <- "Subcategory for Questionnaire" +attr(qs_metabolic_seq$QSTEST, "label") <- "Questionnaire Test Name" +attr(qs_metabolic_seq$QSTESTCD, "label") <- "Questionnaire Test Short Name" +attr(qs_metabolic_seq$QSORRES, "label") <- "Result or Finding in Original Units" +attr(qs_metabolic_seq$QSORRESU, "label") <- "Original Units" +attr(qs_metabolic_seq$QSSTRESC, "label") <- "Character Result/Finding in Std Format" +attr(qs_metabolic_seq$QSSTRESN, "label") <- "Numeric Result/Finding in Standard Units" +attr(qs_metabolic_seq$QSSTRESU, "label") <- "Standard Units" +attr(qs_metabolic_seq$QSSEQ, "label") <- "Sequence Number" + +# Label QS dataset ---- +attr(qs_metabolic_seq, "label") <- "Questionnaire" + +# Final dataset ---- +qs_metabolic <- qs_metabolic_seq + +# Save dataset ---- +usethis::use_data(qs_metabolic, overwrite = TRUE) diff --git a/data/qs_metabolic.rda b/data/qs_metabolic.rda new file mode 100644 index 0000000000000000000000000000000000000000..90f439d418a01e1aa94143724de7e1f0f275024f GIT binary patch literal 3617 zcmbtXdpy(a`&UZk=v zARlKQjO)zz4<5+(XXxnSLef+fbQDx^sw&5Zh(-eQ;8q=_Bs=Z_y^u#pJ)DkwLD5BF z$ewtt!zn@Gf4BdCz-~9qUHJ)43xgq#3yA^0IW6v?nkOZN2*Fqqn@}{4WfK{ODu!`JOL?x;6OVTLTPSo4xhMobOG>(dJaMc; zK|xW!;8s$Cg09ML7lnQ^U0ofegw_s)q4}GiZno^Qz3xwJWSQUWTkX7iD>aXW+x6fR z7a6-`%N;j4>83eM;nT{?)wiiDt2ORRur(+ZxG!Xty9`gZ(Hkh@nAyHM80@LJfOC3} zeW3VtS29nOoFU*?`yo?j*cF^vC#w$W?);YA>q(zQ1df-l2i3-53!9pIzX{^{v+1AQ z==rEKJJ*z<(Vr--gdG?2=I)|&ogEwYcDN5q%(s-9xb8Yqm0uX^cHhXSoC5bN-?rFI zJ9)#6(%77yd(7*CE4d!9}3X&n+%s zLLMsp2uS?`;-Xi>8vGU-2fw<#E;aTY{~EBm+*20o$BG+XJ2-hS$L~wyhp%mK;ZMu1 z`o+b6|F}E_f8dvBn=0B(JW$7HS!@kGKB%r#7;O<)9=AWa$}32fRc5KwdfC!`vFabm z9~2VxRP)8x^*ZcB@oCRTlP%v)r5HFqiad9FtkIyO<4p%XO!|j&%P^;eW3S}y3^9{0XpxDyX?o~{}s1>)TrYd?{R;@(Z{1dcyrbp zDCP9RzaKpMa!q~F-Cfi9r9mCSnPx&pIcAW%c)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h)Ik$2)ON^%YYS?Hru}`U&(r*Y2Iv>>t)8&7Rr_8N6mbPy9tr~Nt*zLoIAMvc&`Sx S4Db329_es|oc5nD;eP>m1B}Z6 literal 0 HcmV?d00001 diff --git a/man/qs_metabolic.Rd b/man/qs_metabolic.Rd new file mode 100644 index 0000000..403525d --- /dev/null +++ b/man/qs_metabolic.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{qs_metabolic} +\alias{qs_metabolic} +\title{Example questionnaire dataset} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 966 rows and 19 columns. +} +\source{ +Constructed using \code{dm_metabolic} from \code{{admiralmetabolic}} package +} +\usage{ +qs_metabolic +} +\description{ +An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. Note that University +of Leeds are the copyright holders of the CoEQ and the test data included within \code{{admiralmetabolic}}is for not-for-profit use only. Any persons +or companies wanting to use the CoEQ should request a license to do so from the following +\href{https://licensing.leeds.ac.uk/product/control-of-eating-questionnaire-coeq}{link}. +} +\keyword{datasets} From 50e85e7600f741f68028d76573bac8dbd2c5390e Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Thu, 24 Oct 2024 10:46:45 +0000 Subject: [PATCH 02/10] #39 chore: styler updates --- data-raw/qs_metabolic.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index 640f898..6721998 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -25,7 +25,7 @@ coeq_structure <- tibble::tribble( ~QSCAT, ~QSSCAT, ~QSTESTCD, ~QSTEST, "COEQ", "EATING", "COEQ01", "How hungry have you felt?", "COEQ", "EATING", "COEQ02", "How full have you felt?", - "COEQ", "EATING", "COEQ03", "How strong was your desire to eat sweet foods?", + "COEQ", "EATING", "COEQ03", "How strong was your desire to eat sweet foods?", "COEQ", "EATING", "COEQ04", "How strong was your desire to eat savoury foods?", "COEQ", "EMOTIONS", "COEQ05", "How happy have you felt?", "COEQ", "EMOTIONS", "COEQ06", "How anxious have you felt?", @@ -50,7 +50,7 @@ coeq_structure <- tibble::tribble( visit_schedule <- vs_metabolic %>% select(STUDYID, USUBJID, VISIT, VISITNUM, VISITDY, VSDTC, VSDY) %>% filter(!grepl("AMBUL|RETRIEVAL", VISIT)) %>% - rename(QSDTC = VSDTC, QSDY = VSDY) %>% + rename(QSDTC = VSDTC, QSDY = VSDY) %>% distinct() # Cross join to get questions at each visit ---- @@ -71,8 +71,10 @@ qs_metabolic_results <- qs_metabolic_shell %>% # Order variables, sort and add sequence number ---- qs_metabolic_seq <- qs_metabolic_results %>% - select(STUDYID, USUBJID, DOMAIN, VISIT, VISITNUM, VISITDY, QSBLFL, QSDTC, QSDY, - QSCAT, QSSCAT, QSTEST, QSTESTCD, QSORRES, QSORRESU, QSSTRESC, QSSTRESN, QSSTRESU) %>% + select( + STUDYID, USUBJID, DOMAIN, VISIT, VISITNUM, VISITDY, QSBLFL, QSDTC, QSDY, + QSCAT, QSSCAT, QSTEST, QSTESTCD, QSORRES, QSORRESU, QSSTRESC, QSSTRESN, QSSTRESU + ) %>% arrange(STUDYID, USUBJID, VISITNUM, QSTESTCD) %>% group_by(USUBJID) %>% mutate(QSSEQ = row_number()) %>% From 9eab7836a837ab3336ef03d6d66e0052ded0bb3c Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Thu, 24 Oct 2024 10:52:15 +0000 Subject: [PATCH 03/10] #39 chore: spelling --- inst/WORDLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index d583e2b..dd8fdf0 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -10,6 +10,7 @@ Biologics BMI CDISC Changelog +CoEQ DM Farrugia GSK From e9147ac0f6dd575faa527244d591e003b34c6cf2 Mon Sep 17 00:00:00 2001 From: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:08:30 +0000 Subject: [PATCH 04/10] Apply suggestions from code review #39: implemented suggestions from code review Co-authored-by: Anders Askeland --- data-raw/qs_metabolic.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index 6721998..5b8727a 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -49,13 +49,13 @@ coeq_structure <- tibble::tribble( # Use visit schedule and days from VS ---- visit_schedule <- vs_metabolic %>% select(STUDYID, USUBJID, VISIT, VISITNUM, VISITDY, VSDTC, VSDY) %>% - filter(!grepl("AMBUL|RETRIEVAL", VISIT)) %>% + filter(stringr::str_detect(VISIT, "AMBUL|RETRIEVAL", negate = TRUE)) %>% rename(QSDTC = VSDTC, QSDY = VSDY) %>% distinct() # Cross join to get questions at each visit ---- qs_metabolic_shell <- visit_schedule %>% - dplyr::cross_join(coeq_structure) + cross_join(coeq_structure) # Simulate question answers ---- qs_metabolic_results <- qs_metabolic_shell %>% @@ -66,7 +66,7 @@ qs_metabolic_results <- qs_metabolic_shell %>% QSSTRESU = "cm", QSSTRESN = QSORRES, QSSTRESC = as.character(QSORRES), - QSBLFL = ifelse(VISIT == "BASELINE", "Y", NA_character_) + QSBLFL = if_else(VISIT == "BASELINE", "Y", NA_character_) ) # Order variables, sort and add sequence number ---- From e02efd4d42707bde7157430a29eaca7fed90a566 Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Thu, 24 Oct 2024 12:17:00 +0000 Subject: [PATCH 05/10] #39 updated disclaimer based on review --- R/data.R | 5 +++-- data-raw/qs_metabolic.R | 6 +++--- man/qs_metabolic.Rd | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/R/data.R b/R/data.R index 0cfc8f3..4a70bca 100644 --- a/R/data.R +++ b/R/data.R @@ -14,8 +14,9 @@ #' Example questionnaire dataset #' -#' An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. Note that University -#' of Leeds are the copyright holders of the CoEQ and the test data included within `{admiralmetabolic}`is for not-for-profit use only. Any persons +#' An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. +#' Note that University of Leeds are the copyright holders of the CoEQ and the test data included within {admiralmetabolic} +#' is 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). #' diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index 6721998..dc4a287 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -1,9 +1,9 @@ #' Dataset: qs_metabolic #' Description: Create QS test SDTM dataset for metabolic studies, #' containing COEQ data (Control of Eating Questionnaire) -#' Note that University of Leeds are the copyright holders of the CoEQ and the test data included within -#' `{admiralmetabolic}`is for not-for-profit use only. Any persons or companies wanting to use the CoEQ -#' should request a license to do so from the following +#' Note: the University of Leeds are the copyright holders of the CoEQ and the test data included within {admiralmetabolic} +#' is 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). # Load libraries ---- diff --git a/man/qs_metabolic.Rd b/man/qs_metabolic.Rd index 403525d..fc4aa4f 100644 --- a/man/qs_metabolic.Rd +++ b/man/qs_metabolic.Rd @@ -14,8 +14,9 @@ Constructed using \code{dm_metabolic} from \code{{admiralmetabolic}} package qs_metabolic } \description{ -An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. Note that University -of Leeds are the copyright holders of the CoEQ and the test data included within \code{{admiralmetabolic}}is for not-for-profit use only. Any persons +An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. +Note that University of Leeds are the copyright holders of the CoEQ and the test data included within {admiralmetabolic} +is for not-for-profit use only within \code{{admiralmetabolic}} and \code{pharmaverse}-related examples/documentation. Any persons or companies wanting to use the CoEQ should request a license to do so from the following \href{https://licensing.leeds.ac.uk/product/control-of-eating-questionnaire-coeq}{link}. } From 8ad8aca00c4469f03ae5074f876dfee36b43ca83 Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Thu, 24 Oct 2024 12:19:59 +0000 Subject: [PATCH 06/10] #39 fixed typo in QSSCATSs --- data-raw/qs_metabolic.R | 8 ++++---- data/qs_metabolic.rda | Bin 3617 -> 3600 bytes 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index 42fa536..4ba7d84 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -37,10 +37,10 @@ coeq_structure <- tibble::tribble( "COEQ", "GENERAL CRAVINGS", "COEQ12", "How often have you eaten in response to food cravings?", "COEQ", "GENERAL CRAVINGS", "COEQ13", "Chocolate or chocolate flavoured foods", "COEQ", "SPECIFIC CRAVINGS", "COEQ14", "Other sweet foods (cakes, pastries, biscuits, etc)", - "COEQ", "SPECIFIC CRAVING", "COEQ15", "Fruit or fruit juice", - "COEQ", "SPECIFIC CRAVING", "COEQ16", "Dairy foods (cheese, yoghurts, milk, etc)", - "COEQ", "SPECIFIC CRAVING", "COEQ17", "Starchy foods (bread, rice, pasta, etc)", - "COEQ", "SPECIFIC CRAVING", "COEQ18", "Savoury foods (french fries, crisps, burgers, pizza, etc)", + "COEQ", "SPECIFIC CRAVINGS", "COEQ15", "Fruit or fruit juice", + "COEQ", "SPECIFIC CRAVINGS", "COEQ16", "Dairy foods (cheese, yoghurts, milk, etc)", + "COEQ", "SPECIFIC CRAVINGS", "COEQ17", "Starchy foods (bread, rice, pasta, etc)", + "COEQ", "SPECIFIC CRAVINGS", "COEQ18", "Savoury foods (french fries, crisps, burgers, pizza, etc)", "COEQ", "CONTROL EATING", "COEQ19", "Generally, how difficult has it been to control your eating?", "COEQ", "CONTROL EATING", "COEQ20", "Which one food makes it most difficult for you to control eating?", "COEQ", "CONTROL EATING", "COEQ21", "How difficult has it been to resist eating this food during the last 7 days?", diff --git a/data/qs_metabolic.rda b/data/qs_metabolic.rda index 90f439d418a01e1aa94143724de7e1f0f275024f..651a1ffb9822bd811dd5ad6d3ed1c1d0890a9b0b 100644 GIT binary patch literal 3600 zcmbtVdpy(o|6d%64<}(8I(5vkVQn)^5uGyWn7eH+yQOp0D@o^?Eq!#Ms;8bRi3Gp(~I6*Cd zj6opE84x|)e^&^5!cK5VouFv{8()tQtjAV7qcV#Qfj%)%1sk%-L)RL65Dc z$2MmxbJb2~C@#sqzGdXpyfR1mZW#e^V zM#9rXNPOU%z*SYr3%^?C^?lw^=)uS3LA|I`%c72rNj2Y(pLbe@tWj+{Ft&YaKEoUD z-99$y^#4?vSXdH`e|p`X7fOD11vgN)pS7ic(sXw&-{^Zl>9d;3$)Ig-3ZU_^WSR5U z%nJkO(0Wdey{OX=IniAq&QnKToijiwOa2Ho*=$u`>;W#)7muem7o zI%eFI73jGuG!vTIDH^GcQTnm>mU=1&_&w6B&LP^x`08S!@0-tmmFETMCW5bzAL@0I z!V74P@prbQ5Z=5)x=k_WM&G8`{^icDc|5&p(Oa|1hPPondZTX@(ZFZZx&D$3U z8@&c&BtcjA;CoBfygN)$9lRum$A2F8CBALCV`|*aO8~k8{8N}~u%Q4(Qu)&PssKhx z*t^2n^ECnUy^GI)QPZe^#oo7n8!lrUTZnO5ms*(dFueEuAcr$rqL#%3*de#YM6ID# zgWD?4eau)&@`?nj1*?09nhyFIy9N)jt!0K$JBkr5|)+ch%Xug`#!(znnwszOU+oUwVIF z_CjGiB8Irei}UDd@Q=lXe=bu}DzEjflFhoYnr z$TPpDpIO<8E{#)!8ks1Y9Uq!Am^Y9*_^j?nx)lhHYU{{6&$HHfZeuq<<*qApa<$3ie!;pKtP%35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3?jYa^Fq zJ}CSjI60^&%T4$;ESiSV1=GFpeSE)0Iw-=x3>Dee2;gS}-s0w;=&D33U!$+pJZWeqmEGa0)I@6oy0R`|lSs?3~yj`zWWK$H1gdRjO3|n%H zV(`=Rwoz0Yhdx=%o0&7h7-7r|Qy48HJOn$)wJU}RJN#)FS3%Yu8wZ+Sf`esECMg~B z0kd}pJ?bF-CD@ZGZS-9$g>7cl;9n*b`|EoDO1e!W##=@hzvA9>JAbLYM8x0DBUGC( ziAhF>gKh-oGhij+ni1I_bO}(%nf=?3_G@t~ R@a{k1F;0ibng98h{U5Z-a2Wsq From e1c3899a00f93c8dafe181f5ca0bedba7e1a867d Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Thu, 24 Oct 2024 12:28:30 +0000 Subject: [PATCH 07/10] #39 fixed typo in data.R --- R/data.R | 2 +- man/qs_metabolic.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/data.R b/R/data.R index 4a70bca..26b7c43 100644 --- a/R/data.R +++ b/R/data.R @@ -14,7 +14,7 @@ #' Example questionnaire dataset #' -#' An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. +#' An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, CoEQ, test data) for metabolic studies. #' Note that University of Leeds are the copyright holders of the CoEQ and the test data included within {admiralmetabolic} #' is 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 diff --git a/man/qs_metabolic.Rd b/man/qs_metabolic.Rd index fc4aa4f..51cbb91 100644 --- a/man/qs_metabolic.Rd +++ b/man/qs_metabolic.Rd @@ -14,7 +14,7 @@ Constructed using \code{dm_metabolic} from \code{{admiralmetabolic}} package qs_metabolic } \description{ -An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, COEQ, test data) for metabolic studies. +An example questionnaire SDTM dataset (containing Control of Eating Questionnaire, CoEQ, test data) for metabolic studies. Note that University of Leeds are the copyright holders of the CoEQ and the test data included within {admiralmetabolic} is for not-for-profit use only within \code{{admiralmetabolic}} and \code{pharmaverse}-related examples/documentation. Any persons or companies wanting to use the CoEQ should request a license to do so from the following From c1a9d3d566c424721fd52d62913087e24e6bbbac Mon Sep 17 00:00:00 2001 From: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com> Date: Wed, 30 Oct 2024 08:11:21 +0000 Subject: [PATCH 08/10] Apply suggestions from code review Co-authored-by: Anders Askeland --- data-raw/qs_metabolic.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index 4ba7d84..d4e0fab 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -12,6 +12,7 @@ library(tibble) library(dplyr) library(pharmaversesdtm) library(purrr) +library(stringr) # Set seed for random data generation ---- set.seed(3.14159265) @@ -49,7 +50,7 @@ coeq_structure <- tibble::tribble( # Use visit schedule and days from VS ---- visit_schedule <- vs_metabolic %>% select(STUDYID, USUBJID, VISIT, VISITNUM, VISITDY, VSDTC, VSDY) %>% - filter(stringr::str_detect(VISIT, "AMBUL|RETRIEVAL", negate = TRUE)) %>% + filter(str_detect(VISIT, "AMBUL|RETRIEVAL", negate = TRUE)) %>% rename(QSDTC = VSDTC, QSDY = VSDY) %>% distinct() From cd11cf7ae84fa7225e76571fbcf71f4b98bbbdf6 Mon Sep 17 00:00:00 2001 From: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:07:48 +0000 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Andrii Yurovskyi --- data-raw/qs_metabolic.R | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index d4e0fab..9a84e4f 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -62,7 +62,7 @@ qs_metabolic_shell <- visit_schedule %>% qs_metabolic_results <- qs_metabolic_shell %>% mutate( DOMAIN = "QS", - QSORRES = floor(runif(1) * 10) + round(runif(1)), + QSORRES = round(runif(n(), min = 0, max = 100)), QSORRESU = "cm", QSSTRESU = "cm", QSSTRESN = QSORRES, @@ -82,21 +82,27 @@ qs_metabolic_seq <- qs_metabolic_results %>% ungroup() # Add labels to variables that don't have them yet ---- -attr(qs_metabolic_seq$DOMAIN, "label") <- "Domain Abbreviation" -attr(qs_metabolic_seq$QSBLFL, "label") <- "Baseline Flag" -attr(qs_metabolic_seq$QSCAT, "label") <- "Category for Questionnaire" -attr(qs_metabolic_seq$QSSCAT, "label") <- "Subcategory for Questionnaire" -attr(qs_metabolic_seq$QSTEST, "label") <- "Questionnaire Test Name" -attr(qs_metabolic_seq$QSTESTCD, "label") <- "Questionnaire Test Short Name" -attr(qs_metabolic_seq$QSORRES, "label") <- "Result or Finding in Original Units" -attr(qs_metabolic_seq$QSORRESU, "label") <- "Original Units" -attr(qs_metabolic_seq$QSSTRESC, "label") <- "Character Result/Finding in Std Format" -attr(qs_metabolic_seq$QSSTRESN, "label") <- "Numeric Result/Finding in Standard Units" -attr(qs_metabolic_seq$QSSTRESU, "label") <- "Standard Units" -attr(qs_metabolic_seq$QSSEQ, "label") <- "Sequence Number" +labels <- list( + DOMAIN = "Domain Abbreviation", + QSBLFL = "Baseline Flag", + QSCAT = "Category for Questionnaire", + QSSCAT = "Subcategory for Questionnaire", + QSTEST = "Questionnaire Test Name", + QSTESTCD = "Questionnaire Test Short Name", + QSORRES = "Result or Finding in Original Units", + QSORRESU = "Original Units", + QSSTRESC = "Character Result/Finding in Std Format", + QSSTRESN = "Numeric Result/Finding in Standard Units", + QSSTRESU = "Standard Units", + QSSEQ = "Sequence Number" +) + +for (var in names(labels)) { + attr(qs_metabolic_seq[[var]], "label") <- labels[[var]] +} # Label QS dataset ---- -attr(qs_metabolic_seq, "label") <- "Questionnaire" +attr(qs_metabolic_seq, "label") <- "Questionnaires" # Final dataset ---- qs_metabolic <- qs_metabolic_seq From 8f3d5f0d57ac3b3b12c19a65c16581e67662937a Mon Sep 17 00:00:00 2001 From: Edoardo Mancini Date: Mon, 4 Nov 2024 17:21:22 +0000 Subject: [PATCH 10/10] #39 updates following review --- data-raw/qs_metabolic.R | 74 +++++++++++++++++++++++----------------- data/qs_metabolic.rda | Bin 3600 -> 6255 bytes man/qs_metabolic.Rd | 2 +- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/data-raw/qs_metabolic.R b/data-raw/qs_metabolic.R index 9a84e4f..acefe61 100644 --- a/data-raw/qs_metabolic.R +++ b/data-raw/qs_metabolic.R @@ -10,8 +10,6 @@ library(tibble) library(dplyr) -library(pharmaversesdtm) -library(purrr) library(stringr) # Set seed for random data generation ---- @@ -23,28 +21,28 @@ vs_metabolic <- admiralmetabolic::vs_metabolic # Set up questions, codes and categories ---- coeq_structure <- tibble::tribble( - ~QSCAT, ~QSSCAT, ~QSTESTCD, ~QSTEST, - "COEQ", "EATING", "COEQ01", "How hungry have you felt?", - "COEQ", "EATING", "COEQ02", "How full have you felt?", - "COEQ", "EATING", "COEQ03", "How strong was your desire to eat sweet foods?", - "COEQ", "EATING", "COEQ04", "How strong was your desire to eat savoury foods?", - "COEQ", "EMOTIONS", "COEQ05", "How happy have you felt?", - "COEQ", "EMOTIONS", "COEQ06", "How anxious have you felt?", - "COEQ", "EMOTIONS", "COEQ07", "How alert have you felt?", - "COEQ", "EMOTIONS", "COEQ08", "How contented have you felt?", - "COEQ", "GENERAL CRAVINGS", "COEQ09", "During the last 7 days how often have you had food cravings?", - "COEQ", "GENERAL CRAVINGS", "COEQ10", "How strong have any food cravings been?", - "COEQ", "GENERAL CRAVINGS", "COEQ11", "How difficult has it been to resist any food cravings?", - "COEQ", "GENERAL CRAVINGS", "COEQ12", "How often have you eaten in response to food cravings?", - "COEQ", "GENERAL CRAVINGS", "COEQ13", "Chocolate or chocolate flavoured foods", - "COEQ", "SPECIFIC CRAVINGS", "COEQ14", "Other sweet foods (cakes, pastries, biscuits, etc)", - "COEQ", "SPECIFIC CRAVINGS", "COEQ15", "Fruit or fruit juice", - "COEQ", "SPECIFIC CRAVINGS", "COEQ16", "Dairy foods (cheese, yoghurts, milk, etc)", - "COEQ", "SPECIFIC CRAVINGS", "COEQ17", "Starchy foods (bread, rice, pasta, etc)", - "COEQ", "SPECIFIC CRAVINGS", "COEQ18", "Savoury foods (french fries, crisps, burgers, pizza, etc)", - "COEQ", "CONTROL EATING", "COEQ19", "Generally, how difficult has it been to control your eating?", - "COEQ", "CONTROL EATING", "COEQ20", "Which one food makes it most difficult for you to control eating?", - "COEQ", "CONTROL EATING", "COEQ21", "How difficult has it been to resist eating this food during the last 7 days?", + ~QSCAT, ~QSTESTCD, ~QSTEST, + "COEQ", "COEQ01", "How hungry have you felt?", + "COEQ", "COEQ02", "How full have you felt?", + "COEQ", "COEQ03", "How strong was your desire to eat sweet foods?", + "COEQ", "COEQ04", "How strong was your desire to eat savoury foods?", + "COEQ", "COEQ05", "How happy have you felt?", + "COEQ", "COEQ06", "How anxious have you felt?", + "COEQ", "COEQ07", "How alert have you felt?", + "COEQ", "COEQ08", "How contented have you felt?", + "COEQ", "COEQ09", "During the last 7 days how often have you had food cravings?", + "COEQ", "COEQ10", "How strong have any food cravings been?", + "COEQ", "COEQ11", "How difficult has it been to resist any food cravings?", + "COEQ", "COEQ12", "How often have you eaten in response to food cravings?", + "COEQ", "COEQ13", "Chocolate or chocolate flavoured foods", + "COEQ", "COEQ14", "Other sweet foods (cakes, pastries, biscuits, etc)", + "COEQ", "COEQ15", "Fruit or fruit juice", + "COEQ", "COEQ16", "Dairy foods (cheese, yoghurts, milk, etc)", + "COEQ", "COEQ17", "Starchy foods (bread, rice, pasta, etc)", + "COEQ", "COEQ18", "Savoury foods (french fries, crisps, burgers, pizza, etc)", + "COEQ", "COEQ19", "Generally, how difficult has it been to control your eating?", + "COEQ", "COEQ20", "Which one food makes it most difficult for you to control eating?", + "COEQ", "COEQ21", "How difficult has it been to resist eating this food during the last 7 days?", ) # Use visit schedule and days from VS ---- @@ -62,19 +60,34 @@ qs_metabolic_shell <- visit_schedule %>% qs_metabolic_results <- qs_metabolic_shell %>% mutate( DOMAIN = "QS", - QSORRES = round(runif(n(), min = 0, max = 100)), - QSORRESU = "cm", - QSSTRESU = "cm", - QSSTRESN = QSORRES, - QSSTRESC = as.character(QSORRES), + QSORRES = as.character(round(runif(n(), min = 0, max = 100))), + QSORRESU = "mm", + QSSTRESU = "mm", + QSSTRESN = as.numeric(QSORRES), + QSSTRESC = QSORRES, QSBLFL = if_else(VISIT == "BASELINE", "Y", NA_character_) + ) %>% + # Update the free text question (COEQ20) + mutate( + QSSTRESC = case_when( + QSTESTCD == "COEQ20" & QSSTRESN < 33 ~ "Ice Cream", + QSTESTCD == "COEQ20" & QSSTRESN < 66 ~ "Pizza", + QSTESTCD == "COEQ20" ~ "Pasta", + TRUE ~ QSSTRESC + ) + ) %>% + mutate( + QSSTRESN = if_else(QSTESTCD == "COEQ20", NA, QSSTRESN), + QSORRES = if_else(QSTESTCD == "COEQ20", QSSTRESC, QSORRES), + QSORRESU = if_else(QSTESTCD == "COEQ20", NA_character_, QSORRESU), + QSSTRESU = if_else(QSTESTCD == "COEQ20", NA_character_, QSSTRESU), ) # Order variables, sort and add sequence number ---- qs_metabolic_seq <- qs_metabolic_results %>% select( STUDYID, USUBJID, DOMAIN, VISIT, VISITNUM, VISITDY, QSBLFL, QSDTC, QSDY, - QSCAT, QSSCAT, QSTEST, QSTESTCD, QSORRES, QSORRESU, QSSTRESC, QSSTRESN, QSSTRESU + QSCAT, QSTEST, QSTESTCD, QSORRES, QSORRESU, QSSTRESC, QSSTRESN, QSSTRESU ) %>% arrange(STUDYID, USUBJID, VISITNUM, QSTESTCD) %>% group_by(USUBJID) %>% @@ -86,7 +99,6 @@ labels <- list( DOMAIN = "Domain Abbreviation", QSBLFL = "Baseline Flag", QSCAT = "Category for Questionnaire", - QSSCAT = "Subcategory for Questionnaire", QSTEST = "Questionnaire Test Name", QSTESTCD = "Questionnaire Test Short Name", QSORRES = "Result or Finding in Original Units", diff --git a/data/qs_metabolic.rda b/data/qs_metabolic.rda index 651a1ffb9822bd811dd5ad6d3ed1c1d0890a9b0b..b2f3f1eb3716e3c6f02db7f01317040308f5d2e1 100644 GIT binary patch literal 6255 zcmai1c~sKr*Qdo&Q8QC8Ez62V5zx$W(xwfi6s(X~WYaJ)$xt)3)nA)mQ?tg5#cWzo zaREg|K*goPauO;P6_-+@(%fy+rfHg9<~`><=l$z_@AsVh-1BVrx%aux{eCW*7UQ>R z7j@$S>MU=Y`+}pf=YIS@^!*j=?9$?n1)v2B;?ILXAZyp1CJxGQU0}Wr4cKjPOREAc z27%oE?F50sU1rzrkz9=F3dt;9ALDeVI4`f~m$LmFThrJ|>!J?OO3~1yJP5S#ASf?nqea?-jkaDZ7C*=a zel01<-5)&iYfMOY|Id3(=kWO-oj#x? z=NGMYwu_mwUc~XeN7}n2?ZCSH; z^_Y9v&ICS^1h5?u6>jcOw=+syI=&?%axgx^kZgtDnZKQVMPt8q zFNJPMLS&mq9!$HjLUN?FTIHU5uzNYE4`k#@LTu{d)~@W zAkp_t5Bc~piD&R!f@-`Ht4!X8g?8C%H>Z-ntW5E;=byQRszI)^xDmb4=-qvCZgus= zmMzKL0t>iV+BwHv3y}bZ$=oP0cic>BNq!04w1(LmyK7tD(a_X!$7k9LUu^=8yD36` zA~Xtxw_uNC0&!=wH;#4c)AVahW6t-J&KC^j&%Eq3=I7sF0d+Sl>aTd>u7>zo^#dS_1SxjXCo+;?3b#W^oyz3$M|xUMQPP5@6!lGqN!$7hgoc{#l<|>)V^1-84dsKG z#JH+KQFM8phcYfPD*)@bZd+!?-1IM#-H#idc(){%Mmhh-Y@RHEN^6^RLW7A9#N$%TiHA9PT7ifM~K z8XV4?;o!UgHb1zpZK-jLZkH}##=_mhr`gywSHEex6xFkklx2@t@!z!18b)S?54v6< zl~nLdYu8h%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