A method and system for extracting details from electronic medical records based on semantic information

By using the Pipeline method in electronic medical record detail extraction combined with dictionary entity matching and PCNN relationship extraction methods, the problem of rule conflict and incomplete coverage in traditional rule extraction methods is solved, and more efficient and accurate detailed item extraction is achieved.

CN114239582BActive Publication Date: 2025-03-04TIANJIN HEALTH CARE BIG DATA CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111531649.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-15
Publication Date
2025-03-04
Estimated Expiration
2041-12-15

AI Technical Summary

Technical Problem

When traditional rules-based electronic medical record details extraction methods deal with natural texts that have no keywords and express a variety of expressions, they are prone to conflicts of rules and incomplete coverage of rules, resulting in large workload and low efficiency.

Method used

The electronic medical record details extraction method based on Pipeline method is adopted, combining dictionary entity matching and PCNN relationship extraction methods, and the entity extraction and relationship extraction tasks are separated to reduce the workload of rulemaking.

Benefits of technology

It effectively resolves the problems of rule conflicts and incomplete coverage, improves the efficiency and accuracy of electronic medical record details, and reduces the workload of rule-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114239582B_ABST
    Figure CN114239582B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for extracting electronic medical record details based on semantic information, which belongs to the field of natural language processing. The present invention integrates dictionary entity matching and PCNN relationship extraction methods, and is used to replace or supplement the original rule method for extracting electronic medical record details, so as to complete the task of extracting electronic medical record details from natural text without keywords and with diverse expressions. The present invention can effectively solve the problems of rule conflicts and incomplete rule coverage, and reduce the workload of rule formulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to a method and system for extracting electronic medical record details based on semantic information. Background Art

[0002] Electronic medical record parsing is the main task of medical unstructured data governance. Electronic medical record parsing is specifically divided into large-scale electronic medical record parsing and detailed electronic medical record parsing. Among them, detailed electronic medical record parsing refers to extracting detailed medical data required for business from large paragraphs of natural language. For example, in Example 1, physical signs such as height, weight, respiration, and pulse are extracted from a physical examination description.

[0003] "Body temperature: 36℃; pulse: 82 times / min; respiration: 20 times / min; blood pressure: 132 / 81 mmHg" Example 1

[0004] The traditional way to extract details from electronic medical records is through regular expressions or keyword matching. For example, for the content in Example 1, the content between the first ":" and the first ";" after the keyword "body temperature" is the body temperature content to be extracted for this physical examination. The advantage of this method is that the rules are flexible and highly interpretable. However, for the extraction of details in the chief complaint, such as in Example 2, it is necessary to extract symptoms and the duration of the corresponding symptoms.

[0005] “Coughing and wheezing for more than a week” Example 2

[0006] For the problem of extracting details from natural texts without keywords and with diverse expressions such as Example 2, if the traditional rule-based extraction method is used, a lot of rule formulation is required. In the process of rule formulation, there are inevitably problems such as rule conflicts and incomplete rule coverage. Therefore, the traditional rule-based method of extracting details is no longer suitable for the task of parsing details in natural texts of electronic medical records. Summary of the invention

[0007] Aiming at the problem of extracting details from natural text electronic medical records without keywords and with diverse expressions, the present invention provides a method for extracting details from electronic medical records based on semantic information, which solves the problems of rule conflicts and incomplete rule coverage, and reduces the workload of rule formulation.

[0008] The technical solution of the present invention is:

[0009] The present invention provides an electronic medical record item parsing method based on the semantic information of electronic medical record text. The invention integrates dictionary entity matching and PCNN relationship extraction method, and is used to replace or supplement the original rule-based electronic medical record item extraction method to complete the task of extracting electronic medical record items from natural text without keywords and with diverse expressions.

[0010] 1. Method for extracting details from electronic medical records

[0011] The method for extracting details from electronic medical records proposed in the present invention uses the Pipeline method to complete the task of extracting entities and relationships from electronic medical record text. Compared with the Joint method, the advantage of this method is that it separates the entity extraction task from the relationship extraction task. During the development process, the two tasks can be developed in parallel. In the later method improvement, the two tasks can be tested and evaluated one by one, and improved one by one. The improvement of one task will not affect the algorithm logic or parameters of the other task.

[0012] Based on the Pipeline entity relationship extraction method, the electronic medical record item extraction method will be divided into a named entity recognition method based on dictionary matching and a relationship extraction method based on PCNN.

[0013] 1.1 Named Entity Recognition Method Based on Dictionary Matching

