Skip to content

Commit

Permalink
remove formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Jul 18, 2023
1 parent cadbe69 commit 5f82eb3
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 59 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Suggests:
DescTools,
docopt,
dplyr,
formatters (>= 0.3.4),
ggExtra,
ggpmisc (>= 0.4.3),
ggpp,
Expand Down
52 changes: 26 additions & 26 deletions inst/apps/early-dev/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ options(shiny.useragg = FALSE)
ADSL <- synthetic_cdisc_data("latest")$adsl

Check warning on line 13 in inst/apps/early-dev/app.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / SuperLinter 🦸‍♂️

file=/github/workspace/inst/apps/early-dev/app.R,line=13,col=1,[object_name_linter] Variable and function name style should be snake_case or symbols.

# derive ADSL treatment duration
adsl_labels <- formatters::var_labels(ADSL, fill = FALSE)
adsl_labels <- teal.widgets::formatters_var_labels(ADSL, fill = FALSE)
ADSL <- ADSL %>%

Check warning on line 17 in inst/apps/early-dev/app.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / SuperLinter 🦸‍♂️

file=/github/workspace/inst/apps/early-dev/app.R,line=17,col=1,[object_name_linter] Variable and function name style should be snake_case or symbols.
mutate(
TRTDURD = as.numeric(as.Date(TRTEDTM) - as.Date(TRTSDTM)) + 1,
DTHFL = ifelse(!is.na(DTHDT), "Y", NA),
EOSSTT = factor(EOSSTT, levels = c("COMPLETED", "ONGOING", "DISCONTINUED"))
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
TRTDURD = "Treatment Duration in Days",
DTHFL = "Death Flag",
DCSREAS = "Reason for Study Discontinuation",
EOSSTT = "End of Study Status"
) %>%
droplevels()
formatters::var_labels(ADSL)[c(names(adsl_labels))] <- adsl_labels
teal.widgets::formatters_var_labels(ADSL)[c(names(adsl_labels))] <- adsl_labels

Check warning on line 30 in inst/apps/early-dev/app.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / SuperLinter 🦸‍♂️

file=/github/workspace/inst/apps/early-dev/app.R,line=30,col=37,[object_name_linter] Variable and function name style should be snake_case or symbols.

ADAE <- synthetic_cdisc_data("latest")$adae

Check warning on line 32 in inst/apps/early-dev/app.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / SuperLinter 🦸‍♂️

file=/github/workspace/inst/apps/early-dev/app.R,line=32,col=1,[object_name_linter] Variable and function name style should be snake_case or symbols.

# derive common flags for AEs
adae_labels <- formatters::var_labels(ADAE, fill = FALSE)
adae_labels <- teal.widgets::formatters_var_labels(ADAE, fill = FALSE)
ADAE <- ADAE %>%

Check warning on line 36 in inst/apps/early-dev/app.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / SuperLinter 🦸‍♂️

file=/github/workspace/inst/apps/early-dev/app.R,line=36,col=1,[object_name_linter] Variable and function name style should be snake_case or symbols.
mutate_at(c("AESOC", "AEBODSYS", "AEHLT", "AEDECOD", "AETERM", "AELLT"), as.character) %>%
mutate(
Expand All @@ -45,7 +45,7 @@ ADAE <- ADAE %>%
ASTDT = as.Date(ASTDTM),
AENDT = as.Date(AENDTM)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
RELFL = "Related AE",
CTC35FL = "Grade >=3 AE",
SERFL = "Serious AE",
Expand All @@ -70,7 +70,7 @@ ADCM <- ADCM %>%
ASTDT = as.Date(ASTDTM),
AENDT = as.Date(AENDTM)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
ASTDT = "Analysis Start Date",
AENDT = "Analysis End Date"
)
Expand All @@ -83,15 +83,15 @@ ADEX <- ADEX %>%
ASTDT = as.Date(ASTDTM),
AENDT = as.Date(AENDTM)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
ASTDT = "Analysis Start Date",
AENDT = "Analysis End Date"
)

ADTR <- synthetic_cdisc_data("latest")$adtr

Check warning on line 91 in inst/apps/early-dev/app.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / SuperLinter 🦸‍♂️

file=/github/workspace/inst/apps/early-dev/app.R,line=91,col=1,[object_name_linter] Variable and function name style should be snake_case or symbols.

# process ADTR
adtr_labels <- formatters::var_labels(ADTR, fill = FALSE)
adtr_labels <- teal.widgets::formatters_var_labels(ADTR, fill = FALSE)
ADTR <- ADTR %>%
mutate(
PCHG = ifelse(AVISIT == "BASELINE", 0, PCHG),
Expand All @@ -100,11 +100,11 @@ ADTR <- ADTR %>%
AVALC = ifelse(AVISIT == "BASELINE", as.character(BASE), AVALC)
) %>%
filter(AVISIT != "SCREENING")
formatters::var_labels(ADTR) <- adtr_labels
teal.widgets::formatters_var_labels(ADTR) <- adtr_labels

