A medical ICD coding classification method based on a graph neural network

By constructing a graph structure and a graph attention network, the problem of ignoring label relationships and text structure in existing ICD encoding tasks is solved, improving the accuracy and generalization ability of ICD encoding classification, especially the performance in the case of sparse labels.

CN119474981BActive Publication Date: 2025-11-18CHONGQING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411589268.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-11-18
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

Existing deep learning models are unable to effectively capture the relationships between labels in ICD encoding tasks, ignore the complexity of text structure, and perform poorly in handling label sparsity, resulting in limited classification accuracy and generalization ability.

Method used

A graph neural network-based approach is adopted to construct a graph structure to capture the semantic similarity, hierarchical distance, and co-occurrence frequency relationships between ICD codes. A graph attention network and an adaptive attention mechanism are used to train the model through a multi-label loss function.

Benefits of technology

It improves the accuracy and generalization ability of ICD-encoded classification, especially when dealing with sparse labels, enhances the model's understanding of complex graph structures, and improves classification performance and coverage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474981B_ABST
    Figure CN119474981B_ABST
Patent Text Reader

Abstract

The application belongs to the field of medical ICD automatic coding, and particularly relates to a medical ICD coding classification method based on a graph neural network, which comprises the following steps: obtaining a data set and preprocessing the data set to obtain a text vector matrix; constructing a graph structure according to the text vector matrix, wherein the graph structure comprises a node feature matrix and an adjacency matrix; inputting the graph structure into a graph neural network model to output a predicted ICD coding result, and training the model by using a multi-label loss function based on cross-entropy; and inputting medical record data to be coded into the trained graph neural network model to obtain a predicted ICD coding result; the application takes the semantic similarity between medical terms, the hierarchical distance between ICD codes and the co-occurrence frequency relationship into the graph structure, can comprehensively capture the complex relationship between words and labels, better utilizes the potential correlation between ICD codes, and enhances the context understanding ability and accuracy of the classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of automatic coding of medical ICDs, and specifically relates to a medical ICD coding and classification method based on graph neural networks. Background Technology

[0002] The International Classification of Diseases (ICD) is a set of standard diagnostic tools developed by the World Health Organization (WHO) for classifying diseases and related health problems. The ICD coding system is used to record, analyze, interpret, and compare mortality and morbidity data and is widely used in global healthcare systems. Manual ICD coding is tedious and error-prone; with the increasing volume of medical data, automated ICD coding has become a necessity. Automated ICD coding uses Natural Language Processing (NLP) and machine learning technologies to extract relevant information from clinical texts and automatically generate ICD codes. It offers advantages such as reducing manual operation time, accelerating the coding process, reducing human error, improving coding accuracy, lowering coding costs, and optimizing resource allocation.

[0003] Early automated ICD encoding primarily relied on rule systems, keyword matching, and statistical models. For example, rule-based systems match specific words in text with their ICD codes based on predefined rule bases or ICD encoding manuals. These systems are simple to implement and can handle some common medical terms. However, these methods require manually writing and maintaining a large number of rules, making them unable to cope with complex medical contexts, especially when new terms appear, necessitating constant rule updates. Furthermore, these methods exhibit poor generalization ability when dealing with diverse medical texts, struggling to capture word polysemy and contextual dependencies.

[0004] In recent years, deep learning models based on neural networks (such as Convolutional Neural Networks (CNNs) and Long Short-Term Memory (LSTM) networks have gradually become the mainstream methods for ICD encoding tasks. For example, CNNs generate text representations by capturing local patterns in text (such as word segments and n-grams); Recurrent Neural Networks (RNNs) and their variant LSTM excel at processing sequential data and can capture long dependencies in text; these models can automatically learn text features and significantly improve classification accuracy. Although these deep learning-based methods have made significant progress in automated ICD encoding, they still have some limitations:

[0005] 1) Inability to effectively capture relationships between labels: ICD encoding is a multi-label classification problem, and most existing models treat it as an independent classification task, ignoring the co-occurrence relationships, semantic similarity, and hierarchical structure between different ICD codes. Since ICD codes usually have certain correlations, existing methods fail to fully utilize these relationships, resulting in limited classification accuracy.

[0006] 2) Lack of comprehensive representation of text structure: Existing methods typically treat medical text as a linear sequence, ignoring the complex relationships between words, such as semantic similarity and contextual dependencies. For example, CNNs can only capture local patterns, while LSTMs cannot fully utilize the interrelationships between multiple labels.

