Personalized drug recommendation method and system fusing adverse drug reaction

By constructing a dynamic integrated model of drug similarity and adverse reaction characteristics, the shortcomings of existing drug recommendation methods in longitudinal EHR data processing are addressed, achieving higher accuracy and safety, and enabling personalized drug recommendations to adapt to different historical data lengths.

CN121983226APending Publication Date: 2026-05-05QINGDAO UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610003920.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-05
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing drug recommendation methods struggle to adapt to varying lengths of historical data when processing longitudinal EHR data, particularly performing poorly with new patients or limited historical data. Furthermore, they lack sufficient systematic integration of adverse drug reaction information, impacting the accuracy and safety of recommendation results.

Method used

By constructing a time-dynamic and global contextual information model of multiple patient visits, introducing drug similarity features, and integrating external adverse drug reaction features, dynamic selection and weighting of multi-source information can improve the accuracy and safety of personalized drug recommendations.

Benefits of technology

It significantly improved the quality of multi-source medical data fusion, enhanced the accuracy and safety of drug recommendations, and strengthened the model's generalization ability and robustness to new patients and drugs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121983226A_ABST
    Figure CN121983226A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of intelligent medical treatment, and particularly relates to a personalized drug recommendation method and system fusing adverse drug reactions, and the method comprises the following steps: inputting longitudinal electronic health record multi-source data of a patient, extracting and fusing time sequence features and drug similarity features, and generating comprehensive information representation of the patient. Local drug information representations and drug information representations are generated through a drug molecule bipartite graph and a drug information cassette, respectively, based on the comprehensive information representation of the patient. After external adverse drug reaction information is introduced and processed by an encoder, the comprehensive information of a patient is used for representing weighting, and adverse drug reaction characteristics are obtained. And the local drug information representation, the drug information representation and the adverse drug reaction characteristics are spliced, and final drug combination recommendation is output through prediction scores. According to the method, various kinds of useful information are fully utilized, complementarity and correlation among different medicine information sources are captured, the quality of multi-source data fusion is improved, and the accuracy and safety of medicine recommendation are optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent healthcare, and in particular to personalized drug recommendation and medication safety control technology based on electronic health records. Specifically, it relates to a personalized drug recommendation method and system that integrates adverse drug reactions with drug similarity and adverse reaction information, combined with a time-series module. Background Technology

[0002] With the rapid development of medical data acquisition technologies and electronic health record (EHR) systems, the diversity and complexity of medical data are constantly increasing. Medical data from different sources and of different types (such as diagnoses, surgeries, and medications) collectively constitute a patient's longitudinal health profile. This multimodal and multi-perspective data often contains rich and complementary information. How to integrate and utilize this heterogeneous medical data to achieve safe and personalized drug recommendations is an important research topic in the field of intelligent healthcare.

[0003] Existing drug recommendation methods are mainly divided into two categories: one is instance-based methods that recommend drugs based on current medical information. These methods rely solely on the patient's current static clinical diagnosis to recommend drugs, ignoring the dynamic changes in historical health status. The other is time-series methods based on longitudinal patient records. These methods mine historical health data to construct richer patient representations and achieve personalized drug recommendations. In recent years, deep learning techniques such as recurrent neural networks and graph neural networks have been widely used in modeling longitudinal EHR data, capable of capturing complex temporal dependencies and global contextual information from multiple patient visits. However, longitudinal methods still have several key problems: First, most existing longitudinal methods use static computational processes, making it difficult to adapt to historical records of varying lengths, especially performing poorly with new patients or limited historical data (i.e., the cold start problem); second, although some works have considered drug-drug interactions (DDIs), the systematic integration of adverse drug reactions (ADRs) information is still insufficient, leading to potential safety risks in the recommendation results; furthermore, existing methods have limitations in handling the diversity and personalization of drug recommendations, making it difficult to balance accuracy and safety.

[0004] To address these challenges, some studies have attempted to incorporate multi-source heterogeneous information into drug recommendation systems. For example, the SafeDrug method utilizes molecular graphs and DDI graphs for safety control of drug combinations, COGNet models the relationships between drug recommendations using multi-graph information, and Trans-GAHNet integrates longitudinal clinical and drug information to improve recommendation performance. However, these methods still have limitations in terms of cold start, model complexity, and practical clinical application, and their deep integration and dynamic weight allocation of adverse drug reaction information are still insufficient.

[0005] In summary, drug recommendation systems based on electronic health records are a crucial technology for improving intelligent medication use in clinical practice. Existing methods largely rely on simple feature fusion of patient history information, lacking dynamic selection and weighting mechanisms for multi-source information such as longitudinal health data, drug similarity, and adverse reactions. Consequently, some valuable information is not fully utilized, affecting the accuracy and safety of recommendations. The current field of drug recommendation urgently needs an innovative method that can dynamically integrate multi-source medical information, drug similarity, and adverse reaction features, while balancing recommendation accuracy and safety. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention proposes a personalized drug recommendation method and system that integrates adverse drug reactions. The technical problem this invention aims to solve is how to achieve dynamic selection and weighting of patient longitudinal data, multi-source information, and drug safety in drug recommendation, effectively utilizing the unique characteristics of each patient and the unique molecular representation of different drugs to improve the accuracy of personalized drug recommendations.

[0007] To address the aforementioned technical problems, this invention proposes a personalized drug recommendation method and system that integrates adverse drug reactions. This method simultaneously models the temporal dynamics of multiple patient visits and global contextual information, introduces drug similarity features to enhance the understanding of potential associations between drugs, and integrates external adverse drug reaction features to maximize the complementarity of various types of information, thereby improving the quality and interpretability of global data fusion and enhancing the accuracy of personalized recommendations and safe medication use.

[0008] A personalized drug recommendation method incorporating adverse drug reactions includes the following steps: S1. The patient stated: Acquire multi-source longitudinal electronic health record (EHR) data of patients, extract and fuse temporal features and drug similarity features to generate a comprehensive information representation of patients. ; Step 1: Construction and Coding of Longitudinal EHR Multi-Source Data We acquire patients' longitudinal electronic health record (EHR) data, which consists of multiple medical visits, each of which includes at least information on the disease, surgery, and medication. We construct trainable embedding matrices by multi-hot encoding the diseases and surgeries (the dataset has been pre-processed), mapping the disease set and surgery set corresponding to each medical visit into low-dimensional continuous vector representations, forming the basic feature representation of each medical visit.

[0009] Step 2: Extraction of temporal features According to the order of the patient's visits, the disease and surgical feature vectors of each visit are input into the temporal modeling network to extract the temporal feature vectors that reflect the evolution trend of the patient's condition.

[0010] Step 3: Construction and extraction of drug similarity features Based on the patient's medication history, the similarity of drug sets between different visits is calculated. Jaccard similarity is used for this calculation to construct a visit-level drug similarity matrix. Each visit is treated as a node in a graph structure, and the drug similarity matrix represents the connection between nodes. The features of the visit nodes are updated using GCN to obtain a visit representation that incorporates drug similarity information.

