Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
bms63 authored Jan 31, 2024
2 parents a55694d + ee8f651 commit 9375eee
Show file tree
Hide file tree
Showing 27 changed files with 907 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
here
reactable
pharmaversesdtm
metacore
metatools
xportr
pharmaverseadam
- name: Install tinytex
Expand Down
1 change: 1 addition & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ https://pharmaverse.github.io/blog/posts/2023-06-27_hackathon_app/
https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
https://go.appsilon.com/demo-apps
https://doi.org/10.1177/17407745221123244
https://appsilon.com/static/35215a117d1bc17fac2179f059c3709f/rhino_fda_pilot_r_shiny_app_e-ctd.webm
10 changes: 5 additions & 5 deletions R/create_blogpost.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ c(

# Fill in the info, e.g.:
create_post(
post_name = "pharmaverse story", # needs to be character vector (length 1)
post_date = "2023-08-30", # needs to be character vector (length 1)
post_name = "admiral_1_0", # needs to be character vector (length 1)
post_date = "2023-12-18", # needs to be character vector (length 1)
description = "", # you can fill the description in later as well
author = c("Nicholas Eugenio"), # one or more authors are permitted
cover_image = "pharmaverse", # chose one of the above (see line 8)
tags = c("community") # chose (multiple) from line 10
author = c("Ben Straub"), # one or more authors are permitted
cover_image = "new_features", # chose one of the above (see line 8)
tags = c("admiral") # chose (multiple) from line 10
)


Expand Down
1 change: 1 addition & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ format:
html:
theme:
light: [minty, ember.scss]
dark: darkly
#ember.scss
css: styles.css
# include-after-body: plausible.html
Expand Down
98 changes: 98 additions & 0 deletions inst/WORDLIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,101 @@ VSDY
VSORRES
VSSEQ
VSTESTCD
adnca
adppk
ADPPK
AETHNIC
AETHNICN
ARMCD
BILI
BILIBL
bmi
BMIBL
bsa
BSABL
CKD
codelist
COHORTC
COUNTRYL
COUNTRYN
covar
CRCL
CRCLBL
creat
CREAT
CREATBL
creatu
egfr
EGFRBL
EPI
EXDOSFRM
EXROUTE
FORMN
HTBL
labsbl
LBBLFL
LBSTRESN
LBTESTCD
LBTESTCDB
metatools
Mosteller
pc
pharmacokinetic
pharmaverseadam
poppk
preconfigured
RACEN
ROUTEN
SEXN
SITEIDN
STUDYIDN
SUBJID
SUBJIDN
SUBJTYP
SUBJTYPC
TBILBL
USUBJIDN
VSBLFL
vslb
VSSTRESN
WTBL
analytics
Analytics
csp
dS
eventID
frontend
nqJsLSLd
pageID
QHuA
thome
traceRedir
pKobZqjlXChj
si
vehIoJgdA
ABLFL
admiraldisc
admiraldiscovery
advs
AGEU
AVALU
bmi
BMI
BMIBL
CANCTRFL
changelog
cheatsheet
CMCAT
CMSEQ
codebase
DTHFL
ef
EOSDT
LSTALVDT
msrc
onboarding
PRSEQ
TRTEDT
wayback
ABLFL
youtu
Binary file added media/new_features.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions posts/2023-06-27__hackathon_app/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ long_slug <- "2023-06-19_shiny_run_script"


We recently created a shiny application for the [`admiral` hackathon](https://cosa.cdisc.org/events/Admiral) in February 2023.
The [`admiral` hackathon](https://cosa.cdisc.org/events/Admiral) was an event designed to make statistical programmers from the pharmaceutical industry more comfortable with the [`admiral`](https://pharmaverse.github.io/admiral/cran-release/) R package which allows users to efficiently transform data from one data standard (SDTM) to another (ADaM).
The [`admiral` hackathon](https://cosa.cdisc.org/events/Admiral) was an event designed to make statistical programmers from the pharmaceutical industry more comfortable with the [`admiral`](https://pharmaverse.github.io/admiral/) R package which allows users to efficiently transform data from one data standard (SDTM) to another (ADaM).

Hackathon participants formed groups of up to five people and were then tasked to create R-scripts that map the SDTM data to ADaM according to specifics defined in the metadata.

Expand All @@ -32,7 +32,7 @@ The purpose of the shiny app was threefold:
1. Allow participants to easily register as a team.


2. Let participants upload their R-scripts, so that the [`admiral` team](https://github.com/pharmaverse/admiral/graphs/contributors) can see how the [`admiral`](https://pharmaverse.github.io/admiral/cran-release/) package is being used -- and how the functions and the documentation could be improved.
2. Let participants upload their R-scripts, so that the [`admiral` team](https://github.com/pharmaverse/admiral/graphs/contributors) can see how the [`admiral`](https://pharmaverse.github.io/admiral/) package is being used -- and how the functions and the documentation could be improved.


3. Run participants R-scripts on the cloud and compare the produced file to a solution file.
Expand Down
6 changes: 3 additions & 3 deletions posts/2023-06-27_admiral/valuelevel/derive_param_computed.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ options(width = narrow)

When creating ADaM Basic Data Structure (BDS) datasets, we often encounter deriving a new parameter based on the analysis values (e.g., AVAL) of other parameters.

The [`admiral`](https://pharmaverse.github.io/admiral/cran-release/) function [`derive_param_computed()`](https://pharmaverse.github.io/admiral/cran-release/reference/derive_param_computed.html) adds a parameter computed from the analysis value of other parameters.
The [`admiral`](https://pharmaverse.github.io/admiral/) function [`derive_param_computed()`](https://pharmaverse.github.io/admiral/reference/derive_param_computed.html) adds a parameter computed from the analysis value of other parameters.

It works like a calculator to derive new records without worrying about merging and combining datasets, all you need is a derivation formula, which also improves the readability of the code.

Expand Down Expand Up @@ -69,10 +69,10 @@ adex_admiral <- derive_param_computed(
adex,
by_vars = exprs(USUBJID),
parameters = c("TOTDOSE", "NUMCYC"),
analysis_value = AVAL.TOTDOSE / AVAL.NUMCYC,
set_values_to = exprs(
PARAMCD = "ADPCYMG",
PARAM = "Actual Dose per Cycle (mg)"
PARAM = "Actual Dose per Cycle (mg)",
AVAL = AVAL.TOTDOSE / AVAL.NUMCYC
)
)
```
Expand Down
4 changes: 2 additions & 2 deletions posts/2023-07-10_blanks_and_nas/blanks_and_nas.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ to bring in your source data to construct your ADaMs or SDTMs.

Unfortunately, while using [haven](https://haven.tidyverse.org/) the character blanks (missing data) found in a typical SAS-based dataset are left as blanks. These blanks will typically prove problematic while using functions like `is.na` in combination with `dplyr::filter()` to subset data. Check out [Bayer's SAS2R catalog: handling-of-missing-values](https://bayer-group.github.io/sas2r/r-and-sas-syntax.html#handling-of-missing-values) for more discussion on missing values and `NAs`.

In the [admiral](https://pharmaverse.github.io/admiral/cran-release/) package, we have built a simple function called `convert_blanks_to_na()` to help us quickly remedy this problem. You can supply an entire dataframe to this function and it will convert any character blanks to `NA_character_`
In the [admiral](https://pharmaverse.github.io/admiral/) package, we have built a simple function called `convert_blanks_to_na()` to help us quickly remedy this problem. You can supply an entire dataframe to this function and it will convert any character blanks to `NA_character_`

## Loading Packages and Making Dummy Data

Expand Down Expand Up @@ -64,7 +64,7 @@ df_na %>% filter(is.na(RFICDTC))

## That's it!

A simple call to this function can make your derivation life so much easier while working in R if working with SAS-based datasets. In [admiral](https://pharmaverse.github.io/admiral/cran-release/), we make use of this function at the start of all ADaM templates for common ADaM datasets. You can use the function `use_ad_template()` to get the full R script for the below ADaMs.
A simple call to this function can make your derivation life so much easier while working in R if working with SAS-based datasets. In [admiral](https://pharmaverse.github.io/admiral/), we make use of this function at the start of all ADaM templates for common ADaM datasets. You can use the function `use_ad_template()` to get the full R script for the below ADaMs.

```{r}
list_all_templates()
Expand Down
6 changes: 3 additions & 3 deletions posts/2023-07-14_code_sections/code_sections.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ long_slug <- "2023-07-14_code_sections"

## Introduction

The [`admiral`](https://pharmaverse.github.io/admiral/cran-release/) package embraces a modular style of programming, where blocks of code are pieced together in sequence to create an ADaM dataset. However, with the well-documented advantages of the modular approach comes the recognition that scripts will on average be longer. As such, astute programmers working in RStudio are constantly on the lookout for quick ways to effectively navigate their scripts. Enter **code sections**!
The [`admiral`](https://pharmaverse.github.io/admiral/) package embraces a modular style of programming, where blocks of code are pieced together in sequence to create an ADaM dataset. However, with the well-documented advantages of the modular approach comes the recognition that scripts will on average be longer. As such, astute programmers working in RStudio are constantly on the lookout for quick ways to effectively navigate their scripts. Enter **code sections**!

## So, what are code sections and why are they useful?

Expand Down Expand Up @@ -73,7 +73,7 @@ For a complete list of Code Sections shortcuts, and for further information, see

# Code Sections on `admiral`

Within the [`admiral`](https://pharmaverse.github.io/admiral/cran-release/) package, heavy use of code sections is made in scripts such as our template ADaM programs. This ensures that they are more traversable and also encourages good commenting practices throughout the program. Here is an example using the ADAE template program:
Within the [`admiral`](https://pharmaverse.github.io/admiral/) package, heavy use of code sections is made in scripts such as our template ADaM programs. This ensures that they are more traversable and also encourages good commenting practices throughout the program. Here is an example using the ADAE template program:

```{r, eval = FALSE, message = FALSE}
library(admiral)
Expand All @@ -87,7 +87,7 @@ knitr::include_graphics("adae_code_sections.png")
```

## Conclusion
Code sections are an easy way to navigate long scripts and foster good commenting practices. They are used extensively in the [`admiral`](https://pharmaverse.github.io/admiral/cran-release/) package, but there is no reason that you cannot start using them yourself in your day-to-day R programming!
Code sections are an easy way to navigate long scripts and foster good commenting practices. They are used extensively in the [`admiral`](https://pharmaverse.github.io/admiral/) package, but there is no reason that you cannot start using them yourself in your day-to-day R programming!

<!--------------- appendices go here ----------------->

Expand Down
4 changes: 2 additions & 2 deletions posts/2023-08-08_study_day/study_day.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ long_slug <- "2023-08-08_study_day"

<!--------------- post begins here ----------------->

Creating `--DY` variables for your ADaMs is super easy using [`derive_vars_dy()`](https://pharmaverse.github.io/admiral/v0.11.1/reference/derive_vars_dy.html) from the [admiral package](https://pharmaverse.github.io/admiral/cran-release/).
Creating `--DY` variables for your ADaMs is super easy using [`derive_vars_dy()`](https://pharmaverse.github.io/admiral/v0.11.1/reference/derive_vars_dy.html) from the [admiral package](https://pharmaverse.github.io/admiral/).


Let's build some dummy data with 4 subjects, a start date/time for treatment (`TRTSDTM`), an analysis start date/time variable (`ASTDTM`) and an analysis end date variable (`AENDT`).
Expand Down Expand Up @@ -73,7 +73,7 @@ derive_vars_dy(
```


If you want to get `--DT` or `--DTM` variables using `admiral` then check out [`derive_vars_dt()`](https://pharmaverse.github.io/admiral/cran-release/reference/derive_vars_dt.html) and [`derive_vars_dtm()`](https://pharmaverse.github.io/admiral/cran-release/reference/derive_vars_dtm.html). If things are messy in your data, e.g. partial dates, both functions have great imputation abilities, which we will cover in an upcoming blog post!
If you want to get `--DT` or `--DTM` variables using `admiral` then check out [`derive_vars_dt()`](https://pharmaverse.github.io/admiral/reference/derive_vars_dt.html) and [`derive_vars_dtm()`](https://pharmaverse.github.io/admiral/reference/derive_vars_dtm.html). If things are messy in your data, e.g. partial dates, both functions have great imputation abilities, which we will cover in an upcoming blog post!


<!--------------- appendices go here ----------------->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ In this article, we first examine the arsenal of functions provided by`{admiral}
`{admiral}` provides the following functions for date/datetime imputation:

- Derivations for adding variables
- [derive_vars_dt()](https://pharmaverse.github.io/admiral/cran-release/reference/derive_vars_dt.html): Adds a date variable and a date imputation flag variable (optional) based on a --DTC variable and imputation rules.
- [derive_vars_dtm()](https://pharmaverse.github.io/admiral/cran-release/reference/derive_vars_dtm.html): Adds a datetime variable, a date imputation flag variable, and a time imputation flag variable (both optional) based on a --DTC variable and imputation rules.
- [derive_vars_dt()](https://pharmaverse.github.io/admiral/reference/derive_vars_dt.html): Adds a date variable and a date imputation flag variable (optional) based on a --DTC variable and imputation rules.
- [derive_vars_dtm()](https://pharmaverse.github.io/admiral/reference/derive_vars_dtm.html): Adds a datetime variable, a date imputation flag variable, and a time imputation flag variable (both optional) based on a --DTC variable and imputation rules.
- Computation functions
- [impute_dtc_dtm()](https://pharmaverse.github.io/admiral/cran-release/reference/impute_dtc_dtm.html): Returns a complete ISO 8601 datetime or `NA` based on a partial ISO 8601 datetime and imputation rules.
- [impute_dtc_dt()](https://pharmaverse.github.io/admiral/cran-release/reference/impute_dtc_dt.html): Returns a complete ISO 8601 date (without time) or `NA` based on a partial ISO 8601 date(time) and imputation rules.
- [convert_dtc_to_dt()](https://pharmaverse.github.io/admiral/cran-release/reference/convert_dtc_to_dt.html): Returns a date if the input ISO 8601 date is complete. Otherwise, `NA` is returned.
- [convert_dtc_to_dtm()](https://pharmaverse.github.io/admiral/cran-release/reference/convert_dtc_to_dtm.html): Returns a datetime if the input ISO 8601 date is complete (with missing time replaced by `"00:00:00"` as default). Otherwise, NA is returned.
- [compute_dtf()](https://pharmaverse.github.io/admiral/cran-release/reference/compute_dtf.html): Returns the date imputation flag.
- [compute_tmf()](https://pharmaverse.github.io/admiral/cran-release/reference/compute_tmf.html): Returns the time imputation flag.
- [impute_dtc_dtm()](https://pharmaverse.github.io/admiral/reference/impute_dtc_dtm.html): Returns a complete ISO 8601 datetime or `NA` based on a partial ISO 8601 datetime and imputation rules.
- [impute_dtc_dt()](https://pharmaverse.github.io/admiral/reference/impute_dtc_dt.html): Returns a complete ISO 8601 date (without time) or `NA` based on a partial ISO 8601 date(time) and imputation rules.
- [convert_dtc_to_dt()](https://pharmaverse.github.io/admiral/reference/convert_dtc_to_dt.html): Returns a date if the input ISO 8601 date is complete. Otherwise, `NA` is returned.
- [convert_dtc_to_dtm()](https://pharmaverse.github.io/admiral/reference/convert_dtc_to_dtm.html): Returns a datetime if the input ISO 8601 date is complete (with missing time replaced by `"00:00:00"` as default). Otherwise, NA is returned.
- [compute_dtf()](https://pharmaverse.github.io/admiral/reference/compute_dtf.html): Returns the date imputation flag.
- [compute_tmf()](https://pharmaverse.github.io/admiral/reference/compute_tmf.html): Returns the time imputation flag.

From the point of view of a typical ADaM programmer, the functions `impute_*`, `convert_*` and `compute_*` above can be viewed as utilities for treating dates and/or imputation within any custom code. In contrast, their `derive_*` find their use in directly deriving new timing variables and/or carrying out imputation at an ADaM dataset scale.

For a detailed look at the Imputation rules applied by these `{admiral}` functions, please visit [this vignette](https://pharmaverse.github.io/admiral/cran-release/articles/imputation.html#imputation-rules) on the documentation website.
For a detailed look at the Imputation rules applied by these `{admiral}` functions, please visit [this vignette](https://pharmaverse.github.io/admiral/articles/imputation.html#imputation-rules) on the documentation website.

# Simple Examples with Vectors

Expand Down Expand Up @@ -313,7 +313,7 @@ dataset_vignette(vs)

Deriving timing variables and carrying out imputations is tricky at the best of times, but hopefully this blog post can shed some light on how make this all easier using the `{admiral}` package! As `{admiral}` developers we are always interested in knowing how users are employing the package for their ADaM needs, so if you have any comments or feedback related to this topic, don't be afraid to leave a comment on our [Slack channel](https://app.slack.com/client/T028PB489D3/C02M8KN8269) or on the [Github repository](https://github.com/pharmaverse/admiral/), either as an issue or as a discussion.

For an even more detailed treatment of this topic, users are once again invited to read the corresponding [vignette](https://pharmaverse.github.io/admiral/cran-release/articles/imputation.html) on the documentation website, from which this article was adapted.
For an even more detailed treatment of this topic, users are once again invited to read the corresponding [vignette](https://pharmaverse.github.io/admiral/articles/imputation.html) on the documentation website, from which this article was adapted.

<!--------------- appendices go here ----------------->

Expand Down
Loading

0 comments on commit 9375eee

Please sign in to comment.