Knowledge graph construction method and device based on traditional Chinese medicine cases and storage medium
By constructing a knowledge graph based on traditional Chinese medicine cases, the problems of information loss and erroneous reasoning in the research of traditional Chinese medicine books were solved, the accurate transformation of traditional Chinese medicine information and the revelation of disease treatment rules were achieved, and the inheritance and development of traditional Chinese medicine was promoted.
Patent Information
- Application Number
- CN202411811516.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-15
AI Technical Summary
The existing technology has problems of information loss or distortion and erroneous reasoning when applying knowledge graph technology to the research of ancient Chinese medicine books, and it is difficult to effectively explore and apply valuable knowledge in ancient Chinese medicine books.
It provides a knowledge graph construction method based on traditional Chinese medicine medical cases. By acquiring and preprocessing medical case data, extracting entities and relationships using a large language model, importing data into the graph database, building a knowledge graph containing multiple entity types and entity relationships, and data analysis and application are carried out through visualization functions and intelligent question-and-answer system.
It realizes the accurate transformation of ancient Chinese medicine book information into a structured knowledge network, reveals the potential laws and correlations in disease treatment, provides an intuitive medical knowledge network and intelligent question-and-answer system, and promotes the inheritance and development of traditional Chinese medicine.
Smart Images

Figure CN119833154A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of traditional Chinese medicine, and in particular relates to a method, device and storage medium for constructing a knowledge graph based on traditional Chinese medicine medical records. Background Art
[0002] Ancient Chinese medical books are an important carrier of Chinese medical culture, containing rich clinical experience and medical knowledge. However, there are many problems when applying knowledge graph technology to the study of ancient Chinese medical books. On the one hand, although it aims to transform the unstructured information in ancient books into structured knowledge networks, the information may be lost or distorted during the transformation process due to technical limitations, affecting the accurate understanding and use of the content of ancient books. On the other hand, although the logical reasoning function of the knowledge graph seems to be able to reveal the potential laws and associations of disease treatment, it may produce erroneous reasoning due to algorithm or data problems in actual applications, misleading the research direction.
[0003] Xiaoke disease, or diabetes in modern medicine, is a disease that has long been recorded in traditional Chinese medicine, and doctors of all generations have accumulated rich experience in treating it. As an important school in the history of Chinese medicine, Xin'an doctors have unique insights and methods in treating Xiaoke disease, but this valuable knowledge is difficult to be properly excavated and applied under the current application of technology. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a method for constructing a knowledge graph based on TCM medical records, comprising:
[0005] Obtain available medical record data and pre-process the medical record data;
[0006] Use large language models to extract multiple entities from medical record data and define entity types and entity relationships;
[0007] Import medical record data into the graph database and build a knowledge graph containing multiple entity types and entity relationships.
[0008] Furthermore, the method comprises:
[0009] Through visualization functions, it supports retrieving disease-related fields to view information, interactive exploration and entity data analysis.
[0010] Furthermore, the method comprises:
[0011] Expand the sources of entity data, optimize natural language processing technology, and develop intelligent question-and-answer systems and clinical decision support systems.
[0012] Furthermore, the preprocessing includes:
[0013] Text normalization, data deduplication, format conversion, and preliminary annotation.
[0014] Furthermore, the entity relationship includes:
[0015] Affiliation, therapeutic, and prescription relationships.
[0016] Furthermore, the graph database includes:
[0017] Use Python's Py2neo package to import entity types and entity relationships into the Neo4j graph database.
[0018] The present invention also provides a knowledge graph construction device based on TCM medical records, comprising:
[0019] Medical record data preprocessing module: used to obtain available medical record data and preprocess the medical record data;
[0020] Entity extraction module: used to extract multiple entities from medical record data using a large language model, and define entity types and entity relationships;
[0021] Knowledge graph construction module: used to import medical record data into the graph database and build a knowledge graph containing multiple entity types and entity relationships.
[0022] Furthermore, the device comprises:
[0023] Visualization interaction and retrieval module: used to support retrieval of disease-related fields to view information, interactive exploration and entity data analysis through visualization functions.
[0024] Furthermore, the device comprises:
[0025] System expansion and development module: used to expand entity data sources, optimize natural language processing technology, and develop intelligent question-answering systems and clinical decision support systems.
[0026] The present invention also provides a computer-readable storage medium storing a computer program, characterized in that when the computer program is executed by a processor, the processor executes the steps of the method for constructing a knowledge graph based on traditional Chinese medicine medical records.
[0027] Compared with the prior art, the present invention has the following advantages:
[0028] 1. Through knowledge graph technology, the unstructured information of ancient Chinese medical books is transformed into a structured knowledge network for easy understanding and utilization.
[0029] 2. The knowledge graph has logical reasoning capabilities and can reveal the underlying laws and connections in disease treatment.
[0030] 3. Utilize the visualization function of graph database to intuitively display complex medical knowledge networks and facilitate users to conduct interactive exploration.
[0031] 4. Combine large language models and expert verification to ensure the accuracy and completeness of extracted data.
[0032] 5. Provide new tools and methods for the modernization research of traditional Chinese medicine, and promote the inheritance and development of traditional Chinese medicine.
[0033] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 A flowchart of a method for constructing a knowledge graph based on TCM medical records provided in an embodiment of the present invention is shown;
[0036] Figure 2 A schematic diagram showing a method for constructing a knowledge graph based on TCM medical records provided in an embodiment of the present invention and visualizing a knowledge graph for diabetes;
[0037] Figure 3 A schematic diagram of displaying a knowledge graph of latent heat in syndromes in a knowledge graph construction method based on TCM medical records provided in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] See also Figure 1As shown, this embodiment provides a method for constructing a knowledge graph of medical records of diabetes in Xin'an based on Neo4j and a large language model. By collecting 103 medical records from medical classics of Xin'an from Ming and Qing dynasties to modern times, using a large language model to extract entities and relationships, a knowledge graph is constructed that includes multiple entity types such as Chinese medicine names, syndromes, Chinese medicines, prescriptions, as well as subordinate relationships, treatment relationships, and prescription relationships.
[0040] S1: Obtain available medical record data and preprocess the medical record data.
[0041] The "Catalogue of Ancient Classic Prescriptions" and the "National Medical Collection" database of ancient Chinese medicine books are used as the main data sources, and some data are collected from the physical medical ancient books in the library of Anhui University of Chinese Medicine. Relevant ancient Chinese medicine books of Xin'an doctors are searched from them, and the image data of the ancient books are identified as electronic txt text using OCR (Optical Character Recognition) technology. Then retrieve the keywords such as "diabetes" and related symptoms "thirst and frequent drinking", "digestion and hunger", "polyuria" from the text file to find out the relevant medical case content that may involve diabetes. Then, the available and standard medical cases are manually screened out by a doctor of traditional Chinese medicine. The medical case data of this embodiment all come from the medical classics of Xin'an doctors from the Ming and Qing Dynasties to modern times. These classics record in detail the diagnosis and treatment methods and medical case materials about diabetes (diabetes). The following is the specific data source information of the medical records and medical books collected in this embodiment:
[0042] Table 1: Statistics of medical records of diabetes mellitus used in this example and their sources
[0043]
[0044]
[0045] The medical records in these classics involve various entity types such as disease names, symptoms, Chinese medicine names, treatment methods, causes, prescription names, etc., providing a rich data foundation for building knowledge graphs.
[0046] After data collection is completed, the raw data needs to be preprocessed. The specific steps are as follows:
[0047] Text normalization: Standardize different versions of medical records and store them in a unified format. The processing includes deleting extra spaces, unifying punctuation marks, and converting between traditional and simplified Chinese.
[0048] Data deduplication: Screen and remove duplicate medical records to ensure that each record appears only once in the data set.
[0049] Format conversion: Convert medical record data in text format into a structured format suitable for subsequent processing (such as Excel or CSV files) to facilitate subsequent entity extraction and relationship extraction.
[0050] Preliminary annotation: Based on the preliminary text processing results, regular expressions and preliminary rules are used to preliminarily annotate the data and extract possible entities and relationships.
[0051] S2: Use a large language model to extract multiple entities from medical record data and define entity types and entity relationships.
[0052] In this embodiment, a large language model is used to extract entities from 103 medical records of diabetes recorded in the medical classics of Xin'an Medical Family. Based on a wide range of pre-trained corpora in multiple fields, the large model has the ability to identify various entity names in the text, such as TCM names, TCM syndrome names, TCM names, prescription names and other key information. Specifically, in this embodiment, the large model recognition and verification by experts obtained 15 TCM names, 37 TCM syndrome names (such as diabetes, middle deficiency heat, muscle jaundice, kidney yin deficiency and liver wind, Jueyin headache and diabetes, etc.), 91 medicinal material names (such as ginseng, Ophiopogon japonicus, Atractylodes macrocephala, Phellodendron chinense, Anemarrhena asphodeloides, etc.) and 24 prescription names (such as Wen Dan Tang, Erchen Tang, Zi Shen Wan, Jin Kui Mai Men Dong Tang, Huang Qi Jian Zhong Tang, etc.). The specific format example of the entity data finally saved is shown in Table 2.
[0053] Table 2 Entity data format example table
[0054]
[0055] In order to ensure the accuracy of entity extraction, the entities initially extracted were submitted to TCM experts for review and annotation. Experts confirmed and revised the entities extracted by the model based on their professional knowledge to ensure the accuracy and completeness of the entities. The entity extraction criteria and methods refer to the "Standards and Specifications for Clinical Terminology of Traditional Chinese Medicine" and other specifications. The entity and relationship extraction results were proofread by two doctors of TCM, and a comprehensive analysis was performed to summarize their syndromes, symptoms, prescriptions, and drug compositions. Finally, the entities and relationships verified by experts were stored in a structured database and saved as Excel files for subsequent import into the Neo4j graph database. In the process of constructing the knowledge graph, this paper defined three types of entity relationships based on the content of 103 medical records of diabetes in Xin'an Medical Family: subordinate relationships, treatment relationships, and prescription relationships, as shown in Table 3.
[0056] Table 3 Entity relationship table
[0057]
[0058] S3: Import medical record data into the graph database and build a knowledge graph containing multiple entity types and entity relationships.
[0059] After completing entity extraction and relationship extraction, we use the Neo4j graph database to construct and display the knowledge graph of 103 medical records of diabetes in Xin'an Medical Books. Use Python's Py2neo package to import these entities and relationships into the Neo4j graph database. Py2neo is a Neo4j database driver for Python that provides a convenient API to operate the Neo4j database. The specific steps are as follows:
[0060] (1) Install and configure Neo4j and Py2neo to connect to the Neo4j database and use Py2neo to connect to a local or remote Neo4j database.
[0061] (2) The manually extracted, sorted and entered data such as TCM names, TCM syndrome names, medicinal material names and prescription names are then stored in CSV files. Each CSV file contains different types of entities and relationships.
[0062] Exemplarily, the names of TCM doctors are stored in the doctor.csv file, the names of TCM syndromes are stored in the syndrome.csv file, the names of medicinal materials are stored in the herb.csv file, and the names of prescriptions are stored in the prescription.csv file.
[0063] (3) Node import, the node import model is (variable: Label{key1: value1, ..., keyN: valueN}). The node label (Label) is equivalent to the table name of the relational database, and the attribute is equivalent to the column of the table in the relational database. Each node has a default internal attribute ID. When a new node is generated, the Neo4j graph database server automatically assigns it an integer ID. By default, the node ID attribute is automatically incremented and unique in the graph database.
[0064] S4: Through visualization functions, it supports retrieving disease-related fields to view information, interactive exploration, and entity data analysis.
[0065] The knowledge graph of diabetes medical records constructed in this example contains 167 entities and 691 relationships, among which the largest number of entity types are drug entities, totaling 91. Figure 2 Through the Neo4j graph database, you can directly and quickly view and understand each entity and the relationship between entities, which is convenient for readers (such as doctors, teachers of traditional Chinese medicine, students studying traditional Chinese medicine, etc.) to quickly master relevant knowledge.
[0066] In the knowledge graph, users can view relevant information by searching any disease-related field. Specific syndromes and their related nodes can be queried and displayed through Cypher statements (a declarative query language used by Neo4j graph databases).
[0067] For example, querying the syndrome "Zhongxu Fure" and its related nodes "Clinical Guide Medical Cases" and Wendan Decoction: Neo4j graph database will return a graphical result showing the relationship between the syndrome "Zhongxu Fure" and other related entities, see Figure 3 Users can clearly see the connection between "Zhongxu Fure Heat" and the "Clinical Guide to Medical Cases" and Wendan Decoction, which is of great significance for understanding and studying the treatment methods and drug use of diabetes.
[0068] In addition, the visualization function of Neo4j graph database makes complex medical knowledge more intuitive and easy to understand. Users can interactively explore through the graphical interface to further mine and analyze data. For example, doctors can quickly find the best treatment for a certain thirst disease, students can understand the application scenarios of different drugs and prescriptions through graphs, and researchers can discover potential medical laws and knowledge.
[0069] S5: Expand the source of entity data, optimize natural language processing technology, and develop intelligent question-answering systems and clinical decision support systems.
[0070] The knowledge graph constructed by this embodiment can better mine and utilize the valuable knowledge in the medical classics of Xin'an Medical School, and provide new ideas and methods for the inheritance and development of traditional Chinese medicine. The knowledge graph not only improves the visualization and operability of the data, but also lays the foundation for the development of the subsequent intelligent question-answering system and clinical decision support system.
[0071] This embodiment can be used as a basis to further cooperate with medical institutions and research institutions to establish a data sharing mechanism, use web crawlers to collect information from authoritative medical websites, and build a platform to encourage doctors and patients to upload cases and feedback to expand data sources. Advanced algorithms can also be used to increase medical corpus training data, improve related technical modules, and optimize natural language processing technology in combination with fine-tuned pre-trained models. It is also possible to build a knowledge graph for an intelligent question-and-answer system, design a user interface, use retrieval and semantic understanding technology to analyze questions, search for answers, and improve based on feedback. Integrate clinical data to establish a knowledge base, use algorithms to build models and integrate them with hospital information systems to ensure system interpretability, thereby developing a clinical decision support system.
[0072] The application embodiment of the present invention provides a knowledge graph construction device based on traditional Chinese medicine medical records, comprising:
[0073] Medical record data preprocessing module: used to obtain available medical record data and preprocess the medical record data;
[0074] Entity extraction module: used to extract multiple entities from medical record data using a large language model, and define entity types and entity relationships;
[0075] Knowledge graph construction module: used to import medical record data into the graph database and build a knowledge graph containing multiple entity types and entity relationships;
[0076] Visualization interaction and retrieval module: used to support retrieval of disease-related fields to view information, interactive exploration and entity data analysis through visualization functions;
[0077] System expansion and development module: used to expand entity data sources, optimize natural language processing technology, and develop intelligent question-and-answer systems and clinical decision support systems.
[0078] An application embodiment of the present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of a method for constructing a knowledge graph based on traditional Chinese medicine medical records.
[0079] The above description and the accompanying drawings fully illustrate the embodiments of the present invention so that those skilled in the art can practice them. Other embodiments may include structural and other changes. The embodiments represent only possible variations. Unless explicitly required, individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The embodiments of the present invention are not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for constructing a knowledge graph based on TCM medical records, characterized in that: include: Obtain available medical record data and pre-process the medical record data; Use large language models to extract multiple entities from medical record data and define entity types and entity relationships; Import medical record data into the graph database and build a knowledge graph containing multiple entity types and entity relationships.
2. The method for constructing a knowledge graph based on TCM medical records according to claim 1, characterized in that: The method comprises: Through visualization functions, it supports retrieving disease-related fields to view information, interactive exploration and entity data analysis.
3. The method for constructing a knowledge graph based on TCM medical records according to claim 2, characterized in that: The method comprises: Expand the sources of entity data, optimize natural language processing technology, and develop intelligent question-and-answer systems and clinical decision support systems.
4. The method for constructing a knowledge graph based on TCM medical records according to claim 1, characterized in that: The preprocessing comprises: Text normalization, data deduplication, format conversion, and preliminary annotation.
5. The method for constructing a knowledge graph based on TCM medical records according to claim 1, characterized in that: The entity relationship includes: Affiliation, therapeutic, and prescription relationships.
6. The method for constructing a knowledge graph based on TCM medical records according to claim 1, characterized in that: The graph database comprises: Use Python's Py2neo package to import entity types and entity relationships into the Neo4j graph database.
7. A knowledge graph construction device based on TCM medical records, characterized in that: include: Medical record data preprocessing module: used to obtain available medical record data and preprocess the medical record data; Entity extraction module: used to extract multiple entities from medical record data using a large language model, and define entity types and entity relationships; Knowledge graph construction module: used to import medical record data into the graph database and build a knowledge graph containing multiple entity types and entity relationships.
8. The knowledge graph construction device based on TCM medical records according to claim 7 is characterized in that: The device comprises: Visualization interaction and retrieval module: used to support retrieval of disease-related fields to view information, interactive exploration and entity data analysis through visualization functions.
9. The knowledge graph construction device based on TCM medical records according to claim 8 is characterized in that: The device comprises: System expansion and development module: used to expand entity data sources, optimize natural language processing technology, and develop intelligent question-answering systems and clinical decision support systems.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor executes the steps of the method for constructing a knowledge graph based on traditional Chinese medicine medical records as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Traditional Chinese medicine named entity recognition method and recognition system based on traditional Chinese medicine ancient book literatures
CN110134953A
Traditional Chinese medicine field knowledge graph question-answering method based on semantic analysis
CN117171329A
Traditional Chinese medicine knowledge graph construction method based on large language model
CN117493579A
Large language model question and answer method and device based on cervical vertebra disease knowledge graph
CN118377875A
Cited By
Method, system, and medium for association of implicit semantics and explicit terminology of traditional chinese medicine ancient books
CN120611717B