[0011] Step 4: Fusion of temporal features and drug similarity features The temporal feature vector obtained in Step 2 is concatenated and dimensionality reduced with the drug similarity enhancement feature obtained in Step 3 to form the final comprehensive patient feature representation, which is used for subsequent medication recommendation decisions.

[0012] S2. Drug Information Integration: The process includes two steps: constructing a drug molecule bipartite diagram and a drug information box. The drug molecule bipartite diagram step involves: decomposing the drug molecule to construct the drug molecule bipartite diagram and representing it with comprehensive patient information. Perform dimensional transformation to obtain local function vectors, and then convert the local function vectors into local drug information representations. ; The steps of drug information boxing include: extracting EHR diagrams and drug interaction DDI diagrams from multi-source EHR data; obtaining drug co-occurrence and interaction information from the EHR diagrams and DDI diagrams and modeling them to obtain a unified representation of drug knowledge. Simultaneously, all historical patient information from multiple follow-ups is stored in dynamic memory, representing the patient's comprehensive information. The unified representation of drug knowledge, Z, queries the historical records of dynamic memory through attention mechanisms to generate personalized drug information features; and represents the patient's comprehensive information. By integrating with personalized drug information features, a drug information representation can be generated. ; S3, Adverse Drug Reaction Code: Adverse drug reaction information from an external database is introduced, input into an encoder for feature encoding processing, and then represented using comprehensive patient information. The final adverse drug reaction characteristics are obtained by weighted summation of the encoded features. ; S4. Recommended medications: Representing drug information Local drug information representation Adverse drug reaction characteristics The features are then concatenated and predicted and scored to obtain the final drug combination recommendation.

[0013] Furthermore, the longitudinal electronic health record (EHR) data includes multiple visit records arranged chronologically by visit time. Each visit record contains corresponding disease features, surgical features, and medication features. Temporal modeling is performed on the disease and surgical features to obtain the disease and surgical feature representations of the patient's current visit, which are temporal features. Simultaneously, feature extraction and enhancement are performed on the medication similarity between the patient's longitudinal visits to obtain comprehensive drug embedding features, i.e., drug similarity features. The obtained disease and surgical feature representations, along with the comprehensive drug embedding features, are cascaded to obtain the final comprehensive information representation of the patient. .

[0014] Furthermore, construct a comprehensive patient information representation. The steps are as follows: Step 1: Perform feature encoding and embedding representation on disease features and surgical features respectively to obtain disease embedding vector and surgical embedding vector; Step 2: Use RNN and Transformer to integrate the temporal features of the disease embedding vector and the surgery embedding vector respectively to obtain the disease feature representation and surgery feature representation of the patient's current visit. The disease feature representation and surgery feature representation of the patient's current visit are temporal features. Step 3: Based on the feature set of all drugs used by the patient in each visit, construct a graph structure that reflects the drug similarity between visits, and enhance the features through a graph convolutional network (GCN) to obtain an enhanced visit representation. Then, average and aggregate the features across all visit node dimensions to obtain comprehensive drug embedding features, i.e., drug similarity features. Step 4: Concatenate the features obtained in Step 2 and Step 3 to obtain a comprehensive feature representation of the patient. .

[0015] Furthermore, the steps for constructing a bipartite graph of a drug molecule specifically include: decomposing the drug molecule and constructing a bipartite graph. Comprehensive patient information representation through fully connected neural networks Perform a dimensional transformation to obtain the local function vector. The calculation formula is: ; in, It is a linear transformation matrix, a function Comprehensive information representation of patients Perform the transformation. This represents the local function vector of the patient during disease treatment. This represents the Sigmoid function; The local function vector is obtained through a masked neural network. Converted into local drug information representation The calculation formula is: ; Where ⊙ represents element-wise multiplication, and the function... Used for local function vectors Generate local drug information representation ; The parameter matrix is ​​formed by dividing the elements of the bipartite graph. Mask.

[0016] Furthermore, the steps for creating the drug information box specifically include: S2.1: Extract EHR diagrams and drug interaction DDI diagrams from multi-source EHR data, and establish adjacency matrices for each. and adjacency matrix Add self-joins to the adjacency matrix and perform symmetric normalization, as shown in the following formula: ; ; in, It is a diagonal matrix. It is the identity matrix; This represents the drug co-occurrence feature matrix. Represents the drug co-occurrence feature matrix; S2.2: A two-layer graph convolutional network (GCN) is used to model the EHR and DDI graphs respectively, learning the embedding representations of drugs under co-occurrence and interaction relationships. The drug embedding matrices of the EHR and DDI graphs are then weighted and fused to serve as a unified representation of drug knowledge. Its form is as follows: ; in, These are drug embedding matrices from the EHR diagram and the DDI diagram, respectively; It is a trainable hidden weight parameter matrix. It is a learnable, adjustable parameter; S2.3: Arrange all historical patient information from multiple follow-ups in chronological order, with each patient as the key and the corresponding medication vector as the value, forming a key-value pair set. Stored in dynamic memory, represented as: ; in, Indicates the first One patient, Indicates the first The patient's current comprehensive characteristics Indicates the first The medication currently recommended for this patient. Indicates the current number of medical visits. ; S2.4: Represent the comprehensive information of the final patient at the t-th visit. Unified representation of drug knowledge By querying relevant historical records in dynamic memory through attention mechanisms, personalized drug information features are generated. ; ; in, Based on comprehensive patient information representation Unified representation of drug knowledge Content attention, This is a dual search result based on the time dimension. express The value corresponds to the medication vector of all historical patient information from multiple follow-ups. express The key corresponds to the current comprehensive characteristics of the patient, which are based on all historical patient information from multiple follow-ups. S2.5: Integrating personalized medication information features with comprehensive patient information representation By performing dimensional transformation and information aggregation, a drug information representation is obtained; the expression is as follows: ; in, For drug information representation, This represents the patient's comprehensive information. The transformation function on the surface performs dimensional transformation and information aggregation.

[0017] Furthermore, the steps for coding adverse drug reactions in S3 include: S3.1: The pre-constructed adverse drug reaction feature matrix o is used as input, and a multilayer perceptron is used for feature encoding to transform the high-dimensional and sparse adverse drug reaction feature matrix o into a usable low-dimensional representation; the specific encoding structure includes a fully connected network and an intermediate nonlinear activation function ReLU, and the encoding process is specifically represented as follows: ; ; in and The weights of the two-layer perceptron are... This represents the process vector obtained during the encoding process, where b1 and b2 are the corresponding bias vectors, and the vectors obtained after encoding. This represents the low-dimensional ADR feature embedding for each drug; S3.2: Representing the final patient's comprehensive information Feature embedding Perform weighted summation to obtain the characteristics of adverse drug reactions. The expression is as follows: ; in, The weight matrix represents the final comprehensive information of the patient. Mapped to ADR space.