[0014] The named entity recognition method based on dictionary matching of the present invention uses a combination of rule matching and dictionary matching to complete the named entity recognition task. The specific implementation process of the method is as follows:

[0015] Assume that the text to be matched is T, and the task needs to obtain n entity types from the text T. The entity type set is ET = {et1,et2,et3,…,et n}. Note that not every text to be matched can match all entity types in ET.

[0016] Indeterminate entity type rule matching

[0017] An entity type with an indefinite value range refers to an entity type whose time and number value ranges are infinite sets. If an entity type with an indefinite value range exists in ET, the rule matching method is used for matching, and the matched entities are fixed. The matched entities are no longer segmented in the text segmentation stage. The time type matching expressions are shown in formulas 1 and 2; the number type matching expression is shown in formula 3. In the matching process, the time type is matched first, followed by the number type.

[0018] \d{4}[--.year]\d{1,2}[--.month]\d{1,2}day* Formula 1

[0019] \d{4}[--.Year]\d{1,2}[--.Month]\d{1,2}[\sDay]+\d{1,2}[::.]\d{1,2} Formula 2

[0020] [0-9\s.]+ Formula 3

[0021] In the expression, \d represents a numeric character; the number in {} represents the number of times the previous symbol appears; the number in [] represents the characters that can appear at that position; * means that the previous character may not appear once or may appear multiple times in succession; \s represents a blank character.

[0022] Text segmentation

[0023] The text segmentation stage refers to the process of segmenting the text to be parsed. For the text segmentation task, the present invention adopts a positive maximum length segmentation strategy. The positive maximum length segmentation strategy refers to matching several consecutive characters in the text to be segmented with the vocabulary from left to right until no matching word is found in the matching vocabulary, adding a segmentation symbol to the text to obtain the segmented text T_seg.

[0024] Dictionary matching

[0025] The task of the dictionary matching stage is to compare the words in the text segment with the words in the dictionary one by one, and identify the entity types in the ET set. First, obtain the dictionary corresponding to the entity type in the ET set from the dictionary module, and then compare the word w in the text segment with the dictionary content one by one. If w is in the entity type ET n In the dictionary, w is recognized as et n Type. Finally, the entity set W in T_seg is identified as {w1,w2,…,w p}

[0026] Get the entity type and index of the matching word

[0027] Obtaining the entity type and index of the matching word means converting the matching result of the dictionary matching phase and the text to be parsed into the following form.

[0028] {text:T_seg,

[0029] entity_list:[{entity: p ,index_s:w p _index_s,index_e:w p _index_e,entity_type:

[0030] et n},……]} Formula 4

[0031] As above, w p _index_s,w p is the starting index in the sentence; w p is the ending index in the sentence.

[0032] 2 Relationship Extraction Method Based on PCNN

[0033] In the dictionary-based named entity recognition stage, the recognition task of the entity position and entity category in the sentence is completed, and the recognition result is converted into the form of Formula 4. In the relationship extraction stage, the present invention takes the entity recognition result, that is, the content of Formula 4, as input. The entities extracted in Formula 4 are paired with each other, and the relationship category of each pair of entities is classified.

[0034] The present invention improves PCNN from the perspective of model structure. The improved PCNN network with entity semantics and entity relations (PCNN_ET) adds embedding information of two entities to be extracted from the relationship and embedding information of entity types to the original model structure. This improves the network's ability to understand the semantics of the two entities to be extracted from the relationship.

[0035] The specific workflow of the relationship extraction stage is as follows:

[0036] 2.1 Get the list of relationship types to be extracted and generate entity type embeddings.

[0037] The list includes the name of the relationship type to be extracted in this task, relation_type_name, the relationship type code, relation_type_id, and the entity type pair of each relationship type (entity_type_s, entity_type_e), where entity_type_s is the starting entity type and entity_type_e is the ending entity type of the relationship type.

[0038] In named entity recognition, all entity recognition type sets ET={et1,et2,et3,…,et n}. In the relation extraction stage, a random matrix of n*word_dim between 0 and 1 is generated as the entity type embedding matrix. Each word_dim dimension vector corresponds to the entity type et i Note that once this matrix is ​​generated, it will no longer change under this task.

[0039] 2.2 Entities are paired in pairs, and the rules eliminate entity pairs that have no relationship.

[0040] First, the entities extracted from the text to be parsed in the named entity phase are paired. Then, the entity type pair consisting of the starting entity type and the ending entity type of each entity pair is checked to see if it is in the entity type pair obtained in the first step. If not, it is deleted. The final result of the entity pair to be evaluated is as follows.

