A medical knowledge graph construction method and related products

By building a model for extracting the relationship between entities and entities in medical information, the problems of low efficiency and poor accuracy of the existing medical information retrieval system are solved, and more efficient and accurate medical information retrieval services are achieved.

CN119046478BActive Publication Date: 2025-02-11SCI & TECH LITERATURE PUBLISHING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411551684.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-11
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

The existing medical information retrieval system is inefficient and has poor accuracy, making it difficult to obtain the medical and health information required by users in a comprehensive and efficient manner.

Method used

Using a medical knowledge graph construction method, the entity-entity relationship is carried out by obtaining and constructing an extracted model for extracting the relationship between entities and entities in the data to be identified, including the first model and the second model of the large model built based on the Bert model. and finally write to the medical knowledge graph.

Benefits of technology

It improves the efficiency of extracting and identifying relationships between entities, enhances the integration and correlation of medical information, and provides more efficient and accurate information retrieval services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046478B_ABST
    Figure CN119046478B_ABST
Patent Text Reader

Abstract

The present application provides a method for constructing a medical knowledge graph and related products, which belong to the field of artificial intelligence and medical technology. It extracts entities and entity relationships from the data to be identified by constructing a model for extracting entities and entity relationships in the data to be identified. The entity types in the data to be identified are divided into two categories, and the first model constructed based on the Bert model is used to extract entities under the first category, and the large model is used to extract entities and entity relationships under other categories except the first category. This method reduces the calculation amount of the first model and the workload of manual annotation, and effectively improves the extraction and recognition efficiency of the entire entity and entity relationship. By constructing a knowledge graph in the medical field, medical and health information scattered on the Internet can be effectively integrated and associated to form a comprehensive knowledge system. The technical solution of the present application can efficiently extract useful medical information from massive data and provide users with convenient and intelligent information retrieval services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence and medical technology, and specifically, to a method for constructing a medical knowledge graph and related products. Background Art

[0002] With the rapid development of the Internet, medical and health information has become increasingly rich and diverse, and this information is scattered across multiple data sources, including professional medical books, health websites, online forums, and social media platforms. However, this dispersion of information has brought great inconvenience to users. When users are looking for specific medical and health information, they often need to visit multiple websites and platforms, which is not only time-consuming and laborious, but also difficult to obtain the required information comprehensively and efficiently. In addition, information from different sources may be contradictory or inconsistent, increasing users' confusion and uncertainty.

[0003] Traditional information retrieval systems are mostly based on character matching, which has obvious limitations when processing natural language data. Character matching cannot understand the semantic information of the text and has difficulty capturing the deep relationship between data, resulting in low accuracy and relevance of retrieval results. For example, when a user searches for treatment methods for a certain disease, a traditional system may only return web pages containing specific keywords, but cannot provide comprehensive treatment plans, related symptoms, drug information, and lifestyle recommendations. This limited service capability greatly restricts users' ability to obtain high-quality medical and health information and cannot meet users' needs for accurate, comprehensive, and highly relevant medical and health information. Summary of the invention

[0004] The purpose of this application is to provide a medical knowledge graph construction method and related products to solve the current problems of low efficiency and poor accuracy in medical information retrieval.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] A method for constructing a medical knowledge graph, comprising: obtaining an extraction model for extracting entities and entity relationships in data to be identified, the extraction model comprising a first model and a second model, wherein the first model is used to extract entities and entity relationships under a first category, and the second model is used to extract entities and entity relationships under categories other than the first category; the construction process of the first model comprises: pre-training a Bert model using medical-related text data to obtain an initial model; based on the initial model, adding a CRF layer to the architecture of the initial model and training with a training data set to obtain the first model; the second model is a large model; extracting entities and entity relationships from data to be identified using the extraction model; evaluating the extracted entities and entity relationships, and writing the extracted entities and entity relationships into the medical knowledge graph or not according to the evaluation results.

[0007] In some embodiments, the use of medical-related text data to pre-train the Bert model includes: obtaining the medical-related text data; pre-training the Bert model through established MLM and NSP training tasks to obtain an initial model, and the data used for pre-training is the medical-related text data.

[0008] In some embodiments, the process of obtaining the training data set includes: defining an outline of a medical knowledge graph, the outline including entity types and entity relationship types; using a general information extraction model to annotate original text according to the outline of the medical knowledge graph to obtain annotated data, wherein the original text is text containing entities and entity relationships.