[0018] Furthermore, the final drug combination recommendation specifically includes: the characteristics of adverse drug reactions. Drug information representation and The products are summed and their dimensions reduced to obtain the joint feature representation, which is then input into the prediction scoring network. Here, we use the sigmoid function and σ scaling to obtain the output of the integrated drug recommendation. The specific formula is: ; In this context, the symbol ⊕ represents vector concatenation, and ⊙ represents element-wise multiplication. (⋅) is the Sigmoid function, used to restrict the output value to between 0 and 1; The final drug recommendation requires outputting a corresponding recommendation score for each candidate drug. Based on a preset recommendation threshold (set to 0.5), drugs with scores higher than the threshold are identified as recommended drugs, thus forming the final drug combination recommendation result. The I function utilizes the threshold... Output of the model Binarization is performed, and drugs with a predicted probability greater than or equal to 0.5 are recommended as effective drugs, converting the results to 0 or 1; thus, drug combination recommendations are obtained. ; .

[0019] The present invention also provides a personalized drug recommendation system that integrates adverse drug reactions, including a patient representation module, a drug information integration module, an adverse drug reaction module, and a drug recommendation module; The patient representation module acquires multi-source longitudinal electronic health record (EHR) data from patients, extracts and fuses temporal features and drug similarity features, and generates a comprehensive patient information representation. ; The drug information integration module consists of two parts: a drug molecule bipartite graph module and a drug information box module. The drug molecule bipartite graph module decomposes drug molecules to construct a drug molecule bipartite graph and represents comprehensive patient information. Perform dimensional transformation to obtain local function vectors, and then convert the local function vectors into local drug information representations. Drug information box: Extracting EHR diagrams and drug interaction DDI diagrams from multi-source EHR data, obtaining drug co-occurrence and interaction information from the EHR and DDI diagrams, and modeling them to obtain a unified representation of drug knowledge. Simultaneously, all historical patient information from multiple follow-ups is stored in dynamic memory, representing the patient's comprehensive information. The unified representation of drug knowledge, Z, queries the historical records of dynamic memory through attention mechanisms to generate personalized drug information features; and represents the patient's comprehensive information. By integrating with personalized drug information features, a drug information representation can be generated. ; The adverse drug reaction coding module introduces external adverse drug reaction information, inputs it into the encoder for feature encoding processing, and represents it using the patient's comprehensive information. The final adverse drug reaction characteristics are obtained by weighted summation of the encoded features. ; The drug recommendation module represents drug information. Local drug information representation Adverse drug reaction characteristics The features are concatenated into a unified feature representation, and the concatenated feature representation is then used for prediction and scoring to obtain the final drug combination recommendation.

[0020] Compared with the prior art, the above technical solutions conceived in this invention can achieve the following beneficial effects: (1) By dynamically selecting and weighting each type of information feature, the multi-source heterogeneous data from patients’ longitudinal medical history, drug similarity, and adverse drug reactions can make full use of various useful information and significantly improve the quality of multi-source medical data fusion.

[0021] (2) This invention combines effective drug information from drug molecule bipartite diagrams, EHR diagrams, and DDI diagrams to capture the complementarity and correlation between different drug information sources, improve the adaptability and performance stability of the model when processing heterogeneous medical data, and provide more scientific and safe decision support for clinical intelligent drug use.

[0022] (3) For the multi-label classification task of drug recommendation, this invention has conducted extensive experiments on the MIMIC-III dataset, which can effectively improve the accuracy and safety of the recommendation, while improving the model's generalization ability and robustness to new patients and new drugs.

[0023] (4) This invention is also applicable to various intelligent medical scenarios such as drug recommendation under multi-source and multi-modal medical data. In particular, the model can still maintain excellent performance in real environments with high data dimensionality and complex features. Attached Figure Description

[0024] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a system architecture diagram of the present invention. Detailed Implementation

[0026] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0027] Example 1

[0028] This embodiment provides a personalized drug recommendation method that integrates adverse drug reactions. It dynamically selects the feature with the most information content and retains medication information and drug characteristics from other patients most similar to the current patient's medication information. Simultaneously, it weights different information sources to maximize the utilization of specific features from various information types, ultimately achieving a personalized and safe drug combination recommendation for the patient's current medical visit.

