mirror of
https://github.com/msberends/AMR.git
synced 2025-07-10 01:02:47 +02:00
- Added new algorithm to determine weighted isolates, can now be points
or keyantibiotics, see
?first_isolate`
- Function `first_isolate` supports tidyverse-like evaluation of parameters (no need to quote them anymore) - Functions `as.rsi` and `as.mic` now add the package name and version as attribute
This commit is contained in:
@ -5,41 +5,46 @@
|
||||
\title{Determine first (weighted) isolates}
|
||||
\usage{
|
||||
first_isolate(tbl, col_date, col_patient_id, col_genus, col_species,
|
||||
col_testcode = NA, col_specimen, col_icu, col_keyantibiotics = NA,
|
||||
episode_days = 365, testcodes_exclude = "", icu_exclude = FALSE,
|
||||
filter_specimen = NA, output_logical = TRUE, points_threshold = 2,
|
||||
col_testcode = NA, col_specimen = NA, col_icu = NA,
|
||||
col_keyantibiotics = NA, episode_days = 365, testcodes_exclude = "",
|
||||
icu_exclude = FALSE, filter_specimen = NA, output_logical = TRUE,
|
||||
type = "keyantibiotics", ignore_I = TRUE, points_threshold = 2,
|
||||
info = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{a \code{data.frame} containing isolates.}
|
||||
|
||||
\item{col_date}{column name of the result date (or date that is was received on the lab)}
|
||||
\item{col_date}{column name of the result date (or date that is was received on the lab), supports tidyverse-like quotation}
|
||||
|
||||
\item{col_patient_id}{column name of the unique IDs of the patients}
|
||||
\item{col_patient_id}{column name of the unique IDs of the patients, supports tidyverse-like quotation}
|
||||
|
||||
\item{col_genus}{column name of the genus of the microorganisms}
|
||||
\item{col_genus}{column name of the genus of the microorganisms, supports tidyverse-like quotation}
|
||||
|
||||
\item{col_species}{column name of the species of the microorganisms}
|
||||
\item{col_species}{column name of the species of the microorganisms, supports tidyverse-like quotation}
|
||||
|
||||
\item{col_testcode}{column name of the test codes. Use \code{col_testcode = NA} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored.}
|
||||
\item{col_testcode}{column name of the test codes. Use \code{col_testcode = NA} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored. Supports tidyverse-like quotation.}
|
||||
|
||||
\item{col_specimen}{column name of the specimen type or group}
|
||||
\item{col_specimen}{column name of the specimen type or group, supports tidyverse-like quotation}
|
||||
|
||||
\item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU)}
|
||||
\item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU), supports tidyverse-like quotation}
|
||||
|
||||
\item{col_keyantibiotics}{column name of the key antibiotics to determine first \emph{weighted} isolates, see \code{\link{key_antibiotics}}.}
|
||||
\item{col_keyantibiotics}{column name of the key antibiotics to determine first \emph{weighted} isolates, see \code{\link{key_antibiotics}}. Supports tidyverse-like quotation.}
|
||||
|
||||
\item{episode_days}{episode in days after which a genus/species combination will be determined as 'first isolate' again}
|
||||
|
||||
\item{testcodes_exclude}{character vector with test codes that should be excluded (caseINsensitive)}
|
||||
\item{testcodes_exclude}{character vector with test codes that should be excluded (case-insensitive)}
|
||||
|
||||
\item{icu_exclude}{logical whether ICU isolates should be excluded}
|
||||
|
||||
\item{filter_specimen}{specimen group or type that should be excluded}
|
||||
|
||||
\item{output_logical}{return output as \code{logical} (will else the values \code{0} or \code{1})}
|
||||
\item{output_logical}{return output as \code{logical} (will else be the values \code{0} or \code{1})}
|
||||
|
||||
\item{points_threshold}{points until the comparison of key antibiotics will lead to inclusion of an isolate, see Details}
|
||||
\item{type}{type to determine weighed isolates; can be \code{"keyantibiotics"} or \code{"points"}, see Details}
|
||||
|
||||
\item{ignore_I}{logical to determine whether antibiotic interpretations with \code{"I"} will be ignored when \code{type = "keyantibiotics"}, see Details}
|
||||
|
||||
\item{points_threshold}{points until the comparison of key antibiotics will lead to inclusion of an isolate when \code{type = "points"}, see Details}
|
||||
|
||||
\item{info}{print progress}
|
||||
}
|
||||
@ -50,13 +55,28 @@ A vector to add to table, see Examples.
|
||||
Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type.
|
||||
}
|
||||
\details{
|
||||
\strong{Why this is so important} \cr
|
||||
\strong{WHY THIS IS SO IMPORTANT} \cr
|
||||
To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode \href{https://www.ncbi.nlm.nih.gov/pubmed/17304462}{[1]}. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that it was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all \emph{S. aureus} isolates would be overestimated, because you included this MRSA more than once. It would be \href{https://en.wikipedia.org/wiki/Selection_bias}{selection bias}.
|
||||
|
||||
\strong{Using parameter \code{points_threshold}} \cr
|
||||
To compare key antibiotics, the difference between antimicrobial interpretations will be measured. A difference from I to S|R (or vice versa) means 0.5 points. A difference from S to R (or vice versa) means 1 point. When the sum of points exceeds \code{points_threshold}, an isolate will be (re)selected as a first weighted isolate.
|
||||
\strong{DETERMINING WEIGHTED ISOLATES} \cr
|
||||
\strong{1. Using \code{type = "keyantibiotics"} and parameter \code{ignore_I}} \cr
|
||||
To determine weighted isolates, the difference between key antibiotics will be checked. Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With \code{ignore_I == FALSE}, also differences from I to S|R (or vice versa) will lead to this. This is a reliable and fast method. \cr
|
||||
\strong{2. Using \code{type = "points"} and parameter \code{points_threshold}} \cr
|
||||
To determine weighted isolates, difference between antimicrobial interpretations will be measured with points. A difference from I to S|R (or vice versa) means 0.5 points. A difference from S to R (or vice versa) means 1 point. When the sum of points exceeds \code{points_threshold}, an isolate will be (re)selected as a first weighted isolate. This method is being used by the Infection Prevention department (Dr M. Lokate) of the University Medical Center Groningen (UMCG).
|
||||
}
|
||||
\examples{
|
||||
# septic_patients is a dataset available in the AMR package
|
||||
?septic_patients
|
||||
my_patients <- septic_patients
|
||||
|
||||
library(dplyr)
|
||||
my_patients$first_isolate <- my_patients \%>\%
|
||||
left_join_bactlist() \%>\%
|
||||
first_isolate(col_date = date,
|
||||
col_patient_id = patient_id,
|
||||
col_genus = genus,
|
||||
col_species = species)
|
||||
|
||||
\dontrun{
|
||||
|
||||
# set key antibiotics to a new variable
|
||||
|
@ -41,6 +41,9 @@ As opposed to the \code{\link[dplyr]{join}} functions of \code{dplyr}, character
|
||||
\examples{
|
||||
left_join_bactlist("STAAUR")
|
||||
|
||||
library(dplyr)
|
||||
septic_patients \%>\% left_join_bactlist()
|
||||
|
||||
df <- data.frame(date = seq(from = as.Date("2018-01-01"),
|
||||
to = as.Date("2018-01-07"),
|
||||
by = 1),
|
||||
|
@ -18,7 +18,7 @@ key_antibiotics(tbl, col_bactcode = "bactid", info = TRUE, amcl = "amcl",
|
||||
|
||||
\item{info}{print warnings}
|
||||
|
||||
\item{amcl, amox, cfot, cfta, cftr, cfur, cipr, clar, clin, clox, doxy, gent, line, mero, peni, pita, rifa, teic, trsu, vanc}{column names of antibiotics.}
|
||||
\item{amcl, amox, cfot, cfta, cftr, cfur, cipr, clar, clin, clox, doxy, gent, line, mero, peni, pita, rifa, teic, trsu, vanc}{column names of antibiotics, case-insensitive}
|
||||
}
|
||||
\value{
|
||||
Character of length 1.
|
||||
|
Reference in New Issue
Block a user