Electronic medical record structured conversion method, device and program product
Through the structured extraction method of electronic medical record text based on large language model, the accuracy and generalization ability of electronic medical record text processing in the prior art are solved, more efficient medical entity and relationship extraction is achieved, and the quality and application potential of medical data are improved.
Patent Information
- Application Number
- CN202510071370.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-01-16
AI Technical Summary
The prior art has problems such as low recognition accuracy, complex feature engineering, poor generalization ability, and difficulty in capturing long-distance dependencies when processing unstructured text of electronic medical records, which affects the quality and application potential of medical data.
The structured extraction method of electronic medical record text based on large language models is adopted. By obtaining medical record text and medical word segmentation dictionary, dynamic text word segmentation matching is performed, index vector sequence is generated, and the electronic medical record structured transformation model is input to obtain structured data.
It improves the recognition accuracy and extraction efficiency of electronic medical record text, enhances the generalization ability of the model, can more accurately capture complex medical entities and relationships, and improves the quality and application potential of medical data.
Smart Images

Figure CN119988519A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent medical care, and more specifically, to a method, device, medium and program product for structured conversion of electronic medical records. Background Art
[0002] Electronic Medical Records (EMR) is a core component of modern medical information management, which contains important medical data such as patient medical history records, clinical examination results, diagnostic information, treatment plans, and doctor's orders. With the development of medical informatization, the use of electronic medical records has been widely used around the world. However, electronic medical record data usually exists in the form of unstructured text, which brings great challenges to data retrieval, analysis and application.
[0003] At present, there are three main methods for extracting structured information from electronic medical record text: (1) Rule-based methods: Rule-based methods mainly parse and extract electronic medical record text through predefined rules and templates. For example, regular expressions are used to match specific medical terms and relationships. This method works well when processing structured and semi-structured data, but for unstructured text, especially electronic medical records with complex and changing semantics, rule-based methods have poor adaptability and scalability. (2) Machine learning methods: Machine learning methods are mainly based on feature engineering and traditional machine learning algorithms (such as SVM and random forest). By extracting features such as word frequency, part of speech, and context from text, classifiers or regression models are constructed to identify medical entities and relationships. Although machine learning methods have better generalization capabilities than rule-based methods, they rely on manual feature engineering and have limited effectiveness when processing large-scale and complex semantic relationships. (3) Deep learning-based methods: Deep learning methods that have emerged in recent years, especially neural network-based models (such as RNN and CNN), have made significant progress in the field of text processing. These methods automatically extract features from text to perform named entity recognition and relationship extraction. Although the performance of text processing has been improved to a certain extent, traditional deep learning methods still have limitations in capturing long-distance dependencies and complex semantic relationships.
[0004] The text content of electronic medical records is a text record that is closer to human language. Traditional text recognition technology generally faces challenges in recognition accuracy, feature engineering complexity, model generalization ability, long-distance dependency processing, and structured availability of results in the process of extracting structured text from electronic medical records. These problems not only affect the quality and effective use of medical data, but also limit the application potential of related technologies in medical decision support and clinical research.
[0005] The main problems currently include: (1) Low accuracy and high misidentification rate: When processing unstructured electronic medical record text, traditional methods have low accuracy in identifying medical entities and relationships due to the diversity of text formats and complex medical terminology, and are prone to misidentification. (2) Reliance on manual feature engineering: Machine learning methods usually rely on manual design and extraction of features, which not only requires a lot of knowledge from domain experts, but also has complex processes and subjectivity and consistency issues. (3) Poor generalization ability: Existing methods are unstable in different data sets and application scenarios, have limited generalization ability, and are difficult to adapt to the diverse medical information entry methods and text styles. (4) Difficulty in capturing long-distance dependencies: Traditional models such as RNN and CNN have limitations in capturing long-distance dependencies and complex semantics in text, resulting in poor results in extracting complex medical entities and relationships. Summary of the invention
[0006] At present, existing methods have their limitations and inconveniences when processing the large amount of text data generated by the electronic medical record system. The present invention proposes a structured extraction method for electronic medical record text based on a large language model, aiming to overcome the defects in the above methods. By combining the latest large language model technology, it can more accurately identify and extract medical entities and relationships in electronic medical records and convert them into structured data.
[0007] The present application (first aspect) discloses a method for structured conversion of electronic medical records, comprising:
[0008] S1: Obtain medical record text and medical word segmentation dictionary;
[0009] S2: Perform dynamic text segmentation matching on the medical record text to obtain an indicator vector sequence, specifically including:
[0010] S21: Performing dynamic text segmentation on the medical record text to obtain a potential segmentation matrix composed of potential segmentations, S22: Obtaining a matching cost matrix based on the matching costs of the potential segmentations in the potential segmentation matrix and the index directory in the medical segmentation dictionary,
[0011] S23: using a sliding window method to compare the matching cost matrix to obtain the indicator directory segmentation and the corresponding starting point, and all the indicator directory segmentations constitute an indicator directory sequence;
[0012] S24: determining a neighborhood according to the position of the indicator catalog segmentation word in the medical record text, performing dynamic text segmentation on the neighborhood and matching the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog;
[0013] S25: The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence;
[0014] S3: The indicator vector is input into the electronic medical record structured conversion model to obtain a structured electronic medical record. The method for obtaining the electronic medical record conversion model is as follows: the indicator vector obtained based on the training set is input into the electronic medical record conversion model obtained by training a large language model.
[0015] Furthermore, the matching cost in S22 is calculated as follows: the elements in the potential word segmentation matrix are sequentially calculated with the matching costs of each indicator directory in the medical word segmentation dictionary, and the minimum value of the matching costs of each indicator directory is selected as the matching cost corresponding to the element in the potential word segmentation matrix;
[0016] Optionally, the medical record text is segmented to obtain possible segmentations, and the potential segmentation matrix is formed by the possible segmentations.
[0017] Optionally, the dynamic text segmentation further includes performing sparsity constraints on the matching costs of the various indicator directories to obtain a minimum matching cost after the constraints, and taking the possibility of the minimum matching cost after the constraints as the segmentation result;
[0018] Optionally, the matching cost is constrained as follows:
[0019]
[0020] Where S represents a sequence of medical record text strings or a sequence of possible word segments; cost(S[i:i+j],t k ) represents the potential segmentation S[i:i+j] and the index directory t in the medical segmentation dictionary k The matching cost, γ is the sparsity weight parameter, and sparsity() represents the sparsity penalty function;
[0021] Optionally, the matching cost is calculated as edit distance;
[0022] Optionally, the sliding window method in S23 is as follows: first, the minimum value of the matching cost matrix is taken according to the row to obtain the minimum matching cost of each starting point, and the sliding window method is used to determine the minimum matching cost and the corresponding starting and ending points within a certain window. If the starting and ending points overlap, the starting and ending points corresponding to the smaller matching cost are used as the starting and ending points of the indicator directory segmentation;
[0023] Optionally, sparse processing is performed on the matching cost matrix, and the matching cost exceeding the set matching range is set to ∞;
[0024] Optionally, S21 is: the medical record text is represented by S, the potential word segmentation matrix is represented by D, the element D[i,j]=S[i:i+j] in the potential word segmentation matrix, represents the potential word segmentation from the i-th character of the medical record text S to the i+j-th character, where i∈[1,length(S)], j∈[0,L)], and L represents the maximum value of the indicator directory length in the medical word segmentation dictionary.
[0025] Furthermore, the matching cost is calculated as follows:
[0026]
[0027] Among them, editdistance(S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The edit distance, f t (S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The time feature difference, λ is the weight of the time feature difference, W t is the weight of the edit distance;
[0028] Optionally, the matching cost is calculated as follows:
[0029]
[0030] Among them, f s (S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The spatial distance, f t (S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The time distance, λ1 is the weight of the spatial distance, and λ2 is the weight of the time distance;
[0031] Optionally, the spatial distance is Jaccard distance;
[0032] Optionally, the time distance is Levenshtein distance.
[0033] Optionally, the medical word segmentation dictionary includes an indicator directory and a value range under the indicator directory.
[0034] Further, the indicator vector sequence is subjected to a self-attention mechanism to obtain a TF-IDF vector; the indicator vector sequence is summarized to obtain an embedding vector, the TF-IDF vector and the embedding vector are fused to obtain a fused indicator vector, and the fused indicator vector is input into a second electronic medical record structured conversion model to obtain a structured electronic medical record;
[0035] The second electronic medical record structured conversion model is obtained by inputting an indicator vector obtained based on a training set into a large language model to obtain a second electronic medical record conversion model.
[0036] Further, the TF-IDF vector is expressed as:
[0037] WV(t,d,D)=tf(t,d)×idf(t,D)
[0038]
[0039] Wherein, WV(t,d,D) represents the TF-IDF vector, t represents the indicator name in the indicator vector sequence, d represents a single medical record text, and D represents the current electronic medical record document to be matched; f t,d It is the frequency of occurrence of indicator name t in a single electronic medical record text d; t' represents the synonyms, related words or other different forms of indicator name t appearing in text d.
[0040] P(t|w) is the conditional probability of the indicator name t appearing when the word w appears in the medical record text; P topic (t|w) is the conditional probability based on the classification of medical record text; α is the weight parameter that balances the medical record text and the indicator vector; Weight(w) is the weight coefficient of the word w.
[0041] Furthermore, the fused index vector is expressed as:
[0042] v fusion =α i WV·v i h sequence +α iembedding ·v iembedding
[0043] h sequence =Pooling(h1,h2,...,h n )
[0044] Among them, α i is the attention weight for each TF-IDF vector; v i is the attention weight for each embedded vector; h1 represents the output of the first attention head in the attention mechanism, n represents the number of vectors, that is, the number of elements in the sequence or set, represents the attention weight of each embedding vector, reflecting the importance of the i-th embedding vector in the overall context. Represents a continuous vector representation that maps words or phrases to high-dimensional space. These vectors can capture the semantic information and contextual relationships of the words. sequence Represents the sequence representation after average pooling. hi represents all indicator vector sequences; Pooling() means applying the average pooling method to summarize the representations of all indicator vector sequences.
[0045] Further, using a word segmentation model to obtain possible word segmentations based on the medical record text;
[0046] Optionally, the word segmentation model is a conditional random field model, and the conditional random field model divides word boundaries using characteristic functions and weights.
[0047] The second aspect of the present application discloses a system for structured conversion of electronic medical records, comprising:
[0048] Acquisition module: used to obtain medical record text and medical word segmentation dictionary;
[0049] Matching module: used to perform dynamic text segmentation matching on the medical record text to obtain an indicator vector sequence. The matching module is specifically used to execute the method steps S21-S25:
[0050] S21: Performing dynamic text segmentation on the medical record text to obtain a potential segmentation matrix composed of potential segmentations, S22: Obtaining a matching cost matrix based on the matching costs of the potential segmentations in the potential segmentation matrix and the index directory in the medical segmentation dictionary,
[0051] S23: using a sliding window method to compare the matching cost matrix to obtain the indicator directory segmentation and the corresponding starting point, and all the indicator directory segmentations constitute an indicator directory sequence;
[0052] S24: determining a neighborhood according to the position of the indicator catalog segmentation word in the medical record text, performing dynamic text segmentation on the neighborhood and matching the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog;
[0053] S25: The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence;
[0054] Conversion module: used for obtaining module 201: used for obtaining medical record text and medical word segmentation dictionary;
[0055] Matching module 202: used to perform dynamic text segmentation matching on the medical record text to obtain an indicator vector sequence. The matching module is specifically used to execute the method steps S21-S25:
[0056] S21: Performing dynamic text segmentation on the medical record text to obtain a potential segmentation matrix composed of potential segmentations, S22: Obtaining a matching cost matrix based on the matching costs of the potential segmentations in the potential segmentation matrix and the index directory in the medical segmentation dictionary,
[0057] S23: using a sliding window method to compare the matching cost matrix to obtain the indicator directory segmentation and the corresponding starting point, and all the indicator directory segmentations constitute an indicator directory sequence;
[0058] S24: determining a neighborhood according to the position of the indicator catalog segmentation word in the medical record text, performing dynamic text segmentation on the neighborhood and matching the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog;
[0059] S25: The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence;
[0060] Conversion module 203: used to input the indicator vector into an electronic medical record conversion model to obtain a structured electronic medical record, wherein the electronic medical record conversion model is obtained by inputting the indicator vector obtained based on the training set into the electronic medical record conversion model obtained by training a large language model.
[0061] The third aspect of the present application discloses a computer device, which includes: a memory and a processor; the memory is used to store program instructions; the processor is used to call the program instructions, and when the program instructions are executed, it is used to execute the steps of the above method.
[0062] A fourth aspect of the present application discloses a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0063] A fifth aspect of the present application discloses a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0064] This application has the following beneficial effects:
[0065] Compared with existing methods, the present invention has significant advantages in processing unstructured text, improving extraction accuracy and adapting to diverse needs;
[0066] The present invention realizes dynamic time matching: when matching with a medical word segmentation dictionary, time-weighted matching is performed to give priority to words with closer time sequence;
[0067] The present invention realizes structural dynamics: through sparsity regularization, the word segmentation path is dynamically optimized to avoid over-dense word segmentation of medical record texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0069] Figure 1 is a schematic diagram of a method flow chart provided by the first aspect of an embodiment of the present invention;
[0070] Figure 2 is a schematic diagram of a program product provided by the second aspect of an embodiment of the present invention;
[0071] Figure 3 is a schematic diagram of a computer device provided by an embodiment of the present invention;
[0072] Figure 4 is a schematic diagram of the architecture of an exemplary computing device provided by an embodiment of the present invention;
[0073] Figure 5 is a schematic diagram of a storage medium provided by an embodiment of the present invention;
[0074] Figure 6 It is a technical solution roadmap provided by an embodiment of the present invention;
[0075] Figure 7 It is a schematic diagram of a key word segmentation standard comparison dictionary structure provided by an embodiment of the present invention;
[0076] Figure 8 It is a schematic diagram of obtaining a structured medical record by applying an electronic medical record structured conversion model provided by an embodiment of the present invention;
[0077] Fig. 9 It is a flow chart for constructing an electronic medical record structured conversion model provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0078] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0079] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The sequence numbers of the operations, such as S101, S102, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0080] 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0081] Figure 1 The present invention provides a method for converting electronic medical records into structured form. Specifically, the method includes the following steps:
[0082] S101: Obtain medical record text and medical word segmentation dictionary;
[0083] S102: Performing dynamic text segmentation matching on the medical record text to obtain an indicator vector sequence, specifically including:
[0084] S21: Performing dynamic text segmentation on the medical record text to obtain a potential segmentation matrix composed of potential segmentations, S22: Obtaining a matching cost matrix based on the matching costs of the potential segmentations in the potential segmentation matrix and the index directory in the medical segmentation dictionary,
[0085] S23: using a sliding window method to compare the matching cost matrix to obtain the indicator directory segmentation and the corresponding starting point, and all the indicator directory segmentations constitute an indicator directory sequence;
[0086] S24: determining a neighborhood according to the position of the indicator catalog segmentation word in the medical record text, performing dynamic text segmentation on the neighborhood and matching the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog;
[0087] S25: The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence;
[0088] S103: The indicator vector is input into an electronic medical record conversion model to obtain a structured electronic medical record. The method for obtaining the electronic medical record conversion model is as follows: the indicator vector obtained based on the training set is input into the electronic medical record conversion model obtained by training a large language model.
[0089] The present invention provides a method for structured extraction of electronic medical record text based on a large language model, aiming to overcome the problems of the prior art in accuracy, feature engineering complexity, model generalization ability, long-distance dependency processing and result structured availability in unstructured electronic medical record processing.
[0090] The program includes:
[0091] (1) Obtaining the user's content extraction requirements (including extraction indicators and the value range of each indicator);
[0092] (2) Preprocessing and content evaluation of electronic medical record text data (including cleaning, denoising, and unified formatting);
[0093] (3) Apply word segmentation algorithm to perform text segmentation.
[0094] (4) Compare the text segmentation with the extracted indicators and value ranges of the medical segmentation dictionary, match the segmentation results with the indicators in the comparison dictionary, and identify the indicator instances appearing in the text. For the identified indicators, further analyze the surrounding text to determine their values, and convert the extracted values into a standard format; for example, standardize "mild", "moderate", and "severe" into "mild", "moderate", and "severe".
[0095] (5) Based on the results obtained after word segmentation, a large language model is used to perform named entity recognition (NER) on the electronic medical record text data to extract medical entities.
[0096] (6) Train the entity-relationship model on the annotated electronic medical record dataset, extract structured entities and relationships, and convert them into structured data based on user needs (such as attached Figure 6 shown).
[0097] The detailed process is described as follows:
[0098] 1. Obtain the user's content extraction requirements, including information such as extraction indicators and the value range of each indicator.
[0099] The user inputs the indicators to be extracted, and the extracted indicators are standardized and converted through the medical word segmentation dictionary, including the indicator name, value range, indicator unit, etc.
[0100] In some embodiments, the medical word segmentation dictionary is developed by performing word frequency statistics on the collected medical record data set, combining the electronic medical record structuring requirements of medical experts, and is reviewed and revised by medical experts.
[0101] Figure 7 The following are some examples of medical word segmentation dictionaries, including extraction indicators and the value ranges corresponding to each indicator. The extraction indicators are the first-level directories and the value ranges corresponding to the indicators.
[0102] In some embodiments, during the construction of the electronic medical record structured conversion model, the dynamic matching algorithm involves and the corresponding algorithm formula is as follows:
[0103] Text preprocessing: Clean the electronic medical record text, including removing punctuation, special symbols, redundant spaces, etc. Combined with the word segmentation dictionary, the text is divided into words for subsequent processing.
[0104] Text and dictionary initialization: Build a vocabulary based on the preprocessed text words, initialize the input medical record text and dictionary, and form a text character sequence S and an indicator directory T in the candidate dictionary as the input of the subsequent dynamic matching algorithm.
[0105] S={s1,s2,…,s n}
[0106] T={t1,t2,…,t k ,…,t m}
[0107] m represents the total number of indicators in the indicator list T in the candidate dictionary.
[0108] Dynamic programming table definition: Construct dynamic programming table D j [i], which means starting from character j in S and ending at character i.
[0109] At the same time, the minimum word segmentation cost (i.e., the minimum matching cost) corresponding to the dynamic planning table is recorded. j represents the starting position of the word segmentation, j <i,cost(S[j:i],t k ) represents the matching cost between a substring and an index word in the dictionary. γ is the sparsity regularization parameter, which controls the weight of the sparsity term. At the same time, the sparsity penalty function sparsity(S[j:i]) is introduced to add sparsity constraints in dynamic programming to encourage shorter segmentation paths and reduce meaningless segmentations, thereby reducing the matching probability of noise words and tending to generate sparse but efficient segmentation sequences.
[0110]
[0111] Among them, C j [i] indicates Dj [i] corresponds to the minimum matching cost.
[0112] Dynamic matching of word segmentation sequence and dictionary
[0113] Use dynamic programming combined with the dictionary to traverse each character and dynamically calculate the word segmentation cost of the substring S[j:i]. Calculate the edit distance or similarity, evaluate the degree of matching between the substring and the dictionary, find matching candidate words in the dictionary and calculate the optimal matching cost.
[0114]
[0115] W t =e -α·Δt
[0116]
[0117] Introducing the time weighting factor W into the matching cost t , prioritize matching phrases with higher temporal relevance, and the more recent data information has a higher weight, reducing word segmentation errors caused by missing or mismatched time attributes. Where S[j:i] represents the substring from j to i. v k The term that matches S[j:i]. Refers to the weight coefficient of the edit distance. λ is the regularization parameter used to control the time weighting factor W t The impact of t is the time feature difference function, which is used to quantify the difference in time information. Δt is the time difference, and α is the attenuation coefficient.
[0118] Backtracking word segmentation path
[0119] Through the dynamic programming table D j [i] The recorded path is traced back from the end point to obtain the optimal word segmentation path, thereby determining the word segmentation sequence.
[0120] Find the optimal cost C of the last character position i from the dynamic programming table j [i], get the optimal word segmentation endpoint P end .
[0121] From position P end Go back and find the corresponding starting position P start , that is, the optimal matching starting point P of the segmentation fragment start .
[0122]
[0123] Each time you get P end and P startAfter that, the corresponding text segment is recorded in the word segmentation path and stored in the path set P. The backtracking process continues until the starting position P of the text is reached. start =0.
[0124] P←P∪{S[P start :P end ]}
[0125] The word segmentation results are mapped into a sequence of indicator vectors
[0126] Map the word segmentation result P into a vector form of a specific medical indicator. Use the one-hot encoding or word embedding method to convert each word segmentation result into a vector that can be used for calculation.
[0127] V={v1,v2,…,v m},v i =encode(P[i])
[0128] encode(P[i]) is a vectorized encoding of the word segment P[i] based on the embedding model, mapping the text into a high-dimensional vector.
[0129] In some embodiments, the medical record text is structured as follows:
[0130] (1) Obtain medical record text and medical word segmentation dictionary;
[0131] (2) Perform dynamic text segmentation on the medical record text to obtain a latent segmentation matrix composed of latent segmentations, such as the latent segmentation matrix D composed of "Preoperative diagnosis: The patient suffered from hypertension 3 years ago"
[0132]
[0133] By matching with the indicators in the medical word segmentation dictionary, the indicators in the medical word segmentation dictionary include "preoperative diagnosis" and "hypertension"; the element [1,3] in the potential word segmentation matrix D has a preoperative diagnosis word segmentation cost of 0; D[13,2] = "hypertension", the matching cost is 0;
[0134] The minimum matching cost of the first row of the potential segmentation matrix D is 0; the minimum matching cost of the 13th row is 0; and the indicators that match the indicators of the medical segmentation dictionary are determined by sliding windows along i: preoperative diagnosis and hypertension;
[0135] Continue to match the neighborhood of "preoperative diagnosis" and "hypertension" to obtain the corresponding value of the indicator. Thus, the indicator vector sequence composed of the indicator vector is converted.
[0136] In some embodiments, the medical record text is firstly segmented by word segmentation software to obtain possible word segmentations, and an initial word segmentation sequence is obtained: "preoperative / diagnosis / patient / 3 years / before / suffering from / high / blood pressure":
[0137] The potential segmentation matrix D is expressed as follows:
[0138] i\j 0 1 2 3 1 Preoperative Preoperative diagnosis Preoperative diagnosis of patients Patients diagnosed 3 years before surgery 2 diagnosis Diagnosing patients Patients diagnosed 3 years ago Patient diagnosed 3 years ago 3 patient Patient 3 years Patient 3 years ago The patient had 4 3 years 3 years ago 3 years ago, I had 3 years ago, I had high 5 forward Pre-existing Previously suffered from high Previously suffered from high blood pressure 6 Suffer from Suffering from high Suffering from high blood pressure - 7 high hypertension - - 8 blood pressure - - -
[0139] The calculated matching cost matrix C is shown as follows:
[0140] i\j 0 1 2 3 1 1 0 2 3 2 0.5 2 3 4 3 6 9 9 14 4 6 9 12 14 5 1 3 6 3 6 2 3 2 - 7 1 0 - - 8 0.5 - - -
[0141] Remove the lowest value from the matching cost matrix C row by row
[0142] C[1]=C[1,1]=0, the corresponding element is D[1,1]=preoperative diagnosis
[0143] C[2]=0.5,
[0144] C[3]=6,
[0145] C[4]=6,
[0146] C[5]=1,
[0147] C[6]=2
[0148] C[7]=0, the corresponding element is C[7,1]=hypertension
[0149] By truncating the adaptation range of the matching cost to [0,1), the matching cost is converted to:
[0150] C[1]=C[1,1]=0, the corresponding element is D[1,1]=preoperative diagnosis
[0151] C[2]=0.5,
[0152] C[3]=∞,
[0153] C[4]=∞,
[0154] C[5]=∞,
[0155] C[6]=∞
[0156] C[7]=0, the corresponding element is C[7,1]=hypertension
[0157] Among them, C[1] and C[2] intersect, and through time weighting, C[1] with a smaller cost and closer timing is prioritized, so as to obtain "preoperative diagnosis" and "hypertension" in the medical record that match the indicators; the indicator vector sequence is ["preoperative diagnosis", "hypertension"].
[0158] Then, the neighborhood is determined based on the position of the catalog segmentation word in the medical record text, the neighborhood is dynamically segmented and matched with the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog; and the relevant time vector is obtained,
[0159] The final indicator vector of the above example includes
[0160] Indicators - Preoperative Diagnosis:
[0161] Time Vector - "3 years ago"
[0162] The value of preoperative diagnosis - "hypertension",
[0163] Determined type of hypertension (matched with hypertension as an indicator) - "primary hypertension".
[0164] The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence;
[0165] The indicator vector is input into a large language model for training to obtain an electronic medical record structured conversion model.
[0166] A dynamic matching algorithm is established based on the indicators that users need to extract, and the indicators that users need to extract are matched with the text features and expected output results of the pre-trained large language model to ensure that the model can process text according to the indicators that users need to extract.
[0167] Dynamic matching algorithm:
[0168]
[0169] Where: θ i is a model parameter, each parameter θ i Corresponding to different indicators and value ranges. and is the range of values of the ith indicator provided by the user. Δ is the normalization scale of the model parameters. β is an offset that is adjusted based on factors such as unit conversion. θ′ i It is a parameter adjusted according to user needs.
[0170] The algorithm can automatically learn and extract useful features from large amounts of text. By learning and adapting to different medical record text styles and data sets, it improves its generalization ability on diverse medical data. It can more accurately identify and match medical terms and indicators in electronic medical records, reducing mismatches and missed matches.
[0171] According to the dynamic matching algorithm, the word segmentation results of the electronic medical record text are matched with each indicator variable in the standard dictionary, and the word segmentation content is matched with the indicator variable. Then, dynamic matching is performed according to the value range of the indicator variable, and the matching score between the word segmentation and each value range is calculated, and the highest score result is used as the matching result. For example, according to the word segmentation content of the electronic medical record text, the variable indicator "myasthenia gravis" is matched, and then the text segmentation is dynamically matched with the 5 value ranges of "myasthenia gravis", and the result with the highest score is selected as the final matching result.
[0172] 2. Preprocess and prepare electronic medical record text data based on user content extraction needs.
[0173] Collect electronic medical record data from different sources, including hospital information systems (HIS), electronic medical record (EMR) systems, etc. The data format may include structured data (such as database tables) and unstructured data (such as text files, PDF files, etc.).
[0174] Import the collected electronic medical record text data into the preprocessing system.
[0175] Unify the terminology and format in the text, such as converting synonyms to standard terms, unifying date formats, etc.
[0176] Processes common abbreviations and abbreviations, expanding them to their full form.
[0177] Remove data noise. Remove noise characters and irrelevant information in the electronic medical record text, such as extra spaces, special characters, format errors, etc.
[0178] 3. Combined with medical dictionaries and other knowledge, use word segmentation algorithms to perform text segmentation
[0179] Prepare one or more medical terminology dictionaries, namely the keyword standard dictionary mentioned above, to ensure that the vocabulary in the dictionary covers common medical terms, symptoms, drugs and other medical terminology information.
[0180] The medical-specific dictionary is loaded into the word segmentation tool Jieba word segmenter so that these special words can be recognized preferentially during the word segmentation process.
[0181] The Conditional Random Field (CRF) model is used for word segmentation, and word boundaries are predicted through feature functions and weights.
[0182]
[0183] Where X is the input sequence, Y is the label sequence, and f k is the characteristic function, λ k is the feature weight, and Z(X) is the normalization factor.
[0184] In some embodiments, Jieba is first used for fast word segmentation to obtain preliminary word segmentation results. On the basis of Jieba word segmentation, a professional medical dictionary is loaded, and the conditional random field model is used to refine and correct Jieba's word segmentation results. Through the combined application of this algorithm, the speed advantage of Jieba word segmentation and the accuracy advantage of the CRF model can be fully utilized to improve the efficiency of word segmentation and ensure the accuracy of word segmentation. It is suitable for processing complex and highly professional electronic medical record texts.
[0185] The importance of the indicator in a single EMR text.
[0186]
[0187] where f t,d It is the frequency of occurrence of indicator t in a single electronic medical record text d.
[0188] In electronic medical record texts, the length of documents in different types of medical record texts varies. The document length may affect the significance of the TF value. In order to eliminate this influence, the present invention optimizes the traditional TF algorithm, normalizes the length of the electronic medical record text by logarithmic transformation, and reduces the word frequency differences in long texts. According to the characteristics of electronic medical record texts, the smooth optimization of the traditional TF algorithm is achieved.
[0189] The measure is the prevalence of the indicator in the electronic medical record text collection of the patient's current hospitalization.
[0190]
[0191] Where t is the target medical word, D is the electronic medical record document to be matched, P(t|w) is the conditional probability of word t appearing when word w appears in the document; P topic (t|w) is the conditional probability based on the classification of electronic medical record documents; α is a mixing parameter used to balance the weights based on content and subject; Weight(w) is the weight coefficient of word w, which is dynamically adjusted according to its importance or frequency. This matching algorithm can dynamically adjust the extraction priority and weight of medical terms according to the content of electronic medical record documents, thereby improving the accuracy and applicability of medical term extraction in electronic medical record documents.
[0192] The topic model is used to analyze the topic structure of electronic medical record documents and calculate the conditional probability of medical terms under specific topics. The weight factor is introduced to adjust the matching weights of different words according to the importance of medical words or specific word segmentation requirements, so that the algorithm is more in line with specific needs.
[0193] In view of the situation that the IDF is infinite or zero when the corresponding word in the electronic medical record text appears in most documents or does not appear at all, the traditional IDF algorithm is optimized by the probability smoothing method. By calculating the probability distribution of the word in the electronic medical record text, -1 and smoothing parameters ∈ are used to avoid the situation where the probability is large or zero. This makes the optimized algorithm more accurate and stable in information retrieval and text mining.
[0194] Convert electronic medical record text data into weight vectors.
[0195] WV(t,d,D)=tf(t,d)×idf(t,D)
[0196] The indicators that the user needs to extract are converted into weight vectors, and vector matching is performed with the electronic medical record text data to identify the indicator content in the electronic medical record text.
[0197] 4. Apply large language models for text representation. Compare the text segmentation with the extraction index and value range, and establish a standard comparison dictionary for key segmentation (create a comparison dictionary containing medical entities and their synonyms and variants). The standard comparison dictionary is built based on professional terms and common vocabulary in the medical field. It not only includes common disease names, drug names, examination items, etc., but also covers synonyms, abbreviations, aliases and other variants of these terms.
[0198] The electronic medical record text data is input into the pre-trained large language model and trained to obtain the electronic medical record conversion model ( Fig. 9 shown).
[0199] The constructed electronic medical record conversion model can be used for structured processing of electronic medical record texts ( Figure 8 shown).
[0200] The present invention has established a set of standardized medical word segmentation reference dictionaries, which are similar to medical structured knowledge bases, and realize the standardized definition of content that needs to be structured. For example, to extract the marital status in the medical record, the medical word segmentation in the electronic medical record text can be matched with the medical word segmentation in the reference dictionary, and the marital status in the electronic medical record text can be extracted by word segmentation and converted into a standard value range (unmarried, married, divorced, widowed), so as to realize the structuring of the medical record text content. Figure 7 As shown:
[0201] The input text sequence is converted into a corresponding indicator vector representation, and each indicator vector is mapped to its corresponding word embedding vector. The indicator vector refers to the numerical form in which the indicator feature is abstracted and represented. This representation method allows the originally unstructured text data to be processed and analyzed by the algorithm.
[0202] Self-attention is performed on the input indicator vector sequence to generate a context-dependent representation of the electronic medical record text.
[0203]
[0204] Where Q, K, V are weight matrices, d k is the dimension of the attention head.
[0205] Q stands for the query vector, which usually represents the element currently being processed. Here, it represents a sequence of indicator vectors. In some contexts, it may represent a specific feature or query extracted from the sequence of indicator vectors. K stands for the key vector, which is usually associated with each element in the dataset and is used to compare with the query vector. When processing a sequence of indicator vectors, it may represent the key representation of each indicator in the sequence, which is used to match the query vector. V stands for the value vector, which represents the actual content or features of each element in the dataset. In the context of a sequence of indicator vectors, V may correspond directly to the indicator vectors in the sequence, or it may be a representation obtained by further processing based on these indicator vectors. The core advantage of the attention mechanism is that it can dynamically adjust the attention to V based on the degree of match between Q and K, thereby capturing the importance of different elements in the sequence. d k Represents the dimension of the key vector K. This parameter is used to scale the dot product to prevent T When the dimension is too high, the dot product result is too large, thus avoiding excessive gradient values. This scaling helps the stability of model training and can be seen as a form of regularization to control the magnitude of the gradient. softmax() is used to convert the dot product scores between Q and K into weights, which are then used for weighted summation.
[0206] The model is processed through multiple layers of Transformers, usually using the hidden state of the last layer of Transformers as the final representation of each token.
[0207] The average pooling method is applied to aggregate the representations of all indicator vectors to obtain the embedding vector of the entire electronic medical record text sequence.
[0208] h sequence =Pooling(h1,h2,...,h n )
[0209] The TF-IDF vector and the embedding vector are weighted and fused using the attention mechanism to obtain the fused index vector. The attention weight is calculated by transforming the input vector.
[0210]
[0211] where α iis the attention weight for each indicator vector; v i is the attention weight for each embedding vector.
[0212] The WV weight vector is combined with the embedding vector generated by the large language model for entity recognition, where the embedding vector refers to a continuous vector representation that maps terms in the text (such as disease names, symptoms, drugs, etc.) to a high-dimensional space.
[0213] In some embodiments, mapping refers to the process of converting entities and relationships extracted from electronic medical record text into a structured data format through a series of predefined rules and templates, wherein entities (such as diseases, drugs) are identified and classified into corresponding parts of the medical record (such as diagnosis, treatment), and relationships (such as the association between patients and diagnoses) are explicitly recorded to reflect the logical connection between medical data, ultimately forming a structured medical record that can be systematically managed and analyzed.
[0214] In some embodiments, the training and fine-tuning of the large language model are as follows: first, indicator vectors are extracted based on the medical record text set, named entity recognition (NER) is performed on the indicator vector sequence, and the recognized data set is input into the large language model for training.
[0215] In some embodiments, the fused vector contains both word frequency information and contextual semantic information, and uses a bidirectional long short-term memory network algorithm to capture the contextual information of the text sequence.
[0216] Globally annotate the labeled sequences, considering the dependencies between sequences.
[0217] Input the prepared labeled data into the model for back propagation and parameter optimization.
[0218] Use negative log likelihood loss or CRF loss function to minimize the error of label prediction.
[0219] Use labeled data for training and fine-tuning, perform entity recognition and annotation prediction on unlabeled text, and extract medical entities from electronic medical record texts.
[0220] Task-specific model training and prediction, named entity recognition (NER)
[0221] Operation: Fine-tune the model using the NER task to extract medical entities from the text.
[0222] Algorithms: BiLSTM-CRF, BERT-CRF, etc.
[0223] Use labeled data to train large language models and optimize model parameters.
[0224] Relationship extraction: Train the model on annotated electronic medical record datasets to extract structured entities and relationships.
[0225] The standard reference dictionary is associated to extract all possible entities from the electronic medical record text, including diseases, drugs, symptoms, etc. as candidates for relationship extraction and generate entity pairs.
[0226]
[0227] Pr(y|x; θ) is the conditional probability of the labeled sequence y given the input text sequence x, calculated by the CRF layer. θ is the parameter of the model. R(θ) is the regularization term used to prevent overfitting. λ is the regularization parameter used to balance the importance of the negative log-likelihood loss and the regularization term.
[0228] Features are extracted for each entity pair and used as input to the relation classification model.
[0229] Apply large language models such as BERT to fine-tune entity pair features and obtain contextual representations between entity pairs.
[0230] Classify the relationship of each entity pair and determine its relationship type, including treatment relationship, complication relationship, drug action relationship, symptom relationship, disease family relationship, etiology relationship, diagnosis relationship, etc.
[0231] Classify the extracted entity pairs and relations
[0232] Convert the preprocessed text into a feature vector that the machine learning model can process.
[0233] Result conversion and structured output: Convert into a structured form based on user needs and map to the electronic medical record system (generate structured data in a unified format based on user needs).
[0234] Named entities and their relations are obtained from named entity recognition (NER) and relation extraction (RE).
[0235] Integrate entity pairs and their corresponding relationship types into a structured data format, with each row representing a relationship, such as a triple (Xiaoming, diagnosis, diabetes) or a graph structure.
[0236] Define the target structured output format, support JSON, CSV, XML and other formats, and facilitate data storage, query and analysis applications.
[0237] The present invention uses a pre-trained large language model, such as BioBERT or ClinicalBERT, and pre-trains it on large-scale medical text data through self-supervised learning. Unlike traditional methods, the present invention uses the powerful representation learning ability of large language models to deeply understand and encode the rich semantic information and complex relationships in electronic medical record texts, thereby significantly improving the ability to accurately extract medical entities and relationships.
[0238] The present invention realizes an end-to-end automated processing flow, including data preprocessing, large language model application, medical entity recognition, relationship extraction and structured output. Compared with traditional manual feature engineering and rule-making methods, the automated processing flow of the present invention not only simplifies the operation process and improves processing efficiency, but also reduces human errors and subjective intervention, and has higher reliability and stability.
[0239] This paper achieves accurate recognition and extraction of complex medical entities and long-distance dependencies by fine-tuning a large language model. Especially in the medical field, entity names are diverse and easily confused, and relationships are complex and changeable. This paper effectively solves the limitations of traditional methods in dealing with these challenges through the deep learning capabilities of the model.
[0240] Figure 3 is a schematic diagram of a computer device provided by an embodiment of the present invention, such as Figure 3 As shown, the device may include: one or more processors, and one or more memories; wherein the memories store computer-readable codes, and when the computer-readable codes are run by the one or more processors, the method described above may be executed.
[0241] The processor in this embodiment can be an integrated circuit chip with signal processing capabilities. The above processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, operations and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can be an X86 architecture or an ARM architecture.
[0242] In general, various example embodiments of the present disclosure may be implemented in hardware or dedicated circuits, software, firmware, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device. When various aspects of the disclosed embodiments are illustrated or described as block diagrams, flow charts, or using some other graphical representation, it will be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof as non-limiting examples.
[0243] For example, the method or device according to the embodiment of the present disclosure may also be implemented by Figure 4 The architecture of the computing device 3000 shown in FIG. Figure 4 As shown, the computing device 3000 may include a bus 3010, one or more CPUs 3020, a read-only memory (ROM) 3030, a random access memory (RAM) 3040, a communication port 3050 connected to a network, an input / output component 3060, a hard disk 3070, etc. The storage device in the computing device 3000, such as ROM 3030 or hard disk 3070, may store various data or files used for processing and / or communication of the method provided by the present disclosure and program instructions executed by the CPU. The computing device 3000 may also include a user interface 3080. Of course, Figure 4 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 4 One or more components of a computing device are shown.
[0244] The embodiment of the present invention also provides a computer-readable storage medium, such as Figure 5As shown, it is a schematic diagram of a storage medium provided by an embodiment of the present invention, and a computer readable instruction 4010 is stored on the computer storage medium 4020. When the computer readable instruction 4010 is executed by the processor, the method according to the embodiment of the present disclosure described with reference to the above figures can be executed. The computer readable storage medium in the embodiment of the present disclosure can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory. It should be noted that the memory of the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0245] The present disclosure also provides a computer program product or a computer program, which implements the steps of the above method when executed by a processor, such as Figure 2 As shown, the computer program product or computer program comprises:
[0246] Acquisition module 201: used to acquire medical record text and medical word segmentation dictionary;
[0247] Matching module 202: used to perform dynamic text segmentation matching on the medical record text to obtain an indicator vector sequence. The matching module is specifically used to execute the method steps S21-S25:
[0248] S21: Performing dynamic text segmentation on the medical record text to obtain a potential segmentation matrix composed of potential segmentations, S22: Obtaining a matching cost matrix based on the matching costs of the potential segmentations in the potential segmentation matrix and the index directory in the medical segmentation dictionary,
[0249] S23: using a sliding window method to compare the matching cost matrix to obtain the indicator directory segmentation and the corresponding starting point, and all the indicator directory segmentations constitute an indicator directory sequence;
[0250] S24: determining a neighborhood according to the position of the indicator catalog segmentation word in the medical record text, performing dynamic text segmentation on the neighborhood and matching the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog;
[0251] S25: The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence;
[0252] Conversion module 203: used to input the indicator vector into an electronic medical record conversion model to obtain a structured electronic medical record, wherein the electronic medical record conversion model is obtained by inputting the indicator vector obtained based on the training set into the electronic medical record conversion model obtained by training a large language model.
[0253] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0254] In general, various example embodiments of the present disclosure may be implemented in hardware or dedicated circuits, software, firmware, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device. When various aspects of the disclosed embodiments are illustrated or described as block diagrams, flow charts, or using some other graphical representation, it will be understood that the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof as non-limiting examples.
[0255] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0256] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0257] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0258] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0259] The exemplary embodiments of the present disclosure described in detail above are merely illustrative and not restrictive. It should be understood by those skilled in the art that various modifications and combinations may be made to these embodiments or their features without departing from the principles and spirit of the present disclosure, and such modifications should fall within the scope of the present disclosure.
Claims
1. A method for structural conversion of electronic medical records, characterized in that: The method comprises: S1: Obtain medical record text and medical word segmentation dictionary; S2: Perform dynamic text segmentation matching on the medical record text to obtain an indicator vector sequence, specifically including: S21: Performing dynamic text segmentation on the medical record text to obtain a potential segmentation matrix composed of potential segmentations, S22: Obtaining a matching cost matrix based on the matching costs of the potential segmentations in the potential segmentation matrix and the index directory in the medical segmentation dictionary, S23: using a sliding window method to compare the matching cost matrix to obtain the indicator directory segmentation and the corresponding starting point, and all the indicator directory segmentations constitute an indicator directory sequence; S24: determining a neighborhood according to the position of the indicator catalog segmentation word in the medical record text, performing dynamic text segmentation on the neighborhood and matching the value range corresponding to the indicator catalog in the medical segmentation dictionary to obtain the value of the indicator catalog; S25: The indicator directory and the value of the indicator directory constitute an indicator vector, and all indicator vectors constitute an indicator vector sequence; S3: The indicator vector sequence is input into the electronic medical record conversion model to obtain a structured electronic medical record. The method for obtaining the electronic medical record conversion model is as follows: the indicator vector sequence obtained based on the training set is input into the electronic medical record conversion model obtained by training a large language model.
2. The method for structural conversion of electronic medical records according to claim 1, characterized in that: The matching cost is calculated as follows: the elements in the potential word segmentation matrix are sequentially calculated with the matching costs of each indicator directory in the medical word segmentation dictionary, and the minimum value of the matching costs of each indicator directory is selected as the matching cost corresponding to the element in the potential word segmentation matrix; Optionally, the medical record text is segmented to obtain possible segmentations, and the potential segmentation matrix is formed by the possible segmentations. Optionally, the dynamic text segmentation further includes performing sparsity constraints on the matching costs of the various indicator directories to obtain the minimum matching cost after the constraints, and taking the possibility of the minimum matching cost after the constraints as the segmentation result; optionally, constraining the matching cost is expressed as: Where S represents a sequence of medical record text strings or a sequence of possible word segments; cost(S[i:i+j],t k ) represents the potential segmentation word S[i:i+j] and the index directory t in the medical segmentation dictionary k The matching cost, γ is the sparsity weight parameter, and sparsity() represents the sparsity penalty function; Optionally, the matching cost is calculated as edit distance; Optionally, the sliding window method is compared as follows: first, the minimum value of the matching cost matrix is taken according to the row to obtain the minimum matching cost of each starting point, and the sliding window method is used to determine the minimum matching cost and the corresponding starting and ending points within a certain window. If the starting and ending points overlap, the starting and ending points corresponding to the smaller matching cost are used as the starting and ending points of the indicator directory segmentation; Optionally, the matching cost matrix is sparsely processed, and the cost of the matching cost exceeding the set matching range is set to. . ; Optionally, S21 is: the medical record text is represented by S, the potential word segmentation matrix is represented by D, the element D[i, j]=S[i:i+j] in the potential word segmentation matrix, represents the potential word segmentation starting from the i-th character of the medical record text S to the i+j-th character, where i∈[1,length(S)], j∈[0,L)], and L represents the maximum value of the index directory length in the medical word segmentation dictionary.
3. The method for structural conversion of electronic medical records according to claim 1, characterized in that: The matching cost is calculated as follows: Among them, editdistance(S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The edit distance, f t (S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The time feature difference, λ is the weight of the time feature difference, W t is the weight of the edit distance; Optionally, the matching cost is calculated as follows: Among them, f s (S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The spatial distance, f t (S[j:j+i],t k ) measure the difference between the word S[j:j+i] and the word t in the medical word segmentation dictionary k The time distance, λ1 is the weight of the spatial distance, and λ2 is the weight of the time distance; Optionally, the spatial distance is Jaccard distance; Optionally, the time distance is a Levenshtein distance; Optionally, the medical word segmentation dictionary includes an indicator directory and a value range under the indicator directory.
4. The method for structural conversion of electronic medical records according to claim 1, characterized in that: The indicator vector sequence is subjected to a self-attention mechanism to obtain a TF-IDF vector; the indicator vector sequence is summarized to obtain an embedding vector, the TF-IDF vector and the embedding vector are fused to obtain a fused indicator vector, and the fused indicator vector is input into a second electronic medical record structured conversion model to obtain a structured electronic medical record; The second electronic medical record structured conversion model is obtained by inputting an indicator vector obtained based on a training set into a large language model to obtain a second electronic medical record conversion model.
5. The method for structural conversion of electronic medical records according to claim 4, characterized in that: The TF-IDF vector is represented as: WV(t,d,D)=tf(t,d)×idf(t,D) Wherein, WV(t, d, D) represents the TF-IDF vector, t represents the indicator name in the indicator vector sequence, d represents a single medical record text, and D represents the current electronic medical record document to be matched; t,d is the frequency of occurrence of indicator name t in a single electronic medical record text d; t' represents the synonyms, related words or other different forms of indicator name t in text d; P(t|w) is the conditional probability of indicator name t appearing when word w appears in the medical record text; P topic (t|w) is the conditional probability based on the classification of medical record text; α is the weight parameter that balances the medical record text and the indicator vector; Weight(w) is the weight coefficient of the word w.
6. The method for structural conversion of electronic medical records according to claim 4, characterized in that: The fused index vector is expressed as: h sequence =Pooling(h1,h2,...,h n ) Among them, α i is the attention weight for each TF-IDF vector; v i is the attention weight for each embedded vector; h1 represents the output of the first attention head in the attention mechanism, n represents the number of vectors, that is, the number of elements in the sequence or set, represents the attention weight of each embedding vector, reflecting the importance of the i-th embedding vector in the overall context. Represents a continuous vector representation that maps words or phrases to high-dimensional space. These vectors can capture the semantic information and contextual relationships of the words. sequence Represents the sequence representation after average pooling. hi represents all indicator vector sequences; Pooling() means applying the average pooling method to summarize the representations of all indicator vector sequences.
7. The method for structural conversion of electronic medical records according to claim 2, characterized in that: Using a word segmentation model to obtain possible word segmentations based on the medical record text; Optionally, the word segmentation model is a conditional random field model, and the conditional random field model divides word boundaries using characteristic functions and weights.
8. A computer device, characterized in that: The device comprises: a memory and a processor; the memory is used to store a computer program; the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Word segmentation method and system for Chinese electronic medical record
CN113095074A
Traditional Chinese medicine text entity relationship joint extraction method
CN115510242A
Method and system for mapping text phrases to a taxonomy
US20200311115A1
Medical Prediction Method and System Based on Semantic Graph Network
US20220277858A1