[0029] To verify the effectiveness of the proposed drug recommendation task in the context of multi-source medical data, a real electronic health record dataset from the MIMIC-III database was used, combined with adverse drug reaction characteristics from authoritative databases such as DrugBank, to perform a multi-label drug recommendation task. Specifically, before drug recommendation, patient medical record data was input, including longitudinal electronic health record (EHR) multi-source data (i.e., Figure 1 Longitudinal EHR data of patients in the study), EHR plot, DDI plot, adverse drug reaction characteristics (i.e., Figure 1 The model incorporates drug adverse reaction (ADR) characteristics. Patient longitudinal EHR data includes patient history, disease, surgery, medication information, and adverse drug reaction characteristics as multi-source inputs. The total sample size and feature dimensions are set based on the actual dataset. The model output is a personalized medication combination recommendation for each visit.

[0030] The different models used in this invention are not simply superimposed, but are set up separately for different types of data structures and technical problems, with clear functional division and application necessity.

[0031] Regarding the model: (1) Longitudinal EHR data has significant time series characteristics, with clear temporal dependencies between different medical records. To effectively model the evolution of patients' conditions over time, this invention uses temporal modeling networks (such as Transformer and RNN) to extract features from patients' longitudinal medical records. This type of model is suitable for processing sequence data with clear time order and complex dependencies, and can capture both long-term and short-term trends in disease changes. Other types of models cannot simultaneously meet this requirement.

[0032] (2) Co-occurrence relationships and adverse interactions between drugs naturally constitute graph-structured data, with drug nodes interconnected through co-occurrence or interaction edges. For this type of non-Euclidean structure data, this invention uses GCN to model the features of drug nodes to learn the structural association information between drugs. GCN can characterize the relationships between drugs through neighborhood information aggregation, which is difficult to effectively represent using traditional sequence models or fully connected models.

[0033] Therefore, the different models in this invention are applied to time series data modeling and graph structure data modeling respectively, solving different technical problems and having clear application necessity, rather than being a simple accumulation of technical means.

[0034] Regarding model training data, testing data, and data volume: During the model training and testing phases, this invention uses historical patient visit data from EHRs and publicly available databases of drug interactions and adverse reactions as training data sources. This data includes multiple patient visit records, historical medication information, and drug interaction relationships.

[0035] In practical implementation, the electronic health record data typically includes longitudinal medical records of at least several hundred patients, with each patient corresponding to multiple medical visits, used to support time-series feature modeling and medication behavior analysis; the publicly available drug database provides information on drug interactions and adverse reaction characteristics. The aforementioned historical data can be divided into training and testing datasets according to a preset ratio for model parameter learning and performance validation. The data scale is determined based on the amount of data available in the medical institution's electronic health record system, ensuring it meets the needs of model training and practical applications.

[0036] Combination Figure 1 and Figure 2As shown, a personalized drug recommendation method integrating adverse drug reactions according to the present invention includes the following steps: S1. The patient stated: Acquire multi-source longitudinal electronic health record (EHR) data of patients, extract and fuse temporal features and drug similarity features to generate a comprehensive information representation of patients. , as input for downstream tasks.

[0037] The longitudinal electronic health record (EHR) data includes multiple visit records arranged chronologically by visit time. Each visit record contains corresponding disease features, surgical features, and medication features. Temporal modeling is performed on the disease and surgical features to obtain representations of the patient's current visit's disease and surgical features, which are considered temporal features. Simultaneously, feature extraction and enhancement are performed on the medication similarity across the patient's longitudinal visits to obtain comprehensive medication embedding features, i.e., medication similarity features. The obtained disease and surgical feature representations, along with the comprehensive medication embedding features, are cascaded to obtain the final comprehensive information representation of the patient. .

[0038] As a preferred implementation method, firstly, a comprehensive information representation of the patient is constructed. The specific steps are as follows: Step 1: Perform feature encoding and embedding representation on the disease features and surgical features respectively to obtain the disease embedding vector and surgical embedding vector.

[0039] Step 2: Use RNN and Transformer to integrate the temporal features of the disease embedding vector and the surgery embedding vector respectively to obtain the disease feature representation and surgery feature representation of the patient's current visit. The disease feature representation and surgery feature representation of the patient's current visit are temporal features. This type of model is suitable for processing sequence data with clear time order and complex dependencies. It can capture long-term and short-term disease change trends. Other types of models are difficult to meet this requirement at the same time.

[0040] Step 3: Based on the feature set of all drugs used by the patient in each visit, construct a graph structure that reflects the drug similarity between visits, and enhance the features through a graph convolutional network (GCN) to obtain an enhanced visit representation. Then, average and aggregate the features across all visit node dimensions to obtain comprehensive drug embedding features, i.e., drug similarity features. GCN can characterize the relationship between drugs through neighborhood information aggregation. If traditional sequence models or fully connected models are used, it is difficult to effectively express this type of relationship structure.

[0041] Step 4: Concatenate the features obtained in Step 2 and Step 3 to obtain a comprehensive feature representation of the patient. .

[0042] As an example, in Step 1, the construction process of the disease embedding vector and the surgical embedding vector is as follows: Constructing a disease embedding table Each row of the disease embedding table corresponds to a specific disease, and a [database name] is initialized for each disease. A random vector of dimension is used to combine these vectors to form a diagnostic embedding table. ;in, , The total number of diagnostic terms contained in the dataset is denoted as . , Indicates the first A disease, This represents the feature dimension, which is a constant of 128.

[0043] Construct surgical embedding table Each row of the surgical embedding table corresponds to a specific surgical procedure, and a table is initialized for each surgical procedure. Dimensional random vectors, and combining these random vectors to form a surgical embedding table. ;in, , This represents the total number of surgeries included in the dataset.

[0044] Disease codes for patients were obtained by combining disease and surgical features from EHR multi-source data. and surgical codes Code the disease and surgical codes Map each to its corresponding embedding space; obtain the patient's disease embedding. and the patient's surgical embedding The calculation formula is as follows: ; ; Among them, disease codes Surgical code Disease Embedded and surgical embedding .

[0045] To better integrate EHR temporal features, a dual processing mechanism of RNN and Transformer is used to process the disease embeddings separately. and the patient's surgical embedding Information is integrated to obtain the patient's current disease characteristics and surgical characteristics; the formula is as follows: ; .

[0046] in, Indicates the first Secondary disease embedding, This indicates the first disease embedding. This indicates the second disease embedding. Indicates the first Secondary disease embedding, This indicates that the implantation occurred during the first surgery. This indicates that the implantation occurred during the second surgery. Indicates the first Second surgery to embed This indicates the characteristics of the disease the patient is currently seeking medical attention for. This indicates the characteristics of the surgery the patient is currently undergoing.

[0047] Step 3 involves feature extraction and enhancement for drug similarity between visits, including:

[0048] Patient T-time visit data were obtained from EHR multi-source data, with the medication set corresponding to each visit being: , ;in, This contains unique drug codes for all medications used in T medical visits, with T medical visits as the T nodes in a graph, representing the set of medications used based on the T medical visits. A drug similarity matrix is ​​constructed through similarity calculation. ;Will As an adjacency matrix in a graph structure, a graph of patient visit relationships is constructed, with patient visits as nodes and drug similarity as edge weights; where, , This indicates the total number of medical visits.

[0049] Assign corresponding feature vectors to T visits in the visitation relationship graph to form a feature matrix. Finally and The input graph is processed by a graph convolutional neural network (GCN), which updates node features based on drug similarity between visits, thereby obtaining an enhanced visit representation. The expression is as follows: ; Among them, enhanced access representation These are node features enhanced with drug similarity information, capable of capturing potential drug association patterns between different patient visits.

[0050] To obtain a comprehensive drug embedding, feature averaging is performed across all T nodes to enhance the access representation. Aggregation is performed at the node level to obtain comprehensive drug embedding features, expressed as follows: ; in, Indicates comprehensive drug embedding features, Indicates shared ownership The first visit, that is, the corresponding 1 node Represented as the first The feature vector of each node.

[0051] The obtained disease feature representations, surgical feature representations, and comprehensive drug embedding features are cascaded to obtain the final comprehensive information representation of the patient. The expression is as follows: ; in, Representing cascaded and dimensionality-reduced neural networks, Indicates the first The characteristics of the disease visited during the first visit indicate that Indicates the first The surgical characteristics of the first visit indicate that This indicates comprehensive drug embedding features.

[0052] S2. Drug Information Integration:

[0053] The inputs for this step are: drug molecule substructure sequence, drug co-occurrence map (EHR map) extracted from EHR data, drug interaction map (DDI map), and dynamic memory (patient medication history). This invention constructs adjacency matrices for the EHR map and the DDI map. and Based on rich health data and drug knowledge, these graph data are then stored in a memory bank (MB) and used as knowledge-driven guidance for comprehensive medication generation. Furthermore, patient visit history information is stored as key-value pairs in dynamic memory (DM), enabling the generation of personalized medication plans based on the patient's health status and historical medication records through a data-driven approach.

[0054] Specifically, this step includes two steps: drug molecule bipartite mapping and drug information boxing. The drug molecule bipartite mapping step includes: decomposing the drug molecule to construct a drug molecule bipartite map, and representing the patient's comprehensive information. Perform dimensional transformation to obtain local function vectors, and then convert the local function vectors into local drug information representations. .

[0055] The steps of drug information boxing include: extracting EHR diagrams and drug interaction DDI diagrams from multi-source EHR data; obtaining drug co-occurrence and interaction information from the EHR diagrams and DDI diagrams and modeling them to obtain a unified representation of drug knowledge. Simultaneously, all historical patient information from multiple follow-ups is stored in dynamic memory, representing the patient's comprehensive information. The unified representation of drug knowledge, Z, queries the historical records of dynamic memory through attention mechanisms to generate personalized drug information features; and represents the patient's comprehensive information. By integrating with personalized drug information features, a drug information representation can be generated. .

[0056] Drug information integration is carried out simultaneously in two parts: drug molecule bipartite map and drug information box.

[0057] The bipartite graph part of the drug molecule specifically includes: decomposing the drug molecule and constructing a bipartite graph. ;in , Indicates the number of substructures. Indicates the quantity of medicine.

[0058] Comprehensive information representation of the final patient through a fully connected neural network Perform a dimensional transformation to obtain the local function vector. The calculation formula is: ; in, It is a linear transformation matrix, a function Comprehensive information representation of the final patient Perform the transformation. This represents the local function vector of the patient during disease treatment. (⋅) is the Sigmoid function.

[0059] Another masked neural network will use local function vectors Converted into local drug information representation The calculation formula is: ; Where ⊙ represents element-wise multiplication, and the function... Used for local function vectors Generate local drug representation , ; For the parameter matrix, the elements of the parameter matrix are bipartite graphs. Masking. This method avoids the co-occurrence of potentially interacting drug pairs, thereby controlling undesirable drug interactions and ensuring the safety of drug combinations.

[0060] The drug information box includes:

[0061] S2.1: Extract EHR diagrams and drug interaction DDI diagrams from EHR multi-source feature data, and directly establish adjacency matrices respectively. and adjacency matrix By adding self-joins to the adjacency matrix and performing symmetric normalization, we obtain... and The formula is as follows: ; ; in, It is a diagonal matrix. It is the identity matrix; This represents the drug co-occurrence feature matrix. This represents the drug co-occurrence feature matrix.

[0062] S2.2: A two-layer graph convolutional network (GCN) is used to model the EHR and DDI graphs respectively, learning the embedding representations of drugs under co-occurrence and interaction relationships. The drug embedding matrices of the EHR and DDI graphs are then weighted and fused to serve as a unified representation of drug knowledge. Its form is as follows: ; in, These are drug embedding matrices from the EHR and DDI diagrams, respectively. It is a trainable hidden weight parameter matrix. It is a learnable adjustable parameter.

[0063] S2.3: Arrange all historical patient information from multiple follow-ups in chronological order, with each patient as the key and the corresponding medication vector as the value, forming a key-value pair set. Stored in dynamic memory, represented as: ; in, Indicates the first One patient, Indicates the first The patient's current comprehensive characteristics Indicates the first The medication currently recommended for this patient. Indicates the current number of medical visits. .

[0064] key-value pair set The simulation depicts a real-world prescribing process: when facing a patient, the doctor investigates the patient's medical history and assesses potential medical information leading to the current health status. Then, based on their clinical experience, the doctor searches for similar cases to aid treatment. Finally, by dynamically storing each patient's medical events and corresponding medications, the system matches the most similar patient representation based on the current patient's health status, thereby assisting in providing effective and safe drug recommendations.

[0065] S2.4: Represent the comprehensive information of the final patient at the t-th visit. Unified representation of drug knowledge By leveraging attention mechanisms to query the most relevant historical records in dynamic memory, personalized drug information features are generated. ; ; in, Based on comprehensive patient information representation Unified representation of drug knowledge Content attention, This is a dual search result based on the time dimension. express The value corresponds to the medication vector of all historical patient information from multiple follow-ups. express The key corresponds to the current comprehensive characteristics of the patient across all historical patient information from multiple follow-ups.

[0066] S2.5: Finally, integrate personalized medication information features with the patient's comprehensive information representation. After performing dimensional transformation and information aggregation, the drug information representation is obtained, as shown in the following expression: ; in, For drug information representation, This represents the comprehensive information of the final patient. The transformation function on the surface performs dimensional transformation and information aggregation.

[0067] S3, Adverse Drug Reaction Code:

[0068] Adverse drug reaction information from an external database is introduced, input into an encoder for feature encoding processing, and then represented using comprehensive patient information. The final adverse drug reaction characteristics are obtained by weighted summation of the encoded features. .

[0069] S3.1: External adverse drug reaction (ADR) information is introduced. A pre-constructed ADR feature matrix o (i.e., the ADR feature matrix in the figure) is used as input to the encoder. The ADR feature matrix o is compiled based on an authoritative ADR database and reflects the adverse reaction information that each drug may cause. A multilayer perceptron is used for feature encoding to transform the high-dimensional and sparse ADR feature matrix o into a usable low-dimensional representation. The specific encoding structure includes a fully connected network and an intermediate nonlinear activation function ReLU. The encoding process is specifically represented as follows: ; ; in and The weights of the two-layer perceptron are... This represents the process vector obtained during the encoding process, where b1 and b2 are the corresponding bias vectors, and the vectors obtained after encoding. This represents the low-dimensional ADR feature embedding for each drug.

[0070] S3.2: Utilizing comprehensive patient information to represent Feature embedding Weighted summation is performed to obtain the characteristics of adverse drug reactions. The expression is as follows: ; in, The weight matrix represents the final comprehensive information of the patient. Mapped to ADR space.

[0071] S4. Recommended medications:

[0072] When making drug recommendations, it is necessary to efficiently fuse multi-source heterogeneous information, such as comprehensive patient information, drug molecular information, and adverse drug reaction information. The fused features are then input into the drug recommendation decision module to fully capture the correlation between the multi-source information. After prediction and scoring using the Sigmoid function, the final recommended medication is obtained.

[0073] In this embodiment, drug information is represented Local drug information representation Adverse drug reaction characteristics The features are then concatenated and predicted and scored to obtain the final drug combination recommendation.

[0074] Specifically, drug information representation Local drug information representation Perform element-wise multiplication, and then compare the product with the characteristics of adverse drug reactions. By adding elements along the feature dimension and reducing the dimensionality, a joint feature expression that integrates multi-source drug information is formed.

[0075] The resulting joint feature representation is input into a prediction scoring network—here, the Sigmoid function is used—to output a corresponding recommendation score for each candidate drug. Based on a preset recommendation threshold, drugs with scores higher than the threshold are identified as recommended drugs, thus forming the final drug combination recommendation result.

[0076] The specific formula is as follows: ; Here, the symbol ⊕ represents the vector concatenation operation, ⊙ represents the element-wise multiplication, and σ(⋅) is the Sigmoid function, which is used to restrict the output value to between 0 and 1.

[0077] It should be noted that the characteristics of adverse drug reactions... It has already incorporated the patient's information, that is, a comprehensive representation of the patient's information. .

[0078] Then the I function uses a threshold (Typically 0.5) for the model's output Binarization is performed, and drugs with a predicted probability greater than or equal to 0.5 are recommended as effective drugs, converting the results to 0 or 1; thus, drug combination recommendations are obtained. The formula is as follows: ; This invention also includes a multi-task loss training step:

[0079] This invention uses two mainstream loss functions: multi-label prediction loss (binary cross-entropy loss). and multi-label edge loss and DDI loss function Among them, binary cross-entropy loss This makes the model's predictions closer to the true labels, while multi-label edge loss This ensures that the predicted probability of the true label is at least one boundary value higher than that of other labels among all labels. Finally, the training process employs a weighted combination method of multiple loss functions. By adjusting the hyperparameters α and β, the weights of prediction loss and drug DDI loss are coordinated, thus obtaining the overall loss function. This design effectively balances the model's predictive accuracy with DDI risk control. Specifically, it takes the following form: .

[0080] Here is an example of a graph structure and dynamic memory bank for a specific patient: Take a hospitalized patient P as an example, and assume that he has used a set of drugs {A, B, C, D} during his previous medical visits.

[0081] (1) Drug co-occurrence diagram (EHR diagram)

[0082] An EHR graph is constructed based on patient P's historical medication records. This graph uses medications as nodes, and when two medications are used simultaneously during the same visit, an edge is established between the corresponding nodes. For example, if medication A and medication B are used together during the same visit, an edge connecting A and B is established in the drug co-occurrence graph; if medication A and medication C are used together during another visit, an edge connecting A and C is established. The weights of these edges can be set according to the number of times the medications co-occur in historical visits.

[0083] (2) Drug-Drug Interaction Diagram (DDI Diagram)

[0084] A Drug Interaction Graph (DDI) is constructed based on an external drug interaction database. This graph uses drugs as nodes, and when a known adverse interaction exists between two drugs, a connection edge is established between the corresponding nodes. For example, if drug B and drug D have an adverse interaction, a B–D connection edge is established in the DDI graph to constrain the risk of such drug combinations during subsequent drug recommendation processes.

[0085] (3) Dynamic memory bank (patient medication history)

[0086] A dynamic memory is constructed for patient P to store their historical medication information. This dynamic memory includes at least the historical order of visits, the set of medications used during each visit, and the frequency of medication use. When a new medical record is generated for the patient, the medication information from the current visit is written into the dynamic memory, and the historical information is updated to reflect the dynamic changes in the patient's medication behavior.

[0087] Example of personalized medication combination recommendations based on inpatient longitudinal electronic health records:

[0088] Taking a medication recommendation scenario for inpatients in a hospital as an example, the patient's longitudinal electronic health record includes the last five inpatient visits, each containing information on the disease, surgery, and historical medications. Selecting the last five visits as the longitudinal modeling window is based on the clinical experience that the patient's recent condition has a more significant impact on current medication decisions, while also avoiding noise interference from premature historical records.

[0089] At the patient representation level, this invention maps the disease and surgical codes from each visit to 128-dimensional embedding vectors, and aggregates multiple disease and surgical vectors from the same visit to obtain the basic feature representation at the corresponding visit time. The 128-dimensional embedding dimension balances the scale of disease and surgical code categories, feature representation capability, and computational complexity, ensuring sufficient semantic information expression while maintaining model training stability. Subsequently, the features from multiple visits arranged chronologically are input into a temporal modeling network to model the patient's longitudinal visit process, obtaining a temporal feature representation reflecting the evolution trend of the patient's condition.

[0090] At the drug representation level, a drug co-occurrence graph and a drug interaction graph are constructed based on historical patient medication data. A two-layer graph neural network is then used to learn features from drug nodes to obtain drug information representations. The two-layer graph neural network effectively fuses the first-order and second-order neighborhood information of drugs; however, too many layers can lead to over-smoothing of features, so two layers are chosen as a compromise. Simultaneously, patient-drug associations are constructed by combining the patient's current state features and drug molecular substructure information, resulting in local drug information representations related to the current patient state. Both the drug information representation and the local drug information representation have a feature dimension of 128 to ensure dimensional consistency and computational feasibility during subsequent feature fusion. Furthermore, adverse reaction features corresponding to each drug are obtained from an adverse drug reaction database, and the high-dimensional sparse adverse reaction features are encoded into 128-dimensional low-dimensional vector representations using a multilayer perceptron network. This ensures consistency in feature dimension with the drug information representation and the local drug information representation, thereby supporting element-wise feature fusion.

[0091] In the feature fusion stage, the drug information representation and the local drug information representation are first multiplied element-wise to enhance the interactive expressive ability of the two types of features on the same dimension. Then, the element-wise product result is added element-wise to the adverse drug reaction feature representation on the feature dimension, and the fused features are compressed using a dimensionality reduction mapping network to form a joint feature expression that integrates multi-source drug information. The final joint feature expression is input into a prediction scoring network, which uses the Sigmoid function to output a corresponding recommendation score for each candidate drug. The Sigmoid function normalizes the prediction results to the 0–1 range, facilitating subsequent threshold-based medication decisions. Based on a preset recommendation threshold, drugs with scores higher than the threshold are identified as recommended drugs, thus forming the final drug combination recommendation result. The threshold (here we choose 0.5) is set based on the average number of medications used by historical patients to achieve a balance between the number of recommended drugs and medication safety.

[0092] Experimental section:

[0093] The training and testing data of this invention: During the model training and testing phase, this invention uses historical patient visit data from the electronic health record system as the primary training data, while combining publicly available drug interaction databases and adverse drug reaction databases as auxiliary data sources. The electronic health record data includes multiple visit records of several patients, corresponding disease information, historical medication information, and medication chronological information, used to support the training of patient longitudinal health status modeling and medication recommendation models.

[0094] In practical implementation, historical data can be divided into training and testing datasets based on the actual application scenario for model parameter learning and performance verification. The data scale is determined based on the amount of data available in the medical institution's electronic health record system, typically including longitudinal medical records of at least several hundred patients, sufficient to meet the needs of model training and application.

[0095] The comparative model of this invention is described in detail below:

[0096] Logistic Regression (LR): This method uses an L2-regularized binary linear model and enters the probability space through linear weighted feature transformation, serving as a baseline method for multi-label drug recommendation.

[0097] Ensemble Classifier Chain (ECC): Combines multiple support vector machine (SVM) classifiers to perform multi-label prediction by utilizing the dependencies between labels, thereby improving the prediction performance of related labels.

[0098] RETAIN: An RNN-based attention model that simulates the doctor's diagnostic process. It improves the interpretability and accuracy of predictions through attention and gating mechanisms on patients' historical medical data.

[0099] LEAP: Based on long short-term memory networks, it introduces an attention mechanism and combines it with external medical knowledge to improve the accuracy of medication recommendations.

[0100] GAMENet combines memory networks and graph neural networks (GCNs) to jointly learn knowledge of clinical events and drug interactions, and is used to recommend drug combinations, capturing dependencies in longitudinal medical data.

[0101] MICRON: Employs a recurrent residual learning model to enhance its ability to learn from changes in medication use and combines multiple data sources to make future medication recommendations, paying attention to the dynamic changes in patients' conditions.

[0102] COGNet proposes a replication or prediction mechanism based on patient surgical and diagnostic information, combines DDI and EHR diagrams to optimize medication recommendations, and explicitly models the correlation between medication recommendations for the same patient.

[0103] SafeDrug: Predicts safe drug combinations using drug molecular structure maps and DDI maps, and ensures patient medication safety by adjusting DDI loss through an adaptive loss controller.

[0104] Trans-GAHNet: Employs a Transformer network architecture and a multi-graph augmentation strategy to integrate longitudinal clinical and drug information from patients, enabling comprehensive representation learning of EHR and drugs, and improving recommendation performance in cold-start scenarios.

[0105] Carmen: Introduces a novel DDI coding system to improve recommendation safety, reducing the risk of drug interactions while maintaining high recommendation accuracy, thus balancing safety and accuracy.

[0106] The detailed description of the evaluation indicators is as follows:

[0107] Jaccard coefficient: Definition: A statistical method used to measure the similarity between two finite sample sets. Used to compare drug predictions from models with actual drug use.

[0108] F1 score: Definition: The F1 score is used for multi-class classification problems. It is calculated by averaging the F1 scores of each class (i.e., the harmonic mean of precision and recall). It is a simple average of the F1 scores of all classes, without considering the number of samples in each class.

[0109] Area under the precision-recall curve (PRAUC): PRAUC is a metric used to evaluate the performance of binary or multi-label classification models. The Precision-Recall curve (PR curve) plots the relationship between precision and recall at different classification thresholds. PRAUC is the area under this curve, reflecting the model's overall performance under imbalanced sample conditions (such as a significant imbalance between positive and negative samples). A higher PRAUC indicates that the model can maintain high precision and recall across various thresholds.

[0110] This example uses the MIMIC-III patient dataset to evaluate the model's performance on the task. As shown in Table 1, the model performs excellently on multiple metrics, including Jaccard coefficient, F1 score, and PRAUC. First, on the Jaccard metric, the model's accuracy is 0.5360, outperforming other comparative methods, indicating that the model can accurately predict drugs and demonstrating its strong overall performance. Furthermore, the F1 score is significantly higher than all other models, indicating a significant advantage in handling imbalanced data. Regarding the PRAUC score, the model optimizes the overall task by comprehensively considering the imbalance in the number of samples in each class. These excellent performances fully demonstrate the model's strong adaptability and generalization ability in drug recommendation tasks.

[0111] Table 1. Comparison of performance of different methods on the MIMIC-III dataset.

[0112] Example 2

[0113] Combination Figure 2 As shown, this embodiment provides a personalized drug recommendation system that integrates adverse drug reactions, including a patient representation module, a drug information integration module, an adverse drug reaction module, and a drug recommendation module; The patient representation module acquires multi-source longitudinal electronic health record (EHR) data from patients, extracts and fuses temporal features and drug similarity features, and generates a comprehensive patient information representation. ; The drug information integration module consists of two parts: a drug molecule bipartite graph module and a drug information box module. The drug molecule bipartite graph module decomposes drug molecules to construct a drug molecule bipartite graph and represents comprehensive patient information. Perform dimensional transformation to obtain local function vectors, and then convert the local function vectors into local drug information representations. Drug Information Box Module: Extracts EHR diagrams and Drug Interaction Diagrams (DDI) from multi-source EHR data, obtains drug co-occurrence and interaction information from the EHR and DDI diagrams, and models them to obtain a unified representation of drug knowledge. Simultaneously, all historical patient information from multiple follow-ups is stored in dynamic memory, representing the patient's comprehensive information. The unified representation of drug knowledge, Z, queries the historical records of dynamic memory through attention mechanisms to generate personalized drug information features; and represents the patient's comprehensive information. By integrating with personalized drug information features, a drug information representation can be generated. ; The adverse drug reaction coding module introduces external adverse drug reaction information, inputs it into the encoder for feature encoding processing, and represents it using the patient's comprehensive information. The final adverse drug reaction characteristics are obtained by weighted summation of the encoded features. ; The drug recommendation module represents drug information. Local drug information representation Adverse drug reaction characteristics The features are concatenated into a unified feature representation, and the concatenated feature representation is then used for prediction and scoring to obtain the final drug combination recommendation.

[0114] The functions and implementation of each module can be found in the method steps described in Example 1, and will not be repeated here.

[0115] Example 3

[0116] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, is used to implement the method as described in Embodiment 1 above.

[0117] Computer-readable storage media can be non-volatile computer-readable storage media. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0118] Of course, the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should be protected by the present invention.