ADTRWF <- ADTR %>%
filter(AVISIT != "BASELINE")
formatters::var_labels(ADTRWF) <- formatters::var_labels(ADTR, fill = FALSE)
teal.widgets::formatters_var_labels(ADTRWF) <- teal.widgets::formatters_var_labels(ADTR, fill = FALSE)


# process ADRS
Expand All @@ -113,12 +113,12 @@ ADRSSWIM <- synthetic_cdisc_data("latest")$adrs %>%
arrange(USUBJID)

ADRS <- synthetic_cdisc_data("latest")$adrs
adrs_labels <- formatters::var_labels(ADRS, fill = FALSE)
adrs_labels <- teal.widgets::formatters_var_labels(ADRS, fill = FALSE)
ADRS <- ADRS %>%
filter(PARAMCD %in% c("BESRSPI", "INVET")) %>%
mutate(ADT = as.Date(ADTM)) %>%
droplevels()
formatters::var_labels(ADRS) <- c(adrs_labels, "Analysis Date")
teal.widgets::formatters_var_labels(ADRS) <- c(adrs_labels, "Analysis Date")

ADLB <- synthetic_cdisc_data("latest")$adlb

Expand All @@ -128,7 +128,7 @@ ADLB <- ADLB %>%
ADT = as.Date(ADTM),
LBSTRESN = as.numeric(LBSTRESC)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
ADT = "Analysis Date",
LBSTRESN = "Numeric Result/Finding in Standard Units"
)
Expand Down Expand Up @@ -179,7 +179,7 @@ cs_paramcd_tr <- choices_selected(
selected = "SLDINV"
)

adsl_labels <- formatters::var_labels(ADSL)
adsl_labels <- teal.widgets::formatters_var_labels(ADSL)
fact_vars_asl <- names(Filter(isTRUE, sapply(ADSL, is.factor)))

date_vars_asl <- names(ADSL)[vapply(ADSL, function(x) inherits(x, c("Date", "POSIXct", "POSIXlt")), logical(1))]
Expand Down Expand Up @@ -245,21 +245,21 @@ adsl <- cdisc_dataset(
dataname = "ADSL",
x = ADSL,
code = 'ADSL <- synthetic_cdisc_data("latest")$adsl
adsl_labels <- formatters::var_labels(ADSL, fill = FALSE)
adsl_labels <- teal.widgets::formatters_var_labels(ADSL, fill = FALSE)
ADSL <- ADSL %>%
mutate(
TRTDURD = as.numeric(as.Date(TRTEDTM) - as.Date(TRTSDTM)) + 1,
DTHFL = ifelse(!is.na(DTHDT), "Y", NA),
EOSSTT = factor(EOSSTT, levels = c("COMPLETED", "ONGOING", "DISCONTINUED"))
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
TRTDURD = "Treatment Duration in Days",
DTHFL = "Death Flag",
DCSREAS = "Reason for Study Discontinuation",
EOSSTT = "End of Study Status"
) %>%
droplevels()
formatters::var_labels(ADSL)[c(names(adsl_labels))] <- adsl_labels'
teal.widgets::formatters_var_labels(ADSL)[c(names(adsl_labels))] <- adsl_labels'
)

