1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 18:46:13 +01:00
This commit is contained in:
dr. M.S. (Matthijs) Berends 2023-10-20 15:07:11 +02:00
parent 7cda9e575b
commit bcab4bc9ba
14 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 2.1.0.9002 Version: 2.1.0.9003
Date: 2023-10-20 Date: 2023-10-20
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)

View File

@ -1,4 +1,4 @@
# AMR 2.1.0.9002 # AMR 2.1.0.9003
* Fix for selecting first isolates using the phenotype-based method * 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 * This included too many isolates when patients had altering antibiograms within the same bacterial species

View File

@ -1 +1 @@
b0c1c3ddb9f8a23aedff6208e9f8d32a c4a5519e0ecc74220fc768e944a372f7

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -15699,7 +15699,7 @@
"CLSI 2023" "human" "DISK" "B_[ORD]_ENTRBCTR" 5 "PLZ" "Table 2A" "30ug" 18 14 FALSE "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" "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" "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" "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" "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 "CLSI 2023" "human" "DISK" "B_[ORD]_ENTRBCTR" 5 "SOX" "Table 2A" "200ug/300ug" 17 12 FALSE

Binary file not shown.

Binary file not shown.

View File

@ -192,7 +192,7 @@ devtools::load_all()
# BREAKPOINTS ---- # 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 %>% whonet_breakpoints %>%
count(GUIDELINES, BREAKPOINT_TYPE) %>% count(GUIDELINES, BREAKPOINT_TYPE) %>%
@ -213,7 +213,7 @@ unknown <- breakpoints %>%
breakpoints %>% breakpoints %>%
filter(code %in% unknown) %>% filter(code %in% unknown) %>%
count(GUIDELINES, YEAR, ORGANISM_CODE, BREAKPOINT_TYPE, sort = TRUE) 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 %>% breakpoints <- breakpoints %>%
filter(!is.na(mo)) 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_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])) 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. # 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 # instead, clean based on MIC factor levels
m <- unique(as.double(as.mic(levels(as.mic(1))))) 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")) 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 # 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") 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 %>% clinical_breakpoints <- clinical_breakpoints %>%
mutate(rank_index = case_when( mutate(rank_index = case_when(
is.na(mo_rank(mo, keep_synonyms = TRUE)) ~ 6, # for UNKNOWN, B_GRAMN, B_ANAER, B_ANAER-NEG, etc. 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 TRUE ~ 6
)) ))
# WHONET adds one log2 level to the R breakpoint for their software, e.g. in AMC in Enterobacterales: # 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 # EUCAST 2022 guideline: S <= 8 and R > 8
# WHONET file: S <= 8 and R >= 16 # 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 # 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"] 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 # check again
breakpoints_new %>% filter(guideline == "EUCAST 2023", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC") breakpoints_new %>% filter(guideline == "EUCAST 2023", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
# compare with current version # compare with current version
@ -361,8 +368,6 @@ breakpoints_new %>% filter(mo == "B_STRPT_PNMN", ab == "AMP", guideline == "EUCA
dim(breakpoints_new) dim(breakpoints_new)
dim(clinical_breakpoints) dim(clinical_breakpoints)
# SAVE TO PACKAGE ----
clinical_breakpoints <- breakpoints_new clinical_breakpoints <- breakpoints_new
clinical_breakpoints <- clinical_breakpoints %>% dataset_UTF8_to_ASCII() clinical_breakpoints <- clinical_breakpoints %>% dataset_UTF8_to_ASCII()
usethis::use_data(clinical_breakpoints, overwrite = TRUE, compress = "xz", version = 2) usethis::use_data(clinical_breakpoints, overwrite = TRUE, compress = "xz", version = 2)

Binary file not shown.

View File

@ -57,7 +57,7 @@ expect_stdout(print(av_name("acic", language = NULL)))
expect_equal(av_name("29113-8", language = NULL), "Abacavir") expect_equal(av_name("29113-8", language = NULL), "Abacavir")
expect_equal( expect_equal(
av_loinc("Abacavir"), 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") expect_true(av_url("ACI") %like% "whocc.no")