Claims

1. A personalized drug recommendation method incorporating adverse drug reactions, characterized in that, Includes the following steps: S1. The patient stated: Acquire multi-source longitudinal electronic health record (EHR) data of patients, extract and fuse temporal features and drug similarity features to generate a comprehensive information representation of patients. ; S2. Drug Information Integration: The process includes two steps: constructing a drug molecule bipartite diagram and a drug information box. The drug molecule bipartite diagram step involves: decomposing the drug molecule to construct the drug molecule bipartite diagram and representing it with comprehensive patient information. Perform dimensional transformation to obtain local function vectors, and then convert the local function vectors into local drug information representations. ; The steps of drug information boxing include: extracting EHR diagrams and drug interaction DDI diagrams from multi-source EHR data; obtaining drug co-occurrence and interaction information from the EHR diagrams and DDI diagrams and modeling them to obtain a unified representation of drug knowledge. Simultaneously, all historical patient information from multiple follow-ups is stored in dynamic memory, representing the patient's comprehensive information. The unified representation of drug knowledge, Z, queries the historical records of dynamic memory through attention mechanisms to generate personalized drug information features; and represents the patient's comprehensive information. By integrating with personalized drug information features, a drug information representation can be generated. ; S3, Adverse Drug Reaction Code: Adverse drug reaction information from an external database is introduced, input into an encoder for feature encoding processing, and then represented using comprehensive patient information. The final adverse drug reaction characteristics are obtained by weighted summation of the encoded features. ; S4. Recommended medications: Representing drug information Local drug information representation Adverse drug reaction characteristics The features are then concatenated and predicted and scored to obtain the final drug combination recommendation.

