A method and system for predicting the risk of adverse reactions of whole blood donation
By employing multi-model machine learning and interpretable AI technology, the accuracy and stratification issues in identifying severe adverse reactions to blood donation in existing technologies have been resolved, enabling an intelligent upgrade of blood donation safety management and improving the donor experience and blood resource allocation.
Patent Information
- Application Number
- CN202511597860.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-04
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-11-04
AI Technical Summary
Existing technologies cannot accurately identify individuals at high risk of severe adverse reactions to blood donation, lack stratified identification capabilities, have insufficient model generalization ability, are difficult to adapt to multi-scenario applications, lack interpretability, cannot achieve intelligent closed-loop management and personalized health advice delivery, and are difficult to cope with the rapid changes in medical big data.
Employing multi-model machine learning and data sampling balancing, the system trains models such as Logistic Regression, Random Forest, and Extreme Gradient Boosting Tree, and combines interpretable AI technologies (such as SHAP, LIME, Gain, and DALEX) for data preprocessing and feature engineering to generate primary and secondary outcome variable models, enabling personalized health advice delivery and model optimization.
It enables accurate identification of individuals at high risk of severe adverse reactions, enhances the intelligence and scientific nature of blood donation safety management, improves the stability and interpretability of the model, and optimizes the blood donor experience and blood resource allocation.
Smart Images