[0041] [({entity_s:w1,index_s:w1_index_s,index_e:w1_index_e,entity_type:

[0042] et1,entity_type_embedding:et1_embedding},{entity_e:w2,index_s:w2

[0043] _index_s,index_e:w2_index_e,entity_type:et2,entity_type_embedding:

[0044] et2_embedding}),……] Formula 5

[0045] where (et1,et2) should be in the list of entity type pairs of the relationship type.

[0046] 2.3 Sentences to be parsed and embedding of two entities

[0047] In the present invention, the pre-trained model Bert is used for word segmentation and embedding of the sentence to be parsed and the two entities, wherein the dimension of embedding is word_dim. After word segmentation and embedding processing by Bert, an embedding matrix of the sentence to be parsed of the size of max_tokens_len*word_dim and two entity embedding matrices of the size of max_entity_len*word_dim are obtained.

[0048] Among them, max_tokens_len is the maximum number of sentence segmentations to be parsed, and max_entity_len is the maximum number of entity segmentations.

[0049] 2.4 Calculate the distance between other words in the sentence and the two entities

[0050] If the starting entity of the current entity pair is before the ending entity, use Formula 6 to calculate the distance between each word in the sentence and the two entities. If the starting entity of the current entity pair is before the ending entity, use Formula 7 to calculate the distance between each word in the sentence and the two entities.

[0051]

[0052] Where D is the position embedding of word w in the sentence, and w_index is the index of w in the sentence. The words in the sentence are combined according to their positions in the sentence to obtain the position embedding matrix of each word in the sentence. The matrix size is max_tokens_len*2.

[0053] 2.5 Combine the sentence embedding, two entity embeddings, entity type embedding, and position embedding to get the model input.

[0054] First, combine the embedding matrix of the sentence to be parsed and the position embedding matrix according to the first dimension to obtain a two-dimensional combined matrix of size max_tokens_len*(word_dim+2).

[0055] Then, a 2*2 zero matrix is ​​generated and combined with the entity type embedding matrix according to the first dimension to obtain a two-dimensional combined matrix of size 2*(word_dim+2).

[0056] Next, a (2max_entity_len)*2 zero matrix is ​​generated and combined with the two entity embedding matrices according to the first dimension to obtain a two-dimensional combined matrix of (2max_entity_len)*(word_dim+2).

[0057] Finally, the above three combined matrices are combined according to the second dimension to obtain a two-dimensional matrix of (max_tokens_len+2+2max_entity_len)*(word_dim+2) as the model input.

[0058] 2.6 Input the model into the PCNN network for relationship extraction

[0059] The obtained input matrix is ​​input into the network, and after convolution of the layer layer with kernel_n=3, the convolution output of layer*(max_tokens_len+2+2max_entity_len) is obtained. Then, segmented maximum pooling is performed at the two index positions w1_index_e and w2_index_e, and the pooling result of the layer layer is straightened to obtain a 3layer*1 vector. Next, after a linear layer, the 3layer*1 vector is converted into an m*1 matrix, where m is the number of relations required to be extracted for this task. Finally, after the softmax layer, the linear layer output is converted to between 0-1. The position of the maximum value in the softmax output corresponds to the category and the classification category of the two entities.

[0060] The present invention also provides an electronic medical record item parsing system based on electronic medical record text semantic information, comprising a text input module to be parsed, an ontology definition module, a dictionary definition module, a named entity recognition module, a relationship extraction module, and a parsed text output module;

[0061] in,

[0062] Electronic medical record item extraction system

[0063] The electronic medical record item extraction system is a typical data stream type system. The purpose of this system is to parse the large sections of electronic medical record content that are input without keywords and with diverse expressions based on the named entity recognition method of dictionary matching and the relationship extraction method based on PCNN. The system is divided into a text input module to be parsed, an ontology definition module, a dictionary definition module, a named entity recognition module, a relationship extraction module, and a parsed text output module.

[0064] Text input module to be parsed

[0065] The text to be parsed input module is the entrance to the electronic medical record item extraction system, which is used to receive the system's extraction tasks and preprocess the text to be parsed.

[0066] For the parsing task, the user needs to input the entity type and relationship type required for the current extraction task into the system through the text to be parsed input module. The text to be parsed input module will send the entity type configuration item and the relationship type configuration item to the dictionary definition module and the ontology definition module respectively. Among them, the relationship type configuration item must include the relationship type, the relationship start entity type, and the relationship end entity type.

