Skip to contents

An ICD code consists of, at a minimum, a three digit ICD-10 code (i.e. one upper-case letter followed by two digits). This may optionally be followed by a two digit subcode, selected punctuation symbols (cross "*", dagger "U2020" or exclamation mark "!"). Both the period separating the three-digit code from the subcode, and the hyphen indicating an "incomplete" subcode, are optional. Finally, in the ambulatory system, an additional letter G, V, Z or A may be appended to signify the status ("security") of the diagnosis.

Usage

is_icd_code(str, year = NULL, parse = TRUE)

Arguments

str

Character vector to be tested

year

Year for which to test whether the specification is a valid code. Default: NULL (test whether str matches a code from any year since 2003)

parse

logical. Whether to first parse the input str using icd_parse (Default: TRUE). If FALSE, assumes that str is already formatted as icd_sub (i.e. without separating period or other punctuation)

Value

Logical vector the same length as the character input

See also

Examples

is_icd_code("A09.9")
#> [1] TRUE
is_icd_code("A099")
#> [1] TRUE
is_icd_code("A09.9-")
#> [1] TRUE

is_icd_code("AA9")
#> [1] FALSE

# The following code is syntactically correct but
# has never been in use
is_icd_code("E15.9")
#> [1] FALSE