A simulation algorithm for adverse drug reaction data based on clinical electronic medical records
The drug adverse reaction data simulation algorithm addresses the challenge of simulating real-world data in clinical databases by injecting association rules and adjusting correlations, ensuring accurate and reliable evaluation of data mining algorithms.
Patent Information
- Application Number
- CN202110799091.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-15
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-07-15
AI Technical Summary
Existing methods for evaluating drug-adverse reaction associations in clinical databases are limited by the inability to accurately simulate real-world data, leading to deviations in algorithm evaluation due to uncontrolled background noise and complex causal relationships, making it difficult to assess the quality and performance of data mining algorithms.
A drug adverse reaction data simulation algorithm that extracts and cleans clinical electronic medical records, injects association rules, and uses Monte Carlo and logistic regression methods to simulate data, retaining background noise and individualizing database evaluations by adjusting drug and adverse event correlations.
The algorithm provides controlled correlation relationships and enables personalized database evaluations, improving the assessment of data mining methods by maintaining signal noise and reducing background noise impact, thus enhancing the reliability of algorithm performance.
Smart Images

Figure CN113539502B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of drug vigilance and data processing, and in particular to a drug adverse reaction data simulation algorithm based on clinical electronic medical records. Background Art
[0002] With the continuous improvement of medical informationization, patients' medical information such as medication, tests, and course of disease are all recorded in the information system, forming a huge information database. The use of big data methods can mine useful drug-adverse event association information. Compared with traditional methods, the use of clinical electronic information systems has the advantages of complete data, fast update, no deviation, and calculable incidence, which has attracted more and more scholars to engage in related research, and corresponding big data mining algorithms are constantly emerging.
[0003] However, there is no good method to judge the quality of data mining methods for drug-adverse reaction associations, which directly limits the rapid development of data mining methods. The main reason is that the strength of drug-adverse reaction associations in the database is not clear, the causal relationships between them are complicated, and the mined associations are difficult to distinguish between true and false. It is impossible to calculate the sensitivity and specificity of various algorithms, and it is impossible to judge the quality of various data methods.
[0004] A more feasible method is to simulate a data set similar to the real data and with a known drug-adverse reaction correlation to test the algorithm. The traditional method requires manual setting of a series of parameters such as medication, adverse reactions, and basic patient data, and then simulates the data based on the relevant parameters. The Enhanced Observational Medical Dataset Simulator (OSIM2) developed with the support of the US FDA extracts its relevant parameters from a real database to ensure that basic data such as age, gender, medication usage rate, and disease incidence are consistent with the real database.
[0005] Nevertheless, given the extreme complexity of real-world data, these data simulation schemes are still difficult to keep completely consistent with the real world, resulting in deviations in algorithm evaluation. If data mining of drug-adverse event associations is likened to hunting by hunters, the previous method is to first analyze the forest where the hunter hunts, then use the resulting parameters to simulate the construction of the forest and prey, and use the hunter's hunting ability in the simulated scenario to infer its hunting ability in the real forest. Because the complexity of the real world leads to a gap between the simulated scenario and reality, and this gap may lead to deviations in our evaluation of the hunter's hunting ability. Summary of the invention
[0006] The purpose of the present invention is to provide a drug adverse reaction data simulation algorithm based on clinical electronic medical records. It starts with establishing simulation data and adopts the method of injecting a set drug-adverse reaction relationship into the original database, avoiding the defect of traditional methods that cannot completely simulate background noise. At the same time, different databases have different parameters and background noise, which leads to the difference in mining ability of the same algorithm in different databases. The method of this study can find such differences and conduct personalized algorithm evaluation of the database.
[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0008] The present invention provides a drug adverse reaction data simulation algorithm based on clinical electronic medical records, characterized in that it comprises the following steps:
[0009] S1. Data extraction and cleaning: Extract authorized electronic medical record information from cooperating hospitals, including medication, test results, and patient age, gender, and disease type; clean up abnormal data, and encode drugs and adverse events to form the original data set;
[0010] S2, association relationship injection: inject one association rule into the backup data set each time, and the formed data set is used for data mining;
[0011] S3, data mining: using different algorithms to mine the data set injected with certain association rules and generate mining results;
[0012] S4, algorithm evaluation and data presentation: compare the mining results of multiple minings with the data in the set association relationship set, evaluate the algorithm performance, and use charts to present the data.
[0013] Further, the step S2 is divided into four steps. The first step is to establish a drug-adverse event association table, which includes the incidence of drugs, the incidence of adverse events, the time pattern of drug use, the type of adverse events, and the relative risk between adverse events and drugs; the second step is to randomly extract a corresponding proportion of cases from the database according to the drug use rate established in the first step; the third step is to add a virtual drug Drug-V to the cases extracted in the second step according to the relative risk established in the first step, and adjust the incidence of adverse events so that the relative risk of drug-V and adverse events is RR; the fourth step is to adjust the proportion of drugs closely related to adverse events, and balance the impact of the addition and deletion of adverse events in the third step on the corresponding drugs and the relative risk of adverse reactions;
[0014] Furthermore, the association table established in the first step of step S2 includes the incidence of drugs, the incidence of adverse reactions, the event pattern of drug use, the type of adverse reactions, and the relative risk between adverse reactions and drugs;
[0015] Furthermore, the association rules in step S2 include three categories: first-order drug-adverse event association, second-order drug-adverse event association, and event-drug-event sequence association;
[0016] Furthermore, the fourth part of the step S2 is composed of two steps, the first step is to calculate which drugs have a high correlation with the AE; the second step is to adjust the incidence of drugs;
[0017] Furthermore, the data mining in step S3 adopts the proportional imbalance method, which is to summarize the data into four numbers in a four-table and calculate them using a corresponding algorithm;
[0018] Furthermore, the algorithm evaluation and data presentation of step S4 use the python Matplotlib module to present the data.
[0019] The beneficial effects of the present invention are that, compared with the existing methods, the background noise is real, the correlation relationship is controllable, and the individualized evaluation of the database-mining method can be realized, laying a good foundation for further improving the existing algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 This is a flow chart of a simulation algorithm for adverse drug reaction data based on clinical electronic medical records of the present invention;
[0022] Figure 2 It is the curve graph of the sigmoid function;
[0023] Figure 3 This is a curve chart simulating the peak value occurring 1 day after drug use or withdrawal;
[0024] Figure 4 This is a curve chart simulating the peak value occurring 2-7 days after drug use or withdrawal;
[0025] Figure 5 It is a curve chart simulating the peak value occurring 7 days after drug use or withdrawal;
[0026] Figure 6 It is the principle block diagram of the directed acyclic graph;
[0027] Figure 7The schematic diagram represents the association model in which both event A and drug B can increase the probability of event C.
[0028] Figure 8 To represent the primary bias, after the patient develops symptom A, the doctor prescribes a drug before getting the test result event C. Schematic diagram of this association pattern;
[0029] Fig. 9 It is the change diagram of algorithm sensitivity under different RR;
[0030] Fig.10 This is a trend chart of algorithm sensitivity changes at different medication time points;
[0031] Fig.11 This is a trend chart of algorithm sensitivity changes under different medication durations;
[0032] Fig.12 Trend chart of algorithm sensitivity changes under different adverse reaction models;
[0033] Fig.13 The graph shows the change in algorithm sensitivity during three re-simulations. DETAILED DESCRIPTION
[0034] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] like Figure 1-Figure 13 As shown, a simulation algorithm for adverse drug reaction data based on clinical electronic medical records is characterized by comprising the following steps:
[0036] S1. Data acquisition and data cleaning:
[0037] The dataset used was extracted from the electronic database of clinical medical records of three cooperating hospitals. When extracting data, the patient's name, hospitalization number and the name of the hospital where the data came from were encrypted (replaced with a random number, RID, Random ID) to protect the patient's privacy. The data were all from the medical records of patients with tumor-related diseases, with a sample size of 35,483 cases. The data obtained included medication information, test information, and basic information such as patient age, gender, and disease type, including 2.2M timestamped drug use information and 4.85M timestamped test result information.
[0038] Abnormal data were cleaned up, and drug names were coded using MEDDRE, and the names of tests with different names in various hospitals were unified;
[0039] S2. Association injection:
[0040] The injection of association relationship is divided into four steps. The first step is to establish the association relationship table between drugs and adverse events, which includes the incidence of drugs, the incidence of adverse events, the time pattern of drug use, the type of adverse events and the relative risk (RR) between adverse events and drugs. The adverse events in this method are represented by test indicators that exceed the normal value range; the second step is to randomly extract a corresponding proportion of cases from the database based on the drug use rate established in the first step; the third step is to add a virtual drug Drug-V to the cases extracted in the second step based on the relative risk (RR) established in the first step, and adjust the incidence of adverse events so that the relative risk of drug-V and adverse events is RR; the fourth step is to adjust the proportion of drugs closely related to adverse events to balance the impact of the addition and deletion of adverse events in the third step on the corresponding drugs and the relative risk of adverse reactions;
[0041] Step 1: Establish a relationship table between drugs and adverse events
[0042] The association table includes the incidence of drugs, the incidence of adverse reactions, the event pattern of drug use, the type of adverse reactions, and the relative risk (RR) between adverse reactions and drugs;
[0043] The variables included in the association table are:
[0044] Drug-V name: Drug-V is a virtual drug used to represent real drugs with incidence rates consistent with the relative risk of AEs;
[0045] Drug-V incidence: refers to the proportion of patients in the database who took the drug at least once;
[0046] AE name: Here refers to the name of the test item. The occurrence of AE means that the measured value of the test item exceeds the normal range;
[0047] AE incidence: refers to the proportion of patients in the overall population who experienced at least one AE;
[0048] RR: refers to the relative risk between Drug-V and AE;
[0049] Medication use pattern: This method takes into account the average duration of use of the three drugs (1 day, 2-7 days, more than 7 days), and the time point of use of the three drugs in the course of illness (first half, middle, second half);
[0050] AE occurs in the following modes:
[0051] This method considers dose-related and dose-independent patterns and withdrawal reactions. The first two patterns are divided into 1 day, 2-7 days, and more than 7 days according to the time of AE occurrence after medication. Withdrawal reactions are divided into 1 day, 2-7 days, and more than 7 days according to the time of AE occurrence after withdrawal.
[0052] This method uses a modified form of the sigmoid function to represent the cumulative probability distribution (Cumulative Distribution Function, CDF) of AE after medication;
[0053]
[0054] The corresponding graphics are shown in Figure 2 , it can be seen that the right side of the curve converges to 1, so this function can be used as a cumulative probability function to simulate the probability distribution;
[0055] Figure 2 : sigmoid function
[0056] This method transforms the function expression and adds three parameters, v, h, and shape, to stretch the original sigmoid function and move it up and down, left and right. The formula is as follows:
[0057]
[0058] in
[0059] h is used to move the curve horizontally. When h increases, the curve moves to the right. v represents the vertical position. A large value means the curve moves downward. shape represents the speed at which the curve reaches 1. The smaller the shape, the steeper the curve. We simulated the situation where the peak occurs 1 day after drug use or withdrawal (such as an immediate allergic reaction), 2-7 days, and 7 days. The parameters and graphs are as follows: Figure 3-5 ;
[0060] Figure 3 Parameters v = 0, h = 0, shape = 0.1, representing the cumulative probability distribution of AEs occurring on the day after medication, such as immediate allergic reactions; Figure 3 It can be seen that after taking the medicine on the same day, AE occurred in 99.999% of the cases;
[0061] Figure 4 The parameters are v=0.1, h=4, shape=2, representing the cumulative probability distribution of AE with the peak occurring on the 4th day.
[0062] Figure 5 The parameters are v = 0.1, h = 8, and shape = 4, which represents the cumulative probability distribution of AEs with the peak occurring on the 8th day;
[0063] Generate a random number R using the random number function rand(), substitute it into the equation, and calculate the day of occurrence so that the AE occurrence time conforms to the above distribution probability;
[0064]
[0065] s=R×(1-v)+v
[0066] day is an integer, representing the day after medication or withdrawal when the AE occurs; the above equation is derived from the previous equation.
[0067] Causal relationship model between drugs and AEs:
[0068] In order to enable the simulated data to comprehensively consider the advantages and disadvantages of the mining algorithm, it is necessary to include some drug-adverse event association patterns with general significance;
[0069] There are three types of association modes currently considered.
[0070] First-order drug-adverse event association: that is, only the strength of the association between drugs and adverse events is concerned, without considering the effects of drug co-administration and other factors on drug interactions. Here, the relative risk definition is used to define the strength of the association; if R-EA is the probability of adverse event E occurring after using drug A, and R-E0 is the probability of adverse event E not occurring with drug A, then the relative risk is:
[0071] RR=R-EA / R-E0
[0072] The RR value, A drug name, and E name are classified into an association table; the drug name A should not be repeated with the drug name in the database to avoid interference with the RR value.
[0073] Second-order drug-adverse event association: RR-A, RR-B, RR-AB, respectively represent the relative risk of adverse event E when using drug A, drug B, and drug AB together.
[0074] Event-drug-event sequence correlation: This means that event A can increase the probability of using drug B, and the use of drug B can increase the probability of event C. This can be represented by a directed acyclic graph (DAG). Figure 6 ; For example, age can increase the use of drug A, and drug A can increase the occurrence of event E.
[0075] Explore other types of correlations: Because the actual database belongs to real-world data and the causal relationships are complex, we will try more types of correlation patterns; see Figure 7 , Figure 8 .in Figure 7 It means that both event A and drug B can increase the probability of event C; Figure 8It represents primary bias. After the patient develops symptom A, the doctor prescribes a certain drug before obtaining the test result event C.
[0076] S2 Step 2: Extract the case and inject the drug
[0077] Diseases are extracted according to the incidence of drug Drug-V in the relationship table between drugs and adverse events; if the usage rate of Drug-V is 1%, the number of extracted cases is the total number of cases N×0.01.
[0078] For all the cases extracted, the frequency, time point and duration of drug use were arranged according to the Drug-V usage pattern and usage rate in the drug-adverse event association table. When complex causal confounding is added according to the DAG graph, corresponding auxiliary variables are added.
[0079] Step 3 of S2 Inject AE: adjust the proportion of the original AE according to the RR value in the drug-adverse event association table. If RR < 1, reduce AE, and if RR > 1, increase AE. The probability of AE is calculated using the logistic regression method;
[0080] In(P / (1-P))=a+b*x1+c*x2......
[0081] Where P is the probability of a certain event AE occurring, x1, x2... represent whether the factors associated with the occurrence of event E occur (1 occurs, 0 does not occur), a represents the background value of In(P / (1-P) when all x1-xn do not occur, b, c... represent the degree of association between x1, x2, etc. and event E, which can be calculated from the RR value of the association table;
[0082] After obtaining the incidence rate P of event E, the Monte Carlo random method is used to place the event into the randomly selected cases to complete the injection.
[0083] S2 Step 4: Adjust the proportion of medications closely related to adverse events
[0084] Because when RR is not equal to 1 during the injection of AE, the proportion of AE occurrence will be adjusted. Many drugs are related to AE occurrence. If the AE proportion is adjusted but the proportion of these drugs is not adjusted accordingly, there will be a difference with the background noise of the original database, which requires the use probability of these drugs to be adjusted;
[0085] The first step is to calculate which drugs are highly correlated with this AE. This method compares the number of days of use of various drugs in the original library before and after the occurrence of AE, and screens out those drugs whose number of days of use after the occurrence of AE is much longer than that before the occurrence;
[0086] The second step is to adjust the drug incidence rate. When adding an AE, the screened drugs are added after it at the same time, and these drugs are randomly assigned according to the probability of occurrence of these drugs after the occurrence of AE in the original library. If the AE is removed, these drugs are removed.
[0087] S3. Data mining experiment
[0088] We conducted a mining experiment on the database using the proportional imbalance method as an example. The core of the proportional imbalance method is to summarize the data into four numbers in a four-cell table and calculate them using the corresponding algorithm;
[0089] We used four methods to obtain the three numbers in the four-cell table.
[0090] D11 D10 D01 D00
[0091] The first method is the distinct method, which calculates based on the case as the unit and divides the cases into four categories: D11 is the case in which drug-V is used and AE occurs during the drug action period, D10 is the case in which drug-V is used but no AE occurs, D01 is the case in which AE occurs without using drug-V, and D00 is the case in which drug-V is not used and no AE occurs.
[0092] The second method is to simulate the active reporting system: that is, when an AE occurs within the drug action window (the time window of this method is set to within one month from the first use of the drug to the cessation of use), the drug and AE are recorded; D11 is the number of AEs that occurred within the drug-V action time window, D10 is the number of AEs that did not occur within the drug-V action time window, D01 is the number of AEs that occurred within other drug action time windows, and D00 is the number of AEs that did not occur within other drug action time windows.
[0093] The third method is: D11 is the total number of drug-V use dates before the AE occurs, D10 is the total number of drug-V use dates after the AE occurs, D01 is the total number of other drug use dates before the AE occurs, and D00 is the total number of other drug use dates after the AE occurs.
[0094] 3 calculation methods, Chi-square test, PRR, ROR, IC method.
[0095] S4. Step Algorithm Evaluation and Data Presentation:
[0096] The algorithm presentation uses the python Matplotlib module to present the data.
[0097] Reliability assessment of data simulation: the difference between simulated data and original data; the re-simulation method tests the degree of difference.
[0098] The original data was simulated three times according to the relationship table between drugs and adverse events, and the differences between the three times were compared;
[0099] The sampling-marking-replacement-mining-re-sampling-re-marking-re-placement-re-mining method is used to compare the results of the two mining operations. If the two results are similar, the evaluation results obtained by the data simulation method are stable and reliable.
[0100] Comparison of algorithms:
[0101] Sensitivity and specificity of the algorithm.
[0102] Table 1 Sensitivity of different mining algorithms
[0103]
[0104] Table 2 Specificity of different mining algorithms
[0105]
[0106] The trend of algorithm mining ability under different RRs:
[0107] Fig. 9 is the change of algorithm sensitivity under different RR, Fig. 9 It shows that with the increase of RR, the sensitivity of all algorithms shows an upward trend.
[0108] The changing trend of algorithm mining ability at different medication time points: Fig.10 This is the trend of algorithm sensitivity changes at different medication time points. Fig.10 It shows that as the medication time point is postponed, the sensitivity of the algorithm tends to decrease.
[0109] The changing trend of algorithm mining ability under different medication durations: Fig.11 This is the trend of algorithm sensitivity changes under different medication durations. Fig.11 It shows that as the duration of medication increases, the sensitivity of all algorithms increases.
[0110] Change trends of algorithm mining capabilities under different adverse reaction models: Fig.12 The changing trend of algorithm sensitivity under different adverse reaction models, Fig.12 The types of adverse reactions related to dose (length of medication) are shown. As the dose correlation increases, the algorithm sensitivity increases. It is not related to dose, but the longer the time difference between the occurrence of adverse reactions and the start of medication, the lower the sensitivity. The last set of figures (time related mode 3) shows that when the adverse reactions occur later than the discharge time of most cases, the algorithm sensitivity drops significantly.
[0111] Comparison of the results of three re-simulations:
[0112] Adding drug_v and adjusting the RR value of the drug and the target adverse reaction will cause slight changes in the database. We use repeated simulation to reproduce the impact of this change on the sensitivity of the algorithm. The degree of variation in the difference between the first and second results and the difference between the second and third results illustrates the reliability of such a sampling scheme; Fig.13 Changes in algorithm sensitivity across three resimulations.
[0113] This algorithm is different from the previous simple simulation that only sets the correlation between medication and adverse events. This method fully considers the impact of background noise in the real world. It is also different from the FDA simulation method in that this simulation method completely retains the real noise in the database, which may make the simulated data and the results obtained by using such simulated data to evaluate data mining methods closer to the real situation.
[0114] The purpose of this algorithm is to develop a data simulation method based on the existing hospital inpatient information database, which highly retains the signal noise of the original database, so as to facilitate the evaluation of the advantages and disadvantages of the data mining method used for drug-adverse reaction correlation; by retaining the original database information, making the association table between drugs and adverse events, and using Monte Carlo and logist regression methods to simulate the data, it is possible to retain as much background noise as possible in the original database, so that the simulated data is close to the actual situation; at the same time, because of the insertion of simulated data, the simulated database may be different from the real database. For example, if an adverse event is added to the course of a patient's illness, the actual situation may be that some drugs are tried to intervene in this adverse event and the adverse event has been treated. By adjusting the proportion of medication closely related to the adverse event, the disturbance of the database background noise during the data simulation process can be reduced to minimize the impact of the inserted data on the overall database.
[0115] This algorithm injects associations into the original database one by one to form a series of databases that know a group of adverse drug events. After combining a series of results mined using data mining methods, we can see the sensitivity and specificity of the method in mining signals in the original database. From the simulation mining experiment, we found that the incidence of drugs, the incidence of adverse events, the degree of association between adverse drug events, drug use patterns, and the types of adverse reactions will all affect the data mining results.
Claims
1. A simulation algorithm for adverse drug reaction data based on clinical electronic medical records, characterized in that: The following steps are involved: S1. Data extraction and cleaning: Extract authorized electronic medical record information from cooperating hospitals, including medication, test results, and patient age, gender, and disease type; clean up abnormal data, and encode drugs and adverse events to form the original data set; S2, association relationship injection: inject one association rule into the backup data set each time, and the formed association rule data set is used for data mining once; S3, data mining: using different algorithms to mine the data set injected with certain association rules and generate mining results; S4, algorithm evaluation and data presentation: compare the mining results of multiple minings with the data in the set association relationship set, evaluate the algorithm performance, and present the data using charts; The step S2 is divided into four steps. The first step is to establish a drug-adverse event association table, which includes the incidence of drugs, the incidence of adverse events, the time pattern of drug use, the type of adverse events, and the relative risk between adverse events and drugs; the second step is to randomly extract a corresponding proportion of cases from the database according to the drug use rate established in the first step; The third step is to add a virtual drug Drug-V to the cases extracted in the second step according to the relative risk established in the first step, and adjust the incidence of adverse events so that the relative risk of drug-V and adverse events is RR; the fourth step is to adjust the proportion of medications closely related to adverse events to balance the impact of the addition and deletion of adverse events in the third step on the relative risk of corresponding drugs and adverse reactions; The association table established in the first step of step S2 includes the incidence of drugs, the incidence of adverse reactions, the event pattern of drug use, the type of adverse reactions, and the relative risk between adverse reactions and drugs; The association rules in step S2 include three categories: first-order drug-adverse event association, second-order drug-adverse event association, and event-drug-event sequence association; The first-order drug-adverse event association indicates the strength of association between a single drug and an adverse event; the second-order drug-adverse event association indicates the strength of association between the use of different drugs separately and in combination and adverse events; the event-drug-event sequence association indicates that a certain event will increase the probability of use of a certain drug, and at the same time, the use of the drug will increase the probability of another event; The fourth step in the S2 step is divided into two steps. The first step is to calculate which drugs are highly correlated with the AE; the second step is to adjust the drug incidence.
2. The method of claim 1, wherein the method comprises: The data mining in step S3 adopts the proportional imbalance method, which summarizes the data into four numbers in a four-cell table and calculates them using a corresponding algorithm.
3. A simulation algorithm for adverse drug reaction data based on clinical electronic medical records according to any one of claims 1-2, characterized in that: The algorithm evaluation and data presentation in step S4 are performed using the python Matplotlib module to present the data.
