A medicine raw material automatic sampling inspection control method and system and a storage medium

The automatic sampling control method solves the problem of manual sampling in the quality inspection of pharmaceutical raw materials for pharmaceutical companies, realizes automatic sampling of pharmaceutical raw materials, improves quality inspection efficiency and compliance, and meets regulatory requirements.

CN113887950BActive Publication Date: 2026-03-03MINGDU ZHIYUN (ZHEJIANG) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111162687.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2026-03-03
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

Currently, pharmaceutical companies rely heavily on manual sampling during the quality inspection of drug raw materials, which leads to low efficiency, susceptibility to human intervention, and difficulty in meeting compliance requirements.

Method used

An automatic sampling control method for pharmaceutical raw materials is provided. The method generates sampling working parameters by parsing the sampling instructions, generates an inspection application form based on the drug attributes and batch information, and automatically selects samples using an equal probability sampling algorithm to achieve automatic sampling of pharmaceutical raw materials.

Benefits of technology

It enables automated sampling of pharmaceutical raw materials, reduces manual intervention, improves quality inspection efficiency, meets regulatory requirements, and accelerates the pharmaceutical production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113887950B_ABST
    Figure CN113887950B_ABST
Patent Text Reader

Abstract

The application discloses a kind of drug raw material automatic sampling control method, system and storage medium, including parsing drug raw material sampling instruction, the quantity of corresponding batch in drug raw material is inquired according to the batch information of to-be-inspected drug raw material, generates the inspection application form of to-be-inspected raw material, then receives inspection application form and obtains its sampling work parameter, if it is first sampling parameter, then preset sample configuration value is called, and according to the preset sample configuration value, the corresponding goods barcode information in the batch raw material is obtained and is entered into the sampling sample information base, if it is second sampling parameter, then the goods in the batch raw material to be inspected is sampled with equal probability, and the extracted goods barcode information is entered into the sampling sample information base. Random sampling analysis in the inspection application form corresponding goods can be realized, reduce the intervention of manual sampling goods, realize the automatic sampling based on batch drug raw material.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent manufacturing, and in particular to an automatic sampling and control method, system and storage medium for pharmaceutical raw materials. Background Technology

[0002] In recent years, the deepening of national supervision of pharmaceutical companies, the frequent introduction of regulations, and the gradual convergence of regulations with international standards have brought considerable pressure to the production management of pharmaceutical companies. Various pharmaceutical companies have gradually begun to recognize the importance of improving drug production efficiency and enhancing raw material quality control, and many pharmaceutical companies have gradually increased their investment in raw material quality control.

[0003] However, at present, most pharmaceutical companies still rely on manual sampling of batches of raw materials when carrying out quality management and drug quality inspection. This manual sampling process is time-consuming and labor-intensive. More seriously, manual sampling is prone to human intervention or interference, making it difficult to meet compliance requirements. Summary of the Invention

[0004] This invention addresses the shortcomings of existing technologies by providing an automated sampling and control method for pharmaceutical raw materials, comprising the following steps:

[0005] S1, parse the drug raw material sampling instruction, and generate sampling working parameters based on the drug raw material attributes, batch information of the drug raw material to be inspected, or sampling method information. The sampling working parameters include a first sampling parameter and a second sampling parameter.

[0006] S2, based on the batch information of the raw materials to be inspected, query the quantity of the raw materials in the corresponding batch, and generate an inspection application form for the raw materials to be inspected. The inspection application form for the raw materials to be inspected includes, but is not limited to, one or more of the following: sampling parameters, batch of the raw materials to be inspected, identity information of the submitter, and number of samples to be sampled.

[0007] S3. Receive the inspection application form and obtain its sampling parameters. If it is the first sampling parameter, retrieve the preset sample configuration value and enter the corresponding product barcode information of the batch of raw materials into the sampling sample information database according to the preset sample configuration value. If it is the second sampling parameter, sample the products in the batch of raw materials to be inspected with equal probability and enter the sample barcode information of the extracted products into the sampling sample information database.

[0008] Preferably, step S3 specifically includes:

[0009] S31, if the sampling working parameter is the second sampling parameter, then obtain the batch of raw materials to be inspected. When there is only one batch of raw materials to be inspected, obtain the barcode table of all goods in the batch of raw materials from the raw material information database according to the batch of raw materials to be inspected.

[0010] S32, determine whether the quantity of goods in this batch of raw materials is less than or equal to the predetermined number of samples to be sampled; if so, enter all the barcodes of the goods into the sample information database.

[0011] S33. If the quantity of goods in the batch of raw materials is greater than the predetermined number of samples to be inspected, the preset sampling strategy corresponding to the attributes of the raw materials of the drug shall be invoked to sample each barcode of the goods in the barcode table with equal probability, and the sampled barcode information shall be entered into the sample information database.

[0012] Preferably, step S33 specifically includes:

[0013] S331, If ​​the quantity of goods in the batch of raw materials is greater than the predetermined number of samples to be inspected, the barcode information of the first k items in the barcode table will be entered into the first sample library in sequence, where k is not greater than the predetermined number of samples to be inspected m, and the index of each barcode information of goods entering the first sample library will be entered into the second sample library.

[0014] S332, sequentially check the remaining product barcode information in the product barcode table with a probability of k / (k+1) to determine whether to enter the current product barcode information into the first sample library. When a new product barcode information is entered into the first sample library, enter the index of the product barcode information into the second sample library, and randomly select a product barcode information from the first sample library and remove it from the first sample library, until all product barcode information in the product barcode table has been traversed, and then use the first sample library as the sampling sample information library.

