CN115293161A - Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph - Google Patents

Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph Download PDF

Info

Publication number
CN115293161A
CN115293161A CN202210999490.5A CN202210999490A CN115293161A CN 115293161 A CN115293161 A CN 115293161A CN 202210999490 A CN202210999490 A CN 202210999490A CN 115293161 A CN115293161 A CN 115293161A
Authority
CN
China
Prior art keywords
medicine
module
entity
data
text
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210999490.5A
Other languages
Chinese (zh)
Inventor
唐珂轲
黄毅宁
陈美莲
林少泽
韦宜均
梁锐
钟冬赐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Zhongkang Zixun Co ltd
Original Assignee
Guangzhou Zhongkang Zixun Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Zhongkang Zixun Co ltd filed Critical Guangzhou Zhongkang Zixun Co ltd
Priority to CN202210999490.5A priority Critical patent/CN115293161A/en
Publication of CN115293161A publication Critical patent/CN115293161A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Medical Treatment And Welfare Office Work (AREA)

Abstract

The invention discloses a reasonable medication system and a method based on natural language processing and a medicine knowledge graph.

Description

Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph
Technical Field
The invention relates to the technical field of natural language processing technology and knowledge maps, in particular to a rational medicine administration system and a method based on natural language processing and a medicine knowledge map.
Background
In the big data age, data is a cornerstone of innovative business models and leading-edge technological development. Along with the popularization of big data concept in recent years, a plurality of enterprises pay more and more attention to the data governance inside the enterprises, the walls among the data of all the previous sub-modules are broken through, and the data resources of the enterprises can be utilized to the maximum extent through further integration.
In the aspect of medicines, the knowledge graph of the medicines can be formed by rapidly and effectively processing non-mechanization specification data based on an artificial intelligence technology. On the basis of the knowledge graph, a plurality of applications in different directions can be derived, such as reasonable medication system functions of an internet hospital, a medicine knowledge service platform required by a DTP pharmacy pharmacist, intelligent medicine services required by a patient user and the like. In an internet hospital setting, a doctor has the ability to make prescriptions on-line. On one hand, risks of repeated medication, drug merchant action, inconsistency of prescription drug indications and the like need to be avoided, on the other hand, compliance of the prescription needs to be checked to prevent the situation of indiscriminate prescription, and the function of reasonable medication function warning plays an important role here and can remind doctors and pharmacists of risk information when the prescription is made. In the DTP pharmacy scenario, pharmacists need to improve the level of service to patients, but due to lack of clinical knowledge and experience, they need to take more time to follow up with the knowledge of the drug. However, the large business volume of the DTP pharmacy store causes the great work pressure of pharmacists, many pharmacists have to use private time to learn the medicine knowledge, but due to the limited background knowledge, the follow-up of the medicine knowledge is a huge challenge for them. Under the scene, the medicine knowledge service platform is very important, and based on the latest medicine knowledge map and a convenient query search interface, pharmacists can conveniently query the knowledge of medicines, so that the time of the pharmacists is greatly saved. In the patient user scenario, the lack of background knowledge leads to a very poor understanding of the information about drug reuse methods, contraindications, etc. The user has the defects of limited knowledge acquired by depending on a search engine and low timeliness when inquiring doctors on line, so that the intelligent medicine service based on man-machine conversation can help the user to quickly know medicine information. Meanwhile, the deployment of the drug affair service to the terminals such as the WeChat small program and the like is also an important way for expanding the user traffic entrance.
Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide a rational medicine taking system and method based on natural language processing and medicine knowledge base.
In order to achieve the purpose, the invention adopts the following technical scheme:
a rational medicine administration system based on natural language processing and medicine knowledge maps comprises an automatic prescription auditing module, a medicine recommending module, a prompt information backtracking module, a medicine information inquiring module and a data updating and maintaining module;
the prescription automatic auditing module: the system is used for automatically auditing the rationality of a prescription and giving an auditing result according to a medicine knowledge graph after a doctor makes the prescription in a diagnosis and treatment scene and according to input basic information, diagnosis and treatment information of a patient and information of specific medicines in the prescription, wherein the rationality auditing content comprises whether the medicines in the prescription are suitable with symptoms and disease diagnosis results in the diagnosis and treatment information or not, whether interaction exists between the medicines in the prescription and medicines being taken by the patient or not, whether the crowd type of the patient belongs to taboo crowds of the medicines in the prescription, whether the patient has an allergy history of taking the medicines in the prescription, whether repeated medicine taking exists in the prescription or not, and whether the usage amount of the medicines in the prescription is consistent with the usage amount of the corresponding medicines in the medicine knowledge graph or not; the basic information of the patient comprises age, sex, population type, allergy history and recent medication; the diagnosis and treatment information comprises symptoms and disease diagnosis results; the information of the specific medicines in the prescription comprises the universal name, manufacturer, specification, standard size and usage amount of each medicine;
a medicine recommending module: the system is used for generating a recommended medication list by utilizing a medicine knowledge graph according to input basic information and disease and symptom information of a patient in a diagnosis and treatment scene or a consultation medication scene;
the information backtracking module: a query interface for providing sources of prescription plausibility audit results and recommended medication lists, the sources including drug description texts and interaction databases; for the original text of the specification, the results of checking the reasonability of the prescription and recommending a medication list come from indications, interaction, contraindications and usage and dosage of the medicine specification; the interaction database definitely indicates the interaction among the components, and the recommended medication module or the automatic prescription auditing module searches the interaction database for the interaction through the components of the medicines in the medicine knowledge map so as to give the interaction, so that the interaction result is the interaction detail information inquired in the database when tracing the source of the interaction result;
a medicine information query module: the system is used for providing an inquiry interface and an interface for inquiring medicine information, wherein the medicine information comprises a specification original text, a medicine knowledge map, adverse reactions, indications, contraindications and a medicine dosage;
a data update maintenance module: and the data updating and maintaining module is used for processing the text data of the uploaded medicine specification by using a natural language processing model and updating the medicine knowledge graph according to the processed text data.
Furthermore, the recommended medication module screens out applicable medicines by using a medicine knowledge map according to the input disease and symptom information of the patient, and then filters the screened medicines according to the crowd type, the allergy history and the recent medication condition of the patient, so as to filter out medicines which are not suitable for the crowd type corresponding to the patient to take, can cause allergy of the patient and have repeated or interactive effects with the medicines being taken by the patient; and sorting the rest of the filtered medicines according to a sorting rule set by a user to generate a recommended medication list.
Further, when inquiring the original text of the specification, the knowledge map of the medicine and the usage amount, returning specific information according to the universal name, the manufacturer, the specification and the standard size of the medicine; the query of adverse reactions, indications and taboos supports forward query and reverse query, wherein the forward query is to return information by the common name, manufacturer, specification and standard letter number of the medicine, and the reverse query is to return a specific medicine list by a specific adverse reaction, indication or taboo.
Furthermore, the data updating and maintaining module supports uploading of medicine specifications in various data formats, including PDF, IMG and text; for the text data, the data updating and maintaining module directly utilizes the natural language processing model to process the uploaded specification text data and updates the medicine knowledge graph according to the uploaded specification text data; for PDF and IMG type data, the data updating and maintaining module extracts content and converts the content into text by using an image processing technology, and then the extracted text data is processed by using a natural language processing model.
Furthermore, the data updating and maintaining module provides a data quality control function, and a user can compare the automatic labeling and map forming results of the text with the original text of the specification to ensure the data quality.
Furthermore, the data updating and maintaining module provides a drug catalog docking function, a user can upload drug data comprising universal names, manufacturers, specifications and quasi-character number fields of drugs through the drug catalog docking function, and the data updating and maintaining module matches the drug data uploaded by the user to an existing drug catalog through an automatic alignment algorithm of a natural language processing model; for the medicines which do not exist in the original medicine catalog, the data updating and maintaining module automatically structures the medicines through the uploaded medicine specification to form a medicine knowledge graph; and finally, completing the butt joint work of the medicine data and putting the medicine data into use.
The invention also provides a method for constructing the system, which comprises the following specific processes:
1. designing a knowledge graph of the medicine:
designing a medicine knowledge graph structure containing corresponding fields based on consideration of business requirements of a rational medicine system, wherein the medicine knowledge graph structure comprises components, indications, adverse reactions, contraindications, interaction and usage amount;
2. designing a label system:
defining a label system according to the design of a medicine knowledge graph;
3. data annotation:
after the label system is designed, marking sample text data of the drug specification by using a marking tool; the data annotation work is performed according to field division tasks designed by the medicine knowledge graph structure; each different field comprises three labeling tasks of named entity labeling, entity relation labeling and labeling term alignment; the named entity labeling is to perform range division and entity type selection on specific words according to entity labels by a labeling tool, and comprises continuous entity labeling and discontinuous entity labeling; the entity relation marking is to specify the type of the directed relation between the marked named entities; the entity alignment marking is to determine which standardized term the entity is aligned to according to the named entity and the entity type label;
4. constructing a natural language processing model:
the natural language processing model automatically analyzes text data obtained from a medicine specification uploaded by a user, extracts entity and entity relation information in the text data, and further aligns to a standard term to construct a medicine knowledge graph; the construction process of the natural language processing model comprises the following steps:
4.1, construct information extraction Module
The model of the information extraction module comprises the tasks of drug text classification, chapter structure analysis, BERT coding task, entity extraction and relationship combined extraction;
the medicine text classification task is used for classifying the text data of the input medicine specification according to the Chinese patent medicines and the chemical medicines;
the BERT coding task is used for coding by adopting massive unsupervised linguistic data or self-adaptive pre-trained BERT in the medical field;
the chapter structure analysis task is used for carrying out a task of dividing the semantic meaning of the chapter medical block on the input medicine specification text; the method comprises the following steps that a medicine specification text relates to the roles of multiple fields such as indications, taboos, usage amount and the like, and a chapter structure analysis task is used for dividing the fields of different text segments and identifying the medical semantic role to which a certain text segment belongs;
the medical entity recognition task is used for extracting the medicine related entities mentioned in the input medicine specification text;
the medical relation extraction task is used for identifying and judging specific relations existing between entity pairs in the input medicine specification text;
the structure of the model integrating the tasks comprises a BERT encoder module, a head entity marking module, a tail entity marking module of the relationship, a chapter extraction module, a specification type classification module and a loss function calculation module; the whole process passes through a shared BERT coding layer and a multi-task joint learning reverse optimization model; the data processing process of the model is as follows:
suppose that there is a text sequence of X = (X) 1 ,x 2 ,x 3 ,...,x n ),x t A character or word representing the t-th position, n representing the length of the text sequence;
s4.1.1, adding a set start character [ CLS ] at the beginning of a text sequence X by a BERT encoder module, and then carrying out BERT encoding:
H=BERT([CLS]+X)...............(1);
wherein H represents the hidden state of the text sequence X after being coded by a function BERT (-), H belongs to R n×d N represents the number of characters or words of the text sequence X, and d represents the vector dimension after encoding;
s4.1.2, the head entity marking module calculates the boundary probability of the head entity mark as follows:
Figure BDA0003806957320000071
Figure BDA0003806957320000072
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0003806957320000073
the probability of the beginning of the head entity is represented for the ith character or word,
Figure BDA0003806957320000074
representing the probability of the end of the head entity for the ith character or word, W s ∈R d×1 ,W e ∈R d×1 ,b s ∈R,b e E is R to represent the parameter to be learned, R represents a real number set, and sigma (-) represents an activation function;
the likelihood function of the head entity can thus be calculated:
Figure BDA0003806957320000075
where s represents the head entity, I (-) represents the indicator function,
Figure BDA0003806957320000076
the mark representing the starting position or the ending position of the ith character or word takes the value of {0,1};
s4.1.3, the calculation relationship of the tail entity marking module and the tail entity boundary is as follows:
Figure BDA0003806957320000077
Figure BDA0003806957320000078
wherein the content of the first and second substances,
Figure BDA0003806957320000081
representing the probability that the ith character or word represents the beginning of the tail entity,
Figure BDA0003806957320000082
representing the probability that the ith character or word represents the end of the tail entity, v k ∈R d Denotes the kth head entity vector, d denotes the dimension of the code, h i E, H represents a hidden vector of the character or the word; if the entity is composed of a plurality of characters or words, a round of average value calculation is carried out;
Figure BDA0003806957320000083
respectively representing parameters to be learned by the model, m representing a relation type number, R representing a real number set, and sigma (·) representing an activation function;
thus, the likelihood functions of the relationships and entities can be calculated:
Figure BDA0003806957320000084
where o represents the tail entity, I (-) represents the indicator function,
Figure BDA0003806957320000085
the mark representing the starting position or the ending position of the ith character or word takes the value of {0,1};
s4.1.3, assuming that the output tag sequence is y = (y) 1 ,y 2 ,y 3 ,...,y n ) The chapter abstraction module calculates the total score of the chapter analysis sequence as follows:
Figure BDA0003806957320000086
wherein A ∈ R n×n To transfer the matrix, W crf ∈R d×n ,b crf ∈R n Represents a parameter to be learned;
calculating the probability of the text sequence corresponding to the target sequence as follows:
Figure BDA0003806957320000087
wherein,Y x Representing a set of possible target sequences;
in the prediction phase, the optimal sequence is solved by using a Viterbi algorithm:
Figure BDA0003806957320000088
s4.1.4, calculating text category probability by a specification type classification module: (ii) a
p c =W c ×h cls +b c ............(11);
Wherein, W c ∈R d ,b c e.R denotes the parameter to be learned, h cls Represents [ CLS]The hidden vector of (2);
s4.1.5, the loss function calculation module calculates the loss function as follows:
L=-(l s+o +l crf +l c )......................(12);
wherein the content of the first and second substances,
Figure BDA0003806957320000091
Figure BDA0003806957320000092
Figure BDA0003806957320000093
wherein M represents the total number of samples, n represents the text length, and lambda and gamma are regularization parameters;
4.2 construction of term standardization Module
The term standardization module is mainly based on a two-stage term standard model, recalls candidate terms from standard terms firstly, and then calculates candidate terms in a refined mode; the construction process of the term standardized module is as follows:
s4.2.1, collecting Chinese and English term corpora and an open term library, and constructing a medical term library after arrangement, wherein fields of the medical term library comprise unified codes CUI, english standard words, english synonyms, chinese standard words and Chinese synonyms;
s4.2.2, establishing indexes for Chinese and English based on an index tool or by adopting a self-defined index, translating the Chinese terms into English when inquiring the Chinese terms, and taking the English and the Chinese as input together;
4.2.3 building a search engine for keywords by integrating recall scores s through multiple recalls recall Suppose s 1 And s 2 Two terms are used:
s recall =α 1 ×s bm252 ×s Jaccard3 ×s MED4 ×s DICE .......(16)
wherein alpha is 1234 Respectively represent the weight of each road score, and alpha 1234 =1;
Wherein BM25 scores s bm25 The calculation is as follows:
Figure BDA0003806957320000101
Figure BDA0003806957320000102
wherein, ω is i Denotes the query term s 1 The ith word segmentation; f. of i Is the word omega i In the term s 2 Frequency of occurrence of, k 1 B is an adjustment factor, len (-) is a function for calculating the length of the sentence, and avgsl is the average length of all the documents in the index; n denotes the number of all documents in the index, N (ω) i ) To comprise omega i The number of documents;
jaccard coefficient s Jaccard The calculation is as follows:
Figure BDA0003806957320000103
wherein A and B each represent s 1 And s 2 Represents the number of collection elements;
edit Distance (MED) similarity score s MED The calculation is as follows:
Figure BDA0003806957320000104
where len (·) is a function for calculating sentence length, d(s) 1 ,s 2 ) Denotes s 1 And s 2 The edit distance of (d);
DICE distance similarity score s DICE The calculation is as follows:
Figure BDA0003806957320000105
wherein A and B each represent s 1 And s 2 The word segmentation set, |, represents the number of the elements of the set;
s4.2.4, training a refined model:
s4.2.4.1, constructing a positive sample: dividing Chinese and English of all words in the same concept CUI code in term library (term _ db) into two groups of terms, wherein the first group is a Chinese term set, and the second group is an English term set; and combining every two term sets of each group to form a term training pair to form a positive sample set +
S4.2.4.2, constructing a negative sample: traversing each group of set elements Q in the concept CUI code, performing similarity calculation on the preferred words in a medical term library term _ db through a formula (16), then taking the preferred words of Top100 and Q to form a term pair set, and finally removing a positive sample set + Element obtaining negative sample set -
S4.2.4.3, constructing a training sample: respectively randomly disorder set + 、set - The ratio of 1:10 from set - Taking negative samples and merging to set + A training sample set is obtained, which is added with 0,1, 0 represents a negative sample, 1 represents a positive sample;
s4.2.4.4, scoring by adopting a BERT model: the terms in set select y select {0,1} as the sequence classification task for the input sequence constituting "[ cls ] s1[ seq ] s2", forming an example, the loss function is a cross entropy loss function;
s4.2.4.5, dividing the sample samples into a training set and a testing set, and training; the model evaluation adopts F1 value, the model with the highest F1 value in the test set evaluation is selected for storage, and the middle-English-ranking dual model std _ model is formed zh And std _ model en
S4.2.5, two-stage term standard prediction:
s4.2.5.1 input Chinese term Q needing standardization, translating into Q EN
S4.2.5.2 based on the formula (16), retrieving Q from the first Chinese word and the synonymous Chinese word in term _ db of the medical term library, taking Top30, constructing a term pair, and inputting std _ model of the second stage zh In the model, score is obtained, and candidate set C of Top5 is taken zh-top5 (ii) a In the same way, Q EN Retrieving from the first English word and the synonymous English word in term _ db of the medical term library, taking Top30, constructing a term pair, and inputting std _ model of the second stage en In the model, score is obtained, and candidate set C of Top5 is taken en-top5
S4.2.5.3, integrating the final result; setting Chinese and English scoring weight weighting lambda zhen
Are respectively to C zh-top5 And C en-top5 Calculating scores, averaging the scores of CUIs with the same concept to form a final standardized set C, and taking Top1 from C as the optimal standardized result;
5. construction of drug knowledge maps
The medicine specification can obtain a basic map after being analyzed by a natural language processing model, and the basic map mainly comprises defined entity labels, entities, relation labels and relations; converting the basic map into the final target map also needs a data processing process, describing the map schema by using an RDFS/OWL technology, and reasoning the basic map by using an SWRL language to finally form the target map;
6. continuously updating module for constructed data
Packaging deep learning natural language processing application service by using a micro-service architecture, and constructing an MLOPS process based on a Docker + Kubernates + Gitlab technology; automatically deploying services and continuously processing data by using the technology; in the face of a new medical institution or a pharmacy, only the medicine specification data needs to be uploaded, and the data continuous updating module can automatically process the data by using a natural language processing model, construct a medicine knowledge graph and deploy medicine application.
Further, in the drug knowledge graph, the drug knowledge graph structure includes blank nodes to expand different scenarios.
Further, in the medicine knowledge graph, the component field is used for recording information including main components and auxiliary materials of the medicine; the indication field is used for recording diseases and symptoms applicable to the medicine; the adverse reaction field is used for recording information including the name, type and occurrence frequency grade of the adverse reaction of the medicine; the contraindication field is used for recording the allergic contraindication of the medicine, the corresponding contraindications of symptoms and diseases and the contraindication information of specific crowds; the interaction field is used for recording specific interaction information between medicine components and between medicine classes; the usage amount field is used to record information on the purpose of administration, route of administration, time of administration, population, frequency of administration, number of administrations, type of dose, value of dose per dose and dosage unit of the drug.
Further, in the above method, the tag system design is an iterative design process, and when the performance of the natural language processing model does not meet the requirements, the tag system needs to be dynamically modified.
The invention has the beneficial effects that: the invention constructs a reasonable medication system based on natural language processing and a medicine knowledge graph, and the system can automatically carry out data management on medicine specification data and form the medicine knowledge graph to realize the function of the reasonable medication system based on the knowledge graph.
Drawings
Fig. 1 is a flow chart of the construction of a natural language processing model in embodiment 2 of the present invention.
Detailed Description
The present invention will be further described below, and it should be noted that the present embodiment is based on the technical solution, and a detailed implementation manner and a specific operation process are provided, but the protection scope of the present invention is not limited to the present embodiment.
Example 1
The embodiment provides a reasonable medication system based on natural language processing and a medicine knowledge graph, which comprises an automatic prescription auditing module, a medication recommending module, a prompt information backtracking module, a medicine information inquiring module and a data updating and maintaining module;
the prescription automatic auditing module: the method is used for automatically auditing the rationality of the prescription and giving an auditing result according to a medicine knowledge graph after a doctor makes a prescription in a diagnosis and treatment scene and according to input basic information, diagnosis and treatment information of a patient and information of specific medicines in the prescription, wherein the rationality auditing content comprises whether the medicines in the prescription are suitable with symptoms and disease diagnosis results in the diagnosis and treatment information or not, whether interaction exists between the medicines in the prescription and medicines being taken by the patient or not, whether the crowd type of the patient belongs to taboo crowds of the medicines in the prescription, whether the patient has an allergy history of taking the medicines in the prescription, whether repeated medicine taking exists in the prescription or not, and whether the usage amount of the medicines in the prescription is consistent with the usage amount of the corresponding medicines in the medicine knowledge graph or not. The basic information of the patient includes age, sex, population type (pregnant woman, children, old people, etc.), allergy history and recent medication; the diagnosis and treatment information comprises symptoms and disease diagnosis results; the information of the specific medicines in the prescription comprises the common name, manufacturer, specification, standard size and usage amount of each medicine.
A medicine recommending module: the method is used for generating a recommended medication list according to the input basic information of the patient and the disease and symptom information in a diagnosis and treatment scene or a consultation medication scene. Specifically, the recommended medication module screens out applicable medicines by using a medicine knowledge map according to input disease and symptom information of the patient, and then filters the screened medicines according to the crowd type, allergy history and recent medication condition of the patient, so as to filter out medicines which are not suitable for the crowd type corresponding to the patient to take, can cause allergy of the patient and have repeated or interactive effects with the medicines being taken by the patient; and sorting the rest of the filtered medicines according to a sorting rule set by a user to generate a recommended medication list. The filtering according to the type of population and the allergy history is to prevent the contraindications field of the instructions for recommending a drug to the drug from explicitly referring to persons who are not suitable for use. The filtering according to the recent medication use situation is to prevent the recommendation of a drug that interacts with the drug being taken by the patient and to avoid the situation of repeated medication use.
The information backtracking module: a source for providing review results of prescription rationality and recommended medication lists, the source including a drug order script and an interaction database. The information sources of the prescription rationality auditing results or the recommended results are required to be checked in the diagnosis and treatment scene or the recommended medication scene, and the purpose is to ensure the rationality and the safety of medication. The information backtracking direction is two, one is the original text of the medicine specification, and the other is the interaction database. For the original text of the specification, the results of checking the reasonability of the prescription and recommending a medication list come from fields of indications, interaction, contraindications, usage and dosage and the like of the medicine specification. The interaction database definitely indicates the interaction among the components, and the recommended medication module or the automatic prescription auditing module searches the interaction database for the interaction through the components of the medicines in the medicine knowledge map, so that the interaction result is the interaction detail information inquired in the database when tracing the source of the interaction result.
A medicine information query module: the system is used for providing an inquiry interface and an interface for inquiring medicine information, wherein the medicine information comprises a specification original text, a medicine knowledge map, adverse reactions, indications, contraindications and a medicine dosage. It should be noted that in both the diagnosis and treatment and pharmacy scenarios, there is a need for drug information query to assist medical workers/pharmacy workers in querying relevant drug information about the specific situation of a patient. The original text, the knowledge map and the usage amount of the specification return specific information according to the common name, the manufacturer, the specification and the standard font size of the medicine, and the adverse reaction, the indication and the contraindication support forward query and reverse query; the forward query is to return information by the common name, manufacturer, specification and quasi-character number of the medicine, and the reverse query is to return a specific medicine list by a specific adverse reaction, indication or taboo.
A data update maintenance module: the system is used for uploading the medicine specification, provides an uploading interface and an interface, and supports the uploading of the medicine specification in various data formats, including PDF, IMG and text. For text data, the data updating and maintaining module processes uploaded specification text data by using the natural language processing model, updates the medicine knowledge graph according to the uploaded specification text data, provides a data quality control function, and ensures data quality by comparing the results of automatic labeling and graph forming of the text with the specification text by a user. For PDF and IMG type data, the data updating and maintaining module extracts content and converts the content into text by using an image processing technology, and then the extracted text data is processed by using a natural language processing model.
In addition, in order to facilitate the system to be deployed and landed in different mechanisms, the data updating and maintaining module provides a drug catalog docking function, a user can upload drug data comprising fields of drug universal names, manufacturers, specifications and quasi-character numbers through the drug catalog docking function, and the data updating and maintaining module matches the drug data uploaded by the user to an existing drug catalog through an automatic alignment algorithm of a natural language processing model. For the medicines which do not exist in the original medicine catalog, the data updating and maintaining module automatically structures the medicines through the uploaded medicine specification to form a medicine knowledge graph; and finally, completing the butt joint work of the medicine data and putting the medicine data into use.
Example 2
The present embodiment provides a method for constructing the system described in embodiment 1, which includes the following specific processes:
the system described in embodiment 1 is a rational medication system implemented based on natural language processing and knowledge graph technology, and the method for constructing the system described in embodiment 1 will be explained in several aspects of drug knowledge graph design, label system design, data annotation, natural language processing model construction, drug knowledge graph construction, and data continuous update process construction.
1. Knowledge map for designing medicine
The system of embodiment 1 is based on knowledge graph technology to realize various reasonable medication information prompt functions, and knowledge graph design is in fit with application scenarios. Based on the consideration of business requirements of a rational medication system, a medicine knowledge graph structure containing corresponding fields is designed, wherein the medicine knowledge graph structure comprises components, indications, adverse reactions, contraindications, interactions and usage amounts. Since the usage scenarios of drugs differ under different conditions, including different patients, different times, etc., the design of the drug knowledge-graph structure includes blank nodes to extend the different scenarios. The component field is used for recording information including main components and auxiliary materials of the medicine; the indication field is used for recording diseases and symptoms applicable to the medicine; the adverse reaction field is used for recording information including the name, type and occurrence frequency grade of the adverse reaction of the medicine; the contraindication field is used for recording the contraindication of allergy, symptoms and diseases of the medicine, and the contraindication information of specific people; the interaction field is used for recording specific interaction information between the medicine components and between the medicine categories; the usage amount field is used to record information on the purpose of administration, administration route, administration time, population, administration frequency, number of administrations, dose type, dose value per dose and dose unit of the drug.
2. Designing a label system:
the label system is defined according to the design of the medicine knowledge graph, and the purpose is to make the conversion from the labeling result to the medicine knowledge graph easier. On the other hand, the difficulty of natural language processing also needs to be considered when designing tags. The label system design is also an iterative design process, and when the performance of the natural language processing model does not meet the requirement, the label system needs to be dynamically modified. Finally forming a set of standard label system through an iterative process.
3. Data annotation:
and after the label system is designed, marking the sample text data of the medicine specification by using a marking tool. The data marking work comprises two stages of marking and auditing. And the administrator constructs tasks and distributes the tasks to specific marking personnel for marking. And after the annotation personnel finishes the annotation, submitting the annotated data to an administrator for auditing work, returning the data which do not pass the auditing to the annotation personnel for checking and modifying, wherein the data which pass the auditing can be used for the subsequent training process of the natural language processing model. And the data annotation work is performed according to the field division task designed by the medicine knowledge graph structure. Each different field comprises three labeling tasks of named entity labeling, entity relationship labeling and labeling term alignment. The named entity labeling is to perform range division and entity type selection on specific words according to entity labels through a labeling tool, and comprises continuous entity labeling and discontinuous entity labeling; an entity relationship annotation specifies a type of directed relationship between annotated named entities. The entity alignment label determines which standardized term the entity is aligned to according to the named entity and the entity type label. In order to more fully align the entities to the standard terms, the embodiment adopts three alignment modes of equivalence, upper position and lower position.
In addition, in the labeling process, an autonomous learning mode is used for dynamically evaluating the labeling result of the labeling personnel and providing labeling data with the highest model confusion degree, so that the labeling personnel are subjected to emphasis and strengthened labeling. And the data marking work and the model training work are continuously and alternately carried out to obtain better model representation effect. And adding a data annotation task to the data with poor model expression effect.
4. Natural language processing model construction
The embodiment automatically analyzes text data obtained from a medicine specification uploaded by a user by using a natural language processing model, extracts entities and entity relationship information in the text data, and further aligns the text data to standard terms to construct a medicine knowledge graph. Therefore, the text data processing flow of the medicine specification is mainly divided into two modules, namely an information extraction module and a medical term alignment module. As shown in fig. 1, the process of constructing the natural language processing model includes:
4.1, construct the information extraction Module
The embodiment is based on the model of the thesis [1], and is improved into a model including tasks such as drug text classification, chapter structure analysis, entity extraction, and relationship joint extraction, and is used as an information extraction module.
The medicine text classification task is used for classifying the text data of the input medicine specification according to the Chinese patent medicines and the chemical medicines;
the BERT coding task is used for coding by adopting massive unsupervised corpora or self-adaptive pretrained BERT in the medical field. BERT model Structure the BERT (Bidirectional Encoder R expressions from transformations) model was proposed by Google AI in 2018 [2] Compared with the algorithm of the earliest language-counting model and the subsequent Word vector technology Word2vec [3] Has more semantic expressive and intellectual properties.
The chapter structure analysis task is used for carrying out a task of dividing the semantic meaning of the chapter medical block on the input medicine specification text. The method comprises the following steps that a medicine specification text relates to the roles of multiple fields such as indications, taboos, usage amount and the like, and a chapter structure analysis task is used for dividing the fields of different text segments and identifying the medical semantic role to which a certain text segment belongs;
the medical entity identification task is used for extracting medical related entities such as diseases, symptoms, medicines and the like mentioned in the input medicine specification text.
The medical relationship extraction task is used for identifying and judging specific relationships existing between entity pairs in the input medicine specification texts. For example, "gastric hyperacidity" (manifestation) leads to "stomach pain" (manifestation), which leads to a relationship that gastric hyperacidity leads to manifestation of stomach pain.
The structure of the model integrating the tasks comprises a BERT encoder module, a head entity marking module, a tail entity marking module of the relationship, a chapter extraction module, a specification type classification module and a loss function calculation module. The whole process passes through a shared BERT coding layer and a multi-task joint learning reverse optimization model. The data processing process of the model is as follows:
suppose that there is a text sequence of X = (X) 1 ,x 2 ,x 3 ,...,x n ),x t The character or word representing the t-th position, and n represents the length of the text sequence.
S4.1.1, adding a set start symbol [ CLS ] at the beginning of the text sequence X by a BERT encoder module, and then carrying out BERT encoding:
H=BERT([CLS]+X)...............(1)
wherein H represents the hidden state of the text sequence X after being coded by a function BERT (-), H is equal to R n×d N represents the number of characters or words of the text sequence X, and d represents the vector dimension after encoding;
s4.1.2, the head entity marking module calculates the boundary probability of the head entity mark as follows:
Figure BDA0003806957320000201
Figure BDA0003806957320000202
wherein the content of the first and second substances,
Figure BDA0003806957320000203
the probability of the beginning of the head entity is represented for the ith character or word,
Figure BDA0003806957320000204
for the i-th character or word to indicate the probability of the head entity ending, W s ∈R d×1 ,W e ∈R d×1 ,b s ∈R,b e E R represents the parameter to be learned, R represents the set of real numbers, σ (-) represents the activation function.
The likelihood function of the head entity can thus be calculated:
Figure BDA0003806957320000205
where s represents the head entity, I (-) represents the indicator function,
Figure BDA0003806957320000206
and the mark representing the start position or the end position of the ith character or word takes the value of {0,1}.
S4.1.3, the calculation relationship of the tail entity marking module and the tail entity boundary is as follows:
Figure BDA0003806957320000211
Figure BDA0003806957320000212
wherein the content of the first and second substances,
Figure BDA0003806957320000213
representing the probability that the ith character or word represents the beginning of the tail entity,
Figure BDA0003806957320000214
representing the probability that the ith character or word represents the end of the tail entity, v k ∈R d Denotes the kth head entity vector, d denotes the dimension of the code, h i e.H represents a hidden vector of the character or word; if the entity is composed of a plurality of characters or words, a round of average value calculation is carried out;
Figure BDA0003806957320000215
respectively, representing the parameters to be learned by the model, m representing the number of relation types, R representing the set of real numbers, and σ (·) representing the activation function.
Thus, the likelihood function of the relation and the entity can be calculated:
Figure BDA0003806957320000216
where o represents the tail entity, I (-) represents the indicator function,
Figure BDA0003806957320000217
and the mark representing the start position or the end position of the ith character or word takes the value of {0,1}.
S4.1.3, assume that the output tag sequence is y = (y) 1 ,y 2 ,y 3 ,...,y n ) The overall score of the chapter analysis sequence calculated by the chapter extraction module is as follows:
Figure BDA0003806957320000218
wherein A ∈ R n×n To transfer the matrix, W crf ∈R d×n ,b crf ∈R n Representing the parameters to be learned.
Calculating the probability corresponding to the text sequence to the target sequence as follows:
Figure BDA0003806957320000219
wherein Y is x Representing a set of possible target sequences.
In the prediction phase, the optimal sequence is solved by using a Viterbi algorithm:
Figure BDA0003806957320000221
s4.1.4, calculating text category probability by a specification type classification module:
p c =W c ×h cls +b c ............(11)
wherein, W c ∈R d ,b c e.R denotes the parameter to be learned, h cls Denotes [ CLS]The hidden vector of (2). S4.1.5, the loss function calculation module calculates the loss function as follows:
L=-(l s+o +l crf +l c )......................(12)
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0003806957320000222
Figure BDA0003806957320000223
Figure BDA0003806957320000224
where M represents the total number of samples, n represents the text length, and λ, γ are regularization parameters.
4.2 construction of term standardization Module
Reference [4], said term normalization module is mainly based on a two-stage term-standard model, first recalling candidate terms from standard terms, then the candidate terms are calculated in a refined way. The embodiment is based on the model framework and combines a Chinese medical term library to expand and recall terms in magnitude. The construction process of the term standardized module is as follows:
s4.2.1, collecting Chinese and English term corpora and an open term library, and constructing a medical term library term _ db after arrangement, wherein fields of the medical term library comprise unified codes CUI, english standard words, english synonyms, chinese standard words, chinese synonyms and the like;
s4.2.2, establishing indexes for Chinese and English based on an index tool (such as ES) or by adopting a self-defined index, translating the Chinese terms into English when inquiring the Chinese terms, and taking the English and the Chinese as input together;
4.2.3 building a search engine for keywords by integrating recall scores s through multiple recalls reca ll Suppose s 1 And s 2 Two terms are used:
s recall =α 1 ×s bm252 ×s Jaccard3 ×s MED4 ×s DICE .......(16)
wherein alpha is 1234 Respectively represent the weight of each road score, and alpha 1234 =1;
BM25 score s bm25 The calculation is as follows:
Figure BDA0003806957320000231
Figure BDA0003806957320000232
wherein, ω is i Denotes the query term s 1 The ith word segmentation; f. of i Is the word omega i In the term s 2 Frequency of occurrence of, k 1 B is an adjustment factor, len (-) is a function for calculating the length of the sentence, and avgsl is the average length of all the documents in the index; n denotes the number of all documents in the index, N (ω) i ) To comprise omega i The number of documents in the document.
Jaccard coefficient s Jaccard The calculation is as follows:
Figure BDA0003806957320000233
wherein A and B each represent s 1 And s 2 Represents the number of collection elements.
Edit Distance (MED) similarity score s MED The calculation is as follows:
Figure BDA0003806957320000234
where len (·) is a function for calculating sentence length, d(s) 1 ,s 2 ) Denotes s 1 And s 2 The edit distance of (c).
DICE distanceSimilarity score s DICE The calculation is as follows:
Figure BDA0003806957320000235
wherein A and B each represent s 1 And s 2 Represents the number of collection elements.
S4.2.4, training a refined model:
and S4.2.4.1, constructing a positive sample. Dividing Chinese and English of all words in the same concept CUI code in term library term _ db into two groups of terms, the first group is Chinese term set, and the second group is English term set; combining every two term sets of each group to form a term training pair to form a positive sample set +
And S4.2.4.2, constructing a negative sample. Traversing each group of set elements Q in the concept CUI code, performing similarity calculation on the first-choice words in a medical term library term _ db through a formula (16), then taking the first-choice words of Top100 and Q to form a term pair set, and finally removing the positive sample set + Element obtaining negative sample set -
And S4.2.4.3, constructing a training sample. Respectively randomly scrambling set + 、set - The ratio of 1: ratio of 10 from set - Taking negative samples and merging to set + Obtaining a training sample set, wherein except for the term pair, a mark of {0,1} is added in the training sample set, 0 represents a negative sample, and 1 represents a positive sample;
and S4.2.4.4, scoring by adopting a BERT model. The terms in set select y select {0,1} as the sequence classification task for the input sequence constituting "[ cls ] s1[ seq ] s2", forming an example, the loss function is a cross entropy loss function;
s4.2.4.5, dividing the sample samples into a training set and a testing set, and training; the model evaluation adopts an F1 value, a model with the highest F1 value in the test set evaluation is selected for storage, and a middle-English-ranking double-model std _ model is formed zh And std _ model en
S4.2.5, two-stage term standard prediction:
s4.2.5.1 input requires standardized Chinese artLanguage Q, translation to Q EN
S4.2.5.2 based on formula (16), retrieving Q from first Chinese word and synonym of Chinese in term _ db of medical term library, taking Top30, constructing term pair, and inputting std _ model of second stage zh In the model, score is obtained, and candidate set C of Top5 is taken zh-top5 (ii) a In the same way, Q EN Retrieving from the first English word and the synonymous English word in term _ db of the medical term library, taking Top30, constructing a term pair, and inputting std _ model of the second stage en In the model, score is obtained, and candidate set C of Top5 is taken en-top5
S4.2.5.3, and integrating the final result. Setting Chinese and English scoring weight weighting lambda zhen
Are respectively to C zh-top5 And C en-top5 Calculating the scores, then averaging the scores of the CUI with the same concept to form a final standardized set C, and taking Top1 from C as the best standardized result.
5. Construction of drug knowledge maps
The drug specification can obtain a basic map after being analyzed by a natural language processing model, and the basic map mainly comprises defined entity labels, entities, relationship labels and relationships. But this profile is not the final target profile. The conversion from the basic map to the final target map also requires a process of data processing. The present embodiment uses RDFS/OWL/SWRL techniques for the conversion. Considering that the knowledge graph constructed based on the RDFS/OWL technology has a plurality of data graph reasoning languages, the RDFS/OWL technology is used for describing a graph schema, and the SWRL language is used for reasoning a basic graph to finally form a target graph.
6. Continuously updating module for constructed data
In this embodiment, a micro service architecture is used to encapsulate deep learning natural language processing application services, and an MLOPS process is constructed based on a Docker + Kubernates + gillab technology. The technology is used to automatically deploy services and continuously process data. In the face of a new medical institution or a pharmacy, only the medicine specification data needs to be uploaded, and the data continuous updating module can automatically process the data by using a natural language processing model, construct a medicine knowledge graph and deploy medicine application.
Reference:
[1]Wei,Zhepei,et al."A novel cascade binary tagging framework for relational triple extraction."arXiv preprint arXiv:1909.03227(2019).
[2]Devlin,Jacob,et al."Bert:Pre-training of deep bidirectional transformers for language understanding."arXiv preprint arXiv:1810.04805(2018).
[3]Mikolov,Tomas,et al."Efficient estimation of word representations in vector space."arXiv preprint arXiv:1301.3781(2013).
[4] sunyueh et al, "BERT-based clinical terminology standardization," chinese information bulletin 35.4 (2021): 8.
various corresponding changes and modifications can be made by those skilled in the art based on the above technical solutions and concepts, and all such changes and modifications should be included in the protection scope of the present invention.