[0009] In some embodiments, the evaluation of the extracted entities and entity relationships includes: evaluating the extracted entities and entity relationships using an evaluation model, and the construction process of the evaluation model includes: taking entities in the labeled data, simulating whether there are matching candidate entities of the same type in the extraction results in the medical knowledge graph, converting the labeled data into positive examples and negative examples according to the matching results, or converting the labeled data into positive examples and negative examples according to whether the extracted entities and entity relationships are correct; selecting the Qwen2 7B model as the basic model of the evaluation model, and training the Qwen2 7B model using the converted positive examples and negative examples as training data; evaluating the trained Qwen27B model using verification data, and outputting the evaluation model if the evaluation is qualified.

[0010] In some embodiments, the evaluation of the extracted entities and entity relationships also includes: inputting the entities and entity relationships extracted by the extraction model, the candidate entities of the same type of the entities extracted from the medical knowledge graph, and the text where the extracted entities and entity relationships are located into the evaluation model, and matching the extracted entities and entity relationships with the candidate entities of the same type of the entities extracted from the medical knowledge graph; inputting the entities and entity relationships extracted by the extraction model, the matching results, and the text where the extracted entities and entity relationships are located into the evaluation model, and verifying the extracted entities and entity relationships; if the verification result of the evaluation model is correct, writing them into the medical knowledge graph; if the verification result of the evaluation model is incorrect, not writing them into the medical knowledge graph.

[0011] In some embodiments, the extraction of entities and entity relationships from the data to be identified using the constructed extraction model includes: correcting and rectifying the data to be identified, wherein the data to be identified includes structured data, semi-structured data, and unstructured data; and extracting entities and entity relationships from the corrected data to be identified using the constructed extraction model.

[0012] In some embodiments, the extraction of entities and entity relationships from the data to be identified using the constructed extraction model also includes: when using the first model to extract entities and entity relationships from the data to be identified, marking the text of the data to be identified corresponding to the extracted entities with corresponding entity tags.

[0013] The second aspect of the present application provides a medical knowledge graph construction system, including: a model acquisition module, which is used to acquire an extraction model for extracting entities and entity relationships in data to be identified, the extraction model includes a first model and a second model, wherein the first model is used to extract entities and entity relationships under a first category, and the second model is used to extract entities and entity relationships under other categories except the first category; the construction process of the first model includes: pre-training the Bert model using medical-related text data to obtain an initial model; based on the initial model, adding a CRF layer to the architecture of the initial model and training with a training data set to obtain the first model; the second model is a large model with a parameter quantity of hundreds of billions; an identification module, which is used to extract entities and entity relationships from data to be identified using the extraction model; an evaluation module, which is used to evaluate the extracted entities and entity relationships, and perform operations of writing or not writing the extracted entities and entities into the medical knowledge graph according to the evaluation results.

[0014] A third aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program runs on a processor, the processor executes the method described in the first aspect.

[0015] The fourth aspect of the present application provides an electronic device, comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory. When the programs stored in the memory are executed, the processor is used to execute the method described in the first aspect.

[0016] Compared with the prior art, the present invention has the following advantages:

[0017] The present application provides a method and system for constructing a medical knowledge graph, which extracts entities and entity relationships from the data to be identified by constructing a model for extracting entities and entity relationships in the data to be identified. Among them, the entity types in the data to be identified are divided into two categories. Specifically, the first model constructed based on the Bert model is used to extract entities under the first category, and the large model is used to extract entities and entity relationships under other categories except the first category. This method reduces the calculation amount of the first model and the amount of data that needs to be annotated, and effectively improves the annotation efficiency, model training efficiency, and the extraction and recognition efficiency of the entire entity and entity relationship. By constructing a knowledge graph in the medical field, the medical and health information scattered on the Internet can be effectively integrated and associated to form a comprehensive and systematic knowledge system. Users can quickly and accurately obtain the required medical information through the intuitive interface provided by the medical knowledge graph, thereby improving the efficiency and accuracy of information retrieval. The technical solution of the present application can efficiently extract useful medical information from massive data, accurately represent and store the effective medical information, and provide users with convenient and intelligent information retrieval services. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A flow chart of the medical knowledge graph construction method of an embodiment of the present application is shown.

[0020] Figure 2 An example table of entities in the medical knowledge graph of an embodiment of the present application is shown.

