diff --git a/DESCRIPTION b/DESCRIPTION index 7e796e4a..9feab66c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 2.1.0.9002 +Version: 2.1.0.9003 Date: 2023-10-20 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 1a30f38d..7e4bc348 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.0.9002 +# AMR 2.1.0.9003 * Fix for selecting first isolates using the phenotype-based method * This included too many isolates when patients had altering antibiograms within the same bacterial species diff --git a/data-raw/clin_break.md5 b/data-raw/clin_break.md5 index 97061839..beec8d7d 100644 --- a/data-raw/clin_break.md5 +++ b/data-raw/clin_break.md5 @@ -1 +1 @@ -b0c1c3ddb9f8a23aedff6208e9f8d32a +c4a5519e0ecc74220fc768e944a372f7 diff --git a/data-raw/clinical_breakpoints.dta b/data-raw/clinical_breakpoints.dta index f04574e5..a0b78d3e 100644 Binary files a/data-raw/clinical_breakpoints.dta and b/data-raw/clinical_breakpoints.dta differ diff --git a/data-raw/clinical_breakpoints.feather b/data-raw/clinical_breakpoints.feather index d2e3cc95..e487fc23 100644 Binary files a/data-raw/clinical_breakpoints.feather and b/data-raw/clinical_breakpoints.feather differ diff --git a/data-raw/clinical_breakpoints.parquet b/data-raw/clinical_breakpoints.parquet index 666f51c0..daf3be97 100644 Binary files a/data-raw/clinical_breakpoints.parquet and b/data-raw/clinical_breakpoints.parquet differ diff --git a/data-raw/clinical_breakpoints.rds b/data-raw/clinical_breakpoints.rds index c5b3bdcc..f4ca9170 100644 Binary files a/data-raw/clinical_breakpoints.rds and b/data-raw/clinical_breakpoints.rds differ diff --git a/data-raw/clinical_breakpoints.sav b/data-raw/clinical_breakpoints.sav index 205aa30c..2c176acb 100644 Binary files a/data-raw/clinical_breakpoints.sav and b/data-raw/clinical_breakpoints.sav differ diff --git a/data-raw/clinical_breakpoints.txt b/data-raw/clinical_breakpoints.txt index de0dca21..f5d4f6ba 100644 --- a/data-raw/clinical_breakpoints.txt +++ b/data-raw/clinical_breakpoints.txt @@ -15699,7 +15699,7 @@ "CLSI 2023" "human" "DISK" "B_[ORD]_ENTRBCTR" 5 "PLZ" "Table 2A" "30ug" 18 14 FALSE "CLSI 2023" "human" "MIC" "B_[ORD]_ENTRBCTR" 5 "PLZ" "Table 2A" 2 8 FALSE "CLSI 2023" "human" "DISK" "B_[ORD]_ENTRBCTR" 5 "SAM" "Table 2A" "10ug/10ug" 15 11 FALSE -"CLSI 2023" "human" "MIC" "B_[ORD]_ENTRBCTR" 5 "SAM" "Table 2A" 16 32 FALSE +"CLSI 2023" "human" "MIC" "B_[ORD]_ENTRBCTR" 5 "SAM" "Table 2A" 8 32 FALSE "CLSI 2023" "human" "DISK" "B_[ORD]_ENTRBCTR" 5 "SMX" "Table 2A" "200ug/300ug" 17 12 FALSE "CLSI 2023" "human" "MIC" "B_[ORD]_ENTRBCTR" 5 "SMX" "Table 2A" 256 512 FALSE "CLSI 2023" "human" "DISK" "B_[ORD]_ENTRBCTR" 5 "SOX" "Table 2A" "200ug/300ug" 17 12 FALSE diff --git a/data-raw/clinical_breakpoints.xlsx b/data-raw/clinical_breakpoints.xlsx index 91f130c7..a91b897d 100644 Binary files a/data-raw/clinical_breakpoints.xlsx and b/data-raw/clinical_breakpoints.xlsx differ diff --git a/data-raw/clinical_breakpoints.xpt b/data-raw/clinical_breakpoints.xpt index f5f254d0..c225d964 100644 Binary files a/data-raw/clinical_breakpoints.xpt and b/data-raw/clinical_breakpoints.xpt differ diff --git a/data-raw/reproduction_of_clinical_breakpoints.R b/data-raw/reproduction_of_clinical_breakpoints.R index 423091c7..5a35dbcc 100644 --- a/data-raw/reproduction_of_clinical_breakpoints.R +++ b/data-raw/reproduction_of_clinical_breakpoints.R @@ -192,7 +192,7 @@ devtools::load_all() # BREAKPOINTS ---- -# now that we have the right MO codes, get the breakpoints and convert them +# now that we have the correct MO codes, get the breakpoints and convert them whonet_breakpoints %>% count(GUIDELINES, BREAKPOINT_TYPE) %>% @@ -213,7 +213,7 @@ unknown <- breakpoints %>% breakpoints %>% filter(code %in% unknown) %>% count(GUIDELINES, YEAR, ORGANISM_CODE, BREAKPOINT_TYPE, sort = TRUE) -# these codes are currently (2023-07-08): clu, kma. No clue, so remove them: +# these codes are currently (2023-07-08): clu, kma. No clue (are not in MO list of WHONET), so remove them: breakpoints <- breakpoints %>% filter(!is.na(mo)) @@ -284,6 +284,9 @@ breakpoints_new <- breakpoints_new %>% breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S", drop = TRUE])) breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R", drop = TRUE])) + +# FIXES FOR WHONET ERRORS ---- + # WHONET has no >1024 but instead uses 1025, 513, etc, so as.mic() cannot be used to clean. # instead, clean based on MIC factor levels m <- unique(as.double(as.mic(levels(as.mic(1))))) @@ -315,7 +318,9 @@ clinical_breakpoints <- clinical_breakpoints %>% filter(mo != as.mo("Achromobact clinical_breakpoints <- clinical_breakpoints %>% filter(!(mo == as.mo("Streptococcus viridans") & ab == "GEN")) # Nitrofurantoin in Staph (EUCAST) only applies to S. saprophyticus, while WHONET has the DISK correct but the MIC on genus level clinical_breakpoints$mo[clinical_breakpoints$mo == "B_STPHY" & clinical_breakpoints$ab == "NIT" & clinical_breakpoints$guideline %like% "EUCAST"] <- as.mo("B_STPHY_SPRP") -# determine rank again +# WHONET sets the 2023 breakpoints for SAM to MIC of 16/32 for Enterobacterales, should be MIC 8/32 like AMC (see issue #123 on github.com/msberends/AMR) +clinical_breakpoints$breakpoint_S[clinical_breakpoints$mo == "B_[ORD]_ENTRBCTR" & clinical_breakpoints$ab == "SAM" & clinical_breakpoints$guideline %like% "CLSI 2023" & clinical_breakpoints$method == "MIC"] <- 8 +# determine rank again now that some changes were made on taxonomic level (genus -> species) clinical_breakpoints <- clinical_breakpoints %>% mutate(rank_index = case_when( is.na(mo_rank(mo, keep_synonyms = TRUE)) ~ 6, # for UNKNOWN, B_GRAMN, B_ANAER, B_ANAER-NEG, etc. @@ -328,7 +333,6 @@ clinical_breakpoints <- clinical_breakpoints %>% TRUE ~ 6 )) - # WHONET adds one log2 level to the R breakpoint for their software, e.g. in AMC in Enterobacterales: # EUCAST 2022 guideline: S <= 8 and R > 8 # WHONET file: S <= 8 and R >= 16 @@ -349,6 +353,9 @@ breakpoints_new <- breakpoints_new %>% # fix missing R breakpoint where there is an S breakpoint breakpoints_new[which(is.na(breakpoints_new$breakpoint_R)), "breakpoint_R"] <- breakpoints_new[which(is.na(breakpoints_new$breakpoint_R)), "breakpoint_S"] + +# CHECKS AND SAVE TO PACKAGE ---- + # check again breakpoints_new %>% filter(guideline == "EUCAST 2023", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC") # compare with current version @@ -361,8 +368,6 @@ breakpoints_new %>% filter(mo == "B_STRPT_PNMN", ab == "AMP", guideline == "EUCA dim(breakpoints_new) dim(clinical_breakpoints) -# SAVE TO PACKAGE ---- - clinical_breakpoints <- breakpoints_new clinical_breakpoints <- clinical_breakpoints %>% dataset_UTF8_to_ASCII() usethis::use_data(clinical_breakpoints, overwrite = TRUE, compress = "xz", version = 2) diff --git a/data/clinical_breakpoints.rda b/data/clinical_breakpoints.rda index 2810c646..e10bfa62 100644 Binary files a/data/clinical_breakpoints.rda and b/data/clinical_breakpoints.rda differ diff --git a/inst/tinytest/test-av_property.R b/inst/tinytest/test-av_property.R index 2ecb0775..8a6b1a2f 100644 --- a/inst/tinytest/test-av_property.R +++ b/inst/tinytest/test-av_property.R @@ -57,7 +57,7 @@ expect_stdout(print(av_name("acic", language = NULL))) expect_equal(av_name("29113-8", language = NULL), "Abacavir") expect_equal( av_loinc("Abacavir"), - c("29113-8", "78772-1", "78773-9", "79134-3", "80118-3") + c("29113-8", "30273-7", "30287-7", "30303-2", "78772-1", "78773-9", "79134-3", "80118-3") ) expect_true(av_url("ACI") %like% "whocc.no")