Medical ICD coding classification method based on graph neural network
By adopting a graph neural network-based method in medical ICD encoding tasks, building graph structures and using graph attention networks, the problem that existing models cannot effectively capture ICD encoding relationships and handle label sparsity is achieved, and higher classification is achieved Accuracy and generalization capability.
Patent Information
- Application Number
- CN202411589268.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-08
AI Technical Summary
Existing deep learning models cannot effectively capture the relationship between ICD encoding in medical ICD encoding tasks, resulting in limited classification accuracy and generalization capabilities, and difficulty in dealing with label sparsity and complex text structures.
Using a graph neural network-based method, multi-label loss is carried out by constructing a graph structure, including node feature matrix and adjacency matrix, using semantic similarity, hierarchical distance and co-occurrence frequency relationships, combining graph attention network and adaptive attention mechanism. Function training, predict ICD encoding.
Effectively capture the multiple relationships between ICD encodings, improve classification accuracy and generalization capabilities, solve the problem of label sparseness, and improve the coverage and prediction performance of ICD encoding.
Smart Images

Figure CN119474981A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical ICD automatic coding, and specifically relates to a medical ICD coding classification method based on graph neural network. Background Art
[0002] ICD (International Classification of Diseases) 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 medical systems. The manual ICD coding process is cumbersome and error-prone. With the increase in the amount of medical data, automated ICD coding has become a necessary means. Automated ICD coding extracts relevant information from clinical texts and automatically generates ICD codes through natural language processing (NLP) and machine learning technology. It has the advantages of reducing manual operation time, speeding up the coding process, reducing human errors, improving coding accuracy, reducing coding work costs, and optimizing resource allocation.
[0003] Early automated ICD coding mainly relied on rule systems, keyword matching, and statistical models. For example, rule-based systems match specific words in the text with ICD codes based on a predefined rule base or ICD coding manual. The advantage of these systems is that they are simple to implement and can handle some common medical terms. However, such methods require manual writing and maintenance of a large number of rules and cannot cope with complex medical contexts, especially when new terms emerge, the rules need to be constantly updated; in addition, such methods show poor generalization ability when dealing with diverse medical texts, and it is difficult to capture the ambiguity and contextual dependence of words.
[0004] In recent years, deep learning models based on neural networks (such as convolutional neural networks (CNNs), long short-term memory networks (LSTMs), etc.) have gradually become the mainstream methods for ICD coding tasks. For example: convolutional neural networks generate text representations by capturing local patterns in text (such as vocabulary fragments, n-grams); recurrent neural networks and their variants LSTMs are good at processing sequence data and can capture long dependencies in text; these models can automatically learn the features of text and significantly improve classification accuracy. Although these deep learning-based methods have made significant progress in automated ICD coding, they still have some limitations:
[0005] 1) Unable to effectively capture the relationship between labels: The ICD coding task is a multi-label classification problem. Most existing models only treat it as an independent classification task, ignoring the co-occurrence relationship, 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 usually treat medical text as a linear sequence, ignoring the complex relationships between words, such as semantic similarity, contextual dependency, etc. For example, CNN can only capture local patterns, while LSTM cannot fully utilize the interrelationships between multiple labels.
[0007] 3) Label sparsity problem: In practical applications, there are a lot of ICD codes, but most texts only involve a few ICD codes. This sparsity makes it difficult for the model to effectively learn and predict rare ICD codes. Summary of the invention
[0008] In order to solve the problem that the existing deep learning model cannot fully capture the similarity, hierarchy and co-occurrence relationship between ICD codes, resulting in limited accuracy and generalization ability of the classification model; and the problem that the existing technology is insufficient in dealing with label sparsity and capturing complex text structure features; the present invention provides a medical ICD code classification method based on graph neural network, characterized in that it includes the following steps:
[0009] S1. Obtain a data set and preprocess it to obtain a text vector matrix; the data set includes multiple medical record coding data, each medical record coding data includes a condition description text and a standard coding set; the standard coding set includes one or more ICD codes;
[0010] S2. construct a graph structure according to 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 to output the predicted ICD coding result, and use the multi-label loss function based on cross entropy to train the model;
[0012] S4. Input the medical record data to be coded into the trained graph neural network model to obtain the predicted ICD code.
[0013] Beneficial effects of the present invention:
[0014] Effectively capture multiple relationships between ICD codes: The present 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] Improve classification accuracy and generalization ability: This paper uses the Graph Attention Network (GAT) and introduces an adaptive attention mechanism, which can dynamically adjust the weights according to the importance of neighbor nodes. Compared with traditional CNN or RNN, this paper can more effectively learn important information between nodes in complex graph structures, especially when dealing with multi-label sparse problems.
[0016] Solving the problem of label sparsity: The present invention introduces the hierarchical distance and co-occurrence frequency relationship between ICD codes, so that the model can utilize the co-occurrence relationship and hierarchical structure between labels when processing sparse labels, thereby effectively improving the classification effect of sparse labels and enhancing the coverage and prediction performance of ICD codes. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] The present invention provides a medical ICD coding classification method based on graph neural network, such as Figure 1 As shown, the following steps are included:
[0020] S1. Obtain a data set and perform preprocessing to obtain a text vector matrix; the data set includes multiple medical record coding data, each medical record coding data includes a condition description 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 code set of the medical record code data. If so, combine the condition description text and the ICD code into a sample. If not, execute step S12;
[0023] S12. Divide the condition description text into multiple sub-texts according to the separator; for each sub-text, calculate its similarity with each ICD code in the standard code set, and select the ICD code corresponding to the highest similarity to form a sample;
[0024] S13. Perform word embedding processing on each sample 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 a corresponding word vector, including:
[0026] S131. Perform word segmentation on the text in the sample in combination with the Unified Medical Language System UMLS to obtain a plurality of words; the word is a medical term, or an ordinary word, or a meaningless stop word;
[0027] S132. Perform stop word removal processing on the decomposition result of step S131 to obtain a vocabulary set;
[0028] S133. Use a pre-trained word vector model to convert each word in the vocabulary set into a word vector of fixed dimension, and combine all word vectors into the text vector of the sample.
[0029] Let C n Represents the vocabulary set of the nth sample, Represents the mth word of the nth sample; the pre-trained Word2vec model is used to convert the word to obtain the text vector of the nth sample represents the mth word vector of the nth sample; M represents the number of words; thus, the text vector matrix T = (X 1 ,X 2 ,…,X N ), N represents the number of samples. The length of the text vectors of all samples is adjusted to be consistent.
[0030] S2. Construct a graph structure according to 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, take the text vector as the initial feature of the node, and obtain the node feature matrix;
[0033] S22. Define semantic weight: Calculate the semantic similarity between every two nodes. If the semantic similarity is greater than the semantic threshold, 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 represents the semantic similarity between node i and node j, X i A text vector representing node i.
[0037] S23. Define hierarchical weight: Calculate the hierarchical distance between the ICD codes corresponding to each 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 hierarchical distance calculation formula 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 code hierarchy (tree structure), and LCA(i,j) represents the minimum common ancestor of the ICD codes corresponding to nodes i and j respectively in the ICD code hierarchy.
[0041] S24. Define frequency weight: Calculate the co-occurrence frequency between the ICD codes corresponding to each two nodes. If the co-occurrence frequency is greater than the frequency threshold, 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 co-occurrences of the ICD codes corresponding to the node i and the node j in the data set is taken as the co-occurrence frequency.
[0043] S25. Fusion processing: perform weighted fusion on the semantic weight, hierarchical weight and frequency weight between every two nodes. If the fusion result is greater than 0, an edge is connected between the two nodes, and the edge weight is the fusion result, and finally the adjacency matrix is obtained.
[0044] S3. Input the graph structure into the graph neural network model to output the predicted ICD coding result, and use the multi-label loss function based on cross entropy to train the model.
[0045] Specifically, the graph neural network model includes multiple attention graph convolution layers, and the processing process of each attention graph convolution layer includes:
[0046] S31. Take the output H of the l-1th attention graph convolution layer l As the input of the lth attention graph convolutional layer, represents the input of node i in the lth attention graph convolution layer;
[0047] S32. Input of node i in the lth attention graph convolution layer The attention mechanism is used to perform neighbor node feature fusion processing to obtain the updated feature representation of node i in the lth attention graph convolution layer. Thus, the output H of the lth attention graph convolution layer is obtained l+1 , specifically expressed as
[0048]
[0049] in, represents the input of node i in the lth attention graph convolution layer, W (l) represents the trainable parameters, represents the linear transformation of node i in the lth attention graph convolution layer, [||] represents the concatenation process,
[0050] represents the weight vector of the lth attention graph convolutional layer, LeakyReLU is the activation function, N(i) represents the set of neighbor nodes of node i, represents the attention weight between node i and node j, Represents the updated feature representation of node i in the lth attention graph convolution layer. The updated feature representations of all nodes in the lth attention graph convolution layer are combined into the output H of the lth attention graph convolution layer l+1 .
[0051] Specifically, the graph neural network model includes L attention graph convolution layers, l = 0, 1, 2, ..., L-1, and a fully connected layer is connected after the last attention graph convolution layer to map the final feature representation of each node to the label space, which is expressed as
[0052]
[0053] Among them, W o represents the weight matrix of the fully connected layer, Represents the predicted classification result of node i.
[0054] Specifically, the multi-label loss function based on cross entropy is expressed as
[0055]
[0056] Among them, y i represents the true label of node i.
[0057] S4. Input the medical record data to be coded into the trained graph neural network model to obtain the predicted ICD code.
[0058] In one embodiment, the present invention uses the public data set MIMIC-III to verify the model. The data set contains 58,976 admission records of 49,583 patients who visited Beth Israel Deaconess Medical Center from 2001 to 2012. Each admission record has a discharge summary, including medical history, diagnosis results, surgical procedures, discharge instructions, etc. The coder codes the diagnosis and procedures that occurred during the patient's hospitalization in order of importance and relevance from high to low. The data set is split according to the patient ID to prevent the same patient from appearing in the training set and the test set at the same time. Table 1 is the MIMIC-III data cutting and statistical data, with a total of 46,157 discharge summaries for training, 3,280 and 3,285 data for verification and testing, respectively. The data set contains a total of 8,922 ICD codes, including 6,919 diagnosis codes and 2,003 procedure codes, of which 8,579 different ICD codes are contained in the training set. For data preprocessing, this paper converts all characters to lowercase and deletes pure numbers and symbols, but does not delete characters like "50mg", and replaces characters that appear less than 3 times with the "UNK" tag. The gensim tool is used to pre-train word2vec word vectors for all texts in the training set using the continuous bag of words (CBOW) model, with the vector dimension set to 100 and the window size set to 5. At the same time, because the medical records are too long, this paper truncates texts with a character length greater than 2500 to ensure training speed.
[0059] In this experiment, we used a variety of evaluation indicators to evaluate model performance, including F1 score (Macro and Micro), AUC (Macro and Micro), and P@K (P@5 and P@8). These evaluation indicators each focus on different aspects of performance measurement:
[0060] Macro F1 measures the average precision and recall of each label and is suitable for scenarios with imbalanced data:
[0061]
[0062] Among them, K is the total number of labels, F1 i is the F1 score of the i-th label. Macro F1 focuses on the performance of each label and is suitable for data imbalance.
[0063] Micro F1 is calculated based on the overall precision and recall rate, which is suitable for evaluating the classification performance of the model for most samples:
[0064]
[0065] In multi-label classification or multi-classification tasks, Precision micro and Recallmicro It is an indicator used to measure the overall classification effect. micro is the overall precision for all samples. It is calculated by dividing the total number of true positives in all classes by the sum of true positives and false positives. micro It is the overall recall rate of all samples. It is calculated by dividing the total number of true positives in all categories by the sum of true positives and false negatives. Micro F1 can better reflect the overall classification effect of the model on most samples by calculating the overall precision and recall rate of all samples.
[0066] AUC (Area Under the ROC Curve): AUC macro average (Macro AUC) and micro average (Micro AUC) are used to measure the classification ability of the model. The higher the AUC, the better the model's ability to distinguish between positive and negative samples.
[0067]
[0068] Among them, AUCi is the AUC value of the i-th label. Macro AUC is suitable for evaluating the classification effect of each label. Micro AUC 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 accuracy of the model in predicting the top K labels.
[0070]
[0071] Among them, K represents the top K predicted labels. P@5 and P@8 represent the accuracy of the model in the top 5 and top 8 predicted labels, respectively, reflecting the model's ability to rank and prioritize labels in multi-label tasks.
[0072] The combination of these indicators enables us to comprehensively evaluate the performance of the model from multiple perspectives, including classification accuracy, robustness to label imbalance, and priority prediction capabilities in multi-label tasks. Through the analysis of these indicators, we can more clearly understand the advantages and disadvantages of each model and provide guidance for further optimization.
[0073] Some experimental results are shown in the following table.
[0074] Table 1 Experimental results of MIMIC III TOP-50 dataset
[0075]
[0076] Table 2 Experimental results of MIMIC III TOP-100 dataset
[0077]
[0078]
[0079] Table 3 Experimental results of MIMIC III TOP-150 dataset
[0080]
[0081] Table 4 Experimental results of MIMIC III bottom-50 dataset
[0082]
[0083] Table 5 Experimental results of MIMIC III bottom-100 dataset
[0084]
[0085] Table 6 Experimental results of MIMIC III bottom-150 dataset
[0086]
[0087] Experimental results show that the number of labels has an important impact on the performance of the model, especially in the case of sparse label sets, the performance of the model will drop significantly. Deep learning models, especially KEPTLongformer and HiLAT+ClinicalBERT with pre-trained language models, and TGFN based on graph neural networks, can alleviate the problem of data sparsity to a certain extent. TGFN shows good performance on all datasets, especially in the case of minimal labels, its advantages are more obvious. This shows that by combining graph neural networks and complex relationships between labels, the performance of ICD code prediction can be effectively improved, especially when the number of labels is limited. Future research can consider further optimizing the graph neural network structure, combining more label relationship information, or introducing semi-supervised learning methods to further improve the performance of the model in the case of few labels.
[0088] In the present invention, unless otherwise clearly stipulated and limited, the terms such as "installation", "setting", "connection", "fixation" and "rotation" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral one; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. Unless otherwise clearly defined, ordinary technicians in this field can understand the specific meanings of the above terms in the present invention according to the specific circumstances.
[0089] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A medical ICD code classification method based on graph neural network, characterized in that: The following steps are involved: S1. Obtain a data set and preprocess it to obtain a text vector matrix; the data set includes multiple medical record coding data, each medical record coding data includes a condition description text and a standard coding set; the standard coding set includes one or more ICD codes; S2. construct a graph structure according to the text vector matrix, wherein the graph structure includes a node feature matrix and an adjacency matrix; S3. Input the graph structure into the graph neural network model to output the predicted ICD coding result, and use the multi-label loss function based on cross entropy to train the model; S4. Input the medical record data to be coded into the trained graph neural network model to obtain the predicted ICD code.
2. According to the medical ICD coding classification method based on graph neural network in claim 1, it is characterized in that: Step S1 specifically includes: S11. Determine whether there is only one ICD code in the standard code set of the medical record code data. If so, combine the condition description text and the ICD code into a sample. If not, execute step S12; S12. Divide the condition description text into multiple sub-texts according to the separator; for each sub-text, calculate its similarity with each ICD code in the standard code set, and select the ICD code corresponding to the highest similarity to form a sample; S13. Perform word embedding processing on each sample to obtain the corresponding text vector, and all text vectors form a text vector matrix.
3. According to claim 2, a medical ICD code classification method based on graph neural network is characterized in that: Step S13 performs word embedding processing on each sample to obtain the corresponding word vector, including: S131. Perform word segmentation on the text in the sample in combination with the Unified Medical Language System UMLS to obtain a plurality of words; the word is a medical term, or an ordinary word, or a meaningless stop word; S132. Perform stop word removal processing on the decomposition result of step S131 to obtain a vocabulary set; S133. Use a pre-trained word vector model to convert each word in the vocabulary set into a word vector of fixed dimension, and combine all word vectors into the text vector of the sample.
4. According to the medical ICD coding classification method based on graph neural network in claim 1, it is characterized in that: Step S2 includes: S21. Define nodes: take each text in the text vector matrix as a node, take the text vector as the initial feature of the node, and obtain the node feature matrix; S22. Define semantic weight: Calculate the semantic similarity between every two nodes. If the semantic similarity is greater than the semantic threshold, the semantic weight between the two nodes is the semantic similarity. Otherwise, the semantic weight between the two nodes is 0. S23. Define hierarchical weight: Calculate the hierarchical distance between the ICD codes corresponding to each 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 two nodes. If the co-occurrence frequency is greater than the frequency threshold, 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: perform weighted fusion on the semantic weight, hierarchical weight and frequency weight between every two nodes. If the fusion result is greater than 0, an edge is connected between the two nodes, and the edge weight is the fusion result, and finally the adjacency matrix is obtained.
5. According to the medical ICD coding classification method based on graph neural network in claim 1, it is characterized in that: The graph neural network model includes multiple attention graph convolution layers. The processing process of the lth attention graph convolution layer includes: S31. Take the output H of the l-1th attention graph convolution layer l As the input of the lth attention graph convolutional layer, represents the input of node i in the lth attention graph convolution layer; S32. Input of node i in the lth attention graph convolution layer The attention mechanism is used to perform neighbor node feature fusion processing to obtain the updated feature representation of node i in the lth attention graph convolution layer. Thus, the output H of the lth attention graph convolution layer is obtained l+1 .
6. According to the medical ICD coding classification method based on graph neural network in claim 1, it is characterized in that: The multi-label loss function based on cross entropy is expressed as Among them, y i represents the true label of node i, represents the predicted classification result of 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
ICD coding method and device and electronic equipment
CN116304048A
Automatic ICD coding method and system based on disease relation enhancement
CN116364220A
A system for identifying abnormalities in the course of medical treatment based on a hierarchical neural network
JP7365747B1
Cited By
Method and system for generating settlement list based on medical data
CN120068802A
Automatic coding method for realizing international disease classification
CN120493868A
Medical expense prediction method based on multi-scale features
CN122337532A
A Medical Cost Prediction Method Based on Multi-Scale Features
CN122337532B