[0015] Preferably, step S32 specifically includes:

[0016] S321, Analyze the barcode table of all goods in this batch of raw materials to obtain the quantity of goods in this batch of raw materials. If the quantity of goods is less than the first preset value, enter all the barcodes of goods into the sampling sample information database.

[0017] S322, if the quantity of goods is greater than the first preset value, the first preset value is lower than the predetermined number of samples to be inspected, and the predetermined number of samples to be inspected is less than the second preset value, then the quantity of goods is taken by square root and rounded down as the base number of the adjustment sample.

[0018] S322, if the quantity of goods is greater than the first preset value and the number of samples to be sampled is greater than the second preset value, then half of the square root of the quantity of goods shall be used as the base number of the adjusted sample.

[0019] Preferably, step S3 further includes:

[0020] S34, if the sampling working parameter is the second sampling parameter, then obtain the batch of raw materials to be inspected. When there are multiple batches of raw materials to be inspected, obtain all the product barcodes in each batch of raw materials from the raw material information database, and determine whether to mix the product barcode information of each batch and enter it into the first product barcode table based on the production information of each batch.

[0021] S35, if the barcode information of each batch of goods is mixed and entered into the first barcode table, then the barcode information in the first barcode table is randomly selected by random shuffling algorithm and the positions of each barcode information are interchanged to form the second barcode table. After verifying that the randomness of the second barcode table meets the preset probability, the goods in the second barcode table are sampled with equal probability, and the sampled barcode information is entered into the sampling sample information database.

[0022] This invention also discloses an automatic sampling and control system for pharmaceutical raw materials, comprising: a parsing module, used to parse pharmaceutical raw material sampling and inspection instructions, and generate sampling working parameters based on the attributes of the pharmaceutical raw materials, batch information of the pharmaceutical raw materials to be inspected, or sampling method information, wherein the sampling working parameters include a first sampling parameter and a second sampling parameter; an inspection application form generation module, used to query the quantity of pharmaceutical raw materials in the corresponding batch based on the batch information of the pharmaceutical raw materials to be inspected, and generate an inspection application form for the pharmaceutical raw materials to be inspected, wherein the inspection application form for the pharmaceutical raw materials to be inspected includes, but is not limited to, one or more of the following: sampling working parameters, batch of pharmaceutical raw materials to be inspected, identity information of the submitter, and predetermined number of samples to be sampled; and a sampling module, used to receive the inspection application form and obtain its sampling working parameters, wherein if it is the first sampling parameter, it retrieves a preset sample configuration value and, based on the preset sample configuration value, obtains the corresponding product barcode information of the batch of raw materials and enters it into the sampling sample information database, and if it is the second sampling parameter, it samples the products in the batch of raw materials to be inspected with equal probability and enters the sampled product barcode information into the sampling sample information database.

[0023] Preferably, the sampling module specifically includes: a product barcode table acquisition module, used to acquire the batch of raw materials to be inspected when the sampling working parameter is the second sampling parameter, and when there is only one batch of raw materials to be inspected, to acquire the barcode table of all products in the batch of raw materials from the raw material information database according to the batch of raw materials to be inspected; a first sample module, used to enter all product barcodes into the sampling sample information database when the quantity of products in the batch of raw materials is less than or equal to the predetermined sampling sample number; and a second sample module, used to call a preset sampling strategy corresponding to the attributes of the drug raw materials to sample each product barcode in the product barcode table with equal probability when the quantity of products in the batch of raw materials is greater than the predetermined sampling sample number, and to enter the extracted product barcode information into the sampling sample information database.

[0024] Preferably, the second sample module specifically includes: an information entry module, used to sequentially enter the barcode information of the first k items in the barcode table into the first sample library when the quantity of goods in the batch of raw materials is greater than the predetermined number of samples to be sampled, where k is not greater than the predetermined number of samples to be sampled, and to enter the index of each barcode information of goods entering the first sample library into the second sample library; and a sample judgment module, used to sequentially judge whether to enter the current barcode information of goods into the first sample library with a probability of k / (k+1) of the remaining barcode information in the barcode table, and when a new barcode information of goods is entered into the first sample library, to enter the index of the barcode information of goods into the second sample library, and to randomly select a barcode information of goods from the first sample library and remove it from the first sample library, until all barcode information of goods in the barcode table has been traversed and the first sample library is used as the sampling sample information library.

[0025] The present invention also discloses an automatic sampling and control device for pharmaceutical raw materials, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of any of the aforementioned automatic sampling and control methods for pharmaceutical raw materials.

[0026] The present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the aforementioned automatic sampling and control methods for pharmaceutical raw materials.

[0027] This invention discloses an automatic sampling control method and system for pharmaceutical raw materials. It generates different sampling parameters based on the attributes of the raw materials, batch information, or sampling method information. Then, it queries the quantity of raw materials within the corresponding batch based on the batch information, generates an inspection request form, and automatically selects different sampling methods to sample the corresponding batch of goods based on the inspection request form and the sampling parameters. This enables flexible configuration of goods quality inspection strategies and can generate a sampling plan after receiving the inspection request form, improving the efficiency of the inspection process. This method can achieve random sampling and analysis of goods corresponding to quality management request forms, identifying batch quality differences. It is suitable for large quantities of goods, avoiding human intervention, reducing manual intervention in sampling, and preventing incomplete quality inspection coverage due to non-scattered sampling. Ultimately, it achieves batch-based automatic sampling of pharmaceuticals, solving the inefficiency and error-prone nature of manual sampling, helping pharmaceutical companies better control drug quality, improving the speed and efficiency of raw material quality inspection, and accelerating drug production.