2. The method according to claim 1, characterized in that, The longitudinal electronic health record (EHR) data includes multiple visit records arranged chronologically by visit time. Each visit record contains corresponding disease features, surgical features, and medication features. Temporal modeling is performed on the disease and surgical features to obtain representations of the patient's current visit's disease and surgical features, which are considered temporal features. Simultaneously, feature extraction and enhancement are performed on the medication similarity across the patient's longitudinal visits to obtain comprehensive medication embedding features, i.e., medication similarity features. The obtained disease and surgical feature representations, along with the comprehensive medication embedding features, are cascaded to obtain the final comprehensive information representation of the patient. .

3. The method according to claim 2, characterized in that, Constructing a comprehensive patient information representation The steps are as follows: Step 1: Perform feature encoding and embedding representation on disease features and surgical features respectively to obtain disease embedding vector and surgical embedding vector; Step 2: Use RNN and Transformer to integrate the temporal features of the disease embedding vector and the surgery embedding vector respectively to obtain the disease feature representation and surgery feature representation of the patient's current visit. The disease feature representation and surgery feature representation of the patient's current visit are temporal features. Step 3: Based on the feature set of all drugs used by the patient in each visit, construct a graph structure that reflects the drug similarity between visits, and enhance the features through a graph convolutional network (GCN) to obtain an enhanced visit representation. Then, average and aggregate the features across all visit node dimensions to obtain comprehensive drug embedding features, i.e., drug similarity features. Step 4: Concatenate the features obtained in Step 2 and Step 3 to obtain a comprehensive feature representation of the patient. .