[0021] Figure 3An example table of entity relationships in the medical knowledge graph of an embodiment of the present application is shown.

[0022] Figure 4 A structural diagram of the medical knowledge graph construction system of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0023] The technical solutions of the specific implementation methods of the present application are further described in detail below in conjunction with the accompanying drawings. These implementation methods are only used to illustrate the present application, but not to limit the present application.

[0024] The term "and / or" in this application is a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. In the present invention, the symbol " / " indicates that the associated objects are in an "or" relationship, for example, "A / B" means "A or B".

[0025] The terms "first" and "second" in the specification and claims of this application are used to distinguish different objects rather than to describe a specific order of the objects. For example, "first response message" and "second response message" are used to distinguish different response messages rather than to describe a specific order of the response messages.

[0026] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be considered as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0027] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc., and multiple elements refer to two or more elements, etc.

[0028] The following is a detailed description of a knowledge graph construction method and related products of an embodiment of the present application in conjunction with the accompanying drawings.

[0029] Figure 1 A schematic diagram of a process for constructing a medical knowledge graph according to an embodiment of the present application is shown. Figure 1 As shown, the method for constructing a medical knowledge graph in the embodiment of the present application includes the following steps:

[0030] Step S100, obtaining an extraction model for extracting entities and entity relationships in the data to be identified, the extraction model comprising a first model and a second model. The first model is used to extract entities under a first category, and the second model is used to extract entities and entity relationships under categories other than the first category. In a specific embodiment, Figure 2 , Figure 3 Several entities and entity relationships are shown. The aforementioned first category may include common entity types such as diseases, psychotherapy, food ingredients, medicines, and laboratory tests, and the second model may be used to extract entities and entity relationships under other categories except the aforementioned first category.

[0031] The process of constructing the first model may include: step S110, obtaining medical-related text data, using the medical-related text data to pre-train the Bert model to obtain an initial model. The medical-related text data may be professional medical data from medical health encyclopedia websites such as medical health books published by Science and Technology Literature Publishing House Co., Ltd., and medical health encyclopedia websites such as Xunyiwenyao.com and Food Nutrition Cost Query Network.

[0032] The aforementioned medical-related text data can be a PDF of medical data. The image recognition algorithm is used to perform image recognition on the image of each page of the PDF to identify the header, footer, page number, table, illustration, text paragraph, and title in the image. A synonym library for each entity is established, for example, synonyms are established for diseases, psychotherapy, food ingredients, medicines, and laboratory tests. The synonyms have a basic name, and then the synonyms are expanded through a large model or manual screening method. When entering the medical-related text data into the database, if a title contains an entity name or a synonym of the entity name, all content under this title is labeled with the entity. If a paragraph contains an entity name or a synonym of the entity name, the first five paragraphs and the last five paragraphs of this paragraph are all labeled with the entity. If a paragraph has too many words, it is segmented, and each segmented paragraph is labeled with the entity. The segmentation standard is the maximum length supported by the large model, such as 2,000 words. The segmentation method can effectively avoid the problem of missing content caused by the method of recalling content through keywords and then extracting it. Use the content sentences in the medical data PDF body to pre-train the Bert model.

[0033] The pre-training process includes training the Bert model through the established MLM (Masked Language Modeling) and NSP (Next Sentence Prediction) training tasks. MLM refers to randomly selecting some words in the input sentence and replacing them with masks, such as [Mask], so that the model can predict the correct words of these masks, thereby training the model's ability to understand the context. NSP adds a sentence-level continuity prediction task on the basis of the bidirectional language model, that is, to judge the logical relationship between two sentences, such as whether they are continuous, that is, to judge whether the second sentence is the next sentence of the first sentence. The aforementioned tasks can help the model learn the relationship between sentences, thereby improving the model's reasoning ability.

[0034] Step S120, based on the initial model, add a CRF layer to the architecture of the Bert model and use the training data set for training to obtain the first model. The process of obtaining the training data set includes: Step S121, defining the outline of the medical knowledge graph, which includes entity types and entity relationship types. The outline constitutes the basic framework of the medical knowledge graph. In a specific embodiment, 24 types of entities and 32 types of entity relationships can be defined according to the purpose of the medical knowledge graph, and the definition rules are various indicators related to the disease. Figure 2 , Figure 3 As shown, the aforementioned 24 types of entities may include diseases, symptoms, efficacy, examination items, etc., and the entity relationship can be represented by the relationship between entity 1 and entity 2.

