Tabulate the number of cases where the pathogen(s) are detected in TAC results by DeCoDe result (in causal chain or not, etc.) and by either site or age

calc_detected_by_decode(
  d,
  by = "site",
  condition,
  pathogen,
  icds,
  sites = NULL,
  specimen_types = NULL
)

Arguments

d

A data object obtained from load_data.

by

One of either "site" or "age", indicating the second dimension of tabulation.

condition

A string specifying the condition to tabulate causal chain presence for. To list all possibilities, see valid_conditions.

pathogen

A string specifying the pathogen to count positive cases of in the TAC results.

icds

A vector of ICD10 codes to check for the DeCoDe result of "Contributing (P2)".

sites

An optional vector of site names to include in the tabulation. If not provided, all sites will be used. See valid_sites.

specimen_types

An optional vector of specimen types to include in the calculation. If not provided, all specimen types will be used. See valid_specimen_types.

Examples

specimen_types <- c(
  "Cerebrospinal fluid sample",
  "Tissue specimen from lung",
  "Whole blood",
  "Rectal swab",
  "Plasma or spun blood specimen"
)

calc_detected_by_decode(mock,
  by = "site",
  condition = "Streptococcus agalactiae",
  pathogen = "Group B Streptococcus",
  icds = c("P36.0", "A40.1", "P23.3", "G00.2"),
  specimen_types = specimen_types)