Medical institution name governance method based on comparative learning

Through the encoder model based on comparison learning and the single tower BERT model, the medical institution names in the medical sales link data are vectorized and text matched, which solves the problem of inconsistent naming of medical institutions and achieves efficient accuracy and semantic unity of data cleaning.

CN119761311AActive Publication Date: 2025-04-04广州中康数字科技有限公司

Patent Information

Application Number
CN202411830825.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-04
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

The inconsistent naming of medical institutions in the medical sales link data is inconsistent, resulting in low data quality and difficult cleaning, which hinders the digital transformation and data governance process of enterprises.

Method used

The encoder model based on comparison learning is used to vectorize the names of medical institutions, and text matching and sorting is performed in the standard library of medical institutions. The single tower BERT model is used to reorder data, and finally unknown names are projected into unified encoding.

Benefits of technology

It improves the accuracy of data cleaning of medical institution names, reduces the cost of manual intervention, and realizes the semantic unified expression and efficient governance of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119761311A_ABST
    Figure CN119761311A_ABST
Patent Text Reader

Abstract

The invention discloses a medical institution name governance method based on comparative learning. The method comprises the following steps: S1, vectorizing medical institution names in to-be-cleaned medical sales link data by using an encoder model; the encoder model is an encoder model based on comparative learning; s2, performing text matching of medical institution names in a medical institution standard library, and performing recall of similarity of semantics and characters; and S3, reordering the data recalled in the step S2 by adopting a single-tower BERT model, outputting the standard name of the medical institution with the maximum score, and projecting the unknown name of the medical institution into the unified code corresponding to the standard name of the medical institution with the maximum score. According to the invention, the accuracy of data cleaning is greatly improved, and the cost of manual intervention is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data governance, and in particular to a medical institution name governance method based on comparative learning. Background Art

[0002] The data generated during the entire process of pharmaceutical products flowing from manufacturers to distributors (there may be multiple levels of distributors) to sales terminals (hospitals, pharmacies, etc.) and finally being purchased by consumers is called pharmaceutical sales link data (flow data). However, the quality of the flow data generated during the process is inconsistent and lacks standards. Most of the market competitor data comes from different distributors or service providers, and different data sources have different naming rules. These data standards are not unified, the quality is not high, and sharing is not smooth, which increases the difficulty of cleaning flow data, thus seriously hindering the advancement of internal digital transformation and data governance of enterprises. Summary of the invention

[0003] In view of the shortcomings of the prior art, the present invention aims to provide a medical institution name management method based on comparative learning.

[0004] In order to achieve the above object, the present invention adopts the following technical solution:

[0005] A medical institution name governance method based on contrastive learning includes the following steps:

[0006] S1. Vectorizing the names of medical institutions in the pharmaceutical sales link data to be cleaned using an encoder model; the encoder model is an encoder model based on contrastive learning;

[0007] S2. Perform text matching of medical institution names in the medical institution standard database and recall the similarity of semantics and characters;

[0008] S3. Reorder the data recalled in step S2 using a single-tower BERT model, output the standard name of the medical institution with the largest score, and project the unknown medical institution name into the unified code corresponding to the standard name of the medical institution with the largest score;

[0009] The fields of the medical institution standard library include unified codes, standard names of medical institutions, former names of medical institutions and business institution names; the unified codes are used to uniquely identify medical institutions; the standard names of medical institutions represent standard expressions of medical institutions and are currently recognized names of medical institutions; the former names of medical institutions represent the former standard names of medical institutions. With the changes in related businesses, the standard names are modified and the former standard names become former names; business institution names are some names that appear in actual business processes of medical institutions; the standard names of medical institutions, the former names of medical institutions and the business institution names are all vectorized through the encoder model;

[0010] In step S2, the text character similarity recall is completed by a character similarity algorithm, which is implemented by the BM25 algorithm. The specific formula is as follows:

[0011]

[0012] bm25(W,D) represents the similarity score between the name W of the medical institution to be queried and the standard name D of the medical institution, w i represents the i-th element after the word W, n(w i ) means including element w i The number of all standard names, N represents the number of standard names of all medical institutions, f(w i ,D) represents the element w i The frequency in D, |D| represents the length of the standard name D, avgdl represents the average length of the standard names of all medical institutions, k1,b represent hyperparameters, which respectively control the rising speed of the word frequency results in the word frequency saturation and control the role of the field length normalization value;

[0013] In step S2, the text semantic similarity recall is completed by the vector similarity algorithm of the medical institution name, and the semantic similarity of the medical institution name is defined based on the cosine distance algorithm. The specific formula is as follows:

[0014]

[0015] Wherein, vec1=encode(W), vec2=encode(D), encode(·) represents an encoder model, which is used to convert the text of the medical institution name into a vector, W represents the name of the medical institution to be queried, D represents the standard name of the medical institution, vec1 represents the vector of W, and vec2 represents the vector of D;

[0016] In step S3, the single-tower BERT scoring model is used to re-rank the recall data obtained in step S2.

[0017] Furthermore, the encoder model is an encoder model based on contrastive learning, and its acquisition includes sample construction and model training;

[0018] A1. Sample set construction: Use semantic similarity or text distance similarity to construct samples;

[0019] A11. Semantic similarity:

[0020] A111. Read data: read the collected medical institution name dataset from the specified file path;

[0021] A112, data preprocessing: cleaning and formatting the text data in the data set obtained in step A111;

