Drug quality detection and analysis method
Through the combination of autoencoder and KDE, combined with statistical analysis of large areas and sub-regions, the problem of rapid identification of abnormal quality of capsule drugs is solved, the detection efficiency and accuracy are improved, and resource waste is reduced.
Patent Information
- Application Number
- CN202510532147.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art cannot quickly identify quality abnormalities in capsule medicines, resulting in inefficient detection and waste of resources. Conventional methods are prone to misjudgment or missed inspections in the face of process fluctuations and environmental differences.
The autoencoder is used for feature learning, combined with KDE and core density estimation to optimize bandwidth selection, and through hierarchical statistical analysis, combined with large-area mean, variance and sub-region density calculation, abnormalities in capsule drugs are identified, and related characteristics such as processing time, raw material batch and transportation path are used to quickly screen suspected abnormal drugs.
It improves the identification ability of abnormal quality capsule drugs, optimizes the accuracy and efficiency of abnormal screening, reduces resource waste, and ensures the timely handling of abnormal drugs.
Smart Images

Figure CN120450520A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of drug detection, and in particular to a method for detecting and analyzing drug quality. Background Art
[0002] Drug testing refers to the quality inspection and analysis of drugs, such as capsule drugs.
[0003] Capsule drug quality inspection mainly relies on sensor measurement, but the following problems still exist during the inspection process:
[0004] Among a large number of capsule drugs to be tested, there are usually some that meet the quality standards and some that do not. Currently, the drugs are usually tested one by one in the sorted order. This testing method cannot quickly pre-test and determine the quality of capsule drugs with quality abnormalities. In other words, due to this testing method, capsule drugs with quality abnormalities are difficult to pre-test. If a large number of capsule drugs are piled together, or if capsule drugs with quality abnormalities are delayed in testing time, the quality abnormalities are not promptly identified, resulting in the inability to carry out subsequent secondary processing steps in a timely manner. This not only affects the efficiency of testing for quality abnormalities, but also increases the resource loss rate of all capsule drugs to be tested.
[0005] Among them, even if there are currently the above-mentioned detection methods for pre-identifying drugs with abnormal quality:
[0006] When capsule drugs are produced in batches or stored in partitions, inherent statistical deviations will occur due to process fluctuations or environmental differences. Existing methods have not established a regional adaptive baseline model, and it is easy to misjudge normal regional deviations as abnormalities or miss regional-specific abnormalities (such as slight deformation of the capsule shell in a certain batch).
[0007] Secondly, current conventional global statistical methods (such as principal component analysis) are also unable to effectively identify local density anomalies. Summary of the Invention
[0008] In response to the above-mentioned shortcomings of the existing technology, the present invention provides a method for detecting and analyzing drug quality, which can effectively solve the problem in the existing technology that it is impossible to quickly identify and detect capsule drugs with quality abnormalities in the drugs to be tested, resulting in excessive loss of drug resources.
[0009] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0010] The present invention provides a method for detecting and analyzing drug quality, which comprises at least the following steps:
[0011] Obtain the drug to be tested and determine the original feature vector, and map the original feature vector to a low-dimensional latent space to obtain the latent variable;
[0012] Reconstruct the latent variables to obtain the reconstructed data and calculate the global reconstruction error, where:
[0013] If the original eigenvector is multimodal data, it is decomposed into submodal data, and the submodal reconstruction errors are calculated separately to obtain the global reconstruction error.
[0014] Based on the distribution characteristics of the drugs to be tested, multi-level statistics of large areas and sub-areas are introduced to divide the large area into several sub-areas, and the local density difference index of the drugs to be tested in the sub-areas is calculated;
[0015] Combined with the kernel density estimation method to describe the probability distribution of latent variables in large regions or sub-regions, KDE is used to construct local probability density functions and define local anomaly indicators;
[0016] The regional deviation is defined by the local density difference index, local anomaly index, and latent variables, thereby obtaining the anomaly score of the drug to be tested to determine the abnormal target detection drug;
[0017] Based on the correlation characteristics of the target detection drugs, other abnormal target detection drugs are re-determined and constituted as pre-detection drugs, and quality inspection is performed on the pre-detection drugs.
[0018] Furthermore, the global reconstruction error is calculated according to the following relationship:
[0019] Decompose the original eigenvector into several sub-modes and calculate the reconstruction error of each sub-mode
[0020] ω k represents the importance weight of the k-th mode, represents the input feature vector of the i-th drug to be tested under the k-th mode, represents the feature vector of the i-th drug to be tested after being reconstructed by the autoencoder under the k-th mode, M represents the total number of sub-modalities, e i represents the global reconstruction error.
[0021] Furthermore, the method for calculating the local density difference index of the drug to be tested in the sub-region is:
[0022] Use clustering algorithm to divide each large area into several sub-areas;
[0023] For the drug i to be tested in a sub-region, assuming that i belongs to the sub-region r in the large region j, the local density is estimated using the k-nearest neighbor method, and the local density difference index is calculated. Gi represents the set of k nearest neighbor samples of the drug i to be tested in the sub-region, K NN represents the number of k nearest neighbors, z qIndicates that it belongs to the set G i A hidden variable of a nearby drug to be tested q.
[0024] Furthermore, the method for determining the local abnormality index is:
[0025] Select the latent variable z of the drug to be tested in the large region j or sub-region i , kernel density estimate f j,r (z i )for:
[0026]
[0027] Among them, K(u) represents the kernel function, h represents the bandwidth parameter of the kernel density estimation, p represents the dimension of the latent variable space, and C j,r represents the set of drugs to be tested in sub-region r;
[0028] Local anomaly index δ′ i =-log(f j,r (z i )).
[0029] Furthermore, the kernel function is defined as:
[0030]
[0031] Where u is z k Represents the latent variable of the kth drug to be tested in the sub-region.
[0032] Furthermore, the bandwidth parameter h is solved by the AMISE criterion to obtain the optimal bandwidth parameter, specifically:
[0033]
[0034] Among them, AMISE(h) represents the objective function of selecting the optimal bandwidth parameter, R(K) represents the second-order moment of the kernel function, and M 2 represents the second moment of the data, R(f″) represents the integral of the second derivative of the density function f(z), and n represents the total number of drugs to be tested for the estimated latent variable distribution;
[0035] Taking the derivative of the AMISE formula and setting it equal to 0, we get:
[0036]
[0037] Furthermore, the anomaly score is determined according to the following relationship:
[0038]
[0039] α, β represent hyperparameters, ε represents a constant, S i represents the anomaly score, d i represents the regional deviation, σ j represents the regional standard deviation.
[0040] Association features include:
[0041] Processing time t of target drug i 、Target detection drug raw material batch c i 、Processing steps of target detection drugsp i and transport path deviation area r i .
[0042] Furthermore, the method further includes determining the corresponding detection time based on the pre-detected drugs, specifically:
[0043] Obtain the quality inspection items and equipment for drugs, and calculate the time required for pre-inspection drug inspection:
[0044] T v Indicates the working time of each testing equipment on the quality inspection item, N a represents the number of pre-tested drugs, E represents the number of drug testing equipment, t v represents the average testing time for each pre-tested drug;
[0045] Detection time T total :
[0046] Q represents the total number of quality inspection items, s q Indicates the cleaning time after the completion of a quality inspection project and before the start of the next inspection project.
[0047] Furthermore, the method further includes obtaining the operation risk value of each detection device at the current time, specifically by:
[0048] Obtain the operating noise, operating temperature, equipment failure rate, number of repairs, and usage time of the detection equipment over a period of time and perform weighted calculation to obtain the operating risk value;
[0049] Obtain the operating risk values of the detection equipment under multiple time periods, obtain the change amplitude values of the operating risk values at adjacent time points in a period, and calculate the average value to obtain the mean change amplitude value;
[0050] According to the detection time T total , the mean of the change amplitude, and the operational risk value at the current time are used to obtain the operational risk value at the predicted detection completion time, where:
[0051] If the risk threshold is reached, the corresponding testing equipment will be marked as a risk testing equipment and prohibited from performing quality inspections on pre-tested drugs.
[0052] Compared with the prior art, the technical solution provided by the present invention has the following beneficial effects:
[0053] The present invention uses autoencoders to perform feature learning, combines KDE and kernel density estimation to optimize bandwidth selection, improves the ability to identify capsule drugs with abnormal quality, and optimizes abnormal screening within the region;
[0054] Furthermore, through hierarchical statistical analysis, combined with large-area mean and variance and sub-area density calculation, the reliability of abnormality judgment is ensured, so that abnormal capsule drugs can be identified and handled in advance.
[0055] Secondly, by using the associated features of the target drug, such as processing time, raw material batch, processing steps, and transportation route deviation, suspected abnormal drugs can be quickly identified to improve screening efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.
[0057] Figure 1 Schematic diagram of the overall method of the present invention. DETAILED DESCRIPTION
[0058] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. 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 making any creative efforts shall fall within the scope of protection of the present invention.
[0059] The present invention will be further described below with reference to the embodiments.
[0060] Example 1 (see Figure 1 ): A method for detecting and analyzing drug quality, comprising the following steps:
[0061] Get the capsule drug to be tested, record it as the drug to be tested, and determine the original feature vector x of the drug to be tested i , the original eigenvector consists of d values, which include:
[0062] Image features: such as color, shape, texture, etc., extracted from high-resolution images of the capsule appearance;
[0063] Spectral data: such as near-infrared or ultraviolet-visible light spectral data, reflecting drug ingredient information;
[0064] Physical and chemical indicators: numerical characteristics such as size, weight, density, pH value, chemical component concentration, etc.
[0065] Each drug to be tested is accompanied by the regional mark to which it belongs: that is, z(i)∈{1,2···,D}, z(i) represents the regional mark (number) to which the i-th drug to be tested belongs, and D represents the total number of regions. Regions can be understood as different sampling batches, production lines or storage areas, etc.
[0066] The original feature vector x i Mapping to the low-dimensional latent space to obtain z i , z i Represents the latent variable of the i-th drug to be tested, which contains important abstract information of the original data;
[0067] From the latent variable z i Reconstruct the original input data to get represents the reconstructed data of the i-th drug to be tested;
[0068] Perform global reconstruction error calculation:
[0069] Global reconstruction error Quantify the error between the i-th drug to be tested and its reconstructed data;
[0070] Among them, when the input original feature vector is multimodal, the original feature vector is decomposed into several sub-modalities (such as image, spectrum, physical and chemical indicators), and the reconstruction error of each sub-modal is calculated separately.
[0071] ω k represents the importance weight of the k-th mode, represents the input feature vector of the i-th drug to be tested under the k-th mode (describing the part of the k-th information extracted from the original input feature vector), represents the feature vector of the i-th drug to be tested after reconstruction by the autoencoder in the k-th mode, M represents the total number of sub-modalities, and the final global reconstruction error reflects the reconstruction performance of the drug to be tested in all modes, which can more comprehensively measure whether the sample deviates from the normal characteristics.
[0072] Since the data of drugs to be tested from different batches, production lines, or storage environments may have different distribution characteristics, relying solely on global reconstruction errors may lead to false detections. To compensate for the uneven distribution of data between different regions, multi-level statistics of large regions and sub-regions are introduced, which gives:
[0073] Conduct large-area statistics:
[0074] Take the regional mean μj of the latent variables of all drugs to be tested in the large area j (corresponding to different sampling batches, production lines or storage areas)
[0075] N j represents the number of drugs to be tested in the large area j;
[0076] By calculating the regional standard deviation σ j , describes the discrete degree of the latent variables of the drugs to be tested in the large region j;
[0077] Use clustering algorithms (such as K-means) to further divide the data in each large area into several sub-areas to capture the local structural differences within the area;
[0078] For the drug i to be tested located in a certain sub-region (assuming i belongs to sub-region r in the large region j), the local density is estimated using the k-nearest neighbor method, and the local density difference index is calculated. G i K represents the set of k nearest neighbor samples of the drug i to be tested in the sub-region, NN represents the number of k-nearest neighbors (representing the number of neighbors selected in the k-nearest neighbor method, that is, the number of neighbors used to calculate the local density for each drug i to be tested), z q Indicates that it belongs to the set G i The local density difference index measures the average distance between the drug i to be tested and its local neighboring drugs to be tested. The larger the value, the more isolated the drug i to be tested is in the local cluster, and there may be anomalies.
[0079] Furthermore, the latent variable z i The distribution may be nonlinear, and the use of mean and standard deviation may not fully capture the local structure. In particular, when there are abnormal samples or asymmetric distributions, the statistical description may be distorted. Therefore, the kernel density estimation (KDE) method is used to describe the probability distribution of latent variables in large regions or sub-regions. The local probability density function is constructed using KDE, and the local anomaly index is defined. The steps are as follows:
[0080] Select the latent variables {z i :i∈C j,r};
[0081] For z i , kernel density estimate f j,r (z i ) is defined as:
[0082]
[0083] Among them, K(u) represents the kernel function, which is defined as: u is z k represents the latent variable of the kth drug to be tested in the sub-region, h represents the bandwidth parameter of the kernel density estimation, which controls the degree of smoothness, p represents the dimension of the latent variable space, and C j,r represents the set of drugs to be tested in sub-region r;
[0084] In this way, the local anomaly index δ′ can be obtained i =-log(f j,r (z i ));
[0085] In the above scheme, the bandwidth parameter h affects the error of kernel density estimation, which is solved by the AMISE criterion:
[0086]
[0087] Among them, AMISE(h) represents the objective function for selecting the optimal bandwidth parameter, R(K) represents the second-order moment of the kernel function, which measures the smoothness of the kernel, and M 2 represents the second moment of the data, which measures the scalability of the data. R(f″) represents the integral of the second derivative of the density function f(z), which measures the smoothness of the data. n represents the total number of drugs to be tested for the estimated latent variable distribution.
[0088] Taking the derivative of the AMISE formula and setting it equal to 0, we get:
[0089] That is, the optimal bandwidth parameter h is obtained by minimizing AMISE * , and substitute it into the kernel function K(u), and calculate the kernel density estimate f by updating the optimal bandwidth parameter j,r (z), kernel density estimation can more accurately reflect the true distribution characteristics of the data, reduce overfitting and underfitting problems, and improve the accuracy of subsequent anomaly detection.
[0090] Considering the deviation of the drug i to be tested in the large area and its sub-area, the regional deviation d is defined i =λ1||z i -μ j || 2 +λ2δ i +λ3δ′i ,λ1,λ2,λ3 are all balance parameters used to control the weight of global and local influences, d i It reflects the global deviation degree of the drug i to be tested in the large region and the local isolation in the sub-region. i When it is large, it means that the drug i to be tested not only deviates from the mean of the large area, but is also relatively isolated in the local cluster and may be an outlier.
[0091] Integrate the reconstruction error and regional deviation into an anomaly score S i , to measure the overall abnormality of the drug i to be tested, we have:
[0092] α and β represent hyperparameters, and ε represents a constant;
[0093] Considering the differences in data distribution in different regions, an adaptive anomaly threshold is set for each large region j so that local anomaly judgment can be performed within the region. In this way, the anomaly score S i If it is greater than the abnormal threshold, it usually means that the drug to be tested exhibits obvious abnormal characteristics relative to other samples in the area, thereby achieving quality detection of the drug to be tested.
[0094] It is worth noting that since the drugs to be tested often have multimodal features (such as images, spectra, physical and chemical indicators, etc.), each of these information has different attributes, dimensions and noise characteristics. Traditional anomaly detection methods are usually difficult to capture subtle differences in all modalities at the same time, which may lead to missed detection or misjudgment of anomalies. The above-mentioned deep autoencoder is used to achieve nonlinear dimensionality reduction and feature fusion, and the reconstruction error is calculated to reflect the overall deviation of each drug to be tested in multimodal data. In addition, since the drugs to be tested may come from different production batches, production lines or storage areas, the statistical characteristics of the data in each region (such as mean and variance) may be significantly different. If a unified anomaly threshold is directly used, it is easy to generate false positives or missed positives in some areas. Therefore, regional local statistics and sub-region division are introduced. By calculating the global deviation and local density index of the drugs to be tested in the region, an adaptive regional threshold is established, so as to more accurately judge the abnormal drugs to be tested in each region.
[0095] It should be noted that by pre-identifying a large number of abnormal drugs to be tested as described above, the abnormal drugs to be tested can be marked as target detection drugs, so that the quality of the target detection drugs can be pre-tested to improve the detection and identification efficiency of abnormal quality drugs.
[0096] Furthermore, by determining the target detection drug, it is determined whether there are multiple target detection drugs. If there are multiple target detection drugs, the correlation features of the multiple target detection drugs are extracted, and the other target detection drugs (other target detection drugs with the same correlation features as the target detection drugs) present in the entire target detection drug list are screened and judged based on the correlation features. The correlation features are as follows:
[0097] Processing time t of target drug i ;
[0098] Raw material batch c of target drug i ;
[0099] Target detection drug processing steps i ;
[0100] Transport path deviation area i (For manufactured drugs, they need to be transported to pre-planned locations such as storage areas after production. Therefore, it is usually necessary to allocate transportation to pre-planned locations based on the processing location of the manufactured drugs. At the same time, a fixed transportation route will be set through the area. Therefore, when the drug is transported through an unplanned area, it is reflected that the drug has abnormal characteristics, that is, there is a transportation route deviation area).
[0101] Furthermore, other target detection drugs with the same characteristics can be determined based on the number of drugs to be detected. In this way, the target detection drugs can be used to quickly identify drugs to be detected that are suspected to have abnormalities, that is, other target detection drugs, thereby improving the subsequent rapid detection and identification efficiency of abnormal drugs.
[0102] Through the above, the target detection drugs and other target detection drugs can be constructed into pre-detection drugs, and their quality can be pre-detected.
[0103] It is worth noting that the advance identification and testing of pre-tested drugs can help to detect and promptly address and improve the drugs before they deteriorate due to quality problems, thereby significantly reducing the unreasonable loss of drug resources.
[0104] Furthermore, obtain the drug quality inspection items, which are usually several (including physical properties inspection, appearance inspection, chemical index inspection, stability inspection), and obtain drug inspection equipment. Based on this, calculate the inspection time of the pre-inspected drug as follows:
[0105] Time calculation for a single quality inspection project:
[0106] T v Indicates the working time of each testing equipment on the quality inspection item, N arepresents the number of pre-tested drugs, E represents the number of drug testing equipment, t v Indicates the average testing time for each pre-tested drug to complete each quality test item v on a single drug testing device;
[0107] The total inspection time T is obtained by adding up the time consumed by each quality inspection item. total :
[0108] Q represents the total number of quality inspection items, s q It indicates the cleaning time after the completion of a quality inspection project and before the start of the next inspection project, ensuring that the drug inspection equipment is ready for the next quality inspection project; there is no cleaning time for the last item.
[0109] It should be noted that the above-mentioned testing method is to carry out the next quality testing item after each quality testing item is completed, and multiple drug testing equipments simultaneously test multiple pre-tested drugs.
[0110] Quality inspection items usually include:
[0111] Physical properties testing, appearance testing, chemical index testing, and stability testing.
[0112] The detection time T total Combined with the current time, the completion time of the pre-tested drug is obtained. In this way, the fastest end time of the pre-tested drug in the future can be clarified, that is, the pre-tested drug cannot be completed before the completion time of the test, so that other subsequent drug testing plans can be planned based on the completion time of the test.
[0113] Among them, obtain the operating risk value of each detection device at the current time:
[0114] The operating risk value can be calculated by weighted comprehensive calculation of the equipment's operating noise, operating temperature, equipment failure rate, and maintenance times over a period of time to obtain the working status value.
[0115] The final operation risk value is obtained by weighted summing the working status value and the total usage time (testing equipment);
[0116] Obtain the operating risk values of the detection equipment over multiple time periods (e.g., one hour), and obtain the variation amplitude of the operating risk values of the detection equipment at adjacent time points;
[0117] Therefore, the average value of the change amplitude is obtained by taking the average value of multiple change amplitude values, and then the average value of the change amplitude over a period of time is clarified;
[0118] Calculate the detection time T totalThe product of the time taken to detect (such as hours) and the mean value of the change amplitude is reflected in the detection time T total The change degree of the operating risk of the detection equipment is obtained by obtaining the operating risk value of the detection equipment at the current time and the detection time T total By adding the product between the risk value of the test equipment at the time of completion of the test and the mean value of the change amplitude, the operating risk value of the test equipment at the time of completion of the test can be predicted. Therefore, if the operating risk value at the time of completion of the test reaches the risk threshold, the corresponding test equipment will be marked as a risk test equipment, and it will be prohibited from performing quality inspection on pre-test drugs. In this way, it can ensure that the safe test equipment can accurately detect the pre-test drugs, and at the same time ensure that the detection accuracy is not affected.
[0119] It is worth noting that in this solution, if there is a risk detection device, it should be eliminated and prohibited from performing quality inspection. At this time, the detection time T can be recalculated using the detection equipment that can currently perform quality inspection. total , and the detection completion time is obtained again, so that the subsequent detection plan can be accurately planned in combination with the detection completion time to ensure the uninterrupted execution of the subsequent detection plan.
[0120] Finally, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0121] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements will not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for detecting and analyzing drug quality, characterized in that: The steps include: Obtain the drug to be tested and determine the original feature vector, and map the original feature vector to a low-dimensional latent space to obtain the latent variable; Reconstruct the latent variables to obtain reconstructed data and calculate the global reconstruction error; If the original eigenvector is multimodal data, it is decomposed into submodal data, and the submodal reconstruction errors are calculated separately to obtain the global reconstruction error. Based on the distribution characteristics of the drugs to be tested, multi-level statistics of large areas and sub-areas are introduced to divide the large area into several sub-areas, and the local density difference index of the drugs to be tested in the sub-areas is calculated; Combined with the kernel density estimation method to describe the probability distribution of latent variables in large regions or sub-regions, KDE is used to construct local probability density functions and define local anomaly indicators; The regional deviation is defined by the local density difference index, local anomaly index, and latent variables, thereby obtaining the anomaly score of the drug to be tested to determine the abnormal target detection drug; Based on the correlation characteristics of the target detection drugs, other abnormal target detection drugs are re-determined and constituted as pre-detection drugs, and quality inspection is performed on the pre-detection drugs.
2. A drug quality detection and analysis method according to claim 1, characterized in that: The global reconstruction error is calculated according to the following relationship: Decompose the original eigenvector into several sub-modes and calculate the reconstruction error of each sub-mode ω k represents the importance weight of the k-th mode, represents the input feature vector of the i-th drug to be tested under the k-th mode, represents the feature vector of the i-th drug to be tested after being reconstructed by the autoencoder under the k-th mode, M represents the total number of sub-modalities, e i represents the global reconstruction error.
3. A drug quality detection and analysis method according to claim 1, characterized in that: The method for calculating the local density difference index of the drug to be tested in the sub-region is: Use clustering algorithm to divide each large area into several sub-areas; For the drug i to be tested in a sub-region, assuming that i belongs to the sub-region r in the large region j, the local density is estimated using the k-nearest neighbor method, and the local density difference index is calculated. Gi represents the set of k nearest neighbor samples of the drug i to be tested in the sub-region, K NN represents the number of k nearest neighbors, z q Indicates that it belongs to the set G i A hidden variable of a nearby drug to be tested q.
4. A drug quality detection and analysis method according to claim 1, characterized in that: The method for determining the local abnormality index is: Select the latent variable z of the drug to be tested in the large region j or sub-region i , kernel density estimate f j,r (z i )for: Among them, K(u) represents the kernel function, h represents the bandwidth parameter of the kernel density estimation, p represents the dimension of the latent variable space, and C j,r represents the set of drugs to be tested in sub-region r; Local anomaly index δ′ i =-log(f j ,r(z i )).
5. A drug quality detection and analysis method according to claim 4, characterized in that: The kernel function is defined as: Where u is z k Represents the latent variable of the kth drug to be tested in the sub-region.
6. A drug quality detection and analysis method according to claim 5, characterized in that: The bandwidth parameter h is solved by the AMISE criterion to obtain the optimal bandwidth parameter, specifically: Among them, AMISE(h) represents the objective function of selecting the optimal bandwidth parameter, R(K) represents the second-order moment of the kernel function, and M 2 represents the second moment of the data, R(f″) represents the integral of the second derivative of the density function f(z), and n represents the total number of drugs to be tested for the estimated latent variable distribution; Derivative the AMISE formula and set it equal to 0 to obtain the optimal bandwidth parameter h * .
7. A drug quality detection and analysis method according to claim 1, characterized in that: The associated features include: The processing time of the target detection drug, the raw material batch of the target detection drug, the processing steps of the target detection drug and the deviation area of the transportation route.
8. A drug quality detection and analysis method according to claim 2, characterized in that: It also includes determining the corresponding testing time based on the pre-tested drugs, specifically: Obtain the quality inspection items and equipment for drugs, and calculate the time required for pre-inspection drug inspection: T v Indicates the working time of each testing equipment on the quality inspection item, N a represents the number of pre-tested drugs, E represents the number of drug testing equipment, t v represents the average testing time for each pre-tested drug; Detection time T total : Q represents the total number of quality inspection items, s q Indicates the cleaning time after the completion of a quality inspection project and before the start of the next inspection project.
9. A drug quality detection and analysis method according to claim 8, characterized in that: It also includes obtaining the operating risk value of each detection device at the current time. The specific method is: Obtain the operating noise, operating temperature, equipment failure rate, number of repairs, and usage time of the detection equipment over a period of time and perform weighted calculation to obtain the operating risk value; Obtain the operating risk values of the detection equipment under multiple time periods, obtain the change amplitude values of the operating risk values at adjacent time points in a period, and calculate the average value to obtain the mean change amplitude value; Based on the detection time, the average change amplitude, and the operation risk value at the current time, the operation risk value at the predicted detection completion time is obtained, where: If the risk threshold is reached, the corresponding testing equipment will be marked as a risk testing equipment and prohibited from performing quality inspections on pre-tested drugs.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to claim 1 are implemented.