Clinical path-based diagnosis and treatment knowledge graph construction method and system
By constructing a diagnosis and treatment knowledge graph in the field of medicine, using Bert model and multi-layer decoder training, combined with professional physician review, the problem of poor accuracy of diagnosis and treatment knowledge graph in the existing technology is solved, and high-quality clinical path-assisted diagnosis and treatment decision support is achieved.
Patent Information
- Application Number
- CN202510350377.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-29
AI Technical Summary
When the existing general knowledge graph construction method is applied in the medical field, there is a problem that the ontology concept is greatly affected by the data source and has poor accuracy, which leads to clinical decision-making errors and lacks effective diagnostic and treatment knowledge graph construction methods based on clinical pathway normative.
By determining the ontology concept of the diagnosis and treatment knowledge graph, establishing the ontology concept tree, using the Bert model for pre-training and multi-layer decoder training, extracting entity relationships, building a diagnosis and treatment knowledge graph, and conducting knowledge completion and entity disambiguation, combining the guidance and review of professional physicians, a high-quality diagnosis and treatment knowledge graph is built.
It improves the accuracy of information extraction in the medical field and the reliability of clinical decision-making, provides high-quality evidence-based medical evidence for clinical research, and assists physicians in formulating correct diagnosis and treatment plans.
Smart Images