4. The method according to claim 1, characterized in that, The specific steps involved in constructing a bipartite graph of a drug molecule include: decomposing the drug molecule and constructing a bipartite graph. Comprehensive patient information representation through fully connected neural networks Perform a dimensional transformation to obtain the local function vector. The calculation formula is: ; in, It is a linear transformation matrix, a function Comprehensive information representation of patients Perform the transformation. This represents the local function vector of the patient during disease treatment. This represents the Sigmoid function; The local function vector is obtained through a masked neural network. Converted into local drug information representation The calculation formula is: ; Where ⊙ represents element-wise multiplication, and the function... Used for local function vectors Generate local drug information representation ; The parameter matrix is ​​formed by dividing the elements of the bipartite graph. Mask.

5. The method according to claim 1, characterized in that, The specific steps involved in creating a drug information box include: S2.1: Extract EHR diagrams and drug interaction DDI diagrams from multi-source EHR data, and establish adjacency matrices for each. and adjacency matrix Add self-joins to the adjacency matrix and perform symmetric normalization, as shown in the following formula: ; ; in, It is a diagonal matrix. It is the identity matrix; This represents the drug co-occurrence feature matrix. Represents the drug co-occurrence feature matrix; S2.2: A two-layer graph convolutional network (GCN) is used to model the EHR and DDI graphs respectively, learning the embedding representations of drugs under co-occurrence and interaction relationships. The drug embedding matrices of the EHR and DDI graphs are then weighted and fused to serve as a unified representation of drug knowledge. Its form is as follows: ; in, These are drug embedding matrices from the EHR diagram and the DDI diagram, respectively; It is a trainable hidden weight parameter matrix. It is a learnable, adjustable parameter; S2.3: Arrange all historical patient information from multiple follow-ups in chronological order, with each patient as the key and the corresponding medication vector as the value, forming a key-value pair set. Stored in dynamic memory, represented as: ; in, Indicates the first One patient, Indicates the first The patient's current comprehensive characteristics Indicates the first The medication currently recommended for this patient. Indicates the current number of medical visits. ; S2.4: The first Comprehensive information of the final patient during the second visit Unified representation of drug knowledge By querying relevant historical records in dynamic memory through attention mechanisms, personalized drug information features are generated. ; ; in, Based on comprehensive patient information representation Unified representation of drug knowledge Content attention, This is a dual search result based on the time dimension. express The value corresponds to the medication vector of all historical patient information from multiple follow-ups. express The key corresponds to the current comprehensive characteristics of the patient, which are based on all historical patient information from multiple follow-ups. S2.5: Integrating personalized medication information features with comprehensive patient information representation By performing dimensional transformation and information aggregation, a drug information representation is obtained; the expression is as follows: ; in, For drug information representation, This represents the patient's comprehensive information. The transformation function on the surface performs dimensional transformation and information aggregation.

