Secondary Logo

Journal Logo

Technology, Computing, and Simulation: Original Clinical Research Report

Development and Validation of an Algorithm to Classify as Equivalent the Procedures in ICD-10-PCS That Differ Only by Laterality

Epstein, Richard H. MD*; Dexter, Franklin MD, PhD, FASA; O’Neill, Liam PhD

Author Information
doi: 10.1213/ANE.0000000000003340
  • Free



  • Question: What is the impact of laterality on the number of commonly performed major therapeutic procedures using discharge abstracts from Texas?
  • Findings: Among the 75,789 International Classification of Diseases, Tenth Revision, Procedure Coding System (ICD-10-PCS) codes from 2017, 16,839 (22.3%) pairs differed only by laterality; after combing such codes, diversity in the state of Texas decreased from 78.2 to 74.1 operative procedures.
  • Meaning: Because combining procedures differing only by laterality will often be desired, the provided structured query language (SQL) code and the lookup table will be useful for all US inpatient analyses of ICD-10-PCS surgical data.

The change in October 2015 from coding in the United States of inpatient surgical procedures in hospital discharge abstracts from International Classification of Diseases, Ninth Revision, Clinical Modification (ICD-9-CM) to International Classification of Diseases, Tenth Revision, Procedure Coding System (ICD-10-PCS)1 increased the number of procedure codes nearly 19-fold, from 3824 to 71,924 codes.2 Importantly, laterality, absent in ICD-9-CM, was added to ICD-10-PCS for a substantial number of codes.3 The impact of codes that are essentially duplicates of each other may inflate various metrics related to the counting of surgical procedures.4,5 Our goal was to analyze the occurrence of laterality within ICD-10-PCS and to develop and validate an algorithm to create a lookup table for merging pairs of codes that represent mirror-image procedures. We then applied this table to quantify the influence of laterality in ICD-10-PCS on the determination of surgical diversity among all hospitals in the state of Texas from October 1, 2015 to March 31, 2016.

Hospitals can be classified according to the diversity of surgical procedures that their surgeons perform.5,6 Large surgical diversity can substantially affect the quality management decision-making for hospital surgical suites because statistical methods suitable for the analysis of rare events need to be applied.7–13 Such diversity can be quantified reliably by determining the number of distinct commonly performed procedures; the approach is analogous to the evaluation of species diversity in ecology or assessments of market concentration in business.14–16 Because ICD-10-PCS treats many essentially equivalent, mirror-image procedures (eg, right hip replacement and left hip replacement) as unique, the calculation of surgical diversity may be inflated artificially.

The lookup table for 2017 and the structured query language (SQL) developed are available online at, allowing anesthesia investigators to combine such procedures easily using tools such as Excel or SQL Server (Microsoft, Redmond, WA). The SQL can easily be modified, if necessary, to deal with additional ICD-10-PCS codes added in future years or to customize the criteria to combine codes.


Data Sources

The ICD-10-PCS files for 2016 and 2017 were downloaded from the Centers for Medicare and Medicaid Services website17 and imported into SQL Server using the SQL Server Import and Export Wizard.

We obtained hospital inpatient discharge public use data files from the Center for Health Statistics of the Texas Health Care Information Collection, Texas Department of State Health Services, Austin, TX, under terms of a data use agreement dated August 18, 2016. We analyzed records with ICD-10-PCS coding from quarter 4 of 2015 and quarter 1 of 2016. For the use of the state of Texas data, we limited our analysis to major therapeutic procedures, defined as “operating room procedure[s] by the Medicare Severity Diagnosis Related Group grouper and … performed for therapeutic reasons.”1

To evaluate the algorithm on a different dataset from that which was used for development, data were obtained from the state of Florida, Agency for Health Care Administration, Florida Center for Health Information and Transparency, under a data use agreement dated May 18, 2017.

Algorithm Development to Classify Procedures With Laterality as Equivalent.

