Chronic disease electronic medical record interpretable text analysis method based on natural language processing
By employing natural language processing and interpretable artificial intelligence technologies based on the Transformer model, the problems of insufficient extraction and interpretability of chronic disease information in electronic health records have been solved, achieving efficient and accurate automated analysis and interpretable output, thus enhancing clinical acceptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 杨雨菡
- Filing Date
- 2026-01-17
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies struggle to efficiently and cost-effectively extract and structure information related to chronic diseases from electronic health records (EHRs), and the limited interpretability of deep learning models restricts their clinical acceptability.
We employ a natural language processing approach based on a pre-trained Transformer model, combined with a sliding window or global-local attention mechanism to process long texts. We also incorporate interpretable artificial intelligence (XAI) technology, using active learning and semi-supervised strategies to reduce annotation costs and achieve automated analysis and interpretable output of electronic medical records for chronic diseases.
It enables efficient and accurate extraction of key clinical entities from unstructured electronic medical records, provides interpretable output, enhances clinical trust, reduces annotation costs, and improves the accuracy of disease risk prediction and the interpretability of the model.
Smart Images

Figure CN121938540A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to medical information processing, and more particularly to a method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing. Background Technology
[0002] With the widespread application of electronic health records (EHRs) in clinical practice and medical research, information extraction techniques based on natural language processing (NLP) have become a core method for extracting key clinical information such as medical history, symptoms, functional status, and pathological examination results from massive amounts of unstructured clinical text. In recent years, pre-trained language models based on deep learning (such as the BERT series and its clinical variants), supervised named entity recognition (NER) and classification models, and hybrid schemes combining active learning and lightweight distillation techniques have shown good performance in various clinical scenarios, including emergency triage, stroke prognosis assessment, New Heart Failure (HF) functional classification (NYHA) identification, and tumor gene mutation status identification. Meanwhile, to explain model decisions and improve clinical acceptability, researchers have introduced explainable artificial intelligence (XAI) methods such as SHAP based on game theory, and evaluated the consistency and usability of explanations through expert comparison (such as blind testing or Turing tests). These studies demonstrate that NLP technology has significant application value in improving the efficiency of clinical documentation, supporting clinical decision-making, screening clinical trial candidates, and conducting multi-center studies.
[0003] Given that a large amount of key information in electronic medical records exists in free text form, such as chief complaints, past medical history, physical signs, functional status, and medications, it is difficult to utilize it in a structured manner. Existing methods often rely on manual annotation or rules, which is time-consuming and labor-intensive; traditional machine learning struggles to handle long texts and contexts (especially cross-sentence negation, historical information, family history, etc.); deep learning models, while high-performing, are "black boxes," limiting their clinical acceptability; labeled data is scarce, and model generalization and construction costs are high. Summary of the Invention
[0004] Purpose of the Invention: The purpose of this invention is to provide an interpretable text analysis method for electronic medical records (EHRs) of chronic diseases based on natural language processing. This method can automatically extract chronic disease-related elements (diagnosis, complications, symptoms, functional assessment, social determinants, etc.) from unstructured EHR text and output them in a structured manner. Based on the text and structured data, it can predict the occurrence or progression of diseases (such as type 2 diabetes, COPD, heart failure progression, etc.), provide interpretable output (word / phrase importance, local / global impact, interactive visualization) to enhance clinical trust, reduce the cost of manual annotation (using active learning and semi-supervised strategies), and can be deployed in real-world scenarios in medical institutions, meeting privacy and security requirements.
[0005] Technical solution: A method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing, including the following steps: S1. Data Access and Desensitization: Access raw data containing unstructured text and structured data from the electronic medical record system, and desensitize sensitive personal information in the raw data; S2. Text preprocessing: The desensitized unstructured text is processed by sentence segmentation, word segmentation, medical terminology standardization, and synonym mapping. S3. Model Training and Prediction: The pre-trained Transformer model is used to encode the preprocessed text to obtain a text vector representation; based on the text vector representation, clinical entities related to chronic diseases are extracted through the named entity recognition branch, and the disease risk prediction results are output through the text classification branch; at the same time, the encoded structured data is fused with the text vector representation to jointly participate in the generation of the disease risk prediction results. S4. Explainability Analysis: The output of the model training and prediction steps is analyzed using interpretable artificial intelligence methods to generate word-level or fragment-level contribution assessments for the clinical entity extraction results and / or the disease risk prediction results. S5. Output Results: Output the structured clinical entity extraction results, disease risk prediction results, and their corresponding interpretability analysis results.
[0006] Furthermore, the Transformer model is a model capable of processing long texts. It employs a sliding window attention mechanism or a global-local attention mechanism to process complete medical record documents whose length exceeds the limit of a single sequence.
[0007] Furthermore, the method also includes an active learning step: Before or during the model training and prediction steps, an initial model is trained based on the initial labeled data; The initial model is used to calculate an uncertainty measure for the unlabeled data; Based on the uncertainty measure, the subset of samples with the highest information content is selected from the unlabeled data for expert annotation; Add the newly labeled samples to the training set and iteratively update the model until the model performance converges or the labeling budget limit is reached.
[0008] Furthermore, the uncertainty measure is calculated using at least one of Monte Carlo Dropout, prediction entropy, or the degree of difference between model ensembles.
[0009] Furthermore, the named entity recognition branch adopts the BIO sequence labeling mode and combines it with a conditional random field model for decoding.
[0010] Furthermore, the interpretability analysis also includes a negation and historical reference identification step: identifying expressions in the text that represent negation, historical events, or family history based on rules or machine learning models, and labeling the type of the expression in the interpretability analysis results.
[0011] Furthermore, the fusion of the structured data and the text vector representation is achieved using an attention fusion mechanism or a gating fusion unit.
[0012] Furthermore, the interpretable artificial intelligence method is SHAP or integral gradient method.
[0013] An electronic medical record text analysis device for implementing the above method includes: The data access and desensitization module is configured to access raw data from the electronic medical record system and desensitize sensitive information; The text preprocessing module is configured to perform sentence segmentation, word segmentation, and terminology standardization on the de-identified unstructured text; The annotation and active learning module is configured to manage labeled data and execute an active learning loop to iteratively filter samples for expert annotation. The representation learning and model training module is configured to load pre-trained Transformer models and fine-tune them using training data to perform named entity recognition and text classification tasks, and supports multimodal data fusion. The interpretability generation module is configured to generate word-level or fragment-level contribution explanations for the model's predictions. The deployment and interface module is configured to output analysis results to external systems in a structured format.
[0014] Beneficial effects: (1) By adopting a deep learning method based on pre-trained Transformer, the present invention can automatically and accurately extract key clinical entities (such as symptoms, diagnoses, functional assessments, etc.) from long and complex unstructured electronic medical record texts, effectively overcoming the dependence of traditional methods on manual rules and a large amount of labeled data, and realizing efficient and large-scale processing of massive medical record texts.
[0015] (2) This invention deeply integrates interpretable artificial intelligence (XAI) technology into the analysis process, which can provide word-level or fragment-level evidence support for each prediction result (such as visualizing the contribution of key features through SHAP values). This not only solves the "black box" problem of deep learning models, but also enables clinicians to understand and verify the decision-making logic of the model, thereby enhancing their trust in the system output and making them more willing to use it to assist in decision-making.
[0016] (3) By introducing an active learning loop, the system can intelligently select the most valuable unlabeled samples for model optimization and submit them to experts for review, thereby achieving rapid convergence of model performance with minimal labeling work. This is particularly suitable for the medical field where labeling resources are expensive and scarce.
[0017] (4) By designing an effective fusion layer (such as an attention mechanism), this invention can jointly model unstructured text information with structured data (such as laboratory indicators and medication records), making full use of all the information in electronic medical records, thereby achieving higher accuracy than single data source models in tasks such as disease risk prediction.
[0018] (5) The method and apparatus support long text processing, can adapt to real clinical recording scenarios, and can be seamlessly integrated with existing hospital information systems (such as EHR and CDSS) through standardized interfaces (such as FHIR), supporting batch analysis and real-time processing, meeting the requirements of reliability, security and ease of use in actual clinical applications. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the method flow of the present invention. Detailed Implementation
[0020] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0021] The workflow of a natural language processing-based method for interpretable text analysis of electronic medical records for chronic diseases is as follows: Figure 1 Even numbers are specifically implemented through the following modules: Data Access and De-identification Module: Accesses raw text from the EHR system, including outpatient and emergency records, inpatient records, nursing records, and structured tables; such as laboratory test results, medication records, and codes. De-identification / De-identification: Sensitive information such as names, ID numbers, and contact information is replaced or hashed to meet privacy compliance requirements.
[0022] Text preprocessing module: segmentation, sentence segmentation, Chinese word segmentation, spelling / abbreviation standardization, disambiguation (medical terminology and units); stop word / punctuation processing, word form restoration / synonym standardization (mapping to UMLS / SNOMED / custom dictionary).
[0023] Annotation / Labeling and Active Learning Module: Initial small-scale manual annotation (using DOCANNO or a self-built annotation platform), annotation tasks include NER (disease, symptom, medication, time, severity, etc.), relation extraction, and judgmental labels (existence / negation / history / family); Active Learning Loop: The model (initial lightweight NER) estimates uncertainty (such as BALD, entropy, and inter-model disagreement) on unlabeled data, selects the most informative samples for expert annotation, and iteratively updates until the metrics converge or the budget is exhausted.
[0024] Representation learning and model training module: Pre-training and fine-tuning of the Transformer model using pre-trained clinical corpus: For short / medium-length texts: fine-tuning with ClinicalBERT variants; For very long texts (such as complete discharge records): Longformer / BigBird / Sliding-window longformer structure to cover longer contexts; Multi-task learning architecture: shared encoder + NER branch (Token-level BIO), text classification branch (disease prediction / risk scoring), sequence labeling branch (time series / event extraction); Fusion of structured data: concatenating encoded structured variables (laboratory values, demographics) to Transformer pooling vectors, or using cross-modal fusion layers (attention mechanism or gating fusion).
[0025] The Explainability (XAI) module includes: Global Explanation: Evaluates the contribution of input words / entities to the model's global predictions using feature importance metrics (SHAP, Integrated Gradients); Local Explanation: Provides the impact of word / sentence rankings, model confidence, negation detection, and evidence fragments for individual samples; Interactive Explanation: Aligns explanations with the original text, highlights them (positive or negative contributions), and generates summary-style evidence (e.g., "Model predicts increased risk of type 2 diabetes, key evidence: fasting blood glucose 7.1, weight gain, family history"); It can generate explanatory reports for clinical review and supports human feedback for continued training (closed loop).
[0026] Evaluation and Validation Module: Internal Metrics: Micro / Macro F1 of NER, classification AUROC, AUPRC; disambiguation and negation detection accuracy; External / Clinical Validation: Comparison with expert annotations (Turing test-style evaluation), case sampling, impact assessment on downstream early warning or cohort identification; Robustness Testing: Cross-institutional / cross-language transfer, validation for minority groups / different documentation styles.
[0027] Deployment and Interface Module: Provides REST API and HL7 / FHIR adapter to write structured output back to EHR or push it to Clinical Decision Support System (CDSS); supports batch offline analysis and real-time streaming processing (such as real-time extraction of emergency room reception dialogues).
[0028] Example 1 Extract chronic disease complications and functional assessments and make risk predictions (taking heart failure patients as an example). Extract NYHA classification, activity-related symptoms, and relevant laboratory values from outpatient / inpatient physician records and predict the risk of heart failure deterioration in the next 6 months, and provide interpretable evidence.
[0029] The specific implementation process is as follows: Data preparation: Extract texts such as outpatient / inpatient records and discharge summaries of heart failure over the past ten years, as well as corresponding structured data (LVEF, BNP, medication, past medical history); de-identify PII.
[0030] Labeling and Active Learning: Initially, 500 records were labeled with NYHA grade and symptom entities by heart failure experts (using DOCANNO); an initial NER model was trained (based on ClinicalBERT); active learning was performed: the model calculated uncertainty (BALD) on unlabeled samples, and 500 high uncertainty samples were selected for relabeling in each round, iterating until F1 stability was achieved.
[0031] Model training: Input text into Longformer (max_len=4096) encoding to obtain sentence / document vectors; NER branch outputs entity BIO labels; classification branch outputs 6-month risk probabilities (cross-entropy loss); LVEF, BNP and other structured variables are encoded through MLP and concatenated with text vectors to enter the final classifier; training uses patient-level division (70% training, 15% validation, 15% testing).
[0032] Interpretability: SHAP values are used to calculate individual predictions, and the contribution of each token is displayed; Output evidence fragments: Extract a fragment of the original text within ±25 characters around each high-contribution token, and mark its contribution direction and strength; Generate summary report: Prediction probability, the 3 most important positive evidences, the 2 most important negative evidences, and model confidence interval.
[0033] Evaluation: NER macro F1, categorical AUROC, and AUPRC were calculated on the test set; Clinical validation: 100 cases were randomly sampled, and heart failure experts conducted a blind review (Turing test) of the model's predictions and interpretations to evaluate the clinical reliability of the interpretations.
[0034] Deployment: Write the structured output back to the EHR (FHIR resource) and display risk warnings and supporting evidence in the outpatient clinic.
[0035] Example 2 EHR text-based prediction of new type 2 diabetes incidence and interpretation of important risk factors can be used to screen high-risk individuals in populations for early intervention.
[0036] The specific implementation process is as follows: Data preparation: integration of outpatient, laboratory, prescription records and clinical notes, with a time window of the past 3 years; desensitization, sentence segmentation, word segmentation, and terminology mapping (fasting blood glucose, BMI, family history keywords).
[0037] Label construction: Using ICD codes and test thresholds (fasting blood glucose ≥7.0 or HbA1c ≥6.5%) as positive labels, a target for predicting new cases of diabetes in the next year was constructed; manual sampling of labels was used to ensure label quality.
[0038] Representation and Training: Text was encoded using ClinicalBERT; text and structured variables were fused into the Transformer output layer; time series features (recent values and trends) were used as input features; time slices were used for training and patient level classification, and AUPRC was used as the main optimization objective (class imbalance).
[0039] Active learning and semi-supervised learning: pseudo-labels / consistency regularization are used to improve generalization for unlabeled long-tail cases; active learning is used for samples with low confidence of pseudo-labels and submitted to clinical experts for review.
[0040] Interpretability: For each positive prediction, calculate the SHAP value and output the top risk factors (e.g., fasting blood glucose 6.8, family history, BMI 31, a certain type of medication); the report distinguishes between the contribution of structured features and the contribution of textual evidence and provides the corresponding text fragments.
[0041] Validation and effectiveness: The predicted recall and precision were calculated through retrospective validation and used as screening indicators in a real population to evaluate the intervention benefit estimate (reduction of incidence / delay of incidence).
[0042] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing, characterized in that: Includes the following steps: S1. Data Access and Desensitization: Access raw data containing unstructured text and structured data from the electronic medical record system, and desensitize sensitive personal information in the raw data; S2. Text preprocessing: The desensitized unstructured text is processed by sentence segmentation, word segmentation, medical terminology standardization, and synonym mapping. S3. Model Training and Prediction: The pre-trained Transformer model is used to encode the preprocessed text to obtain a text vector representation; based on the text vector representation, clinical entities related to chronic diseases are extracted through the named entity recognition branch, and the disease risk prediction results are output through the text classification branch; at the same time, the encoded structured data is fused with the text vector representation to jointly participate in the generation of the disease risk prediction results. S4. Explainability Analysis: The output of the model training and prediction steps is analyzed using interpretable artificial intelligence methods to generate word-level or fragment-level contribution assessments for the clinical entity extraction results and / or the disease risk prediction results. S5. Output Results: Output the structured clinical entity extraction results, disease risk prediction results, and their corresponding interpretability analysis results.
2. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The Transformer model is capable of processing long texts. It employs a sliding window attention mechanism or a combination of global and local attention mechanisms to process complete medical record documents whose length exceeds the limit of a single sequence.
3. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The method also includes an active learning step: Before or during the model training and prediction steps, an initial model is trained based on the initial labeled data; The initial model is used to calculate an uncertainty measure for the unlabeled data; Based on the uncertainty measure, the subset of samples with the highest information content is selected from the unlabeled data for expert annotation; Add the newly labeled samples to the training set and iteratively update the model until the model performance converges or the labeling budget limit is reached.
4. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The uncertainty measure is calculated using at least one of Monte Carlo Dropout, prediction entropy, or the degree of difference between model ensembles.
5. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The named entity recognition branch uses the BIO sequence labeling mode and combines it with a conditional random field model for decoding.
6. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The interpretability analysis also includes a negation and historical reference identification step: identifying statements in the text that represent negation, historical events, or family history based on rules or machine learning models, and labeling the type of the statements in the interpretability analysis results.
7. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The fusion of the structured data and the text vector representation is achieved using an attention fusion mechanism or a gated fusion unit.
8. The method for interpretable text analysis of electronic medical records for chronic diseases based on natural language processing according to claim 1, characterized in that, The interpretable artificial intelligence method is SHAP or integral gradient method.
9. An electronic medical record text analysis apparatus for implementing the method as described in any one of claims 1 to 8, characterized in that, include: The data access and desensitization module is configured to access raw data from the electronic medical record system and desensitize sensitive information; The text preprocessing module is configured to perform sentence segmentation, word segmentation, and terminology standardization on the de-identified unstructured text; The annotation and active learning module is configured to manage labeled data and execute an active learning loop to iteratively filter samples for expert annotation. The representation learning and model training module is configured to load pre-trained Transformer models and fine-tune them using training data to perform named entity recognition and text classification tasks, and supports multimodal data fusion. The interpretability generation module is configured to generate word-level or fragment-level contribution explanations for the model's predictions. The deployment and interface module is configured to output analysis results to external systems in a structured format.