[0035] The process of obtaining a training data set also includes: step S122, using the universal information extraction model UIE, pre-annotating the original text according to the outline of the aforementioned medical knowledge graph, where the original text is a text containing entities and entity relationships. The outline of the medical knowledge graph and the original text to be annotated are input into the information extraction model UIE together, and the instances corresponding to the entities and entity relationships defined in the outline of the medical knowledge graph are output to obtain structured text. The structured text also includes entities and entity relationships, and their corresponding instances, and may also include the location of the instances in the text.

[0036] Further, in step S123, the pre-annotated data can also be checked and supplemented using an annotation platform, and the annotated data is the training data set of the first model. The aforementioned annotation platform is a visual annotation platform used by people, which can annotate all entities and relationships in the outline of the medical knowledge graph and the original text. For example, the original text is "Hypertension is one of the common cardiovascular diseases, and the main symptoms include high blood pressure, headache, dizziness and other manifestations". The hypertension and corresponding symptoms that appear in the original text are defined in the outline of the medical knowledge graph. Therefore, "hypertension" is marked as a disease here, "high blood pressure, headache, dizziness" are marked as symptoms, and the relationship names of "hypertension", "high blood pressure, headache, dizziness" are marked as symptoms.

[0037] Based on the above steps, a CRF layer is then added to the architecture of the Bert model to obtain a first model, and the first model is trained using a training data set. Specifically, a conditional random field, i.e., a CRF layer, can be added to the last layer of the Bert model. The CRF layer uses the output of the last layer of the initial model as input, and the probability that each word belongs to a certain entity category is calculated through the CRF algorithm. It can be understood that the initial model extracts features from the sentence, and the extracted features are used for entity relationship recognition by CRF. The first model is trained using the aforementioned annotated data as a training data set, and the accuracy is verified using a verification set. When the accuracy does not reach 95% or more, repeat step S123 and the step of training the first model until the accuracy reaches the target position. For unrecognizable data such as erroneous data, the annotation is adjusted in step S123, or the training data flow is increased.

[0038] The aforementioned training data set can be a data set composed of plain text collected from medical books and websites, and the results of annotating the text. The training process is to input text, output entities and entity relationships identified by labels, calculate the loss function of the actual labels and the labels output by the first model, and use the gradient descent algorithm to adjust the parameters of the first model to minimize the loss function and achieve the purpose of training. The trained first model can simulate the human annotation process and identify the entities and entity relationships in the text.

[0039] Step 200, extracting entities and entity relationships from the data to be recognized using the extraction model. In a preferred embodiment, the data to be recognized can be firstly corrected and corrected. For example, pycorrector can be used to perform error correction recognition on the data to be recognized. Pycorrector is an open source project. Before performing entity extraction, the data to be recognized is first input into pycorrector, which can correct typos, grammatical errors, etc. in the data to be recognized, and avoid inputting erroneous text into the recognition model.

[0040] In one embodiment, when the first model is used to extract entities and entity relationships from the data to be identified, the text of the data to be identified corresponding to the extracted entities is marked with corresponding entity tags. The data to be identified may include structured data, unstructured data, and semi-structured data in the database, wherein structured data and semi-structured data need to find the fields containing entities according to their structures, extract the plain text in the fields, and then input them into the recognition model, i.e., the first model. The recognition process can only identify five entities, namely, diseases, psychotherapy, food ingredients, medicines, and laboratory tests, and the corresponding texts are marked with the corresponding tags of the above five entities.

[0041] When using the second model to extract entities and entity relationships from the data to be identified, the aforementioned second model can be a large model with hundreds of billions of parameters. A large model refers to a machine learning model with ultra-large-scale parameters and complex computing structures, such as iFlytek's Spark large model and ChatGPT large model. The second model extracts entity types other than the aforementioned five entities, and inputs each paragraph of text that has been marked with entity tags in the database in the aforementioned steps and the instructions of the large model into the second model, and uses the instructions to identify all entities and all entity relationships related to the entity. In a specific embodiment, the instructions of the aforementioned large model can be "Please help me identify the symptoms, differential diagnosis, prevention methods, and [names of other relationships] of hypertension from the paragraph."

[0042] Step S300, evaluate the extracted entities and entity relationships, and write the extracted entities and entity relationships into the medical knowledge graph or not write them into the medical knowledge graph according to the evaluation results. Specifically, the extracted entities and entity relationships can be evaluated using an evaluation model, and the construction process of the evaluation model includes:

