Dynamic traditional Chinese medicine prescription generation method and device based on graph attention network and medium

By constructing heterogeneous medical maps and multi-head attention networks, the static limitations and complex relationship modeling problems of traditional Chinese medicine prescription generation are solved, and the accuracy and interpretability of traditional Chinese medicine prescriptions are improved, and dynamic symptom input and real-time expansion are supported.

CN120473091APending Publication Date: 2025-08-12ANHUI UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510553568.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The existing traditional Chinese medicine prescription generation technology has the problems of limitations in static generation, insufficient modeling of complex relationships, and lack of interpretability and adaptability. It cannot dynamically respond to any symptom input, it is difficult to capture the non-temporal relationship between symptoms-diagnosis-prescriptions, and it is impossible to expand new symptoms in real time.

Method used

Using a graph attention network method, a heterogeneous medical graph is constructed, and a graph node embedding vector is generated through the Node2Vec algorithm to establish a dialectical logical chain of patient-symptom-diagnosis-symptom-prescription, and a multi-head attention mechanism is used to capture the relationship between symptoms, supporting the real-time expansion of virtual patient nodes.

Benefits of technology

It realizes synergistic optimization of prescription generation, improves the compliance and clinical applicability of traditional Chinese medicine prescriptions, supports dynamic input of any combination of symptoms, and shortens the response time to milliseconds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120473091A_ABST
    Figure CN120473091A_ABST
Patent Text Reader

Abstract

The invention discloses a traditional Chinese medicine dynamic prescription generation method and device based on a graph attention network, and a medium. The method comprises the following steps: collecting and processing multi-source heterogeneous medical data; defining a node and edge relationship, constructing a heterogeneous medical diagram, and generating a diagram node embedding vector based on a Node2Vec algorithm; a graph attention network model is modeled, and training and optimization are carried out; and deploying the trained and optimized graph attention network model for predicting a recommended prescription. Through structural data acquisition and graph attention network fusion, the defects of a traditional model in data noise processing, complex relation modeling and dynamic adaptability are overcome, and collaborative optimization of prescription generation accuracy, interpretability and real-time performance is achieved while the traditional Chinese medicine syndrome differentiation and treatment characteristics are kept, so that the method is suitable for large-scale popularization and application. The accuracy and clinical applicability of prescription generation are improved, and an innovative technical path is provided for intelligent development of traditional Chinese medicine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traditional Chinese medicine prescription generation, and in particular to a method, device and medium for generating dynamic traditional Chinese medicine prescriptions based on a graph attention network. Background Art

[0002] Current TCM prescription generation technologies mainly rely on sequence models (such as LSTM and Transformer) and generative adversarial networks (such as GAN), but they have significant drawbacks:

[0003] 1) Static generation limitations: Traditional models require preset fixed symptom labels and cannot dynamically respond to arbitrary symptom inputs; sequence models treat prescriptions as linear text and ignore the non-temporal relationship between symptoms, diagnosis, and prescriptions. 2) Insufficient modeling of complex relationships: Existing methods encode symptoms and drugs independently, making it difficult to capture synergistic or mutually exclusive relationships (such as "fever" and "fear of cold" require different combinations); although GAN can control the output category, it cannot verify compliance with traditional Chinese medicine theory (such as the "Eighteen Antidotes" taboos). 3) Lack of interpretability and adaptability: Black box models lack a generation basis (such as the contribution of symptoms to diagnosis); newly added symptoms require retraining and cannot be expanded in real time.

