TY - JOUR AU - Rajaram, Akshay AU - Judd, Michael AU - Barber, David PY - 2025 DA - 2025/3/7 TI - Deep Learning Models to Predict Diagnostic and Billing Codes Following Visits to a Family Medicine Practice: Development and Validation Study JO - JMIR AI SP - e64279 VL - 4 KW - machine learning KW - ML KW - artificial intelligence KW - algorithm KW - predictive model KW - predictive analytics KW - predictive system KW - family medicine KW - primary care KW - family doctor KW - family physician KW - income KW - billing code KW - electronic notes KW - electronic health record KW - electronic medical record KW - EMR KW - patient record KW - health record KW - personal health record AB - Background: Despite significant time spent on billing, family physicians routinely make errors and miss billing opportunities. In other disciplines, machine learning models have predicted Current Procedural Terminology codes with high accuracy. Objective: Our objective was to derive machine learning models capable of predicting diagnostic and billing codes from notes recorded in the electronic medical record. Methods: We conducted a retrospective algorithm development and validation study involving an academic family medicine practice. Visits between July 1, 2015, and June 30, 2020, containing a physician-authored note and an invoice in the electronic medical record were eligible for inclusion. We trained 2 deep learning models and compared their predictions to codes submitted for reimbursement. We calculated accuracy, recall, precision, F1-score, and area under the receiver operating characteristic curve. Results: Of the 245,045 visits eligible for inclusion, 198,802 (81%) were included in model development. Accuracy was 99.8% and 99.5% for the diagnostic and billing code models, respectively. Recall was 49.4% and 70.3% for the diagnostic and billing code models, respectively. Precision was 55.3% and 76.7% for the diagnostic and billing code models, respectively. The area under the receiver operating characteristic curve was 0.983 for the diagnostic code model and 0.993 for the billing code model. Conclusions: We developed models capable of predicting diagnostic and billing codes from electronic notes following visits to a family medicine practice. The billing code model outperformed the diagnostic code model in terms of recall and precision, likely due to fewer codes being predicted. Work is underway to further enhance model performance and assess the generalizability of these models to other family medicine practices. SN - 2817-1705 UR - https://ai.jmir.org/2025/1/e64279 UR - https://doi.org/10.2196/64279 DO - 10.2196/64279 ID - info:doi/10.2196/64279 ER -