[0067] For the preprocessing task of the text to be parsed, the text to be parsed input module will complete the preprocessing of the input text. Specifically, it includes cleaning spaces and special characters in the input text and word segmentation of sentences. Finally, the sentences that have been cleaned and word segmented are input into the named entity recognition module.

[0068] Ontology definition module

[0069] The ontology definition module is the core of the labeling system of the system, which contains the definitions of all entity types and relationships between entity types in the dictionary definition module. After obtaining the entity type and relationship type of the task configuration from the text input module to be parsed, the module finds the corresponding entity type code, relationship type code, and the start entity type code and end entity type code corresponding to each relationship type in the module. At the same time, it checks whether the entity type code and the end type code are in the entity type code list of this task, and automatically adds the entity type code that is not included in the entity type code list of this task to the entity type code list of this task.

[0070] Dictionary definition module

[0071] The dictionary definition module is the entity name reserve of the named entity recognition part. The specific reserve content includes entity types and corresponding entity names. The function of this module is to output the dictionary content of the corresponding entity type to the named entity recognition module according to the configuration of the entity type to be extracted in the task, for the named entity recognition task.

[0072] Named Entity Recognition Module

[0073] The named entity recognition module is the core module of the dictionary-based named entity recognition method stage. This module uses the rules in the dictionary matching-based named entity recognition method combined with the dictionary to perform named entity recognition on the text to be parsed after being processed by the parsed text input module. The parsing result is shown in Formula 4. The parsing result is output to the relationship extraction module.

[0074] Relation Extraction Module

[0075] The relationship extraction module is the core module of the relationship extraction stage. This module first pairs the entities identified in the named entity recognition stage, and performs preliminary rule screening on each entity pair. The starting entity type and the ending entity type pairs that are not in the starting entity type and the ending entity type pair list transmitted by the ontology module are removed. Then, the PCNN network (PCNN_ET) with entity semantics and entity relations is used to extract relations from the remaining entity pairs that may have relations. The relationship extraction results are input into the parsed text output module.

[0076] Parsing text output module

[0077] The parsed text output module is the export of the electronic medical record item extraction system. This module is used to integrate the relationship extraction results and entity recognition results and then output them. The output format is as follows

[0078]

[0079]

[0080] Where spo_list is the triple list extracted from the sentence to be parsed T_seg. subject is the starting entity, subject_index_s, subject_index_e, and subject_entity_type are the starting index, ending index, and entity type of the starting entity, respectively. object is the starting entity, object_index_s, object_index_e, and object_entity_type are the starting index, ending index, and entity type of the ending entity, respectively.

[0081] The beneficial effects of the present invention are

[0082] The present invention solves the problems of rule conflict and rule coverage in traditional rule-based electronic medical record item extraction methods in the task of extracting electronic medical record item details from natural text without keywords and with diverse expressions, while reducing the workload in the process of formulating electronic medical record parsing rules. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] Figure 1 It is a schematic diagram of the relationship between system modules of the present invention;

[0084] Figure 2 It is the schematic diagram of PCNN_ET;

[0085] Figure 3 System deployment diagram. DETAILED DESCRIPTION

[0086] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0087] The present invention provides a method and system for parsing electronic medical record details based on the semantic information of electronic medical record text. The invention integrates dictionary entity matching and PCNN relationship extraction method, and is used to replace or supplement the original rule-based method for extracting electronic medical record details, completing the task of extracting electronic medical record details from natural text without keywords and with diverse expressions.

[0088] The specific implementation of the present invention includes two parts, the first part is the construction of the relationship extraction model, and the second part is the deployment of the system. The implementation of the present invention will be described in detail from these two parts.

[0089] 1. Relationship Extraction Model Construction

[0090] The construction of the model is divided into three stages: data preprocessing, sample set division, and model training.

[0091] 1.1 Data Preprocessing

[0092] In the data preprocessing stage, the work refers to the process of converting labeled data into sample data.

[0093] First, obtain the structure of the annotated text table as shown below.

[0094]

[0095] Table 1 Annotation text table

[0096] Then, negative sampling is performed based on the above labeled samples. The specific implementation is as follows

[0097] The first step is to extract all relationship types that contain entity 1 type and entity 2 type in the sample, such as

[0098] Entity 1 type: 'surgery and operation' - Relationship type: 'execution' - Entity 2 type: 'time concept'

[0099] Entity 1 Type: 'Symptom or Sign' - Relationship Type: 'Result' - Entity 2 Type: 'Qualifier'