[0004] To address these issues, recent studies have attempted to introduce knowledge graphs (e.g., application document 202411268420.8, "A Method and Apparatus for Recommending Traditional Chinese Medicine Medication Based on Graph Algorithms") and graph neural networks (e.g., application document 202410005003.8, "A Method, System, and Apparatus for Embedding Heterogeneous Graphs"). However, these approaches still suffer from the following issues: 1) They employ homogeneous graph modeling (containing only "symptom-symptom" edges), which makes it difficult to represent the multi-level dialectical logic of patient-diagnosis-prescription; and 2) they employ static attention mechanisms, making it difficult to dynamically adapt to individualized dialectical features. This leads to the dual risks of prescription-drug mismatch (e.g., misuse of warming and drying drugs for "damp-heat syndrome") and dosage inaccuracy (e.g., neglecting dosage adjustments based on the patient's constitution) in real-world clinical scenarios.

[0005] Therefore, a solution based on graph attention network is needed. It can construct heterogeneous medical graphs through node and edge relationships, explicitly represent the logic of TCM syndrome differentiation, and replace flat label input. It also supports the introduction of virtual patient nodes, adds symptoms in real time, and expands the graph structure without retraining. It also uses the attention mechanism to quantify symptom weights and provide a basis for generation. Summary of the Invention

[0006] In response to the above-mentioned problems, the purpose of the present invention is to provide a method, device and medium for generating dynamic prescriptions of traditional Chinese medicine based on a graph attention network, which achieves accuracy and interpretability of prescription generation by integrating structured data collection with a graph attention network.

[0007] Embodiments of the present invention provide a method, device, and medium for generating dynamic prescriptions of traditional Chinese medicine based on a graph attention network.

[0008] A first aspect: A method for generating dynamic prescriptions of traditional Chinese medicine based on a graph attention network, comprising the following steps:

[0009] S1. Collect multi-source heterogeneous medical data and standardize the data;

[0010] S2. Define the node and edge relationships, calculate edge weights, construct a heterogeneous medical graph, and generate graph node embedding vectors based on the Node2Vec algorithm.

[0011] S3. Modeling a graph attention network model, training and optimizing the multi-layer graph attention network model based on graph node embedding vectors;

[0012] S4. Deploy the trained and optimized graph attention network model to predict recommended prescriptions.

[0013] Optionally, the multi-source heterogeneous medical data in S1 includes: patient information, symptom descriptions, diagnosis results, syndrome classifications and prescribed drugs.

[0014] Optionally, the standardization process in S1 includes:

[0015] Multi-source heterogeneous medical data is mapped to the TCM diagnostic standard codes, missing fields are filled through correlation analysis, outliers are eliminated through expert rule library verification, and the processed data is stored in an Excel table with fields divided into patient information, symptom description, diagnosis results, syndrome classification and prescribed drugs.

[0016] Optionally, the node and edge relationships defined in S2 include:

[0017] Define nodes: patient, symptom, diagnosis, syndrome and prescription;

[0018] Define edge relationships: having symptoms, leading to diagnosis, corresponding syndrome type, using prescription, symptoms associated with syndrome type and diagnosis associated with prescription.

[0019] Optionally, in S2, generating a heterogeneous medical graph into a graph node embedding vector based on the Node2Vec algorithm includes:

[0020] Based on the Node2Vec algorithm, high-dimensional, sparse heterogeneous medical graphs are converted into low-dimensional, dense graph node embedding vector representations, which retains the structural information of the heterogeneous medical graphs while significantly reducing the data dimension.

[0021] Optionally, the graph attention network model includes a dual attention layer, wherein:

[0022] The primary attention layer is used for symptom feature extraction, calculating the correlation weights between symptom nodes, focusing on capturing the synergistic effects of co-occurring symptoms, and outputting symptom enhancement representation vectors;

[0023] The advanced attention layer is used for syndrome-prescription association, establishes a mapping relationship from syndrome to prescription, learns the prescription relevance of syndrome characteristics, and outputs the prescription prediction probability distribution.

[0024] Optionally, the multi-layer graph attention network model training and optimization uses a cross entropy loss function and an Adam optimizer, and the steps include:

[0025] S31, forward propagation calculation node representation;

[0026] S32, cross entropy loss function calculates loss;

[0027] S33, back propagation derivative to update Adam optimizer parameters;

[0028] S34. Each epoch is executed in a loop until the set conditions are met.

[0029] Optionally, the predicted recommended prescription in S4 includes:

[0030] S41. Construct a subgraph containing symptom nodes according to a given symptom description;

[0031] S42, converting the subgraph into a subgraph node embedding vector;

[0032] S43, performing model prediction based on the subgraph node embedding vector; outputting the prediction prescription corresponding to each subgraph node;

[0033] S44. Based on the predicted prescription corresponding to the subgraph node, one prescription is selected as the final predicted recommended prescription.

[0034] A second aspect: An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method provided in the first aspect when executing the program.

[0035] A third aspect: A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the first aspect.

[0036] Beneficial effects of the present invention:

[0037] 1. This invention solves the shortcomings of traditional models in data noise processing, complex relationship modeling and dynamic adaptability by integrating structured data collection with graph attention network. While maintaining the characteristics of TCM syndrome differentiation and treatment, it realizes the coordinated optimization of prescription generation accuracy, interpretability and real-time performance, improves the accuracy and clinical applicability of prescription generation, and provides an innovative technical path for the intelligent development of TCM. It can be widely used in TCM intelligent diagnosis and treatment and personalized recommendation scenarios.

[0038] 2. The heterogeneous medical graph of the present invention explicitly constructs a dialectical logic chain of "patient-symptom-diagnosis-syndrome-prescription", which improves the accuracy of syndrome classification compared with traditional sequence models. Based on the multi-head attention mechanism, it automatically captures the synergistic or mutually exclusive relationships between symptoms (such as the association between "aversion to cold and fever" and "ephedra and cinnamon twigs"), effectively circumvents the taboos of the "Eighteen Antidotes" of Traditional Chinese Medicine, improves the prescription compliance rate, and has the advantage of modeling complex medical relationships.

[0039] 3. The present invention visualizes the contribution of symptoms through attention weights. The prescription generation process complies with the theoretical framework of "principle, method, prescription, and medicine" in traditional Chinese medicine, providing a diagnostic basis chain (symptoms → syndrome type → treatment principle → prescription), which improves the acceptance of clinicians and has a high explainable decision support capability.

[0040] 4. By introducing virtual patient node technology, this invention supports real-time clinical input of arbitrary symptom combinations and dynamically expands the graph structure, breaking through the traditional model's reliance on fixed symptom labels. New symptom input eliminates the need for model retraining, shortening response time to milliseconds, and significantly improving the clinical adaptability of the TCM diagnosis and treatment system. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 Schematic diagram of the process of the method for generating dynamic prescriptions of traditional Chinese medicine based on graph attention network of the present invention;

[0042] Figure 2 Schematic diagram of the structure of the dynamic prescription generation device for traditional Chinese medicine based on graph attention network of the present invention;

[0043] Figure 3 This is a flow chart of the principle of the method for generating dynamic prescriptions of traditional Chinese medicine based on graph attention network of the present invention;

[0044] Figure 4 Schematic diagram of the structure of the electronic device of the present invention. DETAILED DESCRIPTION

[0045] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar symbols throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and are not to be construed as limiting the present invention.

[0046] Current TCM prescription generation technology requires preset fixed symptom labels and cannot dynamically respond to arbitrary symptom input; the model treats prescriptions as linear text, ignoring the non-temporal relationship between symptoms, diagnosis, and prescriptions; symptoms and drugs are encoded independently, making it difficult to capture synergistic or mutually exclusive relationships; new symptoms require retraining, and it cannot be expanded in real time.

[0047] In response to the above problems, the present invention provides a method for generating dynamic prescriptions of traditional Chinese medicine based on graph attention network. Figure 1 A schematic diagram of a flow chart of a method for generating dynamic prescriptions for traditional Chinese medicine based on a graph attention network according to an embodiment of the present invention, the method comprising:

[0048] S1. Collect multi-source heterogeneous medical data and standardize the data.

[0049] Collect multi-source heterogeneous data from electronic medical records and clinical databases. Multi-source heterogeneous medical data includes: patient information, symptom descriptions, diagnosis results, syndrome classification and prescription drugs, etc.

[0050] Standardize the data: map all types of data to the standard codes of "Traditional Chinese Medicine Diagnosis", fill in missing fields through correlation analysis, and eliminate outliers through verification by the expert rule library; store the processed data in Excel and extract fields from it: patient information (patient ID), symptom description list (28-dimensional symptom field), diagnosis results, syndrome classification and prescription drugs, etc.

[0051] S2. Define the node and edge relationships, calculate the edge weights, construct a heterogeneous medical graph, and generate the heterogeneous medical graph into graph node embedding vectors based on the Node2Vec algorithm.

[0052] Five types of nodes are defined: patients, symptoms, diagnoses, syndromes and prescriptions. The defined nodes correspond to the collection of multi-source heterogeneous medical data.

[0053] Six types of edge relationships are defined: "having symptoms", "leading to diagnosis", "corresponding to syndrome", "using prescription", "symptom-related syndrome" and "diagnosis-related prescription". By defining edge relationships, the nodes are interconnected.

[0054] Nodes and edge relationships together constitute a heterogeneous medical graph, which is then generated into graph node embedding vectors based on the Node2Vec algorithm.

[0055] Node2Vec is a popular graph embedding algorithm. Processing and embedding node information is a common and important task. Based on deep learning techniques, it aims to generate high-dimensional and low-dimensional vector representations for nodes in the graph. These vector representations can be used in a variety of downstream tasks such as node classification, link prediction, and partition detection.

[0056] The core idea of the Node2Vec algorithm is to generate an embedded representation of a node by simulating the depth-first search (DFS) or breadth-first search (BFS) process of the node. The Node2Vec algorithm can more effectively capture the complex relationships between nodes by introducing information about second-order neighbors (i.e., the neighbors of the neighbors of the current node).

[0057] The Node2Vec algorithm process includes: first, initializing a probability distribution for each node in the graph; then, random walk: starting from each node, a random walk is performed. During the walk, the node transfers according to the distribution probability of its neighboring nodes; then, the return probability controls the probability of the walk returning to the original node. A higher return probability is conducive to capturing local structure; then, the depth probability controls the probability that the walk tends to explore the neighbors of the neighbors of the current node (i.e., second-order neighbors). A higher depth probability is conducive to capturing more distant node relationships; finally, embedding is generated: the embedding vector of each node is trained using the sequence generated by the random walk mentioned above. For example, the walk sequence can be regarded as a sentence, each node as a word, and then the Skip-gram model or other language model can be applied to learn the node embedding.

[0058] Node2Vec is an effective graph embedding algorithm that captures rich information of nodes in the graph by simulating random walks of nodes and is suitable for heterogeneous medical graph data.

[0059] Raw Traditional Chinese Medicine (TCM) diagnosis and treatment data contains complex networks of symptom-syndrome-prescription relationships. Directly processing this unstructured graph data is inefficient. Mapping the nodes in the graph (patients, symptoms, prescriptions, etc.) to a low-dimensional vector space significantly reduces the data dimension while preserving the graph structure, making subsequent graph attention network model processing more efficient.

[0060] S3. Modeling a graph attention network model, training and optimizing the multi-layer graph attention network model based on graph node embedding vectors.

[0061] This paper adopts a hierarchical graph attention network architecture, the core of which includes an attention propagation layer. The attention propagation layer uses a two-layer graph attention network to realize information transmission. Specifically:

[0062] The primary attention layer (symptom feature extraction) takes the original graph structure as input. Its attention mechanism is used to calculate the correlation weights between symptom nodes, focusing on capturing the synergistic effects of co-occurring symptoms and outputting symptom enhancement representation vectors.

[0063] The advanced attention layer (syndrome-prescription association) takes as input the output of the primary attention layer. Its attention mechanism is used to establish a mapping relationship from syndrome to prescription, learn the prescription relevance of syndrome features, and output the prescription prediction probability distribution.

[0064] S4. Deploy the trained and optimized graph attention network model to predict recommended prescriptions.

[0065] After the double-layer graph attention information is transmitted through the attention propagation layer, the graph attention network model generates prescription recommendations based on the prediction output layer.

[0066] Furthermore, the cross entropy loss function and Adam optimizer are used for training and optimization of the multi-layer graph attention network model.

[0067] This paper uses the cross-entropy loss function as the optimization objective to achieve accurate recommendations by minimizing the difference between the predicted prescription and the true label. The Adam optimizer (with an initial learning rate of α = 0.01) is used for parameter updates. This optimizer effectively accelerates model convergence through adaptive learning rate and momentum mechanism.

[0068] The key steps in the training process include: forward propagation to calculate node representation, cross entropy loss calculation, backpropagation derivation, and Adam optimizer parameter update, which are executed in each epoch cycle.

[0069] To prevent overfitting, regularization strategies such as dropout (p=0.5) and early stopping were employed. After training, the model's loss function converged steadily, and the attention weights clearly demonstrated the TCM syndrome differentiation model of symptoms, syndrome types, and prescriptions, achieving accurate prescription predictions while maintaining theoretical rationality.

[0070] Furthermore, virtual patient node technology is introduced to support real-time clinical input of any symptom combination and dynamic expansion of heterogeneous medical graph structures, breaking through the traditional model's reliance on a fixed set of symptom labels.

[0071] Furthermore, a subgraph model is constructed to predict prescriptions. Based on the given symptoms, a subgraph containing these symptom nodes is constructed. First, the data format is converted (for example, PyTorch Geometric format) to convert the subgraph into a data object in the same format as used during training. Then, the model performs a forward propagation on this subgraph, outputting the predicted prescription for each node. Finally, filtering and sorting are performed, and the predicted category of each node is obtained using torch.max. One prescription is selected as the final prediction.

[0072] like Figure 2 As shown, the application example of the method of the present invention is:

[0073] First, data collection and cleaning were performed, and fields were extracted from structured Excel medical record data: patient ID, symptom list (28-dimensional symptom field), diagnosis results, TCM syndrome type, and prescribed drugs; records with empty prescriptions fields were removed; symptoms were standardized, and non-standard descriptions (such as "white tongue coating") were mapped to unified terms (such as "pale tongue").

[0074] Then, a heterogeneous graph is constructed and nodes are defined, for example: patient node, attributes include patient_id (such as P001); symptom node: extracted from the cleaned symptom list, type marked as "symptom"; prescription node: drug combination (such as "Codonopsis pilosula, Atractylodes macrocephala"), type marked as "treatment plan", etc.

[0075] Define edge relationships: for example, patient → symptom: the edge relationship is "having symptoms"; symptom → diagnosis: the edge relationship is "leading to"; diagnosis → prescription: the edge relationship is "adopting", etc.

[0076] Then, node embedding and graph attention network modeling are performed; first, embedding is generated based on the Node2Vec algorithm, and the parameter settings include walk length walk_length = 30, number of walks num_walks = 200, window size window = 10, generating a 64-dimensional embedding vector; embedding is applied to all nodes as the input features of the graph attention network model.

[0077] The graph attention network model adopts the GAT model structure, and the network structure includes: the first layer GATConv (primary attention layer): input dimension 64, output dimension 64, multi-head attention (4 heads); the second layer GATConv (advanced attention layer): input dimension 64, output dimension 64; fully connected classifier: the output dimension is equal to the number of prescription categories.

[0078] During the model training and dynamic prescription generation process, the training strategy uses the cross entropy loss function, which is calculated only for patient nodes. Adam optimizer learning rate lr = 0.01, weight decay weight_decay = 1e-4; Dropout regularization layer probability p = 0.5; after training and optimization, the graph attention network model (GAT) is deployed.

[0079] Finally, dynamic prescription generation and patient symptom injection are performed: a temporary node VIRTUAL_PATIENT is added and connected to the input symptoms; prescription prediction is performed by outputting the probability distribution through the trained model and decoding it into the top-1 prescription.

[0080] The present invention also provides a dynamic prescription generation device for traditional Chinese medicine based on graph attention network, such as Figure 3 As shown, the device includes:

[0081] The acquisition module is used to collect users' multi-source heterogeneous medical data and standardize the data;

[0082] The construction module defines node and edge relationships based on the processed multi-source heterogeneous medical data, calculates edge weights, and constructs a heterogeneous medical graph;

[0083] The algorithm module deploys the Node2Vec algorithm unit, which generates heterogeneous medical graphs into graph node embedding vectors based on the Node2Vec algorithm;

[0084] The processing module deploys a trained and optimized attention network model to predict and recommend prescriptions based on the input user symptoms.

[0085] The dynamic prescription generation device for traditional Chinese medicine of the present invention collects multi-source heterogeneous medical data through an acquisition module, constructs a high-quality training set through standardized term mapping, missing value filling and correlation verification; uses a construction module to construct a heterogeneous medical graph of patient-symptom-diagnosis-syndrome type-prescription; uses an algorithm module to generate node embedding based on the Node2Vec algorithm; designs a multi-layer graph attention network model in the processing module, dynamically allocates symptom weights through a multi-head attention mechanism, and captures key syndrome differentiation features; uses a cross-entropy loss function and an adaptive optimization strategy to train the model, combined with Dropout to prevent overfitting; after the model is trained, symptom combinations are input and personalized prescriptions are predicted.

[0086] This invention solves the shortcomings of traditional models in data noise processing, complex relationship modeling and dynamic adaptability through the integration of structured data collection and graph attention network, improves the accuracy and clinical applicability of prescription generation, and can be widely used in intelligent diagnosis and treatment of traditional Chinese medicine and personalized recommendation scenarios.

[0087] The present invention also provides an electronic device, Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Figure 4 As shown, the electronic device may include: a processor, a communications interface, a memory, and a communication bus, wherein the processor, the communications interface, and the memory communicate with each other via the communication bus. The processor may call logic instructions in the memory, for example, to execute the following method:

[0088] S1. Collect multi-source heterogeneous medical data and standardize the data;

[0089] S2. Define the node and edge relationships, calculate edge weights, construct a heterogeneous medical graph, and generate graph node embedding vectors based on the Node2Vec algorithm.

[0090] S3. Modeling a graph attention network model, training and optimizing the multi-layer graph attention network model based on graph node embedding vectors;

[0091] S4. Deploy the trained and optimized graph attention network model to predict recommended prescriptions.

[0092] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.

[0093] An embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method provided in each of the above embodiments is implemented, for example, including:

[0094] S1. Collect multi-source heterogeneous medical data and standardize the data;

[0095] S2. Define the node and edge relationships, calculate edge weights, construct a heterogeneous medical graph, and generate graph node embedding vectors based on the Node2Vec algorithm.

[0096] S3. Modeling a graph attention network model, training and optimizing the multi-layer graph attention network model based on graph node embedding vectors;

[0097] S4. Deploy the trained and optimized graph attention network model to predict recommended prescriptions.

[0098] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0099] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for generating dynamic prescriptions of traditional Chinese medicine based on graph attention network, characterized in that: include: S1. Collect multi-source heterogeneous medical data and standardize the data; S2. Define the node and edge relationships, calculate edge weights, construct a heterogeneous medical graph, and generate graph node embedding vectors based on the Node2Vec algorithm. S3. Modeling a graph attention network model, training and optimizing the multi-layer graph attention network model based on graph node embedding vectors; S4. Deploy the trained and optimized graph attention network model to predict recommended prescriptions.

2. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, wherein: The multi-source heterogeneous medical data in S1 includes: patient information, symptom descriptions, diagnosis results, syndrome classifications and prescribed drugs.

3. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, wherein: The standardization process in S1 includes: Multi-source heterogeneous medical data is mapped to the TCM diagnostic standard codes, missing fields are filled through correlation analysis, outliers are eliminated through expert rule library verification, and the processed data is stored in an Excel table with fields divided into patient information, symptom description, diagnosis results, syndrome classification and prescribed drugs.

4. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, wherein: The node and edge relationships are defined in S2, including: Define nodes: patient, symptom, diagnosis, syndrome and prescription; Define edge relationships: having symptoms, leading to diagnosis, corresponding syndrome type, using prescription, symptoms associated with syndrome type and diagnosis associated with prescription.

5. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, wherein: In S2, the heterogeneous medical graph is generated into graph node embedding vectors based on the Node2Vec algorithm, including: Based on the Node2Vec algorithm, high-dimensional, sparse heterogeneous medical graphs are converted into low-dimensional, dense graph node embedding vector representations, which retains the structural information of the heterogeneous medical graphs while significantly reducing the data dimension.

6. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, characterized in that: The graph attention network model includes a dual attention layer, where: The primary attention layer is used for symptom feature extraction, calculating the correlation weights between symptom nodes, focusing on capturing the synergistic effects of co-occurring symptoms, and outputting symptom enhancement representation vectors; The advanced attention layer is used for syndrome-prescription association, establishes a mapping relationship from syndrome to prescription, learns the prescription relevance of syndrome characteristics, and outputs the prescription prediction probability distribution.

7. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, wherein: The multi-layer graph attention network model training and optimization uses the cross entropy loss function and Adam optimizer, and the steps include: S31, forward propagation calculation node representation; S32, cross entropy loss function calculates loss; S33, back propagation derivative to update Adam optimizer parameters; S34. Each epoch is executed in a loop until the set conditions are met.

8. The method for generating a dynamic prescription of traditional Chinese medicine according to claim 1, wherein: The predicted recommended prescription in S4 includes: S41. Construct a subgraph containing symptom nodes according to a given symptom description; S42, converting the subgraph into a subgraph node embedding vector; S43, performing model prediction based on the subgraph node embedding vector; outputting the prediction prescription corresponding to each subgraph node; S44. Based on the predicted prescription corresponding to the subgraph node, one prescription is selected as the final predicted recommended prescription.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for generating a dynamic prescription of traditional Chinese medicine according to any one of claims 1 to 8 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for generating a dynamic prescription of traditional Chinese medicine as claimed in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Heterogeneous graph embedding method, system and device

    CN117891975A

  • Traditional Chinese medicine medication recommendation method and device based on graph algorithm

    CN118800408A