[0043] Take the entities in the labeled data, simulate whether there are matching candidate entities of the same type in the medical knowledge graph and whether the extraction results are correct or wrong, and convert the labeled data into positive and negative examples according to the simulation results. The aforementioned medical knowledge graph is an initialized medical knowledge graph containing candidate entities of the same type and entity relationships, and the candidate entities of the same type are known correct entities. Positive examples refer to entities extracted from text that can be matched to corresponding entities in the medical knowledge graph, or the extracted entities and entity relationships are correct. Negative examples refer to entities extracted from text that cannot be matched to corresponding entities in the medical knowledge graph, or the extracted entities and entity relationships are wrong. Negative examples are obtained by deleting corresponding candidate entities of the same type from the positive example input. The ratio of positive examples to negative examples can be set to 2:1.

[0044] The Qwen2 7B model is selected as the basic model of the evaluation model, and the converted positive and negative examples are used as training data to train the Qwen2 7B model. The trained Qwen2 7B model is evaluated using the verification data, and the evaluation model is output if the evaluation is qualified. The training process can be divided into the entity matching part. Taking the positive example as an example of the training data, the Qwen2 7B model is input with "the entity "blood pressure rises" is extracted from the input text. Please judge which entity in the medical knowledge graph it matches. If there is no match, output None + [candidate entity of the same type of extracted entity] + [input text]", and the positive example outputs "hypertension". Taking the negative example as an example, the Qwen2 7B model is input with "the entity "blood pressure rises" is extracted from the input text. Please judge which entity in the medical knowledge graph it matches. If there is no match, output None + [candidate entity of the same type of extracted entity] + [input text]", and the negative example outputs "None". The counterexample does not include the "hypertension" entity in the candidate entities of the same type provided to the Qwen2 7B model, simulating the state that this entity has not yet been stored in the medical knowledge graph. The output of the counterexample is "none", indicating that there is no entity in the current graph that matches the extraction result.

[0045] Furthermore, the training process can be divided into the part of judging the correctness of the entity and entity relationship. Taking the positive example of the training data, input "Please judge whether the extracted entity is correct + [extracted entity] + [candidate entity of the same type selected by the evaluation model] + [input text]" into the Qwen2 7B model, and output "correct". Taking the negative example, input "Please judge whether the extracted entity is correct + [extracted entity] + [candidate entity of the same type selected by the evaluation model] + [input text]" into the Qwen2 7B model, and the candidate entity of the same type does not match the extracted entity, and the output is "wrong". Use the training data of the above two parts to train the Qwen2 7B model and fine-tune the relevant parameters of the Qwen2 7B model. After fine-tuning, the fine-tuned Qwen2 7B model is evaluated through an independent verification data to ensure that it performs well on new data. Common evaluation indicators can include accuracy, recall rate, and F1 score.

[0046] When using the evaluation model to evaluate the entities and entity relationships extracted by the extraction model, the entities and entity relationships extracted by the extraction model, the candidate entities of the same type of the entities extracted in the medical knowledge graph, and the text where the extracted entities and entity relationships are located are input into the evaluation model together, and the extracted entities and entity relationships are matched with the candidate entities of the same type of the entities extracted in the medical knowledge graph. If no match is found, the extracted entity is a new entity to be written into the medical knowledge graph. The entities and entity relationships extracted by the extraction model, the aforementioned matching results, and the text where the extracted entities and entity relationships are located are input into the evaluation model to verify the extracted entities and entity relationships. If the verification result of the evaluation model is correct, the extracted entities and entity relationships are written into the knowledge graph. If the verification result of the evaluation model is wrong, the extracted entities and entity relationships are not written into the medical knowledge graph.

[0047] like Figure 4 As shown, the second aspect of the present application provides a medical knowledge graph construction system, which includes a model acquisition module for acquiring an extraction model for extracting entities and entity relationships in the data to be identified, and the extraction model includes a first model and a second model. Among them, the first model is used to extract entities and entity relationships under the first category, and the second model is used to extract entities and entity relationships under other categories under the first category. The aforementioned second model can be a large model with a parameter volume of hundreds of billions, such as iFlytek's Spark large model and ChatGPT large model. The aforementioned first category can, for example, include five common entity types: diseases, psychotherapy, food ingredients, pharmaceuticals, and laboratory tests. The method of using the first model to extract only the aforementioned common entity types and the second model to extract other entity types except the aforementioned entity types can effectively improve the extraction model's extraction and recognition efficiency of entities and entity relationships in the data to be identified.

