Compute Defined Daily Doses (DDDs) for a drug prescription
or administration record using the World Health Organisation Anatomical
Therapeutic Chemical (ATC) classification (WHO Collaborating Centre for Drug Statistics Methodology 2020)
.
This function includes modified source code by
atc_online_property()
.
compute_DDDs(ATC_code, ATC_administration, dose, unit, silent = FALSE)
a character vector of ATC codes (can be easily obtained from
the ab_atc()
function)
a character vector indicating the ATC route of administration (see Details)
a numeric vector indicating the total dose for the drug serving as the ATC DDD basis of strength. For prescriptions, provide the total dose to be given in one day, rather than per administration.
a character vector coercible to a units
object with
as_units()
.
if TRUE
, the progress bar will be hidden.
The default is FALSE
.
a numeric vector containing the DDDs
This function queries the WHO ATC website for the most up-to-date reference values of the DDDs.
The `administration` parameter must be one of the following values:
'Implant'
for implants
'Inhal'
for inhalation (eg: nebuliser or inhalers)
'Instill'
for instillation (eg: topical drops)
'N'
for nasal administration
'O'
for oral administration or administration via
percutaneous endoscopic gastrostomy tube
'P'
for parenteral administration (eg intravenous
bolus/infusion injections, intramuscular injections)
'R'
for rectal administration
'SL'
for sublingual/buccal/oromucosal administration
'TD'
for transdermal administration (eg: patch)
'V'
for vaginal administration
With thanks to the AMR package authors. WHO Collaborating Centre for Drug Statistics Methodology (2020). “ATC classification index with DDDs, 2020.” https://www.whocc.no/atc_ddd_index/.
# Three tablets of amoxicillin 500mg
compute_DDDs("J01CA04", "O", 3 * 500, "mg")
#> [1] 1
# Three tablets of co-amoxiclav 625mg (containing 500mg amoxicillin each)
compute_DDDs("J01CR02", "O", 3 * 500, "mg")
#> [1] 1
# This function may also be used with `dplyr`
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:Ramses’:
#>
#> collect, compute
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
library(magrittr)
library(AMR)
Ramses::drug_prescriptions %>%
head() %>%
transmute(rxsummary,
tr_DESC,
route,
dose,
units,
daily_frequency = case_when(
frequency == "BD" ~ 2,
frequency == "TDS" ~ 3,
frequency == "6H" ~ 4
)) %>%
mutate(DDD = compute_DDDs(
ATC_code = AMR::ab_atc(tr_DESC, only_first = TRUE),
ATC_administration = if_else(route == "ORAL", "O", "P"),
dose = dose * daily_frequency,
unit = units))
#> rxsummary tr_DESC route dose
#> 1 Piperacillin / Tazobactam IVI 4.5 g TDS Piperacillin / Tazobactam IV 4.5
#> 2 Ciprofloxacin ORAL 500 mg BD Ciprofloxacin ORAL 500.0
#> 3 Flucloxacillin ORAL 500 mg 6H Flucloxacillin ORAL 500.0
#> 4 Metronidazole ORAL 400 mg TDS Metronidazole ORAL 400.0
#> 5 Piperacillin / Tazobactam IVI 4.5 g TDS Piperacillin / Tazobactam IV 4.5
#> 6 Amoxicillin ORAL 500 mg 8H Amoxicillin ORAL 500.0
#> units daily_frequency DDD
#> 1 g 3 0.9642857
#> 2 mg 2 1.0000000
#> 3 mg 4 1.0000000
#> 4 mg 3 NA
#> 5 g 3 0.9642857
#> 6 mg NA NA