[0028] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0029] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0030] Figure 1 This is a flowchart illustrating the automatic sampling and control method for pharmaceutical raw materials disclosed in this embodiment.

[0031] Figure 2 This is a schematic diagram of the specific process of step S3 disclosed in this embodiment.

[0032] Figure 3 This is a schematic diagram of the specific process of step S32 disclosed in this embodiment.

[0033] Figure 4 This is a schematic diagram of the specific process of step S33 disclosed in this embodiment.

[0034] Figure 5 This is another specific flowchart of step S3 disclosed in this embodiment.

[0035] Figure 6 This is a schematic diagram of the specific process of step S34 disclosed in this embodiment. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0037] In the description of this invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0038] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0039] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0040] The pharmaceutical industry has experienced rapid development in recent years, but it also faces numerous challenges. With increasing national regulation of pharmaceutical companies, frequent introduction of new regulations, and the convergence of laws and regulations with international standards, pharmaceutical companies are under considerable pressure. They are increasingly recognizing the importance of improving drug production efficiency and raw material quality control, leading many to increase investment in this area. However, research on domestic pharmaceutical companies and national policies and regulations reveals that many still rely heavily on manual sampling of batches of materials during quality control, a time-consuming and labor-intensive process. This manual sampling method suffers from low efficiency and the potential for human intervention, making it difficult to meet compliance requirements. To address these shortcomings, this invention provides an automated sampling control method for pharmaceutical raw materials. This method enables batch-based automated sampling, solving the inefficiencies and error-prone nature of manual sampling. It helps pharmaceutical companies better control drug quality, meet national regulatory requirements, accelerate raw material quality control, improve efficiency, and expedite drug production. (See attached image) Figure 1 As shown in the figure, the automatic sampling and control method for pharmaceutical raw materials disclosed in this embodiment specifically includes the following steps.

[0041] Step S1: Parse the drug raw material sampling instruction and generate sampling parameters based on the drug raw material attributes, batch information of the drug raw material to be inspected, or sampling method information. The sampling parameters include a first sampling parameter and a second sampling parameter. In this embodiment, the first sampling parameter is for non-automatic sampling, and the second sampling parameter is for automatic sampling.

[0042] Whether each item is automatically sampled can be represented by the following data structure.

[0043] {

[0044] "autoSample": 1, / / Whether to automatically sample (1 for automatic sampling, 0 for non-automatic sampling)

[0045] }

[0046] Automatically sampled goods can form the following data structure.

[0047]

[0048]

[0049] The `autoSample` field indicates whether the sampling method for the pharmaceutical raw material is automatic sampling, serving as the basic data when receiving the inspection application form. The `barcodeId` field contains the barcode information of the randomly sampled goods, also serving as the basic data for generating the sampling plan.

[0050] Step S2: Based on the batch information of the raw materials to be inspected, query the quantity of raw materials within the corresponding batch, and generate an inspection request form for the raw materials to be inspected. The inspection request form includes, but is not limited to, sampling parameters, batch number of the raw materials to be inspected, submitter's identity information, and one or more of the following: the planned number of samples to be sampled. The planned number of samples to be sampled is the number of samples to be drawn in this sampling operation.

[0051] Step S3: Receive the inspection application form and obtain its sampling parameters. If it is the first sampling parameter, retrieve the preset sample configuration value and enter the corresponding product barcode information of the batch of raw materials into the sampling sample information database according to the preset sample configuration value. If it is the second sampling parameter, sample the products in the batch of raw materials to be inspected with equal probability and enter the sample barcode information of the extracted products into the sampling sample information database.

[0052] In this embodiment, the `autoSample` field is used to indicate whether the sampling method for the pharmaceutical raw material is automatic sampling, serving as the basic data when receiving the inspection request form. The `barcodeId` field contains the randomly sampled product barcode information and also serves as the basic data for generating the sampling plan. After obtaining these two basic data, the receiving result, i.e., the sampling plan table data, is persisted after calculation based on the basic data when receiving the inspection request form. Any relational or non-relational database, such as MySQL, SQL Server, Oracle, MongoDB, Elasticsearch, etc., can be selected for persisting the sampling plan data. The first sampling parameter is non-automatic sampling, that is, according to the set sample configuration value, the corresponding product barcode information of the batch of raw materials is obtained and entered into the sampling sample information database. The sample configuration value can be a specific sampling rule, such as sampling at intervals according to product barcode information or sampling according to a preset product barcode judgment method, etc.

[0053] As attached Figure 2 As shown, in this embodiment, step S3 specifically includes:

[0054] Step S31: If the sampling working parameter is the second sampling parameter, then obtain the batch of raw materials to be inspected. When there is only one batch of raw materials to be inspected, obtain the barcode table of all goods in the batch of raw materials from the raw material information database according to the batch of raw materials to be inspected.

[0055] Step S32: Determine whether the quantity of goods in this batch of raw materials is less than or equal to the predetermined number of samples to be inspected. If so, enter all the barcodes of the goods into the sample information database.

[0056] As attached Figure 3 As shown, step S32 specifically includes:

[0057] Step S321: Analyze the barcode table of all goods in the batch of raw materials to obtain the quantity of goods in the batch of raw materials. If the quantity of goods is less than the first preset value, enter all the barcodes of goods into the sampling sample information database.

