From b020da6cfb971afc15f98edc5ead4bc8805b1920 Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Sun, 11 Feb 2024 23:26:03 +0000 Subject: [PATCH] add all possible API search queries --- DESCRIPTION | 3 +- R/icd_search.R | 87 +++++++++++++++++++++++----- R/utils.R | 6 ++ data-raw/icd_linearization_tables.R | 6 ++ data/icd11_linearization_mms.rda | Bin 689072 -> 682028 bytes inst/WORDLIST | 4 ++ man/icd_search_foundation.Rd | 40 ++++++++++--- 7 files changed, 123 insertions(+), 23 deletions(-) create mode 100644 R/utils.R diff --git a/DESCRIPTION b/DESCRIPTION index a29204f..3856910 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,8 @@ Imports: Suggests: covr, httpuv, - spelling + spelling, + tibble Encoding: UTF-8 LazyData: true Language: en-GB diff --git a/R/icd_search.R b/R/icd_search.R index 5db1afe..16d28c2 100644 --- a/R/icd_search.R +++ b/R/icd_search.R @@ -2,10 +2,16 @@ #' Search the foundation component of the ICD-11 #' #' @param base_url The base URL of the API. Default uses the WHO API server at -#' https://id.who.int/icd/entity -#' @param client The OAuth2 client produced through a call to `icd_oauth_client()` +#' https://id.who.int. If you are using a locally deployed server or hosting +#' your own ICD API server, you should specify the URL of your instance here. +#' @param client The OAuth2 client produced through a call to `icd_oauth_client()`. #' @param q String. Text to be searched. Having the character `%` at the end will -#' be regarded as a wild card for that word +#' be regarded as a wild card for that word. +#' @param subtree A string or vector of strings of URIs. If provided, the +#' search will be performed on the entities provided and their descendants. +#' @param chapter A string or vector of strings of chapter codes +#' eg: c("01", "02") When provided, the search will be performed only on +#' these chapters. #' @param flexisearch Logical. Default is FALSE. Changes the search mode to #' flexible search. In the regular search mode, the Coding Tool will only give #' you results that contain all of the words that you've used in your search. @@ -15,16 +21,24 @@ #' that are typed. It would still try to find the best matching phrase but #' there may be words in your search that are not matched at all. It is #' recommended to use flexible search only when regular search does not -#' provide a result +#' provide a result. #' @param flat Logical. Default is FALSE. If set to true the search result #' entities are provided in a nested data structure representing the -#' ICD-11 hierarchy. Otherwise they are listed as flat list of matches +#' ICD-11 hierarchy. Otherwise they are listed as flat list of matches. +#' @param properties A string or a vector of strings for the properties to be +#' searched. By default the system searches, *"Title"*, *"Synonyms"*, and +#' *"FullySpecifiedName"*. The valid values that could be used are: *Title"*, +#' *"Synonym"*, *"NarrowerTerm"*, *"FullySpecifiedName"*, *"Definition"*, and +#' *"Exclusion"*. +#' @param release A string specifying the release version of the Foundation to +#' search from. If not specified, defaults to the latest release version. See +#' the available versions with `icd_versions`. #' @param highlight Logical. Default is FALSE. If set to FALSE the search result #' highlighting is turned off and the results don't contain special tags for -#' highlighting where the results are found within the text +#' highlighting where the results are found within the text. #' @param api_version Version of the API. Possible values are `v1` or `v2`. #' For example, if you provide value v2, the API will respond in the format of -#' the version 2 of the API. Default is `v2` +#' the version 2 of the API. Default is `v2`. #' @param language ICD-API is multi-lingual. By changing this header, you may #' make the API respond in different languages. Languages will be available as #' the translations of ICD-11 completes. The values are language codes such as @@ -36,36 +50,83 @@ #' @examples #' icd_search_foundation(q = "cholera") #' +#' @rdname icd_search #' @export #' -icd_search_foundation <- function(base_url = "https://id.who.int/icd", +icd_search_foundation <- function(base_url = "https://id.who.int", client = icd_oauth_client(), - q = NULL, + q, + subtree = NULL, + chapter = NULL, flexisearch = FALSE, flat = TRUE, + properties = NULL, + release = NULL, highlight = FALSE, api_version = c("v2", "v1"), language = "en") { ## Get API version to use ---- api_version <- match.arg(api_version) - httr2::request(file.path(base_url, "entity/search")) |> + ## Make base request ---- + req <- httr2::request(file.path(base_url, "icd/entity/search")) |> + httr2::req_url_query(q = q) + + ## Add query components ---- + + ### Subtrees filter ---- + if (!is.null(subtree)) { + req <- req |> + httr2::req_url_query(subtreesFilter = paste(subtree, collapse = ",")) + } + + ### Chapters filter ---- + if (!is.null(chapter)) { + req <- req |> + httr2::req_url_query(chapterFilter = paste(chapter, collapse = ",")) + } + + ### Flexi search and flatResults component ---- + req <- req |> httr2::req_url_query( - q = q, useFlexisearch = ifelse(flexisearch, "true", "false"), - flatResults = ifelse(flat, "true", "false"), + flatResults = ifelse(flat, "true", "false") + ) + + ### Properties ---- + if (!is.null(properties)) { + req <- req |> + httr2::req_url_query( + propertiesToBeSearched = paste(properties, collapse = ",") + ) + } + + ### Release ID ---- + if (!is.null(release)) { + req <- req |> + httr2::req_url_query(releaseId = release) + } + + ### Highlighting ---- + req <- req |> + httr2::req_url_query( highlightingEnabled = ifelse(highlight, "true", "false") - ) |> + ) + + ## Add headers ---- + req <- req |> httr2::req_headers( Accept = "application/json", "API-Version" = api_version, "Accept-Language" = language ) |> + ## Authenticate ---- httr2::req_oauth_client_credentials( client = client, scope = "icdapi_access" ) |> + ## Perform request ---- httr2::req_perform() } diff --git a/R/utils.R b/R/utils.R new file mode 100644 index 0000000..d6e06ad --- /dev/null +++ b/R/utils.R @@ -0,0 +1,6 @@ +#' +#' +#' +#' +#' +#' diff --git a/data-raw/icd_linearization_tables.R b/data-raw/icd_linearization_tables.R index b99b87b..c29ef86 100644 --- a/data-raw/icd_linearization_tables.R +++ b/data-raw/icd_linearization_tables.R @@ -38,6 +38,9 @@ icd11_linearization_mms$Version <- header_values |> (\(x) x[2:3])() |> paste(collapse = ":") +icd11_linearization_mms <- icd11_linearization_mms |> + tibble::tibble() + usethis::use_data(icd11_linearization_mms, overwrite = TRUE, compress = "xz") ### Simple Table MMS ---- @@ -60,4 +63,7 @@ icd11_simple_table_mms <- read_xlsx( sheet = 1, data_only = TRUE ) +icd11_simple_table_mms |> + tibble::tibble() + usethis::use_data(icd11_simple_table_mms, overwrite = TRUE, compress = "xz") diff --git a/data/icd11_linearization_mms.rda b/data/icd11_linearization_mms.rda index 2173db7a72f17ccb3a2c68d9bc4c6eda17d998e5..99b96eb4d2181873aacffd2b476d207145b97865 100644 GIT binary patch delta 345 zcmV-f0jB=2hbpYlDS(6lgaU*Egam{Iga(8Mgb0KQvZVC!<3oyvm1!)60=i=g20I6^d}v|4 z{_*5%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SVZJz7R7MD_#aGQhsVaxt0)ijdmH;8~I9DqCW zNNpJAi-iyK%(>`qAWb*uK$VoMb+HF>j^-w%%WW6|*8V53;bQx-7wRj2OPgdh5^KMh zh`}4rzvL#<2SwbIII_DMN_KMuHPuC1?V#foZpl<)FyjUMJN7?dJ_hCwF6R3opR}o= zDRfa*hgByw>!}-x$(0cGp=N@6W#w-M<~rb=H?0w_MI{vwv%ghbbGK=xCejoxAiTsv ziekk>Z40wdQZ_RPMHnQ1rL^p;YKj%Gz;IQaSkVC7gf(u|HRV?(r$L~NGK-Zp%hS^c z$juR4+5ny8{A=nl!<$J8CUkF-I)oi=a!jKEsw$B=EzyrmETSkPkW(vSN9GzN4a$z_ zNDM?X%&#S#C(jRxEkA?kg!=Q~V7E`;Bm2R$H{o3WL$KO+#IX;5nNt=M=V$r7@X_U_PVKX)HiTDN-ksE4|T|6dT6|Z3Gq6G760z{ z7q<1&+!G7LR3#sU381&v;VjGkclx~?1Pl}z?i#omhl-E`;!NXSi-o!~R+=N^6;g#s zQZrKL{hGInz^2b@fm6#s_dUzgbPRAFK{|(nw$ueeiFV<8?9q?v86G`w0vYPpzn&7Z z$D*g+&f~mx7ac!TuUtsYk_e8yl<`r{8ugA|0DI;u0001)fL)IO0fvVvs=2oY0002A SHc(=l<555Z000000a;p*J!+o- diff --git a/inst/WORDLIST b/inst/WORDLIST index 26dd794..b44fe10 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -6,21 +6,25 @@ ClassKind CodeFactor Codecov DepthInKind +FullySpecifiedName GroupingX ICF IsLeaf IsResidual Lifecycle LinearizationMiniOutput +NarrowerTerm OAuth ORCID PrimaryLocation RC SimpleTabulation SupportedClassifications +URIs WIP api depthinkind +eg es etc fileName diff --git a/man/icd_search_foundation.Rd b/man/icd_search_foundation.Rd index 406f95c..8048263 100644 --- a/man/icd_search_foundation.Rd +++ b/man/icd_search_foundation.Rd @@ -5,11 +5,15 @@ \title{Search the foundation component of the ICD-11} \usage{ icd_search_foundation( - base_url = "https://id.who.int/icd", + base_url = "https://id.who.int", client = icd_oauth_client(), - q = NULL, + q, + subtree = NULL, + chapter = NULL, flexisearch = FALSE, flat = TRUE, + properties = NULL, + release = NULL, highlight = FALSE, api_version = c("v2", "v1"), language = "en" @@ -17,12 +21,20 @@ icd_search_foundation( } \arguments{ \item{base_url}{The base URL of the API. Default uses the WHO API server at -https://id.who.int/icd/entity} +https://id.who.int. If you are using a locally deployed server or hosting +your own ICD API server, you should specify the URL of your instance here.} -\item{client}{The OAuth2 client produced through a call to \code{icd_oauth_client()}} +\item{client}{The OAuth2 client produced through a call to \code{icd_oauth_client()}.} \item{q}{String. Text to be searched. Having the character \verb{\%} at the end will -be regarded as a wild card for that word} +be regarded as a wild card for that word.} + +\item{subtree}{A string or vector of strings of URIs. If provided, the +search will be performed on the entities provided and their descendants.} + +\item{chapter}{A string or vector of strings of chapter codes +eg: c("01", "02") When provided, the search will be performed only on +these chapters.} \item{flexisearch}{Logical. Default is FALSE. Changes the search mode to flexible search. In the regular search mode, the Coding Tool will only give @@ -33,19 +45,29 @@ in flexible search mode, the results do not have to contain all of the words that are typed. It would still try to find the best matching phrase but there may be words in your search that are not matched at all. It is recommended to use flexible search only when regular search does not -provide a result} +provide a result.} \item{flat}{Logical. Default is FALSE. If set to true the search result entities are provided in a nested data structure representing the -ICD-11 hierarchy. Otherwise they are listed as flat list of matches} +ICD-11 hierarchy. Otherwise they are listed as flat list of matches.} + +\item{properties}{A string or a vector of strings for the properties to be +searched. By default the system searches, \emph{"Title"}, \emph{"Synonyms"}, and +\emph{"FullySpecifiedName"}. The valid values that could be used are: \emph{Title"}, +\emph{"Synonym"}, \emph{"NarrowerTerm"}, \emph{"FullySpecifiedName"}, \emph{"Definition"}, and +\emph{"Exclusion"}.} + +\item{release}{A string specifying the release version of the Foundation to +search from. If not specified, defaults to the latest release version. See +the available versions with \code{icd_versions}.} \item{highlight}{Logical. Default is FALSE. If set to FALSE the search result highlighting is turned off and the results don't contain special tags for -highlighting where the results are found within the text} +highlighting where the results are found within the text.} \item{api_version}{Version of the API. Possible values are \code{v1} or \code{v2}. For example, if you provide value v2, the API will respond in the format of -the version 2 of the API. Default is \code{v2}} +the version 2 of the API. Default is \code{v2}.} \item{language}{ICD-API is multi-lingual. By changing this header, you may make the API respond in different languages. Languages will be available as