[0022] A113, encoding text data: using a pre-trained model to encode the text data cleaned and formatted in step A112 into an embedding vector;

[0023] A114, constructing a similarity matrix; calculating the cosine similarity between the embedded vectors obtained in step A113, and constructing a similarity matrix;

[0024] A115. Generate positive samples. For each text, find other texts with the same unified code zk_code as positive samples.

[0025] A116. Generate negative samples. For each text, find the text with the largest approximation value and different from its unified code zk_code from the similarity matrix as the negative sample.

[0026] A117. Save the constructed sample set; write the generated sample set into a CSV file;

[0027] A12. Text distance similarity:

[0028] A121. Index synonym set: According to the medical institution standard library, the set of medical institution names with the same unified code is defined as a synonym set. The elements of the synonym set are constructed in the data format of (zk_code, medical institution name) and indexed into the full-text search database;

[0029] A122. Generate positive samples: traverse the medical institution standard library, and for each text, find other texts with the same unified code zk_code as positive samples;

[0030] A123. Generate negative samples: For each text, find the text with the largest matching value and different from its zk_code from the full-text retrieval database as a negative sample;

[0031] A124. Save sample set: Write the generated sample set into a CSV file;

[0032] In the sample set obtained in step A11 or step A12, an ID is assigned to each text data to construct a mapping relationship between the ID and the text data, so as to facilitate the establishment of a relationship between each text data and the unified code; a set of medical institution names with the same unified code is defined as a synonym set; in the sample set, for any element in the synonym set, no other elements of the synonym set will appear in the context field with a distance of N from it; in the sample set, for any element, its context is similar to the N nearest neighbors of the element;

[0033] A2. Encoder model training:

[0034] The encoder model is modeled using the SimCSE model based on the contrastive learning method; the specific training process is divided into three steps: forward calculation, definition of loss function, and reverse calculation:

[0035] Step A21, forward calculation; for any sample x i ∈X, X represents the sample set; sample x i The two elements in are calculated by the base encoder respectively, and Chinese BERT is used as the base encoder, which is expressed as:

[0036] base_vec1,base_vec2=encode_base(x i,1 ,t1),encode_base(x i,2 ,t2)

[0037] Where encode_base(·) represents the base encoder function, using Chinese BERT, t1, t2 represent the parameters of the Dropout layer in the base encoder, the larger the t1, t2, the more invalid neural network elements are output by the neural network, and x i,1 ,x i,2 Respectively represent samples x i The first and second elements of ;

[0038] Step A22, define the loss function: For a given batch B of training data, the loss function is defined as:

[0039]

[0040] Among them, the similarity sim(·,·) is calculated using cosine;

[0041] Step A23, reverse calculation: First, the gradient of the loss function Loss relative to the model parameters is calculated by the back propagation algorithm. Then, these gradients are used to iteratively update the parameters by the gradient descent method or its variants to reduce the value of the loss function. The specific update formula is:

[0042] θ new =θ old -ηΔ θ Loss

[0043] Among them, θ represents the model parameters, η represents the learning rate, and Δ θ Loss represents the gradient of the loss function with respect to the parameter θ;

[0044] With multiple iterations, the model is gradually optimized, the loss function value is continuously reduced, and the model performance is improved; finally, this process completes the learning of the encoder model. *(·)=encode_base(·,0).

[0045] Furthermore, the single-tower BERT model is mainly divided into two stages: training and prediction;

[0046] B1. Training phase: collect samples and format them into “[CLS] medical institution name 1 [SEP] medical institution name 2 [SEP]”;

[0047] B2. The specific steps of the prediction stage are:

[0048] B21. Sort the standard names of medical institutions obtained by recalling text character similarity and recalling text semantic similarity in descending order respectively;

[0049] B22. Take the topN candidate elements of the standard names of medical institutions obtained by the text character similarity recall and the text semantic similarity recall respectively, and encapsulate them into the format of [CLS] medical institution 1 [SEP] medical institution 2 [SEP] as the input of the single-tower BERT model, where medical institution 1 is the name of the medical institution to be queried, and medical institution 2 is the recalled standard name of the medical institution;

[0050] B23. Obtain the standard name of the medical institution with the largest output score of the single-tower BERT model, complete the mapping of the same code, and finally output the unified code of the medical institution.

[0051] Furthermore, before managing the field names in the flow data to be cleaned, the field names in the flow data to be cleaned are first subjected to text preprocessing and historical alias library cleaning;

[0052] Text preprocessing can be done in any of the following ways:

[0053] (i) Direct text replacement: Direct text replacement is applicable to distributors with special names internally, and directly replaces the designated special names with recognizable medical institution name text;

[0054] (ii) Regular replacement: Regular replacement is used to convert a type of data that meets regular conditions into recognizable medical institution name text;

[0055] The specific process of cleaning the historical alias library is as follows:

[0056] The historical alias library includes the original upstream medical institution name, the original downstream medical institution name and the successfully cleaned downstream medical institution name; when cleaning the historical alias library, the pre-processed medical institution name text is first accurately queried in the historical alias library, and the query fields are the original upstream institution name and the original downstream institution name. If the query has results, the cleaning process is directly terminated, and no subsequent cleaning processes are performed. The accurate query results of the historical alias library are returned, and the cleaning similarity in the returned results is 100%. If the query has no results, the cleaning process of steps S1-S2 is continued.