[0058] Step S322: If the quantity of goods is greater than the first preset value, the first preset value is lower than the predetermined number of samples to be inspected, and the predetermined number of samples to be inspected is less than the second preset value, then the quantity of goods is taken as the base number of the adjusted sample.

[0059] Step S322: If the quantity of goods is greater than the first preset value and the number of samples to be sampled is greater than the second preset value, then half of the square root of the quantity of goods is used as the base number of the adjusted sample.

[0060] Specifically, based on the batch number of the inspection application form, a list of all barcode information corresponding to that batch of goods can be retrieved. <long>If the number n of barcodeIds corresponding to the goods in this batch is less than 3 (i.e., the minimum sampling quantity, or the first preset value, is set to 3 in this embodiment), then barcodeIds will be directly returned as a sampling record. Otherwise, the square root of n is first taken and rounded to obtain the sampling baseline quantity i. If m is less than or equal to 300, then the sampling quantity m = i + 1; otherwise, m = i / 2 + 1. Random values ​​are selected using barcodeIds as the data source and m as the sampling quantity. During random value selection, if n of barcodeIds is less than the sampling quantity m, then barcodeIds will be returned as a random sampling record.

[0061] Step S33: If the quantity of goods in the batch of raw materials is greater than the predetermined number of samples to be inspected, the preset sampling strategy corresponding to the attributes of the drug raw materials is called to sample each barcode in the barcode table with equal probability, and the extracted barcode information is entered into the sample information database.

[0062] As attached Figure 4 As shown, step S33 specifically includes the following contents.

[0063] Step S331: If the quantity of goods in the batch of raw materials is greater than the predetermined number of samples to be inspected, the barcode information of the first k items in the barcode table is entered into the first sample library in sequence, where k is not greater than the predetermined number of samples to be inspected m, and the index of each barcode information of goods entering the first sample library is entered into the second sample library.

[0064] Step S332: Sequentially determine whether to enter the current product barcode information into the first sample library with a probability of k / (k+1) for the remaining product barcode information in the product barcode table. When a new product barcode information is entered into the first sample library, enter the index of the product barcode information into the second sample library, and randomly select a product barcode information from the first sample library and remove it from the first sample library, until all product barcode information in the product barcode table has been traversed, and then use the first sample library as the sampling sample information library.

[0065] Specifically, in this embodiment, for random sampling of a single batch, the total amount of data is finite. We need to randomly select k samples from this batch, requiring that each sample has an equal probability of being selected. We adopt a custom sampling algorithm: first, k numbers are placed into the first sample pool; then, each subsequent number (>k) is swapped into the first sample pool with a probability of k / k+1, and a number is randomly selected from the first sample pool to be swapped out. For n (n>=k), if each time... The probability determines whether to include it in the first sample pool. Up to n, each element has an equal probability of being selected, i.e., ... Let there be an element α, and α≦n. Then the probability that it is selected is: the probability of it being selected * [the number of elements after it that were not selected + the number of elements after it that were selected * α not being replaced]. That is: Let n be the total size of the list to be drawn, and m be the number of samples to be drawn. To ensure that the probability of each sample being drawn is... The first sample by Sampling is performed with a probability of , and for the second sample, if the first sample was selected, its probability of being selected is . If the first sample is not selected, the probability of it being selected is: The probability of the second sample being selected is For the i-th sample, the probability of being selected is Where k is the number of samples already selected, k <= m. That is, when selecting the i-th sample, if k samples have already been selected, then mk samples need to be selected from the remaining n-i+1 samples. When the automatic sampling record is associated with the inspection application form, a List of all product barcode information corresponding to that batch is retrieved based on the batch number of the inspection application form. <long>If the number of barcodeIds, n, is less than 3, then barcodeIds are returned directly as sample records. Otherwise, the square root of n is taken and rounded to obtain the baseline number of samples, i. If m is less than or equal to 300, then the number of samples is m = i + 1; otherwise, m = i / 2 + 1. Random values ​​are selected using barcodeIds as the data source and m as the sample size. During random value selection, if n of barcodeIds is less than the sample size m, then barcodeIds are returned as random sample records.

[0066] In a specific implementation, a function random(List) can be defined. <long>The method `barcodeIds(int m)` is used to randomly select `m` barcodes from the batch of barcodes in the `barcodeIds` group. The function defines the number of selected barcodes (i.e., `checkedNum = m` from the second sample library), the total number of barcodes in the batch (`len = barcodeIds.size()`), and the list of randomly selected barcodes (`List<int>`). <long>A list, a key-value pair Map<int, Long> checkedMap is used to mark whether the randomly selected subscript has existed, and an array int[] result with a size of m is used to store the first m elements among the total barcodes barcodeIds to be sampled. In the loop for(int i = 0; i < m; i++), the first m elements are directly placed into the array result[i] = barcodeIds.get(i). In the loop for(int i = m; i < len; i++), probability sampling is performed on m + 1 elements. First, calculate the random subscript int index = random.nextInt(i + 1) (here, the existing function Random in the Java Api is used). If index is less than the number of samples to be taken m, and if the checkedMap does not contain the current subscript index, then assign barcodeIds.get(i) to result[r], that is, if(r < m) result[r] = barcodeIds.get(i). This is the embodiment of the probability mentioned above. Then record the currently randomly selected subscript index into the checkedMap. After the two loops end, return the result array as the sampling result set. Finally, enter the sampling result set, that is, the barcode information of the sampled goods, into the sampling inspection sample information database. At the same time, the random sampling algorithm fully considers the comparison between the number of sampling specimens and the total number, records the random sampling subscript, avoids repeated sampling of a certain good, making this method more general and improving the quality inspection sampling efficiency and coverage range. This is the embodiment of the probability mentioned above. Then record the currently randomly selected subscript index into the checkedMap. After the two loops end, return the result array as the sampling result set. Finally, enter the sampling result set, that is, the barcode information of the sampled goods, into the sampling inspection sample information database. At the same time, the random sampling algorithm fully considers the comparison between the number of sampling specimens and the total number, records the random sampling subscript, avoids repeated sampling of a certain good, making this method more general and improving the quality inspection sampling efficiency and coverage range.