adae <- cdisc_dataset(
Expand All @@ -283,7 +283,7 @@ adae <- cdisc_dataset(
ASTDT = as.Date(ASTDTM),
AENDT = as.Date(AENDTM)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
RELFL = "Related AE",
CTC35FL = "Grade >=3 AE",
SERFL = "Serious AE",
Expand Down Expand Up @@ -311,7 +311,7 @@ adcm <- cdisc_dataset(
ASTDT = as.Date(ASTDTM),
AENDT = as.Date(AENDTM)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
ASTDT = "Analysis Start Date",
AENDT = "Analysis End Date"
)',
Expand All @@ -327,7 +327,7 @@ adex <- cdisc_dataset(
ASTDT = as.Date(ASTDTM),
AENDT = as.Date(AENDTM)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
ASTDT = "Analysis Start Date",
AENDT = "Analysis End Date"
)',
Expand All @@ -339,7 +339,7 @@ adtr <- cdisc_dataset(
x = ADTR,
keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
code = 'ADTR <- synthetic_cdisc_data("latest")$adtr
adtr_labels <- formatters::var_labels(ADTR, fill = FALSE)
adtr_labels <- teal.widgets::formatters_var_labels(ADTR, fill = FALSE)
ADTR <- ADTR %>%
mutate(
PCHG = ifelse(AVISIT == "BASELINE", 0, PCHG),
Expand All @@ -348,7 +348,7 @@ adtr <- cdisc_dataset(
AVALC = ifelse(AVISIT == "BASELINE", as.character(BASE), AVALC)
) %>%
dplyr::filter(AVISIT != "SCREENING")
formatters::var_labels(ADTR) <- adtr_labels',
teal.widgets::formatters_var_labels(ADTR) <- adtr_labels',
var = list(ADSL = adsl)
)

Expand All @@ -358,20 +358,20 @@ adtrwf <- cdisc_dataset(
keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
code = 'ADTRWF <- ADTR %>%
dplyr::filter(AVISIT != "BASELINE")
formatters::var_labels(ADTRWF) <- formatters::var_labels(ADTR, fill = FALSE)',
teal.widgets::formatters_var_labels(ADTRWF) <- teal.widgets::formatters_var_labels(ADTR, fill = FALSE)',
vars = list(ADTR = adtr)
)

adrs <- cdisc_dataset(
dataname = "ADRS",
x = ADRS,
code = 'ADRS <- synthetic_cdisc_data("latest")$adrs
adrs_labels <- formatters::var_labels(ADRS, fill = FALSE)
adrs_labels <- teal.widgets::formatters_var_labels(ADRS, fill = FALSE)
ADRS <- ADRS %>%
filter(PARAMCD %in% c("BESRSPI", "INVET")) %>%
mutate(ADT = as.Date(ADTM)) %>%
droplevels()
formatters::var_labels(ADRS) <- c(adrs_labels, "Analysis Date")',
teal.widgets::formatters_var_labels(ADRS) <- c(adrs_labels, "Analysis Date")',
vars = list(ADSL = adsl)
)

Expand All @@ -394,7 +394,7 @@ adlb <- cdisc_dataset(
ADT = as.Date(ADTM),
LBSTRESN = as.numeric(LBSTRESC)
) %>%
formatters::var_relabel(
teal.widgets::formatters_var_relabel(
ADT = "Analysis Date",
LBSTRESN = "Numeric Result/Finding in Standard Units"
)',
Expand Down
24 changes: 12 additions & 12 deletions inst/apps/efficacy/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ options(shiny.useragg = FALSE)
# code>
## Generate Data
ADSL <- synthetic_cdisc_data("latest")$adsl
adsl_labels <- formatters::var_labels(ADSL, fill = FALSE)
adsl_labels <- teal.widgets::formatters_var_labels(ADSL, fill = FALSE)

char_vars_asl <- names(Filter(isTRUE, sapply(ADSL, is.character)))

Expand All @@ -29,17 +29,17 @@ ADSL <- ADSL %>%
) %>%
mutate_at(char_vars_asl, factor)

formatters::var_labels(ADSL) <- adsl_labels
teal.widgets::formatters_var_labels(ADSL) <- adsl_labels

ADTTE <- synthetic_cdisc_data("latest")$adtte

ADRS <- synthetic_cdisc_data("latest")$adrs
adrs_labels <- formatters::var_labels(ADRS, fill = FALSE)
adrs_labels <- teal.widgets::formatters_var_labels(ADRS, fill = FALSE)
ADRS <- filter(ADRS, PARAMCD == "BESRSPI" | AVISIT == "FOLLOW UP")
formatters::var_labels(ADRS) <- adrs_labels
teal.widgets::formatters_var_labels(ADRS) <- adrs_labels

ADQS <- synthetic_cdisc_data("latest")$adqs
adqs_labels <- formatters::var_labels(ADQS, fill = FALSE)
adqs_labels <- teal.widgets::formatters_var_labels(ADQS, fill = FALSE)
ADQS <- ADQS %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
filter(AVISIT %in% c("WEEK 1 DAY 8", "WEEK 2 DAY 15", "WEEK 3 DAY 22")) %>%
Expand All @@ -50,7 +50,7 @@ ADQS <- ADQS %>%
as.numeric() %>%
as.factor()
)
formatters::var_labels(ADQS) <- adqs_labels
teal.widgets::formatters_var_labels(ADQS) <- adqs_labels

# <code

Expand Down Expand Up @@ -123,7 +123,7 @@ app <- init(
data = cdisc_data(
cdisc_dataset("ADSL", ADSL,
code = 'ADSL <- synthetic_cdisc_data("latest")$adsl
adsl_labels <- formatters::var_labels(ADSL, fill = FALSE)
adsl_labels <- teal.widgets::formatters_var_labels(ADSL, fill = FALSE)
adsl_labels <- c(adsl_labels,
AGEGR1 = "Age Group"
)
Expand All @@ -134,16 +134,16 @@ app <- init(
))
) %>%
mutate_at(char_vars_asl, factor)
formatters::var_labels(ADSL) <- adsl_labels',
teal.widgets::formatters_var_labels(ADSL) <- adsl_labels',
vars = list(char_vars_asl = char_vars_asl)
),
cdisc_dataset("ADRS", ADRS, code = 'ADRS <- synthetic_cdisc_data("latest")$adrs
adrs_labels <- formatters::var_labels(ADRS, fill = FALSE)
adrs_labels <- teal.widgets::formatters_var_labels(ADRS, fill = FALSE)
ADRS <- filter(ADRS, PARAMCD == "BESRSPI" | AVISIT == "FOLLOW UP")
formatters::var_labels(ADRS) <- adrs_labels'),
teal.widgets::formatters_var_labels(ADRS) <- adrs_labels'),
cdisc_dataset("ADTTE", ADTTE, code = "ADTTE <- synthetic_cdisc_data(\"latest\")$adtte"),
cdisc_dataset("ADQS", ADQS, code = 'ADQS <- synthetic_cdisc_data("latest")$adqs
adqs_labels <- formatters::var_labels(ADQS, fill = FALSE)
adqs_labels <- teal.widgets::formatters_var_labels(ADQS, fill = FALSE)
ADQS <- ADQS %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
filter(AVISIT %in% c("WEEK 1 DAY 8", "WEEK 2 DAY 15", "WEEK 3 DAY 22")) %>%
Expand All @@ -154,7 +154,7 @@ app <- init(
as.numeric() %>%
as.factor()
)
formatters::var_labels(ADQS) <- adqs_labels')
teal.widgets::formatters_var_labels(ADQS) <- adqs_labels')
),
modules = modules(
tm_front_page(
Expand Down
2 changes: 1 addition & 1 deletion inst/apps/longitudinal/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ ADSL <- ADSL %>%
)

# capture state of variable labels to apply back onto variables after data filtering
adsl_labels <- formatters::var_labels(ADSL)
adsl_labels <- teal.widgets::formatters_var_labels(ADSL)
date_vars_adsl <- names(ADSL)[vapply(ADSL, function(x) inherits(x, c("Date", "POSIXct", "POSIXlt")), logical(1))]
char_vars_adsl <- names(Filter(isTRUE, sapply(ADSL, is.character)))

Expand Down
8 changes: 4 additions & 4 deletions inst/apps/patient-profile/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ADCM$CMDOSFRQ <- "CMDOSFRQ"
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM

formatters::var_labels(
teal.widgets::formatters_var_labels(
ADCM[c("CMINDC", "CMTRT", "ASTDY", "AENDY")]
) <- c(
"Indication",

Check notice on line 29 in inst/apps/patient-profile/app.R

View workflow job for this annotation

GitHub Actions / grammar

inst/apps/patient-profile/app.R#L29

"Indication" is wordy or unneeded
Expand All @@ -34,7 +34,7 @@ formatters::var_labels(

## Modify ADHM

Check notice on line 35 in inst/apps/patient-profile/app.R

View workflow job for this annotation

GitHub Actions / grammar

inst/apps/patient-profile/app.R#L35

"Modify" is wordy or unneeded
ADMH[["MHDISTAT"]] <- "ONGOING"
formatters::var_labels(ADMH[c("MHDISTAT")]) <- c("Status of Disease")
teal.widgets::formatters_var_labels(ADMH[c("MHDISTAT")]) <- c("Status of Disease")

## Define variable inputs
aeterm_input <- data_extract_spec(
Expand Down Expand Up @@ -93,7 +93,7 @@ app <- init(
cdisc_dataset("ADAE", ADAE, code = "ADAE <- synthetic_cdisc_data(\"latest\")$adae"),
cdisc_dataset("ADMH", ADMH, code = "ADMH <- synthetic_cdisc_data(\"latest\")$admh
ADMH[['MHDISTAT']] <- 'ONGOING'
formatters::var_labels(ADMH[c('MHDISTAT')]) <- c('Status of Disease')"),
teal.widgets::formatters_var_labels(ADMH[c('MHDISTAT')]) <- c('Status of Disease')"),
cdisc_dataset("ADCM", ADCM, code = 'ADCM <- synthetic_cdisc_data(\"latest\")$adcm
ADCM$CMINDC <- paste0("Indication_", as.numeric(ADCM$CMDECOD))
ADCM$CMDOSE <- 1
Expand All @@ -103,7 +103,7 @@ app <- init(
ADCM$CMDOSFRQ <- "CMDOSFRQ"
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM
formatters::var_labels(
teal.widgets::formatters_var_labels(
ADCM[c("CMINDC", "CMTRT", "ASTDY", "AENDY")]) <- c(
"Indication",

Check notice on line 108 in inst/apps/patient-profile/app.R

View workflow job for this annotation

GitHub Actions / grammar

inst/apps/patient-profile/app.R#L108

"Indication" is wordy or unneeded
"Reported Name of Drug, Med, or Therapy",
Expand Down
Loading

0 comments on commit 5f82eb3

Please sign in to comment.