Electronic medical record feature extraction method based on natural language processing
By preprocessing electronic medical record text and using the fine-tuned BERT model for entity recognition and relationship extraction, the problem of difficulty in processing unstructured text in electronic medical records in the existing technology is solved, and efficient medical feature extraction and data structuring are achieved, supporting Clinical decision-making and medical research.
Patent Information
- Application Number
- CN202411520697.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-24
AI Technical Summary
When processing unstructured text of electronic medical records, the prior art lacks professional preprocessing methods for the medical field and cannot effectively standardize medical terms, resulting in low accuracy in entity recognition and insufficient relationship extraction capabilities.
By cleaning the original electronic medical record text, standardization of medical terms, Chinese words and word -based marks, the pre -processing text data is generated. Then, the pre -training BERT model of fine -tuning medical corpus is used for medical entity identification, combined with the self -attention mechanism to build a relationship extraction model, generate the triole of the physical relationship, and store it in the database of the graph.
It has improved the accuracy and recall rate of medical entity recognition, enhanced the accuracy and comprehensiveness of the extraction of relations, and the generated structured data facilitates subsequent query and analysis, and supports clinical decisions and medical research.
Smart Images

Figure CN119361058A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical information processing and natural language processing, and in particular to a method for extracting features from electronic medical records based on natural language processing. Background Art
[0002] With the rapid development of information technology and the medical industry, Electronic Medical Record (EMR) has become the main way for medical institutions to record and manage patient information. Electronic medical records contain a large amount of medical data such as patients' basic information, diagnosis results, treatment plans, and test data. These data are of great significance for improving the quality of medical services, supporting clinical decision-making, and promoting medical research. However, a large amount of information in electronic medical records exists in the form of unstructured text. How to efficiently extract valuable medical features from it has become a hot topic and difficulty in current research.
[0003] In recent years, deep learning-based pre-trained models (such as BERT) have performed well in various natural language processing tasks. However, the medical field has complex professional terminology, many synonyms, and frequent abbreviations, which brings challenges to text processing. Traditional text processing methods have low accuracy and poor generalization ability in medical entity recognition and relationship extraction, and are difficult to meet the needs of actual applications. In addition, the lack of effective medical terminology standardization means leads to inconsistency in the extracted medical entities, affecting subsequent data analysis and application.
[0004] Existing technologies mainly face the following problems when processing unstructured text in electronic medical records: First, there is a lack of professional preprocessing methods for the medical field, and medical terminology cannot be effectively standardized; second, the existing entity recognition models do not fully utilize medical corpus for fine-tuning, resulting in low recognition accuracy; third, the relationship extraction model does not adequately capture complex medical entity relationships, affecting the extraction effect of entity relationships. Summary of the invention
[0005] The purpose of this section is to summarize some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the abstract of the specification and the title of the invention of this application to avoid blurring the purpose of this section, the abstract of the specification and the title of the invention, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0006] In view of the above existing problems, the present invention is proposed.
[0007] Therefore, the technical problem solved by the present invention is: the problem that it is difficult to extract unstructured text information from electronic medical records in the prior art.
[0008] In order to solve the above technical problems, the present invention provides the following technical solutions: the original electronic medical record text is cleaned, medical terminology is normalized, Chinese word segmentation and part-of-speech tagging are performed, and pre-processed text data D is generated;
[0009] Based on the pre-trained BERT model of fine-tuned medical corpus, medical entity recognition is performed on the pre-processed text data to extract the medical entity set E;
[0010] A relation extraction model is constructed based on the self-attention mechanism to extract relations from the extracted medical entity set E and generate an entity relation triple set R;
[0011] The medical entity set E and the entity relationship triple set R are stored in a graph database, and an API interface is provided for query and analysis.
[0012] As a preferred solution of the method for extracting features from electronic medical records based on natural language processing according to the present invention, the step of generating preprocessed text data D includes:
[0013] Use regular expressions and string processing techniques to clean electronic medical record texts, remove noise characters, correct typos, and standardize dates and values;
[0014] Use standard medical terminology to build term mapping dictionaries and standardize medical terminology;
[0015] The Bi-LSTM and CRF models based on deep learning are used to perform Chinese word segmentation and part-of-speech tagging on the electronic medical record text to generate preprocessed text data D.
[0016] As a preferred solution of the method for extracting electronic medical record features based on natural language processing according to the present invention, the extracted medical entity set E includes:
[0017] Using a pre-trained BERT model fine-tuned on medical corpus, the pre-processed text data D is encoded to obtain a context representation H;
[0018] Add a classification layer and a CRF layer on top of the pre-trained BERT model, perform entity category prediction on each word, and generate a label sequence Y;
[0019] The medical entity set E is extracted according to the label sequence Y.
[0020] As a preferred solution of the method for extracting electronic medical record features based on natural language processing described in the present invention, it specifically includes:
[0021] Input the preprocessed word sequence and its corresponding part-of-speech sequence into the fine-tuned pre-trained BERT model;
[0022] The pre-trained BERT model generates a context encoding representation H = {h1,h2,...,h n}, where h i ∈R d , d is the hidden layer dimension;
[0023] Add a linear classification layer on top of the pre-trained BERT model to represent each word h i Predict entity categories, including diseases, drugs, symptoms, and test indicators;
[0024] Using the conditional random field CRF layer, considering the dependencies between labels, we can find the optimal label sequence Y = {y1, y2, ..., y n};
[0025] According to the label sequence Y, the words that are continuously labeled as the same entity category are combined to form a medical entity set E = {e1, e2, ..., e m}.
[0026] As a preferred solution of the method for extracting electronic medical record features based on natural language processing according to the present invention, the step of generating the entity relationship triple set R includes:
[0027] A relation extraction model is constructed based on the self-attention mechanism to encode the medical entity set E and obtain the entity representation V;
[0028] For entity pairs (e i ,e j ) Computational relation representation r ij , predict the relationship category through the fully connected layer and Softmax function;
[0029] Based on the prediction results, a set R of entity relationship triples is generated.
[0030] As a preferred solution of the method for extracting electronic medical record features based on natural language processing described in the present invention, it specifically includes:
[0031] Embed medical entities into table V = {v1, v2, ..., v m}Combined with the encoded representation of the original text as the model input;
[0032] Add location information to each entity to identify the location relationship of the entity in the text;
[0033] For the entities in the medical entity set E, two entities are combined to generate entity pairs {(e i ,e j )};
[0034] For the entity pair (e i ,ej ), which represents the vector (v i ,v j ) to generate the relation representation r ij .
[0035] As a preferred solution of the method for extracting electronic medical record features based on natural language processing described in the present invention, the method further includes:
[0036] Denote the relationship as r ij Input the fully connected layer, pass the activation function, and predict the relationship category of the entity pair;
[0037] According to the predicted relationship category, the relationship with the highest probability exceeding the threshold θ is selected to generate a set of entity relationship triples:
[0038] R = {(e i ,rel k ,e j )|P(k|r ij )≥θ}
[0039] Among them, k is the relationship category label, P(k|r ij ) is an entity pair (e i ,e j )’s relationship category probability distribution, rel k is the name of the relation whose relation category is k.
[0040] As a preferred solution of the electronic medical record feature extraction method based on natural language processing described in the present invention, the Neo4j graph database is used to store the medical entity set E and the entity relationship set R in the form of nodes and relationships.
[0041] As a preferred solution of the method for extracting electronic medical record features based on natural language processing described in the present invention, it includes:
[0042] Traverse the medical entity set E, create a node for each entity, and set the node attributes;
[0043] Traverse the entity relationship set R, create a relationship for each entity pair, connect the corresponding entity nodes, and set the relationship attributes;
[0044] Use RESTful API or GraphQL interface for external system access and query.
[0045] Beneficial effects of the present invention:
[0046] 1. Through the above preprocessing steps, high-quality and standardized text data is generated, which provides a reliable data basis for subsequent medical entity recognition and improves the input quality of the model, thus helping to improve the accuracy and efficiency of the overall system;
[0047] 2. Using the fine-tuned BERT model, the accuracy and recall of entity recognition are improved, missed detection and false detection are reduced, and the performance and reliability of the system are improved;
[0048] 3. Through relationship extraction, a set of entity relationship triples is generated, which enriches the structured information of the data, facilitates subsequent query and analysis, and improves the accuracy and comprehensiveness of relationship extraction;
[0049] 4. The entity and relationship data stored in the graph database, combined with the API interface, provides a solid data foundation for clinical decision support, medical quality control, and scientific research analysis, and improves the availability and value of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0051] Figure 1 Schematic diagram of the process of the electronic medical record feature extraction method based on natural language processing shown in the present invention. DETAILED DESCRIPTION
[0052] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.
[0053] Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without making any creative work should fall within the scope of protection of the present invention.
[0054] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0055] According to an embodiment of the present invention, Figure 1 The flowchart shown is a method for extracting features from electronic medical records based on natural language processing, which specifically includes the following steps:
[0056] S1. Clean the original electronic medical record text, normalize medical terms, perform Chinese word segmentation and part-of-speech tagging, and generate pre-processed text data D. It should be noted that the generation of pre-processed text data D includes:
[0057] Use regular expressions and string processing techniques to clean electronic medical record texts, remove noise characters, correct typos, and standardize dates and values;
[0058] Use standard medical terminology to build term mapping dictionaries and standardize medical terminology;
[0059] The Bi-LSTM and CRF models based on deep learning are used to perform Chinese word segmentation and part-of-speech tagging on the electronic medical record text to generate preprocessed text data D.
[0060] As an example, regular expressions and string processing techniques are used to clean the original electronic medical record text. The steps are as follows:
[0061] Remove noise characters: remove special symbols (such as "#", "$", "%"), HTML tags, repeated spaces and invisible characters;
[0062] Correct typos: Use the typo dictionary to replace common typos with correct words;
[0063] Standardize dates and numbers: Convert dates, times, and numbers in different formats into a standard format, for example, convert "July 5, 2021" to "2021-07-05".
[0064] As an example, to map non-standard medical terms in electronic medical records to a standard medical terminology library, the steps are as follows:
[0065] Construct a mapping dictionary: Use standard medical terminology libraries (such as SNOMED CT, ICD-10) and common terms within the hospital to establish a term mapping dictionary, including mapping relationships between synonyms, abbreviations, and colloquial names;
[0066] Term matching: directly match the terms in the electronic medical record text and replace them with standard terms in the mapping dictionary; use edit distance algorithms (such as Levenshtein distance) or similarity calculations to match possible non-standard terms and replace them.
[0067] As an example, we use a natural language processing tool based on deep learning to segment and tag text. The steps are as follows:
[0068] Chinese word segmentation: Use a model based on bidirectional long short-term memory network (Bi-LSTM) and conditional random field (CRF) to accurately segment the text and generate a word sequence W = {w1,w2,...,wn};
[0069] Part-of-speech tagging: For the word sequence W, use the same model to perform part-of-speech tagging, and get the part-of-speech sequence P = {p1, p2, ..., p n}, where p i (part-of-speech tag of the i-th word) represents word w i (i.e., the i-th word) part-of-speech sequence, such as noun, verb, or adjective.
[0070] As an example, the word segmentation and part-of-speech tagging results are integrated to form structured preprocessed text data, usually represented in the form of bigrams:
[0071] D={(w1,p1),(w2,p2),...,(w n ,p n )}
[0072] Among them, D is the preprocessed text data, a binary sequence of words and part-of-speech tags, which will be used as input for subsequent entity recognition.
[0073] S2. Based on the pre-trained BERT model of fine-tuned medical corpus, perform medical entity recognition on the pre-processed text data and extract the medical entity set E. It should be noted that in this step, the extracted medical entity set E includes:
[0074] Using the pre-trained BERT model fine-tuned on medical corpus, the pre-processed text data D is encoded to obtain the context representation H;
[0075] Add a classification layer and a CRF layer on top of the pre-trained BERT model to predict the entity category of each word and generate a label sequence Y;
[0076] Extract the medical entity set E according to the label sequence Y.
[0077] In an optional implementation, a BERT (Bidirectional Encoder Representations from Transformers) pre-trained model is used because it has strong context understanding capabilities and is suitable for processing complex medical texts;
[0078] Medical Corpus Fine-tuning:
[0079] Corpus collection: Collect large-scale medical texts, including medical papers, textbooks, and electronic medical record samples;
[0080] Fine-tuning process:
[0081] Pre-training task: Masked Language Model (MLM), randomly masking some words, and the model predicts the masked words based on the context;
[0082] Next Sentence Prediction (NSP): Determine whether two paragraphs of text are continuous;
[0083] Optimization algorithm: Use the AdamW optimizer, set an appropriate learning rate (such as 2e-5), perform model training, and minimize the pre-training objective function;
[0084] Model saving: Save the fine-tuned BERT model for use in subsequent entity recognition steps;
[0085] Entity recognition: Input the preprocessed word sequence W and its corresponding part-of-speech sequence P into the fine-tuned pre-trained BERT model;
[0086] The pre-trained BERT model generates a context encoding representation H = {h1,h2,...,h n}, where h i ∈R d , d is the hidden layer dimension;
[0087] Add a linear classification layer on top of the pre-trained BERT model to represent each word h i Predict entity categories, including diseases, drugs, symptoms, and test indicators;
[0088] Its mathematical expression formula is:
[0089] o ij =W r r ij +b r
[0090] P(k|r ij )=Softmax(o ij )
[0091] Among them, W e ∈R c×d , b e ∈R c , c is the number of entity categories, P(k|r ij ) is the word w i the probability distribution of belonging to each entity class;
[0092] Using the conditional random field CRF layer, considering the dependencies between labels, we can find the optimal label sequence Y = {y1, y2, ..., y n};
[0093] According to the label sequence Y, the words that are continuously labeled as the same entity category are combined to form a medical entity set E = {e1, e2, ..., e m}.
[0094] S3. Build a relation extraction model based on the self-attention mechanism, extract relations from the extracted medical entity set E, and generate an entity relation triple set R. It should be noted that the entity relation triple set R is generated, including:
[0095] A relation extraction model is constructed based on the self-attention mechanism to encode the medical entity set E and obtain the entity representation V;
[0096] For entity pairs (e i ,e j ) Computational relation representation r ij , predict the relationship category through the fully connected layer and Softmax function;
[0097] Based on the prediction results, a set R of entity relationship triples is generated.
[0098] As an example, embed medical entities into a table V = {v1, v2, ..., v m}Combined with the encoded representation of the original text as the model input;
[0099] Add location information to each entity to identify the location relationship of the entity in the text;
[0100] For the entities in the medical entity set E, we combine them two by two to generate entity pairs {(e i ,e j )};
[0101] For the entity pair (e i ,e j ), which represents the vector (v i ,v j ) to generate the relation representation r ij ;
[0102] The formula means:
[0103] r ij =[v i ;v j ;v i ⊙v j ;|v i -v j |
[0104] Among them, ⊙ represents the element-wise product, |v i -v j | indicates the absolute value of the vector difference;
[0105] Represent the relationship r ij Input the fully connected layer, pass the activation function, and predict the relationship category of the entity pair;
[0106] The formula means:
[0107] o ij =W r r ij +b r
[0108] P(k|r ij )=Softmax(o ij )
[0109] Among them, W r ∈R l×d′ , b r ∈R l , l is the number of relationship categories, d′ is the dimension of relationship representation;
[0110] According to the predicted relationship category, the relationship with the highest probability exceeding the threshold θ is selected to generate a set of entity relationship triples:
[0111] R = {(e i ,r e l k ,e j )|P(k|r ij )≥θ}
[0112] Among them, k is the relationship category label, P(k|r ij ) is an entity pair (e i ,e j )’s relationship category probability distribution, rel k is the name of the relation whose relation category is k.
[0113] S4. Store the medical entity set E and the entity relationship triple set R in the graph database and provide an API interface for query and analysis. The following points need to be explained in this step:
[0114] Using Neo4j graph database, the medical entity set E and entity relationship set R are stored in the form of nodes and relationships;
[0115] Traverse the medical entity set E, create a node for each entity, and set the node attributes;
[0116] Traverse the entity relationship set R, create a relationship for each entity pair, connect the corresponding entity nodes, and set the relationship attributes.
[0117] As an example, Node: medical entity E, each node contains the attributes of the entity, such as name, category, and description.
[0118] As an example, Relationship: The entity relationship triple R, where each relationship contains a relationship type and attributes.
[0119] As an example, use RESTful API or GraphQL interface for external systems to access and query. The example code of Cypher query language is as follows:
[0120] / / Create a node
[0121] CREATE(e:Entity{name:'Zhang San',type:'Patient'});
[0122] / / Create a relationship
[0123] MATCH(e1:Entity{name:'Zhang San'}),(e2:Entity{name:'Type 2 Diabetes'})
[0124] CREATE(e1)-[:Suffers from]->(e2)
[0125] The following combines some preferred or optional examples of the present invention to more specifically describe the implementation process and / or effects of certain instances of the present invention.
[0126] Taking the diabetic patient Zhang San as an example, this example will combine the foregoing technical solutions to detail how to extract features from the electronic medical record of the diabetic patient Zhang San, aiming to reflect the implementation process of feature extraction. Through this example, the effectiveness and feasibility of this technical solution in actual medical scenarios can be verified.
[0127] Original electronic medical record text: Patient name (Zhang San), gender (male), age (45 years old), chief complaint (polydipsia and polyuria for 3 months), past medical history (type 2 diabetes for 10 years, hypertension for 5 years), medication history (long-term use of metformin, recently started using insulin), examination results (fasting blood glucose 12.5 mmol / L), blood pressure (150 / 95 mmHg), doctor's diagnosis (type 2 diabetes, hypertension), treatment plan (continue insulin treatment, recommend controlling diet and strengthening exercise);
[0128] Cleaning steps:
[0129] Remove redundant punctuation: Unify Chinese comma “,” and English comma “,”, and remove redundant spaces;
[0130] Standardize numerical units: Unify “12.5 mmol / L” to “12.5 mmol / L”, and unify “150 / 95 mmHg” to “150 / 95 mmHg”;
[0131] Correct typos: Check and correct possible typos;
[0132] Cleaned text: Patient name: Zhang San, male, 45 years old, Chief complaint: polydipsia and polyuria for 3 months, Past medical history: Type 2 diabetes for 10 years, hypertension for 5 years, Medication history: Long-term use of metformin, recently started using insulin, Examination results: Fasting blood sugar 12.5mmol / L, blood pressure 150 / 95mmHg, Doctor's diagnosis: Type 2 diabetes, hypertension, Treatment plan: Continue insulin treatment, recommend diet control and exercise;
[0133] Build a term mapping dictionary:
[0134] Collect standard terms: collect standard disease, drug, symptom, and test indicator terms from standard medical terminology libraries such as SNOMED CT and ICD-10;
[0135] Establish mapping relationships: for example, map "hypertension" to "essential hypertension" and "metformin" to "metformin hydrochloride tablets";
[0136] Standardization of terms: standardize "type 2 diabetes" to "type 2 diabetes" (already a standard term, no need to change), standardize "metformin" to "metformin hydrochloride tablets", standardize "insulin" to "recombinant human insulin", and standardize "fasting blood sugar" to "blood sugar (fasting)";
[0137] Normalized text: Patient name: Zhang San, male, 45 years old, main complaint: polydipsia and polyuria for 3 months, past medical history: type 2 diabetes for 10 years, primary hypertension for 5 years, medication history: long-term use of metformin hydrochloride tablets, recently started using recombinant human insulin, examination results: blood sugar (fasting) 12.5mmol / L, blood pressure 150 / 95mmHg, doctor's diagnosis: type 2 diabetes, primary hypertension. Treatment plan: continue recombinant human insulin treatment, it is recommended to control diet and strengthen exercise;
[0138] Use the Bi-LSTM+CRF model for word segmentation and part-of-speech tagging. The results of word segmentation and part-of-speech tagging are stored in a table and integrated to form text data D.
[0139] Input the preprocessed word sequence W and part-of-speech sequence P into the fine-tuned BERT model and calculate the unnormalized score vector:
[0140] o i =W e h i +b e
[0141] Among them, W e ∈R c×d , c is the number of entity categories, b e∈R c ;
[0142] Get entity category probability distribution through Softmax:
[0143] P(y i |h i )=Softmax(o i )
[0144] Using the CRF layer, considering the transition probability between labels, we can get the optimal label sequence Y = {y1, y2, ..., y n};
[0145] Extract medical entity E according to label sequence Y;
[0146] Table 1. List of extracted medical entities
[0147]
[0148]
[0149] For the extracted entity E, the vector representation V = {v1, v2, ..., b m}, where n is the number of entities;
[0150] Entity pair combination: Generate all possible entity pairs (e i ,e j );
[0151] Relational representation calculation:
[0152] r ij =[v i ;v j ;v i ⊙v j ;|v i -v j |
[0153] Relationship Prediction:
[0154] Calculate the unnormalized score vector: o ij =W r r ij +b r
[0155] Get the probability distribution of relationship categories: P(k|r ij )=Softmax(o ij );
[0156] Generate entity relationship triples: According to the probability threshold θ (for example, 0.5), select the qualified relations to form the relation set R;
[0157] Table 2. List of Extracted Entity Relationship Triples
[0158]
[0159]
[0160] Construct a graph database: Use the Neo4j graph database;
[0161] Create nodes: Create nodes for each entity and set attributes;
[0162] Store medical entities in the graph database in the form of nodes as shown in Table 3 below:
[0163] Table 3. Created Nodes and Their Attribute Tables
[0164]
[0165]
[0166] Create relationships: Create relationship edges according to the entity relationship triples;
[0167] Store the relationships between entities in the graph database in the form of edges as shown in Table 4 below:
[0168] Table 4. Created Relationship Table
[0169]
[0170]
[0171] Example queries:
[0172] Query 1: Query all diseases of Zhang San
[0173] Query statement:
[0174] MATCH(p:Patient{name:'Zhang San'})-[:HAS_DISEASE]->(d:Disease)
[0175] RETURN d.name;
[0176] Query result: Type 2 diabetes, essential hypertension
[0177] Query 2: Query the latest blood glucose results of Zhang San
[0178] Query statement:
[0179] MATCH(p:Patient{name:'Zhang San'})-[:UNDERGOES_TEST]->(t:Test{name:'Fasting Blood Glucose'})-[:HAS_RESULT]->(r:Result)
[0180] RETURN r.value
[0181] ORDER BY r.date DESCLIMIT 1;
[0182] Query result: 12.5 mmol / L.
[0183] Preferably, through the application description of the process steps in the above embodiments, the feature extraction and structured storage of Zhang San's electronic medical record are realized, and the following beneficial effects are achieved:
[0184] Unstructured electronic medical record text is converted into structured data, which facilitates information retrieval and analysis and improves data utilization rate;
[0185] By using the BERT model and relation extraction model fine-tuned in the medical field, medical entities and relations are accurately identified, improving the accuracy of information extraction;
[0186] Doctors can quickly query patients' medical histories, medication histories, and test results to assist in clinical decision-making. For example, the system can prompt doctors to pay attention to the patient's high blood sugar level and recommend adjusting the insulin dose.
[0187] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered within the scope of the claims of the present invention.
Claims
1. A method for extracting features from electronic medical records based on natural language processing, characterized in that: include: Clean the original electronic medical record text, normalize medical terms, perform Chinese word segmentation and part-of-speech tagging, and generate preprocessed text data D; Based on the pre-trained BERT model of fine-tuned medical corpus, medical entity recognition is performed on the pre-processed text data to extract the medical entity set E; A relation extraction model is constructed based on the self-attention mechanism to extract relations from the extracted medical entity set E and generate an entity relation triple set R; The medical entity set E and the entity relationship triple set R are stored in a graph database, and an API interface is provided for query and analysis.
2. The method for extracting electronic medical records features based on natural language processing according to claim 1, characterized in that: The generating of the preprocessed text data D comprises: Use regular expressions and string processing techniques to clean electronic medical record texts, remove noise characters, correct typos, and standardize dates and values; Use standard medical terminology to build term mapping dictionaries and standardize medical terminology; The Bi-LSTM and CRF models based on deep learning are used to perform Chinese word segmentation and part-of-speech tagging on the electronic medical record text to generate preprocessed text data D.
3. The method for extracting electronic medical records features based on natural language processing according to claim 1 or 2, characterized in that: The extracting of the medical entity set E includes: Using a pre-trained BERT model fine-tuned on medical corpus, the pre-processed text data D is encoded to obtain a context representation H; Add a classification layer and a CRF layer on top of the pre-trained BERT model, perform entity category prediction on each word, and generate a label sequence Y; The medical entity set E is extracted according to the label sequence Y.
4. The method for extracting electronic medical record features based on natural language processing according to claim 3 is characterized in that: Specifically include: Input the preprocessed word sequence and its corresponding part-of-speech sequence into the fine-tuned pre-trained BERT model; The pre-trained BERT model generates a context encoding representation H = {h1,h2,...,h n }, where h i ∈R d , d is the hidden layer dimension; Add a linear classification layer on top of the pre-trained BERT model to represent each word h i Predict entity categories, including diseases, drugs, symptoms, and test indicators; Using the conditional random field CRF layer, considering the dependencies between labels, we can find the optimal label sequence Y = {y1, y2, ..., y n }; According to the label sequence Y, the words that are continuously labeled as the same entity category are combined to form a medical entity set E = {e1, e2, ..., e m }.
5. The method for extracting electronic medical record features based on natural language processing according to claim 1, characterized in that: The generating entity relationship triple set R comprises: A relation extraction model is constructed based on the self-attention mechanism to encode the medical entity set E and obtain the entity representation V; For entity pairs (e i ,e j ) Computational relation representation r ij , predict the relationship category through the fully connected layer and Softmax function; Based on the prediction results, a set R of entity relationship triples is generated.
6. The method for extracting electronic medical record features based on natural language processing according to claim 5, characterized in that: Specifically include: Embed medical entities into table V = {v1, v2, ..., v m }Combined with the encoded representation of the original text as the model input; Add location information to each entity to identify the location relationship of the entity in the text; For the entities in the medical entity set E, two entities are combined to generate entity pairs {(e i ,e j )}; For the entity pair (e i ,e j ), which represents the vector (v i ,v j ) to generate the relation representation r ij .
7. The method for extracting electronic medical record features based on natural language processing according to claim 6, characterized in that: Also includes: Denote the relationship as r ij Input the fully connected layer, pass the activation function, and predict the relationship category of the entity pair; According to the predicted relationship category, the relationship with the highest probability exceeding the threshold θ is selected to generate a set of entity relationship triples: R={(and i ,rel k ,And j )|P(k|r ij )≥θ} Among them, k is the relationship category label, P(k|r ij ) is an entity pair (e i ,e j )’s relationship category probability distribution, rel k is the name of the relation whose relation category is k.
8. The method for extracting electronic medical record features based on natural language processing according to claim 1, characterized in that: The Neo4j graph database is used to store the medical entity set E and the entity relationship set R in the form of nodes and relationships.
9. The method for extracting electronic medical record features based on natural language processing according to claim 8, characterized in that: include: Traverse the medical entity set E, create a node for each entity, and set the node attributes; Traverse the entity relationship set R, create a relationship for each entity pair, connect the corresponding entity nodes, and set the relationship attributes; Use RESTful API or GraphQL interface for external system access and query.
Citation Information
Patent Citations
Electronic medical record text named entity recognition method based on pre-trained language model
CN110705293A
Cardiovascular disease medical record structuring system based on NLP
CN114530223A
Power distribution network fault handling knowledge graph construction method and device
CN115129892A
Medical text data processing method and device
CN116737924A
Knowledge graph construction method and device and readable storage medium
CN116955634A
Cited By
Structured Chinese electronic medical record generation method, system and device and storage medium
CN119694472A
Electronic medical record information extraction method, system and equipment and storage medium
CN119740558A
Method, System, Device and Storage Medium for Extracting Electronic Medical Record Information
CN119740558B
Cloud native medical service platform construction method and device, equipment and storage medium
CN120199399A
Method for extracting and converting natural language in medical record text
CN120581217A