[0100] …

[0101] The second step is to pair the entities in the labeled samples according to the relationship types above. Note that the pairing process must strictly limit the two entity types according to the relationship type configuration in the first step. For example, according to the following relationship, the entity type of entity 1 must be "surgery and operation type" and the entity type of entity 2 must be "time concept"

[0102] Entity 1 type: 'surgery and operation' - Relationship type: 'execution' - Entity 2 type: 'time concept'

[0103] The third step is to remove the correct entity pairs in the pairwise pairing in the second step, and label the relationship type of the incorrect entity pairs as "none".

[0104] Finally, the negative sampling results are merged with the labeled result table data to form the initial sample set.

[0105] 1.2 Sample set division

[0106] The sample set division work refers to dividing the sample set obtained from the upper part into training set, test set, and validation set. In the division process, it is necessary to first check whether there is a sample imbalance problem. When a sample imbalance problem is found, sample balancing is required. The specific steps are as follows.

[0107] First, count the proportion of samples of each type of relationship in the total number of samples in the first version of the sample set Rat = {Rat1, Rat2, Rat3, ... Rat m}. Where m is the total number of relations. i is the proportion of the i-th type of relationship in the total number of samples. i When it is far lower or higher than 1 / m, it indicates that there is a sample imbalance problem in the sample set and sample balance is required. There are two specific sample balance settings:

[0108] Method 1: Maximum value balancing. That is, count the number of samples of each relationship type, and the maximum number of samples is num_max. For relationship type samples with a number less than num_max, a combination of overall replication and random sampling is used to make the number of samples of each type reach num_max. The specific rules are as follows:

[0109] Let the actual number of samples of sample type r be r_num.

[0110] If r_num = num_max, the samples are not processed.

[0111] If r_num < num_max < 2 * r_num, the part of num_max - r_num is sampled and replicated from the r-type samples in a random sampling manner.

[0112] If 2 * r_num <= num_max, all samples of r will be replicated num_max / / r_num times, and the part of num_max % r_num is sampled and replicated from the r-type samples in a random sampling manner.

[0113] Method 2: Specified value balancing. That is, change num_max in Method 1 to a set value. When the number of a certain type in the samples is greater than the set value, randomly sample num_max from this type of samples. If it is less than or equal to num_max, the rules are as described in Method 1. Here, the set value is int(N / m), where N is the total number of samples and int() represents the rounding operation.

[0114] After the sample balancing process, re-aggregate the samples of each type to form the final sample set. Then, randomly divide the sample set into a training set, a test set, and a validation set in a ratio of 8:1:1.

[0115] 1.3 Model training

[0116] After the data division is completed, enter the model training stage. The model is trained using the pytorch framework, and the specific model training parameters are set as follows.

[0117] The model configuration is as follows:

[0118] batch_size = 32

[0119] num_epochs = 20

[0120] learning_rate = 0.01

[0121] layer = 1000

[0122] loss_func = nn.CrossEntropyLoss()

[0123] After model training, a relationship extraction model file is generated and saved locally for system use.

[0124] 2 System Deployment

[0125] The hardware deployment of this system requires the following environment:

[0126] Database: relational database, not limited to Oracle, MySQL

[0127] Deployment system: Centos7

[0128] Language environment: python3.5+

[0129] Model framework: pytorch1.2.0+

[0130] The system deployment diagram is shown in the attached figure Figure 3 As shown in the figure. This figure shows the interaction between each module and the database. In the system deployment section, the specific interaction between each module and the database during the system deployment process and the table structure of the deployment table in the corresponding database will be explained in detail.

[0131] 2.1 Text input module to be parsed

[0132] The module for inputting text to be parsed needs to obtain the parsing task content from the text library to be parsed, including the text to be parsed, the entity type and relationship type content required in the task. The obtained parsing task table is as follows:

[0133]

[0134] Table 2 Text table to be parsed

[0135]

[0136] Table 3 Analysis task table

[0137] The text input module to be parsed obtains the contents of Table 2 and Table 3, naturally connects the contents of the two tables with the task_id field, groups and aggregates them with the original text field of the text table to be parsed as the key field, and inputs each group of aggregated contents into the text input module to be parsed in sequence.

