Peer Review #2 of "dxpr: an R package for generating analysis-ready data from electronic health records—diagnoses and procedures (v0.2)"

Yi‐Ju Tseng, Hsiang-Ju Chiu, Chun Chen, G Chen, N Khan, R Walker, H Quan, J Denny, M Ritchie, M Basford, J Pulley, L Bastarache, K Brown-Gentry, D Wang, D Masys, D Roden, D Crawford, A Dima, D Dediu, A Elixhauser, C Steiner, D Harris, R Coffey, R Fleurence, L Curtis, R Califf, R Platt, J Selby, J Brown, W Hersh, G Hripcsak, D Albers, C-y Hsieh, C-c Su, S-c Shao, S-f Sung, S-j Lin, Yang Kao, Y-h Lai, Ec-C, P Jensen, L Jensen, S Brunak, Aew Johnson, T Pollard, L Shen, L Lehman, M Feng, M Ghassemi, B Moody, P Szolovits, Anthony Celi, L Mark, R, M Menendez, V Neuhaus, C Van Dijk, D Ring, R Miotto, C Weng, B Moore, S White, R Washington, N Coenen, R-Sig-Db) Wickham, H Mller, K, W Raghupathi, V Raghupathi, P Ryan, D Springate, R Parisi, I Olier, D Reeves, E Kontopantelis, M Tsai, M Lin, C Lee, Y Yang, W Chen, G Chang, Tsai Y Te, P Chen, Y Tsai, Y-j Tseng, Cami Goldmann, D Demaria, A Mandl, A Demaria, D Goldmann, K Mandl, R-f Hu, S-t Lee, Y-l Lin, C-l Hsu, S-w LinOpenalex Unknown 2021 · DOI · OpenAlex

Introduction

Electronic Health Records (EHRs) are a cornerstone of modern clinical research, offering deep insights into disease progression and healthcare decision-making. However, the path from raw data to statistical analysis is often blocked by two significant hurdles: heterogeneity and sparsity. Clinical codes, such as the International Classification of Diseases (ICD), are frequently recorded in inconsistent formats (e.g., decimal vs. short formats). Furthermore, the sheer volume of unique codes makes individual analysis statistically impractical. The dxpr R package was developed to address these bottlenecks by providing a standardized workflow for the integration, wrangling, and visualization of diagnosis and procedure records.

The dxpr Workflow

The dxpr package implements a three-phase approach to transform messy hospital logs into "analysis-ready" datasets.

1. Data Integration and Standardization

The first step involves transforming ICD codes into a uniform format. dxpr automatically converts between "short" (e.g., 7470) and "decimal" (e.g., 747.0) formats. Crucially, it includes built-in error checking that flags incorrect ICD versions or formatting anomalies, providing researchers with a Pareto chart of errors to streamline data cleaning.

2. Clinical Code Grouping

To combat data sparsity, dxpr supports several industry-standard grouping strategies that map specific codes to broader, clinically meaningful categories:

  • CCS (Clinical Classifications Software): Supports both single-level and multi-level groupings.
  • PheWAS (Phenome-Wide Association Studies): Maps codes to "phecodes" for genetic association studies.
  • Comorbidity Measures: Automatically calculates established scores, including Elixhauser, Charlson, and AHRQ comorbidity measures.
  • Custom Grouping: Allows users to define categories using precise or fuzzy matching (regular expressions).

3. Data Wrangling and Reshaping

The package simplifies complex data manipulation tasks. It allows users to define case and control groups based on specific criteria and split data relative to an "index date" (e.g., the date of a primary diagnosis). It also introduces the concept of "condition eras," which collapse multiple records into a single episode of care if they occur within a specific timeframe. Finally, dxpr bridges the gap between the "long" format (one row per record) and the "wide" format (one row per patient) required for most statistical models.

Case Study: Newborns in the MIMIC-III Database

To demonstrate the package's utility, the authors analyzed a cohort of 7,833 newborns from the Medical Information Mart for Intensive Care-III (MIMIC-III) database. The study focused on Patent Ductus Arteriosus (PDA), defining 381 cases and 7,452 controls.

By using dxpr to group diagnoses into AHRQ-defined comorbidities, the researchers quickly identified statistically significant differences in 8 out of 16 comorbidities between the two groups, including fluid and electrolyte disorders and valvular disease. This use case highlights how dxpr enables rapid hypothesis testing on real-world clinical data.

Performance and Scalability

