Skip to contents

ICD-10-CM

icd10cm(icd = "T76.02XA") |> 
  mutate(Chapter = paste0("* ", icd_ch_name, " \n ", "* Range: [", icd_ch_range, "]"),
         Section = paste0("* ", icd_sec_name, " \n ", "* Range: [", icd_sec_range, "]")
         ) |>
  select("ICD-10-Code"   = icd_code, 
         Description     = icd_description, 
         Chapter,
         Section,
         Abbreviation    = icd_ch_abb,
         "Conflict Group" = icd_conflict_group,
         "Conflict Rule"  = icd_conflict_rule) |> 
  display_long() |>
  gt(groupname_col       = "name", 
     row_group_as_column = TRUE) |>
  fmt_markdown() |> 
  gt_style(tablign       = "right", 
           tabsize       = 16, 
           tabwt         = "bold") |> 
  tab_style(
      style              = cell_text(
      font               = google_font(name = "Fira Code")),
      locations          = cells_body(
        columns          = contains("value"))) |>
  tab_style(
    style                = list(
      cell_fill(color    = "powderblue"),
      cell_text(weight   = "bold"),
      cell_borders(
      sides              = c("all"),
      color              = "powderblue",
      weight             = px(3))
      ),
    locations            = cells_row_groups())
ICD-10-Code T76.02XA
Description Child neglect or abandonment, suspected, initial encounter
Chapter
  • Injury, poisoning and certain other consequences of external causes
  • Range: [S00 - T88]
Section
  • Adult and child abuse, neglect and other maltreatment, suspected
  • Range: [T76 - T76.A2XS]
Abbreviation INJ
Conflict Group Age
Conflict Rule Pediatric (Ages 0-17)

The NLM’s ICD-10-CM API

The National Library of Medicine’s ICD-10-CM API is a RESTful API that provides access to the current ICD-10-CM code set.

The API allows users to search for codes by code or keyword(term), and returns the code and its description. Searching is case insensitive and greedy The following are some examples:

Returns the seven ICD-10 codes beginning with A15:

icd10api(icd_code = "A15")
#> # A tibble: 7 × 2
#>   icd_code icd_description                             
#>   <chr>    <chr>                                       
#> 1 A15.0    Tuberculosis of lung                        
#> 2 A15.4    Tuberculosis of intrathoracic lymph nodes   
#> 3 A15.5    Tuberculosis of larynx, trachea and bronchus
#> 4 A15.6    Tuberculous pleurisy                        
#> 5 A15.7    Primary respiratory tuberculosis            
#> 6 A15.8    Other respiratory tuberculosis              
#> 7 A15.9    Respiratory tuberculosis unspecified

Returns all 344 ICD-10 codes associated with tuberculosis:

icd10api(term = "tuber", field = "both")
#> # A tibble: 344 × 2
#>    icd_code icd_description                             
#>    <chr>    <chr>                                       
#>  1 A15.0    Tuberculosis of lung                        
#>  2 A15.4    Tuberculosis of intrathoracic lymph nodes   
#>  3 A15.5    Tuberculosis of larynx, trachea and bronchus
#>  4 A15.6    Tuberculous pleurisy                        
#>  5 A15.7    Primary respiratory tuberculosis            
#>  6 A15.8    Other respiratory tuberculosis              
#>  7 A15.9    Respiratory tuberculosis unspecified        
#>  8 A17.0    Tuberculous meningitis                      
#>  9 A17.1    Meningeal tuberculoma                       
#> 10 A17.81   Tuberculoma of brain and spinal cord        
#> # ℹ 334 more rows

Returns the two ICD-10 codes associated with pleurisy:

icd10api(term = "pleurisy", field = "both")
#> # A tibble: 2 × 2
#>   icd_code icd_description     
#>   <chr>    <chr>               
#> 1 R09.1    Pleurisy            
#> 2 A15.6    Tuberculous pleurisy

The field Parameter

The field parameter allows users to specify whether they want to search for ICD-10-CM codes by the codes themselves or by terms associated with their description. It defaults to "code" and it’s behavior warrants some explanation.

