mirror of
https://github.com/msberends/AMR.git
synced 2025-04-22 06:43:45 +02:00
(v2.1.1.9242) sir log
This commit is contained in:
parent
579025f678
commit
29b0ef1089
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9241
|
Version: 2.1.1.9242
|
||||||
Date: 2025-04-18
|
Date: 2025-04-18
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9241
|
# AMR 2.1.1.9242
|
||||||
|
|
||||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)*
|
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)*
|
||||||
|
|
||||||
|
17
R/sir.R
17
R/sir.R
@ -111,7 +111,7 @@
|
|||||||
#'
|
#'
|
||||||
#' 4. For **interpreting a complete data set**, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running `as.sir(your_data)`.
|
#' 4. For **interpreting a complete data set**, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running `as.sir(your_data)`.
|
||||||
#'
|
#'
|
||||||
#' **For points 2, 3 and 4: Use [sir_interpretation_history()]** to retrieve a [data.frame] (or [tibble][tibble::tibble()] if the `tibble` package is installed) with all results of the last [as.sir()] call.
|
#' **For points 2, 3 and 4: Use [sir_interpretation_history()]** to retrieve a [data.frame] with all results of all previous [as.sir()] calls. It also contains notes about interpretation, and the exact input and output values.
|
||||||
#'
|
#'
|
||||||
#' ### Supported Guidelines
|
#' ### Supported Guidelines
|
||||||
#'
|
#'
|
||||||
@ -1506,10 +1506,8 @@ as_sir_method <- function(method_short,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NROW(breakpoints_current) == 0) {
|
if (NROW(breakpoints_current) == 0) {
|
||||||
AMR_env$sir_interpretation_history <- rbind_AMR(
|
out <- data.frame(
|
||||||
AMR_env$sir_interpretation_history,
|
|
||||||
# recycling 1 to 2 rows does not always seem to work, which is why vectorise_log_entry() was added
|
# recycling 1 to 2 rows does not always seem to work, which is why vectorise_log_entry() was added
|
||||||
data.frame(
|
|
||||||
datetime = vectorise_log_entry(Sys.time(), length(rows)),
|
datetime = vectorise_log_entry(Sys.time(), length(rows)),
|
||||||
index = rows,
|
index = rows,
|
||||||
method = vectorise_log_entry(method_coerced, length(rows)),
|
method = vectorise_log_entry(method_coerced, length(rows)),
|
||||||
@ -1529,7 +1527,8 @@ as_sir_method <- function(method_short,
|
|||||||
breakpoint_S_R = vectorise_log_entry(NA_character_, length(rows)),
|
breakpoint_S_R = vectorise_log_entry(NA_character_, length(rows)),
|
||||||
stringsAsFactors = FALSE
|
stringsAsFactors = FALSE
|
||||||
)
|
)
|
||||||
)
|
out <- subset(out, !is.na(input_given))
|
||||||
|
AMR_env$sir_interpretation_history <- rbind_AMR(AMR_env$sir_interpretation_history, out)
|
||||||
notes <- c(notes, notes_current)
|
notes <- c(notes, notes_current)
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
@ -1636,6 +1635,7 @@ as_sir_method <- function(method_short,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## actual interpretation ----
|
||||||
if (method == "mic") {
|
if (method == "mic") {
|
||||||
new_sir <- case_when_AMR(
|
new_sir <- case_when_AMR(
|
||||||
is.na(values) ~ NA_sir_,
|
is.na(values) ~ NA_sir_,
|
||||||
@ -1668,10 +1668,8 @@ as_sir_method <- function(method_short,
|
|||||||
# write to verbose output
|
# write to verbose output
|
||||||
notes_current <- trimws2(notes_current)
|
notes_current <- trimws2(notes_current)
|
||||||
notes_current[notes_current == ""] <- NA_character_
|
notes_current[notes_current == ""] <- NA_character_
|
||||||
AMR_env$sir_interpretation_history <- rbind_AMR(
|
out <- data.frame(
|
||||||
AMR_env$sir_interpretation_history,
|
|
||||||
# recycling 1 to 2 rows does not always seem to work, which is why vectorise_log_entry() was added
|
# recycling 1 to 2 rows does not always seem to work, which is why vectorise_log_entry() was added
|
||||||
data.frame(
|
|
||||||
datetime = vectorise_log_entry(Sys.time(), length(rows)),
|
datetime = vectorise_log_entry(Sys.time(), length(rows)),
|
||||||
index = rows,
|
index = rows,
|
||||||
method = vectorise_log_entry(method_coerced, length(rows)),
|
method = vectorise_log_entry(method_coerced, length(rows)),
|
||||||
@ -1691,7 +1689,8 @@ as_sir_method <- function(method_short,
|
|||||||
breakpoint_S_R = vectorise_log_entry(paste0(breakpoints_current[, "breakpoint_S", drop = TRUE], "-", breakpoints_current[, "breakpoint_R", drop = TRUE]), length(rows)),
|
breakpoint_S_R = vectorise_log_entry(paste0(breakpoints_current[, "breakpoint_S", drop = TRUE], "-", breakpoints_current[, "breakpoint_R", drop = TRUE]), length(rows)),
|
||||||
stringsAsFactors = FALSE
|
stringsAsFactors = FALSE
|
||||||
)
|
)
|
||||||
)
|
out <- subset(out, !is.na(input_given))
|
||||||
|
AMR_env$sir_interpretation_history <- rbind_AMR(AMR_env$sir_interpretation_history, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
notes <- c(notes, notes_current)
|
notes <- c(notes, notes_current)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse.
|
This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse.
|
||||||
|
|
||||||
First and foremost, you are trained on version 2.1.1.9241. Remember this whenever someone asks which AMR package version you’re at.
|
First and foremost, you are trained on version 2.1.1.9242. Remember this whenever someone asks which AMR package version you’re at.
|
||||||
|
|
||||||
Below are the contents of the NAMESPACE file, the index.md file, and all the man/*.Rd files (documentation) in the package. Every file content is split using 100 hypens.
|
Below are the contents of the NAMESPACE file, the index.md file, and all the man/*.Rd files (documentation) in the package. Every file content is split using 100 hypens.
|
||||||
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
||||||
@ -3567,7 +3567,7 @@ your_data \%>\% mutate_if(is.disk, as.sir, host = "column_with_animal_species",
|
|||||||
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.sir(your_data)}.
|
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.sir(your_data)}.
|
||||||
}
|
}
|
||||||
|
|
||||||
\strong{For points 2, 3 and 4: Use \code{\link[=sir_interpretation_history]{sir_interpretation_history()}}} to retrieve a \link{data.frame} (or \link[tibble:tibble]{tibble} if the \code{tibble} package is installed) with all results of the last \code{\link[=as.sir]{as.sir()}} call.
|
\strong{For points 2, 3 and 4: Use \code{\link[=sir_interpretation_history]{sir_interpretation_history()}}} to retrieve a \link{data.frame} with all results of all previous \code{\link[=as.sir]{as.sir()}} calls. It also contains notes about interpretation, and the exact input and output values.
|
||||||
}
|
}
|
||||||
|
|
||||||
\subsection{Supported Guidelines}{
|
\subsection{Supported Guidelines}{
|
@ -191,7 +191,7 @@ your_data \%>\% mutate_if(is.disk, as.sir, host = "column_with_animal_species",
|
|||||||
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.sir(your_data)}.
|
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.sir(your_data)}.
|
||||||
}
|
}
|
||||||
|
|
||||||
\strong{For points 2, 3 and 4: Use \code{\link[=sir_interpretation_history]{sir_interpretation_history()}}} to retrieve a \link{data.frame} (or \link[tibble:tibble]{tibble} if the \code{tibble} package is installed) with all results of the last \code{\link[=as.sir]{as.sir()}} call.
|
\strong{For points 2, 3 and 4: Use \code{\link[=sir_interpretation_history]{sir_interpretation_history()}}} to retrieve a \link{data.frame} with all results of all previous \code{\link[=as.sir]{as.sir()}} calls. It also contains notes about interpretation, and the exact input and output values.
|
||||||
}
|
}
|
||||||
|
|
||||||
\subsection{Supported Guidelines}{
|
\subsection{Supported Guidelines}{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user