Scalability is a critical requirement for EHR tools. The authors tested dxpr on a simulated dataset containing nearly 8 million admission records for approximately 953,000 patients. On a standard personal computer, the package performed code transformation and grouping in just 149 seconds. Case selection for the entire million-patient cohort was completed in less than four minutes, demonstrating its suitability for large-scale epidemiological research.

Conclusion

The dxpr package provides a robust solution to the common bottlenecks in healthcare data analytics. By automating the standardization and grouping of clinical codes, it allows researchers to focus on clinical insights rather than data cleaning. While currently limited to diagnosis and procedure codes, future iterations may expand to include medication and laboratory data, further integrating dxpr into the clinical research ecosystem.

Summary updated

Abstract

BackgroundEnriched electronic health records (EHRs) contain crucial information related to disease progression, and this information can help with decision-making in the health care field.Data analytics in health care is deemed as one of the essential processes that help accelerate the progress of clinical research.However, processing and analyzing EHR data are common bottlenecks in health care data analytics. MethodsThe dxpr R package provides mechanisms for integration, wrangling, and visualization of clinical data, including diagnosis and procedure records.First, the dxpr package helps users transform International Classification of Diseases (ICD) codes to a uniform format.After code format transformation, the dxpr package supports four strategies for grouping clinical diagnostic data.For clinical procedure data, two grouping methods can be chosen.After EHRs are integrated, users can employ a set of flexible built-in querying functions for dividing data into case and control groups by using specified criteria and splitting the data into before and after an event based on the record date.Subsequently, the structure of integrated long data can be converted into wide, analysis-ready data that are suitable for statistical analysis and visualization. ResultsWe conducted comorbidity data processes based on a cohort of newborns from Medical Information Mart for Intensive Care-III (n = 7,833) by using the dxpr package.We first defined patent ductus arteriosus (PDA) cases as patients who had at least one PDA diagnosis (ICD, Ninth Revision, Clinical Modification [ICD-9-CM] 7470*).Controls were defined as patients who never had PDA diagnosis.In total, 381 and 7,452 patients with and without PDA, respectively, were included in our study population.Then, we grouped the diagnoses into defined comorbidities.Finally, we observed a statistically significant difference in 8 of the 16 comorbidities among patients with and without PDA, including fluid and electrolyte disorders, valvular disease, and others. ConclusionsThis dxpr package helps clinical data analysts address the common bottleneck caused by clinical data characteristics such as heterogeneity and sparseness.
BibTeX
@inproceedings{tseng2021peer,
  author = {Yi‐Ju Tseng and Hsiang-Ju Chiu and Chun Chen and G Chen and N Khan and R Walker and H Quan and J Denny and M Ritchie and M Basford and J Pulley and L Bastarache and K Brown-Gentry and D Wang and D Masys and D Roden and D Crawford and A Dima and D Dediu and A Elixhauser and C Steiner and D Harris and R Coffey and R Fleurence and L Curtis and R Califf and R Platt and J Selby and J Brown and W Hersh and G Hripcsak and D Albers and C-Y Hsieh and C-C Su and S-C Shao and S-F Sung and S-J Lin and Yang Kao and Y-H Lai and Ec-C and P Jensen and L Jensen and S Brunak and Aew Johnson and T Pollard and L Shen and L Lehman and M Feng and M Ghassemi and B Moody and P Szolovits and Anthony Celi and L Mark and R and M Menendez and V Neuhaus and C Van Dijk and D Ring and R Miotto and C Weng and B Moore and S White and R Washington and N Coenen and A Elixhauser and R-Sig-Db) Wickham and H Mller and K and W Raghupathi and V Raghupathi and P Ryan and D Springate and R Parisi and I Olier and D Reeves and E Kontopantelis and M Tsai and M Lin and C Lee and Y Yang and W Chen and G Chang and Tsai Y Te and P Chen and Y Tsai and Y-J Tseng and Cami Goldmann and D Demaria and A Mandl and K and Y-J Tseng and A Demaria and D Goldmann and K Mandl and Y-J Tseng and R-F Hu and S-T Lee and Y-L Lin and C-L Hsu and S-W Lin},
  title = {{Peer Review \#2 of "dxpr: an R package for generating analysis-ready data from electronic health records—diagnoses and procedures (v0.2)"}},
  booktitle = {Openalex Unknown},
  year = {2021},
  doi = {10.7287/peerj-cs.520v0.2/reviews/2},
}
Figure