Whereas the coding of laterality in ICD-10-CM diagnosis codes is straightforward, determination of pairs of equivalent ICD-10-PCS codes is not a trivial exercise for 4 major reasons (Figure). First, for ICD-10-CM diagnosis codes, laterality, if relevant, is indicated by the fifth or sixth character, where “1,” “2,” “3,” and “9” correspond to “right,” “left,” “bilateral,” and “unknown,” respectively. For example, S52311A refers to “Greenstick fracture of shaft of radius, right arm, initial encounter for closed fracture.” In contrast, the identification of right and left is not part of the ICD-10-PCS naming convention. Rather, ICD-10-PCS applies laterality in a nonsystematic manner in the body part (character 4) or qualifier portion (character 7) of the 7-character ICD-10-PCS character code. For example, 41DZ7 is the code for “Bypass Right Common Iliac Artery to Right Common Iliac Artery, Open Approach” and 41CZ6 is the code for “Bypass Left Common Iliac Artery to Left Common Iliac Artery, Open Approach” (Table 1, row 2). The fourth character is D for the left common iliac artery and C for the right common iliac artery. The seventh character of the code is 7 for the right common iliac artery and 6 for the left common iliac artery. Second, “right” and “left” are often used in a nonsymmetrical context (eg, right and left lobe of the liver). Third, many procedures with apparent laterality are functionally different operations due to anatomic differences of surrounding organs or vascular supply (eg, right versus left adrenalectomy). Finally, vascular procedures involving anastomoses can specify right and left in the same procedure (eg, vascular shunt from right common iliac artery to left femoral artery). Digit replacement and transfer procedures involving the hands have similar ipsilateral and contralateral considerations.

Table 1.
Table 1.:
Syntax Changes in the Description for Equivalent ICD-10-PCS Codes Differing Only by Laterality
Flow diagram for the algorithm to identify equivalent International Classification of Diseases, 10th Revision, Procedure Coding System (ICD-10-PCS) from 2017 differing only by laterality in the Medical and Surgical, and Obstetrics sections. Codes for body systems where the designation of right or left does not represent anatomic symmetry were excluded: Central Nervous System (ØØ), Heart and Great Vessels (Ø2), Respiratory System [Lung] (Ø8), Gastrointestinal System (ØD), and Hepatobiliary System and Pancreas (ØF). The algorithm produces an ICD-10-PCS mapping table with the paired codes in each row, with left-sided procedures in the first column and right-sided procedures in the second column. The algorithm checks that all codes selected for processing have a corresponding pair with laterality, and validates the accuracy of the mapping process (see Methods for details).
Table 2.
Table 2.:
ICD-10-PCS 2017 Codes in the Training (2016) and Testing (2017) Datasets

For algorithm development, all ICD-10-PCS procedure code descriptions in the 2016 Centers for Medicare and Medicaid Services file were evaluated to identify procedures performed on symmetrical body parts that were otherwise identical. We excluded procedures that were not included in the Medical and Surgical or Obstetrics section and those in body systems that inherently were anatomically asymmetrical from consideration as equivalent (Figure). For example, we excluded the gastrointestinal system because the anatomy of the structures adjacent to the body part being operated on is different, requiring a different surgical approach (eg, right and left kidney, right and left adrenal). We modified the descriptions of the equivalent procedures following the syntax specified in Table 2. As a matter of convenience and for consistency, the algorithm mapped the left-sided procedure codes to the equivalent right-sided procedure. The Figure presents a flow diagram representation of the algorithm to identify the functionally equivalent codes; interested readers can download a SQL implementation of the algorithm as supplemental web content.

Validation of the Equivalent Codes

Descriptions of pairs of codes identified as functionally equivalent were confirmed as identical in SQL by matching the description of the right- and left-sided procedure after removing the words “right” or “left.” For example, again using the example from Table 2, row 2, after replacement of “right” and “left,” “Bypass Right Common Iliac Artery to Right Common Iliac Artery, Open Approach” would be converted to “Bypass Common Iliac Artery to Common Iliac Artery, Open Approach.” Similarly, “Bypass Left Common Iliac Artery to Left Common Iliac Artery, Open Approach” would be mapped to the same phrase. Only those code pairings, for example, 41DZ7 and 41CZ6, that could be verified as having been mapped to identical phrases were assessed as having been matched correctly.