If you’re searching for codes beginning with a certain letter, you must set the field parameter to "code" or it will return both codes and terms that contain that letter.

For instance, the following call returns ICD-10 codes and descriptions containing the letter “Z”:

icd10api(icd_code = "z", field = "both", limit = 50)
#> # A tibble: 50 × 2
#>    icd_code icd_description                                                     
#>    <chr>    <chr>                                                               
#>  1 A28.8    Other specified zoonotic bacterial diseases, not elsewhere classifi…
#>  2 A28.9    Zoonotic bacterial disease, unspecified                             
#>  3 A92.5    Zika virus disease                                                  
#>  4 B02.0    Zoster encephalitis                                                 
#>  5 B02.1    Zoster meningitis                                                   
#>  6 B02.30   Zoster ocular disease, unspecified                                  
#>  7 B02.31   Zoster conjunctivitis                                               
#>  8 B02.32   Zoster iridocyclitis                                                
#>  9 B02.33   Zoster keratitis                                                    
#> 10 B02.34   Zoster scleritis                                                    
#> # ℹ 40 more rows

While the call below returns only the ICD-10 codes containing “Z”:

icd10api(icd_code = "z", field = "code", limit = 50)
#> # A tibble: 50 × 2
#>    icd_code icd_description                                                     
#>    <chr>    <chr>                                                               
#>  1 Z00.00   Encounter for general adult medical examination without abnormal fi…
#>  2 Z00.01   Encounter for general adult medical examination with abnormal findi…
#>  3 Z00.110  Health examination for newborn under 8 days old                     
#>  4 Z00.111  Health examination for newborn 8 to 28 days old                     
#>  5 Z00.121  Encounter for routine child health examination with abnormal findin…
#>  6 Z00.129  Encounter for routine child health examination without abnormal fin…
#>  7 Z00.2    Encounter for examination for period of rapid growth in childhood   
#>  8 Z00.3    Encounter for examination for adolescent development state          
#>  9 Z00.5    Encounter for examination of potential donor of organ and tissue    
#> 10 Z00.6    Encounter for examination for normal comparison and control in clin…
#> # ℹ 40 more rows

ICD-10-CM Code Edits

ex_data() |>
  dplyr::mutate(patient_age = years_floor(date_of_birth,
                                          date_of_service)) |>
  dplyr::left_join(search_edits()) |>
  dplyr::filter(icd_conflict_group == "Age") |>
  dplyr::mutate(conflict = apply_age_edits(rule = icd_conflict_rule,
                                           age = patient_age)) |>
  dplyr::filter(!is.na(conflict)) |> 
  dplyr::select(-icd_conflict_group) |>
  gt(groupname_col = "icd_conflict_rule",
     row_group_as_column = TRUE) |> 
  gt_style() |> 
  tab_options(column_labels.hidden = FALSE)
date_of_birth date_of_service icd_code patient_age icd_description conflict
Adult (Ages 15-124) 2015-11-27 2023-01-08 Z00.00 7 Encntr for general adult medical exam w/o abnormal findings Age Conflict
2014-01-25 2023-06-27 Z00.00 9 Encntr for general adult medical exam w/o abnormal findings Age Conflict
2012-05-11 2022-09-21 Z00.00 10 Encntr for general adult medical exam w/o abnormal findings Age Conflict
Pediatric (Ages 0-17) 2005-10-21 2024-01-18 F64.2 18 Gender identity disorder of childhood Age Conflict
2005-10-21 2023-12-08 F64.2 18 Gender identity disorder of childhood Age Conflict
2005-10-21 2023-12-01 F64.2 18 Gender identity disorder of childhood Age Conflict
2005-10-21 2023-11-16 F64.2 18 Gender identity disorder of childhood Age Conflict
2005-10-21 2024-02-08 F64.2 18 Gender identity disorder of childhood Age Conflict
2005-10-21 2023-11-09 F64.2 18 Gender identity disorder of childhood Age Conflict
2005-10-21 2023-11-02 F64.2 18 Gender identity disorder of childhood Age Conflict