msberends / AMR

Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by using evidence-based methods, as described in https://doi.org/10.18637/jss.v104.i03.
https://msberends.github.io/AMR/
Other
83 stars 12 forks source link

Interpreting CLSI values (blood) #5

Closed antunderwood closed 4 years ago

antunderwood commented 4 years ago

I noticed a peculiarity with interpretation of some CLSI antibiotics

> data.frame(mo = "E. coli",
+            AMC = 4) %>%
+   as.rsi(guideline = 'CLSI 2019')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
=> Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline CLSI 2019 ... OK.
       mo AMC
1 E. coli   R
> data.frame(mo = "E. coli",
+            AMC = 4) %>%
+   as.rsi(guideline = 'CLSI 2018')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
=> Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline CLSI 2018 ... OK.
       mo AMC
1 E. coli   S
> data.frame(mo = "E. coli",
+            AMC = 4) %>%
+   as.rsi(guideline = 'EUCAST')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
=> Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline EUCAST 2020 ... OK.
       mo AMC
1 E. coli   S

An MIC value of 4 for AMC which I think should be interpreted as sensitive is being interpreted as R for CLSI 2019

I think this is because of row 6 in the table below

> rsi_translation %>% filter(guideline == 'CLSI 2019' & method == 'MIC' & ab == 'AMC')
   guideline method                   site           mo  ab            ref_tbl disk_dose breakpoint_S breakpoint_R   uti
1  CLSI 2019    MIC                   <NA>      B_AGGRG AMC        M45 Table 9      <NA>         4.00            8 FALSE
2  CLSI 2019    MIC                   <NA>      B_ANRSL AMC           Table 2J      <NA>         4.00           16 FALSE
3  CLSI 2019    MIC                   <NA> B_BRKHL_PSDM AMC       M45 Table 21      <NA>         8.00           32 FALSE
4  CLSI 2019    MIC                   <NA>      B_CRDBC AMC        M45 Table 9      <NA>         4.00            8 FALSE
5  CLSI 2019    MIC                   <NA> B_EKNLL_CRRD AMC        M45 Table 9      <NA>         4.00            8 FALSE
6  CLSI 2019    MIC      Skin, soft tissue B_ESCHR_COLI AMC     VET08 Table 2A      <NA>         0.25            1 FALSE
7  CLSI 2019    MIC                    UTI B_ESCHR_COLI AMC     VET08 Table 2A      <NA>         8.00           NA  TRUE
8  CLSI 2019    MIC Skin, soft tissue, UTI B_ESCHR_COLI AMC     VET08 Table 2A      <NA>         0.25            1  TRUE
9  CLSI 2019    MIC                   <NA>      B_HMPHL AMC           Table 2E      <NA>         4.00            8 FALSE
10 CLSI 2019    MIC                   <NA>      B_KGLLA AMC        M45 Table 9      <NA>         4.00            8 FALSE
11 CLSI 2019    MIC                   <NA> B_MRXLL_CTRR AMC       M45 Table 16      <NA>         4.00            8 FALSE
12 CLSI 2019    MIC                   <NA>      B_PSTRL AMC       M45 Table 17      <NA>         0.50           NA FALSE
13 CLSI 2019    MIC Skin, soft tissue, UTI B_PSTRL_MLTC AMC     VET08 Table 2H      <NA>         0.25            1  TRUE
14 CLSI 2019    MIC                   <NA>      B_STPHY AMC           Table 2C      <NA>         4.00            8 FALSE
15 CLSI 2019    MIC      Skin, soft tissue      B_STPHY AMC     VET08 Table 2C      <NA>         0.25            1 FALSE
16 CLSI 2019    MIC                    UTI      B_STPHY AMC     VET08 Table 2C      <NA>         8.00           NA  TRUE
17 CLSI 2019    MIC Skin, soft tissue, UTI      B_STPHY AMC     VET08 Table 2C      <NA>         0.25            1  TRUE
18 CLSI 2019    MIC                   <NA>      B_STRPT AMC         Table 2H-1      <NA>           NA           NA FALSE
19 CLSI 2019    MIC Skin, soft tissue, UTI      B_STRPT AMC     VET08 Table 2D      <NA>         0.25            1  TRUE
20 CLSI 2019    MIC         Non-meningitis B_STRPT_PNMN AMC           Table 2G      <NA>         2.00            8 FALSE
21 CLSI 2019    MIC                   <NA>      B_VIBRI AMC       M45 Table 20      <NA>         8.00           32 FALSE
22 CLSI 2019    MIC                   <NA>      UNKNOWN AMC Generic CLSI rules   20-10ug         8.00           32 FALSE

