This commit is contained in:
dr. M.S. (Matthijs) Berends 2023-01-21 11:07:55 +01:00
parent bee337dfe0
commit ee38689172
29 changed files with 18362 additions and 53 deletions

View File

@ -73,7 +73,7 @@ The `antibiotics` data set was greatly updated:
* Updated DDDs and PubChem Compound IDs
* Updated some antibiotic name spelling, now used by WHOCC (such as cephalexin -> cefalexin, and phenethicillin -> pheneticillin)
* Antibiotic code "CEI" for ceftolozane/tazobactam has been replaced with "CZT" to comply with EARS-Net and WHONET 2022. The old code will still work in all cases when using `as.ab()` or any of the `ab_*()` functions.
* Support for antimicrobial interpretation of anaerobic bacteria, by adding a 'placeholder' code `B_ANAER` to the `microorganisms` data set and adding the breakpoints of anaerobics to the `sir_interpretation` data set, which is used by `as.sir()` for interpretion of MIC and disk diffusion values
* Support for antimicrobial interpretation of anaerobic bacteria, by adding a 'placeholder' code `B_ANAER` to the `microorganisms` data set and adding the breakpoints of anaerobics to the `clinical_breakpoints` data set, which is used by `as.sir()` for interpretion of MIC and disk diffusion values
Also, we added support for using antibiotic selectors in scoped `dplyr` verbs (with or without using `vars()`), such as in: `... %>% summarise_at(aminoglycosides(), resistance)`, please see `resistance()` for examples.

View File