[0138] The module for inputting text to be parsed first inputs the entity type and relationship type to be parsed in each set of data into the ontology definition module to obtain the corresponding encoding and the starting entity type and ending entity type of the relationship to be parsed. Then, the module for inputting text to be parsed inputs the sentences to be parsed in the task obtained by the module for named entity recognition after Jieba word segmentation, waiting for entity extraction. Note that in order to increase the medical professionalism of the Jieba word segmentation dictionary, the entity words updated in the dictionary library can be regularly added to the Jieba word segmentation as a supplementary dictionary.

[0139] 2.2 Ontology definition module

[0140] After the ontology definition module receives the entity type and relationship type to be parsed from the text input module to be parsed, it needs to obtain the entity type and relationship type codes in the ontology library and output them to the dictionary definition module and the relationship extraction module respectively. The entity type code table and relationship type code table obtained from the ontology library are shown in the following table.

[0141]

[0142] Table 4 Entity type list

[0143]

[0144] Table 5 Relationship type list

[0145] 2.3 Dictionary Definition Module

[0146] After obtaining the entity type code provided by the ontology definition module, the dictionary definition module needs to obtain the corresponding dictionary list under the entity type in the dictionary library according to the entity type code. And pass the list to the named entity recognition module. The dictionary list table structure in the dictionary library is as follows.

[0147]

[0148] Table 6 Dictionary list table structure

[0149] 2.4 Named Entity Recognition Module

[0150] After obtaining the entity type dictionary and the text to be parsed, the named entity recognition module recognizes the entities in the text to be parsed according to the named entity recognition method based on dictionary matching. The recognition results are input into the relationship extraction module and the parsed text output module in the form of formula 4.

[0151] 2.5 Relation Extraction Module

[0152] After obtaining the entity recognition results of the named entity recognition module and the information in Table 5 in the ontology definition module, the relationship extraction module pairs the entities and extracts the relationships based on the PCNN-based relationship extraction method. The relationship extraction results are input into the parsed text output module and merged with the results of the named entity recognition module.

[0153] 2.6 Parsing Text Output Module

[0154] The parsing text output module integrates the results of the relationship extraction module and the named entity recognition module, and outputs them to the parsing result library in the format of Formula 7. The table structure of the parsing result table is shown in the following table.

[0155]

[0156] Table 7 Analysis result table structure

[0157] The above description is only a preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, and is not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for extracting details from electronic medical records based on semantic information, characterized in that: The entity relationship extraction method based on Pipeline is divided into named entity recognition based on dictionary matching and relationship extraction based on PCNN; Named entity recognition based on dictionary matching, identifying the entity position and entity category in the sentence, and converting the recognition results; Based on PCNN relationship extraction, the embedding information of the two entities to be extracted and the embedding information of the entity type are added to the PCNN network model; the transformed entity recognition result content is used as input, the extracted entities are paired, and the relationship category of each pair of entities is classified; include 1) Obtain a list of relation types to be extracted and generate entity type embeddings; 2) Entities are paired, and the rules eliminate entity pairs that do not have a relationship; 3) The sentence to be parsed and the embedding of two entities; 4) Calculate the distance between other words in the sentence and the two entities; 5) Combine the sentence embedding, two entity embeddings, entity type embedding, and position embedding to get the model input; 6) Input the model into the PCNN network for relationship extraction; The list includes the name of the relationship type to be extracted in the task relation_type_name, the relationship type code relation_type_id, and the entity type pair of each relationship type (entity_type_s, entity_type_e); where entity_type_s is the starting entity type and entity_type_e is the ending entity type of the relationship type; In named entity recognition, all entity recognition type sets ET included in the task have been obtained = {et1,et2,et3,…,et n }; In the relationship extraction stage, generate n*word_dim random matrices between 0 and 1 as entity type embedding matrices; each word_dim dimension vector is the corresponding entity type et i embedding; Pair the entities extracted from the text to be parsed in the named entity phase in pairs, and then check whether the entity type pair consisting of the starting entity type and the ending entity type of each entity pair is in the acquired entity type pair; if not, delete it, and finally obtain the result of the entity pair to be evaluated; The sentence to be parsed and the two entities are segmented and embedded using the pre-trained model Bert, where the dimension of embedding is word_dim. After Bert performs word segmentation and embedding processing, the embedding matrix of the sentence to be parsed with a size of max_tokens_len*word_dim and the embedding matrix of the two entities with a size of max_entity_len*word_dim are obtained. Among them, max_tokens_len is the maximum number of sentence segmentations to be parsed, and max_entity_len is the maximum number of entity segmentations; If the starting entity of the current entity pair is before the ending entity, use the first formula below to calculate the distance between each word in the sentence and the two entities; Where D is the position embedding of word w in the sentence; w_index is the index of w in the sentence; w1_index_s is the starting index of the starting entity; w1_index_e is the ending index of the starting entity; w2_index_s is the starting index of the ending entity; w2_index_e is the ending index of the ending entity; the words in the sentence are combined according to their positions in the sentence to obtain the position embedding matrix of each word in the sentence; the matrix size is max_tokens_len*2; Combine the sentence embedding to be parsed, the two entity embeddings, the entity type embedding, and the position embedding to get the model input. First, combine the embedding matrix of the sentence to be parsed and the position embedding matrix according to the first dimension to obtain a two-dimensional combination matrix of size max_tokens_len*(word_dim+2); Then, generate a 2n*2 zero matrix and combine it with the entity type embedding matrix according to the first dimension to obtain a two-dimensional combined matrix of size 2n*(word_dim+2); Next, generate a (2max_entity_len)*2 zero matrix and combine it with the two entity embedding matrices according to the first dimension to obtain a two-dimensional combination matrix of (2max_entity_len)*(word_dim+2); Finally, the above three combined matrices are combined according to the second dimension to obtain a two-dimensional matrix of (max_tokens_len+2+2max_entity_len)*(word_dim+2) as the model input; The obtained input matrix is ​​input into the network, and after convolution with kernel_n=3, the convolution output of layer*(max_tokens_len+2+2max_entity_len) is obtained; then, segmented maximum pooling is performed at the two index positions w1_index_e and w2_index_e, and the pooling result of the layer is straightened to obtain a 3layer*1 vector; then, after a linear layer, the 3layer*1 vector is converted into an m*1 matrix, where m is the number of relations required to be extracted for the task; finally, after a softmax layer, the linear layer output is converted to between 0 and 1, and the position of the maximum value in the Softmax output corresponds to the category and the two entity classification category.