Claims (10)

1. A rational medication system based on natural language processing and a medicine knowledge graph is characterized by comprising an automatic prescription auditing module, a medication recommending module, a prompt information backtracking module, a medicine information inquiring module and a data updating and maintaining module;
the automatic prescription auditing module: the system is used for automatically auditing the rationality of a prescription and giving an auditing result according to a medicine knowledge graph after a doctor makes the prescription in a diagnosis and treatment scene and according to input basic information, diagnosis and treatment information of a patient and information of specific medicines in the prescription, wherein the rationality auditing content comprises whether the medicines in the prescription are suitable with symptoms and disease diagnosis results in the diagnosis and treatment information or not, whether interaction exists between the medicines in the prescription and medicines being taken by the patient or not, whether the crowd type of the patient belongs to taboo crowds of the medicines in the prescription, whether the patient has an allergy history of taking the medicines in the prescription, whether repeated medicine taking exists in the prescription or not, and whether the usage amount of the medicines in the prescription is consistent with the usage amount of the corresponding medicines in the medicine knowledge graph or not; the basic information of the patient comprises age, sex, population type, allergic history and recent medication condition; the diagnosis and treatment information comprises symptoms and disease diagnosis results; the information of the specific medicines in the prescription comprises the universal name, manufacturer, specification, standard size and usage amount of each medicine;
a medicine recommending module: the system is used for generating a recommended medication list by utilizing a medicine knowledge graph according to input basic information and disease and symptom information of a patient in a diagnosis and treatment scene or a consultation medication scene;
the information backtracking module: a query interface for providing sources of prescription rationality review results and recommended medication lists, the sources including drug description text and interaction databases; for the original text of the specification, the results of checking the reasonability of the prescription and recommending a medication list come from indications, interaction, contraindications and usage and dosage of the medicine specification; the interaction database definitely indicates the interaction among the components, and the recommended medication module or the automatic prescription auditing module searches the interaction database for the interaction through the components of the medicines in the medicine knowledge map so as to give the interaction, so that the interaction result is the interaction detail information inquired in the database when tracing the source of the interaction result;
the drug information query module: the system is used for providing an inquiry interface and an interface for inquiring medicine information, wherein the medicine information comprises a specification original text, a medicine knowledge map, adverse reactions, indications, contraindications and a dosage;
a data update maintenance module: and the data updating and maintaining module is used for processing the text data of the uploaded medicine specification by using a natural language processing model and updating the medicine knowledge graph according to the processed text data.
2. The rational medication system according to claim 1, wherein the medication recommending module screens out applicable drugs by using a drug knowledge graph according to inputted disease and symptom information of the patient, and then filters out the screened drugs according to the crowd type, allergy history and recent medication condition of the patient, so as to filter out drugs which are not suitable for the crowd type corresponding to the patient to take, can cause allergy of the patient and have repeated or interactive effects with the drugs being taken by the patient; and sorting the rest of the filtered medicines according to a sorting rule set by a user to generate a recommended medication list.
3. The rational medication system of claim 1, wherein when the original text of the specification, the knowledge map of the drug, and the usage amount are queried, specific information is returned according to the universal name, manufacturer, specification, and quasi-character number of the drug; the query of adverse reactions, indications and taboos supports forward query and reverse query, wherein the forward query is to return information by the common name, manufacturer, specification and standard letter number of the medicine, and the reverse query is to return a specific medicine list by a specific adverse reaction, indication or taboo.
4. The rational drug administration system of claim 1, wherein the data update maintenance module supports uploading of drug specifications in a plurality of data formats, including PDF, IMG, text; for the text data, the data updating and maintaining module directly utilizes the natural language processing model to process the uploaded specification text data and updates the medicine knowledge graph according to the uploaded specification text data; for PDF and IMG type data, the data updating maintenance module extracts contents and converts the contents into texts by using an image processing technology, and then processes the extracted text data by using a natural language processing model.
5. The rational medicine system of claim 1 or 4, wherein the data update maintenance module provides data quality control function, and the user can compare the automatic labeling and mapping result with the original text of the specification according to the text to ensure the data quality.
6. The rational medication system according to claim 1, wherein the data update maintenance module provides a drug catalog docking function through which a user can upload drug data including a drug universal name, a manufacturer, a specification, and a quasi-character number field, and the data update maintenance module matches the drug data uploaded by the user to an existing drug catalog through an automatic alignment algorithm of a natural language processing model; for the medicines which do not exist in the original medicine catalog, the data updating and maintaining module automatically structures the medicines through the uploaded medicine specification to form a medicine knowledge graph; and finally, completing the butt joint work of the medicine data and putting the medicine data into use.
7. A method for constructing the system of any one of claims 1 to 6, characterized in that the specific process is as follows:
1. designing a knowledge graph of the medicine:
designing a medicine knowledge graph structure containing corresponding fields based on consideration of business requirements of a rational medicine system, wherein the medicine knowledge graph structure comprises components, indications, adverse reactions, contraindications, interaction and usage amount;
2. designing a label system:
defining a label system according to the design of a medicine knowledge graph;
3. data labeling:
after the label system is designed, marking sample text data of the medicine specification by using a marking tool; the data annotation work is performed according to field division tasks designed by the medicine knowledge graph structure; each different field comprises three labeling tasks of named entity labeling, entity relationship labeling and labeling term alignment; the named entity labeling is to perform range division and entity type selection on specific words according to entity labels through a labeling tool, and comprises continuous entity labeling and discontinuous entity labeling; the entity relation marking is to specify the type of the directed relation between the marked named entities; the entity alignment marking is to determine which standardized term the entity is aligned to according to the named entity and the entity type label;
4. constructing a natural language processing model:
the natural language processing model automatically analyzes text data obtained from a medicine specification uploaded by a user, extracts entity and entity relation information in the text data, and further aligns the text data to standard terms to construct a medicine knowledge graph; the construction process of the natural language processing model comprises the following steps:
4.1, construct the information extraction Module
The model of the information extraction module comprises the tasks of drug text classification, chapter structure analysis, BERT coding task, entity extraction and relationship combined extraction;
the medicine text classification task is used for classifying the text data of the input medicine specification according to the Chinese patent medicines and the chemical medicines;
the BERT coding task is used for coding by adopting massive unsupervised corpora or self-adaptive pretrained BERT in the medical field;
the chapter structure analysis task is used for carrying out a task of dividing the semantic meaning of the chapter medical block on the input medicine specification text; the method comprises the following steps that a medicine specification text relates to the roles of multiple fields such as indications, taboos, usage amount and the like, and a chapter structure analysis task is used for dividing the fields of different text segments and identifying the medical semantic role to which a certain text segment belongs;
the medical entity recognition task is used for extracting the medicine related entities mentioned in the input medicine specification text;
the medical relation extraction task is used for identifying and judging a specific relation existing between entity pairs in the input medicine specification text;
the structure of the model integrating the tasks comprises a BERT encoder module, a head entity marking module, a tail entity marking module of the relationship, a chapter extraction module, a specification type classification module and a loss function calculation module; the whole process is realized through a shared BERT coding layer and a multi-task joint learning reverse optimization model; the data processing process of the model is as follows:
suppose that there is a text sequence of X = (X) 1 ,x 2 ,x 3 ,...,x n ),x t A character or word representing the t-th position, n representing the length of the text sequence;
s4.1.1, adding a set start symbol [ CLS ] at the beginning of the text sequence X by a BERT encoder module, and then carrying out BERT encoding:
H=BERT([CLS]+X)...............(1);
wherein H represents the hidden state of the text sequence X after being coded by a function BERT (-), H belongs to R n×d N represents the number of characters or words of the text sequence X, and d represents the vector dimension after encoding;
s4.1.2, the head entity marking module calculates the boundary probability of the head entity mark as follows:
Figure FDA0003806957310000061
Figure FDA0003806957310000062
wherein, the first and the second end of the pipe are connected with each other,
Figure FDA0003806957310000063
the probability of the beginning of the head entity is represented for the ith character or word,
Figure FDA0003806957310000064
for the i-th character or word to indicate the probability of the head entity ending, W s ∈R d×1 ,W e ∈R d×1 ,b s ∈R,b e E is R to represent the parameter to be learned, R represents a real number set, and sigma (-) represents an activation function;
the likelihood function of the head entity can thus be calculated:
Figure FDA0003806957310000065
where s represents the head entity, I (-) represents the indicator function,
Figure FDA0003806957310000066
indicating the starting position of the ith character or word orThe mark of the end position takes the value of {0,1};
s4.1.3, the calculation relationship of the tail entity marking module and the tail entity boundary is as follows:
Figure FDA0003806957310000067
Figure FDA0003806957310000068
wherein, the first and the second end of the pipe are connected with each other,
Figure FDA0003806957310000069
representing the probability that the ith character or word represents the beginning of the tail entity,
Figure FDA00038069573100000610
indicating the probability that the ith character or word indicates the end of the final entity, v k ∈R d Denotes the kth head entity vector, d denotes the dimension of the code, h i E, H represents a hidden vector of the character or the word; if the entity is composed of a plurality of characters or words, a round of average value calculation is carried out;
Figure FDA00038069573100000611
respectively representing parameters to be learned by the model, m representing a relation type number, R representing a real number set, and sigma (·) representing an activation function;
thus, the likelihood function of the relation and the entity can be calculated:
Figure FDA00038069573100000612
where o represents the tail entity, I (-) represents the indicator function,
Figure FDA00038069573100000613
representing the ith character or wordThe starting position or the ending position of (2) is marked, and the value of the mark is {0,1};
s4.1.3, assuming that the output tag sequence is y = (y) 1 ,y 2 ,y 3 ,...,y n ) The overall score of the chapter analysis sequence calculated by the chapter extraction module is as follows:
Figure FDA0003806957310000071
wherein A ∈ R n×n To transfer the matrix, W crf ∈R d×n ,b crf ∈R n Represents a parameter to be learned;
calculating the probability corresponding to the text sequence to the target sequence as follows:
Figure FDA0003806957310000072
wherein, Y x Representing a set of possible target sequences;
in the prediction phase, the optimal sequence is solved by using a Viterbi algorithm:
Figure FDA0003806957310000073
s4.1.4, calculating text category probability by a specification type classification module: (ii) a
p c =W c ×h cls +b c ............(11);
Wherein, W c ∈R d ,b c e.R represents the parameter to learn, h cls Denotes [ CLS]The hidden vector of (2);
s4.1.5, the loss function calculation module calculates the loss function as follows:
L=-(l s+o +l crf +l c )......................(12);
wherein, the first and the second end of the pipe are connected with each other,
Figure FDA0003806957310000074
Figure FDA0003806957310000075
Figure FDA0003806957310000076
wherein M represents the total number of samples, n represents the text length, and lambda and gamma are regularization parameters;
4.2 construction of term standardization Module
The term standardization module is mainly based on a two-stage term standard model, recalls candidate terms from standard terms firstly, and then calculates candidate terms in a refined mode; the construction process of the term standardized module is as follows:
s4.2.1, collecting Chinese and English term corpora and an open term library, and constructing a medical term library after arrangement, wherein fields of the medical term library comprise unified codes CUI, english standard words, english synonyms, chinese standard words and Chinese synonyms;
s4.2.2, establishing indexes for Chinese and English based on an index tool or by adopting a self-defined index, translating the Chinese terms into English when inquiring the Chinese terms, and taking the English and the Chinese as input together;
4.2.3 building a search engine for keywords by integrating and recalling scores s through multi-path recalling recall Suppose s 1 And s 2 Two terms are used:
s recall =α 1 ×s bm252 ×s Jaccard3 ×s MED4 ×s DICE .......(16)
wherein alpha is 1234 Respectively represent the weight of each road score, and alpha 1234 =1;
Wherein BM25 scores s bm25 The calculation is as follows:
Figure FDA0003806957310000081
Figure FDA0003806957310000082
wherein, ω is i Denotes the query term s 1 The ith word segmentation; f. of i Is the word omega i In the term s 2 Frequency of occurrence of, k 1 B is an adjustment factor, len (-) is a function for calculating the length of the sentence, and avgsl is the average length of all the documents in the index; n denotes the number of all documents in the index, N (ω) i ) To comprise omega i The number of documents;
jaccard coefficient s Jaccard The calculation is as follows:
Figure FDA0003806957310000091
wherein A and B each represent s 1 And s 2 The word segmentation set, | · | represents the number of elements in the set;
edit Distance (MED) similarity score s MED The calculation is as follows:
Figure FDA0003806957310000092
where len (·) is a function for calculating sentence length, d(s) 1 ,s 2 ) Denotes s 1 And s 2 The edit distance of (d);
DICE distance similarity score s DICE The calculation is as follows:
Figure FDA0003806957310000093
wherein A and B each represent s 1 And s 2 The word segmentation set, | · | represents the number of elements in the set;
s4.2.4, training a refined training model:
s4.2.4.1, constructing a positive sample: dividing Chinese and English of all words in the same concept CUI code in term library term _ db into two groups of terms, the first group is Chinese term set, and the second group is English term set; and combining every two term sets of each group to form a term training pair to form a positive sample set +
S4.2.4.2, constructing a negative sample: traversing each group of set elements Q in the concept CUI code, performing similarity calculation on the first-choice words in a medical term library term _ db through a formula (16), then taking the first-choice words of Top100 and Q to form a term pair set, and finally removing the positive sample set + Element obtaining negative sample set -
S4.2.4.3, constructing a training sample: respectively randomly scrambling set + 、set - The ratio of 1: ratio of 10 from set - Taking negative samples and merging to set + Obtaining a training sample set, wherein in the set, besides the term pair, a {0,1} mark is added, 0 represents a negative sample, and 1 represents a positive sample;
s4.2.4.4, scoring by adopting a BERT model: the terms in set are used for constituting an input sequence of "[ cls ] s1[ seq ] s2", y selects {0,1} as a sequence classification task to form an example, and a loss function is a cross entropy loss function;
s4.2.4.5, dividing the sample samples into a training set and a test set, and training; the model evaluation adopts an F1 value, a model with the highest F1 value in the test set evaluation is selected for storage, and a middle-English-ranking double-model std _ model is formed zh And std _ model en
S4.2.5, two-stage term standard prediction:
s4.2.5.1 input needs standardized Chinese term Q, translate into Q EN
S4.2.5.2 based on formula (16), retrieving Q from first Chinese word and synonym of Chinese in term _ db of medical term library, taking Top30, constructing term pair, and inputting std _ model of second stage zh In the model, the model is divided into a plurality of models,obtaining score, taking candidate set C of Top5 zh-top5 (ii) a In the same way, Q EN Retrieving and recalling the first choice word and the synonymous word of English from term _ db of the medical term library, taking Top30, constructing a term pair, and inputting std _ model of the second stage en In the model, score is obtained, and candidate set C of Top5 is taken en-top5
S4.2.5.3, integrating the final result; setting Chinese and English scoring weight weighting lambda zhen
Are respectively to C zh-top5 And C en-top5 Calculating scores, averaging the scores of CUIs with the same concept to form a final standardized set C, and taking Top1 from C as an optimal standardized result;
5. construction of drug knowledge maps
The medicine specification can obtain a basic map after being analyzed by a natural language processing model, and the basic map mainly comprises defined entity labels, entities, relationship labels and relationships; converting the basic map into the final target map by a data processing process, describing a map schema by using an RDFS/OWL technology, and reasoning the basic map by using an SWRL language to finally form the target map;
6. continuously updating module for constructed data
Packaging deep learning natural language processing application service by using a micro-service architecture, and constructing an MLOPS process based on a Docker + Kubernates + Gitlab technology; automatically deploying services and continuously processing data by using the technology; in the face of a new medical institution or pharmacy, only the medicine specification data needs to be uploaded, and the data continuous updating module can automatically utilize the natural language processing model to process the data, construct a medicine knowledge graph and deploy medicine application.
8. The method of claim 7, wherein the drug knowledge-graph structure comprises blank nodes to extend different scenarios in the drug knowledge-graph.
9. The method of claim 7, wherein in the knowledge graph of the drug, the component field is used for recording information including main components and auxiliary materials of the drug; the indication field is used for recording diseases and symptoms applicable to the medicine; the adverse reaction field is used for recording information including the name, type and occurrence frequency grade of the adverse reaction of the medicine; the contraindication field is used for recording the allergic contraindication of the medicine, the corresponding contraindications of symptoms and diseases and the contraindication information of specific crowds; the interaction field is used for recording specific interaction information between the medicine components and between the medicine categories; the usage amount field is used to record information on the purpose of administration, administration route, administration time, population, administration frequency, number of administrations, dose type, dose value per dose and dose unit of the drug.
10. The method of claim 7, wherein the tag hierarchy design is an iterative design process that requires dynamic modification of the tag hierarchy when the natural language processing model performance does not meet requirements.
CN202210999490.5A 2022-08-19 2022-08-19 Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph Pending CN115293161A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210999490.5A CN115293161A (en) 2022-08-19 2022-08-19 Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210999490.5A CN115293161A (en) 2022-08-19 2022-08-19 Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph

Publications (1)

Publication Number Publication Date
CN115293161A true CN115293161A (en) 2022-11-04

Family

ID=83830731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210999490.5A Pending CN115293161A (en) 2022-08-19 2022-08-19 Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph

Country Status (1)

Country Link
CN (1) CN115293161A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115934967A (en) * 2023-01-05 2023-04-07 瓴创(北京)科技有限公司 Commodity recommendation method and system based on combination of twin transform model and knowledge graph
CN116631573A (en) * 2023-07-25 2023-08-22 讯飞医疗科技股份有限公司 Prescription drug auditing method, device, equipment and storage medium
CN116955579A (en) * 2023-09-21 2023-10-27 武汉轻度科技有限公司 Chat reply generation method and device based on keyword knowledge retrieval
CN117334292A (en) * 2023-10-10 2024-01-02 山东百康云网络科技有限公司 Medicine sales management system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115934967A (en) * 2023-01-05 2023-04-07 瓴创(北京)科技有限公司 Commodity recommendation method and system based on combination of twin transform model and knowledge graph
CN115934967B (en) * 2023-01-05 2024-02-27 瓴创(北京)科技有限公司 Commodity recommendation method and system based on combination of twin transducer model and knowledge graph
CN116631573A (en) * 2023-07-25 2023-08-22 讯飞医疗科技股份有限公司 Prescription drug auditing method, device, equipment and storage medium
CN116955579A (en) * 2023-09-21 2023-10-27 武汉轻度科技有限公司 Chat reply generation method and device based on keyword knowledge retrieval
CN116955579B (en) * 2023-09-21 2023-12-29 武汉轻度科技有限公司 Chat reply generation method and device based on keyword knowledge retrieval
CN117334292A (en) * 2023-10-10 2024-01-02 山东百康云网络科技有限公司 Medicine sales management system
CN117334292B (en) * 2023-10-10 2024-04-05 山东百康云网络科技有限公司 Medicine sales management system