[0067] In some other embodiments, as shown in the appendix Figure 5 It is shown that step S3 further includes:

[0068] Step S34, if the sampling working parameter is the second sampling parameter, obtain the batch of raw materials to be inspected. When the batch of raw materials to be inspected is multiple batches, obtain all the barcode information of the goods in each batch of raw materials from the raw material information database, and judge whether to enter the barcode information of each batch of goods into the first goods barcode table after mixing according to the production information of each batch.

[0069] Specifically, obtain the production time interval between the previous and subsequent batches of raw materials to be inspected from the production information of each batch. If the production time interval between multiple batches is less than the preset time, then mix the barcode information of these batches and enter it into the first goods barcode table. Otherwise, enter the barcode information of each batch into the corresponding goods barcode table separately.

[0070] As shown in the appendix Figure 6 It is shown that in this embodiment, step S34 specifically includes:

[0071] Step S341: Obtain the batch time span of each batch of raw materials to be inspected, wherein the batch time span is the time interval between the earliest and latest produced goods in the batch of raw materials to be inspected.

[0072] Step S342: Calculate the production time interval between each batch of raw materials to be inspected, wherein the production time interval is the time interval between the latest produced item in the earlier batch of raw materials to be inspected and the earliest produced item in the later batch of raw materials to be inspected.

[0073] Step S343: Iterate through the batch time span and production time interval of each batch of raw materials to be inspected, and obtain one or more related batches of raw materials to be inspected. The related batches of raw materials to be inspected are those where the ratio of the production time interval of two batches of raw materials to the sum of the time spans of these two batches is less than a preset value. Mix the barcode information of each batch of goods in the related batches of raw materials to be inspected and enter it into the same first product barcode table. This preset value can be pre-set before inspection based on the actual situation of the goods to be inspected. For example, if the preset value is set to 1, then when the time interval between the latest produced item in the earlier batch of raw materials to be inspected and the earliest produced item in the later batch of raw materials to be inspected is less than or equal to the sum of the time spans of these two batches, these two batches of raw materials to be inspected are marked as related batches. Because the production times of the related batches of raw materials to be inspected are close, their processing environment, equipment status, and raw material parameters are very similar during production. They can be approximated as raw materials produced with the same production parameters and mixed for sampling inspection. When two batches of raw materials to be inspected are not considered related batches, meaning the ratio of the production time interval between these two batches to the sum of the time spans of these two batches exceeds the preset value, the excessively long production interval between the two batches may lead to differences in equipment status due to varying working hours during the production of each batch. This could result in different processing deviations due to wear and tear, slight differences in environmental parameters due to different seasons, or subtle differences in internal parameters due to the use of different suppliers for some raw materials. These factors could all affect the final sampling parameters of the two batches. Therefore, it is more suitable to conduct separate sampling inspections on these two batches of raw materials. This would allow for the timely detection of potential issues with a higher non-conformity rate in a particular batch of raw materials, ensuring accurate understanding of the overall product quality while more effectively pinpointing the problematic batch.

[0074] Step S35: If the barcode information of each batch of goods is mixed and entered into the first product barcode table, then a random shuffling algorithm is used to randomly select the barcode information of each product in the first product barcode table, and their positions are interchanged to form a second product barcode table. After verifying that the randomness of the second product barcode table meets the preset probability, the products in the second product barcode table are sampled with equal probability, and the sampled product barcode information is entered into the sampling sample information database. The sampling sample information database stores the sampling sample groups corresponding to each second product barcode table, and the sampling sample groups corresponding to the remaining individual batches of goods that were not mixed because no related batches exist.

[0075] Step S35 specifically includes:

[0076] Step S351: The barcode information of the products in the first product barcode table is randomly selected by a random shuffling algorithm and their positions are interchanged to form the second product barcode table.