Validation of the Algorithm

To validate the algorithm developed using the 2016 ICD-10-PCS data file (ie, training dataset), the algorithm was applied to the 2017 data file (ie, validation dataset) and the accuracy of the merged codes was determined. Every code was examined, and a 100% match was required to claim validity.

Calculation of Surgical Diversity

To calculate surgical diversity, one first computes the total number of surgical procedure codes observed in discharge abstracts, meeting inclusion criteria. Typically, only codes representing major therapeutic (surgical) procedures are included, eliminating diagnostic and minor therapeutic procedures. Then, the fractions represented by each included code are determined. The squares of these fractions are calculated and added, yielding the Herfindahl index.5 The inverse of the Herfindahl index represents the number of different procedures that are performed commonly.5,18 As a simple example, consider a hypothetical hospital that performs 3 different procedures, A, B, and C. Procedure A represents ½ the total caseload, and procedures B and C each ¼ of the caseload. The Herfindahl index, H, would then be (0.5)2 + (0.25)2 + (0.25)2 = 0.375. The effective number of common procedures would equal 1/H or 2.67.15,16 This is also referred to as the number of procedures performed commonly. Regardless, why is it not just as simple in practice to report the percentage of procedures (not codes) that satisfy some criterion (eg, those that include laterality)? Many procedures are of codes that are rare.4,19 From our previous studies motivating the current study, even for the large state of Texas, 46.6% of procedures are of ICD-10-PCS codes observed just once or twice statewide during each quarter year.4,19

Application of the Lookup Table to the Calculation of Surgical Diversity

We calculated the surgical diversity for the entire state of Texas, using the 6-month dataset, among all major therapeutic procedures without merging, and following the merging of equivalent codes based on laterality. Each discharge often has multiple major therapeutic ICD-10-PCS codes, sometimes duplicates (eg, W9G3ZZ Drainage of Peritoneal Cavity, Percutaneous Approach performed several times during the admission).a The difference between the surgical diversity measurements was compared using the z test.


2016 ICD-10-PCS File Used as the Training Dataset

Of the 71,974 ICD-10-PCS codes in the table from 2017, 62,234 codes were in the Medical and Surgical, and Obstetrics sections; potential laterality was present in 36,860 codes (59.2%; Table 2). Excluded from consideration of equivalence were 2778 codes containing the word “right” or “left” from body systems (“heart and great vessels,” “respiratory system” [lung], “gastrointestinal system,” and “hepatobiliary system and pancreas”) in which there was not symmetry between corresponding right and left organs. Also excluded were 2512 codes for “upper arteries” and “upper veins” involving the innominate artery or vein, subclavian artery or vein, or internal mammary artery, and codes containing “renal artery,” “renal vein,” “pleura,” “kidney,” “adrenal,” or “ureter” (Table 2). The rationale for these exclusions was either based on anatomical differences between the structures (eg, right and left lobe of the liver, right and left atrium), or differences in vascular supply or surrounding anatomic structures (eg, right and left kidney, right and left adrenal gland). Thus, 31,570 ICD-10-PCS codes were processed to identify the 15,785 pairs of equivalent codes (Table 2). Each of the descriptions in the 15,785 pairs of equivalent codes was compared electronically and verified as differing only by the presence of the words “right” or “left” (Figure). Of the 31,570 codes processed by the algorithm, none remained after processing by the 11 if-then decision steps (Figure).

2017 ICD-10-PCS File Used as the Validation Dataset

Table 3.
Table 3.:
Frequency of ICD-10-PCS Codes With Laterality in the 2017 Dataset

Percentages of codes in the 2017 ICD-10-PCS dataset indicating possible laterality ranged from 0% to 100% among body systems (Table 3). There were 3815 ICD-10-PCS codes added between 2016 and 2017. Of these, 2108 included laterality in a body system where such code would be merged. Thus, there were 33,678 ICD-10-PCS codes in the 2017 dataset processed for merging based on laterality. Accuracy of the algorithm was found to be 100%, with all 16,839 (22.3%) pairs of equivalent codes correctly classified (Figure), with each pair contributing 2 codes. No codes with laterality were unmatched by the algorithm.

Predictive Validity of Algorithm Evaluated Using Data From the State of Florida

As additional validation of the algorithm, ICD-10-PCS codes for all 1566,422 inpatient discharges from the State of Florida in federal fiscal year 2016 (2015 quarter 4 to 2016 quarter 3) were processed using the lookup table for merged codes from fiscal year 2017. Among the 4,142,074 ICD-10-PCS procedures listed, 1,130,261 (27.3%) incorporated laterality in the description. In the state of Florida dataset, there was an average of 2.65 ± 2.51 (standard deviation) codes per discharge, with 22,533 unique ICD-10-PCS codes present. Each of the 22,533 codes was manually examined using an Excel workbook. No classification errors were found based on the selected criteria for merging and the 2017 lookup table. However, 7 codes, neither for surgical procedures nor involving laterality, were found that were missing from the ICD-10-PCS table from 2017, representing a combined total of 252 procedures. All involved the intravenous transfusion of stem cells or bone marrow. Evaluation of the 2016 and 2017 ICD-10-PCS tables revealed that the wording had been changed from “transfusion of nonautologous…” to “transfusion of allogeneic unrelated…,” with elimination of the 2016 codes and replacement with new codes in the 2017 dataset (eg, 3233X1 was replaced with 3233X3). Although none of these missing codes affected the accuracy of the algorithm, the finding indicates that the master file for merging codes should incorporate retired ICD-10-PCS codes if processing data from a range of years, because in future years, codes with laterality might be affected.

Application of the Lookup Table to the Calculation of Surgical Diversity.

Table 4.
Table 4.:
Rank Order and Frequency of Major Therapeutic ICD-10-PCS Codes With Frequency ≥0.5% With and Without Merging Equivalent Procedures Differing Only by Laterality in the State of Texas Dataset

In the state of Texas discharge database for the 6-month period studied, there were 735,042 major therapeutic codes among the 423,924 discharges (Table 3, row 1 in Ref. 4), with 34.1% of the codes involving equivalent procedures differing only by laterality. Among the major therapeutic codes, there were 78.2 ± 0.4 procedures performed commonly based on the original ICD-10-PCS codes (ie, laterality not combined) versus 74.1 ± 0.3 common procedures with laterality combined (P < 10–6) (Table 4). The 95% confidence interval for the difference in commonly performed procedures was −5.1 to −3.1 operative procedures.


The algorithm we developed functioned as a perfect classifier for ICD-10-PCS codes in the 2016 and 2017 datasets that were surgically equivalent other than the side of the body where the procedure was performed. There were no pairs of codes among those under consideration for merging that remained unmatched after processing. As new ICD-10-PCS codes are planned to be added yearly, with no fundamental changes to the underlying syntax and naming conventions of the 7-character procedure codes,20 we expect that this algorithm will be effective in the future in identifying new pairs of codes that are functionally equivalent for reporting or analytical purposes. However, we expect that some manual adjustments or minor modifications to the SQL code may be needed over time to handle new procedures involving multiple elements of laterality. For example, if a new surgical procedure were developed to transfer the right index finger to the left thumb and left index finger to the right thumb, an additional if-then step would be required in the algorithm (Figure). This software property known as extensibility21 is analogous to the situation for our recently published SQL algorithm that calculates Elixhauser comorbidities and the van Walraven index using ICD-10-CM.22

We found that for purposes of calculating surgical diversity,5,6,18,23,24 combining procedures differing only by laterality had a minor effect on the number of the most commonly performed procedures (Table 4). This was largely due to the low frequency of specification of laterality in the most common surgical procedures. However, for other purposes related to counting of procedures,4,7,9-11,19 consideration of laterality in analyses of surgical activity may be more important. For example, if one were to study a surgical subspecialty in which laterality is highly represented in the codes (eg, ophthalmology, orthopedic surgery; Table 3), combining the right- and left-sided equivalent procedures (eg, open replacement of the right or left knee joint with a cemented, synthetic substitute) would likely be warranted.


The principal limitation of our algorithm is that it only considers issues related to the symmetry of the body parts and surrounding structures, including the vascular supply in determining the pairs of equivalent codes. There could be reasonable grounds, depending on the analysis, to merge based on other considerations, such as the material composition of an implanted device (eg, ceramic versus metal) or the surgical approach (eg, open versus percutaneous). However, one would still want to merge the equivalent codes with laterality before applying such additional criteria. For example, if one were studying postanesthesia care unit length of stay or the incidence of infection after hip arthroplasty, laterality would be irrelevant, and procedures would be merged. However, the type of material would be potentially relevant for a study of postoperative wound infection.

A second limitation is that we did not test the algorithm using new ICD-10-PCS codes that will be added in the fourth quarter of 2017, as these were not available at the time of the study. However, given the underlying structure of the 7-character codes and naming conventions for new procedures, the algorithm should function without error when the word “right” or “left” only appears once, as an equivalent pair of codes will be added. Exceptions potentially might occur for procedures involving new structures where “right” and “left” occur more than once.

A third limitation is that our classifier is subject to some elements of subjectivity. For example, we included all procedures involving the right or left axillary artery, and thus subject to merging of procedures. Other anesthesia investigators might disagree with this decision. Consequently, the accuracy of the algorithm is not an issue of “right,” “left,” or procedure names, but reasonable differences of opinions about how distinctions between whether right and left procedures are different. This, too, is not an issue of comparing physicians and developing consensus because it depends on the specific application. For example, for a study investigating technical surgical complications after kidney transplantation, one might not want to merge TY10Z (Transplantation of Left Kidney, Allogeneic, Open Approach) and TY0Z (Transplantation of Right Kidney, Allogeneic, Open Approach). However, for a study of rejection after kidney transplantation, one might want to merge the 2 codes. Because the algorithm generating the equivalence tables is provided, it would be simple to rerun the SQL code to generate a different lookup table. To avoid merging the ICD-10-PCS renal transplant codes, an analyst would need only to add 2 lines into the SQL (ie, INSERT INTO #ExcludedStructures SELECT “Transplantation of Left Kidney” and INSERT INTO #ExcludedStructures SELECT “Transplantation of Right Kidney”).

A final limitation is that laterality is not included for all body systems in ICD-10-PCS, most notably the central nervous system (Table 3). For example, operations on the left frontal lobe near Broca’s speech and language area would not be distinguishable based on procedure coding from operations on the homologous area of the right frontal lobe.

In conclusion, we developed an SQL algorithm that accurately identifies pairs of ICD-10-PCS codes that are functionally equivalent, differing only by considerations of laterality. The lookup table provided online provides a simple mechanism for anesthesia researchers to combine pairs of procedures that surgically are mirror images. The software provided can easily be modified to create alternative lookup tables for specific purposes.


Name: Richard H. Epstein, MD.

Contribution: This author helped design the study, obtain the data, perform the analysis, and write the article.

Name: Franklin Dexter, MD, PhD, FASA.

Contribution: This author helped design the study, obtain the data, perform the analysis, and write the article.

Name: Liam O’Neill, PhD.

Contribution: This author helped design the study, obtain the data, perform the analysis, and write the article.

This manuscriptwas handled by: Maxime Cannesson, MD, PhD.


aThis issue of duplicate ICD-10-PCS codes is not restricted to the state of Texas. For example, in the corresponding inpatient discharge data from the State of Florida for the fourth quarter of 2015 and the first quarter of 2016, 3.82% of the 72,185 distinct admissions had a surgical or (rarely) an obstetrical procedure documented more than once per discharge.


1. Agency for Healthcare Research and Quality. Healthcare Cost and Utilization Project, Procedure classes for ICD-10-PCS. Available at: Accessed March 26, 2017.
2. Centers for Disease Control and Prevention. International Classification of Diseases, (ICD-10-CM/PCS) Transition–Background. Available at: Accessed June 16, 2017.
3. Aline F, Wanderer JP, Ehrenfeld JM. Managing the impact of the ICD-10 transition on a data warehouse. J Med Syst. 2016;40:57.
4. O’Neill L, Dexter F, Park SH, Epstein RH. Discharges with surgical procedures performed less often than once per month per hospital account for two-thirds of hospital costs of inpatient surgery. J Clin Anesth. 2017;41:99–103.
5. Dexter F, Ledolter J, Hindman BJ. Quantifying the diversity and similarity of surgical procedures among hospitals and anesthesia providers. Anesth Analg. 2016;122:251–263.
6. Dexter F, Epstein RH, Thenuwara K, Lubarsky DA. Large variability in the diversity of physiologically complex surgical procedures exists nationwide among all hospitals including among large teaching hospitals. Anesth Analg. 2018;127:190–197.
7. Dexter F, Ledolter J. Bayesian prediction bounds and comparisons of operating room times even for procedures with few or no historic data. Anesthesiology. 2005;103:1259–1167.
8. Reymondon F, Pellet B, Marcon E. Optimization of hospital sterilization costs proposing new grouping choices of medical devices into packages. Int J Prod Econ. 2008;112:326–335.
9. Dexter F, Epstein RH, Lee JD, Ledolter J. Automatic updating of times remaining in surgical cases using Bayesian analysis of historical case duration data and “instant messaging” updates from anesthesia providers. Anesth Analg. 2009;108:929–940.
10. Dexter F, Ledolter J, Davis E, Witkowski TA, Herman JH, Epstein RH. Systematic criteria for type and screen based on procedure’s probability of erythrocyte transfusion. Anesthesiology. 2012;116:768–778.
11. Dexter F, Epstein RH, Bayman EO, Ledolter J. Estimating surgical case durations and making comparisons among facilities: identifying facilities with lower anesthesia professional fees. Anesth Analg. 2013;116:1103–1115.
12. Dobson G, Seidmann A, Tilson V, Froix A. Configuring surgical instrument trays to reduce costs. IIE Trans Healthc Syst Eng. 2015;5:225–237.
13. Dexter F, Epstein RH. For assessment of changes in intraoperative red blood cell transfusion practices over time, the pooled incidence of transfusion correlates highly with total units transfused. J Clin Anesth. 2017;39:53–56.
14. Diversity index. Available at: Accessed March 13, 2017.
15. The Inverse Herfindahl–Hirschman Index as an “Effective Number of” Parties. Available at: Accessed March 13, 2017.
16. Effective number of species. Available at: Accessed March 13, 2017.
17. 2016 ICD-10 PCS and GEMs. Available at: Accessed June 5, 2017.
18. Dexter F, Epstein RH, Dutton RP, et al. Diversity and similarity of anesthesia procedures in the United States during and among regular work hours, evenings, and weekends. Anesth Analg. 2016;123:1567–1573.
19. O’Neill L, Dexter F, Park SH, Epstein RH. Uncommon combinations of ICD10-PCS or ICD-9-CM operative procedure codes account for most inpatient surgery at half of Texas hospitals. J Clin Anesth. 2017;41:65–70.
20. Averill RF, Mullin RL, Steinbeck BA, Goldfield NI, Grant TM, Butler RR. Development of the ICD-10 procedure coding system (ICD-10-PCS). Available at: Accessed March 26, 2017.
21. Wikipedia. Extensibility. Available at: Accessed November 28, 2017.
22. Epstein RH, Dexter F. Development and validation of a structured query language implementation of the Elixhauser comorbidity index. J Am Med Inform Assoc. 2017;24:845–850.
23. Dexter F, Ledolter J, Epstein RH, Hindman BJ. Operating room anesthesia subspecialization is not associated with significantly greater quality of supervision of anesthesia residents and nurse anesthetists. Anesth Analg. 2017;124:1253–1260.
24. Dexter F, Epstein RH, Lubarsky DA. Hospitals with greater diversities of physiologically complex procedures do not achieve greater surgical growth in a market with stable numbers of such procedures. J Clin Anesth. 2018;46:67–73.
Copyright © 2018 International Anesthesia Research Society