Similar Documents

Publication Publication Date Title
CN110032648B (en) Medical record structured analysis method based on medical field entity
CN112199511B (en) Cross-language multi-source vertical domain knowledge graph construction method
CN110210037B (en) Syndrome-oriented medical field category detection method
CN112542223A (en) Semi-supervised learning method for constructing medical knowledge graph from Chinese electronic medical record
CN115293161A (en) Reasonable medicine taking system and method based on natural language processing and medicine knowledge graph
CN112786194A (en) Medical image diagnosis guide inspection system, method and equipment based on artificial intelligence
CN112002411A (en) Cardiovascular and cerebrovascular disease knowledge map question-answering method based on electronic medical record
CN113806563B (en) Architect knowledge graph construction method for multi-source heterogeneous building humanistic historical material
CN111078875B (en) Method for extracting question-answer pairs from semi-structured document based on machine learning
CN107403068A (en) Merge the intelligence auxiliary way of inquisition and system of clinical thinking
CN110990590A (en) Dynamic financial knowledge map construction method based on reinforcement learning and transfer learning
CN106919793A (en) A kind of data standardization processing method and device of medical big data
CN110277167A (en) The Chronic Non-Communicable Diseases Risk Forecast System of knowledge based map
CN114064931A (en) Multi-modal knowledge graph-based emergency knowledge question-answering method and system
CN113688248B (en) Medical event identification method and system under condition of small sample weak labeling
CN113764112A (en) Online medical question and answer method
CN111858940A (en) Multi-head attention-based legal case similarity calculation method and system
CN113569023A (en) Chinese medicine question-answering system and method based on knowledge graph
CN112420191A (en) Traditional Chinese medicine auxiliary decision making system and method
CN113742493A (en) Method and device for constructing pathological knowledge map
CN114077673A (en) Knowledge graph construction method based on BTBC model
CN115019906A (en) Multi-task sequence labeled drug entity and interaction combined extraction method
CN113611401A (en) Perioperative blood management system and method
CN115982379A (en) User portrait construction method and system based on knowledge graph
CN114840685A (en) Emergency plan knowledge graph construction method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination