1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 06:46:11 +01:00

export first_isolate

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-02-26 12:15:52 +01:00
parent be51a95448
commit d36a391747
No known key found for this signature in database
GPG Key ID: AE86720DBCDA4567
6 changed files with 14 additions and 13 deletions

View File

@ -15,6 +15,7 @@ export(anti_join_bactlist)
export(as.mic) export(as.mic)
export(as.rsi) export(as.rsi)
export(atc_property) export(atc_property)
export(first_isolate)
export(full_join_bactlist) export(full_join_bactlist)
export(inner_join_bactlist) export(inner_join_bactlist)
export(interpretive_reading) export(interpretive_reading)

View File

@ -35,12 +35,11 @@
#' @param output_logical return output as \code{logical} (will else the values \code{0} or \code{1}) #' @param output_logical return output as \code{logical} (will else the values \code{0} or \code{1})
#' @param ignore_I ignore \code{"I"} as antimicrobial interpretation of key antibiotics (with \code{FALSE}, changes in antibiograms from S to I and I to R will be interpreted as difference) #' @param ignore_I ignore \code{"I"} as antimicrobial interpretation of key antibiotics (with \code{FALSE}, changes in antibiograms from S to I and I to R will be interpreted as difference)
#' @param info print progress #' @param info print progress
# @param ... parameters to pass through to \code{first_isolate}.
#' @rdname first_isolate
#' @details To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode. 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 is 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 selection bias. #' @details To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode. 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 is 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 selection bias.
#' #'
#' 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. #' 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.
#' @keywords isolate isolates first #' @keywords isolate isolates first
#' @export
#' @importFrom dplyr arrange_at lag between row_number filter mutate arrange #' @importFrom dplyr arrange_at lag between row_number filter mutate arrange
#' @return A vector to add to table, see Examples. #' @return A vector to add to table, see Examples.
#' @examples #' @examples

View File

@ -14,7 +14,7 @@
\item{\code{trivial}}{Trivial name in Dutch, like \code{"Amoxicilline/clavulaanzuur"}} \item{\code{trivial}}{Trivial name in Dutch, like \code{"Amoxicilline/clavulaanzuur"}}
\item{\code{oral_ddd}}{Daily Defined Dose (DDD) according to the WHO, oral treatment} \item{\code{oral_ddd}}{Daily Defined Dose (DDD) according to the WHO, oral treatment}
\item{\code{oral_units}}{Units of \code{ddd_units}} \item{\code{oral_units}}{Units of \code{ddd_units}}
\item{\code{iv_ddd}}{Daily Defined Dose (DDD) according to the WHO, bij parenteral treatment} \item{\code{iv_ddd}}{Daily Defined Dose (DDD) according to the WHO, parenteral treatment}
\item{\code{iv_units}}{Units of \code{iv_ddd}} \item{\code{iv_units}}{Units of \code{iv_ddd}}
\item{\code{atc_group1}}{ATC group in Dutch, like \code{"Macroliden, lincosamiden en streptograminen"}} \item{\code{atc_group1}}{ATC group in Dutch, like \code{"Macroliden, lincosamiden en streptograminen"}}
\item{\code{atc_group2}}{Subgroup of \code{atc_group1} in Dutch, like \code{"Macroliden"}} \item{\code{atc_group2}}{Subgroup of \code{atc_group1} in Dutch, like \code{"Macroliden"}}

View File

@ -13,7 +13,7 @@
\item{\code{species}}{Species name of microorganism, like \code{"coli"}} \item{\code{species}}{Species name of microorganism, like \code{"coli"}}
\item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}} \item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
\item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}} \item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
\item{\code{type}}{Type of microorganism, like \code{"Bacterie"} en \code{"Schimmel/gist"} (these are Dutch)} \item{\code{type}}{Type of microorganism in Dutch, like \code{"Bacterie"} and \code{"Schimmel/gist"}}
\item{\code{gramstain}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}} \item{\code{gramstain}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}}
\item{\code{aerobic}}{Type aerobe/anaerobe of bacteria} \item{\code{aerobic}}{Type aerobe/anaerobe of bacteria}
}} }}

View File

@ -4,12 +4,12 @@
\alias{key_antibiotics} \alias{key_antibiotics}
\title{Key antibiotics based on bacteria ID} \title{Key antibiotics based on bacteria ID}
\usage{ \usage{
key_antibiotics(tbl, col_bactcode = "bacteriecode", info = TRUE, key_antibiotics(tbl, col_bactcode = "bactid", info = TRUE, amcl = "amcl",
amcl = "amcl", amox = "amox", cfot = "cfot", cfta = "cfta", amox = "amox", cfot = "cfot", cfta = "cfta", cftr = "cftr",
cftr = "cftr", cfur = "cfur", cipr = "cipr", clar = "clar", cfur = "cfur", cipr = "cipr", clar = "clar", clin = "clin",
clin = "clin", clox = "clox", doxy = "doxy", gent = "gent", clox = "clox", doxy = "doxy", gent = "gent", line = "line",
line = "line", mero = "mero", peni = "peni", pita = "pita", mero = "mero", peni = "peni", pita = "pita", rifa = "rifa",
rifa = "rifa", teic = "teic", trsu = "trsu", vanc = "vanc") teic = "teic", trsu = "trsu", vanc = "vanc")
} }
\arguments{ \arguments{
\item{tbl}{table with antibiotics coloms, like \code{amox} and \code{amcl}.} \item{tbl}{table with antibiotics coloms, like \code{amox} and \code{amcl}.}

View File

@ -4,7 +4,7 @@
\alias{rsi_predict} \alias{rsi_predict}
\title{Predict antimicrobial resistance} \title{Predict antimicrobial resistance}
\usage{ \usage{
rsi_predict(tbl, col_ab, col_date = "ontvangstdatum", rsi_predict(tbl, col_ab, col_date,
year_max = as.integer(format(as.Date(Sys.Date()), "\%Y")) + 15, year_max = as.integer(format(as.Date(Sys.Date()), "\%Y")) + 15,
year_every = 1, model = "binomial", I_as_R = TRUE, year_every = 1, model = "binomial", I_as_R = TRUE,
preserve_measurements = TRUE, info = TRUE) preserve_measurements = TRUE, info = TRUE)
@ -37,19 +37,20 @@ Create a prediction model to predict antimicrobial resistance for the next years
\examples{ \examples{
\dontrun{ \dontrun{
# use it directly: # use it directly:
rsi_predict(tbl[which(first_isolate == TRUE & genus == "Haemophilus"),], "amcl") rsi_predict(tbl[which(first_isolate == TRUE & genus == "Haemophilus"),], col_ab = "amcl", coldate = "date")
# or with dplyr so you can actually read it: # or with dplyr so you can actually read it:
library(dplyr) library(dplyr)
tbl \%>\% tbl \%>\%
filter(first_isolate == TRUE, filter(first_isolate == TRUE,
genus == "Haemophilus") \%>\% genus == "Haemophilus") \%>\%
rsi_predict("amcl") rsi_predict(col_ab = "amcl", coldate = "date")
tbl \%>\% tbl \%>\%
filter(first_isolate_weighted == TRUE, filter(first_isolate_weighted == TRUE,
genus == "Haemophilus") \%>\% genus == "Haemophilus") \%>\%
rsi_predict(col_ab = "amcl", rsi_predict(col_ab = "amcl",
coldate = "date",
year_max = 2050, year_max = 2050,
year_every = 5) year_every = 5)