diff --git a/NEWS.md b/NEWS.md index 35b24613..f6607863 100755 --- a/NEWS.md +++ b/NEWS.md @@ -46,6 +46,8 @@ * Any progress bar will now only show in interactive mode (i.e. not in R Markdown) * Speed improvement for `mdro()` and `filter_ab_class()` * New option `arrows_textangled` for `ggplot_pca()` to indicate whether the text at the end of the arrows should be angled (defaults to `TRUE`, as it was in previous versions) +* Added parenteral DDD to benzylpenicillin +* Fixed a bug where `as.mic()` could not handle dots without a leading zero (like `"<=.25`) ### Other * Moved primary location of this project from GitLab to [GitHub](https://github.com/msberends/AMR), giving us native support for automated syntax checking without being dependent on external services such as AppVeyor and Travis CI. @@ -132,7 +134,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag ### New * Support for the newest [EUCAST Clinical Breakpoint Tables v.10.0](http://www.eucast.org/clinical_breakpoints/), valid from 1 January 2020. This affects translation of MIC and disk zones using `as.rsi()` and inferred resistance and susceptibility using `eucast_rules()`. -* The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: . This **allows for machine reading these guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file [can be found here](https://gitlab.com/msberends/AMR/blob/master/data-raw/read_EUCAST.R). +* The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: . This **allows for machine reading these guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file [can be found here](https://github.com/msberends/AMR/blob/master/data-raw/read_EUCAST.R). * Support for LOINC and SNOMED codes * Support for LOINC codes in the `antibiotics` data set. Use `ab_loinc()` to retrieve LOINC codes, or use a LOINC code for input in any `ab_*` function: ```r @@ -449,9 +451,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag * All references to antibiotics in our package now use EARS-Net codes, like `AMX` for amoxicillin * Functions `atc_certe`, `ab_umcg` and `atc_trivial_nl` have been removed * All `atc_*` functions are superceded by `ab_*` functions - * All output will be translated by using an included translation file which [can be viewed here](https://gitlab.com/msberends/AMR/blob/master/data-raw/translations.tsv). - - Please [create an issue in one of our repositories](https://gitlab.com/msberends/AMR/issues/new?issue[title]=Translation%20suggestion) if you want additions in this file. + * All output will be translated by using an included translation file which [can be viewed here](https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv) * Improvements to plotting AMR results with `ggplot_rsi()`: * New parameter `colours` to set the bar colours * New parameters `title`, `subtitle`, `caption`, `x.title` and `y.title` to set titles and axis descriptions @@ -475,9 +475,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag freq(age) %>% boxplot() ``` -* Removed all hardcoded EUCAST rules and replaced them with a new reference file which [can be viewed here](https://gitlab.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv). - - Please [create an issue in one of our repositories](https://gitlab.com/msberends/AMR/issues/new?issue[title]=EUCAST%20edit) if you want changes in this file. +* Removed all hardcoded EUCAST rules and replaced them with a new reference file which [can be viewed here](https://github.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv) * Added ceftazidim intrinsic resistance to *Streptococci* * Changed default settings for `age_groups()`, to let groups of fives and tens end with 100+ instead of 120+ * Fix for `freq()` for when all values are `NA` @@ -694,7 +692,7 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git # AMR 0.5.0 #### New -* Repository moved to GitLab: https://gitlab.com/msberends/AMR +* Repository moved to GitLab * Function `count_all` to get all available isolates (that like all `portion_*` and `count_*` functions also supports `summarise` and `group_by`), the old `n_rsi` is now an alias of `count_all` * Function `get_locale` to determine language for language-dependent output for some `mo_*` functions. This is now the default value for their `language` parameter, by which the system language will be used at default. * Data sets `microorganismsDT`, `microorganisms.prevDT`, `microorganisms.unprevDT` and `microorganisms.oldDT` to improve the speed of `as.mo`. They are for reference only, since they are primarily for internal use of `as.mo`. diff --git a/R/ab_property.R b/R/ab_property.R index 882e4181..0b262f2c 100644 --- a/R/ab_property.R +++ b/R/ab_property.R @@ -23,7 +23,7 @@ #' #' Use these functions to return a specific property of an antibiotic from the [antibiotics] data set. All input values will be evaluated internally with [as.ab()]. #' @inheritSection lifecycle Stable lifecycle -#' @param x any (vector of) text that can be coerced to a valid microorganism code with [as.ab()] +#' @param x any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()] #' @param tolower logical to indicate whether the first character of every output should be transformed to a lower case character. This will lead to e.g. "polymyxin B" and not "polymyxin b". #' @param property one of the column names of one of the [antibiotics] data set #' @param language language of the returned text, defaults to system language (see [get_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation. diff --git a/data-raw/antibiotics.txt b/data-raw/antibiotics.txt index 92a57f41..59d55a0d 100644 --- a/data-raw/antibiotics.txt +++ b/data-raw/antibiotics.txt @@ -329,7 +329,7 @@ "PEF" "J01MA03" 51081 "Pefloxacin" "Quinolones" "Quinolone antibacterials" "Fluoroquinolones" "c(\"\", \"pefl\")" "c(\"abactal\", \"labocton\", \"pefloxacin\", \"pefloxacine\", \"pefloxacino\", \"pefloxacinum\", \"perfloxacin\", \"silver pefloxacin\")" 0.8 "g" 0.8 "g" "3906-5" "PNM" "J01CE06" 10250769 "Penamecillin" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "c(\"hydroxymethyl\", \"penamecilina\", \"penamecillin\", \"penamecillina\", \"penamecilline\", \"penamecillinum\")" 1.05 "g" "character(0)" "PEN" "J01CE01" 5904 "Penicillin G" "Beta-lactams/penicillins" "Combinations of antibacterials" "Combinations of antibacterials" "c(\"p\", \"pen\", \"peni\", \"pv\")" "c(\"abbocillin\", \"ayercillin\", \"bencilpenicilina\", \"benzopenicillin\", \"benzyl penicillin\", \"benzylpenicillin\", \"benzylpenicillin g\", \"benzylpenicilline\", \"benzylpenicillinum\", \"bicillin\", \"cillora\", \"cilloral\", \"cilopen\", \"compocillin g\", \"cosmopen\", \"dropcillin\", \"free penicillin g\", \"free penicillin ii\", \"galofak\", \"gelacillin\", \"liquacillin\", \"megacillin\", \"pencillin g\", \"penicillin\", \"penicilling\", \"pentids\", \"permapen\", \"pfizerpen\", \"pfizerpen g\", \"pharmacillin\", \"pradupen\", \"specilline g\", \"ursopen\" -)" "3913-1" +)" 3.6 "g" "3913-1" "PNV" "J01CE01" 6869 "Penicillin V" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "c(\"bepe\", \"p\", \"pen\", \"pv\")" "c(\"acipen v\", \"apocillin\", \"apopen\", \"beromycin\", \"calcipen\", \"compocillin v\", \"crystapen v\", \"distaquaine v\", \"eskacillian v\", \"eskacillin v\", \"fenacilin\", \"fenospen\", \"meropenin\", \"oracillin\", \"oratren\", \"penicillin v\", \"phenocillin\", \"phenomycilline\", \"phenopenicillin\", \"robicillin\", \"rocilin\", \"stabicillin\", \"vebecillin\", \"veetids\", \"vegacillin\")" 3.6 "g" "3914-9" "PNO" "Penicillin/novobiocin" "Beta-lactams/penicillins" "" "" "" "PSU" "Penicillin/sulbactam" "Beta-lactams/penicillins" "" "" "" diff --git a/data-raw/reproduction_of_antibiotics.R b/data-raw/reproduction_of_antibiotics.R index ede153bb..9dc72c36 100644 --- a/data-raw/reproduction_of_antibiotics.R +++ b/data-raw/reproduction_of_antibiotics.R @@ -541,6 +541,10 @@ old_sym <- old_sym[!old_sym %in% c("Cotrimoxazole", "Bactrimel")] antibiotics[which(antibiotics$ab == "SMX"), "synonyms"][[1]] <- list(old_sym) antibiotics[which(antibiotics$ab == "SXT"), "synonyms"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "COL"), "synonyms"][[1]], "Cotrimoxazole", "Bactrimel", "Septra", "Bactrim", "Cotrimazole")))) +# New DDDs +antibiotics[which(antibiotics$ab == "PEN"), "iv_ddd"] <- 3.6 +antibiotics[which(antibiotics$ab == "PEN"), "iv_units"] <- "g" + ## new ATC codes # ceftaroline antibiotics[which(antibiotics$ab == "CPT"), "atc"] <- "J01DI02" diff --git a/data/antibiotics.rda b/data/antibiotics.rda index ca57f4df..eeab73ee 100755 Binary files a/data/antibiotics.rda and b/data/antibiotics.rda differ diff --git a/docs/news/index.html b/docs/news/index.html index 3b667526..5c9418f1 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -298,6 +298,8 @@
  • Any progress bar will now only show in interactive mode (i.e. not in R Markdown)

  • Speed improvement for mdro() and filter_ab_class()

  • New option arrows_textangled for ggplot_pca() to indicate whether the text at the end of the arrows should be angled (defaults to TRUE, as it was in previous versions)

  • +
  • Added parenteral DDD to benzylpenicillin

  • +
  • Fixed a bug where as.mic() could not handle dots without a leading zero (like "<=.25)

  • @@ -447,7 +449,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ New
    • Support for the newest EUCAST Clinical Breakpoint Tables v.10.0, valid from 1 January 2020. This affects translation of MIC and disk zones using as.rsi() and inferred resistance and susceptibility using eucast_rules().
    • -
    • The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt. This allows for machine reading these guidelines, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file can be found here.
    • +
    • The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt. This allows for machine reading these guidelines, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file can be found here.
    • Support for LOINC and SNOMED codes
      • @@ -865,43 +867,39 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/

        Changed

          -
        • Fixed a critical bug in first_isolate() where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.

        • -
        • Fixed a bug in eucast_rules() where antibiotics from WHONET software would not be recognised

        • -
        • -

          Completely reworked the antibiotics data set:

          +
        • Fixed a critical bug in first_isolate() where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.
        • +
        • Fixed a bug in eucast_rules() where antibiotics from WHONET software would not be recognised
        • +
        • Completely reworked the antibiotics data set:
            -
          • -

            All entries now have 3 different identifiers:

            +
          • All entries now have 3 different identifiers:
            • Column ab contains a human readable EARS-Net code, used by ECDC and WHO/WHONET - this is the primary identifier used in this package
            • Column atc contains the ATC code, used by WHO/WHOCC
            • Column cid contains the CID code (Compound ID), used by PubChem
          • -
          • Based on the Compound ID, almost 5,000 official brand names have been added from many different countries

          • -
          • All references to antibiotics in our package now use EARS-Net codes, like AMX for amoxicillin

          • -
          • Functions atc_certe, ab_umcg and atc_trivial_nl have been removed

          • -
          • All atc_* functions are superceded by ab_* functions

          • -
          • -

            All output will be translated by using an included translation file which can be viewed here.

            -

            Please create an issue in one of our repositories if you want additions in this file.

            +
          • Based on the Compound ID, almost 5,000 official brand names have been added from many different countries
          • +
          • All references to antibiotics in our package now use EARS-Net codes, like AMX for amoxicillin
          • +
          • Functions atc_certe, ab_umcg and atc_trivial_nl have been removed
          • +
          • All atc_* functions are superceded by ab_* functions
          • +
          • All output will be translated by using an included translation file which can be viewed here
        • -
        • -

          Improvements to plotting AMR results with ggplot_rsi():

          +
        • Improvements to plotting AMR results with ggplot_rsi():
          • New parameter colours to set the bar colours
          • New parameters title, subtitle, caption, x.title and y.title to set titles and axis descriptions
        • -
        • Improved intelligence of looking up antibiotic columns in a data set using guess_ab_col()

        • -
        • Added ~5,000 more old taxonomic names to the microorganisms.old data set, which leads to better results finding when using the as.mo() function

        • -
        • This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like portion_df() and count_df() this means that their new parameter combine_SI is TRUE at default. Our plotting function ggplot_rsi() also reflects this change since it uses count_df() internally.

        • -
        • The age() function gained a new parameter exact to determine ages with decimals

        • -
        • Removed deprecated functions guess_mo(), guess_atc(), EUCAST_rules(), interpretive_reading(), rsi()

        • -
        • -

          Frequency tables (freq()):

          +
        • Improved intelligence of looking up antibiotic columns in a data set using guess_ab_col() +
        • +
        • Added ~5,000 more old taxonomic names to the microorganisms.old data set, which leads to better results finding when using the as.mo() function
        • +
        • This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like portion_df() and count_df() this means that their new parameter combine_SI is TRUE at default. Our plotting function ggplot_rsi() also reflects this change since it uses count_df() internally.
        • +
        • The age() function gained a new parameter exact to determine ages with decimals
        • +
        • Removed deprecated functions guess_mo(), guess_atc(), EUCAST_rules(), interpretive_reading(), rsi() +
        • +
        • Frequency tables (freq()):
          • speed improvement for microbial IDs

          • fixed factor level names for R Markdown

          • @@ -919,20 +917,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
        • -
        • -

          Removed all hardcoded EUCAST rules and replaced them with a new reference file which can be viewed here.

          -

          Please create an issue in one of our repositories if you want changes in this file.

          +
        • Removed all hardcoded EUCAST rules and replaced them with a new reference file which can be viewed here
        • -
        • Added ceftazidim intrinsic resistance to Streptococci

        • -
        • Changed default settings for age_groups(), to let groups of fives and tens end with 100+ instead of 120+

        • -
        • Fix for freq() for when all values are NA

        • -
        • Fix for first_isolate() for when dates are missing

        • -
        • Improved speed of guess_ab_col()

        • -
        • Function as.mo() now gently interprets any number of whitespace characters (like tabs) as one space

        • -
        • Function as.mo() now returns UNKNOWN for "con" (WHONET ID of ‘contamination’) and returns NA for "xxx"(WHONET ID of ‘no growth’)

        • -
        • Small algorithm fix for as.mo()

        • -
        • Removed viruses from data set microorganisms.codes and cleaned it up

        • -
        • Fix for mo_shortname() where species would not be determined correctly

        • +
        • Added ceftazidim intrinsic resistance to Streptococci +
        • +
        • Changed default settings for age_groups(), to let groups of fives and tens end with 100+ instead of 120+
        • +
        • Fix for freq() for when all values are NA +
        • +
        • Fix for first_isolate() for when dates are missing
        • +
        • Improved speed of guess_ab_col() +
        • +
        • Function as.mo() now gently interprets any number of whitespace characters (like tabs) as one space
        • +
        • Function as.mo() now returns UNKNOWN for "con" (WHONET ID of ‘contamination’) and returns NA for "xxx"(WHONET ID of ‘no growth’)
        • +
        • Small algorithm fix for as.mo() +
        • +
        • Removed viruses from data set microorganisms.codes and cleaned it up
        • +
        • Fix for mo_shortname() where species would not be determined correctly
    @@ -1198,8 +1198,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/

    New

      -
    • Repository moved to GitLab: https://gitlab.com/msberends/AMR -
    • +
    • Repository moved to GitLab
    • Function count_all to get all available isolates (that like all portion_* and count_* functions also supports summarise and group_by), the old n_rsi is now an alias of count_all
    • Function get_locale to determine language for language-dependent output for some mo_* functions. This is now the default value for their language parameter, by which the system language will be used at default.
    • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 5dbee0a9..e55e1ab2 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -10,7 +10,7 @@ articles: WHONET: WHONET.html benchmarks: benchmarks.html resistance_predict: resistance_predict.html -last_built: 2020-07-30T10:26Z +last_built: 2020-07-30T13:15Z urls: reference: https://msberends.github.io/AMR/reference article: https://msberends.github.io/AMR/articles diff --git a/docs/reference/ab_property.html b/docs/reference/ab_property.html index 3823387d..5c80b836 100644 --- a/docs/reference/ab_property.html +++ b/docs/reference/ab_property.html @@ -266,7 +266,7 @@ x -

      any (vector of) text that can be coerced to a valid microorganism code with as.ab()

      +

      any (vector of) text that can be coerced to a valid antibiotic code with as.ab()

      language diff --git a/man/ab_property.Rd b/man/ab_property.Rd index b8f8c475..5cef1b7f 100644 --- a/man/ab_property.Rd +++ b/man/ab_property.Rd @@ -44,7 +44,7 @@ ab_url(x, open = FALSE, ...) ab_property(x, property = "name", language = get_locale(), ...) } \arguments{ -\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.ab]{as.ab()}}} +\item{x}{any (vector of) text that can be coerced to a valid antibiotic code with \code{\link[=as.ab]{as.ab()}}} \item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.} diff --git a/tests/testthat/test-ab.R b/tests/testthat/test-ab.R index 0c2713b6..18fa49dc 100755 --- a/tests/testthat/test-ab.R +++ b/tests/testthat/test-ab.R @@ -22,6 +22,9 @@ context("ab.R") test_that("as.ab works", { + + skip_on_cran() + expect_equal(as.character(as.ab(c("J01FA01", "J 01 FA 01", "Erythromycin", diff --git a/tests/testthat/test-ab_property.R b/tests/testthat/test-ab_property.R index 3e9447f9..91a39d0f 100644 --- a/tests/testthat/test-ab_property.R +++ b/tests/testthat/test-ab_property.R @@ -22,7 +22,9 @@ context("ab_property.R") test_that("ab_property works", { - + + skip_on_cran() + expect_identical(ab_name("AMX"), "Amoxicillin") expect_identical(as.character(ab_atc("AMX")), "J01CA04") expect_identical(ab_cid("AMX"), as.integer(33613)) diff --git a/tests/testthat/test-count.R b/tests/testthat/test-count.R index 49dba5c9..9dbfa6f4 100644 --- a/tests/testthat/test-count.R +++ b/tests/testthat/test-count.R @@ -23,6 +23,8 @@ context("count.R") test_that("counts work", { + skip_on_cran() + expect_equal(count_resistant(example_isolates$AMX), count_R(example_isolates$AMX)) expect_equal(count_susceptible(example_isolates$AMX), count_SI(example_isolates$AMX)) expect_equal(count_all(example_isolates$AMX), n_rsi(example_isolates$AMX)) diff --git a/tests/testthat/test-pca.R b/tests/testthat/test-pca.R index b2bb2ba6..615ea0d1 100644 --- a/tests/testthat/test-pca.R +++ b/tests/testthat/test-pca.R @@ -22,6 +22,9 @@ context("pca.R") test_that("PCA works", { + + skip_on_cran() + resistance_data <- structure(list(order = c("Bacillales", "Enterobacterales", "Enterobacterales"), genus = c("Staphylococcus", "Escherichia", "Klebsiella"), AMC = c(0.00425, 0.13062, 0.10344), diff --git a/tests/testthat/test-proportion.R b/tests/testthat/test-proportion.R index 8346ccdc..dff399cc 100755 --- a/tests/testthat/test-proportion.R +++ b/tests/testthat/test-proportion.R @@ -22,6 +22,9 @@ context("proportion.R") test_that("proportions works", { + + skip_on_cran() + expect_equal(proportion_R(example_isolates$AMX), resistance(example_isolates$AMX)) expect_equal(proportion_SI(example_isolates$AMX), susceptibility(example_isolates$AMX))