[0057] Furthermore, while performing the cleaning of steps S1-S2, model cleaning is added as a supplement to improve the probability of data cleaning out; the specific process of the model cleaning is as follows:

[0058] C1. Pre-cleaning operation

[0059] After text preprocessing, if there is no accurate query result in the historical alias library, the preprocessed medical institution name text is retrieved in real time from the encoder model to obtain vectorized text, and a vector search operation is performed in the standard library. The vector search uses the inner product algorithm. After the vector result is obtained, the similarity value between the retrieved vector result and the vectorized array is calculated and sorted in descending order, and the first M results are taken and returned;

[0060] C2. Rules and threshold determination

[0061] After obtaining the M vector search results with the highest similarity in step B1, the M vector search results are subjected to rule and threshold determination, where the threshold is the minimum similarity value set by the user to determine that data cleaning is successful. The specific process of rule and threshold determination is as follows:

[0062] (1) If there is only one vector with a similarity of 100% in the TOP10 vector search results, the vector with a similarity of 100% is considered to be cleaned successfully;

[0063] (2) In the TOP10 vector search results, if there are two or more results with the same similarity higher than the threshold, and only one of the results has a medical institution with an operating status of "still in operation", it is determined that the cleaning is successful;

[0064] (3) Among the TOP10 vector search results, there is only one result with a similarity higher than the threshold, which is considered to be a successful cleanup;

[0065] (4) In the TOP10 vector search results, if there are multiple results with values ​​above the threshold, they are judged as cleansing pending confirmation, and are marked as requiring manual intervention for confirmation;

[0066] (5) Except for the above 4 situations, the rest are judged as cleaning failures.

[0067] Furthermore, after the cleaning in steps S1-S2 or after the model cleaning, the cleaning results are quality inspected according to the set specifications;

[0068] After data quality inspection, different credibility levels are given to the data according to the quality inspection results. The credibility is divided into 3 levels, from high to low credibility: credibility A, credibility B, credibility C. The credibility granting rules are as follows:

[0069] When there is no abnormality in the data quality inspection results, and the name of the medical institution in the cleansing result is exactly the same as the downstream institution name of the original data, the credibility A is granted;

[0070] If the cleaning result has been cleaned by the historical alias database or confirmed by manual intervention, the credibility is granted A;

[0071] When the data quality inspection results are normal and the similarity of the data cleaning results is 100%, the credibility B is granted;

[0072] When there is no abnormality in the data quality inspection result and the similarity of the data cleaning result is less than 100%, the credibility C is granted.

[0073] The beneficial effects of the present invention are:

[0074] 1. The present invention proposes a hybrid contrastive learning scheme that combines unsupervised learning and partially supervised prior data. By introducing the SimCSE model for modeling, the process of vectorized encoding of medical institution names is optimized. This hybrid learning method can not only take advantage of the advantages of unsupervised learning and improve the generalization ability of the model, but also make the model more in line with business needs by introducing the prior knowledge of supervised learning, thereby improving the accuracy of data cleaning.

[0075] 2. Innovative application of the single-tower BERT model. The present invention uses a single-tower BERT model to re-arrange the recall results. The single-tower BERT model optimizes the sorting of recall data through two stages: training and prediction, and further improves the accuracy of data cleaning. The application of this model enables the system to more accurately identify and sort the names of relevant medical institutions when faced with a large amount of recall data.

[0076] 3. The present invention adopts processes such as text preprocessing and historical alias library cleaning, which not only ensures the validity of data input, but also greatly improves the accuracy of data through data quality inspection process, and effectively reduces the cost of manual intervention.

[0077] 4. Innovative data quality inspection and credibility judgment mechanism. In order to improve the automation of data cleaning, the present invention innovatively proposes a data quality inspection process, and grants different credibility levels to the data based on the quality inspection results. The application of this mechanism reduces the need for manual judgment, improves the automation of the cleaning process, and also ensures the consistency and reliability of the cleaning results. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 This is an example of a sample data format for encoder model training in an embodiment of the present invention;

[0079] Figure 2 The figure is a flow chart of cleaning the historical alias library in an embodiment of the present invention. DETAILED DESCRIPTION

[0080] The present invention will be further described below in conjunction with the accompanying drawings. It should be noted that this embodiment is based on the technical solution and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to this embodiment.

[0081] This embodiment provides a medical institution name governance method based on contrastive learning, which completes the medical institution name governance through contrastive learning model and text matching. Among them, the semantic expression of the medical institution name is mainly completed through the vector output by the contrastive learning model. In addition, the text matching of the medical institution name is mainly performed through BM25. After recalling the semantics and character similarity, the unified scoring model is finally used to achieve the purpose of medical institution name governance. The goal of medical institution name governance is to project unknown medical institution names into abstract unified codes to complete the semantic unified expression of medical institutions.

[0082] A medical institution name governance method based on contrastive learning includes the following steps:

[0083] S1. Vectorize the names of medical institutions in the pharmaceutical sales link data to be cleaned using the encoder model;

[0084] S2. Perform text matching of medical institution names in the medical institution standard database and recall the similarity of semantics and characters;

[0085] S3. Use the single-tower BERT model to reorder the data recalled in step S2, output the standard name of the medical institution with the largest score, and project the unknown medical institution name into the unified code corresponding to the standard name of the medical institution with the largest score.

[0086] In this embodiment, the medical institution standard library is constructed by manually sorting and reviewing the medical institution data accumulated by the company's internal business system and the external Internet. The fields of the standard library include four fields: unified code (zk_code), medical institution standard name (registered_name), medical institution formerly used name (use_name_set) and business institution name (customer_naem_set). The unified code abstractly describes the abstract concept of the medical institution, represents the objectively existing medical institution, and is used to uniquely identify the medical institution; the medical institution standard name represents the standard expression of the medical institution, which is the currently recognized name of the medical institution, facilitating the relevant exchanges of the medical institution; the medical institution formerly used name represents the standard name of the medical institution. With the changes in related businesses, the standard name is modified, and the former standard name becomes the former name; the business institution name is some names that appear in the actual business process of the medical institution, which may be expressed as the abbreviation of the medical institution, may be a less-word or more-word expression of the standard name, or may be expressed as a typo of the standard name. The medical institution standard name (registered_name), medical institution former name (use_name_set), and business institution name (customer_naem_set) are all vectorized through the encoder model.

[0087] In this embodiment, in step S1, the encoder model is an encoder model based on contrastive learning. Contrastive Learning is an unsupervised learning method whose core idea is to learn a meaningful representation by bringing similar sample pairs closer and dissimilar sample pairs farther apart. Based on the unsupervised learning of contrastive learning, this embodiment introduces partially supervised prior data and proposes a hybrid contrastive learning scheme in order to better meet business needs. The acquisition of the encoder model includes sample construction and model training.

[0088] A1. Sample set construction

[0089] In this embodiment, the sample set is constructed according to the In-batch negatives principle. Some supervised prior data are introduced in the process. The specific data format is as follows: Figure 1 As shown in Figure 2, samples are constructed by using either semantic similarity or text distance similarity.

[0090] A11. Semantic similarity:

[0091] A111. Read data. Read the collected medical institution name dataset from the specified file path.

[0092] A112. Data preprocessing: Clean and format the text data in the data set obtained in step A111.

[0093] A113. Encode text data. Use the pre-trained model to encode the text data cleaned and formatted in step A112 into an embedding vector.

[0094] A114: Construct a similarity matrix. Calculate the cosine similarity between the embedded vectors obtained in step A113 to construct a similarity matrix.

[0095] A115. Generate positive samples. For each text, find other texts with the same unified encoding zk_code as positive samples.

[0096] A116. Generate negative samples. For each text, find the text with the largest approximation value and different from its unified code zk_code from the similarity matrix as a negative sample.

[0097] A117. Save the constructed sample set. Write the generated sample set into a CSV file.

[0098] A12. Text distance similarity:

[0099] A121. Index synonym sets. According to the medical institution standard library, a set of medical institution names with the same unified code is defined as a synonym set. The elements of the synonym set are constructed in the data format of (zk_code, medical institution name) and indexed into a full-text retrieval database, such as Elasticsearch and other related databases.

[0100] A122. Generate positive samples. Traverse the medical institution standard library and find other texts with the same unified code zk_code as positive samples for each text.

[0101] A123. Generate negative samples. For each text, find the text with the largest matching value and different from its zk_code from the full-text retrieval database as a negative sample.

[0102] A124. Save the sample set. Write the generated sample set into a CSV file.

[0103] It should be noted that in the sample set obtained in step A11 or step A12, an ID is assigned to each text data to construct a mapping relationship between the ID and the text data, so as to facilitate the establishment of a relationship between each text data and the unified code. The set of medical institution names with the same unified code is defined as a synonym set. For example, for a unified code, there are multiple name character expressions such as {'Sun Yat-sen University Cancer Prevention and Treatment Center', 'Sun Yat-sen University Affiliated Cancer Hospital', 'Zhongda Cancer Hospital', 'Sun Yat-sen University Cancer Research Institute', 'Sun Yat-sen University Cancer Prevention and Treatment Center Internet Hospital'}, and the expressions of these medical institution names are constructed into a synonym set. When there is only one element in a synonym set, the element is independently constructed into a sample, which is expressed in the form of "<Sun Yat-sen University Cancer Prevention and Treatment Center, Sun Yat-sen University Cancer Prevention and Treatment Center>", "<Sun Yat-sen University Affiliated Cancer Hospital, Sun Yat-sen University Affiliated Cancer Hospital>" and other styles.

[0104] like Figure 1 As shown in , in the sample set, for any element in the synonym set, no other elements of the synonym set will appear in the context field with a distance N from it. Assume that there is a synonym set as a represents the standard name of the medical institution, The m+1 synonyms of element a are multiple name character expressions in the unified code (zk_code). In the context field with a distance N from element a in the sample set, it will not appear. Elements (i=0, 1, ...m). For example, for 'Sun Yat-sen University Cancer Center', in the context domain with a distance N from it, there will be no elements in the synonym set such as 'Sun Yat-sen University Affiliated Cancer Hospital' or 'Zhongda Cancer Hospital'.