[0007] 3) Label sparsity problem: In practical applications, there are many ICD codes, but most texts only involve a few ICD codes. This sparsity makes it difficult for the model to effectively learn and predict the rare ICD codes. Summary of the Invention

[0008] To address the limitations of existing deep learning models in capturing the similarity, hierarchical structure, and co-occurrence relationships between ICD codes, thus restricting the accuracy and generalization ability of classification models; and to the shortcomings of existing technologies in handling label sparsity and capturing complex text structural features, this invention provides a medical ICD code classification method based on graph neural networks, characterized by the following steps:

[0009] S1. Obtain the dataset and preprocess it to obtain a text vector matrix; the dataset includes multiple medical record coding data, each medical record coding data includes a description of the illness text and a standard coding set; the standard coding set includes one or more ICD codes;

[0010] S2. Construct a graph structure based on the text vector matrix, wherein the graph structure includes a node feature matrix and an adjacency matrix;

[0011] S3. Input the graph structure into the graph neural network model and output the predicted ICD encoding result. Train the model using a multi-label loss function based on cross-entropy.

[0012] S4. Input the medical record data to be encoded into the trained graph neural network model to obtain the predicted ICD code.

[0013] The beneficial effects of this invention are:

[0014] Effectively capturing multiple relationships between ICD codes: This invention incorporates the semantic similarity between medical terms, the hierarchical distance between ICD codes, and the co-occurrence frequency relationship into the graph structure, which can comprehensively capture the complex relationships between words and labels, better utilize the potential correlation between ICD codes, and enhance the contextual understanding ability and accuracy of the classification model.

[0015] Improving classification accuracy and generalization ability: This invention uses a Graph Attention Network (GAT) and introduces an adaptive attention mechanism that dynamically adjusts weights based on the importance of neighboring nodes. Compared to traditional CNNs or RNNs, this invention can more effectively learn the important information between nodes in complex graph structures, especially performing better when dealing with multi-label sparsity problems.

[0016] Addressing the issue of label sparsity: This invention introduces hierarchical distance and co-occurrence frequency relationships between ICD codes, enabling the model to utilize co-occurrence relationships and hierarchical structures between labels when processing sparse labels, thereby effectively improving the classification performance of sparse labels and enhancing the coverage and prediction performance of ICD codes. Attached Figure Description

[0017] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] This invention provides a medical ICD encoding classification method based on graph neural networks, such as... Figure 1 As shown, it includes the following steps:

[0020] S1. Obtain the dataset and preprocess it to obtain a text vector matrix; the dataset includes multiple medical record coding data, each medical record coding data includes a description of the illness text and a standard coding set; the standard coding set includes one or more ICD codes.

[0021] Specifically, step S1 includes:

[0022] S11. Determine whether there is only one ICD code in the standard coding set of medical record coding data. If so, combine the disease description text and the ICD code into a sample. If not, proceed to step S12.

[0023] S12. Divide the disease description text into multiple sub-texts according to the delimiter; for each sub-text, calculate its similarity with each ICD code in the standard coding set, and select the ICD code corresponding to the highest similarity to form a sample;

[0024] S13. For each sample, perform word embedding processing to obtain the corresponding text vector, and all text vectors form a text vector matrix.

[0025] Specifically, step S13 performs word embedding processing on each sample to obtain the corresponding word vector, including:

[0026] S131. Combine the Unified Medical Language System (UMLS) to perform word segmentation on the text in the sample to obtain multiple words; each word is a medical term, a common word, or a meaningless stop word.

[0027] S132. Perform stop word removal processing on the decomposition results of step S131 to obtain a vocabulary set;

[0028] S133. A pre-trained word vector model is used to transform each word in the vocabulary set into a fixed-dimensional word vector, and all word vectors are combined to form the text vector of the sample.

[0029] Let C n Let n be the set of words for the nth sample. Let m be the m-th word of the n-th sample; a pre-trained Word2vec model is used to transform the words to obtain the text vector of the n-th sample. This represents the m-th word vector of the n-th sample; M represents the number of words; thus, the text vector matrix T = (X1, X2, ..., X...) is obtained. N N represents the number of samples. The text vector length of all samples is adjusted to be the same.

[0030] S2. Construct a graph structure based on the text vector matrix, wherein the graph structure includes a node feature matrix and an adjacency matrix.

