1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 02:03:04 +02:00

(v1.2.0.9014) ab_from_text()

This commit is contained in:
2020-06-25 17:34:50 +02:00
parent 8a66e475d7
commit 344bbd57f4
32 changed files with 749 additions and 191 deletions

38
man/ab_from_text.Rd Normal file
View File

@ -0,0 +1,38 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ab_from_text.R
\name{ab_from_text}
\alias{ab_from_text}
\title{Retrieve antimicrobial drugs from text}
\usage{
ab_from_text(text, collapse = NULL, translate_ab = "name", ...)
}
\arguments{
\item{text}{text to analyse}
\item{collapse}{character to pass on to \code{paste(..., collapse = ...)} to only return one character per element of \code{text}, see Examples}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Defaults to "name", which is equal to using \code{TRUE}. Use a value \code{FALSE}, \code{NULL} or \code{NA} to prevent translation of the \verb{<ab>} code.}
\item{...}{parameters passed on to \code{\link[=as.ab]{as.ab()}}}
}
\description{
Use this function on e.g. clinical texts from health care records. It returns a vector of antimicrobial drugs found in the texts.
}
\details{
To use this for creating a new variable in a data set (e.g. with \code{mutate()}), it could be convenient to paste the outcome together with the \code{collapse} parameter so every value in your new variable will be a character of length 1:\cr
\code{df \%>\% mutate(abx = ab_from_text(clinical_text, collapse = "|"))}
This function is also internally used by \code{\link[=as.ab]{as.ab()}}, although it then only returns the first hit.
}
\examples{
# mind the bad spelling of amoxicillin in this line,
# straight from a true health care record:
ab_from_text("28/03/2020 regular amoxicilliin 500mg po tds")
ab_from_text("administered amoxi/clav and cipro")
ab_from_text("administered amoxi/clav and cipro", collapse = ", ")
# if you want to know which antibiotic groups were administered, check it:
abx <- ab_from_text("administered amoxi/clav and cipro")
ab_group(abx)
}

View File

@ -83,5 +83,8 @@ ab_name("J01FA01") # "Erythromycin"
ab_name("eryt") # "Erythromycin"
}
\seealso{
\link{antibiotics} for the dataframe that is being used to determine ATCs.
\itemize{
\item \link{antibiotics} for the dataframe that is being used to determine ATCs
\item \code{\link[=ab_from_text]{ab_from_text()}} for a function to retrieve antimicrobial drugs from clinical text (from health care records)
}
}

View File

@ -47,7 +47,7 @@ count_df(
\item{data}{a \code{\link{data.frame}} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Use a value}
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}

View File

@ -83,7 +83,7 @@ labels_rsi_count(
\item{limits}{numeric vector of length two providing limits of the scale, use \code{NA} to refer to the existing minimum or maximum}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Use a value}
\item{combine_SI}{a logical to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the parameter \code{combine_IR}, but this now follows the redefinition by EUCAST about the interpretion of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is \code{TRUE}.}

View File

@ -62,7 +62,7 @@ rsi_df(
\item{data}{a \code{\link{data.frame}} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}. Use a value}
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}