To interact with ICD-10 you should first get your token:
library(WHOicd)
#Substitute CLIENT_ID and CLIENT_SECRET by your credentials
token <- get_token(CLIENT_ID, CLIENT_SECRET)
Searching given a code
The main function relating to ICD-10 is icd10_search()
which searches for the titles and parents of codes, blocks of chapters.
As an example, we can search for the following vector and obtain a
data.frame
:
#Search for code, specific code, chapter and block
codes <- c("D60", "IX", "I10-I15")
icd10_search(token, codes)
#> searched code code_title block
#> 1 D60 D60 Acquired pure red cell aplasia [erythroblastopenia] D60-D64
#> 2 IX <NA> <NA> <NA>
#> 3 I10-I15 <NA> <NA> I10-I15
#> block_title chapter
#> 1 Aplastic and other anaemias III
#> 2 <NA> IX
#> 3 Hypertensive diseases IX
#> chapter_title
#> 1 Diseases of the blood and blood-forming organs and certain disorders involving the immune mechanism
#> 2 Diseases of the circulatory system
#> 3 Diseases of the circulatory system
If you only want to get the title of the current code/chapter/block
you can use icd10_title
which is faster as it requires less
requests to the API:
#Search for code, specific code, chapter and block
codes <- c("D60", "IX", "I10-I15")
icd10_title(token, codes)
#> searched title
#> 1 D60 Acquired pure red cell aplasia [erythroblastopenia]
#> 2 IX Diseases of the circulatory system
#> 3 I10-I15 Hypertensive diseases
Top-down search
Given a chapter you can also list all the blocks in a chapter
icd10_blocks(token, chapter = "III")
#> codes title
#> 1 D50-D53 Nutritional anaemias
#> 2 D55-D59 Haemolytic anaemias
#> 3 D60-D64 Aplastic and other anaemias
#> 4 D65-D69 Coagulation defects, purpura and other haemorrhagic conditions
#> 5 D70-D77 Other diseases of blood and blood-forming organs
#> 6 D80-D89 Certain disorders involving the immune mechanism
As well as all of the chapters in a block:
icd10_codes(token, block = "D55-D59")
#> codes title
#> 1 D55 Anaemia due to enzyme disorders
#> 2 D56 Thalassaemia
#> 3 D57 Sickle-cell disorders
#> 4 D58 Other hereditary haemolytic anaemias
#> 5 D59 Acquired haemolytic anaemia
The same command allows you to search inside a code:
icd10_codes(token, block = "D55")
#> codes title
#> 1 D55.0 Anaemia due to glucose-6-phosphate dehydrogenase [G6PD] deficiency
#> 2 D55.1 Anaemia due to other disorders of glutathione metabolism
#> 3 D55.2 Anaemia due to disorders of glycolytic enzymes
#> 4 D55.3 Anaemia due to disorders of nucleotide metabolism
#> 5 D55.8 Other anaemias due to enzyme disorders
#> 6 D55.9 Anaemia due to enzyme disorder, unspecified
Search for code in releases
Not all codes are available across releases. For example, the
C80.0
code was not in the 2008
release of the
ICD-10. Hence if you are using that release you will not find it:
icd10_search(token, "C80.0", release = 2008)
#> Warning in value[[3L]](cond): Request not found. Possibly any of release,
#> chapter/block/code or language is not available or incorrectly specified.
#> Warning in value[[3L]](cond): Request not found. Possibly any of release,
#> chapter/block/code or language is not available or incorrectly specified.
#> searched chapter chapter_title
#> 1 C80.0 <NA> <NA>
However you can use the icd10_code_search_release
to
search for a release containing that code:
icd10_code_search_release(token, code = "C80.0")
#> [1] "2019" "2016" "2010"
and use one of those releases instead:
icd10_search(token, "C80.0", release = 2016)
#> searched level_0 title_0 level_1
#> 1 C80.0 C80.0 Malignant neoplasm, primary site unknown, so stated C80
#> title_1 level_2
#> 1 Malignant neoplasm, without specification of site C76-C80
#> title_2 level_3
#> 1 Malignant neoplasms of ill-defined, secondary and unspecified sites C00-C97
#> title_3 level_4 title_4
#> 1 Malignant neoplasms II Neoplasms
Additional information on releases
The icd10_releases
function lists all available ICD-10
releases
icd10_releases(token)
#> [1] "2019" "2016" "2010" "2008"
The default is 2019. You can change it with the release
parameter across all functions.
To obtain the complete information on a certain release you can use
the icd10_release_info
function:
icd10_release_info(token, release = 2016)
#> $`@context`
#> [1] "http://id.who.int/icd/contexts/contextForTopLevel.json"
#>
#> $`@id`
#> [1] "http://id.who.int/icd/release/10/2016"
#>
#> $title
#> $title$`@language`
#> [1] "en"
#>
#> $title$`@value`
#> [1] "International Statistical Classification of Diseases and Related Health Problems 10th Revision (ICD-10) Version for 2016"
#>
#>
#> $releaseDate
#> [1] "2016-11-01"
#>
#> $child
#> $child[[1]]
#> [1] "http://id.who.int/icd/release/10/2016/I"
#>
#> $child[[2]]
#> [1] "http://id.who.int/icd/release/10/2016/II"
#>
#> $child[[3]]
#> [1] "http://id.who.int/icd/release/10/2016/III"
#>
#> $child[[4]]
#> [1] "http://id.who.int/icd/release/10/2016/IV"
#>
#> $child[[5]]
#> [1] "http://id.who.int/icd/release/10/2016/V"
#>
#> $child[[6]]
#> [1] "http://id.who.int/icd/release/10/2016/VI"
#>
#> $child[[7]]
#> [1] "http://id.who.int/icd/release/10/2016/VII"
#>
#> $child[[8]]
#> [1] "http://id.who.int/icd/release/10/2016/VIII"
#>
#> $child[[9]]
#> [1] "http://id.who.int/icd/release/10/2016/IX"
#>
#> $child[[10]]
#> [1] "http://id.who.int/icd/release/10/2016/X"
#>
#> $child[[11]]
#> [1] "http://id.who.int/icd/release/10/2016/XI"
#>
#> $child[[12]]
#> [1] "http://id.who.int/icd/release/10/2016/XII"
#>
#> $child[[13]]
#> [1] "http://id.who.int/icd/release/10/2016/XIII"
#>
#> $child[[14]]
#> [1] "http://id.who.int/icd/release/10/2016/XIV"
#>
#> $child[[15]]
#> [1] "http://id.who.int/icd/release/10/2016/XV"
#>
#> $child[[16]]
#> [1] "http://id.who.int/icd/release/10/2016/XVI"
#>
#> $child[[17]]
#> [1] "http://id.who.int/icd/release/10/2016/XVII"
#>
#> $child[[18]]
#> [1] "http://id.who.int/icd/release/10/2016/XVIII"
#>
#> $child[[19]]
#> [1] "http://id.who.int/icd/release/10/2016/XIX"
#>
#> $child[[20]]
#> [1] "http://id.who.int/icd/release/10/2016/XX"
#>
#> $child[[21]]
#> [1] "http://id.who.int/icd/release/10/2016/XXI"
#>
#> $child[[22]]
#> [1] "http://id.who.int/icd/release/10/2016/XXII"
#>
#>
#> $browserUrl
#> [1] "http://apps.who.int/classifications/icd10/browse/2016/en"