Figure CN121054268B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical information technology and intelligent risk prediction technology, and in particular to a method and system for predicting adverse reactions to whole blood donation. Background Technology
[0002] Blood donation is a fundamental public health service that ensures the safety and supply of blood for clinical use. However, during the blood donation process, some donors experience adverse reactions of varying degrees, especially severe adverse reactions such as fainting, loss of consciousness, and severe hypotension. Although these reactions occur in a low rate, they have a significant impact on the physical health and psychological experience of blood donors, and may even require emergency medical intervention.
[0003] Severe adverse reactions not only endanger the safety of blood donors but also directly affect their trust in blood donation and their willingness to donate again. Related studies and actual work at blood banks show that donors who have experienced severe adverse reactions have a significantly lower repeat donation rate, which is one of the main reasons for donor attrition and increased pressure on blood supply. Therefore, improving the ability to identify severe adverse reactions in early blood donation and providing effective warnings and interventions for high-risk individuals are core technical requirements for current blood donation safety management.
[0004] Currently, blood banks and related institutions mostly rely on human experience or traditional statistical methods (such as univariate analysis and logistic regression) to assess the risks of blood donation. These methods are limited by variable types, data structures, and model capabilities, making it difficult to fully explore the complex characteristics of high-dimensional, multi-source, and nonlinear data. They often can only make rough judgments, especially with limited predictive ability for severe adverse reactions, and there is a risk of missed detections and misjudgments.
[0005] With the rapid growth of electronic health data, traditional methods have limitations in feature selection, model generalization ability, and automated modeling. They are unable to achieve individualized and dynamic risk prediction and model updates, which affects the implementation of intelligent management and cannot provide accurate decision support for managers and clinicians, thus restricting the improvement of blood donation safety management.
[0006] The shortcomings and deficiencies of existing technologies are specifically reflected in:
[0007] (i) Inability to accurately identify individuals at high risk of severe adverse reactions to blood donation: Existing statistical methods and empirical rules are insufficient for in-depth analysis of high-dimensional, multi-source, and nonlinear blood donation data, resulting in limited early identification capabilities for severe adverse reactions and the occurrence of missed detections and misjudgments.
[0008] (ii) Lack of ability to stratify risk modeling and individualized management of primary and secondary outcome variables: Existing solutions only target single outcome variables or overall risk and cannot stratify and identify different types and severity of adverse reactions, thus lacking strong support for individualized and classified management.
[0009] (iii) The model has weak generalization ability and is difficult to adapt to multiple application scenarios: Traditional models are unstable in different blood stations, different populations or data segmentation, and have insufficient generalization ability.
[0010] (iv) Insufficient ability to identify a few types (high-risk events): Due to the scarcity of high-risk event samples, traditional methods often cannot effectively identify them, resulting in a high risk of missed detection.
[0011] (v) Lack of interpretability, making model results difficult to apply and trust in clinical practice: Most existing intelligent models are "black boxes", making it difficult for medical workers to understand their judgment logic, which affects practical application and promotion.
[0012] (vi) Unable to achieve intelligent closed-loop management and dynamic optimization: Traditional systems lack an automated closed loop of data-analysis-intervention-feedback, and cannot dynamically adjust management strategies and model parameters.
[0013] (vii) Difficulty in achieving efficient and automated individual health advice delivery and resource optimization: Existing management methods rely heavily on manual operation, making it difficult to deliver health intervention advice in batches and accurately, resulting in unscientific resource allocation.
[0014] (viii) Difficult to adapt to the needs of future medical big data and intelligent development: Existing technologies are unable to cope with the rapid changes in data volume, data structure and clinical scenarios.
[0015] Some existing patents, such as CN110910994A (Blood Bank Management Information System), propose a blood bank management information system that realizes donor information collection, adverse reaction registration, and process monitoring. However, its core lies in information archiving and process management, lacking intelligent prediction and modeling functions for adverse reaction risks. CN111477332A (Method for Identifying and Recruiting Blood Donors Based on Machine Learning) uses machine learning to identify and recruit blood donors, focusing on donor feature profiling and recruitment strategy optimization, but does not predict or explain the risk of adverse blood donation reactions. CN111325515A (Information-based Blood Collection and Supply Method) focuses on the informatization of blood collection and supply business processes, improving the efficiency of blood collection and supply management, but does not involve risk modeling and variable contribution explanation for adverse blood donation reactions, especially primary and secondary outcome variables. CN117100234A (A Blood Donation Reaction Early Warning and Monitoring System and Method) proposes a method for early warning and monitoring blood donation reactions, possessing a certain ability to detect abnormal reactions. However, it mainly relies on rules and expert experience and does not achieve automatic screening through multi-model machine learning or variable interpretability analysis. CN119361157A (A Method for Predicting the Risk of Delayed Blood Donation Due to Low Hemoglobin in Whole Blood Donors) focuses on risk assessment for whole blood donors whose blood donation is delayed due to low hemoglobin. It primarily relies on donor physical examinations and laboratory test parameters, using relevant algorithms to predict the risk of delayed blood donation. Its core purpose is to ensure the safety of donor hemoglobin levels and optimize the blood donation process and resource management.
[0016] With the development of information technology and artificial intelligence, how to utilize advanced technologies such as multi-model machine learning, feature integration, and interpretability analysis to achieve efficient, accurate, and automated identification of severe adverse reactions to blood donation, minimize donor attrition, and build a high-quality repeat blood donor pool has become a pressing technical challenge and innovation direction in the field of blood donation. Summary of the Invention
[0017] Based on the above problems, the purpose of this invention is to provide a method and system for predicting adverse reactions to whole blood donation. This method overcomes the core technical challenges of existing technologies in the identification and management of adverse reactions to blood donation, including accuracy, stratification, generalization, minority class identification, interpretability, intelligent closed-loop management, and personalized recommendations. It enables stratification of primary and secondary outcome variables, multi-model training, and selection of the optimal prediction model, significantly improving the accuracy and intelligence of adverse reaction prediction, and significantly enhancing blood donation safety and service levels. This provides blood banks and donors with scientific and personalized risk management tools, promoting the intelligent upgrade of blood donation safety management. This invention also possesses good scalability and clinical application value.
[0018] The technical solution adopted by this invention to achieve its objective is a method for predicting the risk of adverse reactions to whole blood donation, comprising the following steps:
[0019] S1. Data Import and Integration: Import donor demographic information, blood donation history, and adverse reaction records from the blood donation management platform system;
[0020] S2. Perform data preprocessing: This includes data cleaning, missing value handling, feature engineering, data stratification and label generation. The data is then randomly divided into training and test sets in a 7:3 ratio. The training set is used for training machine learning models and optimizing their internal parameters, while the test set is used for independent performance evaluation of the trained models. The selection of all models and the determination of the best model are based on the evaluation results on the test set.
[0021] S3. Variable Definition and Encoding:
[0022] Severe adverse reactions to blood donation were used as the main outcome variable, defined as having a value of 1 when there was loss of consciousness, hospitalization, or trauma, and a value of 0 when there was no loss of consciousness, hospitalization, or trauma.
[0023] Adverse reaction type is used as a secondary outcome variable. The adverse reaction type is divided into three categories: the first category is other blood donation reactions with a value of 0, the second category is local blood donation adverse reactions with a value of 1, the third category is systemic blood donation adverse reactions with a value of 2, and mixed adverse reactions including two or more of the above three categories with a value of 3.
[0024] The donor's demographic information, blood donation history, and adverse reaction records are defined as variables and used as input variables for model training.
[0025] S4. Multi-model training: Multiple machine learning models are used for training the primary outcome variable (binary classification prediction task) and the secondary outcome variable (multi-class classification prediction task). During training, probability thresholds are selected for the primary outcome variable, i.e., different risk probability thresholds are traversed, the F1 score is calculated for each threshold, and the probability threshold with the highest F1 score is selected as the high-risk discrimination criterion. The F1 score is the harmonic mean of precision and recall in the classification model evaluation.
[0026] S5. Model Evaluation and Screening: The best primary outcome variable prediction model and the best secondary outcome variable prediction model are selected by evaluating multiple evaluation indicators. The evaluation indicators include the area under the receiver operating characteristic curve (AUC), accuracy, sensitivity, specificity, precision, and F1 score.
[0027] S6. Perform 10-fold cross-validation on the selected best primary outcome variable prediction model and the best secondary outcome variable prediction model, and evaluate the stability and reliability of the model based on the results of the cross-validation.
[0028] S7. Using the selected best primary outcome variable prediction model and best secondary outcome variable prediction model, collect demographic information, blood donation history, and adverse reaction records of the blood donors to be predicted, and predict adverse reactions to blood donation.
[0029] Furthermore, in step S2, the data cleaning includes removing duplicate, invalid, or obviously erroneous data entries, and reasonably correcting or deleting outliers;
[0030] The missing value handling is specifically as follows: for continuous variables, multiple imputation is used; for categorical variables, mode imputation is used to fill in missing data.
[0031] The feature engineering process includes normalization, standardization, feature selection, and dimensionality reduction;
[0032] The data stratification and label generation specifically involves automatically generating labels based on the criteria for primary and secondary outcome variables.
[0033] Furthermore, in step S4, the machine learning models used for the main outcome variables include Logistic Regression, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Support Vector Machine (SVM), Lightweight Gradient Boosting Machine (LightGBM), and Multilayer Perceptron (MLP); the machine learning models used for the secondary outcome variables include CatBoost, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Multinomial Logistic Regression, Naive Bayes, Support Vector Machine (SVM), k-Nearest Neighbors (kNN), and Lightweight Gradient Boosting Machine (LightGBM).
[0034] Furthermore, the input variables include continuous variables, binary variables, and multi-category variables, wherein:
[0035] Continuous variables include: age (years), weight (kg), height (cm), blood volume (L), body mass index, body temperature (°C), systolic blood pressure (mmHg), diastolic blood pressure (mmHg), blood donation volume (mL), duration of blood donation reaction (min), pulse rate (beats / minute), and respiratory rate (beats / minute).
[0036] Binary variables include: gender (0 for female, 1 for male); blood donation history (0 for first-time donor, 1 for non-first-time donor); timing of adverse reactions (0 for reactions occurring before blood collection, 1 for reactions occurring after blood collection); pain in other parts of the body (0 for no pain, 1 for pain); hematoma (0 for no hematoma, 1 for hematoma); bruising (0 for no bruising, 1 for bruising); dizziness (0 for no dizziness, 1 for dizziness); sweating (0 for no sweating, 1 for sweating); weakness (0 for no weakness, 1 for weakness). Symptoms include: weakness; anxiety (0 for no anxiety, 1 for anxiety); paleness (0 for no paleness, 1 for paleness); malaise (0 for no malaise, 1 for malaise); nausea (0 for no nausea, 1 for nausea); vomiting (0 for no vomiting, 1 for vomiting); hyperventilation (0 for no hyperventilation, 1 for hyperventilation); syncope (0 for no syncope, 1 for syncope); convulsions (0 for no convulsions, 1 for convulsions); incontinence (0 for no incontinence, 1 for incontinence); and blood donation. Form of blood donation: 0 represents voluntary blood donation, 1 represents emergency blood donation; Needle fainting: 0 represents no needle fainting, 1 represents needle fainting; Hemophobia: 0 represents hemophobia not occurring, 1 represents hemophobia occurring; Environmental factors: 0 represents not affected by environmental factors, 1 represents affected by environmental factors; Motion sickness: 0 represents no motion sickness, 1 represents motion sickness; Fatigue: 0 represents not fatigued before blood donation, 1 represents fatigued before blood donation; Insufficient sleep before blood donation: 0 represents sufficient sleep before blood donation, 1 represents insufficient sleep before blood donation; Prolonged blood collection time: 0 represents no cases of prolonged blood collection time, 1 represents cases of prolonged blood collection time; Group Group effect: 0 represents no group effect, 1 represents group effect; Fasting: 0 represents no fasting before blood donation, 1 represents fasting before blood donation; Prolonged lack of hydration: 0 represents no prolonged lack of hydration before blood donation, 1 represents prolonged lack of hydration before blood donation; Puncture difficulty: 0 represents no puncture difficulty, 1 represents puncture difficulty during blood collection; Inadequate hemostasis: 0 represents no inadequate hemostasis after blood donation, 1 represents inadequate hemostasis after blood donation; Communication with blood collection personnel: 0 represents average, 1 represents good.
[0037] The multi-category variables include: eating before blood donation (0 represents no food intake, 1 represents food intake less than 1 hour, 2 represents food intake between 1 and 2 hours, and 3 represents food intake more than 2 hours); waiting time before blood donation (0 represents no waiting time, 1 represents waiting time less than 30 minutes, 2 represents waiting time between 30 and 60 minutes, and 3 represents waiting time more than 60 minutes); and drinking water before blood donation (0 represents no beverage consumption, 1 represents beverage consumption less than 200 ml, 2 represents beverage consumption between 200 and 400 ml, and 3 represents beverage consumption more than 400 ml). Increase; Puncture pain: 0 means little or no pain, 1 means some pain, 2 means severe pain; Muscle contraction: 0 means no muscle contraction before blood donation, 1 means 5-10 seconds of muscle contraction, 2 means more than 10 seconds of muscle contraction; Psychological state before blood donation: 0 means very nervous, 1 means relaxed, 2 means nervous, 3 means moderately nervous; Awareness of adverse reactions to blood donation: 0 means unaware of adverse reactions to blood donation, 1 means very aware of adverse reactions to blood donation, 2 means not very aware of adverse reactions to blood donation, 3 means moderately aware of adverse reactions to blood donation.
[0038] Furthermore, before model training, sampling balancing is performed, specifically as follows:
[0039] For the main outcome variable prediction model, the minority class samples are oversampled and the majority class samples are undersampled in the training data, and a new balanced training set is constructed by generating synthetic samples.
[0040] For the secondary outcome variable prediction model, an automatic stratified sampling strategy is adopted. For categories with very few samples, a minimum sampling threshold is set, and for several categories with very low sample sizes, they are merged into one category.
[0041] Furthermore, during the model training phase, parameter tuning is also performed, specifically as follows:
[0042] For each candidate machine learning model, the key parameters of the model, including learning rate, tree depth, and regularization coefficient, are systematically optimized through grid search or cross-validation. The AUC, accuracy, sensitivity, specificity, and F1 score are used as the tuning targets, and finally the model parameter combination with the best overall performance is selected.
[0043] For machine learning models that support class weights, class weight adjustment is also performed. That is, during the model training phase, class weights are automatically calculated and assigned so that the weights are inversely proportional to the number of class samples.
[0044] Furthermore, after selecting the best primary outcome variable prediction model and the best secondary outcome variable prediction model, model interpretability analysis and visualization report output are performed. Specifically, for the best primary outcome variable prediction model and the best secondary outcome variable prediction model, interpretability AI methods are used to analyze the variable contribution and generate feature importance ranking, explanatory charts, model performance reports, ROC curves, key risk factor bar charts, and local explanation documents. The interpretability AI methods include Shapley Additive Explanations (SHAP), Local Interpretable Model-agnostic Explanations (LIME), Gain (Feature Split Gain, a measure of the contribution of feature splitting to model loss), and the DALEX (Descriptive Machine Learning Explanations, which includes local explanation functionality) toolkit for model interpretability. Among them, Gain is a measure used to measure feature importance or splitting contribution (not a complete explanation algorithm), and DALEX is a toolkit / software implementation (which can encapsulate or call other explanation algorithms to generate explanation results).
[0045] This invention also provides a whole blood donation adverse reaction risk prediction system, comprising:
[0046] The data acquisition module is used to automatically collect multi-source heterogeneous data, including basic information of blood donors, blood donation process, laboratory tests, and adverse reactions.
[0047] The data preprocessing module is used to clean, denoise, fill in missing values, and standardize the raw data.
[0048] The hierarchical modeling module is used to train multiple machine learning models based on the primary outcome variable and the secondary outcome variable to construct a prediction model for the primary outcome variable and a prediction model for the secondary outcome variable, respectively. The primary outcome variable is severe adverse reactions to blood donation, and the secondary outcome variable is the type of adverse reaction.
[0049] The knowledge base and rule engine integration module is used to integrate the clinical expert knowledge base and rule engine, combining the prediction results of the main outcome variable prediction model and the secondary outcome variable prediction model with the experience of medical experts and authoritative guidelines to form personalized health recommendations.
[0050] The push service module is used to push the risk stratification results and individualized health recommendations output by the main outcome variable prediction model and the secondary outcome variable prediction model to blood donors, medical staff or managers.
[0051] The feedback collection module is used to collect user feedback information and actual intervention effects in real time, including blood donor self-reports, medical staff records, and automatic system collection.
[0052] The model self-optimization module is used to automatically trigger model retraining and parameter adjustment based on the feedback acquisition module's feedback data.
[0053] Furthermore, the hierarchical modeling module employs machine learning models for the primary outcome variables, including Logistic Regression, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Support Vector Machine (SVM), Lightweight Gradient Boosting Machine (LightGBM), and Multilayer Perceptron (MLP); and for the secondary outcome variables, it employs machine learning models including CatBoost, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Multinomial Logistic Regression, Naive Bayes, Support Vector Machine (SVM), k-Nearest Neighbors (kNN), and Lightweight Gradient Boosting Machine (LightGBM).
[0054] The hierarchical modeling module is also used to perform probability threshold screening for the main outcome variable during training, that is, to traverse different risk probability thresholds, calculate the F1 score under each threshold, and select the probability threshold with the largest F1 score as the high-risk discrimination criterion; the F1 score is the harmonic mean of precision and recall in the evaluation of the classification model.
[0055] The hierarchical modeling module is also used to evaluate the model using multiple evaluation metrics, and to select the best primary outcome variable prediction model and the best secondary outcome variable prediction model. The evaluation metrics include the area under the receiver operating characteristic curve (AUC), accuracy, sensitivity, specificity, precision, and F1 score.
[0056] The hierarchical modeling module is also used to perform 10-fold cross-validation on the selected best primary outcome variable prediction model and the best secondary outcome variable prediction model.
[0057] Furthermore, the hierarchical modeling module is also used to perform sample balancing before model training, specifically:
[0058] For the main outcome variable prediction model, the minority class samples are oversampled and the majority class samples are undersampled in the training data, and a new balanced training set is constructed by generating synthetic samples.
[0059] For the secondary outcome variable prediction model, an automatic stratified sampling strategy is adopted. For categories with very few samples, a minimum sampling threshold is set, and for several categories with very low sample sizes, they are merged into one category.
[0060] The hierarchical modeling module is also used to perform model interpretability analysis and output visualization reports after selecting the best primary outcome variable prediction model and the best secondary outcome variable prediction model. Specifically, it uses interpretability AI methods to analyze the variable contribution of the best primary outcome variable prediction model and the best secondary outcome variable prediction model, and generates feature importance ranking, explanatory charts, model performance reports, ROC curves, key risk factor bar charts, and local explanatory documents. The interpretability AI methods include Shapley value additive interpretation method (SHAP), locally interpretable model-independent interpretation method (LIME), gain, and the DALEX toolkit for model interpretability.
[0061] The beneficial effects of this invention are as follows:
[0062] (i) Accurately identify high-risk blood donors. Through multi-model machine learning and data sampling balance, the system can automatically and accurately identify individuals at high risk of severe adverse reactions, thereby improving the pertinence and scientific nature of risk management.
[0063] (ii) Through automatic screening and optimization of multiple models, the system improves the accuracy, sensitivity and generalization ability of adverse reaction prediction.
[0064] (iii) Integrate interpretable AI technologies (such as SHAP, LIME, Gain, and the local interpretation function of DALEX tools) to make the contribution of global and local variables in the model results transparent, so that clinical experts and managers can understand, trust and implement the model.
[0065] (iv) By adopting sampling balance methods (such as ROSE) and class weight adjustment, the model’s ability to identify high-risk individuals under class imbalanced data is significantly improved.
[0066] (v) Implement cross-validation and parameter tuning to ensure the stability and generalizability of the model in different real-world scenarios.
[0067] (vi) Provide blood banks, clinical and public health management departments with intelligent and individualized blood donation safety management and strategy development tools to optimize the blood donor experience and blood resource allocation. Attached Figure Description
[0068] Figure 1 This is a schematic diagram of the risk prediction method in Embodiment 1 of the present invention;
[0069] Figure 2This is a graph showing the ROC curves of the training and testing sets of the main outcome variable prediction model in Embodiment 1 of the present invention.
[0070] Figure 3 This is a feature importance analysis diagram of the main outcome variable prediction model in Embodiment 1 of the present invention;
[0071] Figure 4 This is a partial DALEX interpretation diagram of the 49th sample in the test set of the main outcome variable prediction model of Embodiment 1 of the present invention;
[0072] Figure 5 This is a multi-class ROC curve of the outcome variable prediction model in Embodiment 1 of the present invention;
[0073] Figure 6 This is a ranking diagram of the global feature importance of the outcome variable prediction model SHAP in Embodiment 1 of the present invention;
[0074] Figure 7 This is an example diagram of the local interpretability analysis of the LIME (Local Interpretation Method for Expected Outcome Variables) prediction model in Embodiment 1 of the present invention;
[0075] Figure 8 This is a block diagram of the risk prediction system according to Embodiment 2 of the present invention;
[0076] Figure 9 This is a schematic diagram of an application scenario for Embodiment 2 of the present invention;
[0077] Figure 10 This is a schematic diagram of the push and feedback closed loop in Embodiment 2 of the present invention. Detailed Implementation
[0078] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0079] Example 1
[0080] Figure 1 This invention illustrates a specific embodiment of the method for predicting adverse reactions to whole blood donation, comprising the following steps:
[0081] S1. Data Import and Integration: Import donor demographic information, blood donation history, and adverse reaction records from the blood donation management platform system;
[0082] S2. Perform data preprocessing, including:
[0083] Data cleaning: Remove duplicate, invalid, or obviously erroneous data entries, and make reasonable corrections or deletions for outliers;
[0084] Missing value handling: Specifically, for continuous variables, multiple imputation is used; for categorical variables, mode imputation is used to fill in missing data, thereby improving the accuracy of subsequent analysis.
[0085] Feature engineering processing: The feature engineering processing includes normalization, standardization, feature selection and dimensionality reduction to ensure that the data is adapted to the input requirements of machine learning models;
[0086] Data stratification and label generation: Labels are automatically generated based on the criteria of primary and secondary outcome variables for subsequent modeling.
[0087] Sampling balancing aims to address performance biases caused by imbalanced class distribution during model training and improve the overall predictive ability and robustness of the model through system parameter optimization. Sampling balancing specifically includes the following:
[0088] For main outcome variable prediction models, due to the imbalanced class distribution in the original data (i.e., the minority class samples are far fewer than the majority class samples), direct modeling can easily lead to insufficient ability to identify the minority class. Therefore, this study uses the ROSE (Random Over Sampling Examples) method to resample the training set. The ROSE method is a technique based on a combination of random oversampling and undersampling. By generating synthetic samples in the feature space, it increases the number of minority class samples while moderately reducing the number of majority class samples, thus obtaining a more balanced training set. The specific implementation steps are as follows: Data partitioning: First, the original data is randomly divided into a training set and a test set in a 7:3 ratio, and sample balancing is performed only on the training set; Synthetic sample generation: Using the rose() function in the ROSE package of R language, the minority class samples in the training set are oversampled, while the majority class samples are undersampled. The `rose()` function generates new synthetic samples around the original samples using the smoothed bootstrap method, ensuring the authenticity and representativeness of the synthetic data and avoiding the overfitting risk caused by simply copying samples. Balanced dataset modeling: After obtaining training data with a more balanced class distribution, the `train()` function from the `caret` package is used to train various base learners, including RandomForest and XGBoost. Only the balanced training set is used during model training; the test set maintains its original distribution for independent model performance evaluation. Result evaluation: The effectiveness of the ROSE method in improving model robustness and generalization ability is verified by comparing the model's recognition capabilities on a few classes (such as sensitivity, F1-score, AUC, etc.).
[0089] For the secondary outcome variable prediction model, an automatic stratified sampling strategy is adopted to ensure that each category has representative samples in both the training and test sets. For categories with very few samples, a minimum sampling threshold is set (e.g., each category in the test set must contain at least 2 samples) to prevent missing categories or inability to plot ROC curves during model training and evaluation. Several categories with extremely low sample sizes are merged into one category (e.g., merged into the "Other" category) to further mitigate the adverse effects of class imbalance on the model.
[0090] S3. Variable Definition and Encoding:
[0091] Severe adverse reactions to blood donation were used as the main outcome variable, defined as having a value of 1 when there was loss of consciousness, hospitalization, or trauma, and a value of 0 when there was no loss of consciousness, hospitalization, or trauma.
[0092] Adverse reaction type is used as a secondary outcome variable. The adverse reaction type is divided into three categories: the first category is other blood donation reactions with a value of 0, the second category is local blood donation adverse reactions with a value of 1, the third category is systemic blood donation adverse reactions with a value of 2, and mixed adverse reactions including two or more of the above three categories with a value of 3.
[0093] The donor's demographic information, blood donation history, and adverse reaction records are defined as variables and used as input variables for model training.
[0094] The input variables include continuous variables, binary variables, and multi-category variables, among which:
[0095] Continuous variables include: age (years), weight (kg), height (cm), blood volume (L), body mass index, body temperature (°C), systolic blood pressure (mmHg), diastolic blood pressure (mmHg), blood donation volume (mL), duration of blood donation reaction (min), pulse rate (beats / minute), and respiratory rate (beats / minute).
[0096] Binary variables include: gender (0 for female, 1 for male); blood donation history (0 for first-time donor, 1 for non-first-time donor); timing of adverse reactions (0 for reactions occurring before blood collection, 1 for reactions occurring after blood collection); pain in other parts of the body (0 for no pain, 1 for pain); hematoma (0 for no hematoma, 1 for hematoma); bruising (0 for no bruising, 1 for bruising); dizziness (0 for no dizziness, 1 for dizziness); sweating (0 for no sweating, 1 for sweating); weakness (0 for no weakness, 1 for weakness). Symptoms include: weakness; anxiety (0 for no anxiety, 1 for anxiety); paleness (0 for no paleness, 1 for paleness); malaise (0 for no malaise, 1 for malaise); nausea (0 for no nausea, 1 for nausea); vomiting (0 for no vomiting, 1 for vomiting); hyperventilation (0 for no hyperventilation, 1 for hyperventilation); syncope (0 for no syncope, 1 for syncope); convulsions (0 for no convulsions, 1 for convulsions); incontinence (0 for no incontinence, 1 for incontinence); and blood donation. Form of blood donation: 0 represents voluntary blood donation, 1 represents emergency blood donation; Needle fainting: 0 represents no needle fainting, 1 represents needle fainting; Hemophobia: 0 represents hemophobia not occurring, 1 represents hemophobia occurring; Environmental factors: 0 represents not affected by environmental factors, 1 represents affected by environmental factors; Motion sickness: 0 represents no motion sickness, 1 represents motion sickness; Fatigue: 0 represents not fatigued before blood donation, 1 represents fatigued before blood donation; Insufficient sleep before blood donation: 0 represents sufficient sleep before blood donation, 1 represents insufficient sleep before blood donation; Prolonged blood collection time: 0 represents no cases of prolonged blood collection time, 1 represents cases of prolonged blood collection time; Group Group effect: 0 represents no group effect, 1 represents group effect; Fasting: 0 represents no fasting before blood donation, 1 represents fasting before blood donation; Prolonged lack of hydration: 0 represents no prolonged lack of hydration before blood donation, 1 represents prolonged lack of hydration before blood donation; Puncture difficulty: 0 represents no puncture difficulty, 1 represents puncture difficulty during blood collection; Inadequate hemostasis: 0 represents no inadequate hemostasis after blood donation, 1 represents inadequate hemostasis after blood donation; Communication with blood collection personnel: 0 represents average, 1 represents good.
[0097] The multi-category variables include: eating before blood donation (0 represents no food intake, 1 represents food intake less than 1 hour, 2 represents food intake between 1 and 2 hours, and 3 represents food intake more than 2 hours); waiting time before blood donation (0 represents no waiting time, 1 represents waiting time less than 30 minutes, 2 represents waiting time between 30 and 60 minutes, and 3 represents waiting time more than 60 minutes); and drinking water before blood donation (0 represents no beverage consumption, 1 represents beverage consumption less than 200 ml, 2 represents beverage consumption between 200 and 400 ml, and 3 represents beverage consumption more than 400 ml). Increase; Puncture pain: 0 means little or no pain, 1 means some pain, 2 means severe pain; Muscle contraction: 0 means no muscle contraction before blood donation, 1 means 5-10 seconds of muscle contraction, 2 means more than 10 seconds of muscle contraction; Psychological state before blood donation: 0 means very nervous, 1 means relaxed, 2 means nervous, 3 means moderately nervous; Awareness of adverse reactions to blood donation: 0 means unaware of adverse reactions to blood donation, 1 means very aware of adverse reactions to blood donation, 2 means not very aware of adverse reactions to blood donation, 3 means moderately aware of adverse reactions to blood donation.
[0098] S4, Multi-model Training:
[0099] For the main outcome variable, namely the binary classification prediction task, various machine learning models such as Logistic Regression, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Support Vector Machine (SVM), Lightweight Gradient Boosting Machine (LightGBM), and Multilayer Perceptron (MLP) are used for training.
[0100] For the secondary outcome variable, i.e., the multi-class prediction task, various machine learning models are used for training, including CatBoost, RandomForest, XGBoost, multinomial Logistic Regression, NaiveBayes, SVM, k-Nearest Neighbors (kNN), and LightGBM.
[0101] During training, probability thresholds are selected for the main outcome variable. This involves iterating through different risk probability thresholds, calculating the F1 score for each threshold, and selecting the threshold with the highest F1 score as the high-risk criterion. The F1 score is the harmonic mean of precision and recall in classification model evaluation, calculated as: F1 = 2 × (Precision × Recall) / (Precision + Recall). A higher F1 score indicates a stronger ability to identify positive examples, making it particularly suitable for risk prediction scenarios with extremely imbalanced classes.
[0102] For binary classification models (such as high-risk / low-risk), the model outputs a probability value between 0 and 1. Traditionally, 0.5 is often used as the cutoff, but in scenarios with severe class imbalance, such as medical settings, a 0.5 threshold may not be optimal. Therefore, this invention iterates through multiple probability thresholds and selects the threshold with the highest F1 score as the actual discrimination criterion. This optimal threshold effectively transforms the model's output probability into high-risk and low-risk categories, ensuring the accuracy and practicality of the model's risk identification.
[0103] It should be noted that in this invention, a probability threshold screening step is set for the primary outcome variable (binary classification model), but this method is not used for the secondary outcome variable (multi-class classification model). The reason is as follows:
[0104] For binary classification prediction models, the model typically outputs the probability that each sample belongs to the positive class (e.g., high risk). In practical applications, a probability threshold needs to be set to classify individuals with probabilities higher than the threshold as high risk and those lower as low risk. Different thresholds directly affect the model's precision, recall, F1 score, and other metrics. Therefore, by iterating through different probability thresholds and selecting the optimal threshold that maximizes the F1 score, it helps to achieve better risk identification results in real-world scenarios involving class imbalance and a focus on high-risk individuals. For multi-class models (e.g., secondary outcome variable prediction), the model outputs the probability that each sample belongs to each class. The final classification result is usually the class with the highest probability (i.e., argmax), without needing to adjust the probability distribution with additional thresholds. Evaluation criteria for multi-class tasks (e.g., multi-class AUC, macro / micro average F1 score, etc.) do not depend on a single threshold setting. Therefore, multi-class variables do not require separate probability threshold selection.
[0105] In summary, binary classification models can flexibly adjust risk assessment criteria and improve model performance through threshold screening, while multi-class classification models already have a clear classification mechanism and do not require additional threshold settings.
[0106] During the model training phase, parameter tuning is also performed, specifically as follows:
[0107] For each candidate machine learning model (such as Random Forest, Extreme Gradient Boosting Tree XGBoost, Category Boosting Tree CatBoost, Support Vector Machine (SVM), Lightweight Gradient Boosting Machine (LightGBM), etc.), grid search and cross-validation methods are used to systematically optimize the key parameters of the model. The parameters tuned include, but are not limited to, learning rate, maximum tree depth, regularization term, and subsampling ratio. During parameter tuning, the area under the receiver operating characteristic (AUC), accuracy, sensitivity, specificity, precision, and F1 score are used as targets to comprehensively evaluate model performance, and finally, the parameter combination with the best performance across all metrics is selected.
[0108] For machine learning models that support class weights, class weight adjustment is also performed. This involves automatically calculating and assigning class weights during model training, ensuring that the class weights are inversely proportional to the number of samples, thus enhancing the model's focus on minority classes. Specifically, weight parameters are automatically set based on the number of samples in each class in the training set, distributing the weights to each sample. This improves the model's ability to identify rare classes during training. This effectively mitigates the impact of class imbalance on model performance and significantly improves the accuracy and robustness of minority class predictions.
[0109] S5. Model Evaluation and Screening: The best primary outcome variable prediction model and the best secondary outcome variable prediction model are selected by evaluating multiple evaluation indicators. The evaluation indicators include the area under the receiver operating characteristic curve (AUC), accuracy, sensitivity, specificity, precision, and F1 score.
[0110] In selecting models for predicting the main outcome variable, priority was given to model performance on independent test sets. Since different models exhibit slight differences in AUC between the training and test sets, the final selection of the main outcome variable prediction model was primarily based on test set results. The specific process was as follows: All candidate models were evaluated on independent test sets (see Table 1), including AUC, sensitivity, precision, and F1 score; a comprehensive analysis of each model's performance on key metrics was conducted, prioritizing models that balanced overall accuracy with the ability to identify high-risk individuals; for example, although the LightGBM model had a slightly lower AUC than models like SVM, it performed better in sensitivity and F1 score, better balancing accuracy and high-risk identification, ultimately determining the LightGBM model as the best main outcome variable prediction model.
[0111] Table 1 Performance parameters of the main outcome variable prediction model on the test set
[0112] Model AUC Accuracy Sensitivity Specificity Precision F1 Logistic 0.768 0.843 0.588 0.876 0.385 0.465 RandomForest 0.867 0.945 0.647 0.985 0.846 0.733 XGBoost 0.852 0.952 0.706 0.985 0.857 0.774 SVM 0.916 0.938 0.529 0.992 0.9 0.667 LightGBM 0.849 0.706 0.954 0.667 0.686 0.925 MLP 0.500 0.884 0 1.00 NA NA
[0113] To comprehensively evaluate the discriminative ability of the main outcome variable prediction model, this invention uses the receiver operating characteristic (ROC) curve and its area under the curve (AUC) as the main performance indicators. The ROC curve is plotted by combining sensitivity and 1-specificity at different discrimination thresholds, intuitively reflecting the model's overall discriminative ability at each threshold. The closer the AUC value (Area Under Curve) is to 1, the stronger the model's ability to distinguish between positive and negative samples. Figure 2 The ROC curves of the main outcome variable prediction model on the training and test sets are shown, with the horizontal axis representing 1-specificity and the vertical axis representing sensitivity. In this embodiment, the Area Under the Receiver Operating Characteristic (ROC) curve of the LightGBM model on the training set is 0.994, demonstrating extremely high discriminative ability; the Area Under the ROC curve on the independent test set is 0.848, indicating that the model still has strong generalization ability for unseen data. Furthermore, the ROC curve helps us select the optimal classification threshold. Specifically, the model outputs the probability that each individual is at high risk. Based on different combinations of sensitivity and specificity at different thresholds, a balance point can be selected on the ROC curve as the classification criterion. The final determined optimal threshold (cut-off value) is used when the model output probability exceeds this threshold and is classified as high risk, and vice versa; this maximizes the detection rate of high-risk individuals while effectively controlling the false positive rate. This threshold serves as the basis for actual risk determination, ensuring the scientific and practical nature of risk warning management and providing a reliable foundation for subsequent individualized interventions.
[0114] As shown in Table 2, the Extreme Gradient Boosting Tree (XGBoost) model outperforms other models in multiple metrics, including AUC, accuracy, and F1 score, on the test set, and is therefore selected as the best secondary outcome variable prediction model in this embodiment. Meanwhile, ensemble learning models such as CatBoost and RandomForest also performed well on the test set for multi-class prediction of secondary outcome variables. Specifically, the CatBoost model achieved an AUC of 0.984, with excellent F1 score and accuracy; the RandomForest model had an AUC of 0.995, with similarly impressive F1 score and accuracy. Furthermore, the MultinomialLogit model also demonstrated strong discriminative ability in specific scenarios, making it suitable for tasks with high variable interpretability requirements. In summary, besides XGBoost, CatBoost and RandomForest can all serve as alternative core models for the secondary outcome variable prediction task in this invention, thereby further improving the model's stability and applicability.
[0115] Table 2 Performance Parameters of the Predictive Model for Outcome Variables on the Test Set
[0116] Model AUC Accuracy Sensitivity Specificity Precision F1 CatBoost 0.984 0.966 0.464 0.886 0.982 0.952 RandomForest 0.995 0.973 0.702 0.879 0.990 0.770 XGBoost 0.996 0.990 0.878 0.996 0.967 0.946 MultinomialLogit 0.966 0.968 0.755 0.967 0.804 0.876 NaiveBayes 0.618 0.021 0.333 0.667 0.011 0.043 SVM 0.602 0.925 0.333 0.667 0.925 0.961 kNN NA 0.918 0.412 0.692 0.477 0.645 LightGBM 0.601 0.327 0.304 0.590 0.316 0.195
[0117] S6. Perform 10-fold cross-validation on the selected best primary outcome variable prediction model and the best secondary outcome variable prediction model.
[0118] After selecting the best model, we continue to evaluate the model's stability and generalization ability under different data splits. The specific operation is as follows: Taking the LightGBM model with the main outcome variable as an example, all training data are randomly divided into 10 subsets in a 1:9 ratio. Each time, one subset is selected as the validation set, and the other nine subsets are used as the training set. This process is repeated 10 times to ensure that each set of data is used as a validation set. Finally, the mean and distribution of the evaluation indicators for each round are calculated to measure the model's generalization performance.
[0119] During the ten-fold cross-validation process, for each fold, six typical performance metrics were recorded: accuracy, sensitivity, specificity, precision, F1 score, and area under the receiver operating characteristic (AUC). Detailed results of each round of cross-validation are shown in Table 3.
[0120] Table 3. Evaluation results of the 10-fold cross-validation of the main outcome variables using the LightGBM model.
[0121] Fold Accuracy Sensitivity Specificity Precision F1 AUC 1 0.980 1.000 0.976 0.857 0.923 0.981 2 0.918 0.400 0.977 0.667 0.500 0.618 3 0.980 0.833 1.000 1.000 0.909 0.895 4 0.959 0.833 0.977 0.833 0.833 0.981 5 0.918 0.667 0.975 0.857 0.750 0.861 6 0.918 0.400 0.977 0.667 0.500 0.700 7 0.980 0.500 1.00 1.000 0.667 0.787 8 0.979 1.000 0.978 0.667 0.800 1.000 9 0.900 0.333 0.935 0.250 0.286 0.797 10 0.959 0.714 1.000 1.000 0.833 0.925
[0122] As shown in Table 3, the LightGBM model exhibits stable performance across all metrics under 10-fold cross-validation, particularly with high mean values for core metrics such as accuracy and AUC, indicating good generalization ability. Furthermore, the sensitivity, specificity, accuracy, and F1 score show manageable fluctuations across subsets, further confirming the model's robustness under different data distributions. This cross-validation evaluation provides a solid technical foundation for subsequent model applications and risk prediction.
[0123] It should be noted that the 10-fold cross-validation method is not only applicable to the LightGBM model, but also to various mainstream machine learning models related to the main outcome variable, such as Extreme Gradient Boosting Tree (XGBoost), Random Forest, Logistic Regression, and Support Vector Machine (SVM). In the model evaluation and selection process, this invention uses 10-fold cross-validation to evaluate and compare the performance of various models, ensuring the objectivity and consistency of the results. The cross-validation results shown above use the LightGBM model as an example; the evaluation process and statistical methods for other models are completely consistent.
[0124] After selecting the best primary outcome variable prediction model and the best secondary outcome variable prediction model, model interpretability analysis and visualization report output are also performed. Specifically, for the best primary outcome variable prediction model and the best secondary outcome variable prediction model, interpretability AI methods are used to analyze the contribution of variables, systematically reveal the impact of each feature on the model prediction results, and generate feature importance ranking, interpretive charts, model performance reports, ROC curves, key risk factor bar charts, and local interpretation documents. The interpretability AI methods include Shapley value additive interpretation method (SHAP), locally interpretable model-independent interpretation method (LIME), Gain, and the DALEX toolkit for model interpretability.
[0125] Output of interpretability analysis and visualization report for main outcome variable prediction model:
[0126] To clarify the impact of each input variable on the prediction model of the main outcome variable, this invention conducted a statistical analysis of feature importance based on the final LightGBM model. The "Gain" metric was used to measure the information gain contribution of each variable during the model splitting process. The analysis results are as follows: Figure 3As shown, syncope had the highest Gain value (0.883) in the model, far exceeding other variables, making it the core feature for identifying the main outcome variable. This was followed by diastolic blood pressure (Gain = 0.069), respiration (Gain = 0.016), and systolic blood pressure (Gain = 0.013). Other variables such as age, blood donation volume, blood donation history, height, fatigue, and fasting contributed relatively little, with Gain values all below 0.01.
[0127] For example, in a specific sample, syncope = 0 (no syncope occurred) contributed the most to the predicted probability of adverse reactions (increasing by 0.332). Other characteristics, such as fatigue = 0 (no fatigue before blood donation) and muscle contraction = 2 (muscle contraction lasting more than 10 seconds), also had some positive effects, suggesting that these characteristics can serve as important factors in preventing adverse reactions to blood donation. Ultimately, the predicted probability for this sample was 0.597.
[0128] The analysis reveals the decision-making basis of the model at the individual level, which has important reference value for clinical risk assessment and personalized intervention. Overall, the LightGBM model relies primarily on syncope and physiological indicators such as blood pressure and respiration when identifying the main outcome variable, suggesting that these variables have high practical applicability in actual risk prediction and intervention.
[0129] Figure 3 The importance of features in the main outcome variable prediction model based on the LightGBM algorithm is ranked (using Gain as the indicator). It is evident that syncope features are far more important than other variables, dominating the model's decision-making; diastolic blood pressure, respiration, and systolic blood pressure are secondary, while other variables contribute only to a limited extent. These results indicate that the model constructed in this invention primarily relies on information related to syncope when identifying the main outcome variable, suggesting that this variable has significant reference value in practical risk prediction and intervention.
[0130] To further enhance the interpretability of the model at the individual level, this invention uses the DALEX tool to perform a local interpretation of the LightGBM model on the 49th sample in the test set. The local interpretation, presented as a decomposed bar chart, clearly demonstrates the positive and negative impacts of each feature value of the blood donor on the final predicted probability. For example... Figure 4As shown in the figure, the DALEX partial interpretation analysis results indicate that when LightGBM predicted the 49th test sample, the feature "syncope = 0" (no syncope occurred) contributed the most to the prediction probability, significantly increasing the probability that this sample was predicted as an adverse reaction. It is important to note that this result reflects the model's decision-making mechanism under all feature combinations for this sample, rather than "no syncope occurring" itself being a risk factor for an adverse reaction. In fact, in this sample, other features (such as fatigue = 0, muscle contraction = 2, weakness = 0, etc.) also made some positive contributions, suggesting that these feature combinations may be related to the risk of adverse reactions; some features (such as eating before blood donation = 0, blood donation history = 0, height = 155, gender = 0) contributed less. The horizontal axis in the figure represents the predicted probability output by the model, and the vertical axis represents each feature and its actual value. The length and direction of the bars indicate the impact of each feature on the final prediction result. The final predicted probability value for this sample is marked at the bottom of the bars. This analysis reveals the model's decision-making basis for individual cases, providing a reference for personalized clinical risk assessment and intervention.
[0131] Secondary outcome variable prediction model interpretability analysis and visualization report output:
[0132] To address the training and evaluation biases caused by extreme class imbalance, this invention employs the following methods: (1) automatically merging rare classes with very few samples to prevent missing samples from a single class; (2) stratified sampling to ensure that each class has representative samples in the test set, facilitating fair evaluation; and (3) introducing class weights during model training, assigning higher weights to rare classes to improve the model's ability to identify minority classes. These measures collectively ensure the model's generalization ability under extremely imbalanced data and the scientific validity of multi-class evaluation. The definitions of each class are as follows:
[0133] 0: Other blood donation reactions refer to other rare or unclassified adverse reactions besides the types mentioned above (such as special cases, rare reactions, etc.). Generally, this corresponds to other values of the reaction variable or missing data, and the corresponding reaction variable value is 0.
[0134] 1: Adverse reactions to local blood donation (such as pain, swelling, and local bleeding at the puncture site), with the corresponding reaction variable set to 1;
[0135] 2: Adverse reactions to systemic blood donation (such as mild dizziness, fatigue, etc.), with the corresponding reaction variable value set to 2;
[0136] 3: Mixed adverse reactions, including two or more of the above three types of mixed adverse reactions, with the corresponding reaction variable value being 3;
[0137] like Figure 5As shown in the figure, 0, 1, 2, and 3 represent different types of adverse reactions to blood donation: 0 represents "other adverse reactions to blood donation", 1 represents "local adverse reactions to blood donation", 2 represents "systemic adverse reactions to blood donation", and 3 represents "mixed adverse reactions" (i.e., two or more of the aforementioned three types of mixed adverse reactions occur). The sample distribution is as follows: 2 samples of type 0; 2 samples of type 1; 136 samples of type 2; and 7 samples of type 3.
[0138] As can be seen, the ROC curve for category 0 (other blood donation reactions) is only a small segment. This is because the sample size for this category in the test set is extremely small, resulting in the ROC curve showing only a limited number of discrete points, unlike the smooth and continuous curves for other categories. This is a common phenomenon under extreme class imbalance.
[0139] The small sample size of Class 0 in the test set shows that the ROC curve is only a small segment, reflecting the impact of extreme class imbalance on the assessment. Overall, the model has a high discriminative ability for all sub-outcome variables, with the area under the receiver operating characteristic curve greater than 0.96 for each.
[0140] To improve the interpretability of the model, this invention employs the SHAP method for global variable contribution analysis. The SHAP method quantifies the average influence of each input feature on the overall prediction of the model. The analysis results are as follows: Figure 6 As shown, age is the most important variable affecting the prediction results of the multi-class model, followed by body mass index, dizziness, sweating, paleness, etc., indicating that the model's discrimination criteria are basically in line with clinical practice and medical common sense. Figure 6 The horizontal axis represents the average SHAP value (absolute value) of each feature, indicating the average contribution of that feature to the overall prediction of the model. The top-ranked features play a crucial role in the model's discrimination of secondary outcome variables and help to understand the model's decision-making basis.
[0141] At the individual sample level, this invention employs LIME (Locally Interpretable Model-Independent Method) for local interpretability analysis. Taking the 49th sample in the test set as an example (model predicts 2 classes), the LIME analysis results are shown below. Figure 7 The figure shows that the overall pain score significantly supports the classification of this sample; other factors such as puncture pain, body mass index, puncture difficulty (or puncture effect), blood donation time, and body temperature also contribute positively to the prediction to varying degrees; while diastolic blood pressure, pulse rate, and respiratory rate have a certain negative impact on the prediction results.
[0142] Figure 7The horizontal axis represents the feature contribution weight. Blue bars represent features that support the current predicted category, while red bars represent features that suppress the category. A larger weight indicates a more significant impact of the feature on the prediction. This method helps reveal the main basis of the model in individual decision-making, improving the model's transparency and credibility in high-risk medical scenarios.
[0143] Overall, the model performed excellently in the major categories, while individual indicators for the minor categories were only for reference. Comprehensive indicators such as macro-average AUC and macro-average F1 scores reflect the overall discriminative ability. Ultimately, the best model was determined by ranking the results using a combination of macro-average AUC, accuracy, and F1 scores.
[0144] S7. Using the selected best primary outcome variable prediction model and best secondary outcome variable prediction model, collect demographic information, blood donation history, adverse reaction records, and other relevant data of the blood donors to be predicted, and predict adverse reactions to blood donation.
[0145] Example 2
[0146] Figure 8 This invention illustrates a specific embodiment of the whole blood donation adverse reaction risk prediction system, comprising:
[0147] The data acquisition module is used to automatically collect multi-source heterogeneous data, including basic information of blood donors, blood donation process, laboratory tests, and adverse reaction records.
[0148] The data preprocessing module is used to clean, denoise, fill in missing values, and standardize the raw data.
[0149] The hierarchical modeling module is used to train multiple machine learning models based on the primary outcome variable and the secondary outcome variable to construct a primary outcome variable prediction model and a secondary outcome variable prediction model, respectively. The primary outcome variable is severe adverse reactions to blood donation, and the secondary outcome variable is the type of adverse reaction.
[0150] The knowledge base and rule engine integration module is used to integrate the clinical expert knowledge base and rule engine, combining the prediction results of the main outcome variable prediction model and the secondary outcome variable prediction model with the experience of medical experts and authoritative guidelines to form personalized health recommendations.
[0151] The push service module is used to push the risk stratification results and individualized health recommendations output by the main outcome variable prediction model and the secondary outcome variable prediction model to blood donors, medical staff or managers.
[0152] The feedback collection module is used to collect user feedback information and actual intervention effects in real time, including blood donor self-reports, medical staff records, and automatic system collection.
[0153] The model self-optimization module is used to automatically trigger model retraining and parameter adjustment based on the feedback acquisition module's feedback data.
[0154] In this embodiment, the machine learning models used by the hierarchical modeling module for the primary outcome variable include Logistic Regression, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Support Vector Machine (SVM), LightGBM, and Multilayer Perceptron (MLP); the machine learning models used for the secondary outcome variable include CatBoost, Random Forest, Extreme Gradient Boosting Tree (XGBoost), Multinomial Logistic Regression, Naive Bayes, Support Vector Machine (SVM), k-Nearest Neighbors (kNN), and LightGBM.
[0155] The hierarchical modeling module is also used to perform probability threshold screening for the main outcome variable during training, that is, to traverse different risk probability thresholds, calculate the F1 score under each threshold, and select the probability threshold with the largest F1 score as the high-risk discrimination criterion; the F1 score is the harmonic mean of precision and recall in the evaluation of the classification model.
[0156] The hierarchical modeling module is also used to evaluate the model using multiple evaluation metrics, and to select the best primary outcome variable prediction model and the best secondary outcome variable prediction model. The evaluation metrics include the area under the receiver operating characteristic curve (AUC), accuracy, sensitivity, specificity, precision, and F1 score.
[0157] The hierarchical modeling module is also used to perform 10-fold cross-validation on the selected best primary outcome variable prediction model and the best secondary outcome variable prediction model, and to evaluate the stability and reliability of the model based on the results of various evaluation indicators of the cross-validation.
[0158] The hierarchical modeling module is also used to perform sample balancing before model training, specifically:
[0159] For the main outcome variable prediction model, the minority class samples are oversampled and the majority class samples are undersampled in the training data. A new balanced training set is constructed by generating synthetic main outcome variable and secondary outcome variable samples.
[0160] For the secondary outcome variable prediction model, an automatic stratified sampling strategy is adopted. For categories with very few samples, a minimum sampling threshold is set, and for several categories with very low sample sizes, they are merged into one category.
[0161] The hierarchical modeling module is also used to perform model interpretability analysis and output visualization reports after selecting the best primary outcome variable prediction model and the best secondary outcome variable prediction model. Specifically, for the best primary outcome variable prediction model and the best secondary outcome variable prediction model, interpretability AI methods are used to analyze the variable contribution and generate feature importance ranking, interpretive charts, model performance reports, ROC curves, key risk factor bar charts, and local interpretation documents. The interpretability AI methods include Shapley value additive interpretation method (SHAP), locally interpretable model-independent interpretation method (LIME), gain, and the DALEX toolkit for model interpretability.
[0162] Using the risk prediction system of this embodiment, the method for predicting adverse reactions to blood donation in potential donors is as shown in the steps of Embodiment 1.
[0163] This invention, with blood donors, blood bank management systems, and medical staff as core users, constructs a complete closed-loop system integrating data uploading, risk identification, personalized health advice delivery, monitoring and intervention, and effect feedback. Figure 9 As shown, the specific process is as follows:
[0164] After blood donors complete registration, their basic information, blood donation history, and physical examination data are automatically uploaded to the risk management platform by the blood bank's information management system.
[0165] The system automatically conducts risk assessments on blood donors, identifies high-risk individuals, and combines AI data-driven models with a clinical expert knowledge base and rule engine to generate personalized, scientific, and authoritative health advice and risk warnings.
[0166] The push service accurately delivers health advice and risk warnings to blood donors, enabling personalized health management; it supports push notifications through multiple channels such as SMS, App, and WeChat.
[0167] Administrators / doctors dynamically monitor and implement intervention measures for high-risk blood donors based on system risk alerts; the intervention plan includes both automatic model recommendations and flexible adjustments based on expert knowledge bases and rule engines.
[0168] The entire process, intervention effects, and donor feedback are automatically recorded in the system database. The platform regularly analyzes the feedback data to drive the self-optimization of model parameters and intervention strategies, thereby achieving continuous closed-loop improvement in risk management.
[0169] This closed-loop system significantly improves the informatization, intelligence, and personalization of blood donation safety management, providing solid technical support for blood banks and clinical risk intervention.
[0170] This system accurately identifies high-risk blood donors based on a risk prediction model and generates and pushes personalized health management suggestions through an automated process, achieving an intelligent closed-loop risk intervention. The specific process is as follows: Figure 10 As shown:
[0171] High-risk identification: Using a trained risk prediction model, large-scale blood donor data is analyzed in real time to dynamically screen individuals with high-risk characteristics. Risk identification is not only based on model judgment, but also integrates expert rules and historical cases to improve identification accuracy.
[0172] Health advice push: For each high-risk blood donor, the system automatically generates personalized health management and intervention suggestions based on their specific risk factors. The suggestions cover precautions before and after blood donation, lifestyle guidance, and necessary medical follow-up reminders, and are accurately pushed to blood donors and related medical staff.
[0173] User acceptance and feedback: Blood donors and medical staff receive health advice through the system interface, mobile devices or other means. Users can actively provide feedback on the adoption of suggestions, actual implementation effects and problems encountered, providing first-hand data for continuous system optimization;
[0174] Feedback Collection and Effectiveness Evaluation: The system automatically collects user feedback and intervention results, and regularly evaluates the actual effectiveness of the intervention measures, including collecting multi-dimensional indicators such as changes in the incidence of adverse reactions after intervention, user satisfaction, and intervention compliance.
[0175] Model and intervention strategy optimization: Real-world feedback data serves as an important basis for model retraining and intervention strategy adjustment, automatically optimizing risk discrimination thresholds, feature weights, and intervention processes to achieve a positive cycle and continuous progress in risk management.
[0176] Through the aforementioned closed-loop process, the system can achieve dynamic and accurate identification of high-risk blood donors, generation of individualized health advice, real-time feedback on intervention effects, and model self-optimization, greatly improving the scientific, intelligent, and practical nature of blood donation risk management.
Claims
1. A method for predicting the risk of adverse reactions to whole blood donation, characterized by, Comprise the following steps: S1, data import and integration: import the demographic information of blood donors, blood donation history, adverse reaction records from the blood donation management platform system; S2, data preprocessing: including data cleaning, missing value processing, feature engineering processing, data layering and label generation, and dividing the data into training set and test set in the ratio of 7:3; S3, variable definition and coding: Serious blood donation adverse reactions are defined as the primary outcome variable, which is valued as 1 when consciousness loss, medical treatment or injury occurs, and 0 when consciousness loss, medical treatment or injury does not occur; Adverse reaction types are defined as secondary outcome variables, which are divided into three categories, the first category is other blood donation reactions, valued as 0, the second category is local blood donation adverse reactions, valued as 1, and the third category is systemic blood donation adverse reactions, valued as 2, including mixed adverse reactions of two or more of the above three categories, valued as 3; The demographic information of blood donors, blood donation history, adverse reaction records are defined as input variables for model training; Before model training, sampling balance is also performed, specifically: For the primary outcome variable prediction model, the minority class samples are oversampled and the majority class samples are undersampled in the training data, and a new balanced training set is constructed by generating synthetic samples; For the secondary outcome variable prediction model, an automatic stratified sampling strategy is adopted, a minimum sampling threshold is set for classes with few samples, and several classes with very low sample size are merged into one class; S4, multi-model training: for the primary outcome variable, i.e. binary classification prediction task, and secondary outcome variable, i.e. multi-classification prediction task, multiple machine learning models are trained; In the training process, for the primary outcome variable, probability threshold screening is performed, that is, different risk probability thresholds are traversed, the F1 score under each threshold is calculated respectively, and the probability threshold with the maximum F1 score is selected as the high risk discrimination standard; The F1 score is the harmonic mean of precision and recall in classification model evaluation; S5, model evaluation and selection: evaluate with multiple evaluation indicators to select the best primary outcome variable prediction model and the best secondary outcome variable prediction model, the evaluation indicators include area under the receiver operating characteristic curve AUC, accuracy Accuracy, sensitivity Sensitivity, specificity Specificity, precision Precision, F1 score; S6, ten-fold cross-validation is performed on the selected best primary outcome variable prediction model and the best secondary outcome variable prediction model, and the stability and reliability of the model are evaluated based on the cross-validation evaluation index results; S7, use the selected best primary outcome variable prediction model and the best secondary outcome variable prediction model to collect the demographic information, blood donation history and adverse reaction records of the blood donors to be predicted, and predict the risk of blood donation adverse reactions.
2. The method for predicting the risk of adverse reactions of whole blood donation according to claim 1, characterized in that: In step S2, the data cleaning includes removing duplicate, invalid or obviously incorrect data entries, and reasonably correcting or deleting abnormal values; The missing value processing specifically comprises: for continuous variables, multiple imputation is adopted; for discrete type variables, missing data is filled by using a mode filling method; The feature engineering processing comprises normalization, standardization, feature selection and dimension reduction; The data stratification and label generation specifically comprises: automatically generating labels according to main outcome variable and secondary outcome variable standards.
3. The method for predicting the risk of adverse reactions of whole blood donation according to claim 1, characterized in that: In step S4, the machine learning model adopted for the main outcome variable comprises Logistic regression, random forest RandomForest, extreme gradient boosting tree XGBoost, support vector machine SVM, light gradient boosting machine LightGBM and multi-layer perception machine MLP; and the machine learning model adopted for the secondary outcome variable comprises category boosting tree CatBoost, random forest RandomForest, extreme gradient boosting tree XGBoost, multinomial Logistic regression, naive Bayes NaiveBayes, support vector machine SVM, k-nearest neighbor kNN and light gradient boosting machine LightGBM.
4. The method for predicting the risk of adverse reactions of whole blood donation according to claim 1, characterized in that, The input variables comprise continuous variables, binary classification variables and multi-classification variables, wherein: The continuous variables comprise: age, weight, height, blood volume, body mass index, body temperature, systolic pressure, diastolic pressure, blood donation amount, blood donation reaction duration, pulse frequency and respiratory frequency. Binary variables include: gender, 0 represents female, 1 represents male; blood donation history, 0 represents first-time blood donor, 1 represents non-first-time blood donor; blood donation reaction occurrence time, 0 represents blood donation reaction occurring before blood collection, 1 represents occurring after blood collection; pain in other parts of the body, 0 represents no pain, 1 represents pain; hematoma, 0 represents no hematoma, 1 represents hematoma; ecchymosis, 0 represents no ecchymosis, 1 represents ecchymosis; dizziness, 0 represents no feeling of dizziness, 1 represents feeling of dizziness; sweating, 0 represents no sweating, 1 represents sweating; weakness, 0 represents no feeling of weakness, 1 represents feeling of weakness; anxiety, 0 represents no anxiety, 1 represents anxiety; pale complexion, 0 represents no pale complexion, 1 represents pale complexion; malaise, 0 represents no malaise, 1 represents malaise; nausea, 0 represents no nausea, 1 represents nausea; vomiting, 0 represents no vomiting, 1 represents vomiting; excessive ventilation, 0 represents no excessive ventilation, 1 represents excessive ventilation; syncope, 0 represents no syncope, 1 represents syncope; convulsions, 0 represents no convulsions, 1 represents convulsions; incontinence, 0 represents no incontinence, 1 represents incontinence; blood donation organization form, 0 represents voluntary blood donation, 1 represents emergency blood donation; needle phobia, 0 represents no needle phobia, 1 represents needle phobia; blood phobia, 0 represents no blood phobia, 1 represents blood phobia; environmental factors, 0 represents no environmental factors, 1 represents environmental factors; car sickness, 0 represents no car sickness, 1 represents car sickness; fatigue, 0 represents no fatigue before blood donation, 1 represents fatigue before blood donation; lack of sleep before blood donation, 0 represents sufficient sleep before blood donation, 1 represents lack of sleep before blood donation; long blood collection time, 0 represents no long blood collection time, 1 represents long blood collection time; group effect, 0 represents no group effect, 1 represents group effect; fasting, 0 represents no fasting before blood donation, 1 represents fasting before blood donation; long time without water replenishment, 0 represents no long time without water replenishment before blood donation, 1 represents long time without water replenishment before blood donation; difficult puncture, 0 represents no difficult puncture, 1 represents difficult puncture during blood collection; improper compression hemostasis, 0 represents no improper compression hemostasis, 1 represents improper compression hemostasis after blood donation; communication with blood collection personnel, 0 represents general, 1 represents good; The multi-classification variables include: eating before blood donation, 0 represents not eating, 1 represents eating less than 1 hour, 2 represents eating between 1-2 hours, 3 represents eating more than 2 hours or more; waiting time before blood donation, 0 represents no waiting time before blood donation, 1 represents waiting time less than 30 minutes, 2 represents waiting time between 30-60 minutes, 3 represents waiting time more than 60 minutes; drinking before blood donation, 0 represents not drinking before blood donation, 1 represents drinking less than 200 ml, 2 represents drinking between 200-400 ml, 3 represents drinking more than 400 ml; pain of puncture, 0 represents not painful or no feeling, 1 represents somewhat painful, 2 represents very painful; muscle contraction, 0 represents no muscle contraction before blood donation, 1 represents muscle contraction movement for 5-10 seconds, 2 represents muscle contraction movement more than 10 seconds; psychology before blood donation, 0 represents very nervous, 1 represents relaxed, 2 represents nervous, 3 represents generally nervous; understanding of adverse reactions of blood donation, 0 represents not understanding the adverse reactions of blood donation, 1 represents very understanding the adverse reactions of blood donation, 2 represents not very understanding the adverse reactions of blood donation, 3 represents generally understanding the adverse reactions of blood donation.
5. The method for predicting the risk of adverse reactions of whole blood donation according to claim 1, characterized in that, In the model training stage, parameter optimization is also carried out, specifically: For each candidate machine learning model, the model key parameters including learning rate, tree depth and regularization coefficient are optimized by grid search or cross-validation method, and AUC, accuracy, sensitivity, specificity and F1 score are used as optimization targets, and finally the model parameter combination with the best comprehensive performance is selected; For the machine learning model supporting class weight, class weight adjustment is also carried out, that is, in the model training stage, the class weight is automatically calculated and distributed, so that the weight is inversely proportional to the number of class samples.
6. The method for predicting the risk of adverse reactions of whole blood donation according to claim 1, characterized in that: After screening out the best primary outcome variable prediction model and the best secondary outcome variable prediction model, model interpretability analysis and visual report output are also carried out, specifically: for the best primary outcome variable prediction model and the best secondary outcome variable prediction model, variable contribution analysis is carried out by using an interpretable AI method, and feature importance ranking, interpretable chart, model performance report, ROC curve, key risk factor bar chart and local explanation document are generated, the interpretable AI method includes Shapley value additive explanation method SHAP, local interpretable model independent explanation method LIME, gain Gain and tool kit DALEX for model interpretability.
7. A system for predicting the risk of adverse reactions to whole blood donation, characterized by It includes: A data acquisition module for automatically collecting multi-source heterogeneous data, the multi-source heterogeneous data including donor basic information, blood donation process, laboratory detection and adverse reaction record; A data preprocessing module for cleaning, denoising, missing value completion and standardization processing of original data; A hierarchical modeling module for training a plurality of machine learning models based on primary outcome variables and secondary outcome variables, and constructing a primary outcome variable prediction model and a secondary outcome variable prediction model, the primary outcome variable being a serious adverse reaction of blood donation, and the secondary outcome variable being an adverse reaction type; a knowledge base and rule engine integration module for integrating a clinical expert knowledge base and a rule engine, combining prediction results of the primary outcome variable prediction model and the secondary outcome variable prediction model with medical expert experience and authoritative guidelines to form individualized health recommendations; a push service module for pushing risk stratification results and individualized health recommendations output by the primary outcome variable prediction model and the secondary outcome variable prediction model to blood donors, medical staff or managers; a feedback collection module for collecting user feedback information and actual intervention effects in real time, including self-reports by blood donors, records by medical staff and automatic collection by the system; a model self-optimization module for automatically triggering model retraining and parameter adjustment based on feedback collection module backflow data, realizing intelligent closed-loop optimization and continuous upgrading of the system; the machine learning models used by the stratified modeling module for the primary outcome variable include Logistic regression, Random Forest, XGBoost, SVM, LightGBM and MLP; and the machine learning models used for the secondary outcome variable include CatBoost, Random Forest, XGBoost, multinomial Logistic regression, Naive Bayes, SVM, kNN and LightGBM; the stratified modeling module is also used to perform probability threshold screening for the primary outcome variable during the training process, that is, different risk probability thresholds are traversed, F1 scores under each threshold are calculated respectively, and the probability threshold with the largest F1 score is selected as the high-risk discrimination standard; the F1 score is a harmonic mean that takes into account both precision and recall in classification model evaluation; the stratified modeling module is also used to evaluate a plurality of evaluation indexes to respectively screen out the best primary outcome variable prediction model and the best secondary outcome variable prediction model, the evaluation indexes including AUC, Accuracy, Sensitivity, Specificity, Precision and F1 score; the stratified modeling module is also used to perform ten-fold cross-validation on the screened best primary outcome variable prediction model and the best secondary outcome variable prediction model, and analyze the evaluation index fluctuation of each fold to determine the stability and generalization ability of the model, thereby further confirming the reliability of the model.
8. The whole blood donation adverse reaction risk prediction system according to claim 7, characterized in that: the stratified modeling module is also used to perform sampling balancing before model training, specifically: for the primary outcome variable prediction model, over-sampling is performed on minority class samples in the training data, while under-sampling is performed on majority class samples, and a new balanced training set is constructed by generating synthetic samples; For the secondary outcome variable prediction model, an automatic stratified sampling strategy is adopted. For the class with very few samples, a minimum sampling threshold is set. For several classes with very low sample size, they are merged into one class. The hierarchical modeling module is also used to perform model interpretability analysis and visual report output after screening the best primary outcome variable prediction model and the best secondary outcome variable prediction model. Specifically, for the best primary outcome variable prediction model and the best secondary outcome variable prediction model, the variable contribution degree is analyzed by using an interpretable AI method, and feature importance ranking, interpretable chart, model performance report, ROC curve, key risk factor bar chart and local explanation document are generated. The interpretable AI method includes Shapley value additive explanation method SHAP, local interpretable model independent explanation method LIME, gain Gain and DALEX toolkit for model interpretability.
Citation Information
Patent Citations
Blood station management information system
CN110910994A
Informationized blood collection and supply method
CN111325515A
Blood donator identification and recruitment method based on machine learning
CN111477332A
Blood donation reaction early warning monitoring system and method
CN117100234A
Whole blood donor low hemoglobin delayed blood donation risk prediction method
CN119361157A