[0077] Specifically, when performing mixed sampling inspection on multiple batches, the data sets of multiple batches are first mixed and shuffled. To ensure that the arrangement of the data sets of multiple batches is random enough, a random shuffling algorithm is used in this embodiment to randomly select elements for exchange. First, a method randInt(int min, int max) is defined to obtain a random integer within the closed interval [min, max]. Random.nextInt(min, max) is called to obtain a random value between [min, max]. Then, a random shuffling algorithm shuffle(List< ... <long>In the algorithm, we define a variable `length = list.size()`, and randomly select an element by calling `randInt(i, length-1)` in a loop. Then, we swap the data at the `i`th and `rand`th positions in the list. `list.get(i) = list.get(rand)`.

[0078] Step S352: After verifying the randomness of the second product barcode table to meet the preset probability, determine whether the quantity of products in the second product barcode table is less than or equal to the predetermined sampling sample size. If so, enter all product barcodes into the sampling sample information database. The Monte Carlo method can be used to verify that the result set after data exchange in the above steps is sufficiently random. List the frequency of all permutations and combinations of the list and display it as a histogram. Assuming list = {1, 2, 3, 4}, after each shuffling, increment the frequency corresponding to the shuffled result by one, repeating this 1 million times. If the total frequency of each result is approximately the same, it indicates that the probability of each result is equal.

[0079] Step S353: If the quantity of goods is greater than the predetermined number of samples to be inspected, the preset sampling strategy corresponding to the raw material attribute of the drug is invoked to sample each barcode of the goods in the barcode table with equal probability, and the extracted barcode information is entered into the sample information database.

[0080] Step S353 specifically includes:

[0081] Step S3531: If the number of goods in the second product barcode table is greater than the predetermined number of samples to be inspected, then the barcode information of the first k products in the product barcode table is entered into the first sample library in sequence, where k is not greater than the predetermined number of samples to be inspected m, and the index of each product barcode information entering the first sample library is entered into the second sample library.

[0082] Step S3532: Sequentially determine whether to enter the current product barcode information into the first sample library with a probability of k / (k+1) for the remaining product barcode information in the product barcode table. When a new product barcode information is entered into the first sample library, enter the index of the product barcode information into the second sample library, and randomly select a product barcode information from the first sample library and remove it from the first sample library. After traversing all product barcode information in the product barcode table, the first sample library is used as the sampling sample information library.

[0083] Specifically, similar to step S33 above, k samples are randomly selected from the second product barcode table after mixing the barcode information of each batch of goods, requiring that each sample has an equal probability of being selected. We adopt a custom sampling algorithm, first putting k numbers into the first sample library, and then each subsequent number (>k) is swapped into the first sample library with a probability of k / k+1, and a number is randomly selected from the first sample library when swapping in. For n (n>=k), if each time... The probability determines whether to include it in the first sample pool. Up to n, each element has an equal probability of being selected, i.e., ... Let there be an element α, and α≦n. Then the probability that it is selected is: the probability of it being selected * [the number of elements after it that were not selected + the number of elements after it that were selected * α not being replaced]. That is: Let n be the total size of the list to be drawn, and m be the number of samples to be drawn. To ensure that the probability of each sample being drawn is... The first sample by Sampling is performed with a probability of , and for the second sample, if the first sample was selected, its probability of being selected is . If the first sample is not selected, the probability of it being selected is: The probability of the second sample being selected is For the i-th sample, the probability of being selected is Where k is the number of samples already selected, k <= m. That is, when selecting the i-th sample, if k samples have already been selected, then mk samples need to be selected from the remaining n-i+1 samples. After traversing all the product barcode information in the second product barcode table, the first sample database is entered into the sampling sample information database.

[0084] After subsequent sampling inspections of goods in the sample database, if the pass rates of the sample groups corresponding to each second product barcode table and the sample groups corresponding to the remaining individual batches that were not mixed due to the absence of related batches are both higher than the preset value, then the barcode information of all batches can be mixed and entered into the third product barcode table. Then, the barcode information of the third product barcode table is randomly selected using a random placement algorithm to swap the positions of each product barcode information to form the fourth product barcode table. The products in the fourth product barcode table are sampled with equal probability, and the extracted product barcode information is entered into the sample database for sampling inspection to obtain the overall pass rate.

[0085] If at least one of the product pass rates in the sample groups corresponding to each of the second product barcode tables and the sample groups corresponding to the remaining individual batches of products that were not mixed due to the absence of related batches is lower than the preset value, then a warning message will be issued directly to the corresponding sample group or individual batch of products and no more overall mixed sampling will be carried out.

[0086] In this embodiment, the relevant batch groups are defined based on the relationship between the production time interval of each batch of raw materials to be inspected and the time span between batches. Relevant batches can be directly mixed and sampled as a whole, while unrelated batches can be sampled separately. This allows for timely detection of the problem of a high non-conformity rate in a specific batch of raw materials, ensuring accurate knowledge of the overall quality status of the goods while more effectively locating the problematic batch.

[0087] In other embodiments, an automatic sampling and control system for pharmaceutical raw materials is also disclosed, comprising: a parsing module, used to parse pharmaceutical raw material sampling and inspection instructions, and generate sampling working parameters based on the attributes of the pharmaceutical raw materials, batch information of the pharmaceutical raw materials to be inspected, or sampling method information, wherein the sampling working parameters include a first sampling parameter and a second sampling parameter; a request for inspection generation module, used to query the quantity of pharmaceutical raw materials in the corresponding batch based on the batch information of the pharmaceutical raw materials to be inspected, and generate a request for inspection of the pharmaceutical raw materials to be inspected, wherein the request for inspection of the pharmaceutical raw materials to be inspected includes, but is not limited to, one or more of the following: sampling working parameters, batch of the pharmaceutical raw materials to be inspected, identity information of the submitter, and a predetermined number of samples to be sampled; and a sampling module, used to receive the request for inspection and obtain its sampling working parameters, wherein if it is the first sampling parameter, it retrieves a preset sample configuration value and, according to the preset sample configuration value, obtains the corresponding product barcode information of the batch of raw materials and enters it into the sampling sample information database, and if it is the second sampling parameter, it samples the products in the batch of raw materials to be inspected with equal probability and enters the sample barcode information of the extracted products into the sampling sample information database.

[0088] In this embodiment, the sampling module specifically includes: a product barcode table acquisition module, used to acquire the batch of raw materials to be inspected when the sampling working parameter is the second sampling parameter, and when there is only one batch of raw materials to be inspected, to acquire the barcode table of all products in the batch of raw materials from the raw material information database according to the batch of raw materials to be inspected; a first sample module, used to enter all product barcodes into the sampling sample information database when the quantity of products in the batch of raw materials is less than or equal to the predetermined sampling sample number; and a second sample module, used to call a preset sampling strategy corresponding to the attributes of the drug raw materials to sample each product barcode in the product barcode table with equal probability when the quantity of products in the batch of raw materials is greater than the predetermined sampling sample number, and to enter the extracted product barcode information into the sampling sample information database.

[0089] In this embodiment, the second sample module specifically includes: an information entry module, used to sequentially enter the barcode information of the first k items in the barcode table into the first sample library when the quantity of goods in the batch of raw materials is greater than the predetermined number of samples to be sampled, where k is not greater than the predetermined number of samples to be sampled, and to enter the index of each barcode information of goods entering the first sample library into the second sample library; and a sample judgment module, used to sequentially judge whether to enter the current barcode information of goods into the first sample library with a probability of k / (k+1) of the remaining barcode information in the barcode table, and when a new barcode information of goods is entered into the first sample library, to enter the index of the barcode information of goods into the second sample library, and to randomly select a barcode information of goods from the first sample library and remove it from the first sample library, until all barcode information of goods in the barcode table has been traversed and the first sample library is used as the sampling sample information library.

[0090] The specific functions of the above-described automatic sampling and control system for pharmaceutical raw materials correspond one-to-one with the automatic sampling and control methods for pharmaceutical raw materials disclosed in the previous embodiments. Therefore, they will not be described in detail here. For details, please refer to the embodiments of the automatic sampling and control methods for pharmaceutical raw materials disclosed in the previous embodiments. It should be noted that the embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the embodiments can be referred to mutually.

[0091] In other embodiments, an automatic sampling and control device for pharmaceutical raw materials is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the automatic sampling and control method for pharmaceutical raw materials as described in the above embodiments.

[0092] The automatic sampling and control device for pharmaceutical raw materials may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that the schematic diagram is merely an example of an automatic sampling and control device for pharmaceutical raw materials and does not constitute a limitation on the device. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the automatic sampling and control device for pharmaceutical raw materials may also include input / output devices, network access devices, buses, etc.

[0093] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the automatic sampling and control device for pharmaceutical raw materials, connecting all parts of the device via various interfaces and lines.

[0094] The memory can be used to store the computer program and / or modules. The processor, by running or executing the computer program and / or modules stored in the memory and calling the data stored in the memory, realizes various functions of the device for automatic sampling and control of pharmaceutical raw materials. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0095] If the automatic sampling and control device for pharmaceutical raw materials is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above embodiments of the automatic sampling and control method for pharmaceutical raw materials. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately added to or subtracted from the content as required by the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium may not include electrical carrier signals and telecommunication signals.