[0048] The construction process of the aforementioned first model includes: using medical-related text data to pre-train the Bert model to obtain an initial model. The pre-training process includes training the Bert model through the established MLM (Masked Language Modeling) and NSP (Next Sentence Prediction) training tasks. MLM refers to randomly selecting some words in the input sentence and replacing them with masks, such as [Mask], so that the model can predict the correct words of these masks, so as to train the model's ability to understand the context. NSP adds a sentence-level continuity prediction task on the basis of the bidirectional language model, that is, to judge the logical relationship between two sentences, such as whether they are continuous, that is, to judge whether the second sentence is the next sentence of the first sentence. The aforementioned tasks can help the model learn the relationship between sentences, thereby improving the model's reasoning ability.

[0049] Based on the initial model, a CRF layer is added to the architecture of the initial model and trained using a training data set to obtain a first model. The process of obtaining a training data set includes: defining an outline of a medical knowledge graph, which includes entity types and entity relationship types, and the outline constitutes the basic framework of the medical knowledge graph. Using the universal information extraction model UIE, the outline and original text of the aforementioned medical knowledge graph are pre-annotated, and the original text is a text containing entities and entity relationships. The pre-annotated data can also be checked and supplemented using an annotation platform, and the annotated data is the training data set of the first model.

[0050] The medical knowledge graph construction system of the present application also includes a recognition module, which is used to extract entities and entity relationships from the data to be recognized using the constructed extraction model. In one embodiment, when the first model is used to extract entities from the data to be recognized, the text of the data to be recognized corresponding to the extracted entity is marked with a corresponding entity label. The data to be recognized may include structured data, unstructured data and semi-structured data in the database, among which structured data and semi-structured data need to find the fields containing entities according to their structure, extract the plain text in the fields, and then input them into the recognition model, i.e., the first model. The recognition process can only recognize five entities: diseases, psychotherapy, ingredients, drugs and laboratory tests, and the corresponding texts are marked with the corresponding labels of the above five entities.

[0051] When using the second model to extract entities and entity relationships from the data to be identified, the aforementioned second model can be a large model with hundreds of billions of parameters, such as iFlytek's Spark model and ChatGPT model. The second model extracts entity types other than the aforementioned five entities, and inputs each paragraph of text that has been marked with entity tags in the database in the aforementioned steps and the instructions of the large model into the second model, and uses the instructions to identify all entities and all entity relationships related to the entity. In a specific embodiment, the instructions of the aforementioned large model can be "Please help me identify the symptoms, differential diagnoses, prevention methods, and other relationship names of hypertension from the paragraph."

[0052] The medical knowledge graph construction system of the present application also includes an evaluation module for evaluating the extracted entities and entity relationships, performing operations of writing or not writing the extracted entities and entities into the medical knowledge graph according to the evaluation results, and constructing the medical knowledge graph according to the entities and entity relationships written into the medical knowledge graph. Specifically, the evaluation model can be used to evaluate the extracted entities and entity relationships, and the construction process of the evaluation model includes:

[0053] Take the entities in the labeled data, simulate whether the extraction results have matching candidate entities of the same type in the medical knowledge graph, and whether the extraction results are correct or wrong. According to the simulation results, convert the labeled data into positive and negative examples. Select the Qwen2 7B model as the basic model of the evaluation model, and use the converted positive and negative examples as training data to train the Qwen2 7B model. Use the verification data to evaluate the trained Qwen2 7B model, and output the evaluation model if the evaluation is qualified. The training process can be divided into the entity matching part. Taking the positive example as an example of training data, input "the entity "blood pressure rises" is extracted from the input text. Please judge which entity in the medical knowledge graph it matches. If there is no match, output None + [candidate entity of the same type of extracted entity] + [input text]", and the positive example outputs "hypertension". Taking the counterexample as an example, input "The entity "blood pressure rises" is extracted from the input text. Please determine which entity in the medical knowledge graph it matches. If there is no match, output None + [candidate entity of the same type as the extracted entity] + [input text]" into the Qwen2 7B model, and the counterexample outputs "None". The counterexample does not include the "hypertension" entity in the candidate entities of the same type provided to the Qwen2 7B model, simulating the state that this entity has not yet been stored in the medical knowledge graph. The output of the counterexample is None, indicating that there is no entity in the current graph that matches the extraction result.

