Skip to contents

Provides the best matching classification entity (its code and URI) for the provided diagnostic text.

Usage

icd11_autocode(
  token,
  text,
  release = "2024-01",
  linearization = "mms",
  subtrees_filter = NULL,
  match_threshold = NULL,
  language = "en",
  auto_update = TRUE
)

icd11_autocode2(
  token,
  text,
  release = "2024-01",
  subtrees_filter = NULL,
  match_threshold = NULL,
  language = "en",
  auto_update = TRUE
)

Arguments

token

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

text

(stirng) String to autocode with ICD-11

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

subtrees_filter

(string) Optional parameter. Vector of URIs. If provided, the search will be performed on the entities provided and their descendants

match_threshold

(string) Score is a value between 0 and 1 that indicates the similarity between the input text and the matched term. match_threshold is the minimum score to be included in the output. Will use WHO's default value if no threshold provided

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

Value

A list of the coded information as well as any additional information.

Details

The icd11_autocode function allows you to search across different linearizations such as the Mortality and Morbidity Statistics linearization = "mms" (default) and the International Classifications of Functioning Disability and Health linearization = "icf".

Note

Both icd11_autocode() and icd11_autocode2() provide the best classification. They correspond to two different API entry-points in the WHO's API and provide slighly different amount of information for the same result.

This provides the default autocode but might throw different amount of information as icd11_autocode2.

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-10 releases
  icd11_autocode(token, text = "Cerebrovascular accident")
}
#> $searchText
#> [1] "Cerebrovascular accident"
#> 
#> $matchingText
#> [1] "cerebrovascular accident"
#> 
#> $theCode
#> [1] "8B20"
#> 
#> $foundationURI
#> [1] "http://id.who.int/icd/entity/1442995018"
#> 
#> $linearizationURI
#> [1] "http://id.who.int/icd/release/11/2024-01/mms/1442995018"
#> 
#> $matchLevel
#> [1] 0
#> 
#> $matchScore
#> [1] 1
#> 
#> $matchType
#> [1] 0
#> 

# 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-10 releases
  icd11_autocode2(token, text = "Cerebrovascular accident")
}
#> $searchText
#> [1] "Cerebrovascular accident"
#> 
#> $matchingText
#> [1] "cerebrovascular accident"
#> 
#> $foundationURI
#> [1] "http://id.who.int/icd/entity/1442995018"
#> 
#> $matchLevel
#> [1] 0
#> 
#> $matchScore
#> [1] 1
#> 
#> $matchType
#> [1] 0
#>