2. A system for extracting details from electronic medical records based on semantic information, characterized in that: It includes a text input module to be parsed, an ontology definition module, a dictionary definition module, a named entity recognition module, a relationship extraction module, and a parsed text output module; in, The text input module to be parsed is the entrance to the electronic medical record item extraction system, which is used to receive the extraction tasks of the system and pre-process the text to be parsed; The ontology definition module is the core of the labeling system of the system. It contains the definitions of all entity types and relationships between entity types in the dictionary definition module. After obtaining the entity type and relationship type of the task configuration from the text input module to be parsed, the module finds the corresponding entity type code, relationship type code and the starting entity type code and ending entity type code corresponding to each relationship type in the module. At the same time, it checks whether the entity type code and the ending type code are in the entity type code list of this task, and automatically adds the entity type code that is not included in the entity type code list of this task to the entity type code list of this task; The dictionary definition module is the entity name reserve of the named entity recognition part. The specific reserve content includes entity types and corresponding entity names. The function of this module is to output the dictionary content of the corresponding entity type to the named entity recognition module according to the configuration of the entity type to be extracted in the task, for the named entity recognition task; The named entity recognition module is the core module of the dictionary-based named entity recognition method stage. This module uses the rules in the dictionary matching-based named entity recognition method combined with the dictionary to perform named entity recognition on the text to be parsed after being processed by the text input module, and outputs the parsing results to the relationship extraction module; The relationship extraction module is the core module of the relationship extraction stage. This module first pairs the entities identified in the named entity recognition stage, and performs preliminary rule screening on each entity pair, removing the starting entity type and ending entity type pairs that are not in the starting entity type and ending entity type pair list transmitted by the ontology module. Then, the PCNN network with entity semantics and entity relations is used to extract relations from the remaining entity pairs that may have relations, and the relation extraction results are input into the parsed text output module. The parsed text output module is the export of the electronic medical record item extraction system. This module is used to integrate the relationship extraction results and entity recognition results and then output them; include 1) Obtain a list of relation types to be extracted and generate entity type embeddings; 2) Entities are paired, and the rules eliminate entity pairs that do not have a relationship; 3) The sentence to be parsed and the embedding of two entities; 4) Calculate the distance between other words in the sentence and the two entities; 5) Combine the sentence embedding, two entity embeddings, entity type embedding, and position embedding to get the model input; 6) Input the model into the PCNN network for relationship extraction; The list includes the name of the relationship type to be extracted in the task relation_type_name, the relationship type code relation_type_id, and the entity type pair of each relationship type (entity_type_s, entity_type_e); where entity_type_s is the starting entity type and entity_type_e is the ending entity type of the relationship type; In named entity recognition, all entity recognition type sets ET={et1,et2,et3,…,et n }; In the relationship extraction stage, generate a random matrix of n*word_dim between 0 and 1 as the entity type embedding matrix; each word_dim dimension vector is the corresponding entity type et i embedding; Pair the entities extracted from the text to be parsed in the named entity phase in pairs, and then check whether the entity type pair consisting of the starting entity type and the ending entity type of each entity pair is in the acquired entity type pair; if not, delete it, and finally obtain the result of the entity pair to be evaluated; The sentence to be parsed and the two entities are segmented and embedded using the pre-trained model Bert, where the dimension of embedding is word_dim. After Bert performs word segmentation and embedding processing, the embedding matrix of the sentence to be parsed with a size of max_tokens_len*word_dim and the embedding matrix of the two entities with a size of max_entity_len*word_dim are obtained. Among them, max_tokens_len is the maximum number of sentence segmentations to be parsed, and max_entity_len is the maximum number of entity segmentations; If the starting entity of the current entity pair is before the ending entity, use the first formula below to calculate the distance between each word in the sentence and the two entities; Where D is the position embedding of word w in the sentence; w_index is the index of w in the sentence; w1_index_s is the starting index of the starting entity; w1_index_e is the ending index of the starting entity; w2_index_s is the starting index of the ending entity; w2_index_e is the ending index of the ending entity; the words in the sentence are combined according to their positions in the sentence to obtain the position embedding matrix of each word in the sentence; the matrix size is max_tokens_len*2; Combine the sentence embedding to be parsed, the two entity embeddings, the entity type embedding, and the position embedding to get the model input. First, combine the embedding matrix of the sentence to be parsed and the position embedding matrix according to the first dimension to obtain a two-dimensional combination matrix of size max_tokens_len*(word_dim+2); Then, generate a 2n*2 zero matrix and combine it with the entity type embedding matrix according to the first dimension to obtain a two-dimensional combined matrix of size 2n*(word_dim+2); Next, generate a (2max_entity_len)*2 zero matrix and combine it with the two entity embedding matrices according to the first dimension to obtain a two-dimensional combination matrix of (2max_entity_len)*(word_dim+2); Finally, the above three combined matrices are combined according to the second dimension to obtain a two-dimensional matrix of (max_tokens_len+2+2max_entity_len)*(word_dim+2) as the model input; The obtained input matrix is ​​input into the network, and after convolution with kernel_n=3, the convolution output of layer*(max_tokens_len+2+2max_entity_len) is obtained; then, segmented maximum pooling is performed at the two index positions w1_index_e and w2_index_e, and the pooling result of the layer is straightened to obtain a 3layer*1 vector; then, after a linear layer, the 3layer*1 vector is converted into an m*1 matrix, where m is the number of relations required to be extracted for the task; finally, after a softmax layer, the linear layer output is converted to between 0 and 1, and the position of the maximum value in the Softmax output corresponds to the category and the two entity classification category.