[0054] Furthermore, the training process can be divided into the part of judging the correctness of the entity and entity relationship. Taking the positive example of the training data, input "Please judge whether the extracted entity is correct + [extracted entity] + [evaluation model selected candidate entity of the same type] + [input text]" into the Qwen2 7B model, and output "correct". Taking the negative example, input "Please judge whether the extracted entity is correct + [extracted entity] + [evaluation model selected candidate entity of the same type] + [input text]" into the Qwen2 7B model, and the candidate entity of the same type does not match the extracted entity, and the output is "wrong". Use the training data of the above two parts to fine-tune the Qwen2 7B model and the relevant parameters of the Qwen2 7B model. After fine-tuning, the fine-tuned Qwen2 7B model is evaluated through an independent verification data to ensure that it performs well on new data. Common evaluation indicators can include accuracy, recall rate and F1 score.

[0055] When using the evaluation model to evaluate the entities and entity relationships extracted by the extraction model, the entities and entity relationships extracted by the extraction model, the candidate entities of the same type of the entities extracted in the medical knowledge graph, and the text where the extracted entities and entity relationships are located are input into the evaluation model together, and the extracted entities and entity relationships are matched with the candidate entities of the same type of the entities extracted in the medical knowledge graph. If no match is found, the extracted entity is a new entity to be written into the medical knowledge graph. The entities and entity relationships extracted by the extraction model, the aforementioned matching results, and the text where the extracted entities and entity relationships are located are input into the evaluation model to verify the extracted entities and entity relationships. If the verification result of the evaluation model is correct, the extracted entities and entity relationships are written into the medical knowledge graph. If the verification result of the evaluation model is incorrect, the operation of writing the extracted entities and entity relationships into the medical knowledge graph is not performed.

[0056] The third aspect of the present application provides a computer-readable storage medium, on which a program of a medical knowledge graph construction method is stored, so that the medical knowledge graph construction method provided in the first aspect of the present application is executed. As for the aforementioned computer-readable storage medium, those skilled in the art can understand that the embodiments for realizing the functions of the aforementioned system and each unit can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, it executes an embodiment including the functions of the aforementioned system and each unit. The aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM or optical disk.

[0057] In a fourth aspect, the present application provides an electronic device, comprising: at least one memory for storing programs; at least one processor for executing the programs stored in the memory. The electronic device may be a server. The electronic device comprises a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device comprises a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, the functions or steps of the medical knowledge graph construction method of the present application are implemented.

[0058] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and substitutions can be made without departing from the technical principles of the present application. These improvements and substitutions should also be regarded as the scope of protection of the present application.

Claims

1. A method for constructing a medical knowledge graph, characterized in that: include: Obtaining an extraction model for extracting entities and entity relationships in the data to be identified, the extraction model comprising a first model and a second model, wherein the first model is used to extract entities and entity relationships under a first category, and the second model is used to extract entities and entity relationships under categories other than the first category; Extracting entities and entity relationships from the data to be identified using the extraction model; Evaluate the extracted entities and entity relationships, and write or not write the extracted entities and entity relationships into the medical knowledge graph according to the evaluation results; The construction process of the first model includes: The Bert model is pre-trained using medical-related text data to obtain an initial model; wherein the pre-training of the Bert model using medical-related text data includes: obtaining the medical-related text data, the medical-related text data is a PDF of medical data, using an image recognition algorithm to perform image recognition on the image of each page of the PDF, and identifying the header, footer, page number, table, illustration, text paragraph, and title in the image; the Bert model is pre-trained by the established MLM and NSP training tasks to obtain an initial model, and the data used for pre-training is the medical-related text data; Based on the initial model, a CRF layer is added to the architecture of the initial model and the training data set is used for training to obtain the first model; wherein the process of obtaining the training data set includes: defining an outline of a medical knowledge graph, wherein the outline includes entity types and entity relationship types; using a general information extraction model, annotating the original text according to the outline of the medical knowledge graph to obtain annotated data, wherein the original text is a text containing entities and entity relationships; The second model is a large model with hundreds of billions of parameters; The evaluation of the extracted entities and entity relationships includes evaluating the extracted entities and entity relationships using an evaluation model; the construction process of the evaluation model includes: taking entities in the labeled data, simulating whether there are matching candidate entities of the same type in the extraction results in the medical knowledge graph, converting the labeled data into positive examples and negative examples according to the matching results, or converting the labeled data into positive examples and negative examples according to whether the extracted entities and entity relationships are correct; selecting the Qwen2 7B model as the basic model of the evaluation model, and training the Qwen2 7B model with the converted positive examples and negative examples as training data; evaluating the trained Qwen2 7B model using verification data, and outputting the evaluation model if the evaluation is qualified.

