Pastry detection early warning method based on data driving and application thereof
By constructing a comprehensive risk index model and introducing an ARIMAX model of environmental variables, the problems that environmental factors in the existing technology are not considered are solved, more accurate food safety risk assessment and early warning are achieved, and the practicality and response speed of the early warning system are improved.
Patent Information
- Application Number
- CN202510531484.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-09-02
AI Technical Summary
The existing food safety risk assessment methods fail to fully consider environmental factors, resulting in insufficient accuracy and practicality of the risk prediction model when environmental changes are not achieved, and cannot effectively reflect the dynamic changes in food safety risks.
A comprehensive risk index model is constructed, combined with environmental variables as exogenous variables, and risk prediction is adopted using the ARIMAX model, and pastry detection and warning is carried out through data-driven methods, including data collection, standardized processing and risk indicator construction, and risk prediction is used using environmental data and historical detection data.
It improves the accuracy of food safety risk assessment and the response speed of the early warning system, provides more accurate early warning information and decision-making basis, and enhances the practicality and pertinence of the early warning system.
Smart Images

Figure CN120579812A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of food inspection technology and big data application technology, and in particular to a data-driven pastry detection and early warning method and its application. Background Art
[0002] With the continuous improvement of people's living standards and the rapid development of the food industry, the consumption of snack foods such as pre-packaged pastries has increased annually. Against this backdrop, food safety issues continue to demand special attention and concern, especially as numerous foodborne illness incidents caused by food contamination have garnered widespread public attention. Bacillus cereus, a common foodborne pathogen, has become a key target for food safety monitoring due to its ability to produce diarrheal toxins and vomitoxins. In particular, with the widespread use of antibiotics, this strain has shown a trend toward multidrug resistance, further increasing food safety risks.
[0003] Existing food safety risk assessment methods primarily rely on statistical analysis of historical testing data. However, these traditional approaches often overlook external environmental factors that influence microbial growth in food, such as temperature, humidity, rainfall, and air pressure. Because these environmental parameters significantly influence microbial reproduction and virulence expression, risk prediction models that rely solely on historical data often fail to accurately reflect risk fluctuations caused by environmental changes in practical applications, thereby reducing the accuracy and practicality of early warning systems.
[0004] To solve the above problems, in recent years, some researchers have combined environmental factors and historical detection conditions to conduct precise early warning of food detection, and then tried to introduce environmental data as exogenous variables into the risk prediction model, such as combining weather parameters such as temperature and humidity with historical risk index data, so as to more comprehensively reflect the dynamic changes of food safety risks. However, there are few related studies disclosed. Based on this, the present technical solution proposes a food safety risk prediction method and system based on environmental variables. The solution comprehensively considers the pre-packaged pastry detection data (including contamination rate, virulence gene score, drug resistance index, vomiting type index) and historical monitoring data, and also introduces environmental data. Through data collection, standardization processing, risk index construction and ARIMAX model prediction, it provides better predictions for pastry detection early warning and more reference risk predictions for detection planners, so that they can be more targeted and forward-looking when formulating monitoring plans. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to propose a data-driven pastry detection and early warning method and its application, which has comprehensive consideration of influencing factors, good early warning reference and high historical data reuse value.
[0006] In order to achieve the above technical objectives, the technical solution adopted by the present invention is:
[0007] A data-driven pastry detection and early warning method, comprising:
[0008] S01. Build a test information database to collect test data from sampling and testing of cakes;
[0009] S02. Construct a comprehensive risk index model for assessing pastry risks based on the test information database;
[0010] S03. Based on the comprehensive risk index model, environmental variables are introduced as exogenous variables to establish an ARIMAX model for risk prediction, and then the model is fitted and optimized;
[0011] S04. Use the fitted and optimized ARIMAX model to conduct pastry detection and early warning to evaluate the risk warning level of pastries under different environmental scenarios.
[0012] As a possible implementation, further, in this solution S01, the detection data includes detection basic data, sampling environment data and detection result data;
[0013] The basic data for testing include the geographical location, sampling time, sampling date, and product batch of the sample when it was collected;
[0014] The sampling environment data includes one or more of the temperature, humidity, and rainfall of the area where the sample is located when the sample is sampled;
[0015] The test result data includes: the detection of Bacillus cereus in the sample, the colony count of Bacillus cereus corresponding to the sample, the number, type and combination of virulence genes carried by Bacillus cereus, the contamination rate index, the virulence gene score, the drug resistance index and the vomiting type index; the types of virulence genes include diarrhea type and vomiting type;
[0016] Among them, each sample obtained by sampling has a unique ID, and its corresponding basic detection data, detection process data and detection result data are all collected and associated with the sample.
[0017] As a possible implementation, further, in the test result data described in this solution, the colony count is the colony count data obtained after the original colony count data is logarithmically transformed and normalized, and its formula is defined as follows:
[0018]
[0019] in, is the normalized colony count data, C iis the original colony count data of the i-th sample, log(C i +1) is the logarithmic transformation of the colony count of each sample; min(log(C+1)) is the minimum value of the data obtained after logarithmic transformation of all samples; max(log(C+1)) is the maximum value of the data obtained after logarithmic transformation of all samples;
[0020] The humidity, temperature, and rainfall data in the environmental data are generated by normalizing or Z-score standardization of the corresponding original data.
[0021] As a preferred embodiment, preferably, in the test result data of this solution, the calculation formula of the contamination rate index P is defined as follows:
[0022]
[0023] Among them, N pos N is the number of samples detected with Bacillus cereus within the preset time period and / or preset area. total The total number of samples within a preset time period and / or preset area;
[0024] The calculation formula of the virulence gene score VG is defined as follows:
[0025]
[0026] Among them, VG i is the virulence gene score of sample i, m is the total number of samples, g ij ∈{0,1}, which represents the detection result of sample i for virulence gene j; w j is the risk weight of the jth virulence gene;
[0027] The calculation formula of the drug resistance index AR is defined as follows:
[0028]
[0029] Among them, AR i is the drug resistance index of sample i, r ik ∈{0,0.5,1}, which correspond to the sensitive, intermediate, and resistant states of antibiotic k, respectively; n is the total number of antibiotics tested for resistance to Bacillus cereus;
[0030] The vomiting type index ET calculation formula is defined as follows:
[0031]
[0032] Among them, ET i is the vomiting index score of sample i, m is the total number of samples, gij ∈{0,1}, which is the detection result of the j-th vomiting virulence gene of sample i, v i is the risk weight of the j-th vomiting virulence gene.
[0033] As a preferred embodiment, preferably, this solution S01 also includes: indexing the data in the detection information database so that the detection basic data, sampling environment data and / or detection result data corresponding to the detection sample have corresponding index information entries.
[0034] As a preferred embodiment, preferably, this solution S02 includes:
[0035] S021. Based on the test result data of samples in the test information database, a comprehensive risk index model for assessing pastry risk is constructed, which is defined as follows:
[0036] RI=αP+βVG+γAR+δET
[0037] Among them, RI is the comprehensive risk index, P is the contamination rate, which is used to reflect the probability of the occurrence of Bacillus cereus in the sample, VG is the virulence gene score, AR is the drug resistance index, and ET is the vomiting type index; α, β, γ, and δ are the weight parameters of the contamination rate, virulence gene score, drug resistance index, and vomiting type index, respectively.
[0038] As a preferred embodiment, preferably, this solution S03 includes:
[0039] S031. Based on the comprehensive risk index model, taking time periods as the benchmark, a comprehensive risk index model for time periods is integrated, which is defined as follows:
[0040] RI t =αP t +βVG t +γAR t +δET t
[0041] Among them, RI t is the comprehensive risk index in time period t, P t is the average pollution rate in time period t, VG t is the average virulence gene score in time period t, AR t is the average drug resistance index in time period t, ET t is the average vomiting index in time period t; α, β, γ, and δ are the weight parameters of contamination rate, virulence gene score, drug resistance index, and vomiting index, respectively;
[0042] S032. Introduce environmental variables as exogenous variables into the comprehensive risk index model and establish an ARIMAX model for risk prediction, which is defined as follows:
[0043]
[0044] Among them, RI t , RI t-1 are the comprehensive risk indices at time t and t-1 respectively, c is a constant term, which is used to represent the benchmark risk level, is the autoregressive coefficient, which represents the risk index RI at the first p moments t-1 Current risk index RI t The influence of , where i = 1, 2, ... p; θ j is the moving average coefficient, which reflects the error term ∈ in the first q moments t-j Impact on current risk, where j = 1, 2, ..., q; X k,t is the value of the kth environmental variable at time t, which includes X 1,t : Temperature T t 、X 2,t :Humidity H t 、X 3,t : Rainfall Rn t , where k = 1, 2, ..., K; β k Corresponding to environment variable X k,t The impact coefficient reflects the environmental factors on the risk index RI t The marginal impact of t is the white noise error term;
[0045] S033, use maximum likelihood estimation MLE or least squares method to estimate parameter c, ,θ j , β k , and then transform the ARIMAX model into the following:
[0046]
[0047] Where c is a constant term, which is used to represent the baseline risk level; is the risk index RI of the previous n periods t-n Current risk index RI t The influence of θ n is the influence of the error in the first n periods, β1, β2, and β3 are the temperature T t 、Humidity H t , rainfall Rn t Current risk index RI t When the temperature T is not introduced t 、Humidity H tand / or rainfall Rn t When used as environmental variables, β1, β2 and / or β3 are 0, otherwise they are 1; ∈ t is the white noise error term.
[0048] As a preferred embodiment, preferably, this solution S04 includes:
[0049] The risk classification threshold is calculated based on historical risk index data and is defined as follows:
[0050] T low =μ RI -kσ RI
[0051] T hig h =μ RI +kσ RI
[0052] Among them, μ RI is the historical risk index mean within the preset time period, σ RI is the standard deviation, k is the sensitivity adjustment coefficient, T low is the lower limit threshold of risk classification, T hig h is the upper threshold of risk classification;
[0053] Use the ARIMAX model to predict the risk index RI at future time t t and risk classification threshold T low 、T hig h Compare and evaluate the risk warning level of pastries under different environmental scenarios.
[0054] Based on the above, this solution also proposes a food inspection and monitoring planning method, which applies the above-mentioned data-driven pastry detection and early warning method.
[0055] As a preferred embodiment, the food inspection and monitoring planning method of this solution preferably includes:
[0056] Obtain the time period of the monitoring plan, retrieve the inspection data of pastry sampling and inspection in the corresponding time period of the historical year from the inspection information database, and then import it into the ARIMAX model to predict the risk index RI of the monitoring plan time period t ;
[0057] Risk Index RI t Compared with the preset risk classification threshold T low 、T hig h Compare and evaluate the risk warning level of pastries under different environmental scenarios;
[0058] Build monitoring planning projects based on risk warning levels.
[0059] Based on the above, this solution also proposes a clinical medication guidance method which applies the above-mentioned data-driven pastry detection and early warning method; it includes:
[0060] A01. Obtain food intake information of the food poisoning patient. If the patient has consumed pastries, obtain the time of pastry ingestion or the date the pastries were released, and generate date feature information.
[0061] A02. Obtain the risk warning level for the corresponding time based on the date feature information, and extract the test data of the pastry sampling test on that date from the test information database.
[0062] A03. Obtain the probability of Bacillus cereus appearing in the corresponding sample from the test data. VG is the virulence gene score, AR is the drug resistance index, and ET is the vomiting type index to obtain the drug resistance spectrum and virulence gene information as reference information for medication.
[0063] Based on the above, this solution also proposes a data-driven pastry detection and early warning system, which includes:
[0064] A data server is used to build a test information database and collect test data from sampling and testing of cakes;
[0065] A model building module is used to retrieve the test data from the test information database and then build a comprehensive risk index model for assessing the risk of pastries;
[0066] The risk prediction module is used to introduce environmental variables as exogenous variables based on the comprehensive risk index model, establish an ARIMAX model for risk prediction, and then perform fitting and optimization processing on it;
[0067] The risk assessment module is used to perform pastry detection and early warning using the fitted and optimized ARIMAX model to evaluate the risk warning level of pastries under different environmental scenarios.
[0068] The present invention, using the above-mentioned technical solution, has the following advantages over the prior art: This solution reuses historical test data to construct a comprehensive risk index model, then introduces environmental variables as exogenous variables to establish an ARIMAX model for risk prediction. By integrating the comprehensive risk index obtained by fitting the historical test data with environmental variables at a preset future time, this model provides early warning guidance for pastry testing risks in the future. Regarding data aggregation, this solution leverages the comprehensive nature of data collection and integration. In addition to traditional food testing data, this solution also simultaneously collects environmental parameter data that matches the sample collection time and region, ensuring data connectivity and temporal and spatial consistency. Regarding data selection, this solution standardizes colony count data, including data, through data cleaning, logarithmic transformation, and normalization, enabling multiple data indicators to be compared and comprehensively analyzed on the same scale. Regarding the multidimensional evaluation of the comprehensive risk index, this solution proposes constructing a comprehensive risk index (RI) based on contamination rate, virulence gene score, drug resistance index, and vomiting type index. A weighted average approach is used to comprehensively evaluate these different indicators, making the risk assessment more comprehensive and objective. On the basis of the above, this solution introduces the ARIMAX model prediction of environmental variables. Based on the traditional time series model, it takes environmental variables such as temperature, humidity, and rainfall as exogenous inputs to construct an ARIMAX model to achieve dynamic prediction of future risk indexes. Through scenario simulation, the ARIMAX model obtained by this solution can estimate the risk level under different environmental conditions, providing more accurate early warning information and decision-making basis for regulatory authorities and production enterprises. In terms of early warning, this solution can realize automatic early warning triggering by constructing a closed loop of risk classification and early warning response mechanism, making judgments based on the predicted risk index and the preset risk classification threshold (red, yellow, and green). In terms of time scale, this solution can combine monitoring results of different time granularities such as day, week, and month to propose flexible sampling and emergency response strategies, forming a closed-loop monitoring system from data collection to risk feedback.
[0069] In summary, this scheme not only improves the accuracy of pastry food safety risk assessment through deep integration of multi-source data and dynamic risk prediction based on environmental variables, but also enhances the response speed and practicality of the early warning system in practical applications, which is of great significance for the prevention and control of food safety risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order 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. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0071] Figure 1 This is a schematic diagram of the implementation process of the data-driven pastry detection and early warning method of this program.
[0072] Figure 2 These are characterization diagrams of the Bacillus cereus mentioned in this scheme, wherein Figure A is a colony diagram of Bacillus cereus cultured in a culture dish, and Figure B is a microscopic observation diagram of Bacillus cereus under a microscope.
[0073] Figure 3 This is a schematic diagram of the unit module connection of the data-driven pastry detection and early warning system in this scheme. DETAILED DESCRIPTION
[0074] The present invention will be described in further detail below with reference to the accompanying drawings and examples. It is particularly noted that the following examples are intended only to illustrate the present invention and are not intended to limit the scope of the present invention. Similarly, the following examples are only some embodiments of the present invention and are not intended to be exhaustive. All other embodiments obtained by those of ordinary skill in the art without creative effort are intended to fall within the scope of protection of the present invention.
[0075] like Figure 1 As shown, this embodiment provides a data-driven pastry detection and early warning method, which includes:
[0076] S01. Build a test information database to collect test data from sampling and testing of cakes;
[0077] S02. Construct a comprehensive risk index model for assessing pastry risks based on the test information database;
[0078] S03. Based on the comprehensive risk index model, environmental variables are introduced as exogenous variables to establish an ARIMAX model for risk prediction, and then the model is fitted and optimized;
[0079] S04. Use the fitted and optimized ARIMAX model to conduct pastry detection and early warning to evaluate the risk warning level of pastries under different environmental scenarios.
[0080] In this solution S01, the test data includes basic test data, sampling environment data, and test result data. The basic test data includes the geographical location, sampling time, sampling date, and product batch of the sample at the time of sampling; the sampling environment data includes one or more of the temperature, humidity, and rainfall in the area at the time of sampling; and the test result data includes: the detection of Bacillus cereus in the sample, the colony count of Bacillus cereus corresponding to the sample, the number, type, and combination of virulence genes carried by Bacillus cereus, the contamination rate index, the virulence gene score, the drug resistance index, and the vomiting type index; the types of virulence genes include diarrhea type and vomiting type.
[0081] In order to improve the systematicness and orderliness of data collection, each sample obtained by this scheme has a unique ID, and its corresponding basic test data, test process data and test result data are all collected and associated with the sample.
[0082] Figure 2 These are characterization diagrams of the Bacillus cereus mentioned in this scheme, wherein Figure A is a colony diagram of Bacillus cereus cultured in a culture dish, and Figure B is a microscopic observation diagram of Bacillus cereus under a microscope.
[0083] In order to facilitate the conversion of test result data into the same scale for comprehensive analysis and avoid the problem of increased errors caused by some abnormal data, in this scheme, during the sampling process, 3-5 specimens can be taken from the same sample, and then the test results that deviate from the mean by more than a preset threshold (for example, the deviation from the mean by more than 30%) are eliminated as error items in the test results to achieve error data cleaning, and finally the mean of the test results of the remaining samples is taken as the reference test result. At the same time, the test results of the original samples are also retained synchronously.
[0084] In terms of data conversion and unified scale, as a possible implementation method, further, in the test result data described in this solution, the colony count is the colony count data obtained after the original colony count data is logarithmically transformed and normalized, and its formula is defined as follows:
[0085]
[0086] in, is the normalized colony count data, C i is the original colony count data of the i-th sample, log(C i+1) is the logarithmic transformation of the colony count of each sample; min(log(C+1)) is the minimum value of the data obtained after logarithmic transformation of all samples; max(log(C+1)) is the maximum value of the data obtained after logarithmic transformation of all samples; when performing data conversion on colony counts, all samples collected at the same time and place are regarded as a sample group, and then the colony counts in the same sample group are used as references for data conversion and unified scale.
[0087] In addition, during data collection and aggregation, the humidity, temperature, and rainfall data in the environmental data may also be generated by normalizing or Z-score standardization of the corresponding original data.
[0088] In terms of conversion and calculation of test result indicators, as a preferred embodiment, preferably, in the test result data described in this solution, the calculation formula of the contamination rate indicator P is defined as follows:
[0089]
[0090] Among them, N pos N is the number of samples detected with Bacillus cereus within the preset time period and / or preset area. total The total number of samples within a preset time period and / or preset area;
[0091] The calculation formula of the virulence gene score VG is defined as follows:
[0092]
[0093] Among them, VG i is the virulence gene score of sample i, m is the total number of samples, g ij ∈{0,1}, which represents the detection result of sample i for virulence gene j; w j is the risk weight of the jth virulence gene;
[0094] The calculation formula of the drug resistance index AR is defined as follows:
[0095]
[0096] Among them, AR i is the drug resistance index of sample i, r ik ∈{0,0.5,1}, which correspond to the sensitive, intermediate, and resistant states of antibiotic k, respectively; n is the total number of antibiotics tested for resistance to Bacillus cereus;
[0097] The vomiting type index ET calculation formula is defined as follows:
[0098]
[0099] Among them, ET i is the vomiting index score of sample i, m is the total number of samples, g ij ∈{0,1}, which is the detection result of the j-th vomiting virulence gene of sample i, v i is the risk weight of the j-th vomiting virulence gene.
[0100] Among them, in order to facilitate data retrieval and improve the retrieval efficiency and flexibility of historical data, as a preferred implementation method, preferably, this solution S01 also includes: indexing the data in the detection information database so that the detection basic data, sampling environment data and / or detection result data corresponding to the detection sample have corresponding index information entries.
[0101] In terms of constructing a comprehensive risk index model, as a preferred implementation method, preferably, this solution S02 includes:
[0102] S021. Based on the test result data of samples in the test information database, a comprehensive risk index model for assessing pastry risk is constructed, which is defined as follows:
[0103] RI=αP+βVG+γAR+δET
[0104] Among them, RI is the comprehensive risk index, P is the contamination rate, which is used to reflect the probability of the occurrence of Bacillus cereus in the sample, VG is the virulence gene score, AR is the drug resistance index, and ET is the vomiting type index; α, β, γ, and δ are the weight parameters of the contamination rate, virulence gene score, drug resistance index, and vomiting type index, respectively.
[0105] This plan constructs a comprehensive risk index model and uses the contamination rate (the so-called calculation object of samples collected from the same sample group or the same time period and the same area) in historical test results, virulence gene score, drug resistance index, and vomiting type index as parameters for comprehensive risk index assessment. This not only makes risk assessment more comprehensive and observable, but also can improve the reliability of subsequent risk prediction when considering multiple factors.
[0106] Based on the constructed comprehensive risk index model, as an example of a further preferred implementation based thereon, this solution S03 includes:
[0107] S031. Based on the comprehensive risk index model, taking time periods as the benchmark, a comprehensive risk index model for time periods is integrated, which is defined as follows:
[0108] RI t =αP t +βVG t +γAR t +δETt
[0109] Among them, RI t is the comprehensive risk index in time period t, P t is the average pollution rate in time period t, VG t is the average virulence gene score in time period t, AR t is the average drug resistance index in time period t, ET t is the average vomiting index in time period t; α, β, γ, and δ are the weight parameters of contamination rate, virulence gene score, drug resistance index, and vomiting index, respectively;
[0110] S032. Introduce environmental variables as exogenous variables into the comprehensive risk index model and establish an ARIMAX model for risk prediction, which is defined as follows:
[0111]
[0112] Among them, RI t , RI t-1 are the comprehensive risk indices at time t and t-1 respectively, c is a constant term, which is used to represent the benchmark risk level, is the autoregressive coefficient, which represents the risk index RI at the first p moments t-1 Current risk index RI t The influence of , where i = 1, 2, ... p; θ j is the moving average coefficient, which reflects the error term ∈ in the first q moments t-j Impact on current risk, where j = 1, 2, ..., q; X k,t is the value of the kth environmental variable at time t, which includes X 1,t : Temperature T t 、X 2,t :Humidity H t 、X 3,t : Rainfall Rn t , where k = 1, 2, ..., K; β k Corresponding to environment variable X k,t The impact coefficient reflects the environmental factors on the risk index RI t The marginal impact of t is the white noise error term;
[0113] S033, use maximum likelihood estimation MLE or least squares method to estimate parameter c, θ j , β k , and then transform the ARIMAX model into the following:
[0114]
[0115] Where c is a constant term, which is used to represent the baseline risk level; is the risk index RI of the previous n periods t-n Current risk index RI t The influence of θ n is the influence of the error in the first n periods, β1, β2, and β3 are the temperature T t 、Humidity H t , rainfall Rn t Current risk index RI t When the temperature T is not introduced t 、Humidity H t and / or rainfall Rn t When used as environmental variables, β1, β2 and / or β3 are 0, otherwise they are 1; ∈ t is the white noise error term.
[0116] Regarding risk level determination, as a preferred implementation method, preferably, this solution S04 includes:
[0117] The risk classification threshold is calculated based on historical risk index data and is defined as follows:
[0118] T low =μ RI -kσ RI
[0119] T hig h =μ RI +kσ RI
[0120] Among them, μ RI is the historical risk index mean within the preset time period, σ RI is the standard deviation, k is the sensitivity adjustment coefficient, T low is the lower limit threshold of risk classification, T hig h is the upper threshold of risk classification;
[0121] Use the ARIMAX model to predict the risk index RI at future time t t and risk classification threshold T low 、T hig h Compare and evaluate the risk warning level of pastries under different environmental scenarios.
[0122] To further explain this solution, the following uses the day as the time granularity to further elaborate on this solution. The content related to simple data integration will not be further analyzed:
[0123] Assume that on February 1, 2025, samples are taken from pastry sales outlets in a certain area of a certain place, and then after testing, the average contamination rate P t The average virulence gene score VG is 20. t The average drug resistance index AR was 3.2. t The average vomiting index ET was 0.85. t is 0.15; when the weight parameters α, β, γ, and δ of the contamination rate, virulence gene score, drug resistance index, and vomiting type index are 0.4, 0.3, 0.2, and 0.1 respectively, the comprehensive risk index RI t For: RI t =0.4×20+0.3×3.2+0.2×0.85+0.1×0.15=9.145
[0124] In this case, the comprehensive risk index RI obtained by sampling pastry sales points in a certain area of a certain place on February 1, 2025 is t Recorded as 9.145. The comprehensive risk index RI t Stored as historical data for subsequent prediction model use, a set of historical data sets about comprehensive risk index is obtained, namely {RI t-n , RI t-n+1 ,……RI t-1 , RI t}.
[0125] In the ARIMAX model, the data of the comprehensive risk index historical data set is reused to obtain the comprehensive risk index RI. t The sequence is the independent variable and is connected to the environmental data. Assume that the risk index sequence calculated from the detection data of several consecutive days is RI t-3 , RI t-2 , RI t-1 , RI t , and the corresponding ambient temperature T on that day t 、Humidity H t (When only temperature and humidity are considered, β3=0); fit the ARIMAX model using historical data, and use maximum likelihood estimation (MLE) or least squares method to estimate parameters c, ,θ j , β k , assuming that in the fitting results, c = -5, θ j =0.3, β1=0.1, β2=0.05, then use the most recently calculated comprehensive risk index RI t And historical error (assuming the error between the most recent forecast value and the actual value ∈ t =0.5), by collecting the environmental parameters (temperature Tt+1 、Humidity H t+1 ), substitute it into the ARIMAX model to predict the comprehensive risk index RI at the future time point t+1 t+1 , which is calculated as follows:
[0126] RI t+1 =-5+0.6×RI t +0.3×∈ t +0.1×T t+1 +0.05×H t+1 +0×Rn t+1 +∈ t+1
[0127] Among them, the comprehensive risk index RI calculated in the last time t =9.145, assuming that the temperature T t+1 =29℃, humidity H t+1 =78%; then the calculation is:
[0128] RI t+1 =-5+0.6×9.145+0.3×0.5+0.1×29+0.05×78+∈ t+1
[0129] If the error term is assumed to be 0 on average, the comprehensive risk index RI predicted at the future time point t+1 is t+1 =7.437.
[0130] In the risk classification, assuming that the risk classification lower limit threshold T low is 5, T hig h The upper threshold of risk classification is 8, then the comprehensive risk index RI predicted at the future time point t+1 is t+1 =7.437, which is between the lower and upper limits. In this case, when planning food inspection and monitoring for the area, the predicted risk index and the preset risk grading thresholds (red, yellow, and green) can be used to determine the pastry sampling and inspection plan to be followed at the future time point t+1. When constructing inspection plans, different inspection plans can be pre-built based on different risks, corresponding to different risk levels. Subsequently, different plans can be called up based on the predicted risk grading, thereby achieving automated early warning triggering.
[0131] In addition to the above-mentioned daily time granularity, this plan can also further form index evaluations with weekly, monthly and other time granularities to guide the formulation of detection planning plans.
[0132] Based on the above, this solution also proposes a food inspection and monitoring planning method, which applies the above-mentioned data-driven pastry detection and early warning method; and as a preferred embodiment, preferably, the food inspection and monitoring planning method of this solution includes:
[0133] Obtain the time period of the monitoring plan, retrieve the inspection data of pastry sampling and inspection in the corresponding time period of the historical year from the inspection information database, and then import it into the ARIMAX model to predict the risk index RI of the monitoring plan time period t ;
[0134] Risk Index RI t Compared with the preset risk classification threshold T low 、T hig h Compare and evaluate the risk warning level of pastries under different environmental scenarios;
[0135] Build monitoring planning projects based on risk warning levels.
[0136] In addition to the above applications, this scheme can also use the resistance spectrum and virulence gene information as reference information based on the test results in different periods, combined with the probability of Bacillus cereus in the sample, VG is the virulence gene score, AR is the resistance index, ET is the vomiting type index, etc., and use it as a reference for clinical treatment in food poisoning pathology to guide medical personnel to reasonably select and use drugs.
[0137] For example, when the test results of Bacillus cereus in a sample indicate the presence of highly resistant strains, such as those resistant to penicillin, ampicillin, cefotaxime, etc., early avoidance can be carried out clinically to improve the accuracy and specificity of food poisoning treatment.
[0138] Combine Figure 3 As shown, based on the above, this solution also proposes a data-driven pastry detection and early warning system, which includes:
[0139] A data server is used to build a test information database and collect test data from sampling and testing of cakes;
[0140] A model building module is used to retrieve the test data from the test information database and then build a comprehensive risk index model for assessing the risk of pastries;
[0141] The risk prediction module is used to introduce environmental variables as exogenous variables based on the comprehensive risk index model, establish an ARIMAX model for risk prediction, and then perform fitting and optimization processing on it;
[0142] The risk assessment module is used to perform pastry detection and early warning using the fitted and optimized ARIMAX model to evaluate the risk warning level of pastries under different environmental scenarios.
[0143] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0144] If the integrated unit is implemented in the form of 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, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the various embodiments of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0145] The above descriptions are only some embodiments of the present invention and do not limit the scope of protection of the present invention. Any equivalent device or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A data-driven pastry detection and early warning method, characterized in that: It includes: S01. Build a test information database to collect test data from sampling and testing of cakes; S02. Construct a comprehensive risk index model for assessing pastry risks based on the test information database; S03. Based on the comprehensive risk index model, environmental variables are introduced as exogenous variables to establish an ARIMAX model for risk prediction, and then the model is fitted and optimized; S04. Use the fitted and optimized ARIMAX model to conduct pastry detection and early warning to evaluate the risk warning level of pastries under different environmental scenarios.
2. The data-driven pastry detection and early warning method according to claim 1, characterized in that: In S01, the detection data includes detection basic data, sampling environment data and detection result data; The basic data for testing include the geographical location, sampling time, sampling date, and product batch of the sample when it was collected; The sampling environment data includes one or more of the temperature, humidity, and rainfall of the area where the sample is located when the sample is sampled; The test result data includes: the detection of Bacillus cereus in the sample, the colony count of Bacillus cereus corresponding to the sample, the number, type and combination of virulence genes carried by Bacillus cereus, the contamination rate index, the virulence gene score, the drug resistance index and the vomiting type index; the types of virulence genes include diarrhea type and vomiting type; Among them, each sample obtained by sampling has a unique ID, and its corresponding basic detection data, detection process data and detection result data are all collected and associated with the sample.
3. The data-driven pastry detection and early warning method according to claim 1, characterized in that: In the test result data, the colony count is the colony count data obtained after logarithmic transformation and normalization of the original colony count data, and its formula is defined as follows: in, is the normalized colony count data, C i is the original colony count data of the i-th sample, log(C i +1) is the logarithmic transformation of the colony count of each sample; min(log(C+1)) is the minimum value of the data obtained after logarithmic transformation of all samples; max(log(C+1)) is the maximum value of the data obtained after logarithmic transformation of all samples; The humidity, temperature, and rainfall data in the environmental data are generated by normalizing or Z-score standardization of the corresponding original data.
4. The data-driven pastry detection and early warning method according to claim 2 or 3, characterized in that: In the test result data, the calculation formula of the contamination rate index P is defined as follows: Among them, N pos N is the number of samples detected with Bacillus cereus within the preset time period and / or preset area. total The total number of samples within a preset time period and / or preset area; The calculation formula of the virulence gene score VG is defined as follows: Among them, VG i is the virulence gene score of sample i, m is the total number of samples, g ij ∈{0,1}, which represents the detection result of sample i for virulence gene j; w j is the risk weight of the jth virulence gene; The calculation formula of the drug resistance index AR is defined as follows: Among them, AR i is the drug resistance index of sample i, r ik ∈{0,0.5,1}, which correspond to the sensitive, intermediate, and resistant states of antibiotic k, respectively; n is the total number of antibiotics tested for resistance to Bacillus cereus; The vomiting type index ET calculation formula is defined as follows: Among them, ET i is the vomiting index score of sample i, m is the total number of samples, g ij ∈{0,1}, which is the detection result of the j-th vomiting virulence gene of sample i, v i is the risk weight of the j-th vomiting virulence gene.
5. The data-driven pastry detection and early warning method according to claim 4, characterized in that: S01 also includes: indexing the data in the test information database so that the test basic data, sampling environment data and / or test result data corresponding to the test sample have corresponding index information entries; S02 includes: S021. Based on the test result data of samples in the test information database, a comprehensive risk index model for assessing pastry risk is constructed, which is defined as follows: RI=αP+βVG+γAR+δET Among them, RI is the comprehensive risk index, P is the contamination rate, which is used to reflect the probability of the occurrence of Bacillus cereus in the sample, VG is the virulence gene score, AR is the drug resistance index, and ET is the vomiting type index; α, β, γ, and δ are the weight parameters of the contamination rate, virulence gene score, drug resistance index, and vomiting type index, respectively.
6. The data-driven pastry detection and early warning method according to claim 5, characterized in that: S03 includes: S031. Based on the comprehensive risk index model, taking time periods as the benchmark, a comprehensive risk index model for time periods is integrated, which is defined as follows: RI t =αP t +βVG t +γAB t +δET t Among them, RI t is the comprehensive risk index in time period t, P t is the average pollution rate in time period t, VG t is the average virulence gene score in time period t, AR t is the average drug resistance index in time period t, ET t is the average vomiting index in time period t; α, β, γ, and δ are the weight parameters of contamination rate, virulence gene score, drug resistance index, and vomiting index, respectively; S032. Introduce environmental variables as exogenous variables into the comprehensive risk index model and establish an ARIMAX model for risk prediction, which is defined as follows: Among them, RI t , RI t-1 are the comprehensive risk indices at time t and t-1 respectively, c is a constant term, which is used to represent the benchmark risk level, is the autoregressive coefficient, which represents the risk index RI at the first p moments t-1 Current risk index RI t The influence of , where i = 1, 2, ... p; θ j is the moving average coefficient, which reflects the error term ∈ in the first q moments t-j Impact on current risk, where j = 1, 2, ..., q; X k,t is the value of the kth environmental variable at time t, which includes X 1,t : Temperature T t 、X 2,t :Humidity H t 、X 3,t : Rainfall Rn t , where k = 1, 2, ..., K; β k Corresponding to environment variable X k,t The impact coefficient reflects the environmental factors on the risk index RI t The marginal impact of t is the white noise error term; S033, use maximum likelihood estimation MLE or least squares method to estimate parameter c, θ j , β k , and then transform the ARIMAX model into the following: Where c is a constant term, which is used to represent the baseline risk level; is the risk index RI of the previous n periods t-n Current risk index RI t The influence of θ n is the influence of the error in the first n periods, β1, β2, and β3 are the temperature T t 、Humidity H t , rainfall Rn t Current risk index RI t When the temperature T is not introduced t 、Humidity H t and / or rainfall Rn t When used as environmental variables, β1, β2 and / or β3 are 0, otherwise they are 1; ∈ t is the white noise error term.
7. The data-driven pastry detection and early warning method according to claim 6, characterized in that: S04 includes: The risk classification threshold is calculated based on historical risk index data and is defined as follows: T low =μ RI -kσ RI T high =μ RI +kσ RI Among them, μ RI is the historical risk index mean within the preset time period, σ RI is the standard deviation, k is the sensitivity adjustment coefficient, T low is the lower limit threshold of risk classification, T high is the upper threshold of risk classification; Use the ARIMAX model to predict the risk index RI at future time t t and risk classification threshold T low 、T high Compare and evaluate the risk warning level of pastries under different environmental scenarios.
8. A food inspection and monitoring planning method, characterized in that: It is applied with the data-driven pastry detection and early warning method according to any one of claims 1 to 7; It includes: Obtain the time period of the monitoring plan, retrieve the inspection data of pastry sampling and inspection in the corresponding time period of the historical year from the inspection information database, and then import it into the ARIMAX model to predict the risk index RI of the monitoring plan time period t ; Risk Index RI t Compared with the preset risk classification threshold T low 、T high Compare and evaluate the risk warning level of pastries under different environmental scenarios; Build monitoring planning projects based on risk warning levels.
9. A clinical medication guidance method, characterized in that: It is applied with the data-driven pastry detection and early warning method according to any one of claims 1 to 7; It includes: A01. Obtain food intake information of the food poisoning patient. If the patient has consumed pastries, obtain the time of pastry ingestion or the date the pastries were released, and generate date feature information. A02. Obtain the risk warning level for the corresponding time based on the date feature information, and extract the test data of the pastry sampling test on that date from the test information database. A03. Obtain the probability of Bacillus cereus appearing in the corresponding sample from the test data. VG is the virulence gene score, AR is the drug resistance index, and ET is the vomiting type index to obtain the drug resistance spectrum and virulence gene information as reference information for medication.
10. A data-driven pastry detection and early warning system, characterized in that: It includes: A data server is used to build a test information database and collect test data from sampling and testing of cakes; A model building module is used to retrieve the test data from the test information database and then build a comprehensive risk index model for assessing the risk of pastries; The risk prediction module is used to introduce environmental variables as exogenous variables based on the comprehensive risk index model, establish an ARIMAX model for risk prediction, and then perform fitting and optimization processing on it; The risk assessment module is used to perform pastry detection and early warning using the fitted and optimized ARIMAX model to evaluate the risk warning level of pastries under different environmental scenarios.