IgE-mediated hypersensitivity reactions to beta-lactam antibiotics represent one of the most prevalent and potentially life-threatening forms of drug allergy, often involving cutaneous, respiratory, gastrointestinal, and cardiovascular manifestations, including hypotension and hemodynamic instability. Conventional diagnostic approaches such as clinical history assessment and in vivo and in vitro testing are limited by suboptimal sensitivity and specificity as well as restricted availability for many patients. Given these limitations, intelligent data-driven models show promise as complementary tools for supporting more rapid and accurate assessments of allergic risk. This study aimed to develop, train, and evaluate machine-learning models for predicting IgE-mediated allergic reactions to beta-lactam antibiotics and to design a clinical decision-support tool intended to assist physicians in this field. Clinical data were collected from patients referred to an allergy clinic in Iran and subsequently curated for analysis. A total of 322 patient records were evaluated using nine independent variables: age, gender, culprit drug group, time since last reaction, reaction repetition, reaction with another drug from the same class, time-to-onset of drug reactions, reaction severity, and history of other allergies. Multiple machine-learning algorithms were implemented to predict the final clinical diagnosis as the dependent outcome variable, which was established according to EAACI-based clinical assessment. Within the limitations of the balanced single-centre dataset, Random Forest achieved the highest composite mean score in internal cross-validation (0.912), with accuracy of 0.90, sensitivity of 0.90, specificity of 0.89, F-score of 0.90, and AUC of 0.97. In same-centre temporal validation, the Random Forest model was applied to the independent 80-patient dataset without retraining or retuning and achieved accuracy of 0.96, sensitivity of 0.95, specificity of 0.98, F-score of 0.96, AUC of 0.99, and a composite mean score of 0.97. These findings suggest that machine-learning models, particularly Random Forest, may serve as adjunctive tools for structured risk stratification of suspected IgE-mediated beta-lactam hypersensitivity in an allergy-clinic setting. However, this single-centre, balanced, retrospective study should be considered preliminary, and the developed software should be regarded as a research decision-support prototype rather than a tool ready for routine clinical implementation. Further prospective, multicentre validation and direct comparison with established clinical risk-stratification approaches are required before clinical deployment.

Ethics approval and consent to participate

This work is approved by the local ethical committee of Iran University of Medical Sciences, study No IR.IUMS.REC.1404.958, which conforms to the guidelines of the Declaration of Helsinki. The patients were provided with written informed consent before data collection.

Consent for publication

Informed consent was obtained from the patients and/ or their parents before being included in the study.

Competing interests

The authors declare no competing interests.

Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.

Reprints and permissions