This should not be used for bacteraemia, only skin and soft tissue. Is there any way to exclude these and only include interpretations for blood?

antunderwood commented 4 years ago

In addition looking at the https://github.com/msberends/AMR/blob/master/data-raw/DRGLST1.xlsx table I think the values here are for animals image

antunderwood commented 4 years ago

Looking at the code I believe an additional filter here is required https://github.com/msberends/AMR/blob/4be54d608c5da2efa871046a544cff8f00bd0e6b/data-raw/reproduction_of_rsi_translation.R#L9

filter(HOST=='HUMAN') %>%
msberends commented 4 years ago

Nice catch! I removed all animal records from the file, and now:

data.frame(mo = "E. coli",
           AMC = 4) %>%
  as.rsi(guideline = "CLSI 2019")
#> NOTE: Using column `mo` as input for `col_mo`.
#> NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
#> => Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline CLSI 2019 ... OK.
#>        mo AMC
#> 1 E. coli   S

I'm running checks now and will then upload it to the master branch. I'll let you know when it's done!

You're just in time, I was about to release a new version to CRAN! So if you can confirm this is fixed, I will 😉

antunderwood commented 4 years ago

Great - thank you. How do I install locally. Check out code and devtools build?

msberends commented 4 years ago

No, just do:

remotes::install_github("msberends/AMR")

It will install the latest beta version to your computer and then you can just run your code again (you might need to refresh your R session). But this issue is not yet fixed, I'm now also fixing your other issue in one go 🙂

msberends commented 4 years ago

📋 Please take part in our survey!

Now you're at it, please fill in our short questionnaire! You can fill it in completely anonymously. If you know others using this AMR package, please ask them to fill it in too.

Your valuable input will help to improve the package and its functionalities 🙂

antunderwood commented 4 years ago

Survey completed

antunderwood commented 4 years ago

No, just do:

remotes::install_github("msberends/AMR")

It will install the latest beta version to your computer and then you can just run your code again (you might need to refresh your R session). But this issue is not yet fixed, I'm now also fixing your other issue in one go 🙂

Let me know when it's ready for testing

msberends commented 4 years ago

Ready! You can test the 'new' as.rsi() 😄

Thanks for filling in the survey!

antunderwood commented 4 years ago

Sorry for the late reply. Was checking out my comparison and it's much improved. The fixes for human only and the conserve_capped_values work a treat.

I was running into some more discrepancies.

It turns out that exports from Vitek have values such as <=.25 (i.e with no leading 0). as.mic can't interpret this and converts the value to NA

I can solve this by transforming my dataframe as follows

 dplyr::mutate(across(-c(id,Species), str_replace, "([<>]=*)\\.", "\\10.")) 

would you consider making a modification to the as.mic function to accommodate this? Should I raise a new issue?

msberends commented 4 years ago

No problem about the late reply, wasn’t that late!

Using across() already, nice 😜

Sure thing, I’ll fix it in the morning. New issue would be best, I’ll handle it. Many thanks again!

msberends commented 4 years ago

Fix released to official R repository

Just a small notice: we released a new software version, containing the fix to this issue. Please update your version using either the user interface of your software, or by running:

install.packages("AMR")