@ -667,7 +667,7 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
}
if (identical(v, c("I", "R", "S"))) {
# class 'sir' should be sorted like this
v <- c("R", "S", "I")
v <- c("S", "I", "R")
}
# all commas except for last item, so will become '"val1", "val2", "val3" or "val4"'
paste0(

View File

@ -639,10 +639,10 @@ c.ab_selector <- function(...) {
all_any_ab_selector <- function(type, ..., na.rm = TRUE) {
cols_ab <- c(...)
result <- cols_ab[toupper(cols_ab) %in% c("R", "S", "I")]
result <- cols_ab[toupper(cols_ab) %in% c("S", "I", "R")]
if (length(result) == 0) {
message_("Filtering ", type, " of columns ", vector_and(font_bold(cols_ab, collapse = NULL), quotes = "'"), ' to contain value "R", "S" or "I"')
result <- c("R", "S", "I")
message_("Filtering ", type, " of columns ", vector_and(font_bold(cols_ab, collapse = NULL), quotes = "'"), ' to contain value "S", "I" or "R"')
result <- c("S", "I", "R")
}
cols_ab <- cols_ab[!cols_ab %in% result]
df <- get_current_data(arg_name = NA, call = -3)
@ -751,8 +751,8 @@ any.ab_selector_any_all <- function(..., na.rm = FALSE) {
}
}
# this is `!=`, so turn around the values
rsi <- c("R", "S", "I")
e2 <- rsi[rsi != e2]
sir <- c("S", "I", "R")
e2 <- sir[sir != e2]
structure(all_any_ab_selector(type = type, e1, e2),
class = c("ab_selector_any_all", "logical")
)

View File

@ -181,8 +181,8 @@ custom_eucast_rules <- function(...) {
result_value <- as.character(result)[[3]]
result_value[result_value == "NA"] <- NA
stop_ifnot(
result_value %in% c("R", "S", "I", NA),
"the resulting value of rule ", i, " must be either \"R\", \"S\", \"I\" or NA"
result_value %in% c("S", "I", "R", NA),
"the resulting value of rule ", i, " must be either \"S\", \"I\", \"R\" or NA"
)
result_value <- as.sir(result_value)

View File

@ -237,7 +237,7 @@ first_isolate <- function(x = NULL,
FUN.VALUE = logical(1),
X = x,
# check only first 10,000 rows
FUN = function(x) any(as.character(x[1:10000]) %in% c("R", "S", "I"), na.rm = TRUE),
FUN = function(x) any(as.character(x[1:10000]) %in% c("S", "I", "R"), na.rm = TRUE),
USE.NAMES = FALSE
))
if (method == "phenotype-based" && !any_col_contains_sir) {

View File

@ -282,7 +282,7 @@ generate_antimcrobials_string <- function(df) {
as.list(df),
function(x) {
x <- toupper(as.character(x))
x[!x %in% c("R", "S", "I")] <- "."
x[!x %in% c("S", "I", "R")] <- "."
paste(x)
}
)
@ -308,7 +308,7 @@ antimicrobials_equal <- function(y,
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
stop_ifnot(length(y) == length(z), "length of `y` and `z` must be equal")
key2rsi <- function(val) {
key2sir <- function(val) {
val <- strsplit(val, "", fixed = TRUE)[[1L]]
val.int <- rep(NA_real_, length(val))
val.int[val == "S"] <- 1
@ -318,7 +318,7 @@ antimicrobials_equal <- function(y,
}
# only run on uniques
uniq <- unique(c(y, z))
uniq_list <- lapply(uniq, key2rsi)
uniq_list <- lapply(uniq, key2sir)
names(uniq_list) <- uniq
y <- uniq_list[match(y, names(uniq_list))]

View File

@ -30,7 +30,7 @@
#' Calculate the Mean AMR Distance
#'
#' Calculates a normalised mean for antimicrobial resistance between multiple observations, to help to identify similar isolates without comparing antibiograms by hand.
#' @param x a vector of class [rsi][as.sir()], [mic][as.mic()] or [disk][as.disk()], or a [data.frame] containing columns of any of these classes
#' @param x a vector of class [sir][as.sir()], [mic][as.mic()] or [disk][as.disk()], or a [data.frame] containing columns of any of these classes
#' @param ... variables to select (supports [tidyselect language][tidyselect::language] such as `column1:column4` and `where(is.mic)`, and can thus also be [antibiotic selectors][ab_selector()]
#' @param combine_SI a [logical] to indicate whether all values of S and I must be merged into one, so the input only consists of S+I vs. R (susceptible vs. resistant), defaults to `TRUE`
#' @details The mean AMR distance is effectively [the Z-score](https://en.wikipedia.org/wiki/Standard_score); a normalised numeric value to compare AMR test results which can help to identify similar isolates, without comparing antibiograms by hand.
@ -46,9 +46,9 @@
#' Isolates with distances less than 0.01 difference from each other should be considered similar. Differences lower than 0.025 should be considered suspicious.
#' @export
#' @examples
#' rsi <- random_sir(10)
#' rsi
#' mean_amr_distance(rsi)
#' sir <- random_sir(10)
#' sir
#' mean_amr_distance(sir)
#'
#' mic <- random_mic(10)
#' mic

View File

@ -40,7 +40,7 @@
#' @param translate_ab a column name of the [antibiotics] data set to translate the antibiotic abbreviations to, using [ab_property()]
#' @inheritParams ab_property
#' @param 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), defaults to `TRUE`
#' @param ab_result antibiotic results to test against, must be one of more values of "R", "S", "I"
#' @param ab_result antibiotic results to test against, must be one or more values of "S", "I", or "R"
#' @param confidence_level the confidence level for the returned confidence interval. For the calculation, the number of S or SI isolates, and R isolates are compared with the total number of available isolates with R, S, or I by using [binom.test()], i.e., the Clopper-Pearson method.
#' @param side the side of the confidence interval to return. Defaults to `"both"` for a length 2 vector, but can also be (abbreviated as) `"min"`/`"left"`/`"lower"`/`"less"` or `"max"`/`"right"`/`"higher"`/`"greater"`.
#' @inheritSection as.sir Interpretation of SIR
@ -200,7 +200,7 @@
#' combination_n = count_all(CIP, GEN)
#' )
#'
#' # Get proportions S/I/R immediately of all rsi columns
#' # Get proportions S/I/R immediately of all sir columns
#' example_isolates %>%
#' select(AMX, CIP) %>%
#' proportion_df(translate = FALSE)
@ -256,7 +256,7 @@ sir_confidence_interval <- function(...,
only_all_tested = FALSE,
confidence_level = 0.95,
side = "both") {
meet_criteria(ab_result, allow_class = c("character", "sir"), has_length = c(1, 2, 3), is_in = c("R", "S", "I"))
meet_criteria(ab_result, allow_class = c("character", "sir"), has_length = c(1, 2, 3), is_in = c("S", "I", "R"))
meet_criteria(confidence_level, allow_class = "numeric", is_positive = TRUE, has_length = 1)
meet_criteria(side, allow_class = "character", has_length = 1, is_in = c("both", "b", "left", "l", "lower", "lowest", "less", "min", "right", "r", "higher", "highest", "greater", "g", "max"))
x <- tryCatch(

12
R/sir.R
View File

@ -27,7 +27,7 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
#' Interpret MIC and Disk Values, or Clean Raw SIR Data
#' Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data
#'
#' Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing SIR values. This transforms the input to a new class [`sir`], which is an ordered [factor] with levels `S < I < R`.
#' @rdname as.sir
@ -258,9 +258,9 @@ is_sir_eligible <- function(x, threshold = 0.05) {
%in% class(x))) {
# no transformation needed
return(FALSE)
} else if (all(x %in% c("R", "S", "I", NA)) & !all(is.na(x))) {
} else if (all(x %in% c("S", "I", "R", NA)) & !all(is.na(x))) {
return(TRUE)
} else if (!any(c("R", "S", "I") %in% x, na.rm = TRUE) & !all(is.na(x))) {
} else if (!any(c("S", "I", "R") %in% x, na.rm = TRUE) & !all(is.na(x))) {
return(FALSE)
} else {
x <- x[!is.na(x) & !is.null(x) & !x %in% c("", "-", "NULL")]
@ -301,7 +301,7 @@ as.sir.default <- function(x, ...) {
if (inherits(x.bak, c("integer", "numeric", "double")) && all(x %in% c(1:3, NA))) {
# support haven package for importing e.g., from SPSS - it adds the 'labels' attribute
lbls <- attributes(x.bak)$labels
if (!is.null(lbls) && all(c("R", "S", "I") %in% names(lbls)) && all(c(1:3) %in% lbls)) {
if (!is.null(lbls) && all(c("S", "I", "R") %in% names(lbls)) && all(c(1:3) %in% lbls)) {
x[x.bak == 1] <- names(lbls[lbls == 1])
x[x.bak == 2] <- names(lbls[lbls == 2])
x[x.bak == 3] <- names(lbls[lbls == 3])
@ -314,7 +314,7 @@ as.sir.default <- function(x, ...) {
x[x.bak == "1"] <- "S"
x[x.bak == "2"] <- "I"
x[x.bak == "3"] <- "R"
} else if (!all(is.na(x)) && !identical(levels(x), c("R", "S", "I")) && !all(x %in% c("R", "S", "I", NA))) {
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "I", "R")) && !all(x %in% c("S", "I", "R", NA))) {
if (all(x %unlike% "(R|S|I)", na.rm = TRUE)) {
# check if they are actually MICs or disks
if (all_valid_mics(x)) {
@ -625,7 +625,7 @@ as.sir.data.frame <- function(x,
show_message <- FALSE
ab <- ab_cols[i]
ab_coerced <- suppressWarnings(as.ab(ab))
if (!all(x[, ab_cols[i], drop = TRUE] %in% c("R", "S", "I", NA), na.rm = TRUE)) {
if (!all(x[, ab_cols[i], drop = TRUE] %in% c("S", "I", "R", NA), na.rm = TRUE)) {
show_message <- TRUE
# only print message if values are not already clean
message_("=> Cleaning values in column '", font_bold(ab), "' (",

View File

@ -141,7 +141,7 @@ vec_math.mic <- function(.fn, x, ...) {
.fn(as.double(x), ...)
}
# S3: rsi
# S3: sir
vec_ptype2.character.sir <- function(x, y, ...) {
x
}

View File

@ -166,7 +166,7 @@ if (utf8_supported && !is_latex) {
s3_register("vctrs::vec_cast", "mic.character")
s3_register("vctrs::vec_cast", "mic.double")
s3_register("vctrs::vec_math", "mic")
# S3: rsi
# S3: sir
s3_register("vctrs::vec_ptype2", "character.sir")
s3_register("vctrs::vec_ptype2", "sir.character")
s3_register("vctrs::vec_cast", "character.sir")

View File

@ -53952,7 +53952,7 @@
"58301-3","High blood pressure without toxemia during this pregnancy","Find","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","Did you have High blood pressure without toxemia during this pregnancy?","PX040401020000","N","BP; Finding; Findings; Gestation; Gestations; Gravida; High BP WO toxemia during pregnancy; Ordinal; PhenX; Point in time; Pregnancies; QL; Qual; Qualitative; Random; Screen","High BP WO toxemia during pregnancy","","","","","High blood pressure without toxemia during this pregnancy","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
"58302-1","Ever told by doctor that you had rheumatic heart or heart valve problems","Find","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","Has a doctor ever told you that you had rheumatic heart or heart valve problems?","PX040501010000","N","Finding; Findings; Ordinal; PhenX; Point in time; QL; Qual; Qualitative; Random; Screen","Rheumatic heart or heart valve problems","","","","","Ever told by doctor that you had rheumatic heart or heart valve problems","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
"58303-9","Ever told by doctor that you had angina","Find","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","Has a doctor ever told you that you had angina?","PX040601010000","N","Finding; Findings; Ordinal; PhenX; Point in time; QL; Qual; Qualitative; Random; Screen","Angina","","","","","Ever told by doctor that you had angina","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
"58304-7","Chest discomfort ever or since last exam or medical history update","TmStp","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","Any chest discomfort eveSIRnce last exam or medical history update?","PX040601020000","N","Chest discomfort eveSIRnce last exam; Date and time; Hx; Ordinal; Past; PhenX; Point in time; QL; Qual; Qualitative; Random; Screen; Time stamp; Timestamp","Chest discomfort eveSIRnce last exam","","","","","Chest discomfort ever or since last exam or medical history update","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
"58304-7","Chest discomfort ever or since last exam or medical history update","TmStp","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","Any chest discomfort ever/since last exam or medical history update?","PX040601020000","N","Chest discomfort ever/since last exam; Date and time; Hx; Ordinal; Past; PhenX; Point in time; QL; Qual; Qualitative; Random; Screen; Time stamp; Timestamp","Chest discomfort ever/since last exam","","","","","Chest discomfort ever or since last exam or medical history update","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
"5830-5","Adenovirus Ag","PrThr","Pt","Tiss","Ord","IF","MICRO","2.73","MIN","","ACTIVE","","1","","","","","","ACIF; Adeno virus; Anticomplement Immunofluorescence; Antigen; Antigens; DFA; FA; Fluorescent antibody; Fluoresent; HAdV; ID; IFA; Immune fluorescence; Immunoflour; Immunofluor; Immunofluorescence; Infectious Disease; InfectiousDisease; Microbiology; Ordinal; Point in time; PR; QL; Qual; Qualitative; Random; Screen; Time Resolved Fluorescence; Tissue; Tissue, unspecified; TRF","HAdV Ag Tiss Ql IF","Both","","","","Adenovirus Ag [Presence] in Tissue by Immunofluorescence","","","","The PrThr property is used for LOINC terms whose results are reported using an ordered categorical scale, regardless of whether or not an internal threshold was used to make that determination. This change was approved by the Laboratory LOINC Committee in June 2016.","12067","0","0","","","","","","1.0","","Adenovirus Ag IF Ql (Tiss)"
"58305-4","Chest discomfort with exertion or excitement","Find","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","","PX040601030000","N","Chest discomf W exertion/excitement; Finding; Findings; Ordinal; PhenX; Point in time; QL; Qual; Qualitative; Random; Screen","Chest discomf W exertion/excitement","","","","","Chest discomfort with exertion or excitement","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
"58306-2","Chest discomfort when quiet or resting","Find","Pt","^Patient","Ord","","PHENX","2.65","MIN","","TRIAL","","2","","","","PX040601040000","N","Finding; Findings; Ordinal; PhenX; Point in time; QL; Qual; Qualitative; Random; Screen","Chest discomfort when quiet or resting","","","","","Chest discomfort when quiet or resting","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.","0","0","0","","","","","","2.30","",""
@ -58634,7 +58634,7 @@
"62660-6","PhenX - hormonal therapy protocol 100701","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.66","NAM","Female participants are asked whether they have ever used Evista® or Nolvadex® and then asked length of time they used it as well as whether they are currently using it. They are asked whether they are using any over-the-counter preparations for hormone replacement or post-menopause symptoms. Lastly, they are asked about their use of prescription female hormones (number of months taken, types, dosage). Note: PhenX staff removed embedded dates of original study for clarity of Toolkit users.","TRIAL","","2","","","","PX100701","N","Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","Hormonal therapy proto","","","","","PhenX - hormonal therapy protocol 100701","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.; Added the PhenX protocol ID to the Component to clearly define the protocol version for which this panel is based upon.","0","0","0","","","Panel","","","2.36","",""
"6266-1","Lycopersicon lycopersicum Ab.IgE","ACnc","Pt","Ser","Qn","","ALLERGY","2.73","MIN","","ACTIVE","","1","","","","","Y","ABS; Aby; Allergen; Allergens; ALLERGY TESTING; Antby; Anti; Antibodies; Antibody; Arbitrary concentration; Autoantibodies; Autoantibody; f25; Immune globulin E; Immunoglobulin E; Lycopersicon esculatum; Lycopersicon lycopersicon; Point in time; QNT; Quan; Quant; Quantitative; Random; Serum; SR; Tomato; UniversalLabOrders","Tomato IgE Qn","Both","","","kIU/L; kU/L","Tomato IgE Ab [Units/volume] in Serum","k[IU]/L","","","","1964","0","0","","","","","","1.0d","","Tomato IgE Qn (S)"
"62661-4","PhenX measure - human papillomavirus vaccine use","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.46","DEL","Questions to assess women's use of the human papillomavirus vaccine. These questions ascertain if a woman received the human papillomavirus vaccine and if so, the number of doses received. Use of the vaccine impacts a woman's risk of developing cervical cancer and the overall incidence rate of cervical cancer.","DEPRECATED","","2","","","","PhenX.100800","N","Measure - HPV vaccine use; Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","","","","","","Deprecated PhenX measure - human papillomavirus vaccine use","","","Measure terms were added to match PhenX hierarchy but make it difficult to locate protocols (which contain the set of variables you would use for a particular purpose). They have been deprecated and mapped directly to protocols.","","0","0","0","","","","","","2.36","",""
"62662-2","PhenX - human papillomavirus vaccine use protocol 100801","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.66","NAM","The interviewer asks the female participant whether she has ever received a human papillomavirus (HPV) vaccination. If she answers yes, the interviewer asks her age and how many shots she received. If the participant answers ""yes"" to question 1, the interviewer should complete the rest of the protocol. If the participant answers ""no"" then the protocol is deemed complete. The PhenX Working Group notes that GARDASIL® is also known as Silgard. European Medicines Agency. (September 25, 2009). Silgard European Public Assessment Report. Retrieved from http://www.emea.europa.eu/humandocs/Humans/EPASIRlgard/silgard.htm. Waknine, Yael. (October 2, 2006). International Approvals: Singulair and Gardasil/Silgard. Medscape Today. Retrieved from http://www.medscape.com/viewarticle/545374.","TRIAL","","2","","","","PX100801","N","HPV vaccine use proto; Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","HPV vaccine use proto","","","","","PhenX - human papillomavirus vaccine use protocol 100801","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.; Added the PhenX protocol ID to the Component to clearly define the protocol version for which this panel is based upon.","0","0","0","","","Panel","","","2.36","",""
"62662-2","PhenX - human papillomavirus vaccine use protocol 100801","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.66","NAM","The interviewer asks the female participant whether she has ever received a human papillomavirus (HPV) vaccination. If she answers yes, the interviewer asks her age and how many shots she received. If the participant answers ""yes"" to question 1, the interviewer should complete the rest of the protocol. If the participant answers ""no"" then the protocol is deemed complete. The PhenX Working Group notes that GARDASIL® is also known as Silgard. European Medicines Agency. (September 25, 2009). Silgard European Public Assessment Report. Retrieved from http://www.emea.europa.eu/humandocs/Humans/EPAR/silgard/silgard.htm. Waknine, Yael. (October 2, 2006). International Approvals: Singulair and Gardasil/Silgard. Medscape Today. Retrieved from http://www.medscape.com/viewarticle/545374.","TRIAL","","2","","","","PX100801","N","HPV vaccine use proto; Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","HPV vaccine use proto","","","","","PhenX - human papillomavirus vaccine use protocol 100801","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.; Added the PhenX protocol ID to the Component to clearly define the protocol version for which this panel is based upon.","0","0","0","","","Panel","","","2.36","",""
"62663-0","PhenX measure - male reproductive tract birth defects","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.46","DEL","Questions to determine whether a male participant has ever had certain conditions that could have developed in utero. Cryptorchidism is failure of one or both of the testes to descend into the scrotum. Hypospadius is a developmental anomaly in which the male urethra opens on the underside of the penis or on the perineum. The purpose of these questions is to determine whether the participant had ever had the following abnormalities that developed in utero: Cryptorchidism, Hypospadius, and/or other related conditions. These conditions are suspected of being hereditary and/or influenced by environmental factors, may reflect abnormalities of androgen production, and may be passed to offspring.","DEPRECATED","","2","","","","PhenX.100900","N","Measure male reproduct birth defects; Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","","","","","","Deprecated PhenX measure - male reproductive tract birth defects","","","Measure terms were added to match PhenX hierarchy but make it difficult to locate protocols (which contain the set of variables you would use for a particular purpose). They have been deprecated and mapped directly to protocols.","","0","0","0","","","","","","2.36","",""
"62664-8","PhenX - male reproductive tract birth defects protocol 100901","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.66","NAM","The male participant answers whether he was ever diagnosed with Cryptorchidism, Hypospadius and/or other related conditions. The questions were originally asked of partners of pregnant women but the WG recommends asking them of adult males. Note: Cryptorchidism is failure of one or both of the testes to descend into the scrotum. Hypospadius is a developmental anomaly in which the male urethra opens on the underside of the penis or on the perineum.","TRIAL","","2","","","","PX100901","N","Male reproductive birth defects proto; Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","Male reproductive birth defects proto","","","","","PhenX - male reproductive tract birth defects protocol 100901","","","","Updated the PhenX ID from ""PhenX.<ID>"" to ""PX<ID>"" in Survey Question Source field to align with the variable identifier used in the PhenX Toolkit.; Added the PhenX protocol ID to the Component to clearly define the protocol version for which this panel is based upon.","0","0","0","","","Panel","","","2.36","",""
"62665-5","PhenX measure - male sexual function","-","Pt","^Patient","-","PhenX","PANEL.PHENX","2.46","DEL","Questions to determine whether a male participant has certain types of sexual function difficulties. The purpose of these questions is to determine whether the participant ever had sexual difficulties regarding erection and/or performance.","DEPRECATED","","2","","","","PhenX.101000","N","FCN; Func; Funct; Pan; Panel; PANEL.PHENX; Panl; Pnl; Point in time; Random","","","","","","Deprecated PhenX measure - male sexual function","","","Measure terms were added to match PhenX hierarchy but make it difficult to locate protocols (which contain the set of variables you would use for a particular purpose). They have been deprecated and mapped directly to protocols.","","0","0","0","","","","","","2.36","",""

Can't render this file because it is too large.

View File

@ -369,20 +369,20 @@ changed_md5 <- function(object) {
}
# give official names to ABs and MOs
rsi <- clinical_breakpoints %>%
clin_break <- clinical_breakpoints %>%
mutate(mo_name = mo_name(mo, language = NULL, keep_synonyms = TRUE, info = FALSE), .after = mo) %>%
mutate(ab_name = ab_name(ab, language = NULL), .after = ab)
if (changed_md5(rsi)) {
if (changed_md5(clin_break)) {
usethis::ui_info(paste0("Saving {usethis::ui_value('clinical_breakpoints')} to {usethis::ui_value('data-raw/')}"))
write_md5(rsi)
try(saveRDS(rsi, "data-raw/clinical_breakpoints.rds", version = 2, compress = "xz"), silent = TRUE)
try(write.table(rsi, "data-raw/clinical_breakpoints.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(haven::write_sas(rsi, "data-raw/clinical_breakpoints.sas"), silent = TRUE)
try(haven::write_sav(rsi, "data-raw/clinical_breakpoints.sav"), silent = TRUE)
try(haven::write_dta(rsi, "data-raw/clinical_breakpoints.dta"), silent = TRUE)
try(openxlsx::write.xlsx(rsi, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE)
try(arrow::write_feather(rsi, "data-raw/clinical_breakpoints.feather"), silent = TRUE)
try(arrow::write_parquet(rsi, "data-raw/clinical_breakpoints.parquet"), silent = TRUE)
write_md5(clin_break)
try(saveRDS(clin_break, "data-raw/clinical_breakpoints.rds", version = 2, compress = "xz"), silent = TRUE)
try(write.table(clin_break, "data-raw/clinical_breakpoints.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(haven::write_sas(clin_break, "data-raw/clinical_breakpoints.sas"), silent = TRUE)
try(haven::write_sav(clin_break, "data-raw/clinical_breakpoints.sav"), silent = TRUE)
try(haven::write_dta(clin_break, "data-raw/clinical_breakpoints.dta"), silent = TRUE)
try(openxlsx::write.xlsx(clin_break, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE)
try(arrow::write_feather(clin_break, "data-raw/clinical_breakpoints.feather"), silent = TRUE)
try(arrow::write_parquet(clin_break, "data-raw/clinical_breakpoints.parquet"), silent = TRUE)
}
if (changed_md5(microorganisms)) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -214,7 +214,7 @@ expect_equal(
1108
)
# empty rsi results
# empty sir results
expect_equal(
sum(first_isolate(example_isolates, include_untested_sir = FALSE)),
1366

View File

@ -69,7 +69,7 @@ expect_error(as.sir.mic(as.mic(16)))
expect_error(as.sir.disk(as.disk(16)))
expect_error(get_guideline("this one does not exist"))
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
# 40 rsi columns
# 40 sir columns
expect_equal(
example_isolates %>%
mutate_at(vars(PEN:RIF), as.character) %>%
@ -218,7 +218,7 @@ expect_inherits(
expect_inherits(
suppressWarnings(as.sir(data.frame(
mo = "Escherichia coli",
amoxi = c("R", "S", "I", "invalid")
amoxi = c("S", "I", "R", "invalid")
))$amoxi),
"sir"
)

View File

@ -33,7 +33,7 @@ if (AMR:::pkg_is_available("dplyr", also_load = FALSE)) {
mo = as.mo("Escherichia coli"),
mic = as.mic(2),
disk = as.disk(20),
rsi = as.sir("S"))
sir = as.sir("S"))
check1 <- lapply(test, class)
test[1, "ab"] <- "GEN"
test[1, "mo"] <- "B_KLBSL_PNMN"

View File

@ -11,7 +11,7 @@
\alias{as.sir.disk}
\alias{as.sir.data.frame}
\alias{sir_interpretation_history}
\title{Interpret MIC and Disk Values, or Clean Raw SIR Data}
\title{Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data}
\format{
An object of class \code{sir} (inherits from \code{ordered}, \code{factor}) of length 1.
}

View File

@ -16,7 +16,7 @@ mean_amr_distance(x, ...)
amr_distance_from_row(amr_distance, row)
}
\arguments{
\item{x}{a vector of class \link[=as.sir]{rsi}, \link[=as.mic]{mic} or \link[=as.disk]{disk}, or a \link{data.frame} containing columns of any of these classes}
\item{x}{a vector of class \link[=as.sir]{sir}, \link[=as.mic]{mic} or \link[=as.disk]{disk}, or a \link{data.frame} containing columns of any of these classes}
\item{...}{variables to select (supports \link[tidyselect:language]{tidyselect language} such as \code{column1:column4} and \code{where(is.mic)}, and can thus also be \link[=ab_selector]{antibiotic selectors}}
@ -46,9 +46,9 @@ Isolates with distances less than 0.01 difference from each other should be cons
}
\examples{
rsi <- random_sir(10)
rsi
mean_amr_distance(rsi)
sir <- random_sir(10)
sir
mean_amr_distance(sir)
mic <- random_mic(10)
mic

View File

@ -71,7 +71,7 @@ sir_sf(
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antibiotics, see section \emph{Combination Therapy} below}
\item{ab_result}{antibiotic results to test against, must be one of more values of "R", "S", "I"}
\item{ab_result}{antibiotic results to test against, must be one or more values of "S", "I", or "R"}
\item{confidence_level}{the confidence level for the returned confidence interval. For the calculation, the number of S or SI isolates, and R isolates are compared with the total number of available isolates with R, S, or I by using \code{\link[=binom.test]{binom.test()}}, i.e., the Clopper-Pearson method.}
@ -264,7 +264,7 @@ if (require("dplyr")) {
combination_n = count_all(CIP, GEN)
)
# Get proportions S/I/R immediately of all rsi columns
# Get proportions S/I/R immediately of all sir columns
example_isolates \%>\%
select(AMX, CIP) \%>\%
proportion_df(translate = FALSE)

View File

@ -33,7 +33,7 @@ Conducting AMR data analysis unfortunately requires in-depth knowledge from diff
* Good questions (always start with those!)
* A thorough understanding of (clinical) epidemiology, to understand the clinical and epidemiological relevance and possible bias of results
* A thorough understanding of (clinical) microbiology/infectious diseases, to understand which microorganisms are causal to which infections and the implications of pharmaceutical treatment, as well as understanding intrinsic and acquired microbial resistance
* Experience with data analysis with microbiological tests and their results, to understand the determination and limitations of MIC values and their interpretations to RSI values
* Experience with data analysis with microbiological tests and their results, to understand the determination and limitations of MIC values and their interpretations to SIR values
* Availability of the biological taxonomy of microorganisms and probably normalisation factors for pharmaceuticals, such as defined daily doses (DDD)
* Available (inter-)national guidelines, and profound methods to apply them