[0105] In the sample set, for any element, its context is similar to that of the element’s N nearest neighbors. Figure 1 As shown, a, b, c, etc. are the most similar elements, such as {('Sun Yat-sen University Cancer Center', 'Sun Yat-sen University Cancer Center', 1), ('Hainan Cancer Center', 'Hainan Cancer Center', 1), ('Yunnan Cancer Hospital', 'The Third Affiliated Hospital of Kunming Medical College', 1), ('Huxiang Traditional Chinese Medicine Cancer Hospital', 'Changsha Yuelu District People's Hospital', 1), ('Affiliated Cancer Hospital of Guangzhou Medical University', 'Guangzhou Cancer Center', 1), ...}.

[0106] A2. Encoder model training:

[0107] In this embodiment, the encoder model is modeled using the SimCSE model based on the contrastive learning method. The SimCSE model uses the twin-tower model as a semantic framework, that is, the two medical institution name texts are encoded separately, and then their similarity is calculated. The specific training process is divided into three steps: forward calculation, definition of loss function, and reverse calculation:

[0108] Step A21: Forward calculation. For any sample x i ∈X, X represents the sample set. Sample x i The two elements in are calculated by the base encoder respectively. In this embodiment, Chinese BERT is selected as the base encoder, which can be expressed as:

[0109] base_vec1,base_vec2=encode_base(x i,1 ,t1),encode_base(x i,2 ,t2)

[0110] Where encode_base(·) represents the base encoder function, using Chinese BERT, t1, t2 represent the parameters of the Dropout layer in the base encoder, the larger the t1, t2, the more invalid neural network elements are output by the neural network, and x i,1 ,x i,2 Respectively represent samples x i The first and second elements of .

[0111] Step A22, define the loss function. For a given batch B of training data, the loss function is defined as:

[0112]

[0113] Among them, the similarity sim(·,·) is calculated using cosine.

[0114] Step A23, reverse calculation. First, the gradient of the loss function Loss relative to the model parameters is calculated by the back propagation algorithm. Then, these gradients are used to iteratively update the parameters by the gradient descent method or its variants to reduce the value of the loss function. The specific update formula is:

[0115] θ new =θ old -ηΔ θ Loss

[0116] Among them, θ represents the model parameters, η represents the learning rate, and Δ θ Loss represents the gradient of the loss function with respect to the parameter θ.

[0117] With multiple iterations, the model is gradually optimized, the loss function value is continuously reduced, and the model performance is improved. Finally, this process completes the learning of the encoder model. * (·)=encode_base(·,0).

[0118] In this embodiment, in step S2, the text character similarity recall is mainly completed by a character similarity algorithm, such as edit distance, BM25 algorithm, etc. This embodiment adopts the BM25 algorithm, and the specific formula is as follows:

[0119]

[0120] bm25(W,D) represents the similarity score between the name W of the medical institution to be queried and the standard name D of the medical institution, w i represents the i-th element after the word W, n(w i ) means including element w i The number of all standard names, N represents the number of standard names of all medical institutions, f(w i ,D) represents the element w i The frequency in D, |D| represents the length of the standard name D, avgdl represents the average length of the standard names of all medical institutions, k1,b represent hyperparameters, which respectively control the rising speed of the word frequency results in the word frequency saturation and the role of controlling the field length normalization value. The default values ​​are 1.2 and 0.75 respectively.

[0121] In this embodiment, the landing service system for implementing character matching is Elasticsearch. Elasticsearch is an open source, distributed, RESTful search and analysis engine built on Apache Lucene, which allows fast storage, search and analysis of large amounts of data, is used to implement full-text search functions, and is very suitable for processing various types of search queries.

[0122] In this embodiment, in step S2, the text semantic similarity recall is completed by the vector similarity algorithm of the medical institution name, and the vector similarity algorithm can be an algorithm such as Euclidean distance, Manhattan distance, cosine distance, etc. This embodiment specifically defines the semantic similarity of the medical institution name based on the cosine distance algorithm, and the specific formula is as follows:

[0123]

[0124] Among them, vec1=encode(W), vec2=encode(D), encode(·) represents the encoder model, which is used to convert the text of the medical institution name into a vector, W represents the name of the medical institution to be queried, D represents the standard name of the medical institution, vec1 represents the vector of W, and vec2 represents the vector of D.

[0125] In this embodiment, in step S3, a single-tower BERT scoring model is used to complete the reordering of the recall data obtained in step S2.

[0126] The single-tower BERT model is mainly divided into two stages: training and prediction.

[0127] B1. Training phase: Collect samples and format them into “[CLS] Medical institution name 1 [SEP] Medical institution name 2 [SEP]”, for example, “[CLS] Chengdu Shuangliu District XX Pharmacy (Sichuan Province) [SEP] Chengdu Shuangliu District XX Pharmacy [SEP]”. During training, [CLS] is used as the output of the single-tower BERT model. When the elements are relevant, the sample is marked as 1, otherwise it is marked as 0.

[0128] B2. The specific steps of the prediction stage are:

[0129] B21. Sort the standard names of medical institutions obtained by recalling text character similarity and recalling text semantic similarity in descending order respectively;

[0130] B22. Take the topN candidate elements of the standard names of medical institutions obtained by recalling text character similarity and recalling text semantic similarity respectively, and encapsulate them into the format of [CLS] medical institution 1 [SEP] medical institution 2 [SEP] as the input of the single-tower BERT model, where medical institution 1 is the name of the medical institution to be queried and medical institution 2 is the standard name of the recalled medical institution. For example, "[CLS] Shuangliu District XX Pharmacy [SEP] Chengdu Shuangliu District XX Pharmacy [SEP]";

[0131] B23. Obtain the standard name of the medical institution with the largest output score of the single-tower BERT model, complete the mapping of the same code, and finally output the unified code of the medical institution.

[0132] Furthermore, in this embodiment, before the field names in the flow data to be cleaned are managed, the field names in the flow data to be cleaned are first subjected to text preprocessing and historical alias library cleaning, etc., to ensure the validity and certainty of the input data. Specifically, the specific process of text preprocessing is:

[0133] In the actual pharmaceutical sales business, the names of the upstream and downstream medical institutions in the sales chain have their own independent names in the ERP systems of major distributors. For example, the name of the upstream medical institution may be the name corresponding to the distributor, not the real name. For another example, the names of the upstream and downstream medical institutions may be abbreviations or irregular names such as certain symbols or codes. Before text cleaning, these medical institution names need to be preprocessed. The preprocessing can be done in any of the following ways:

[0134] (i) Direct text replacement: Direct text replacement is applicable to distributors with special names internally, and directly replaces the designated special names with recognizable medical institution name text;

[0135] (ii) Regular expression replacement: Regular expression replacement is applicable to converting a class of data that meets regular expression conditions into recognizable medical institution name text.

[0136] Specifically, a set of preprocessing rules can be supported to perform preprocessing replacement in sequence in the form of preprocessing rule groups. After verification by actual business scenarios, the text preprocessing process greatly improves the final cleaning accuracy. Table 1 lists some preprocessing rules.

[0137] Table 1

[0138]

[0139] The specific process of cleaning the historical alias library is as follows:

[0140] The historical alias library is an accumulation of historical cleaning data. The data that has been cleaned and confirmed to be successfully cleaned is valuable cleaning experience. By effectively storing this data, not only can the cleaning efficiency be improved and the cleaning time be reduced, but the cleaning accuracy can also be improved through experience.

[0141] like Figure 2 As shown, the historical alias library includes the original upstream medical institution name, the original downstream medical institution name, and the downstream medical institution name that has been successfully cleaned. When cleaning the historical alias library, the pre-processed medical institution name text is first accurately queried in the historical alias library, and the query fields are the original upstream institution name and the original downstream institution name. If the query has a result, the cleaning process is directly terminated, and the subsequent cleaning process is no longer performed. The accurate query result of the historical alias library is returned, and the cleaning similarity in the returned result is 100%. If the query has no result, the cleaning process of steps S1-S2 is continued.

[0142] In this embodiment, while performing the cleaning of steps S1-S2, model cleaning is added as a supplement to improve the probability of data cleaning. Model cleaning can be further used when the cleaning of steps S1-S2 fails. The specific process of the model cleaning is as follows:

[0143] C1. Pre-cleaning operation

[0144] After text preprocessing, if there is no accurate query result in the historical alias library, the medical institution name text obtained after preprocessing is retrieved in real time from the encoder model to obtain vectorized text, and a vector search operation is performed in the standard library. The vector search uses the IP (inner product) algorithm. After obtaining the vector result, the similarity value between the retrieved vector result and the vectorized array is calculated and sorted in descending order. The top 10 results are taken and returned.

[0145] The inner product calculation formula is:

[0146] For two vectors a = (a1, a2, ..., an) and b = (b1, b2, ..., bn), their inner product is defined as:

[0147]

[0148] The core parameters of MILVUS vector retrieval are:

[0149] {"topK::10,"metricType":"IP","nprobe":8}

[0150] C2. Rules and threshold determination

[0151] After obtaining the 10 vector search results with the highest similarity in step B1, the 10 vector search results are subjected to rule and threshold determination, where the threshold is the minimum similarity value set by the user to determine that data cleaning is successful. The specific process of rule and threshold determination is as follows:

[0152] (1) If there is only one vector with a similarity of 100% in the TOP10 vector search results, the vector with a similarity of 100% is considered to be cleaned successfully;

[0153] (2) In the TOP10 vector search results, if there are two or more results with the same similarity higher than the threshold, and only one of the results has a medical institution with an operating status of "still in operation", it is determined that the cleaning is successful;

[0154] (3) Among the TOP10 vector search results, there is only one result with a similarity higher than the threshold, which is considered to be a successful cleanup;

[0155] (4) In the TOP10 vector search results, if there are multiple results with values ​​above the threshold, they are judged as cleansing pending confirmation, and are marked as requiring manual intervention for confirmation;

[0156] (5) Except for the above 4 situations, the rest are judged as cleaning failures.

[0157] In this embodiment, after completing data cleaning, further data quality inspection can greatly improve the accuracy of the data and effectively reduce the cost of manual intervention. The specific process of data quality inspection is:

[0158] After the cleaning of steps S1-S2 or the model cleaning, the data cleaning results at this time are often not certain and reliable. In order to help users intuitively and efficiently check the data results after the above cleaning process, this embodiment defines the specifications of machine quality inspection based on a large amount of accumulation in actual business scenarios, as shown in Table 2.

[0159] Table 2

[0160]

[0161] Among them, the four specifications are defined as:

[0162] (1) Entity type: common medical institution entities such as clinics, hospitals, pharmacies, and branches.

[0163] (2) Chain brand: a large-scale chain brand engaged in drug sales.

[0164] (3) Region: provinces, cities, districts, sub-districts, etc. as defined in the Administrative Regional Planning of the People's Republic of China.

[0165] (4) Names: Names extracted by the open source NLP framework HanLP.

[0166] After data quality inspection, different credibility levels are given to the data according to the quality inspection results. The credibility is divided into 3 levels, from high to low credibility: credibility A, credibility B, credibility C. The credibility granting rules are as follows:

[0167] When there is no abnormality in the data quality inspection results, and the name of the medical institution in the cleansing result is exactly the same as the downstream institution name of the original data, the credibility A is granted;

[0168] If the cleaning result has been cleaned by the historical alias database or confirmed by manual intervention, the credibility is granted A;

[0169] When the data quality inspection results are normal and the similarity of the data cleaning results is 100%, the credibility B is granted;

[0170] When there is no abnormality in the data quality inspection result and the similarity of the data cleaning result is less than 100%, the credibility C is granted.

[0171] For those skilled in the art, various corresponding changes and modifications can be made according to the above technical solutions and concepts, and all of these changes and modifications should be included in the protection scope of the claims of the present invention.

Claims

1. A medical institution name management method based on contrastive learning, characterized in that: The steps include: S1. Vectorizing the names of medical institutions in the pharmaceutical sales link data to be cleaned using an encoder model; the encoder model is an encoder model based on contrastive learning; S2. Perform text matching of medical institution names in the medical institution standard database and recall the similarity of semantics and characters; S3. Reorder the data recalled in step S2 using a single-tower BERT model, output the standard name of the medical institution with the largest score, and project the unknown medical institution name into the unified code corresponding to the standard name of the medical institution with the largest score; The fields of the medical institution standard library include unified codes, standard names of medical institutions, former names of medical institutions and business institution names; the unified codes are used to uniquely identify medical institutions; the standard names of medical institutions represent standard expressions of medical institutions and are currently recognized names of medical institutions; the former names of medical institutions represent the former standard names of medical institutions. With the changes in related businesses, the standard names are modified and the former standard names become former names; business institution names are some names that appear in actual business processes of medical institutions; the standard names of medical institutions, the former names of medical institutions and the business institution names are all vectorized through the encoder model; In step S2, the text character similarity recall is completed by a character similarity algorithm, which is implemented by the BM25 algorithm. The specific formula is as follows: bm25(W,D) represents the similarity score between the name W of the medical institution to be queried and the standard name D of the medical institution, w i represents the i-th element after the word W, n(w i ) means including element w i The number of all standard names, N represents the number of standard names of all medical institutions, f(w i ,D) represents the element w i The frequency in D, |D| represents the length of the standard name D, avgdl represents the average length of the standard names of all medical institutions, k1,b represent hyperparameters, which respectively control the rising speed of the word frequency results in the word frequency saturation and control the role of the field length normalization value; In step S2, the text semantic similarity recall is completed by the vector similarity algorithm of the medical institution name, and the semantic similarity of the medical institution name is defined based on the cosine distance algorithm. The specific formula is as follows: Wherein, vec1=encode(W), vec2=encode(D), encode(·) represents an encoder model, which is used to convert the text of the medical institution name into a vector, W represents the name of the medical institution to be queried, D represents the standard name of the medical institution, vec1 represents the vector of W, and vec2 represents the vector of D; In step S3, the single-tower BERT scoring model is used to re-rank the recall data obtained in step S2.

2. The method according to claim 1, characterized in that The encoder model is an encoder model based on contrastive learning, and its acquisition includes sample construction and model training; A1. Sample set construction: Use semantic similarity or text distance similarity to construct samples; A11. Semantic similarity: A111. Read data: read the collected medical institution name dataset from the specified file path; A112, data preprocessing: cleaning and formatting the text data in the data set obtained in step A111; A113, encoding text data: using a pre-trained model to encode the text data cleaned and formatted in step A112 into an embedding vector; A114, constructing a similarity matrix; calculating the cosine similarity between the embedded vectors obtained in step A113, and constructing a similarity matrix; A115. Generate positive samples. For each text, find other texts with the same unified code zk_code as positive samples. A116. Generate negative samples. For each text, find the text with the largest approximation value and different from its unified code zk_code from the similarity matrix as the negative sample. A117. Save the constructed sample set; write the generated sample set into a CSV file; A12. Text distance similarity: A121. Index synonym set: According to the medical institution standard library, the set of medical institution names with the same unified code is defined as a synonym set. The elements of the synonym set are constructed in the data format of (zk_code, medical institution name) and indexed into the full-text search database; A122. Generate positive samples: traverse the medical institution standard library, and for each text, find other texts with the same unified code zk_code as positive samples; A123. Generate negative samples: For each text, find the text with the largest matching value and different from its zk_code from the full-text retrieval database as a negative sample; A124. Save sample set: Write the generated sample set into a CSV file; In the sample set obtained in step A11 or step A12, an ID is assigned to each text data to construct a mapping relationship between the ID and the text data, so as to facilitate the establishment of a relationship between each text data and the unified code; a set of medical institution names with the same unified code is defined as a synonym set; in the sample set, for any element in the synonym set, no other elements of the synonym set will appear in the context field with a distance of N from it; in the sample set, for any element, its context is similar to the N nearest neighbors of the element; A2. Encoder model training: The encoder model is modeled using the SimCSE model based on the contrastive learning method; the specific training process is divided into three steps: forward calculation, definition of loss function, and reverse calculation: Step A21, forward calculation; for any sample x i ∈X, X represents the sample set; sample x i The two elements in are calculated by the base encoder respectively, and Chinese BERT is used as the base encoder, which is expressed as: base_vec1,base_vec2=encode_base(x i,1 ,t1),encode_base(x i,2 ,t2) Where encode_base(·) represents the base encoder function, using Chinese BERT, t1, t2 represent the parameters of the Dropout layer in the base encoder, the larger the t1, t2, the more invalid neural network elements are output by the neural network, and x i,1 ,x i,2 Respectively represent samples x i The first and second elements of ; Step A22, define the loss function: For a given batch B of training data, the loss function is defined as: Among them, the similarity sim(·,·) is calculated using cosine; Step A23, reverse calculation: First, the gradient of the loss function Loss relative to the model parameters is calculated by the back propagation algorithm. Then, these gradients are used to iteratively update the parameters by the gradient descent method or its variants to reduce the value of the loss function. The specific update formula is: i new =θ old -ηD θ Loss Among them, θ represents the model parameters, η represents the learning rate, and Δ θ Loss represents the gradient of the loss function with respect to the parameter θ; With multiple iterations, the model is gradually optimized, the loss function value is continuously reduced, and the model performance is improved; finally, this process completes the learning of the encoder model. * (·)=encode_base(·,0).

3. The method according to claim 1, characterized in that The single-tower BERT model is mainly divided into two stages: training and prediction; B1. Training phase: collect samples and format them into "[CLS] medical institution name 1 [SEP] medical institution name 2 [SEP]"; B2. The specific steps of the prediction stage are: B21. Sort the standard names of medical institutions obtained by recalling text character similarity and recalling text semantic similarity in descending order respectively; B22. Take the topN candidate elements of the standard names of medical institutions obtained by the text character similarity recall and the text semantic similarity recall respectively, and encapsulate them into the format of [CLS] medical institution 1 [SEP] medical institution 2 [SEP] as the input of the single-tower BERT model, where medical institution 1 is the name of the medical institution to be queried, and medical institution 2 is the recalled standard name of the medical institution; B23. Obtain the standard name of the medical institution with the largest output score of the single-tower BERT model, complete the mapping of the same code, and finally output the unified code of the medical institution.

4. The method according to claim 1, characterized in that: Before managing the field names in the flow data to be cleaned, first perform text preprocessing and historical alias library cleaning on the field names in the flow data to be cleaned; Text preprocessing can be done in any of the following ways: (i) Direct text replacement: Direct text replacement is applicable to distributors with special names internally, and directly replaces the designated special names with recognizable medical institution name text; (ii) Regular replacement: Regular replacement is used to convert a type of data that meets regular conditions into recognizable medical institution name text; The specific process of cleaning the historical alias library is as follows: The historical alias library includes the original upstream medical institution name, the original downstream medical institution name and the successfully cleaned downstream medical institution name; when cleaning the historical alias library, the pre-processed medical institution name text is first accurately queried in the historical alias library, and the query fields are the original upstream institution name and the original downstream institution name. If the query has results, the cleaning process is directly terminated, and no subsequent cleaning processes are performed. The accurate query results of the historical alias library are returned, and the cleaning similarity in the returned results is 100%. If the query has no results, the cleaning process of steps S1-S2 is continued.

5. The method according to claim 1, characterized in that While performing the cleaning of steps S1-S2, model cleaning is added as a supplement to improve the probability of data cleaning out; the specific process of the model cleaning is as follows: C1. Pre-cleaning operation After text preprocessing, if there is no accurate query result in the historical alias library, the preprocessed medical institution name text is retrieved in real time from the encoder model to obtain vectorized text, and a vector search operation is performed in the standard library. The vector search uses the inner product algorithm. After the vector result is obtained, the similarity value between the retrieved vector result and the vectorized array is calculated and sorted in descending order, and the first M results are taken and returned; C2. Rules and threshold determination After obtaining the M vector search results with the highest similarity in step B1, the M vector search results are subjected to rule and threshold determination, where the threshold is the minimum similarity value set by the user to determine that data cleaning is successful; the specific process of rule and threshold determination is as follows: (1) If there is only one vector with a similarity of 100% in the TOP10 vector search results, the vector with a similarity of 100% is considered to be cleaned successfully; (2) In the TOP10 vector search results, if there are two or more results with the same similarity higher than the threshold, and only one of the results has a medical institution with an operating status of "still in operation", it is determined that the cleaning is successful; (3) Among the TOP10 vector search results, there is only one result with a similarity higher than the threshold, which is considered to be a successful cleanup; (4) In the TOP10 vector search results, if there are multiple results with values ​​above the threshold, they are judged as cleansing pending confirmation, and are marked as requiring manual intervention for confirmation; (5) Except for the above 4 situations, the rest are judged as cleaning failures.

6. The method according to claim 5, characterized in that After the cleaning in steps S1-S2 or after the model cleaning, the cleaning results are quality inspected according to the set specifications; After data quality inspection, different credibility levels are given to the data according to the quality inspection results. The credibility is divided into 3 levels, from high to low credibility: credibility A, credibility B, credibility C. The credibility granting rules are as follows: When there is no abnormality in the data quality inspection results, and the name of the medical institution in the cleansing result is exactly the same as the downstream institution name of the original data, the credibility A is granted; If the cleaning result has been cleaned by the historical alias database or confirmed by manual intervention, the credibility is granted A; When the data quality inspection results are normal and the similarity of the data cleaning results is 100%, the credibility B is granted; When there is no abnormality in the data quality inspection result and the similarity of the data cleaning result is less than 100%, the credibility C is granted.

Citation Information

Patent Citations

  • Medical examination item standardization system and method based on medical knowledge graph and pre-training model

    CN113191156A

  • Medical term standardization method based on deep learning

    CN116975201A

  • Medical term standardization system and method based on heterogeneous graph neural network

    WO2023065858A1

Cited By

  • Mechanism name normalization method based on deep learning

    CN120235146A