2. The method for constructing a medical knowledge graph according to claim 1, characterized in that: The evaluating of the extracted entities and entity relationships further includes: The entities and entity relationships extracted by the extraction model, the candidate entities of the same type of the entities extracted in the medical knowledge graph, and the texts containing the extracted entities and entity relationships are input into the evaluation model, and the extracted entities and entity relationships are matched with the candidate entities of the same type of the entities extracted in the medical knowledge graph; The entities and entity relationships extracted by the extraction model, the matching results, and the text containing the extracted entities and entity relationships are input into the evaluation model to verify the extracted entities and entity relationships; if the verification result of the evaluation model is correct, they are written into the medical knowledge graph; if the verification result of the evaluation model is wrong, they are not written into the medical knowledge graph.

3. The method for constructing a medical knowledge graph according to claim 1, characterized in that: The extracting of entities and entity relationships from the data to be identified by using the extraction model includes: Correcting and rectifying the data to be identified, wherein the data to be identified includes structured data, semi-structured data and unstructured data; The extraction model is used to extract the entities and entity relationships in the corrected data to be identified.

4. The method for constructing a medical knowledge graph according to claim 1, wherein: The extracting of entities and entity relationships from the to-be-identified data using the extraction model also includes: When the first model is used to extract entities and entity relationships from the data to be identified, corresponding entity tags are added to the texts of the data to be identified corresponding to the extracted entities.

5. A medical knowledge graph construction system, characterized in that: include: A model acquisition module, which is used to acquire an extraction model for extracting entities and entity relationships in data to be identified, wherein the extraction model includes a first model and a second model, wherein the first model is used to extract entities and entity relationships under a first category, and the second model is used to extract entities and entity relationships under other categories except the first category; the construction process of the first model includes: pre-training the Bert model using medical-related text data to obtain an initial model; based on the initial model, adding a CRF layer to the architecture of the initial model and training with a training data set to obtain the first model; the second model is a large model with a parameter quantity of hundreds of billions; An identification module, which is used to extract entities and entity relationships from the data to be identified using the extraction model; An evaluation module, which is used to evaluate the extracted entities and entity relationships, and to write or not write the extracted entities and entities into the medical knowledge graph according to the evaluation results; in, The method of using medical-related text data to pre-train the Bert model includes: obtaining the medical-related text data, the medical-related text data is a PDF of medical data, using an image recognition algorithm to perform image recognition on the image of each page of the PDF, and identifying the header, footer, page number, table, illustration, text paragraph, and title in the image; pre-training the Bert model through the established MLM and NSP training tasks to obtain an initial model, and the data used for pre-training is the medical-related text data; The process of obtaining the training data set includes: defining an outline of a medical knowledge graph, wherein the outline includes entity types and entity relationship types; using a general information extraction model to annotate original text according to the outline of the medical knowledge graph to obtain annotated data, wherein the original text is a text containing entities and entity relationships; The evaluation of the extracted entities and entity relationships includes evaluating the extracted entities and entity relationships using an evaluation model; the construction process of the evaluation model includes: taking entities in the labeled data, simulating whether there are matching candidate entities of the same type in the extraction results in the medical knowledge graph, converting the labeled data into positive examples and negative examples according to the matching results, or converting the labeled data into positive examples and negative examples according to whether the extracted entities and entity relationships are correct; selecting the Qwen2 7B model as the basic model of the evaluation model, and training the Qwen2 7B model with the converted positive examples and negative examples as training data; evaluating the trained Qwen2 7B model using verification data, and outputting the evaluation model if the evaluation is qualified.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a processor, the processor is caused to execute the method according to any one of claims 1 to 4.

7. An electronic device, characterized in that: include: at least one memory for storing a program; At least one processor is used to execute the program stored in the memory, and when the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Multi-relation medical knowledge extraction method, device and equipment and storage medium

    CN112507061A

  • Knowledge graph construction method and system based on deep learning, equipment and medium

    CN113505244A