Figure CN120388712A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of digital medicine, and specifically relates to a method and system for constructing a diagnosis and treatment knowledge graph based on a clinical pathway. Background Art
[0002] A knowledge graph is essentially a structured and networked knowledge system constructed with a "semantic network" as its backbone, and its purpose is to describe the concepts, entities and the relationships between them existing in the objective world. Among them, the definition of a concept in a knowledge graph is a conceptual representation of objective things formed by humans in the process of understanding the world, such as drugs, machines, doctors, etc. The definition of an entity in a knowledge graph is a specific thing existing in the objective world, such as Wu Mengchao, the father of hepatobiliary surgery in China, and sodium valproate sustained-release tablets, etc. The definition of a relationship in a knowledge graph is used to describe the objective associations existing between concepts and entities, such as the relationship between hepatobiliary surgeons and doctors is the relationship between a sub-concept and a concept, etc.
[0003] Currently, the general method for constructing a knowledge graph generally consists of four steps: data acquisition, information extraction, knowledge fusion, and knowledge processing. First, in the data acquisition stage, the raw data is cleaned through a series of automated or semi-automated means according to the characteristics of the raw data. Secondly, information extraction technology is used to extract information such as entities, relationships, and entity attributes from the raw data and store them in a database. Then, the data is logically classified and redundant / error-filtered through knowledge fusion technology. Finally, the knowledge is processed through ontology extraction and quality assessment to obtain a structured and networked knowledge system.
[0004] Different from the general knowledge graph, the diagnosis and treatment knowledge graph is a specialized knowledge graph in a vertical domain. Due to the strong professionalism and extremely high accuracy requirements of medical domain knowledge, if the above general knowledge graph construction method is used to create a diagnosis and treatment knowledge graph, there are problems such as the ontology concept being greatly affected by the data source and poor accuracy, which will cause large errors in clinical decision-making and even lead to wrong decisions. Therefore, how to construct a knowledge graph and its system that can be directly used for clinical decision support, how to represent medical knowledge with multiple relationships, and how to accurately process and review medical knowledge data are important problems to be solved by the present invention.
[0005] As a precise data source, the clinical pathway document is compiled and released after strict review, so the data quality is high, which can better avoid the negative impact of poor data source quality on the diagnosis and treatment knowledge graph. With the continuous update and iteration of clinical pathway normative documents, automatically generating a diagnosis and treatment knowledge graph according to clinical pathway normative documents can play an important role in assisting physicians to complete clinical diagnosis and treatment and improving medical safety and treatment efficiency. However, there is currently a lack of a relatively effective method for constructing a diagnosis and treatment knowledge graph based on clinical pathway norms. Summary of the Invention
[0006] In view of the above problems, in the first aspect of the present invention, a method for constructing a diagnosis and treatment knowledge graph based on a clinical pathway is provided, characterized in that the method includes:
[0007] Determine the ontology concepts of the diagnosis and treatment knowledge graph and establish an ontology concept tree, extract the ontology according to the ontology concept tree, and label the relationships of the extracted entities to obtain training samples.
[0008] Pre-train the encoder of the Bert model using diagnosis and treatment texts, and then train the Bert model with multiple layers of decoders using the training samples, where each layer of the decoders in the Bert model with multiple layers of encoders outputs a hierarchical label, and the entity relationships are obtained based on the hierarchical labels.
[0009] Input the medical text from which entity relationships are to be extracted into the trained Bert model to obtain triples, construct a diagnosis and treatment knowledge graph of the diagnosis and treatment clinical pathway using the triples, and perform knowledge completion and entity disambiguation on the triples.
[0010] Preferably, the pre-training of the encoder of the Bert model using diagnosis and treatment texts is specifically:
[0011] Randomly select a preset proportion of vocabulary related to entity relationships in the input diagnosis and treatment texts for masking.
[0012] Use the MLM task branch to predict the masked content, and determine the final entity relationship triples from multiple predicted masked contents according to the NSP task branch; the inputs of the MLM task branch and the NSP task branch are both the outputs of the Bert model encoder.
[0013] Preferably, the Bert model with multiple layers of decoders is specifically:
[0014] The Bert model includes an encoder and a decoder, and the encoder and decoder include multiple Transformer decoder layers and Transformer decoder layers.
[0015] After each Transformer encoder layer completes the encoding operation, the extracted features are passed to the next Transformer encoder layer.
[0016] Each Transformer decoder layer receives the output of the corresponding Transformer encoder layer, and the output of each Transformer decoder layer is processed by a feed-forward neural network layer to output the hierarchical label corresponding to the Transformer decoder layer.
[0017] Fuse the hierarchical labels output by all Transformer encoder layers to obtain entity relationships.
[0018] Preferably, the fusing the hierarchical labels output by all Transformer encoder layers to obtain entity relationships is specifically as follows:
[0019] According to the corresponding relationship between the Transformer decoder layer and the Transformer encoder layer, assign weights to the Transformer decoder layer.
[0020] Multiply the output of the Transformer decoder layer by the weight, accumulate the results of multiplying the outputs of all Transformer decoder layers by the weight to obtain comprehensive information, and use the comprehensive information to obtain entity relationships.
[0021] Preferably, the knowledge completion and entity disambiguation of the triple are specifically as follows:
[0022] Use the MLM task branch to dynamically complete the knowledge graph, and use the NSP task branch to statically complete the knowledge graph.
[0023] Use Bert+CNN to output a confidence score for each candidate abbreviation expansion, take the expansion entity with the highest score as the candidate entity, use the random walk method to map the graph data into a multi-dimensional entity space, and use the Multi-Sense LSTM model to implement entity linking.
[0024] In the second aspect of the present invention, there is provided a diagnosis and treatment knowledge graph construction system based on a clinical pathway, characterized in that the system includes:
[0025] A training sample acquisition module, configured to determine the ontology concepts of the diagnosis and treatment knowledge graph and establish an ontology concept tree, extract the ontology according to the ontology concept tree, and label the relationships of the extracted entities to obtain training samples.
[0026] A training module, configured to pre-train the encoder of the Bert model using diagnosis and treatment texts, and then train the Bert model with multiple decoders using the training samples, wherein each decoder in the Bert model with multiple encoders outputs a hierarchical label, and entity relationships are obtained based on the hierarchical labels.
[0027] A knowledge graph construction module, configured to input medical texts whose entity relationships are to be extracted into the trained Bert model to obtain triples, construct a diagnosis and treatment knowledge graph of the diagnosis and treatment clinical pathway using the triples, and perform knowledge completion and entity disambiguation on the triples.
[0028] Preferably, the pre-training of the encoder of the Bert model using the diagnosis and treatment text is specifically as follows:
[0029] In the input diagnosis and treatment text, randomly select a preset proportion of words related to entity relationships for masking.
[0030] Use the MLM task branch to predict the masked content, and determine the final entity relationship triple from multiple predicted masked contents according to the NSP task branch; the inputs of both the MLM task branch and the NSP task branch are the outputs of the Bert model encoder.
[0031] Preferably, the Bert model with multiple layers of decoders is specifically as follows:
[0032] The Bert model includes an encoder and a decoder, and both the encoder and the decoder include multiple Transformer decoder layers and Transformer encoder layers.
[0033] After each Transformer encoder layer completes the encoding operation, the extracted features are passed to the next Transformer encoder layer.
[0034] Each Transformer decoder layer receives the output of the corresponding Transformer encoder layer, and the output of each Transformer decoder layer is processed by a feed-forward neural network layer to output the hierarchical label corresponding to the Transformer decoder layer.
[0035] Fuse the hierarchical labels output by all Transformer encoder layers to obtain the entity relationship.
[0036] Preferably, the fusing the hierarchical labels output by all Transformer encoder layers to obtain the entity relationship is specifically as follows:
[0037] Assign weights to the Transformer decoder layers according to the corresponding relationship between the Transformer decoder layers and the Transformer encoder layers.
[0038] Multiply the output of the Transformer decoder layer by the weight, accumulate the results of multiplying the outputs of all Transformer decoder layers by the weights to obtain the comprehensive information, and use the comprehensive information to obtain the entity relationship.
[0039] Preferably, the knowledge completion and entity disambiguation of the triple are specifically as follows:
[0040] Use the MLM task branch to dynamically complete the knowledge graph, and use the NSP task branch to statically complete the knowledge graph.
[0041] Using Bert+CNN to output a confidence score for each candidate abbreviation expansion, taking the expansion entity with the highest score as the candidate entity, mapping the graph data into a multi-dimensional entity space using the random walk method, and implementing entity linking using the Multi-Sense LSTM model.
[0042] The present invention trains a domain pre-trained language model through a large amount of unlabeled medical field-related corpus, improving the information extraction effect in the medical field; extracting high-quality triples directly from clinical pathway files through an improved method; in addition, the proposed Bert-based knowledge completion model completes clinical knowledge completion and can evaluate the quality of triples; through the data processing and manual review system, the accuracy of clinical medical knowledge representation is improved. This system can effectively provide evidence-based medical evidence for clinical research and provide suggestions for assisting physicians in formulating correct diagnosis and treatment plans. Brief Description of the Drawings
[0043] Figure 1 It is the logical framework diagram of the present invention;
[0044] Figure 2 It is the flowchart of the first embodiment;
[0045] Figure 3 It is the schematic diagram of the ontology concept tree;
[0046] Figure 4 It is the Bert model connecting the MLM task branch and the NSP task branch;
[0047] Figure 5 It is the schematic diagram of the corresponding relationship between the encoder layer and the decoder layer. Detailed Embodiments
[0048] In the embodiments of the present invention, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or more advantageous than other embodiments or design solutions. Rather, using words such as "exemplary" or "for example" is intended to present relevant concepts in a specific way for easy understanding.
[0049] It will be understood that the "embodiments" mentioned throughout the specification mean that specific features, structures, or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, the various embodiments mentioned throughout the specification do not necessarily refer to the same embodiments. In addition, these specific features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. It will be understood that in the various embodiments of the present application, the magnitude of the sequence number of each process does not mean the order of execution, and the order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0050] In the present invention, unless otherwise specified, the same or similar parts between various embodiments may be referred to each other. In the various embodiments of the present invention, as well as in each implementation manner / implementation method / realization method in each embodiment, if there is no special specification and logical conflict, the terms and / or descriptions between different embodiments, as well as between each implementation manner / implementation method / realization method in each embodiment, are consistent and can be referred to each other, and the technical features in different embodiments, as well as in each implementation manner / implementation method / realization method in each embodiment, can be combined to form new embodiments, implementation manners, implementation methods, or realization methods according to their internal logical relationships. The implementation manners of the present application described below do not constitute a limitation to the protection scope of the present application.
[0051] Figure 1 A logical framework diagram of the present invention is shown, as Figure 1 shown, first, data cleaning and domain text pre-training are performed to obtain a domain language model; then, the ontology concepts of the knowledge graph are determined by experts, and based on this, the training data is labeled; then, entity relationship extraction is performed using the pre-trained model and the labeled data to obtain preliminary triples; subsequently, knowledge completion and entity disambiguation are performed to improve and correct the knowledge; finally, the constructed diagnosis and treatment knowledge graph is evaluated by domain experts, and finally a usable diagnosis and treatment knowledge graph is produced.
[0052] Embodiment 1, as Figure 2 shown, provides a method for constructing a diagnosis and treatment knowledge graph based on a clinical pathway, characterized in that the method includes:
[0053] S101, determining the ontology concepts of the diagnosis and treatment knowledge graph and establishing an ontology concept tree, extracting the ontology according to the ontology concept tree, and labeling the relationships of the extracted entities to obtain training samples.
[0054] Professional physicians, knowledge experts, etc. in the field of clinical medicine have an in-depth understanding of diagnosis and treatment processes, disease classifications, medical terms, etc. Professional physicians, knowledge experts, etc. analyze clinical pathway normative documents, identify the core medical concepts therein, such as disease names, symptoms and signs, diagnostic methods, treatment means, drug names, etc., and can also refer to other relevant medical knowledge sources, such as medical textbooks, guidelines and consensus, medical term standards, etc. During the process of analyzing the documents, not only the core concept entities need to be identified, but also the possible relationships between these concepts need to be identified. For example, a disease hasSymptom a symptom. Based on the identified concepts and the relationships between them, a hierarchical tree structure is constructed. For each concept in the ontology concept tree, a rule-based extraction pattern is defined, or extraction is carried out using methods such as dictionaries and knowledge bases. For example, for the disease concept, medical terms appearing in the clinical pathway document can be searched and matched against the medical term library; for the drug concept, drug names can be searched and the drug database can be referred to; for the symptom concept, words describing the patient's chief complaint or the signs observed by the doctor can be searched. Based on the relationship types defined in the ontology concept tree and the actual associations between entities in the clinical pathway document, the relationship types to be labeled are determined. For each clinical pathway document and the entity pairs identified therein, it is manually judged whether there is a predefined relationship between these entities. The annotator determines which or which relationships exist between the entity pairs according to clinical knowledge and the text context, and labels the type of the relationship. For example, in the sentence "The patient uses metformin to treat diabetes", "metformin" and "diabetes" are the identified entities, and the annotator needs to label that there is a "treatment" relationship between them. Each labeled relationship constitutes a training sample. To ensure the quality of the labeled data, professional physicians verify the labeled entity relationships to confirm the accuracy and reasonableness of the labels.
[0055] The construction of a knowledge graph is divided into two modes: top-down and bottom-up. Among them, the top-down knowledge graph construction mode is to add entity or concept-related knowledge and establish relationships between entities or concepts on the basis of a preset knowledge graph ontology concept, which is more suitable for the construction of vertical domain-specific knowledge graphs with high requirements for knowledge accuracy and small scale. The bottom-up knowledge graph construction mode refers to extracting entity relationship triples from a large number of general documents and determining the ontology concept information of the schema layer of the knowledge graph based on the extracted entity relationship triples. The bottom-up knowledge graph construction mode is applicable to the construction of large-scale knowledge graphs, but it may contain more knowledge noise.
[0056] Due to the inherent characteristics of the diagnosis and treatment knowledge graph and the requirements of the application scenarios it faces, there are extremely high requirements for the accuracy and effectiveness of knowledge. Therefore, under the guidance of relevant professional physicians, the present invention adopts a top-down knowledge graph construction paradigm to complete the construction of the diagnosis and treatment knowledge graph based on clinical pathway normative documents.
[0057] When determining the ontology concepts in the schema layer, a large number of clinical pathway normative documents are sorted out and analyzed. Combining the guidance and suggestions of professional physicians, the ontology concepts of the diagnosis and treatment knowledge graph are determined and an ontology concept tree is established, specifically as Figure 3 shown. It includes entities such as disease classification, treatment methods, relevant medical examinations, and disease medications, as well as the conceptual relationships between them. It has high rationality of ontology concepts, can meet actual clinical use, and assist physicians in completing the sorting of diagnosis and treatment knowledge.
[0058] During data annotation, since data annotation is an important link in constructing the diagnosis and treatment knowledge graph, and the quality and quantity of data annotation directly determine the quality of the entity relationship triples extracted from entity relationships, thus greatly affecting the quality of the diagnosis and treatment knowledge graph. Therefore, on the basis of determining accurate ontology concepts and combining the guiding opinions of professional physicians, the clinical pathway normative documents are respectively subjected to entity annotation and entity relationship annotation. First, the entities in the text are determined and the relevant entities are recorded in the diagnosis and treatment entity library with ontology concepts as the directory index; then, the relationship existing between the two entities recorded in the text is determined; finally, professional physicians are invited to verify the entity relationship triple data and the diagnosis and treatment entity library marked, to ensure the accuracy and integrity of the pre-marked data, so as to meet the needs of actual clinical decision-making support.
[0059] S102, pre-train the encoder of the Bert model using the diagnosis and treatment text, and then train the Bert model with multiple decoders using the training samples, where each decoder in the Bert model with multiple encoders outputs a hierarchical label, and the entity relationship is obtained based on the hierarchical label.
[0060] To enable the BERT model to better understand and process professional texts in the medical field, the encoder part of the model is first pre-trained using a large number of medical diagnosis and treatment texts. Specifically, in the input medical diagnosis and treatment texts, a certain proportion (predetermined proportion) of words related to entity relationships are randomly selected for masking. Then, using the MLM (Masked Language Model) task branch of BERT, the model is made to predict the masked content based on the context information. At the same time, the NSP (Next Sentence Prediction) task branch is also used to assist in determining the final entity relationship triple from multiple predicted masked contents. Although the importance of the NSP task in the model has been reduced, it is still mentioned in this solution for assisting in judgment. Both of these task branches take the output of the BERT model encoder as input. Through training with a large number of medical diagnosis and treatment texts, the encoder can capture the vocabulary, grammar, and semantic features in the medical field and generate more domain-specific text representations.
[0061] After the encoder is pre-trained with medical diagnosis and treatment texts, the next step is to fine-tune a BERT model with multiple layers of decoders using labeled training samples (including entities and their relationships) to perform the entity relationship extraction task. In the present invention, a decoder part is added to the basis of the BERT encoder, and this decoder is multi-layered. The output of each decoder layer is processed by a feed-forward neural network and then outputs the hierarchical label corresponding to this decoder layer. The hierarchical label is for more effectively processing entity relationships. It may hierarchically encode the relationships according to semantic complexity or importance, enabling different layers of decoders to focus on learning relationship features at different granularities. The final entity relationship extraction result is obtained by fusing the hierarchical labels from the outputs of different layers of decoders.
[0062] In a preferred embodiment, the pre-training of the encoder of the Bert model using medical diagnosis and treatment texts is specifically as follows:
[0063] In the input medical diagnosis and treatment texts, a predetermined proportion of words related to entity relationships are randomly selected for masking.
[0064] Use the MLM task branch to predict the masked content, and determine the final entity relationship triple from multiple predicted masked contents according to the NSP task branch; the inputs of both the MLM task branch and the NSP task branch are the output of the Bert model encoder, as Figure 4 shown.
[0065] Bert adopts two pre-training tasks during the pre-training process:
[0066] One is the MLM task: That is, in a sentence, a certain percentage of tokens, such as 15%, are randomly selected, and these tokens are replaced with [MASK]. Then, a classification model is used to predict what word the [MASK] actually is.
[0067] The second is the NSP task: That is, each sample consists of two sentences, A and B, and there are two cases:
[0068] ① Sentence B is indeed the next sentence of sentence A, and the sample label is IsNext;
[0069] ② Sentence B is not the next sentence of sentence A, and sentence B is a random sentence in the corpus. The sample label is NotNext, and the model needs to complete classification during the pre-training process.
[0070] In view of the characteristics of the two pre-training tasks and combined with the requirements of knowledge graph completion for diagnosis and treatment, the present invention proposes two knowledge graph completion methods, namely dynamic knowledge graph completion based on the MLM task and static knowledge graph completion based on the NSP task.
[0071] The dynamic knowledge graph completion based on the MLM task means using a triple (h, r, t) as a sentence, randomly selecting h, r, t in the triple, replacing the tokens of h, r, t with [MASK], and then letting the Bert pre-trained language model predict the tokens replaced by [MASK]. Therefore, after training, the missing triples can be dynamically completed.
[0072] The static knowledge graph completion based on the NSP task divides each triple into two parts, where A is any two parts of the triple (h, r, t), and B is the remaining part of the triple (h, r, t). There are two cases:
[0073] ① B is indeed a component of the triple corresponding to A, and the sample label is IsIn;
[0074] ② B is not a component of the triple corresponding to A, and B is a random entity or relationship in other triples. The sample label is NotIn. Therefore, after training, the model can complete knowledge graph completion through classification and evaluate the quality of triples.
[0075] In yet another embodiment, the present invention also provides a Bert model with multiple layers of decoders. Specifically, the Bert model includes an encoder and a decoder, and the encoder and decoder include multiple Transformer decoder layers and Transformer decoder layers.
[0076] After each Transformer encoder layer completes the encoding operation, the extracted features are passed to the next Transformer encoder layer;
[0077] Each Transformer decoder layer receives the output of the corresponding Transformer encoder layer. The output of each Transformer decoder layer is processed by a feed-forward neural network layer to output the hierarchical label corresponding to the Transformer decoder layer.
[0078] The hierarchical labels output by all Transformer encoder layers are feature-fused to obtain the entity relationship.
[0079] The Bert pre-trained language model has 12 layers of Transformer encoders. Its feature is that after each layer of Transformer encoder completes the encoding operation, the extracted features are passed to the next layer of Transformer encoder, and the extracted features gradually change from shallow information features to deep task features. To more effectively process entity relationship labels, this method introduces a decoder. When the Bert model is pre-trained, it learns general text features and is difficult to directly process complex entity relationship labels. Introducing a decoder can specifically process the features extracted by each layer of the Bert encoder to make it suitable for the entity relationship extraction task. The decoder adopts a structure similar to the Transformer encoder in the Bert model, including multiple attention mechanisms and feed-forward neural network layers. In the specific working process, the decoder receives the output features from a specific layer of the encoder as its input, and through its own attention mechanism, focuses on the information related to the entity relationship label. For example, when processing a relationship such as "drugs treat diseases", the decoder can, through the attention mechanism, focus on the words and context information in the text about drugs, diseases, and the association between the two, and then after being processed by the feed-forward neural network layer, output the prediction result for the relationship label of this layer.
[0080] Regarding the hierarchical marking of entity relationship tags, specifically, entity relationships are divided into different levels based on factors such as semantic complexity and domain importance. For example, the basic "treatment relationship" is set at a lower level and uses simple binary encoding; the complex "drug side effect association relationship" is set at a higher level and uses complex vector encoding. For other common relationships such as "diagnosis relationship" and "association relationship between examination and disease", corresponding level divisions and encodings are also carried out according to their semantics and importance. For the "diagnosis relationship" with relatively simple semantics and more basic in the medical field, a simple encoding method similar to the "treatment relationship" is adopted; while for the "drug interaction relationship" with complex semantics and involving multiple factors, more complex high-dimensional vector encoding is used. The encoded entity relationships are used as independent inputs and spliced into the outputs of the corresponding layer encoders to facilitate the model to distinguish different levels of relationships. After receiving the spliced information, the model learns and processes the relationship encodings of different levels through attention mechanisms and weight parameters of different layers. The attention mechanism of the lower layer pays more attention to local lexical and syntactic information to identify basic relationship clues; as the level increases, the attention mechanism gradually pays attention to more extensive context and semantic information, so as to be able to distinguish complex relationships.
[0081] The output of each layer decoder corresponds to a level label. The label output by the lower layer decoder captures the basic relationship clues of the text, such as the initial association between words; the label output by the higher layer decoder integrates more semantic and context information and is used to determine more accurate and complex entity relationships. These labels are integrated through a specific fusion algorithm to finally determine the entity relationship triple. The specific fusion algorithm adopted here is a method based on weighted summation. For the labels output by different layer decoders, different weights are assigned according to the importance and reliability of their levels. The weight of the lower layer label is relatively low because the information it contains is more preliminary and local; the weight of the higher layer label is relatively high because it integrates richer semantic and context information. For example, in a text containing drugs, diseases, and treatment methods, the lower layer decoder may identify the two entities of "drug" and "disease", but cannot determine whether the specific relationship between them is "treatment" or "causing"; while the higher layer decoder can accurately judge the "treatment" relationship by comprehensively considering the context information. In the fusion process, the lower layer label information is multiplied by the lower weight, the higher layer label information is multiplied by the higher weight, and then the summation operation is performed to obtain the comprehensive information finally used to determine the entity relationship triple.
[0082] In another embodiment, the specific method for obtaining entity relationships by performing feature fusion on the level labels output by all Transformer encoder layers is as follows:
[0083] Weights are assigned to the Transformer decoder layers according to the corresponding relationship between the Transformer decoder layers and the Transformer encoder layers.
[0084] Multiply the output of the Transformer decoder layer by the weight, accumulate the results of multiplying the outputs of all Transformer decoder layers by the weights to obtain comprehensive information, and use the comprehensive information to obtain entity relationships.
[0085] Correspond each layer of the decoder with a certain layer of the encoder. Preferably, they are usually layers with the same index, and this correspondence is part of the predefined model architecture. For each decoder layer, a weight value is assigned. Preferably, the smaller the index, the smaller the weight, where the index of the decoder layer starts from the input of the encoder. In another embodiment, the weight is used as a model parameter and learned through backpropagation during the training process. For each decoder layer, the hierarchical label of its output is multiplied by the weight assigned to this layer. Add all the weighted hierarchical labels element-wise. The accumulation process integrates information from different hierarchical decoders together to form a comprehensive information vector or tensor containing all hierarchical features. This comprehensive information vector can be considered a more comprehensive and richer representation of the entities and their relationships in the input text. Further predict the relationships between entities using the fused comprehensive information. Preferably, through one or more neural network layers, such as a neural network layer composed of a fully connected layer and / or a classification layer and / or an activation layer, for prediction.
[0086] When using the trained Bert model to extract entity relationships, the MLM task branch is mainly used to supplement and improve the entity relationship information. When extracting the input text, the model predicts and supplements the possibly missing or ambiguous parts of the entity relationship based on the MLM mechanism. The specific operation process is as follows: in the input text, a certain proportion (such as 15%) of the words related to the entity relationship are randomly selected and masked (replaced with "[MASK]"), and then the Bert model is used to predict these masked words. For example, for the text "aspirin [MASK] heart disease", the model predicts through learning a large amount of medical text data that the masked word may be "treat", so as to supplement and improve the entity relationship information. The NSP task branch assists in judging whether the logical relationship between two sentences in the text meets the requirements of the entity relationship context. In actual applications, the text containing the entity relationship is split into two sentences A and B according to certain rules, and then the NSP task is used to judge whether B is a reasonable continuation of A in the entity relationship context. For example, if A is "The patient took aspirin" and B is "The symptoms of heart disease were relieved", the NSP task, through learning a large amount of medical text, judges that these two sentences are reasonably relevant in the entity relationship, so as to assist in determining the rationality of the entity relationship triple "aspirin" - "treat" - "heart disease". When determining the final entity relationship triple, the output result of the MLM task is given priority. If the MLM result is ambiguous and uncertain, the judgment result of the NSP task is combined for comprehensive decision-making. When the MLM task predicts multiple possible entity relationships, the NSP task judges which relationship is more in line with the context according to the logical relationship between the two sentences, so as to determine the final entity relationship triple.
[0087] S103, Input the medical text with entity relationships to be extracted into the trained Bert model to obtain triples, and use the triples to construct the diagnostic and treatment knowledge graph of the clinical pathway for diagnosis and treatment, and perform knowledge completion and entity disambiguation on the triples.
[0088] The medical text with entity relationships to be extracted comes from clinical pathway documents, electronic medical records, medical literature, etc. These medical texts are input into the previously trained BERT model with multiple-layer decoders. The model analyzes the input text, identifies the entities existing in the text, and predicts the relationship types existing between these entities. The output of the model is usually in the form of triples (Subject, Relationship, Object). Among them, Subject (subject) is an identified entity, Relationship (predicate / relationship) is the relationship type predicted by the model between the subject and the object, and Object (object) is another identified entity, which is connected to the subject through the predicate. For example, for the text "The patient took metformin to treat diabetes", the model may output triples as (patient, took, metformin) or (metformin, treat, diabetes).
[0089] After obtaining a series of triples, a knowledge graph is constructed. A knowledge graph is a graph structure composed of nodes and edges. The nodes are the Subject and Object in the triples, representing specific entities or concepts. The edges are the Relationships in the triples corresponding to the edges in the knowledge graph, connecting the relevant nodes and representing the relationships between entities. These nodes and edges are stored in a dedicated knowledge graph storage system or database, forming an interconnected knowledge network.
[0090] After obtaining the knowledge graph, or before obtaining the knowledge graph, knowledge completion and entity disambiguation are performed on the triples. The specific method for performing knowledge completion and entity disambiguation on the triples is as follows:
[0091] The MLM task branch is used to dynamically complete the knowledge graph, and the NSP task branch is used to statically complete the knowledge graph.
[0092] Bert+CNN is used to output a confidence score for each candidate abbreviation expansion, and the expanded entity with the highest score is used as the candidate entity. The random walk method is used to map the graph data into a multi-dimensional entity space, and the Multi-Sense LSTM model is used to achieve entity linking.
[0093] Knowledge completion is an important step in the construction and maintenance of a knowledge graph. It can supplement the missing triples in the knowledge graph. The methods of knowledge completion can be divided into two types: static knowledge completion and dynamic knowledge completion. Dynamic knowledge completion means supplementing the entities and relationships that do not exist in the knowledge graph through relevant algorithms, and static knowledge completion means supplementing the existing entities or relationships in the knowledge graph through relevant algorithms. The present invention adopts a method combining dynamic knowledge completion and static knowledge completion, and uses the Bert pre-trained language model to not only consider the structural information of the triples themselves.
[0094] Entity disambiguation can map the entities mentioned in the text to the entities in the knowledge base. The current entity disambiguation methods can be divided into an unsupervised entity disambiguation method based on clustering and a supervised entity linking method. Since the diagnosis and treatment knowledge graph has high requirements for knowledge validity and accuracy, the present invention adopts a supervised entity linking method to complete entity disambiguation. Specifically as follows: First, Bert+CNN is used to output a confidence score for each candidate abbreviation expansion, and the expanded entity with the highest score is used as the candidate entity. Then, the random walk technique is used to map the graph data into a multi-dimensional entity space, and the Multi-Sense LSTM model is used to achieve entity linking.
[0095] More specifically, a text fragment containing abbreviations is input into the combined model of BERT+CNN. For each identified abbreviation, one or more possible complete entities, i.e., candidate expansions, are generated, and each candidate expansion corresponds to a confidence score, which represents the likelihood that the candidate expansion is the true entity referred to by the abbreviation. The higher the score, the more certain the model is that the expansion is correct. The candidate expansion with the highest confidence score is selected as the most likely entity of the abbreviation in the current context and used as the input for the next entity linking step.
[0096] To better perform entity linking, entities in the knowledge graph are represented in the form of low-dimensional vectors, i.e., entity embeddings. The embedding vectors can capture the structural relationships and semantic similarities of entities in the knowledge graph. Specifically, starting from each node in the knowledge graph, a certain number of steps are randomly walked along adjacent edges to generate a series of entity sequences; if completion and disambiguation are performed before generating the knowledge graph, random walks can use the existing knowledge graph or knowledge graphs from other sources. By using an algorithm similar to Word2Vec on a large number of random walk sequences, the vector representation of each entity can be learned. Entities that are semantically related or close in the graph structure will have closer distances between their embedding vectors in the multi-dimensional space. The obtained candidate entities are more precisely matched with the entities in the knowledge graph that obtain embedding vectors through random walks to finally determine the correct link. For the obtained candidate entities and other relevant entities in the knowledge graph, the embedding vectors learned through random walks are used. The Multi-Sense LSTM model will compare the vector representation of the text context and the embedding vectors of the candidate entities and calculate the semantic similarity or matching degree between them. The entity in the knowledge graph that is most similar to the text context is selected as the final link result, thus completing the task of entity disambiguation. If an abbreviation has multiple possible full forms, the model will select the most appropriate one for linking based on the semantic information of the context and the knowledge graph.
[0097] In one embodiment, the specific implementation steps of the present invention are as follows:
[0098] Step 1: Sort out the 2019 version of clinical normative documents promulgated by the General Office of the National Health Commission;
[0099] Step 2: Consult experts in related fields to formulate ontology concepts at the schema layer, including diagnosis and treatment methods, medical instruments, treatment methods, drug names, etc.;
[0100] Step 3: According to the ontology concepts at the schema layer, select some clinical normative documents to complete the annotation of 500 entity relationship triples;
[0101] Step 4: Collect publicly available medical datasets on the network, use clinically standardized file names as keywords to download and collect relevant medical papers, organize them, and finally load the Bert pre-trained language model for continued pre-training to obtain a domain pre-trained language model;
[0102] Step 5: Divide the dataset, use 400 pieces of data as the training set, 50 as the validation set, and 50 as the test set, and use an improved entity relationship extraction method combined with the domain pre-trained language model to complete the entity relationship;
[0103] Specifically, use 400 pieces of data to fine-tune KG-bert, 50 as the validation set, and 50 as the test set to complete the knowledge completion training to evaluate the credibility of entity relationship triples and perform knowledge completion.
[0104] Step 6: Use Bert+CNN to output a confidence score for each candidate abbreviation expansion, and use the expansion entity with the highest score as the candidate entity. Use the random walk technique to map the graph data into a multi-dimensional entity space, and use the Multi-SenseLSTM model to achieve entity linking.
[0105] Embodiment 2 provides a clinical-path-based diagnosis and treatment knowledge graph construction system, characterized in that the system includes:
[0106] A training sample acquisition module for determining the ontology concepts of the diagnosis and treatment knowledge graph, establishing an ontology concept tree, extracting the ontology according to the ontology concept tree, and annotating the relationships of the extracted entities to obtain training samples.
[0107] A training module for pre-training the encoder of the Bert model using diagnosis and treatment texts, and then training the Bert model with multiple layers of decoders using the training samples, where each layer of the decoders in the Bert model with multiple layers of encoders outputs a hierarchical label, and the entity relationship is obtained based on the hierarchical label.
[0108] A knowledge graph construction module for inputting medical texts with entity relationships to be extracted into the trained Bert model to obtain triples, constructing a diagnosis and treatment knowledge graph of the diagnosis and treatment clinical path using the triples, and performing knowledge completion and entity disambiguation on the triples.
[0109] Preferably, the pre-training of the encoder of the Bert model using diagnosis and treatment texts is specifically:
[0110] In the input diagnosis and treatment texts, randomly select a preset proportion of vocabulary related to entity relationships for masking.
[0111] Predict the masked content using the MLM task branch, and determine the final entity relationship triple from multiple predicted masked contents according to the NSP task branch; the inputs of both the MLM task branch and the NSP task branch are the outputs of the Bert model encoder.
[0112] Preferably, the Bert model with multiple layers of decoders is specifically:
[0113] The Bert model includes an encoder and a decoder, and the encoder and decoder include multiple Transformer decoder layers and Transformer decoder layers.
[0114] After each Transformer encoder layer completes the encoding operation, the extracted features are passed to the next Transformer encoder layer.
[0115] Each Transformer decoder layer receives the output of the corresponding Transformer encoder layer, and the output of each Transformer decoder layer is processed by a feed-forward neural network layer to output the hierarchical label corresponding to the Transformer decoder layer.
[0116] Fuse the hierarchical labels output by all Transformer encoder layers to obtain the entity relationship.
[0117] Preferably, the fusing the hierarchical labels output by all Transformer encoder layers to obtain the entity relationship is specifically:
[0118] Assign weights to the Transformer decoder layers according to the corresponding relationship between the Transformer decoder layers and the Transformer encoder layers.
[0119] Multiply the output of the Transformer decoder layer by the weight, accumulate the results of multiplying the outputs of all Transformer decoder layers by the weights to obtain the comprehensive information, and use the comprehensive information to obtain the entity relationship.
[0120] Preferably, the knowledge completion and entity disambiguation of the triple are specifically:
[0121] Use the MLM task branch to dynamically complete the knowledge graph, and use the NSP task branch to statically complete the knowledge graph.
[0122] Use Bert+CNN to output a confidence score for each candidate abbreviation expansion, take the expanded entity with the highest score as the candidate entity, use the random walk method to map the graph data into a multi-dimensional entity space, and use the Multi-Sense LSTM model to achieve entity linking.
[0123] Embodiment 3 provides a computer-readable storage medium. When the computer program stored on the readable storage medium is executed by a processor, the method described in Specific Embodiment 1 is implemented.
[0124] The above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrating one or more available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0125] The steps of the methods or algorithms described in the embodiments of the present application may be directly embedded in hardware, a software unit executed by a processor, or a combination of the two. The software unit may be stored in a RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, register, hard disk, removable disk, CD-ROM, or any other form of storage medium in the art. Exemplarily, the storage medium may be connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Optionally, the storage medium may also be integrated into the processor. The processor and the storage medium may be provided in an ASIC.
[0126] These computer program instructions may also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in a process Figure 1 a process or multiple processes and / or blocks Figure 1 a block or multiple blocks.
[0127] Although the present application has been described in connection with specific features and their embodiments, it will be apparent that various modifications and combinations can be made without departing from the spirit and scope of the present application. Accordingly, the specification and drawings are merely exemplary illustrations of the present application as defined by the appended claims and are considered to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to cover these changes and modifications.
Claims
1. A method for constructing a diagnosis and treatment knowledge graph based on a clinical pathway, characterized in that, The method includes: Determine the ontology concepts of the diagnosis and treatment knowledge graph and establish an ontology concept tree. Extract the ontology according to the ontology concept tree, and label the relationships of the extracted entities to obtain training samples; Pre-train the encoder of the Bert model using diagnosis and treatment texts, and then train the Bert model with multiple decoders using the training samples. Each decoder layer in the Bert model with multiple encoder layers outputs a hierarchical label, and the entity relationship is obtained based on the hierarchical label; Input the medical text for which entity relationships are to be extracted into the trained Bert model to obtain triples. Use the triples to construct the diagnosis and treatment knowledge graph of the diagnosis and treatment clinical pathway, and perform knowledge completion and entity disambiguation on the triples.
2. The method according to claim 1, characterized in that The pre-training of the encoder of the Bert model using diagnosis and treatment texts is specifically: Randomly select a preset proportion of vocabulary related to entity relationships in the input diagnosis and treatment texts for masking; Use the MLM task branch to predict the masked content, and determine the final entity relationship triples from multiple predicted masked contents according to the NSP task branch; the inputs of the MLM task branch and the NSP task branch are both the outputs of the Bert model encoder.
3. The method according to claim 1, characterized in that The Bert model with multiple decoders is specifically: The Bert model includes an encoder and a decoder, and the encoder and decoder include multiple Transformer decoder layers and Transformer encoder layers; After each Transformer encoder layer completes the encoding operation, the extracted features are passed to the next Transformer encoder layer; Each Transformer decoder layer receives the output of the corresponding Transformer encoder layer, and the output of each Transformer decoder layer is processed by a feed-forward neural network layer to output the hierarchical label corresponding to the Transformer decoder layer; Fuse the hierarchical labels output by all Transformer encoder layers to obtain the entity relationship.
4. The method according to claim 3, wherein The fusing of the hierarchical labels output by all Transformer encoder layers to obtain the entity relationship is specifically: Assign weights to the Transformer decoder layers according to the corresponding relationship between the Transformer decoder layers and the Transformer encoder layers; Multiply the output of the Transformer decoder layer by the weight, accumulate the results of multiplying the outputs of all Transformer decoder layers by the weights to obtain comprehensive information, and use the comprehensive information to obtain the entity relationship.
5. The method according to claim 1, wherein The knowledge completion and entity disambiguation of the triples are specifically: Use the MLM task branch to perform dynamic completion on the knowledge graph, and use the NSP task branch to perform static completion on the knowledge graph; Use Bert+CNN to output a confidence score for each candidate abbreviation expansion, take the expanded entity with the highest score as the candidate entity, use the random walk method to map the graph data into a multi-dimensional entity space, and use the Multi-Sense LSTM model to achieve entity linking.
6. A diagnostic and treatment knowledge graph construction system based on a clinical pathway, characterized in that The system includes: A training sample acquisition module, which is used to determine the ontology concepts of the diagnosis and treatment knowledge graph and establish an ontology concept tree, extract ontologies according to the ontology concept tree, and label the relationships of the extracted entities to obtain training samples; A training module, which is used to pre-train the encoder of the Bert model using diagnosis and treatment texts, and then use the training samples to train the Bert model with multiple layers of decoders. Each layer of decoder in the Bert model with multiple layers of encoders outputs a hierarchical label, and entity relationships are obtained based on the hierarchical labels; A knowledge graph construction module, which is used to input medical texts with entity relationships to be extracted into the trained Bert model to obtain triples, construct a diagnosis and treatment knowledge graph of the diagnosis and treatment clinical path using the triples, and perform knowledge completion and entity disambiguation on the triples.
7. The system according to claim 6, wherein The pre-training of the encoder of the Bert model using diagnosis and treatment texts is specifically as follows: In the input diagnosis and treatment texts, randomly select a preset proportion of vocabulary related to entity relationships for masking; Use the MLM task branch to predict the masked content, and determine the final entity relationship triples from multiple predicted masked contents according to the NSP task branch; the inputs of the MLM task branch and the NSP task branch are both the outputs of the Bert model encoder.
8. The system according to claim 6, wherein, The Bert model with multiple layers of decoders is specifically as follows: The Bert model includes an encoder and a decoder, and the encoder and decoder include multiple Transformer decoder layers and Transformer decoder layers; After each Transformer encoder layer completes the encoding operation, the extracted features are passed to the next Transformer encoder layer; Each Transformer decoder layer receives the output of the corresponding Transformer encoder layer, and the output of each Transformer decoder layer is processed by a feed-forward neural network layer to output the hierarchical label corresponding to the Transformer decoder layer; The hierarchical labels output by all Transformer encoder layers are feature-fused to obtain entity relationships.
9. The system according to claim 8, wherein The feature-fusing the hierarchical labels output by all Transformer encoder layers to obtain entity relationships is specifically as follows: According to the corresponding relationship between the Transformer decoder layer and the Transformer encoder layer, weights are assigned to the Transformer decoder layer; Multiply the output of the Transformer decoder layer by the weight, accumulate the results of multiplying the outputs of all Transformer decoder layers by the weights to obtain comprehensive information, and use the comprehensive information to obtain entity relationships.
10. The system according to claim 6, wherein The knowledge completion and entity disambiguation of the triples are specifically as follows: Use the MLM task branch to perform dynamic completion on the knowledge graph, and use the NSP task branch to perform static completion on the knowledge graph; Using Bert + CNN to output a confidence score for each candidate abbreviation expansion, taking the expansion entity with the highest score as the candidate entity, mapping the graph data into a multi-dimensional entity space using the random walk method, and implementing entity linking with the Multi-Sense LSTM model.