Timely switch to oral therapy is a widely recommended
antimicrobial stewardship behaviour. parenteral_changes()
extracts 'therapy sequences', which are defined as either:
a period of parenteral antimicrobial therapy subsequently converted into oral therapy
a period of parenteral antimicrobial therapy never converted into oral therapy
parenteral_changes(therapy_episode, tolerance_hours = 12L)
a TherapyEpisode
object
integer for the maximum number of hours during which an absence of prescription or the administration of some oral drugs will be ignored. The default is 12.
a named list containing, for every therapy episode, a nested list of
vectors describing therapy sequences. Each vector consists
of three integers coding for the time t
:
when the sequence is initiated (parenteral administration begins)
when the sequence ends
if the therapy is converted to oral administration: time of conversion,
(otherwise NA_integer_
)
The integers are in direct correspondence with field t
in the
therapy episode table (longitudinal_table()
).
Antimicrobial drugs may be administered via oral or parenteral (usually intravenous) route. Oral administration is preferred when patients can tolerate them and infections are not deep seated.
This function analyses the parenteral
field in a
longitudinal table. By default, it returns positions of sequences of at least
twelve "1" (= parenteral drug administration) followed by a
"0" (= oral administration) or a terminating sequence composed exclusively of "0".
Short periods without therapy lasting up to twelve hours (e.g. between two prescriptions)
are ignored by default (see tolerance_hours
parameter).
Short periods of oral administration lasting up to twelve hours are also ignored by default.
This ensures that very short oral prescriptions (including when parenteral therapy continues uninterrupted) do not distort the analysis of therapy changes.
if (FALSE) {
library(dplyr)
ramses_db <- create_mock_database("Ramses_mock_database_example.duckdb")
example_therapy <- TherapyEpisode(ramses_db, "2a2b6da3b67f6f495f4cedafb029f631")
# Obtain the parenteral to oral sequence indexes
therapy_sequence <- parenteral_changes(example_therapy)
therapy_sequence
# Look for the section of the longitudinal_table where 0 <= t <= 267
filter(longitudinal_table(example_therapy, collect = TRUE),
between(t,
therapy_sequence[["2a2b6da3b67f6f495f4cedafb029f631"]][[1]][1],
therapy_sequence[["2a2b6da3b67f6f495f4cedafb029f631"]][[1]][2])) %>% head()
# Look for the section of the longitudinal_table near conversion (t = 220)
filter(longitudinal_table(example_therapy, collect = TRUE),
between(t, 218, 223))
}