6. The method according to claim 1, characterized in that, The steps for coding adverse drug reactions in S3 include: S3.1: The pre-constructed adverse drug reaction feature matrix o is used as input, and a multilayer perceptron is used for feature encoding to transform the high-dimensional and sparse adverse drug reaction feature matrix o into a usable low-dimensional representation; the specific encoding structure includes a fully connected network and an intermediate nonlinear activation function ReLU, and the encoding process is specifically represented as follows: ; ; in and The weights of the two-layer perceptron are... This represents the process vector obtained during the encoding process, where b1 and b2 are the corresponding bias vectors, and the vectors obtained after encoding. This represents the low-dimensional ADR feature embedding for each drug; S3.2: Representing the final patient's comprehensive information Feature embedding Perform weighted summation to obtain the characteristics of adverse drug reactions. The expression is as follows: ; in, The weight matrix represents the final comprehensive information of the patient. Mapped to ADR space.

7. The method according to claim 1, characterized in that, The final drug combination recommendation specifically includes: the characteristics of adverse drug reactions. Drug information representation and The products are added together and their dimensions reduced, then scaled using a sigmoid function σ to obtain the output of the integrated drug recommendation. The specific formula is as follows: ; In this context, the symbol ⊕ represents vector concatenation, and ⊙ represents element-wise multiplication. (⋅) is the Sigmoid function, used to restrict the output value to between 0 and 1; The I function utilizes a threshold. Output of the model Binarization is performed, and drugs with a predicted probability greater than or equal to 0.5 are recommended as effective drugs, converting the results to 0 or 1; thus, drug combination recommendations are obtained. ; 。 8. A personalized drug recommendation system that integrates adverse drug reactions, characterized in that, It includes a patient presentation module, a drug information integration module, a drug adverse reaction module, and a drug recommendation module; The patient representation module acquires multi-source longitudinal electronic health record (EHR) data from patients, extracts and fuses temporal features and drug similarity features, and generates a comprehensive patient information representation. ; The drug information integration module consists of two parts: a drug molecule bipartite graph module and a drug information box module. The drug molecule bipartite graph module decomposes drug molecules to construct a drug molecule bipartite graph and represents comprehensive patient information. Perform dimensional transformation to obtain local function vectors, and then convert the local function vectors into local drug information representations. ; Drug Information Box Module: Extracts EHR diagrams and Drug Interaction Diagrams (DDI) from multi-source EHR data. Obtains drug co-occurrence and interaction information from the EHR and DDI diagrams and models them to obtain a unified representation of drug knowledge. Simultaneously, all historical patient information from multiple follow-ups is stored in dynamic memory, representing the patient's comprehensive information. Unified representation of drug knowledge By querying the historical records of dynamic memory through attention mechanisms, personalized drug information features are generated; Representing comprehensive patient information By integrating with personalized drug information features, a drug information representation can be generated. ; The adverse drug reaction coding module introduces external adverse drug reaction information, inputs it into the encoder for feature encoding processing, and represents it using the patient's comprehensive information. The final adverse drug reaction characteristics are obtained by weighted summation of the encoded features. ; The drug recommendation module represents drug information. Local drug information representation Adverse drug reaction characteristics The features are concatenated into a unified feature representation, and the concatenated feature representation is then used for prediction and scoring to obtain the final drug combination recommendation.