[0031] Specifically, step S2 includes:

[0032] S21. Define nodes: Take each text in the text vector matrix as a node, and use the text vector as the initial feature of the node to obtain the node feature matrix;

[0033] S22. Define semantic weight: Calculate the semantic similarity between any two nodes. If the semantic similarity is greater than the semantic threshold, then the semantic weight between the two nodes is the semantic similarity; otherwise, the semantic weight between the two nodes is 0.

[0034] Specifically, the semantic similarity calculation formula is:

[0035]

[0036] Among them, S ij X represents the semantic similarity between node i and node j. i The text vector representing node i.

[0037] S23. Define hierarchical weights: Calculate the hierarchical distance between the ICD codes corresponding to every two nodes. If the hierarchical distance is greater than the distance threshold, the hierarchical weight between the two nodes is the hierarchical distance; otherwise, the hierarchical weight between the two nodes is 0.

[0038] Specifically, the formula for calculating hierarchical distance is:

[0039] D ij =Depth(i)+Depth(j)-2×Depth(LCA(i,j))

[0040] Depth(i) represents the depth of the ICD code corresponding to node i in the ICD coding hierarchy (tree structure), and LCA(i,j) represents the least common ancestor of the ICD codes corresponding to nodes i and j in the ICD coding hierarchy.

[0041] S24. Define frequency weight: Calculate the co-occurrence frequency between the ICD codes corresponding to each pair of nodes. If the co-occurrence frequency is greater than the frequency threshold, then the frequency weight between the two nodes is the co-occurrence frequency; otherwise, the frequency weight between the two nodes is 0.

[0042] Specifically, the number of times the ICD codes corresponding to node i and node j co-occur in the dataset is used as the co-occurrence frequency.

[0043] S25. Fusion Processing: The semantic weight, hierarchical weight, and frequency weight between every two nodes are weighted and fused. If the fusion result is greater than 0, an edge is connected between the two nodes, and the edge weight is the fusion result, thus obtaining the adjacency matrix.

[0044] S3. Input the graph structure into the graph neural network model and output the predicted ICD encoding result. Train the model using a multi-label loss function based on cross-entropy.

[0045] Specifically, the graph neural network model includes multiple attention map convolutional layers, and the processing of each attention map convolutional layer includes:

[0046] S31. Using the output H of the (l-1)th attention map convolutional layer l As the input to the l-th attention map convolutional layer, This represents the input of node i in the l-th attention map convolutional layer;

[0047] S32. For the input of node i in the l-th attention map convolutional layer An attention mechanism is used to fuse the features of neighboring nodes, resulting in the updated feature representation of node i at the l-th attention map convolutional layer. Thus, the output H of the l-th attention map convolutional layer is obtained. l+1 Specifically, it is expressed as

[0048]

[0049] in, W represents the input of node i in the l-th attention map convolutional layer. (l) Indicates trainable parameters, [||] represents the linear transformation of node i in the l-th attention map convolutional layer, and [||] represents the concatenation process.

[0050] Let represent the weight vector of the l-th attention map convolutional layer, LeakyReLU be the activation function, and N(i) represent the set of neighboring nodes of node i. This represents the attention weight between node i and node j. Let H represent the updated feature representation of node i at the l-th attention map convolutional layer. Combine the updated feature representations of all nodes at the l-th attention map convolutional layer into the output H of the l-th attention map convolutional layer. l+1 .

[0051] Specifically, the graph neural network model includes L attention map convolutional layers, l = 0, 1, 2, ..., L-1. A fully connected layer follows the last attention map convolutional layer, mapping the final feature representation of each node to the label space, represented as...

[0052]

[0053] Among them, W o This represents the weight matrix of the fully connected layer. This represents the predicted classification result for node i.

[0054] Specifically, the multi-label loss function based on cross-entropy is expressed as follows:

[0055]

[0056] Among them, y i This represents the actual label of node i.

[0057] S4. Input the medical record data to be encoded into the trained graph neural network model to obtain the predicted ICD code.

