Skip to contents

Returns information on a certain code.

Usage

icd11_codeinfo(
  token,
  code,
  release = "2024-01",
  linearization = "mms",
  convert_2_terminal = FALSE,
  include = NULL,
  language = "en",
  auto_update = TRUE
)

icd11_codeinfo2(
  token,
  code,
  release = "2024-01",
  linearization = "mms",
  flexible_mode = FALSE,
  convert_2_terminal = FALSE,
  language = "en",
  auto_update = TRUE
)

Arguments

token

(list) Access token to the API obtained from get_token()

code

The code or code combination that will be looked up. (The & and / characters need to be URL encoded)

release

Release version as listed in https://icd.who.int/docs/icd-api/SupportedClassifications/#supported-classifications-and-versions the default is 2024-01.

linearization

(character) ICD-11 linearization (default = "mms"). See all linearizations in the WHO's API website https://icd.who.int/docs/icd-api/APIDoc-Version2/#the-icd11-linearizations

convert_2_terminal

by default it is FALSE, if set to TRUE, the codes will be changed to use the terminal codes (leaf nodes in the hierarchy). In most cases this is done by changing the code to the unspecified residual child

include

Either NULL of provide additional information such as ancestor, decendant or diagnosticCriteria. For example, if you set include="ancestor" the returned response will include all ancestor entity URIs for the requested entity. Use a vector to include multiple properties. For example include = c("ancestor", "diagnosticCriteria")

language

(character) Language for the request. Available languages are listed in https://icd.who.int/docs/icd-api/SupportedClassifications/ the default is English (language = "en").

auto_update

Attempts to update token automatically

flexible_mode

Normally, icd11_codeinfo returns an error when the provided code combination includes codes that are not in the predefined suggested value sets of the entity. If the flexible_mode is set to TRUE, it will return a result even when some of the postcoordination values are not in these defined value sets. In this case, the codes whose postcoordination axis cannot be detected ('/' postcoordination) will be placed under otherPostcoordination rubric.

Details

Users should prefer icd11_codeinfo() while icd11_codeinfo2 is for developers of additional applications as it is directly the result from the API. The icd11_codeinfo() makes two requests to identify the code in terms of a URI and then return information on the URI

Examples

# Assuming that the CLIENT ID and CLIENT SECRET are set up. Substitute accordingly
if (exists("CLIENT_ID") & exists("CLIENT_SECRET")) {
  # Generated token
  token <- get_token(CLIENT_ID, CLIENT_SECRET)

  # Search for ICD-11 URI across multiple releases
  code_info <- icd11_codeinfo(token, code = "8B20")

  #Use retrieve function to obtain more information
  code_info |> retrieve("title")
  code_info |> retrieve("definition")
}
#> [1] "en"                                                                                                                                                                                                                                                     
#> [2] "Fulfills criteria for stroke in acute symptoms of focal brain injury that have lasted 24 hours or more (or led to death before 24 hours), but subtype of stroke (ischemic or haemorrhagic) has not been determined by neuroimaging or other techniques."

# Assuming that the CLIENT ID and CLIENT SECRET are set up. Substitute accordingly
if (exists("CLIENT_ID") & exists("CLIENT_SECRET")) {
  # Generated token
  token <- get_token(CLIENT_ID, CLIENT_SECRET)

  # Search for ICD-11 URI across multiple releases
  icd11_codeinfo2(token, code = "8B20")
}
#> $`@context`
#> [1] "http://id.who.int/icd/contexts/contextForCodeInfo.json"
#> 
#> $`@id`
#> [1] "http://id.who.int/icd/release/11/2024-01/mms/codeinfo/8B20"
#> 
#> $code
#> [1] "8B20"
#> 
#> $stemId
#> [1] "http://id.who.int/icd/release/11/2024-01/mms/1442995018"
#>