Skip to content

Commit

Permalink
Closes #244 Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, r…
Browse files Browse the repository at this point in the history
…eplacing look-up table with derive_vars_merged() (#256)

* feat: #244 Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, replacing look-up table with derive_vars_merged()

feat: #247 Used call_derivation with derive_vars_crit_flag() to generate CRITy conditions and CRITyFL flags, superseding derive_var_bcvacritxfl()

* Closes #244 Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, replacing look-up table with derive_vars_merged()

* Closes #244 Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, replacing look-up table with derive_vars_merged()

* Closes 244 Updating admiralophtha documentation

* Closes #244 Update header to include documentation on using derive_vars_merged() in adbcva_crtflag dataframe with derive_vars_cat() to derive AVALCA1N and AVALCAT1 in ADBCVA template

* Closes #244 Used derive_vars_cat() to derive AVALCA1N and AVALCAT1, replacing look-up table with derive_vars_merged()

* Closes #244 Add authorship

* Closes #244 Added derive_vars_cat() used in ADBCVA template

* Closes 244 Add authorship

* Closes 244 Add derive_vars_cat used in ADBCVA template

* Closes 244 Added email

* Closes 244 Added email

* #244 try adding cli to imports to fix failing checks

* Closes 244 Added get_admiral_option to admiral package

* Closes 244 Used `derive_vars_cat` to derive AVALCA1N and AVALCAT1, replacing look-up table with `derive_vars_merged`

* Update NEWS.md

Co-authored-by: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com>

* Update vignettes/adbcva.Rmd

Co-authored-by: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com>

* Update vignettes/adbcva.Rmd

Co-authored-by: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com>

* Update vignettes/adbcva.Rmd

Co-authored-by: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com>

* Closes 244 Updated under admiralophtha 1.1.0.9007 on changes to ADBCVA template to use `admiral::derive_vars_cat()` to derive `AVALCA1N` and `AVALCAT1`

* Closes 244 Updated for documentation under admiralophtha 1.1.0.9007 for use of new function `admiral::derive_vars_cat()` to derive `AVALCA1N` and `AVALCAT1` in ADBCVA template

* Update NEWS.md

---------

Co-authored-by: Edoardo Mancini <edoardo.mancini@roche.com>
Co-authored-by: Edoardo Mancini <53403957+manciniedoardo@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent 487d4df commit 470a94c
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 224 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Authors@R: c(
person("Rachel", "Linacre", , "rachel.linacre@roche.com", role = "aut"),
person("Lucy", "Palmen", , "lucy.palmen@roche.com", role = "aut"),
person("Nandini", "R Thampi", , "nandini.rajendhiran@novartis.com", role = "aut"),
person("Aldrich", "Salva", , "salva.aldrich@gene.com", role = "aut")
person("Aldrich", "Salva", , "salva.aldrich@gene.com", role = "aut"),
person("Steven", "Ting", , "steven.ting@cytel.com", role = "aut")
)
Description: Aids the programming of Clinical Data Standards Interchange
Consortium (CDISC) compliant Ophthalmology Analysis Data Model (ADaM)
Expand All @@ -34,6 +35,7 @@ Depends:
Imports:
admiral (>= 1.1.1),
admiraldev (>= 1.1.0),
cli (>= 3.6.2),
dplyr (>= 1.0.5),
hms (>= 0.5.3),
lifecycle (>= 0.1.0),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export(derive_var_afeye)
export(derive_var_bcvacritxfl)
export(derive_var_studyeye)
importFrom(admiral,derive_param_computed)
importFrom(admiral,derive_vars_cat)
importFrom(admiral,derive_vars_merged)
importFrom(admiral,get_admiral_option)
importFrom(admiral,params)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# admiralophtha 1.1.0.9007

## Updates to Templates

- Within the ADBCVA template, updated `AVALCA1N` and `AVALCAT1` derivations to use new function `admiral::derive_vars_cat()`. (#244)

## Updates to Documentation

- Within the ADBCVA vignette, updated `AVALCA1N` and `AVALCAT1` derivations to use new function `admiral::derive_vars_cat()`. (#244)

## Updates to Functions

- The following function arguments of `derive_var_afeye()` are removed following the end of their deprecation cycle (#237):
Expand Down
2 changes: 1 addition & 1 deletion R/admiralophtha-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @importFrom hms as_hms
#' @importFrom lifecycle deprecate_warn deprecated deprecate_stop
#' @importFrom admiral derive_vars_merged restrict_derivation params derive_param_computed
#' get_admiral_option
#' derive_vars_cat get_admiral_option
#' @importFrom admiraldev assert_symbol assert_data_frame expect_dfs_equal assert_data_frame
#' assert_character_vector assert_character_scalar assert_integer_scalar
#' assert_numeric_vector assert_vars expr_c vars2chr
Expand Down
122 changes: 28 additions & 94 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,117 +1,51 @@
ABLFL
ADBCVA
ADIOP
ADOE
ADQS
ADSL
AE
ADVFQ
ADXX
ADaM
ADaMs
AFEYE
ASEQ
AVAL
AVALC
AVISIT
AVISITN
AE
AVALCA
AVALCAT
BCVA
BDS
Biologics
CDISC
CRITx
CRITxFL
ETDRS
FBCVA
FOCID
Laterality
AVALCATx
AVALCAxN
CMD
Changelog
dataset
datasets
DM
LogMAR
ORCID
QS
VFQ
Edoardo
Farrugia
Palmen
Linacre
GSK
Hoch
LinkedIn
Onboarding
README
Recoded
SBCVA
SDTM
TAs
Template'
USUBJIDs
adae
adam
adamig
admiraltemplate
admiralxxx
adsl
Snellen
Thampi
VFQ
adbcva
anonymized
cdisc
dev
github
adoe
advfq
al
basetypes
categorisation
crtflag
doi
eg
et
https
onboarding
paramcds
pharmaverse
repo
studyeye
tribble
sc
www
xxLOC
xxLAT
laterality
afeye
logMAR
LogMAR
Nandini
Occurence
PARAMCD
PCHG
QSTESTCD
SCTESTCD
SDTM
STUDYEYE
Thampi
USUBJID
intraocular
laterality
logMAR
masse
pharmaverse
programmatically
recode
recoded
recoding
scrutinise
th
v
basetype
basetypes
BDS
categorisation
eg
EXLAT
EXLOC
Snellen
toolset
lookup
ADQS
recode
masse
programmatically
intraocular
scrutinise
DTYPE
OEDTC
OEDY
ORCID
VISITNUM
NEI
al
doi
et
ADIOP
OE
adoe
advfq
112 changes: 50 additions & 62 deletions inst/templates/ad_adbcva.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,66 +38,54 @@ param_lookup <- tibble::tribble(
"VACSCORE", "BEST CORRECTED VISUAL ACUITY", "OVERALL EVALUATION", "Fellow Eye", "FBCVA", "Fellow Eye Visual Acuity Score (letters)", 2, # nolint
)

# Assign AVALCAT1
avalcat_lookup <- tibble::tribble(
~PARAMCD, ~AVALCA1N, ~AVALCAT1,
"SBCVA", 1000, "< 20/800",
"SBCVA", 800, "20/800",
"SBCVA", 640, "20/640",
"SBCVA", 500, "20/500",
"SBCVA", 400, "20/400",
"SBCVA", 320, "20/320",
"SBCVA", 250, "20/250",
"SBCVA", 200, "20/200",
"SBCVA", 160, "20/160",
"SBCVA", 125, "20/125",
"SBCVA", 100, "20/100",
"SBCVA", 80, "20/80",
"SBCVA", 63, "20/63",
"SBCVA", 50, "20/50",
"SBCVA", 40, "20/40",
"SBCVA", 32, "20/32",
"SBCVA", 25, "20/25",
"SBCVA", 20, "20/20",
"SBCVA", 16, "20/16",
"SBCVA", 12, "20/12",
"SBCVA", 1, "> 20/12",
# SBCVA and FBCVA definition list
# This can be sourced from a separate R script
definition_bcva <- exprs(
~PARAMCD, ~condition, ~AVALCA1N, ~AVALCAT1,
"SBCVA", AVAL >= 0 & AVAL <= 3, 1000, "< 20/800",
"FBCVA", AVAL >= 0 & AVAL <= 3, 1000, "< 20/800",
"SBCVA", AVAL >= 4 & AVAL <= 8, 800, "20/800",
"FBCVA", AVAL >= 4 & AVAL <= 8, 800, "20/800",
"SBCVA", AVAL >= 9 & AVAL <= 13, 640, "20/640",
"FBCVA", AVAL >= 9 & AVAL <= 13, 640, "20/640",
"SBCVA", AVAL >= 14 & AVAL <= 18, 500, "20/500",
"FBCVA", AVAL >= 14 & AVAL <= 18, 500, "20/500",
"SBCVA", AVAL >= 19 & AVAL <= 23, 400, "20/400",
"FBCVA", AVAL >= 19 & AVAL <= 23, 400, "20/400",
"SBCVA", AVAL >= 24 & AVAL <= 28, 320, "20/320",
"FBCVA", AVAL >= 24 & AVAL <= 28, 320, "20/320",
"SBCVA", AVAL >= 29 & AVAL <= 33, 250, "20/250",
"FBCVA", AVAL >= 29 & AVAL <= 33, 250, "20/250",
"SBCVA", AVAL >= 34 & AVAL <= 38, 200, "20/200",
"FBCVA", AVAL >= 34 & AVAL <= 38, 200, "20/200",
"SBCVA", AVAL >= 39 & AVAL <= 43, 160, "20/160",
"FBCVA", AVAL >= 39 & AVAL <= 43, 160, "20/160",
"SBCVA", AVAL >= 44 & AVAL <= 48, 125, "20/125",
"FBCVA", AVAL >= 44 & AVAL <= 48, 125, "20/125",
"SBCVA", AVAL >= 49 & AVAL <= 53, 100, "20/100",
"FBCVA", AVAL >= 49 & AVAL <= 53, 100, "20/100",
"SBCVA", AVAL >= 54 & AVAL <= 58, 80, "20/80",
"FBCVA", AVAL >= 54 & AVAL <= 58, 80, "20/80",
"SBCVA", AVAL >= 59 & AVAL <= 63, 63, "20/63",
"FBCVA", AVAL >= 59 & AVAL <= 63, 63, "20/63",
"SBCVA", AVAL >= 64 & AVAL <= 68, 50, "20/50",
"FBCVA", AVAL >= 64 & AVAL <= 68, 50, "20/50",
"SBCVA", AVAL >= 69 & AVAL <= 73, 40, "20/40",
"FBCVA", AVAL >= 69 & AVAL <= 73, 40, "20/40",
"SBCVA", AVAL >= 74 & AVAL <= 78, 32, "20/32",
"FBCVA", AVAL >= 74 & AVAL <= 78, 32, "20/32",
"SBCVA", AVAL >= 79 & AVAL <= 83, 25, "20/25",
"FBCVA", AVAL >= 79 & AVAL <= 83, 25, "20/25",
"SBCVA", AVAL >= 84 & AVAL <= 88, 20, "20/20",
"FBCVA", AVAL >= 84 & AVAL <= 88, 20, "20/20",
"SBCVA", AVAL >= 89 & AVAL <= 93, 16, "20/16",
"FBCVA", AVAL >= 89 & AVAL <= 93, 16, "20/16",
"SBCVA", AVAL >= 94 & AVAL <= 97, 12, "20/12",
"FBCVA", AVAL >= 94 & AVAL <= 97, 12, "20/12",
"SBCVA", AVAL >= 98, 1, "> 20/12",
"FBCVA", AVAL >= 98, 1, "> 20/12"
)

# add equivalent rows for PARAMCD = "FBCVA"
avalcat_lookup <- avalcat_lookup %>%
mutate(PARAMCD = "FBCVA") %>%
rbind(avalcat_lookup)

# ---- Utility functions ----

# Format function for AVALCAT1
format_avalcat1n <- function(param, aval) {
case_when(
param %in% c("SBCVA", "FBCVA") & aval >= 0 & aval <= 3 ~ 1000,
param %in% c("SBCVA", "FBCVA") & aval >= 4 & aval <= 8 ~ 800,
param %in% c("SBCVA", "FBCVA") & aval >= 9 & aval <= 13 ~ 640,
param %in% c("SBCVA", "FBCVA") & aval >= 14 & aval <= 18 ~ 500,
param %in% c("SBCVA", "FBCVA") & aval >= 19 & aval <= 23 ~ 400,
param %in% c("SBCVA", "FBCVA") & aval >= 24 & aval <= 28 ~ 320,
param %in% c("SBCVA", "FBCVA") & aval >= 29 & aval <= 33 ~ 250,
param %in% c("SBCVA", "FBCVA") & aval >= 34 & aval <= 38 ~ 200,
param %in% c("SBCVA", "FBCVA") & aval >= 39 & aval <= 43 ~ 160,
param %in% c("SBCVA", "FBCVA") & aval >= 44 & aval <= 48 ~ 125,
param %in% c("SBCVA", "FBCVA") & aval >= 49 & aval <= 53 ~ 100,
param %in% c("SBCVA", "FBCVA") & aval >= 54 & aval <= 58 ~ 80,
param %in% c("SBCVA", "FBCVA") & aval >= 59 & aval <= 63 ~ 63,
param %in% c("SBCVA", "FBCVA") & aval >= 64 & aval <= 68 ~ 50,
param %in% c("SBCVA", "FBCVA") & aval >= 69 & aval <= 73 ~ 40,
param %in% c("SBCVA", "FBCVA") & aval >= 74 & aval <= 78 ~ 32,
param %in% c("SBCVA", "FBCVA") & aval >= 79 & aval <= 83 ~ 25,
param %in% c("SBCVA", "FBCVA") & aval >= 84 & aval <= 88 ~ 20,
param %in% c("SBCVA", "FBCVA") & aval >= 89 & aval <= 93 ~ 16,
param %in% c("SBCVA", "FBCVA") & aval >= 94 & aval <= 97 ~ 12,
param %in% c("SBCVA", "FBCVA") & aval >= 98 ~ 1
)
}

# ---- Derivations ----

# Get list of ADSL vars required for derivations
Expand Down Expand Up @@ -294,12 +282,12 @@ adbcva_crtflag <- adbcva_adsl %>%
filter = PARAMCD %in% c("SBCVA", "FBCVA")
) %>%
# Add AVALCATx variables
mutate(AVALCA1N = format_avalcat1n(param = PARAMCD, aval = AVAL)) %>%
derive_vars_merged(
avalcat_lookup,
by = exprs(PARAMCD, AVALCA1N)
derive_vars_cat(
definition = definition_bcva,
by_vars = exprs(PARAMCD)
)


# Final Steps, Select final variables and Add labels
# This process will be based on your metadata, no example given for this reason
# ...
Expand Down
1 change: 1 addition & 0 deletions man/admiralophtha-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 470a94c

Please sign in to comment.