[0058] In one embodiment, the present invention uses the publicly available dataset MIMIC-III to validate the model. This dataset contains 58,976 admission records of 49,583 patients treated at Beth Israel Deaconess Medical Center from 2001 to 2012. Each admission record includes a discharge summary, including medical history, diagnosis, surgical procedures, discharge instructions, etc. Coders coded the diagnoses and procedures that occurred during the patient's hospitalization in descending order of importance and relevance. The dataset was split according to patient ID to prevent the same patient from appearing in both the training and testing sets. Table 1 shows the MIMIC-III data splitting and statistics, with 46,157 discharge summaries used for training, and 3,280 and 3,285 data points used for validation and testing, respectively. The dataset contains a total of 8,922 ICD codes, including 6,919 diagnostic codes and 2,003 procedural codes, with the training set containing 8,579 different ICD codes. For data preprocessing, this paper converts all characters to lowercase and removes pure numbers and symbols, but does not remove characters like "50mg". Characters appearing less than 3 times are replaced with "UNK". The gensim tool is used to pre-train word2vec word vectors on all text in the training set using a Continuous Bag-of-Words (CBOW) model, with a vector dimension of 100 and a window size of 5. Additionally, due to the excessive length of medical records, texts longer than 2500 characters are truncated to ensure training speed.

[0059] In this experiment, we used a variety of evaluation metrics to assess model performance, including F1 score (Macro and Micro), AUC (Macro and Micro), and P@K (P@5 and P@8). These metrics each focus on different aspects of performance measurement.

[0060] Macro F1 measures the average precision and recall for each label and is suitable for scenarios with imbalanced data.

[0061]

[0062] Where K is the total number of tags, F1 i It is the F1 score for the i-th label. Macro F1 focuses on the performance of each label and is suitable for imbalanced data.

[0063] Micro F1, calculated based on overall precision and recall, is suitable for evaluating a model's classification performance on a large number of samples.

[0064]

[0065] In multi-label classification or multi-classification tasks, Precision micro and Recallmicro Precision is a metric used to measure overall classification performance. micro It represents the overall precision across all samples. It is calculated by dividing the total number of true positives across all classes by the sum of true positives and false positives. Recall micro It represents the overall recall of all samples. It is calculated by dividing the total number of true positives in all classes by the sum of true positives and false negatives. Micro F1, by calculating the overall precision and recall across all samples, better reflects the model's overall classification performance on the majority of samples.

[0066] AUC (Area Under the ROC Curve): Macro AUC and Micro AUC are used to measure the classification ability of a model. The higher the AUC, the better the model can distinguish between positive and negative samples.

[0067]

[0068] Here, AUCi is the AUC value of the i-th label. Macro AUC is suitable for evaluating the classification performance of each label. Micro AUC, on the other hand, calculates the overall AUC of all samples and labels, reflecting the overall classification performance of the model.

[0069] P@K (Precision at K): P@5 and P@8 are used to evaluate the model's accuracy in predicting the first K labels.

[0070]

[0071] Where K represents the first K predicted labels. P@5 and P@8 represent the model's accuracy in the first 5 and first 8 predicted labels, respectively, reflecting the model's ability to rank and prioritize labels in multi-label tasks.

[0072] The combination of these metrics allows us to comprehensively evaluate model performance from multiple perspectives, including classification accuracy, robustness to label imbalance, and priority prediction ability in multi-label tasks. Analyzing these metrics clarifies the strengths and weaknesses of each model and provides guidance for further optimization.

[0073] Some of the experimental results are shown in the table below.

[0074] Table 1 Experimental results of the MIMIC III TOP-50 dataset

[0075]

[0076] Table 2 Experimental results of the MIMIC III TOP-100 dataset

[0077]

[0078]

[0079] Table 3 Experimental results of the MIMIC III TOP-150 dataset

[0080]

[0081] Table 4 Experimental results of the MIMIC III bottom-50 dataset.

[0082]

[0083] Table 5 Experimental results of the MIMIC III bottom-100 dataset.

[0084]

[0085] Table 6 Experimental Results of the MIMIC III bottom-150 Dataset

[0086]

[0087] Experimental results show that the number of labels has a significant impact on model performance, especially with sparse label sets, where performance drops dramatically. Deep learning models, particularly KEPTLongformer and HiLAT+ClinicalBERT with pre-trained language models, and TGFN based on graph neural networks, can alleviate the problem of data sparsity to some extent. TGFN demonstrates good performance on all datasets, especially with minimal labels, where its advantage is more pronounced. This indicates that combining graph neural networks with the complex relationships between labels can effectively improve the performance of ICD encoding prediction, particularly with a limited number of labels. Future research could consider further optimizing the graph neural network structure, incorporating more label relationship information, or introducing semi-supervised learning methods to further enhance model performance with fewer labels.

