1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 19:41:49 +02:00

(v0.9.0.9009) antibiotics data set update

This commit is contained in:
2020-01-08 11:30:33 +01:00
parent ced1a7b7fa
commit 64f5ceef03
49 changed files with 134 additions and 59 deletions

14
R/ab.R
View File

@ -43,7 +43,7 @@
#' @inheritSection AMR Read more on our website!
#' @export
#' @examples
#' # These examples all return "ERY", the ID of Erythromycin:
#' # these examples all return "ERY", the ID of erythromycin:
#' as.ab("J01FA01")
#' as.ab("J 01 FA 01")
#' as.ab("Erythromycin")
@ -54,8 +54,14 @@
#' as.ab("eritromicine") # spelled wrong, yet works
#' as.ab("Erythrocin") # trade name
#' as.ab("Romycin") # trade name
#'
#' # spelling from different languages and dyslexia are no problem
#' ab_atc("ceftriaxon")
#' ab_atc("cephtriaxone")
#' ab_atc("cephthriaxone")
#' ab_atc("seephthriaaksone")
#'
#' # Use ab_* functions to get a specific properties (see ?ab_property);
#' # use ab_* functions to get a specific properties (see ?ab_property);
#' # they use as.ab() internally:
#' ab_name("J01FA01") # "Erythromycin"
#' ab_name("eryt") # "Erythromycin"
@ -87,6 +93,10 @@ as.ab <- function(x, ...) {
# spaces around non-characters must be removed: amox + clav -> amox/clav
x_bak_clean <- gsub("(.*[a-zA-Z0-9]) ([^a-zA-Z0-9].*)", "\\1\\2", x_bak_clean)
x_bak_clean <- gsub("(.*[^a-zA-Z0-9]) ([a-zA-Z0-9].*)", "\\1\\2", x_bak_clean)
# remove hyphen after a starting "co"
x_bak_clean <- gsub("^co-", "co", x_bak_clean, ignore.case = TRUE)
# replace text 'and' with a slash
x_bak_clean <- gsub(" and ", "/", x_bak_clean, ignore.case = TRUE)
x <- unique(x_bak_clean)
x_new <- rep(NA_character_, length(x))

View File

@ -72,6 +72,12 @@
#' ab_name("floxapen") # "Flucloxacillin"
#' ab_name(21319) # "Flucloxacillin" (using CID)
#' ab_name("J01CF05") # "Flucloxacillin" (using ATC)
#'
#' # spelling from different languages and dyslexia are no problem
#' ab_atc("ceftriaxon")
#' ab_atc("cephtriaxone")
#' ab_atc("cephthriaxone")
#' ab_atc("seephthriaaksone")
ab_name <- function(x, language = get_locale(), tolower = FALSE, ...) {
x <- translate_AMR(ab_validate(x = x, property = "name", ...), language = language)
if (tolower == TRUE) {