Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dv.papo
Title: Patient Profile
Version: 2.2.0-9000
Version: 2.2.0-9001
Authors@R:
c(person("Boehringer-Ingelheim Pharma GmbH & Co.KG", role = c("cph", "fnd")),
person(given = "Korbinian",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# dv.papo 2.2.0-9001

- Wrap decode column into no more than two lines (to avoid overlap).

# dv.papo 2.2.0-9000

- [NOT USER-FACING] Tweak lintr rules.

# dv.papo 2.2.0
Expand Down
16 changes: 11 additions & 5 deletions R/mod_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,17 @@ patient_plot_server <- function(id, subject_var,
}
}

# wrap decode column
df[["decode"]] <- strwrap(df[["decode"]],
width = CONST$decode_max_width_before_wrap_in_characters,
simplify = FALSE
) |> sapply(function(x) paste(x, collapse = "\n"))
# Wrap decode column into no more than two lines (to avoid overlap). Increment width one-by-one,
# from the larger of the preset constant or an estimate (mid-point of longest decode text), until
# all decode texts fit over a maximum of two lines.
width_estimate <- ceiling(nchar(as.character(df[["decode"]])) / 2)
max_width <- max(width_estimate, CONST$decode_max_width_before_wrap_in_characters)
repeat {
wrapped <- strwrap(df[["decode"]], width = max_width, simplify = FALSE)
if (max(lengths(wrapped)) <= 2) break
max_width <- max_width + 1
}
df[["decode"]] <- sapply(wrapped, function(x) paste(x, collapse = "\n"))

df <- df[intersect(names(df), c("start_date", "end_date", "decode", "grading", "serious_ae"))]

Expand Down
Loading