[0088] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "setting," "connection," "fixing," "rotation," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal connection of two components or the interaction between two components. Unless otherwise explicitly limited, those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0089] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A medical ICD encoding and classification method based on graph neural networks, characterized in that, Includes the following steps: S1. Obtain the dataset and preprocess it to obtain a text vector matrix; the dataset includes multiple medical record coding data, each medical record coding data includes a description of the illness text and a standard coding set; the standard coding set includes one or more ICD codes; S2. Construct a graph structure based on the text vector matrix, wherein the graph structure includes a node feature matrix and an adjacency matrix; Step S2 includes: S21. Define nodes: Take each text in the text vector matrix as a node, and use the text vector as the initial feature of the node to obtain the node feature matrix; S22. Define semantic weight: Calculate the semantic similarity between any two nodes. If the semantic similarity is greater than the semantic threshold, then the semantic weight between the two nodes is the semantic similarity; otherwise, the semantic weight between the two nodes is 0. S23. Define hierarchical weights: Calculate the hierarchical distance between the ICD codes corresponding to every two nodes. If the hierarchical distance is greater than the distance threshold, the hierarchical weight between the two nodes is the hierarchical distance; otherwise, the hierarchical weight between the two nodes is 0. S24. Define frequency weight: Calculate the co-occurrence frequency between the ICD codes corresponding to each pair of nodes. If the co-occurrence frequency is greater than the frequency threshold, then the frequency weight between the two nodes is the co-occurrence frequency; otherwise, the frequency weight between the two nodes is 0. S25. Fusion Processing: The semantic weight, hierarchical weight, and frequency weight between every two nodes are weighted and fused. If the fusion result is greater than 0, an edge is connected between the two nodes, and the edge weight is the fusion result. Finally, the adjacency matrix is ​​obtained. S3. Input the graph structure into the graph neural network model and output the predicted ICD encoding result. Train the model using a multi-label loss function based on cross-entropy. The graph neural network model includes multiple attention map convolutional layers. The processing of the l-th attention map convolutional layer includes: S31. Using the output H of the (l-1)th attention map convolutional layer l As the input to the l-th attention map convolutional layer, This represents the input of node i in the l-th attention map convolutional layer; S32. For the input of node i in the l-th attention map convolutional layer An attention mechanism is used to fuse the features of neighboring nodes, resulting in the updated feature representation of node i at the l-th attention map convolutional layer. Thus, the output H of the l-th attention map convolutional layer is obtained. l+1 ; S4. Input the medical record data to be encoded into the trained graph neural network model to obtain the predicted ICD code.

2. The medical ICD encoding and classification method based on graph neural networks according to claim 1, characterized in that, Step S1 specifically includes: S11. Determine whether there is only one ICD code in the standard coding set of medical record coding data. If so, combine the disease description text and the ICD code into a sample. If not, proceed to step S12. S12. Divide the disease description text into multiple sub-texts according to the delimiter; for each sub-text, calculate its similarity with each ICD code in the standard coding set, and select the ICD code corresponding to the highest similarity to form a sample; S13. For each sample, perform word embedding processing to obtain the corresponding text vector, and all text vectors form a text vector matrix.

3. The medical ICD encoding and classification method based on graph neural networks according to claim 2, characterized in that, Step S13 performs word embedding processing on each sample to obtain the corresponding word vector, including: S131. Combine the Unified Medical Language System (UMLS) to perform word segmentation on the text in the sample to obtain multiple words; each word is a medical term, a common word, or a meaningless stop word. S132. Perform stop word removal processing on the decomposition results of step S131 to obtain a vocabulary set; S133. A pre-trained word vector model is used to transform each word in the vocabulary set into a fixed-dimensional word vector, and all word vectors are combined to form the text vector of the sample.

4. The medical ICD encoding and classification method based on graph neural networks according to claim 1, characterized in that, The multi-label loss function based on cross-entropy is expressed as follows: Among them, y i This represents the actual label of node i. This represents the predicted classification result for node i, and N represents the number of nodes.

Citation Information

Patent Citations

  • ICD automatic coding method and system for diagnosis reason visualization

    CN111540468A

  • ICD operation classification automatic matching method and system based on graph neural network

    CN112686306A