3. The system according to claim 2, characterized in that For the parsing task, the user needs to input the entity type and relationship type required for the current extraction task through the to-be-parsed text input module. The to-be-parsed text input module will send the entity type configuration item and the relationship type configuration item to the dictionary definition module and the ontology definition module respectively; among which, the relationship type configuration item needs to include the relationship type, the relationship start entity type, and the relationship end entity type; For the preprocessing task of the text to be parsed, the text to be parsed input module will complete the preprocessing of the input text, including cleaning of spaces and special characters in the input text, and word segmentation of sentences; finally, the sentences that have completed cleaning and word segmentation will be input into the named entity recognition module.

4. The system according to claim 2, characterized in that The output format of the parsed text output module is as follows {text:T_seg, spo_list:[ {subject:wi, subject_index_s:wi_index_s, subject_index_e:wi_index_e, subject_entity_type:eti, object:wj, object_index_s:wj_index_s, object_index_e:wj_index_e, object_entity_type:etj, predicate:relation_type},……] } Where spo_list is a list of triples extracted from the sentence to be parsed T_seg; subject is the starting entity, subject_index_s, subject_index_e, and subject_entity_type are the starting index, ending index, and entity type of the starting entity respectively; object is the starting entity, object_index_s, object_index_e, and object_entity_type are the starting index, ending index, and entity type of the ending entity, respectively.

Citation Information

Patent Citations

  • Electronic medical record named entity identification method and system fusing deep learning and rules

    CN112001177A

  • Text entity relationship extraction method based on multi-feature information enhancement

    CN112163425A