[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

[0097] In summary, the above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be covered by the present invention.< / long> < / long> < / long> < / long> < / long>

Claims

1. A method for automatic sampling inspection control of a pharmaceutical raw material, characterized by, The method comprises the following steps: S1, analyzing the drug raw material sampling instruction, generating sampling work parameters according to the drug raw material attribute, the batch information or the sampling mode information of the drug raw material to be inspected, the sampling work parameters comprising first sampling parameters indicating non-automatic sampling and second sampling parameters indicating automatic sampling; S2, querying the number of drug raw materials in the corresponding batch according to the batch information of the drug raw material to be inspected, and generating an inspection application form for the raw material to be inspected, the inspection application form comprising one or more of the sampling work parameters, the batch of the raw material to be inspected, the submitter's identity information, and the predetermined number of samples to be inspected; S3, receiving the inspection application form and obtaining the sampling work parameters thereof, if the first sampling parameters are used, preset sample configuration values are called, and the corresponding product barcode information in the batch of raw materials is recorded in the sampling sample information database according to the preset sample configuration values, if the second sampling parameters are used, the products in the batch of raw materials to be inspected are sampled with equal probability, and the extracted product barcode information is recorded in the sampling sample information database; the step S3 further comprises: S34, if the sampling work parameters are the second sampling parameters, the batch of raw materials to be inspected is obtained, when the batch of raw materials to be inspected is multiple batches, all product barcodes in each batch of raw materials are obtained from the raw material information database, and whether the product barcode information of each batch is mixed and recorded in the first product barcode table is determined according to the production information of each batch; S35, if the product barcode information of each batch is mixed and recorded in the first product barcode table, a random disorder algorithm is used to randomly select each product barcode information in the first product barcode table to exchange positions to form a second product barcode table, and the second product barcode table is verified for randomness to meet a preset probability, and the products in the second product barcode table are sampled with equal probability, and the extracted product barcode information is recorded in the sampling sample information database.

2. The automatic inspection and control method of drug substance raw material according to claim 1, characterized by, The step S3 specifically comprises: S31, if the sampling work parameters are the second sampling parameters, the batch of raw materials to be inspected is obtained, when the batch of raw materials to be inspected is only one batch, all product barcode tables in the batch of raw materials are obtained from the raw material information database according to the batch of raw materials to be inspected; S32, determining whether the number of products possessed in the batch of raw materials is less than or equal to the predetermined number of samples to be inspected, if yes, recording all product barcodes in the sampling sample information database; S33, if the number of products in the batch of raw materials is greater than the predetermined number of samples to be inspected, a preset sampling strategy corresponding to the attribute of the drug raw material is called to sample each product barcode in the product barcode table with equal probability, and the extracted product barcode information is recorded in the sampling sample information database.

3. The automatic inspection and control method of drug substance raw material according to claim 2, characterized by, The step S33 specifically comprises: S331, if the number of products in the batch of raw materials is greater than the predetermined number of samples to be inspected, the first sample library is sequentially recorded with the product barcode information in the top k product barcode table, wherein k is not greater than the predetermined number of samples m, and the subscript of each product barcode information entering the first sample library is recorded in the second sample library; S332, sequentially remaining goods barcode information in the goods barcode table is whether the current goods barcode information is entered into the first sample library, and when a new goods barcode information is entered into the first sample library, the subscript of the goods barcode information is entered into the second sample library, and a goods barcode information is randomly selected from the first sample library and removed from the first sample library, until all goods barcode information in the goods barcode table is traversed, and the first sample library is used as the inspection sample information library.

4. The automatic inspection and control method of drug substance raw material according to claim 3, characterized by, The step S32 specifically comprises: S321, obtaining the number of goods in the batch of raw materials from all the goods barcode tables of the batch of raw materials, and if the number of goods is less than a first preset value, recording all the goods barcodes into the sampling sample information database; S322, if the number of goods is greater than the first preset value, the first preset value is lower than the predetermined sampling sample number, and the predetermined sampling sample number is less than a second preset value, then the square root of the number of goods is taken as the adjusted sample base; S323, if the number of goods is greater than the first preset value and the predetermined sampling sample number is greater than the second preset value, then half of the square root of the number of goods is taken as the adjusted sample base.

5. A drug material automatic sampling and inspection control system, characterized by, Comprise: The analysis module is used for analyzing the drug raw material sampling instruction, generating sampling work parameters according to the drug raw material attribute, the batch information of the to-be-inspected drug raw material or the sampling mode information, the sampling work parameters including the first sampling parameter indicating the use of non-automatic sampling and the second sampling parameter indicating the use of automatic sampling; The inspection application form generation module is used for querying the number of drug raw materials in the corresponding batch according to the batch information of the to-be-inspected drug raw material, and generating an inspection application form of the to-be-inspected raw material, the to-be-inspected raw material inspection application form including one or more of the sampling work parameters, the to-be-inspected raw material batch, the submitter identity information, and the predetermined sampling sample number; The sampling module is used for receiving the inspection application form and obtaining the sampling work parameters thereof, if the first sampling parameter is used, the preset sample configuration value is called, and the corresponding goods barcode information in the batch of raw materials is recorded into the sampling sample information database according to the preset sample configuration value, if the second sampling parameter is used, the goods in the to-be-inspected batch of raw materials are sampled with equal probability, and the extracted goods barcode information is recorded into the sampling sample information database; if the sampling work parameter is the second sampling parameter, the to-be-inspected raw material batch is obtained, when the to-be-inspected raw material batch is multiple batches, all the goods barcodes in each batch of raw materials are obtained from the raw material information database, whether the goods barcode information of each batch is mixed and recorded into the first goods barcode table is judged according to the production information of each batch; if the goods barcode information of each batch is mixed and recorded into the first goods barcode table, a random disorder algorithm is used to randomly select each goods barcode information to exchange positions to form a second goods barcode table, and the second goods barcode table is verified to meet the preset probability, and the goods in the second goods barcode table are sampled with equal probability, and the extracted goods barcode information is recorded into the sampling sample information database.

6. The automatic drug raw material sampling and testing control system according to claim 5, wherein The sampling module specifically comprises: The goods barcode table acquisition module is used for obtaining the to-be-inspected raw material batch when the sampling work parameter is the second sampling parameter, and obtaining all the goods barcode tables in the batch of raw materials from the raw material information database according to the to-be-inspected raw material batch when the to-be-inspected raw material batch is only one batch; The first sample module is used for recording all the goods barcodes into the sampling sample information database when the number of goods possessed by the batch of raw materials is less than or equal to the predetermined sampling sample number; The second sample module is configured to, when the number of goods in the batch of raw materials is greater than the predetermined number of sampling samples, call a preset sampling strategy corresponding to the attribute of the raw materials to sample each of the goods barcodes in the goods barcode table with equal probability, and record the sampled goods barcode information in the sampling sample information database.

7. The automatic inspection and control system for drug substance raw materials according to claim 6, characterized in that, The second sample module specifically comprises: The information recording module is configured to, when the number of goods in the batch of raw materials is greater than the predetermined number of sampling samples, sequentially record the top k goods barcode information in the goods barcode table in the first sample database, where k is not greater than the predetermined number of sampling samples m, and record the subscript of each goods barcode information in the first sample database in the second sample database. The sample judgment module is used to sequentially check the remaining product barcode information in the product barcode table. The probability is used to determine whether to enter the current product barcode information into the first sample database. When a new product barcode information is entered into the first sample database, the index of the product barcode information is entered into the second sample database. Then, a product barcode information is randomly selected from the first sample database and removed from the first sample database. This process continues until all product barcode information in the product barcode table has been traversed. After that, the first sample database is used as the sampling sample information database.

8. A drug material automatic sampling inspection control device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes the computer program to implement the steps of the method of any one of claims 1-4.

9. A computer readable storage medium storing a computer program, characterized in that: The computer program is executed by the processor to implement the steps of the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Incoming quality control method and device

    CN111523805A