A medical record text automatic classification and coding method based on deep learning
Patent Information
- Application Number
- CN202611154044.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-10-23
AI Technical Summary
然而,该技术路线存在结构性缺陷
[0007]与现有技术相比,本申请提供的一种基于深度学习的病案文本自动分类编码方法,其首先通过预训练医学语言模型提取核心医疗实体并结合外部医学知识图谱构建病案实体逻辑图,将临床推理链条显式建模为图拓扑结构。进而引入实体-标签异构二分图架构,利用动态路由机制使文本实体特征沿医学逻辑边自主选择性流入对应ICD标签节点,通过图卷积网络的多轮迭代聚合与收敛实现实体证据向编码标签的自适应分配。通过这样的方式,有效消除了模板噪声干扰并建立了跨段落医学逻辑推理通道,从而提升了病案自动编码准确率、降低了互斥过编与蕴含漏编错误率。
Smart Images

Figure CN122964269A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent classification coding, and more specifically, to a method for automatic classification coding of medical record texts based on deep learning. Background Technology
[0002] Disease classification coding on the front page of medical records is a core component of medical record management in healthcare institutions. Its coding quality directly impacts the accuracy of DRG / DIP payment settlements under medical insurance, the reliability of epidemiological statistics on disease spectrum, and the effectiveness of clinical research data mining. With the continuous increase in the number of hospital discharges annually, the manual coding model faces real bottlenecks such as a severe shortage of professional coders, lengthy coding cycles, and inconsistent coding due to subjective judgment differences among coders. Therefore, there is an urgent need to develop an efficient and accurate automatic classification and coding scheme for medical record texts to replace or supplement the manual coding process.
[0003] Existing automatic coding schemes primarily rely on deep learning sequence models for end-to-end multi-label classification of medical record texts. These methods typically employ traditional Transformer or CNN architectures as text encoders, performing global weighted summation or global pooling on all tokens to extract semantic features of the medical record, and then outputting the activation probabilities of each candidate ICD code through a fully connected classification layer. However, this approach suffers from structural flaws. First, when processing medical record texts as long as 5000 words, valuable diagnostic evidence often accounts for only about 200 words. The remaining large amount of structured templates and supporting physical descriptions constitute significant noise interference during global pooling. The model calculates attention weights solely based on the statistical co-occurrence frequency of the text in the training set, lacking the constraints and guidance of a medical knowledge graph, leading to broken inference chains between entities across paragraphs. Secondly, existing schemes treat each ICD candidate code as an independent classification label and predict it in isolation, completely ignoring the competitive and mutually exclusive relationships and synergistic implications between labels that objectively exist in the ICD coding system. Mutually exclusive codes are simultaneously activated due to the lack of mutual inhibition mechanisms, resulting in overcoding errors. Implicit codes omit additional codes that are forcibly associated due to isolated decision-making, which seriously restricts the clinical applicability of automatic coding systems.
[0004] Therefore, an optimized deep learning-based automatic classification and coding method for medical record texts is desired. Summary of the Invention
[0005] To address the aforementioned technical issues, this application provides a deep learning-based method for automatic classification and encoding of medical record texts.
[0006] According to one aspect of this application, a deep learning-based automatic classification and coding method for medical record texts is provided, comprising: Step 1: Based on the pre-trained medical language model, name entity recognition and feature encoding are performed on the medical record text data to obtain a set of medical entities and an entity context feature matrix. Step 2: Based on the predefined medical logical relationships between entities in the external medical knowledge graph, perform association matching and topology construction on the medical entity set to obtain the medical record entity logical graph; Step 3: Vectorize each candidate code based on the disease classification code hierarchy dictionary to construct label nodes, and establish cross-type directed connections between the label nodes and the entity nodes in the medical record entity logic graph, and combine the entity context feature matrix as the node attribute assignment to obtain the entity-label heterogeneous bipartite graph. Step 4: The entity representation is updated by aggregating neighbor features along the medical logic edges in the entity-label heterogeneous bipartite graph using a graph convolutional network. The semantic coupling coefficient between the updated entity representation and each label node is also updated. The entity features are adaptively aggregated to the corresponding label nodes according to the coupling coefficient. After multiple rounds of iteration and convergence, the label convergence feature matrix is obtained. Step 5: Perform probability mapping and threshold filtering on the label convergence feature matrix to output the structured disease classification coding results.
[0007] Compared with existing technologies, this application provides a deep learning-based automatic classification and encoding method for medical record texts. First, it extracts core medical entities using a pre-trained medical language model and constructs a logical graph of medical record entities by combining it with an external medical knowledge graph, explicitly modeling the clinical reasoning chain as a graph topology. Then, it introduces an entity-label heterogeneous bipartite graph architecture, utilizing a dynamic routing mechanism to allow text entity features to autonomously and selectively flow into corresponding ICD label nodes along medical logic edges. Through multiple rounds of iterative aggregation and convergence of the graph convolutional network, it achieves adaptive allocation of entity evidence to encoding labels. This approach effectively eliminates template noise interference and establishes cross-segment medical logic reasoning channels, thereby improving the accuracy of automatic medical record encoding and reducing the error rates of mutual exclusion overcoding and implied omissions. Attached Figure Description
[0008] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0009] Figure 1 This is a flowchart of a deep learning-based automatic classification and encoding method for medical record texts according to an embodiment of this application; Figure 2This is a schematic diagram of the data flow of a deep learning-based automatic classification and encoding method for medical record texts according to an embodiment of this application; Figure 3 This is a flowchart of step two in the deep learning-based automatic classification and encoding method for medical record texts according to an embodiment of this application; Figure 4 This is a flowchart of step four in the deep learning-based automatic classification and encoding method for medical record texts according to an embodiment of this application. Detailed Implementation
[0010] Hereinafter, exemplary embodiments according to this application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments of this application. It should be understood that this application is not limited to the exemplary embodiments described herein.
[0011] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" are not specifically singular and may include plural forms. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0012] While this application makes various references to certain modules of the systems according to embodiments of this application, any number of different modules can be used and run on user terminals and / or servers. The modules described are merely illustrative, and different aspects of the systems and methods may use different modules.
[0013] Flowcharts are used in this application to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0014] In the technical solution of this application, an automatic classification and encoding method for medical record text based on deep learning is proposed. Figure 1 This is a flowchart of a deep learning-based automatic classification and encoding method for medical record texts according to an embodiment of this application. Figure 2 This is a system architecture diagram of a deep learning-based automatic classification and encoding method for medical record texts according to an embodiment of this application. Figure 1 and Figure 2As shown, the deep learning-based automatic classification and encoding method for medical record text according to an embodiment of this application includes the following steps: S1, based on a pre-trained medical language model, performing named entity recognition and feature encoding on the medical record text data to obtain a set of medical entities and an entity context feature matrix; S2, based on predefined medical logical relationships between entities in an external medical knowledge graph, performing association matching and topology construction on the set of medical entities to obtain a medical record entity logic graph; S3, based on a disease classification code hierarchy dictionary, vectorizing each candidate code to construct label nodes, and associating the label nodes with the medical record entity logic graph. S4. Cross-type directed connections are established between entity nodes, and the entity context feature matrix is used as the node attribute to obtain an entity-label heterogeneous bipartite graph. S5. The neighbor features of entity nodes are aggregated along the medical logic edges in the entity-label heterogeneous bipartite graph through a graph convolutional network to update the entity representation. The semantic coupling coefficient between the updated entity representation and each label node is updated, and the entity features are adaptively aggregated to the corresponding label nodes according to the coupling coefficient. After multiple rounds of iteration and convergence, the label convergence feature matrix is obtained. S6. The label convergence feature matrix is subjected to probability mapping and threshold filtering to output the structured disease classification coding result.
[0015] Specifically, S1, based on a pre-trained medical language model, performs named entity recognition and feature encoding on medical record text data to obtain a set of medical entities and an entity context feature matrix. It should be understood that medical record text data is typically composed of multiple paragraphs, including the chief complaint, present illness history, past medical history, auxiliary examinations, and discharge diagnosis, with a total length reaching several thousand words. However, the key information with real diagnostic coding value is often only scattered among a small number of medical entities (such as disease names, symptoms and signs, examination indicators, surgical procedures, etc.), while the remaining large number of structured template statements and accompanying descriptions constitute information noise. If the entire text is directly input into a classifier for end-to-end mapping, the model struggles to accurately locate the medical entities and their semantic context that play a decisive role in coding decisions from the lengthy text. Therefore, in the technical solution of this application, a pre-trained medical language model is used to perform deep semantic encoding on the medical record text, and named entity recognition technology is used to accurately extract the set of medical entities from the global hidden state. At the same time, the semantic feature representation of each identified entity in the original context is extracted to form an entity context feature matrix. This compresses the input of subsequent graph structure modeling and encoding prediction from the original long text into a structured entity-level semantic representation, which not only eliminates the noise interference of irrelevant text, but also preserves the complete contextual semantic information of each entity in the medical record context.
[0016] In specific implementation, step 1.1 involves global sequence encoding and deep contextual semantic feature extraction of the medical record text data to obtain a global sequence hidden state tensor. Specifically, firstly, the chief complaint text, present medical history text, past medical history text, auxiliary examination text, and discharge diagnosis text in the medical record text data are concatenated in a preset order to form a unified original input character sequence. Subsequently, the word segmenter built into the pre-trained medical language model is used to perform sub-word segmentation and tokenization processing on the original input character sequence, inserting special classification tags at the beginning of the sequence and special delimiter tags at the end of the sequence to generate a complete input tag sequence containing N tags. Next, the input tag sequence is fed into the embedding layer of the pre-trained medical language model, where word embedding, position embedding, and paragraph embedding are performed element-wise and fused to obtain an initial embedding matrix. The initial embedding matrix is then processed through a layer-by-layer forward propagation of multiple stacked Transformer encoder layers in a pre-trained medical language model. Each Transformer encoder layer calculates the attention weights between the current label and all other labels in the sequence through a multi-head self-attention mechanism, achieving bidirectional interactive fusion of global contextual information. A feedforward neural network then performs nonlinear transformations and dimension mapping on the fused features. After layer-by-layer processing by all Transformer encoder layers, a global sequence hidden state tensor is obtained at the output of the final hidden layer. The number of rows in this tensor equals the length N of the input label sequence, and the number of columns equals the dimension d of the hidden state vectors. The hidden state vector at each position in this global sequence hidden state tensor encodes the deep semantic feature representation of the corresponding label within the global context of the entire medical record text.
[0017] In step 1.2, the medical entity sequence is decoded using a conditional random field (CRF) based method to obtain a set of medical entities. Specifically, firstly, a linear classification layer is added to the global sequence hidden state tensor. The d-dimensional hidden state vector at each labeled position is mapped to the label space through a linear transformation of the weight matrix and the bias vector, yielding the unnormalized score of each candidate BIO label at each labeled position. This score matrix has rows equal to the label sequence length N and columns equal to the size K of the BIO label set, where each element represents the probability score of the corresponding labeled position being labeled with the corresponding label. Subsequently, this emission score matrix is input into the CRF decoding layer. The CRF introduces a learnable label transition matrix to model the transition constraints between adjacent labeled positions. The size of this transition matrix is... Each element represents the transition score from one label to another. For any candidate label sequence, its global sequence score under the Conditional Random Field (CRF) model equals the sum of two parts: the first part is the sum of the emission scores of the corresponding labels at each position in the sequence, and the second part is the sum of the label transition scores between each pair of adjacent positions in the sequence. During the training phase, the CRF learns parameters by maximizing the log-likelihood probability of the correct label sequence, which is equal to the global score of the correct sequence minus the log-exponential sum of the scores of all possible label sequences (this log-exponential sum is efficiently calculated recursively using a forward algorithm, avoiding exhaustive traversal of the exponential sequence space). During the inference phase, the Viterbi decoding algorithm searches for the optimal label sequence with the highest global score in all possible label sequence spaces. This algorithm uses a dynamic programming strategy to solve for the global optimum in linear time complexity. In the decoded optimal label sequence, each label is assigned a BIO format label (B represents the entity's starting position, I represents the entity's internal position, and O represents a non-entity position). Based on the continuous distribution pattern of BIO tags, boundary identification and aggregation are performed on all continuous tag segments labeled as the same entity. The start and end position indices of each entity in the original tag sequence, as well as the entity category identifier, are extracted. All identified medical entities are then organized sequentially into a medical entity set, which contains a total of Each medical entity is recorded as a triple of start position, end position, and entity type.
[0018] In step 1.3, based on the start and end position indices of each entity in the medical entity set in the original labeled sequence, mean pooling and row-wise concatenation are performed on the hidden state vectors of the corresponding position segments in the global sequence hidden state tensor to obtain the entity context feature matrix. Specifically, for the j-th entity in the medical entity set, its start position index in the original labeled sequence is the s-th position, and its end position index is the e-th position. The label span corresponding to this entity is a continuous segment from the s-th label to the e-th label. All hidden state vectors of the corresponding position segment of this entity (i.e., all hidden state vectors from the s-th position to the e-th position) are extracted from the global sequence hidden state tensor, and mean pooling is performed on these hidden state vectors in the sequence dimension. Specifically, the hidden state vectors of all labeled positions within the entity span are summed element-wise and divided by the number of labels spanned by the entity (i.e., the end position minus the start position plus 1), thereby compressing the variable-length labeled hidden state sequence into a fixed d-dimensional entity-level semantic feature vector. By averaging the hidden states of all marked positions within the entity span, the local semantic details carried by each marked position are fused with the global contextual information into a comprehensive semantic representation of the entity as a whole. This not only preserves the contextual information of the entity in the medical record text, but also achieves dimensional unification from variable-length marked sequences to fixed-dimensional vectors.
[0019] Complete all of the medical entity set After calculating the contextual semantic feature vectors of each entity, all entity feature vectors are vertically concatenated along the row dimension in entity index order to obtain the entity contextual feature matrix. The number of rows in this matrix is equal to the total number of medical entities. The number of columns is equal to the dimension d of the feature vector, and the j-th row of the matrix is the context semantic feature vector of the j-th medical entity. This entity context feature matrix will be used as the initial attribute features of entity nodes in subsequent steps to participate in the construction of the medical record entity logic graph and the assignment of node features in the entity-label heterogeneous bipartite graph.
[0020] Specifically, in step S2, based on the predefined medical logical relationships between entities in an external medical knowledge graph, association matching and topology construction are performed on the medical entity set to obtain the medical record entity logic graph. It should be understood that after the named entity recognition and feature encoding in step one, the medical entity set and its corresponding entity context feature matrix have been obtained. However, at this point, each medical entity still exists as a discrete, independent, flat set, and the medical logical relationships between entities have not yet been explicitly modeled. However, in the actual clinical diagnostic reasoning process, there are objectively rich and deterministic logical relationships between medical entities such as diseases, symptoms, examination indicators, and drugs. For example, there is a causal reasoning relationship between "decreased left ventricular ejection fraction" and "chronic heart failure" that supports diagnosis; a pathogenic relationship between "hypertension" and "hypertensive heart disease" that leads to complications; and a relationship between "type 2 diabetes" and "metformin" that corresponds to treatment. These medical logical relationships between entities are the core reasoning chains upon which coders rely when making ICD encoding decisions. If they are not explicitly modeled, the subsequent graph neural network will be unable to propagate features and aggregate reasoning along meaningful medical logical paths. Therefore, in the technical solution of this application, by using the predefined medical logical relationships between entities in an external medical knowledge graph, the discrete medical entity set is transformed into a medical record entity logic graph with a topological structure, so that the clinical reasoning chain between entities is explicitly encoded in the form of graph edge connections, providing a structured graph topology foundation for subsequent graph convolutional networks to perform neighbor feature aggregation along medical logical edges.
[0021] Figure 3 This is a flowchart of step two in the deep learning-based automatic classification and encoding method for medical record text according to an embodiment of this application. Figure 3 The S2 includes: S2.1, based on the predefined entity logical relationship triplet library in the external medical knowledge graph, performing graph node instantiation and pairwise medical relationship retrieval matching on the medical entity set to obtain the initial node set of the isomorphic graph and the entity logical relationship triplet set; S2.2, using the relationship type of each triplet in the entity logical relationship triplet set and its corresponding preset edge connection weight, performing weighted self-loop adjacency matrix calculation and graph topology instantiation encapsulation on the initial node set of the isomorphic graph to obtain the medical record entity logical graph.
[0022] Specifically, in S2.1, based on a predefined triplet library of logical relationships between entities in an external medical knowledge graph, graph node instantiation and pairwise medical relationship retrieval and matching are performed on the medical entity set to obtain an initial set of isomorphic graph nodes and a set of entity logical relationship triplets. Specifically, firstly, all nodes in the medical entity set... Each medical entity is traversed sequentially, and each medical entity is instantiated as a node object in a graph data structure. A unique node index number (from 1 to 1) is assigned to each node. The entity's name and category identifier are stored as attribute information for the node, thus completing the entire process. Instantiate the graph nodes of each entity to form the initial node set of the isomorphic graph, which contains 1. Entity nodes of the same type. Then, all nodes in the initial set of isomorphic graphs... Each entity node is paired up to generate all possible ordered entity pairs (totaling...). An ordered pair is constructed for any two distinct entity nodes i and j. and orderly pairs For each ordered entity pair, the first entity in the pair is designated as the head entity and the second entity as the tail entity. A precise search and matching is performed in the entity logical relation triplet library of the external medical knowledge graph to determine if a predefined logical relation triplet record exists, starting with the head entity and ending with the tail entity. Specifically, the name text of the head entity and the name text of the tail entity in the current ordered entity pair are matched against the head entity field and tail entity field of each triplet record in the triplet library (supporting precise matching and synonym normalization matching). If a matching record is found in the triplet library, the relation type identifier of the triplet is extracted, and the successfully matched triplet (head entity, relation type, tail entity) is added to the entity logical relation triplet set. After completing the traversal and retrieval of all ordered entity pairs, the entity logical relation triplet set is obtained. This set contains all entity logical relation records in the current medical record that have been verified and confirmed by the knowledge graph. Each record consists of three elements: head entity node index, relation type identifier, and tail entity node index.
[0023] Specifically, in S2.2, the relationship types of each triple in the entity logical relationship triple set and their corresponding preset edge connection weights are used to perform weighted adjacency matrix calculation with self-loops and graph topology instantiation encapsulation on the initial node set of the isomorphic graph to obtain the case entity logical graph. Specifically, firstly, a graph of size is initialized... The initial state of the adjacency matrix is a square matrix of all zeros, where... This represents the total number of nodes in the initial node set of the isomorphic graph (i.e., the total number of medical entities). Subsequently, each triplet record in the entity logical relation triplet set is traversed sequentially. For each triplet record, its head entity node index i, tail entity node index j, and relation type identifier r are extracted. Based on a pre-established mapping rule table from relation type to edge connection weights (this rule table is a system preset parameter, assigning numerical weights reflecting the importance of each relation type in clinical reasoning), the preset edge connection weight value corresponding to relation type r is queried. And set the value of the element in the i-th row and j-th column of the adjacency matrix to This indicates that there exists a path with weight from node i to node j. The directed edges are connected. After traversing all triplet records, the off-diagonal positions of the adjacency matrix record the directed weighted connections of all logical relationships between entities. Next, self-loop connections are assigned to the diagonal positions of the adjacency matrix, that is, the element value in the i-th row and i-th column of the adjacency matrix is set to a preset self-loop weight value (usually set to 1). The physical meaning of this self-loop connection is to ensure that when the subsequent graph convolutional network performs neighbor feature aggregation, each node can retain its own original feature information without being completely covered by the neighbor features. Thus, a weighted adjacency matrix with self-loops is obtained, which can be formally represented as: in, For the weighted adjacency matrix with self-loops, the th Line number The element values of the column; For relation type The corresponding preset edge connection weight value; It is a set of entity logical relation triples; This indicates that there exists a sub-node in the set of triples. Through relation type Pointing to node The triplet record; Represents a self-loop connection at the diagonal position.
[0024] Finally, the initial set of nodes in the isomorphic graph (containing The entity nodes and their attribute information are instantiated and encapsulated into a graph data structure using a weighted adjacency matrix with self-loops. Specifically, the initial node set of the isomorphic graph is used as the node set of the graph, and the weighted adjacency matrix with self-loops is used as the topological connection description and edge weight description. These are then unified and encapsulated into a complete weighted directed graph data structure object, which is the medical record entity logic graph. Each node in the medical record entity logic graph represents a medical entity in the current medical record. The directed weighted edges between nodes represent the medical logical relationship between the two entities, verified and confirmed by an external medical knowledge graph. The edge weights reflect the importance of this relationship in clinical reasoning, and diagonal self-loop connections ensure that each node retains its own characteristics during subsequent graph convolution. This medical record entity logic graph will serve as the basis for constructing the entity-label heterogeneous bipartite graph in step three, providing a structured topological path for the graph convolutional network to aggregate neighbor features along medical logical edges.
[0025] Specifically, in step S3, candidate codes are vectorized based on a disease classification code hierarchy dictionary to construct label nodes. Cross-type directed connections are established between the label nodes and entity nodes in the medical record entity logic graph, and the entity context feature matrix is used as the node attribute assignment, resulting in an entity-label heterogeneous bipartite graph. It should be understood that after steps one and two, a medical record entity logic graph containing medical logical relationships between medical entities and an entity context feature matrix encoding the semantic information of each entity's context have been obtained. However, the graph structure at this point only contains entity nodes; ICD disease classification code labels have not yet been introduced as prediction target nodes in the graph. In traditional multi-label classification paradigms, each candidate ICD code typically exists as an independent fully connected output neuron. The model directly generates activation probabilities through a linear mapping between the global text feature vector and each output neuron, lacking topological connections and information interaction channels between labels. This flattened label processing method cannot establish an explicit reasoning path between entity evidence and coded labels, nor can it provide a structured interaction carrier between label nodes and entity nodes for subsequent dynamic routing mechanisms. Therefore, in the technical solution of this application, each candidate code in the ICD disease classification coding system is vectorized into a label node with semantic features, and these label nodes are heterogeneously connected to the entity nodes in the medical record entity logic graph through cross-type directed edges. At the same time, all nodes are assigned corresponding feature attributes, and finally a heterogeneous bipartite graph data structure containing both entity nodes and label nodes is constructed, providing a unified graph topology carrier for the cross-type feature propagation and dynamic routing iterative aggregation of subsequent graph convolutional networks.
[0026] In specific implementation, in step 3.1, based on the pre-trained text encoder, the standard text descriptor sequences of each candidate code in the disease classification code hierarchy dictionary are vectorized and dimensionality-reduced to obtain the tag node set and the initial tag node feature matrix. Specifically, firstly, all L candidate codes and their corresponding standard text descriptor sequences are extracted from the disease classification code hierarchy dictionary, where L is the total number of candidate ICD codes that the system needs to predict. The standard text descriptor sequence of each candidate code is the standardized disease name text description of that code in the ICD coding system (for example, the standard text descriptor sequence corresponding to code I50.0 is "congestive heart failure", and the standard text descriptor sequence corresponding to code E11.22 is "type 2 diabetes mellitus with diabetic chronic kidney disease"). Subsequently, the standard text descriptor sequence of each candidate code is vectorized using the pre-trained text encoder. Specifically, the standard text descriptor sequence of the k-th candidate encoding is input into the tokenizer of the pre-trained text encoder for tokenization, generating a tokenized sequence for the descriptor. This tokenized sequence is then fed into the pre-trained text encoder for forward propagation encoding, yielding the hidden state vector for each tokenized position in the descriptor sequence at the output of the final hidden layer. Since the standard text descriptor sequences of different candidate encodings vary in length (e.g., "heart failure" has only 4 characters while "type 2 diabetes with diabetic chronic kidney disease" has more than 10 characters), to transform the variable-length tokenized hidden state sequence into a fixed-dimensional encoding-level semantic feature vector, a dimensionality reduction aggregation operation is performed on the hidden state vectors of all tokenized positions in the descriptor sequence. Specifically, mean pooling is performed on the hidden state vectors of all tokenized positions in the k-th candidate encoding descriptor sequence along the sequence dimension to obtain a fixed d-dimensional semantic feature vector for the candidate encoding.
[0027] After vectorizing and dimensionality-reducing all L candidate codes, each candidate code is instantiated as a label node, assigned a unique label node index number (from 1 to L), and the calculated d-dimensional semantic feature vector is used as the initial feature attribute of the label node, thus forming a label node set containing L label nodes. The semantic feature vectors of all L label nodes are vertically concatenated along the row dimension in label index order to obtain the initial label node feature matrix. The number of rows in this matrix is equal to the total number of candidate codes L, and the number of columns is equal to the feature vector dimension d. The k-th row of the matrix is the semantic feature vector of the k-th candidate ICD code.
[0028] In step 3.2, based on the cross-type fully connected directed edges established between all entity nodes in the medical record entity logic graph and all label nodes in the label node set, heterogeneous topological connections and block adjacency matrices are constructed for the two types of nodes to obtain the heterogeneous bipartite graph topological matrix. Specifically, firstly, the total number of nodes in the heterogeneous bipartite graph is determined to be... ,in This represents the number of entity nodes in the medical record entity logic graph (i.e., the total number of medical entities). This represents the number of tag nodes in the tag node set (i.e., the total number of candidate ICD codes). All nodes are uniformly numbered in the order of entity first, then label, i.e., the first... Each location is a physical node, and then... Each position is a tag node (index) to Then, initialize a size of (). ) ( The all-zero square matrix is used as the initial state of the heterogeneous bipartite graph topology matrix. This matrix can be divided into four blocks according to node type: the upper left block corresponds to the connection relationship between entity nodes, the upper right block corresponds to the cross-type connection relationship from entity nodes to label nodes, the lower left block corresponds to the connection relationship from label nodes to entity nodes, and the lower right block corresponds to the connection relationship between label nodes.
[0029] For the top-left block, the weighted adjacency matrix with self-loops from the medical record entity logic graph is directly filled into this block, preserving the existing medical logical relationships between entity nodes and their corresponding edge weights. For the top-right block, based on the cross-type fully connected directed edge establishment rules, all nodes in the medical record entity logic graph are included. All of the entity nodes and tag nodes in the set A directed edge connection is established between each entity node and each label node, that is, for any entity node i and any label node i... In the topological matrix of a heterogeneous bipartite graph, the i-th row and the ( The column with a connection weight of 1 indicates that there is a directed edge from entity node i to label node k. The physical meaning of this fully connected rule is that no prior assumptions are made about the correspondence between entities and labels in the initial stage, allowing the features of each entity node to flow to any label node via directed edges. For the lower left and lower right blocks, the weights are kept all zero in the current step (i.e., no reverse connections are established from label nodes to entity nodes, nor are direct connections established between label nodes). This is because the direction of information flow is designed as unidirectional propagation from entities to labels, and the constraint relationships between labels will be processed independently through the label constraint interaction matrix during the iteration in step four.
[0030] In step 3.3, the entity context feature matrix and the initial label node feature matrix are vertically concatenated along the node dimension to construct global node attributes. The heterogeneous bipartite graph topology matrix is then subjected to node feature assignment and graph data structure instantiation to obtain the entity-label heterogeneous bipartite graph. Specifically, firstly, the entity context feature matrix and the initial label node feature matrix are vertically concatenated along the node dimension (i.e., row dimension) to obtain the global node attribute matrix. This vertical concatenation operation arranges the feature vectors of the entity nodes at the beginning of the matrix. The feature vectors of the label nodes are arranged in the last L rows of the matrix, thus forming a matrix with L rows. A unified characteristic matrix with d columns, where the first... In the topological matrix of a row and a heterogeneous bipartite graph, the first Each node position corresponds one-to-one, then The rows correspond one-to-one with the last L nodes in the heterogeneous bipartite graph topology matrix. Furthermore, the global node attribute matrix is assigned as the feature attributes of all nodes to the graph topology described by the heterogeneous bipartite graph topology matrix. That is, the i-th row vector of the global node attribute matrix is used as the feature attribute of the i-th node in the heterogeneous bipartite graph. The heterogeneous bipartite graph topology matrix is used as the edge connection and weight description of the graph. The node set, node features, and edge topology are uniformly encapsulated into a complete heterogeneous graph data structure object, which is the entity-label heterogeneous bipartite graph. This graph contains two types of nodes (entity nodes and label nodes) and two types of edges (medical logical relationship edges between entity nodes and cross-type fully connected directed edges from entity nodes to label nodes). This provides a unified graph structure carrier for the graph convolutional network in step four to perform homogeneous neighbor feature aggregation on the entity subgraph and to propagate entity features across types to label nodes through a dynamic routing mechanism.
[0031] Specifically, in step S4, a graph convolutional network is used to aggregate neighbor features of entity nodes along the medical logic edges in the entity-label heterogeneous bipartite graph to update the entity representation. The semantic coupling coefficient between the updated entity representation and each label node is then updated, and the entity features are adaptively aggregated to the corresponding label nodes according to the coupling coefficient. After multiple iterations and convergence, a label convergence feature matrix is obtained. It should be understood that in real clinical coding reasoning, a coder's coding judgment for a disease does not solely rely on the textual description of the disease entity itself, but requires comprehensive consideration of collaborative evidence provided by other entities with medical logical relationships (such as examination indicators supporting the diagnosis, causative entities causing the disease, and associated symptoms and signs). Therefore, in the technical solution of this application, a graph convolutional network is used to aggregate neighbor features along the medical logic edges between entities, enabling the feature representation of each entity node to incorporate the corroborating information carried by its associated entities, forming a richer updated entity representation. Furthermore, after updating entity features, a dynamic routing mechanism is established to guide the flow of entity features to label nodes. By calculating the semantic coupling coefficient between the updated entity representation and each label node, entity features are adaptively assigned to corresponding label nodes according to their relevance. Through multiple iterations, the features of the label nodes gradually converge to a steady state, and finally, a label convergence feature matrix is output for use in downstream classification steps. In this way, cross-entity medical logical reasoning propagation is achieved at the graph topology level, and adaptive aggregation and iterative refinement of entity evidence to encoded labels are achieved at the dynamic routing level.
[0032] Figure 4 This is a flowchart of step four in the deep learning-based automatic classification and encoding method for medical record text according to an embodiment of this application. Figure 4 As shown, in the first embodiment of this application, step S4 includes: S4.1, performing isomorphic entity neighbor feature aggregation based on graph convolutional networks on the isomorphic entity subgraph decoupled from the entity-label heterogeneous bipartite graph to obtain an updated entity feature matrix; S4.2, performing cross-type semantic matching degree evaluation and normalized route weight quantization on the updated entity feature matrix and the initial label node feature matrix in the entity-label heterogeneous bipartite graph to obtain a route coupling coefficient matrix; S4.3, based on the route coupling coefficient matrix, performing iterative feature allocation and label feature convergence on the updated entity feature matrix and the initial label node feature matrix to obtain a label converged feature matrix.
[0033] Specifically, in S4.1, isomorphic entity neighbor feature aggregation based on graph convolutional networks is performed on the isomorphic entity subgraph decoupled from the entity-label heterogeneous bipartite graph to obtain an updated entity feature matrix. Specifically, firstly, isomorphic entity subgraphs are extracted from the entity-label heterogeneous bipartite graph, that is, the top-left block corresponding to the heterogeneous bipartite graph's topology matrix is extracted. The weighted adjacency matrix with self-loops and the global node attribute matrix in the first The entity context feature matrix corresponding to each row is composed of these two parts, forming an isomorphic subgraph containing only entity nodes. Subsequently, a neighbor feature aggregation operation based on a graph convolutional network is performed on this isomorphic entity subgraph. Specifically, the graph convolutional network first performs symmetric normalization on the weighted adjacency matrix with self-loops to eliminate the inconsistency in aggregation scale caused by differences in the number of neighbors (i.e., degree) of different nodes, resulting in a symmetrically normalized adjacency matrix. Then, matrix multiplication is performed between the symmetrically normalized adjacency matrix and the entity context feature matrix to achieve weighted aggregation of neighbor features. A linear transformation is then performed using a learnable weight matrix, followed by processing with a nonlinear activation function to obtain the updated entity feature matrix. After graph convolution processing, the feature vector of each entity node in the updated entity feature matrix no longer contains only the textual semantic information of the entity itself, but also incorporates the associated diagnostic evidence carried by its neighboring entities connected along the medical logic edge. For example, the updated features of the "chronic heart failure" node will incorporate feature information from diagnostic support neighboring nodes such as "left ventricular ejection fraction 35%" and "BNP 1850pg / mL".
[0034] Specifically, in S4.2, cross-type semantic matching degree evaluation and normalized route weight quantization are performed on the updated entity feature matrix and the initial label node feature matrix in the entity-label heterogeneous bipartite graph to obtain the route coupling coefficient matrix. Specifically, firstly, all nodes in the updated entity feature matrix... Each entity feature vector and all of the initial node feature matrices of the label For each label feature vector, pairwise cross-type semantic matching degree is calculated. Specifically, the corresponding dimension elements of the entity feature vector and the label feature vector are multiplied one by one and then summed to obtain a scalar value as the raw score of semantic matching degree between the two. For all... Individual entities and all After calculating the pairwise inner product of the labels, the dimension is obtained as follows: OK The original semantic matching score matrix is obtained by first calculating the element value in the k-th row and j-th column, where the element represents the original matching score of the j-th entity to the k-th tag. Then, the original semantic matching score matrix is normalized and quantized to ensure that the sum of the routing weights received by each tag node from all entity nodes is 1, ultimately yielding the routing coupling coefficient matrix. The routing coupling coefficient matrix obtained after the above calculation has dimensions of [dimension missing]. OK The matrix is a series of columns, where the sum of the elements in each row is 1. The value of the element in the k-th row and j-th column represents the routing weight assigned by the k-th label node to the j-th entity node when aggregating entity features. The physical meaning of this routing coupling coefficient matrix is that it establishes a soft routing allocation scheme for each label node, selectively receiving feature signals from all entity nodes. Entity-label pairs with high semantic matching will receive larger routing weights, meaning that diagnostic evidence carried by that entity will flow into that label node in a higher proportion; entity-label pairs with low semantic matching will receive smaller routing weights, meaning that the contribution of irrelevant entity evidence to that label will be automatically suppressed.
[0035] Specifically, in step S4.3, based on the routing coupling coefficient matrix, iterative feature allocation and label feature convergence are performed on the updated entity feature matrix and the initial label node feature matrix to obtain the label converged feature matrix. Specifically, in the t-th iteration, the routing coupling coefficient matrix and the updated entity feature matrix are first multiplied to obtain the original feature signal matrix of each label node weighted and aggregated from the entity nodes. Then, a nonlinear compression operation is performed on the aggregated feature signal matrix to compress the magnitude of the aggregated feature vector to a reasonable range, preventing numerical overflow due to continuous accumulation of eigenvalues during iteration, thus obtaining the compressed feature vector. By performing nonlinear compression on the feature vector of each label node in the aggregated feature signal matrix one by one, the compressed aggregated feature matrix is obtained. Then, the compressed aggregated feature matrix is residually superimposed with the initial label node feature matrix, that is, the elements at corresponding positions of the two matrices are added one by one to obtain the label feature matrix of the t-th iteration. Here, the physical meaning of residual superposition is that the initial node feature matrix of the label serves as the knowledge residual baseline, preserving the semantic definition information of each ICD encoding itself, and preventing semantic drift of the label features due to excessive reliance on entity aggregation signals during multiple iterations.
[0036] After updating the label feature matrix in the t-th iteration, it is determined whether the iteration process has reached convergence. Specifically, the mean squared error between the label feature matrix obtained in the current t-th iteration and the result of the previous iteration (t-1th iteration) is calculated, which is the sum of the squares of the differences between corresponding elements of the two matrices divided by the total number of elements in the matrices. If the mean squared error is greater than a preset convergence threshold, it is determined that the iteration has not yet converged, and the routing coupling coefficient matrix needs to be recalculated based on the currently updated label feature matrix, and the next iteration is started to continue performing feature aggregation and residual superposition. If the mean squared error is less than or equal to the preset convergence threshold, it is determined that the dynamic routing process has reached steady state, and the label feature matrix of the current iteration is formally encapsulated as a label convergence feature matrix and output to the downstream steps. When the convergence condition is met, the label feature matrix obtained in the final iteration is encapsulated as the label convergence feature matrix output. The feature vector of each label node in this matrix has been processed by multiple rounds of routing-aggregation-compression-residual iterative loops, which fully integrates the diagnostic evidence signals from the entity node that best matches its semantics. At the same time, the semantic definition information of the encoding itself is preserved through the residual mechanism, providing a complete and convergent label-level feature representation for the probability mapping and encoding output in the subsequent step five.
[0037] Specifically, as described above, in the automatic classification and encoding method for medical record text based on dynamic routing of bipartite graphs of medical entities and labels, sub-step S4.3, iterative feature allocation and label feature convergence, undertakes the core function of adaptively distributing the entity features updated by graph convolution to each ICD label node through routing coupling coefficients and finally converging the output. The core computational logic of this step is as follows: in each iteration, each ICD label node independently aggregates the feature signals from entity nodes through a weighted aggregation of routing coupling coefficient matrix, and then generates an updated label feature matrix through nonlinear compression and residual superposition. However, this mechanism has a fundamental structural defect: each ICD label node is completely isolated and unaware of each other during the aggregation of entity features. When the j-th label node receives the entity feature stream, it is completely unaware of what information its neighboring label nodes are synchronously receiving, and it is also unable to perceive whether there are medical logical constraints between itself and other label nodes.
[0038] This deficiency can lead to serious business errors in real-world medical record coding scenarios at top-tier hospitals. In the ICD (International Classification of Diseases) coding system, there are two significant logical constraints between labels (i.e., disease codes). The first is a competitive mutual exclusion relationship: In the same hospitalization, certain ICD codes cannot coexist in the final coding result from a medical logic perspective. For example, I21.0 (acute transmural anterior wall myocardial infarction) and I21.1 (acute transmural inferior wall myocardial infarction) are mutually exclusive as primary diagnoses because the same patient cannot simultaneously have both anterior and inferior wall acute transmural infarctions as independent primary diagnoses; similarly, E10 (type 1 diabetes) and E11 (type 2 diabetes) are mutually exclusive in terms of pathological mechanism for the same patient. The second is a cooperative implication relationship: When an ICD code is coded, the coding standard mandates that its associated code must also be coded simultaneously. For example, when E11.22 (type 2 diabetes mellitus with diabetic chronic kidney disease) is activated, the health statistics coding standard requires that a specific stage code of N18 (chronic kidney disease) must be encoded as an additional code.
[0039] Because the tag nodes in the first embodiment are aggregated completely independently and lack any lateral information communication channels, two typical coding errors will occur when facing the above two types of constraint relationships. The first is overcoding: two ICD codes that should be mutually exclusive receive support signals from different entity nodes and are simultaneously activated with a high probability in the absence of a mutual inhibition mechanism, ultimately outputting logically contradictory coding results (such as simultaneously outputting type 1 diabetes and type 2 diabetes). The second is omission coding: in associated codes with implicit dependencies, although the main code is successfully activated by entity features, its forcibly associated supplementary codes are omitted because they do not directly correspond to obvious entity features. In the isolated aggregation mode, the activation probability does not reach the threshold, violating the health statistics coding standards and causing the medical record quality control process to fail.
[0040] To address the aforementioned technical deficiencies, this application further proposes a second embodiment.
[0041] Specifically, firstly, pairwise semantic affinity assessment and positive / negative weighting are performed on the feature vectors of each label node in the initial label node feature matrix to obtain the label constraint interaction matrix. Before entering the dynamic routing iteration loop, a mathematical structure that can explicitly encode the logical constraint relationships between labels needs to be pre-constructed. This step is placed outside the iteration process because the mutual exclusion / implication relationships between ICD labels belong to domain prior knowledge, which is essentially determined by the hierarchical structure of the disease classification system and clinical coding rules. It does not change with the specific case content, so it only needs to be calculated once and can be reused for coding prediction of all subsequent cases.
[0042] Specifically, pairwise cosine similarity is calculated on the feature vectors of all ICD label nodes in the initial label node feature matrix to obtain the semantic affinity values of global label pairs, as shown below: in, For the first The tag node and the first A scalar measure of semantic affinity between individual tag nodes; The first node extracted from the initial node feature matrix of the label The initial feature vector of each label; The first node extracted from the initial node feature matrix of the label The initial feature vector of each label; The Euclidean norm operator for vectors.
[0043] Subsequently, a dual-threshold symbolic mapping strategy is introduced to transform continuous similarity values into discrete positive / negative / zero three-valued symbolic weights: in, For the label constraint interaction matrix, the first... Line number The element values of the column; The upper threshold scalar is used to determine the pre-defined cooperative implication relationship; The upper bound of the predetermined competition and mutual exclusion relationship is determined by a scalar. The lower bound scalar of the pre-defined competition and mutual exclusion relationship determination interval; As a positive value for the collaborative incentive weight scalar, it controls the enhancement propagation strength of the implication relationship; The negative competition suppression weight scalar controls the suppression attenuation strength of the mutual exclusion relationship.
[0044] It should be noted that when the semantic affinity of two labels exceeds the co-occurrence threshold, it indicates that there is a hierarchical implication or strong comorbidity between the label pair (e.g., the text descriptions of diabetic nephropathy and chronic kidney disease are highly similar in semantic space). In this case, a positive weight is assigned to establish a co-occurrence incentive propagation channel. When the affinity falls into the competition range (i.e., sibling codes at the same level in the same ICD chapter, whose descriptive texts are highly similar but are different subtypes of each other's sub-diagnoses), a negative weight is assigned to establish a competition inhibition propagation channel. The remaining label pairs without significant constraints are assigned zero weight to cut off irrelevant propagation paths. Thus, the symbolic weight values of all label pairs are assembled in a matrix structure to generate a label constraint interaction matrix. The positive value region of this matrix constitutes a co-occurrence implication channel in a physical sense, so that when a label is activated by entity features, its implication partner labels can be co-enhanced, thereby ensuring that the associated codes required by the coding specifications are not omitted. The negative value region constitutes a competition inhibition channel, so that when a label is activated, the feature signals of its mutually exclusive opponent labels are suppressed and attenuated, preventing logically contradictory mutually exclusive codes from passing the activation threshold simultaneously from the topological propagation level.
[0045] Next, based on the tag constraint interaction matrix, the aggregated signal obtained from the entity feature matrix after weighted updating of the routing coupling coefficient matrix is subjected to constraint propagation and gating fusion, and the residual of the initial node feature matrix of the tag is superimposed to obtain the tag feature matrix after constraint modulation. Here, it should be understood that in each iteration, two information streams need to be processed simultaneously—the vertical feature aggregation signal from the entity node and the horizontal modulation signal from the tag constraint channel—and the two are adaptively fused through a gating mechanism. Those skilled in the art should know that in real medical record coding, the degree of dependence on the two signals varies significantly in different clinical situations: for common comorbidity combinations with clear constraint relationships (such as hypertension combined with coronary heart disease), the credibility of the tag constraint signal is extremely high, and its fusion weight should be increased to enhance the accuracy of linkage coding; while for rare disease combinations with ambiguous constraint relationships, the constraint signal may be misleading, and its weight should be reduced to avoid false suppression. Therefore, in the second embodiment of this application, parallel processing of dual signals is adopted instead of simple serial superposition.
[0046] Specifically, firstly, the routing coupling coefficient matrix and the updated entity feature matrix are multiplied, and then processed by a nonlinear compression function to obtain the entity aggregation signal matrix, as shown below: in, For the first The entity aggregation signal matrix obtained by standard entity to label aggregation calculation in the next iteration; It is a nonlinear compression function that compresses the vector magnitude to the interval [0,1) while keeping the direction unchanged; For the first The routing coupling coefficient matrix of the next iteration; This is the updated entity feature matrix. Next, the label constraint interaction matrix and the entity aggregation signal matrix are multiplied, and then mapped using the hyperbolic tangent activation function to generate the constraint propagation signal matrix, as shown below: in, For the first The constraint propagation signal matrix obtained by constraint propagation calculation in the next iteration; The hyperbolic tangent activation function maps numerical values. To preserve the sign semantics of the signal within the interval; The interaction matrix is constrained by the label; This is the entity aggregation signal matrix calculated in the previous stage.
[0047] It should be noted that matrix multiplication During the calculation process, positive weighted edges will propagate the features of the activated label forward to its implied partner label nodes to achieve a cooperative incentive effect, while negative weighted edges will reverse the features of the activated label to become an inhibitory signal and propagate it to its mutually exclusive opponent label nodes to achieve a competitive inhibition effect. The hyperbolic tangent function further restricts the upper bound of the amplitude of the propagated signal to prevent numerical explosion during the iteration process.
[0048] Then, a learnable gating unit is introduced to adaptively fuse the two signals. Based on the concatenation of the dimensions of the entity aggregation signal matrix and the constraint propagation signal matrix, a gating coefficient matrix is calculated using the gating weight matrix and the Sigmoid activation function. This coefficient is then used to perform element-wise weighted mixing of the two signals, and the initial label node feature matrix is superimposed as the knowledge residual baseline. Finally, the constraint-modulated label feature matrix is generated, as shown below: in, For the first The constrained modulated label feature matrix obtained in the next iteration; The gating coefficient matrix is formed by... Calculations show that For the Sigmoid function, For learnable gated weight matrix, This is the gated bias vector; For element-wise Hadamard product operator; For entity aggregation signal matrix; To constrain the propagation signal matrix; The initial node feature matrix is used as the knowledge residual baseline to prevent feature drift during deep iterations.
[0049] The gating coefficient ranges from (0,1). When the gating value of a label node approaches 1, it means that the model determines that the encoding decision at that location should rely more on the evidence directly provided by the entity. When the gating value approaches 0, it means that the encoding decision at that location should rely more on the linkage signal brought about by the constraint propagation between labels. This adaptive balancing mechanism ensures that the model will not produce false suppression due to the rigid propagation of constraint channels when facing rare cases, while making full use of constraint information to enhance the standardization of encoding when facing common comorbidities.
[0050] Furthermore, based on the comparison between the mean square error between adjacent iterations and the preset convergence threshold, the constrained modulated label feature matrix undergoes multiple rounds of iterative convergence determination and final state encapsulation output to obtain the label converged feature matrix. Here, it should be understood that the propagation of constraint relationships between labels requires multiple rounds of routing-aggregation-constraint-rerouting cycles to allow the inhibition and excitation effects to fully diffuse throughout the entire label network. Therefore, an iterative convergence strategy is adopted instead of single-step direct output. Specifically, the mean square error between the constrained modulated label feature matrix obtained in the current iteration and the result of the previous iteration is calculated. The determination formula is: in, For the first The iteration and the The average change in the label feature matrix between iterations (scalar); This represents the total number of ICD tag nodes; The dimension value of the label feature vector; The square operator for the Frobenius norm of a matrix; This is the constrained modulated label feature matrix obtained from the current iteration. This is the label feature matrix from the previous iteration; This is a preset minimum convergence threshold scalar.
[0051] If the mean squared error is greater than the convergence threshold, the current constraint-modulated label feature matrix feedback loop is used in the coupling coefficient calculation step to re-evaluate the semantic matching degree between entities and labels, and then returns to step two to perform the next round of constraint-aware aggregation calculation. If the mean squared error is less than or equal to the convergence threshold, the dynamic routing process is determined to have reached a steady state, and the constraint-modulated label feature matrix in the convergence state is formally encapsulated as a label convergence feature matrix and output to the downstream classification step. After multiple iterations, due to the continuous decay effect of the negative value suppression channel in each iteration, the features of mutually exclusive label pairs are ultimately only kept in a high activation state at the convergence point, which eliminates the possibility of simultaneous output of mutually exclusive codes at the feature level; while the co-implied label pairs are synchronously in a high activation state at the final convergence point due to the continuous enhancement effect of the positive value excitation channel in each iteration, ensuring that the associated codes required by the coding specification are output in a linked manner without omission.
[0052] In summary, by embedding a lateral propagation mechanism based on symbolic label constraint interaction matrices and a gated fusion unit into the dynamic routing iteration loop, an explicit information communication channel is established between the originally completely independent aggregated ICD label nodes. The positive channel continuously amplifies the feature response intensity of implied association codes during iteration, reducing the omission rate of co-coding; the negative channel continuously decays the feature activation level of mutually exclusive competing codes during iteration, preventing logically contradictory codes from being generated at the source of feature aggregation, without relying on secondary corrections from a post-processing rule engine. The gated fusion mechanism endows the model with the ability to dynamically adjust the fusion ratio of constraint signals and entity signals according to specific clinical situations. When facing common comorbidities with clear constraint relationships, it fully utilizes constraint information to enhance coding standardization; when facing rare cases with ambiguous constraint relationships, it automatically reduces the weight of constraint signals to avoid misjudgment, combining flexibility and robustness. Ultimately, the improved iterative convergence output can significantly reduce the overcoding error rate of mutually exclusive codes and the omission coding error rate of implicit codes in multi-label ICD coding tasks, improve the overall accuracy and coding standard compliance of automatic coding of medical record front pages, and reduce the rework rate and time cost of manual quality control.
[0053] Specifically, in step S5, probability mapping and threshold filtering are performed on the label convergence feature matrix to output structured disease classification coding results. It should be understood that the feature vectors in the label convergence feature matrix are still in a high-dimensional continuous feature space, and the feature vector of each label node is a d-dimensional real vector, which cannot be directly used as the output result of the coding decision. Clinical medical record coding tasks require the system to output a discrete, structured set of ICD disease classification codes (i.e., clearly indicating which specific ICD codes should be encoded in the current medical record), rather than a continuous high-dimensional feature representation. Therefore, in the technical solution of this application, the high-dimensional feature vector of each label node in the label convergence feature matrix is transformed into a probability value representing whether the code should be activated. Then, a confidence threshold filtering mechanism is used to transform the continuous probability value into a discrete binary coding decision (activation or inactivation). Finally, the label index determined to be in an activated state is reverse-parsed into a standard ICD code string, thus completing the complete transformation link from high-dimensional feature space to structured coding output. The final output is a structured disease classification coding result that can be directly used for filling in the medical record homepage.
[0054] In specific implementation, step 5.1 involves performing feature compression and probability space nonlinear mapping on the high-dimensional feature vector of each label node in the label convergence feature matrix to obtain an independent activation probability vector. Specifically, firstly, feature compression is performed on the d-dimensional feature vector of each label node in the label convergence feature matrix, that is, a learnable linear transformation is used to map the d-dimensional feature vector to a one-dimensional scalar value, resulting in the original activation intensity score scalar of that label node. After performing the above linear transformation on all L label nodes, an original activation intensity score vector of length L is obtained, where each element is an unbounded real value (which may be positive or negative), representing the activation intensity of the corresponding label node after feature compression. Subsequently, a probability space nonlinear mapping is performed on each element of the original activation intensity score vector, that is, the unbounded real value is mapped to the probability interval of 0 to 1 using the Sigmoid activation function, resulting in an independent activation probability vector of length L, where each element's value is between 0 and 1. Finally, the independent activation probability values of all L label nodes are arranged in index order to obtain the independent activation probability vector.
[0055] In step 5.2, based on a preset global confidence classification threshold, confidence threshold filtering and binarization are performed on each probability element in the independent activation probability vector to obtain a positive example coding index set. Specifically, first, a global confidence classification threshold is set. Then, each probability element in the independent activation probability vector is compared and judged according to the confidence threshold: for the k-th candidate code, if its independent activation probability value is greater than the global confidence classification threshold, the code is determined to be a positive example (i.e., it should be encoded), and its index number k is added to the positive example coding index set; if its independent activation probability value is less than or equal to the global confidence classification threshold, the code is determined to be a negative example (i.e., it should not be encoded), and its index is not added to the positive example coding index set. After completing the threshold judgment for all L candidate codes, a positive example coding index set is obtained, which contains the index numbers of all candidate codes that the system has determined should be encoded. The size of the positive example coding index set (i.e. the number of elements it contains) may vary from 0 to L, depending on how many candidate codes in the current case have an activation probability exceeding the confidence threshold. This is consistent with the characteristic that different samples in a multi-label classification task may correspond to different numbers of positive example labels.
[0056] In step 5.3, based on the pre-built bidirectional mapping rule table between node indexes and standard International Classification of Disease (ICD) codes maintained by the system, reverse code parsing is performed on each numeric index in the positive example coding index set to obtain the structured disease classification coding result. Specifically, the system pre-establishes and maintains a bidirectional mapping rule table between node indexes and standard ICD codes. This table records the one-to-one correspondence between the integer index number of each tag node in the tag node set and its corresponding standard ICD code string (for example, index number 1 corresponds to ICD code "I50.0", index number 2 corresponds to ICD code "I50.1", index number 3 corresponds to ICD code "I11.0", index number 4 corresponds to ICD code "E11.22", index number 5 corresponds to ICD code "N18.3", etc.). For each integer index number in the positive example coding index set, a reverse code parsing query is performed in the bidirectional mapping rule table, that is, using the integer index as the query key, the corresponding standard ICD code string is retrieved in the mapping rule table. The standard ICD code strings obtained after reverse parsing all positive example indexes are organized sequentially into a structured disease classification coding result set. Each element in the final output structured disease classification coding result set is a standard ICD disease classification code string. This set represents the system's automatic classification coding prediction results for the currently input medical record text data, and can be directly used for disease coding entry on the medical record homepage and subsequent downstream business processes such as medical insurance settlement and statistical analysis.
[0057] In summary, the deep learning-based automatic classification and encoding method for medical record texts according to the embodiments of this application is explained. First, it extracts core medical entities through a pre-trained medical language model and constructs a logical graph of medical record entities by combining it with an external medical knowledge graph, explicitly modeling the clinical reasoning chain as a graph topology. Then, it introduces an entity-label heterogeneous bipartite graph architecture, utilizing a dynamic routing mechanism to allow text entity features to autonomously and selectively flow into corresponding ICD label nodes along medical logic edges. Through multi-round iterative aggregation and convergence of the graph convolutional network, it achieves adaptive allocation of entity evidence to encoding labels. In this way, template noise interference is effectively eliminated and cross-segment medical logic reasoning channels are established, thereby improving the accuracy of automatic medical record encoding and reducing the error rates of mutual exclusion overcoding and implied omissions.
[0058] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for automatic classification and coding of medical record texts based on deep learning, characterized in that, include: Step 1: Based on the pre-trained medical language model, name entity recognition and feature encoding are performed on the medical record text data to obtain a set of medical entities and an entity context feature matrix. Step 2: Based on the predefined medical logical relationships between entities in the external medical knowledge graph, perform association matching and topology construction on the medical entity set to obtain the medical record entity logical graph; Step 3: Vectorize each candidate code based on the disease classification code hierarchy dictionary to construct label nodes, and establish cross-type directed connections between the label nodes and the entity nodes in the medical record entity logic graph, and combine the entity context feature matrix as the node attribute assignment to obtain the entity-label heterogeneous bipartite graph. Step 4: The entity representation is updated by aggregating neighbor features along the medical logic edges in the entity-label heterogeneous bipartite graph using a graph convolutional network. The semantic coupling coefficient between the updated entity representation and each label node is also updated. The entity features are adaptively aggregated to the corresponding label nodes according to the coupling coefficient. After multiple rounds of iteration and convergence, the label convergence feature matrix is obtained. Step 5: Perform probability mapping and threshold filtering on the label convergence feature matrix to output the structured disease classification coding results.
2. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 1, characterized in that, The medical record text data includes the chief complaint text, present illness text, past medical history text, auxiliary examination text, and discharge diagnosis text.
3. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 2, characterized in that, Step one includes: Step 1.1: Perform global sequence encoding and deep contextual semantic feature extraction on the medical record text data to obtain the global sequence hidden state tensor; Step 1.2: Decode the medical entity sequence based on conditional random fields from the global sequence hidden state tensor to obtain the medical entity set; Step 1.3: Based on the start and end position indices of each entity in the medical entity set in the original labeled sequence, perform mean pooling and row-wise concatenation on the hidden state vectors of the corresponding positions in the global sequence hidden state tensor to obtain the entity context feature matrix.
4. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 1, characterized in that, Step two includes: Step 2.1: Based on the predefined entity logical relationship triplet library in the external medical knowledge graph, the medical entity set is instantiated with graph nodes and paired with medical relationship retrieval and matching to obtain the initial node set of the isomorphic graph and the entity logical relationship triplet set. Step 2.2: Using the relation types of each triple in the entity logical relation triple set and their corresponding preset edge connection weights, perform weighted self-loop adjacency matrix calculation and graph topology instantiation encapsulation on the initial node set of the isomorphic graph to obtain the case entity logical graph.
5. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 1, characterized in that, Step three includes: Step 3.1: Based on the pre-trained text encoder, the standard text descriptor sequence of each candidate code in the disease classification code hierarchy dictionary is vectorized and dimensionally reduced to obtain the tag node set and the tag initial node feature matrix. Step 3.2: Based on the cross-type fully connected directed edge establishment rules between all entity nodes in the medical record entity logic graph and all label nodes in the label node set, heterogeneous topological connections and block adjacency matrices are constructed for the two types of nodes to obtain the heterogeneous bipartite graph topological matrix. Step 3.3: Vertically concatenate the entity context feature matrix and the initial label node feature matrix along the node dimension to construct global node attributes. Assign node features to the heterogeneous bipartite graph topology matrix and instantiate and encapsulate the graph data structure to obtain the entity-label heterogeneous bipartite graph.
6. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 1, characterized in that, Step four includes: Step 4.1: Perform isomorphic entity neighbor feature aggregation based on graph convolutional network on the isomorphic entity subgraph decoupled from the entity-label heterogeneous bipartite graph to obtain the updated entity feature matrix; Step 4.2: Perform cross-type semantic matching degree evaluation and normalized route weight quantization on the updated entity feature matrix and the initial label node feature matrix in the entity-label heterogeneous bipartite graph to obtain the route coupling coefficient matrix. Step 4.3: Based on the routing coupling coefficient matrix, perform iterative feature allocation and label feature convergence on the updated entity feature matrix and the initial label node feature matrix to obtain the label converged feature matrix.
7. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 1, characterized in that, Step five includes: Step 5.1: Perform feature compression and probability space nonlinear mapping on the high-dimensional feature vector of each label node in the label convergence feature matrix to obtain an independent activation probability vector; Step 5.2: Based on the preset global confidence classification threshold, perform confidence threshold filtering and binarization judgment on each probability element in the independent activation probability vector to obtain the positive example encoding index set. Step 5.3: Based on the pre-built bidirectional mapping rule table of node indexes to standard international disease classification codes maintained by the system, reverse code parsing is performed on each numeric index in the positive example coding index set to obtain the structured disease classification coding result.
8. The method for automatic classification and encoding of medical record texts based on deep learning according to claim 6, characterized in that, Step 4.3 includes: Step 4.3.1: Perform pairwise semantic affinity evaluation and positive and negative weight segmentation on the feature vectors of each label node in the initial label node feature matrix to obtain the label constraint interaction matrix; Step 4.3.2: Based on the tag constraint interaction matrix, the aggregated signal obtained by weighting and updating the entity feature matrix after the routing coupling coefficient matrix is subjected to constraint propagation and gated fusion, and the residual of the tag initial node feature matrix is superimposed to obtain the tag feature matrix after constraint modulation. Step 4.3.3: Based on the comparison between the mean square error between adjacent iterations and the preset convergence threshold, perform multiple rounds of iterative convergence determination and final state encapsulation output on the constrained modulated tag feature matrix to obtain the tag convergence feature matrix.