Edible agricultural product quality safety assessment method and system based on localized data integration
By constructing a three-dimensional dynamic evaluation model encompassing time, space, ecology, and society, integrating multi-source heterogeneous data, dynamically allocating weights, and generating a comprehensive evaluation index and risk correction coefficient, the problem of discrepancies between assessment results and actual risks in existing technologies is solved, enabling real-time dynamic assessment and precise supervision of the quality and safety of edible agricultural products.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 深圳市农产品质量安全检验检测中心(深圳市动植物疫病预防控制中心)
- Filing Date
- 2026-04-16
- Publication Date
- 2026-05-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing methods for assessing the quality and safety of edible agricultural products rely on single-dimensional data and static models, which make it difficult to reflect the spatiotemporal dynamic changes in the distribution path of agricultural products, resulting in discrepancies between the assessment results and the actual risks.
By integrating spatiotemporal quality data, ecological resilience data, and social co-governance data, a three-dimensional dynamic evaluation model of spatiotemporal-ecological-social aspects is constructed. The entropy weight method and the coefficient of variation method are used to dynamically allocate weights. Combined with real-time IoT data streams to trigger adaptive weight adjustment, a comprehensive evaluation index and risk correction coefficient are generated to formulate differentiated regulatory strategies and optimal resource allocation schemes.
It enables real-time dynamic assessment of the quality and safety of edible agricultural products, reduces assessment bias, improves the timeliness and accuracy of assessment, and ensures the quality and safety of agricultural products.
Smart Images

Figure CN122022607A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural product quality and safety assessment technology, and in particular to a method and system for assessing the quality and safety of edible agricultural products based on localized data integration. Background Technology
[0002] Current assessments of the quality and safety of edible agricultural products primarily rely on single-dimensional data or static models. Traditional methods often employ laboratory testing data (such as pesticide residues and heavy metal content), sampling records from the distribution process, and enterprise self-inspection reports, generating safety scores through a weighted summation with fixed weights. For example, some regions use a linear model of "pass rate + sampling frequency" or static risk heat maps based on GIS maps, combined with expert experience to set thresholds for grading. The underlying principle focuses on a passive "post-detection - compliance determination" model, with data sources primarily consisting of structured databases, lacking the ability to capture spatiotemporal dynamic features. Ecological resilience assessments often use static indicators from agricultural ecosystem service value accounting, such as soil retention and carbon sequestration capacity. The integration of these indicators with social governance data (such as enterprise credit records and blockchain traceability information) is still in the pilot stage, lacking a cross-dimensional collaborative analysis mechanism. This makes it difficult to reflect the spatiotemporal dynamic changes in agricultural product distribution paths (such as seasonal transportation pollution and regional climate fluctuations), leading to discrepancies between assessment results and actual risks. Summary of the Invention
[0003] This invention aims to at least solve the technical problems existing in the prior art, and in particular, it innovatively proposes a method and system for assessing the quality and safety of edible agricultural products based on localized data integration.
[0004] To achieve the above-mentioned objectives of this invention, this invention provides a method for assessing the quality and safety of edible agricultural products based on localized data integration, the method comprising: S1. Collect spatiotemporal quality data, ecological resilience data, and social co-governance data to form a multi-source heterogeneous dataset; S2. Based on the aforementioned multi-source heterogeneous dataset, construct a three-dimensional dynamic evaluation model encompassing spatiotemporal, ecological, and social aspects; S3. Based on the three-dimensional dynamic evaluation model, dynamic weight allocation and data fusion are performed on the spatiotemporal quality axis, ecological resilience axis, and social co-governance axis to generate a comprehensive evaluation index and risk correction coefficient. S4. Based on the comprehensive evaluation index and risk correction coefficient, formulate differentiated regulatory strategies and optimal resource allocation schemes; S5. Based on the differentiated regulatory strategy and optimal resource allocation scheme, dynamically warn of agricultural product quality and safety risks, and output a visualized two-dimensional comprehensive evaluation report; wherein, the two dimensions include the quality and safety level dimension and the risk warning dimension.
[0005] On the other hand, the present invention also proposes a quality and safety assessment system for edible agricultural products based on localized data integration, the system comprising: processor; Memory used to store processor-executable instructions; The processor is configured to implement the dual-dimensional comprehensive evaluation method for agricultural product quality and safety when executing the executable instructions.
[0006] The beneficial effects of this invention are as follows: This invention integrates spatiotemporal quality data (including spatiotemporal entropy values of agricultural product circulation paths and seasonal pollution risk coefficients), ecological resilience data (quantified based on an agricultural ecosystem service value accounting model), and social co-governance data (including automatic execution records of blockchain smart contracts) to form a multi-source heterogeneous dataset. It then constructs a three-dimensional dynamic evaluation model encompassing spatiotemporal, ecological, and social aspects, effectively solving the problems of single data sources and lagging updates in existing technologies. By dynamically allocating weights for each dimension using the entropy weight method and the coefficient of variation method, combined with a real-time IoT data stream-triggered adaptive weight adjustment mechanism and a sliding window algorithm for rolling calculation, it reflects the spatiotemporal dynamic changes in seasonal transportation pollution and regional climate fluctuations in real time, reducing assessment bias caused by data lag. Simultaneously, it uses the weighted geometric mean method to construct a three-dimensional data fusion function to generate a comprehensive evaluation index, combines the seasonal pollution risk coefficient and ecological resilience threshold to construct a risk correction coefficient, and uses fuzzy clustering analysis to delineate quality and safety level boundaries, achieving a high degree of matching between the assessment results and actual risks. Ultimately, by using a differentiated regulatory strategy library (including a three-dimensional strategy combination of spatiotemporal quality, ecological resilience, and social co-governance) and a multi-objective optimized resource allocation scheme, combined with a dynamic early warning and emergency response system, a closed-loop system of "data integration, dynamic assessment, and precise regulation" is formed. This significantly improves the timeliness, accuracy, and resource utilization efficiency of edible agricultural product quality and safety assessment, effectively reduces actual risk deviations, and ensures the quality and safety of agricultural products.
[0007] 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
[0008] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart of a method for assessing the quality and safety of edible agricultural products based on localized data integration, according to the present invention. Detailed Implementation
[0009] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0010] Example 1 like Figure 1 As shown, a method for assessing the quality and safety of edible agricultural products based on localized data integration is described, the method comprising: S1. Collect spatiotemporal quality data, ecological resilience data, and social co-governance data to form a multi-source heterogeneous dataset; among them, spatiotemporal quality data includes the spatiotemporal entropy value of agricultural product circulation path and seasonal pollution risk coefficient, ecological resilience data is quantified based on agricultural ecosystem service value accounting model, and social co-governance data includes automatic execution records of blockchain smart contracts. In step S1, it is necessary to explain in detail that the collection of spatiotemporal quality data needs to integrate multi-source heterogeneous information. Specifically, this includes: using IoT sensing devices deployed in agricultural production bases, storage centers, transport vehicles, and sales terminals to collect environmental parameters such as geographical coordinates, timestamps, temperature, humidity, and light intensity in real time; combining GPS trajectory data to construct a spatiotemporal matrix of the circulation path; and using the information entropy algorithm to calculate the spatiotemporal entropy value to quantify the uncertainty and complexity of the circulation process. The seasonal pollution risk coefficient is established by performing multiple regression analysis on historical pollution event databases (such as pesticide residue exceeding standards and heavy metal pollution cases) and meteorological data (rainfall, temperature changes, and wind force levels). The coefficient value is dynamically updated quarterly, with a value range of [0,1]. The higher the value, the greater the pollution risk in that season.
[0011] The method for establishing the seasonal pollution probability model in this embodiment is as follows: Stepwise regression analysis is used to screen significant influencing factors. Using a quarter as the time window, the frequency of pollution events over the past 5 years is used as the dependent variable, and the daily average temperature, weekly average rainfall, crop growth cycle stage (e.g., sowing and harvesting periods), distance from surrounding industrial pollution sources, and soil pH are selected as independent variables. Multiple linear regression modeling is performed using SPSS software, yielding the regression equation: Seasonal pollution risk coefficient = 0.032 × daily average temperature + 0.018 × weekly average rainfall + 0.15 × growth cycle stage coefficient (1 for harvesting period, 0.5 for growing period, and 0.2 for sowing period) - 0.025 × pollution source distance + 0.08 × (7 - pH value) + 0.05 (constant term). After model adjustment, R² is 0.78, F-test P < 0.01, and each coefficient passes the t-test (P < 0.05). The calculation results are normalized, compressing the values to the [0,1] interval, where 0 represents no risk and 1 represents extremely high risk. For example, when the average daily temperature is 28℃, the average weekly rainfall is 80mm, it is harvest season, the distance from the pollution source is 3km, and the soil pH is 5.5, substituting into the equation, we get: 0.032×28+0.018×80+0.15×1-0.025×3+0.08×(7-5.5)+0.05=0.896+1.44+0.15-0.075+0.12+0.05=2.581. After normalization (2.581 / 3.2, where 3.2 is the maximum value of historical data), we get 0.806, that is, the pollution risk coefficient for this quarter is 0.806.
[0012] The quantification of ecological resilience data needs to be based on an agricultural ecosystem service value accounting model. This model covers soil conservation value (soil erosion and conservation value calculated by modifying the Universal Soil Loss Equation (USLE)), water conservation value (the water retention and purification value of the ecosystem is measured using the water balance method), and biodiversity maintenance value (based on the Shannon-Wiener index combined with species endangerment level weights). After determining the weights of each subsystem using the Analytic Hierarchy Process (AHP), a weighted sum is obtained to obtain the comprehensive ecological resilience index, which is then standardized to 0-1. The collection of social governance data focuses on records of automatic execution of blockchain smart contracts (such as the on-chain time of agricultural product traceability information, digital signatures of both parties in the transaction, smart contract triggering conditions and execution results), inspection data from regulatory departments (testing items, results, and handling measures), public complaint and reporting information (complaint type, processing time, satisfaction score), and industry association self-regulatory data (enterprise certification qualifications, quality commitment fulfillment status). Distributed data crawling technology and standardized interfaces are used to connect with various data sources, forming a mixed dataset of structured data and unstructured text.
[0013] S2. Based on the aforementioned multi-source heterogeneous dataset, construct a three-dimensional dynamic evaluation model encompassing spatiotemporal, ecological, and social aspects; S3. Based on the three-dimensional dynamic evaluation model, dynamic weight allocation and data fusion are performed on the spatiotemporal quality axis, ecological resilience axis, and social co-governance axis to generate a comprehensive evaluation index and risk correction coefficient. S4. Based on the comprehensive evaluation index and risk correction coefficient, formulate differentiated regulatory strategies and optimal resource allocation schemes; S5. Based on the differentiated regulatory strategy and optimal resource allocation scheme, dynamically warn of agricultural product quality and safety risks, and output a visualized two-dimensional comprehensive evaluation report; wherein, the two dimensions include the quality and safety level dimension and the risk warning dimension.
[0014] In step S5, it is necessary to explain in detail that the dual-dimensional comprehensive evaluation report is presented in the form of an interactive visual dashboard. The left panel displays the quality and safety level dimension information, and uses a radar chart to intuitively display the scores (range 0-100 points) of the three dimensions of spatiotemporal quality, ecological resilience, and social co-governance. Different colors are used to indicate the three levels of quality and safety: high (80-100 points), medium (60-79 points), and low (0-59 points). The comprehensive evaluation index (the result of the weighted geometric mean calculation, rounded to two decimal places) is marked in the center of the radar chart. The right panel presents the risk warning dimension information, using a dynamic heat map overlaid with a GIS map to display the risk level distribution of each monitoring area in real time. Red indicates a level 1 warning (emergency response needs to be initiated immediately), yellow indicates a level 2 warning (monitoring and patrols need to be strengthened), and blue indicates a level 3 warning (routine supervision). A timeline of warning events is set below the heat map, which can trace the number of times each level of warning was triggered, the duration, and the handling status in the past 30 days. The report includes a data drill-down function at the bottom, allowing users to click on any area or warning event to view specific monitoring data for that area (such as pollutant concentration change curves and ecological resilience index fluctuation trends), corresponding regulatory strategies (such as monitoring frequency adjustment records and resource allocation ratios), and emergency response execution details (such as response start time, participating departments, disposal measures, and effect evaluation). This enables a fully visualized presentation of the entire chain, from macro-level assessment to micro-level data tracing.
[0015] As an optional embodiment of the present invention, optionally, in step S2, constructing a spatiotemporal-ecological-social three-dimensional dynamic evaluation model based on the multi-source heterogeneous dataset includes: S201. Based on multi-source heterogeneous datasets, using spatiotemporal entropy calculation models, ecological resilience accounting models, and blockchain smart contract verification models, a three-dimensional initial architecture including spatiotemporal quality axis, ecological resilience axis, and social co-governance axis is constructed, generating a basic model framework including spatiotemporal distribution characteristics of circulation paths, quantitative indicators of ecosystem service value, and social co-governance compliance records. In step S201, it is necessary to explain in detail that the spatiotemporal entropy calculation model of this embodiment adopts the information entropy algorithm to transform the spatiotemporal matrix of agricultural product circulation path (containing the timestamps and geographical coordinates of n nodes) into a probability distribution matrix. The spatiotemporal entropy value H is calculated by the formula H=-∑(pi×log2pi), where pi represents the time proportion of the i-th circulation node in the total path. The higher the entropy value, the greater the uncertainty of the circulation link. The ecological resilience accounting model, based on the weights determined by the analytic hierarchy process (AHP), introduces the Ecological Elasticity Index (EEI), which is calculated by EEI=(Resilience Index×0.4+Resistance Index×0.3+Adaptability Index×0.3). The resilience index is measured by the interannual change rate of vegetation cover, the resistance index is the weighted product of soil organic carbon content and biodiversity index, and the adaptability index is comprehensively evaluated by combining the planting ratio of climate-adaptive crops and the popularization rate of water-saving irrigation technology. The blockchain smart contract verification model uses preset compliance rules (such as traceability information on-chain timeliness ≤ 24 hours, transaction signature verification pass rate ≥ 99%) to logically verify the automatic execution records of smart contracts, generating a compliance score of 0-1, where 1 represents full compliance and 0 represents serious violation. Intermediate values are obtained by summing the products of the number of violations and their weights and then normalizing them. The initial three-dimensional architecture is visualized using a Cartesian coordinate system. The X-axis is the spatiotemporal quality axis (0-100 points, lower spatiotemporal entropy value results in a higher score), the Y-axis is the ecological resilience axis (0-100 points, higher ecological resilience index results in a higher score), and the Z-axis is the social co-governance axis (0-100 points, higher compliance score results in a higher score). Each agricultural product sample corresponds to a coordinate point in the three-dimensional space, forming a preliminary spatial distribution for quality and safety assessment.
[0016] S202. Based on the aforementioned basic model framework, the spatiotemporal entropy value, equivalent value of ecosystem services, and smart contract execution rate are normalized using the Min-Max normalization algorithm, and a multi-source data fusion algorithm that combines principal component analysis and analytic hierarchy process is used to generate a data fusion model. In step S202, it is necessary to explain in detail that the Min-Max standardization algorithm linearly transforms the original data of each dimension to the interval [0,1], with the formula: Standardized value = (Original value - Minimum value) / (Maximum value - Minimum value). The minimum value of the spatiotemporal entropy is taken from the minimum entropy value in historical data (corresponding to the most stable circulation path), and the maximum value is taken from the maximum entropy value (corresponding to the most complex circulation path). The minimum value of the ecosystem service value equivalent is set to 0 (completely degraded ecosystem), and the maximum value is taken from the highest historical ecosystem service value equivalent in the region. The minimum value of the smart contract execution rate is 0 (completely unexecuted), and the maximum value is 100% (completely executed). After eliminating dimensional differences through this algorithm, Principal Component Analysis (PCA) is used to reduce the dimensionality of the standardized multi-source data, extracting principal components with a cumulative contribution rate ≥85% as comprehensive variables. A judgment matrix is then constructed using the Analytic Hierarchy Process (AHP). Fifteen experts in agricultural ecology, food safety supervision, and information technology are invited to conduct pairwise comparisons and scores of the importance of each principal component. After passing the consistency test (CR < 0.1), the weights of each principal component are determined, and finally, a data fusion model is constructed through weighted summation. For example, three principal components F1, F2, and F3 are extracted by PCA, with variance contribution rates of 45%, 30%, and 15%, respectively. After adjustment by AHP, their weights are 0.5, 0.3, and 0.2, respectively. Then, the data fusion value = 0.5×F1 + 0.3×F2 + 0.2×F3, thus achieving the organic integration of multi-source heterogeneous data.
[0017] S203. Based on the data fusion model, the entropy weight method is used to dynamically calculate the data volatility weight of each dimension, and the weight allocation ratio of seasonal pollution risk coefficient and ecological resilience threshold is adjusted by combining the coefficient of variation method to generate a dynamic weight allocation scheme for the spatiotemporal quality axis, ecological resilience axis and social co-governance axis. The expression for dynamically calculating the volatility weights of each dimension of data using the entropy weight method is as follows: in, Indicates the first Dimensions ( =1, 2, 3 correspond to the dynamic weights of the spatiotemporal quality axis, the ecological resilience axis, and the social co-governance axis, respectively. Indicates the first Information entropy of dimensions Indicates the first The coefficient of variation of dimensions, Indicates the seasonal pollution risk coefficient ( =1) or ecological resilience threshold ( The correction factor (when = 2) has a value range of [1.0, 1.5]. Represents the total number of samples. Indicates the standardized first The sample in the Dimensional proportions Indicates the first The sample at the th Standardized data values of dimensions Indicates the first Standard deviation of dimensional data Indicates the first The mean of the dimensional data.
[0018] In step S203, it is important to explain in detail that this embodiment first reflects the dispersion of the data by calculating the information entropy of each dimension. The smaller the information entropy, the greater the degree of variation of the data in that dimension, the richer the information it contains, and the higher its weight should be. Specifically, for the first dimension... Dimension, first calculate the first The proportion of a sample's standardized data value to the total number of standardized data values of all samples in that dimension. Then calculate the information entropy according to the information entropy formula. Then, the entropy weight of this dimension is calculated. Initially, weights based on data volatility were obtained. Next, the coefficient of variation method was introduced to adjust the entropy weights by calculating the coefficients of variation for each dimension of the data, thereby enhancing the sensitivity of the weights to data dispersion. Finally, correction factors were set for the two key regulating factors: the seasonal pollution risk coefficient and the ecological resilience threshold. When the seasonal pollution risk coefficient is in the high-risk range of [0.7, 1] or the ecological resilience index is below the low-resilience range of 0.3, A value of 1.5 increases the weight of the corresponding dimension (spatiotemporal quality axis or ecological resilience axis); when the risk coefficient is in the medium-risk range of [0.3, 0.7) or the ecological resilience index is in the medium range of [0.3, 0.7), The value is 1.2; when the risk coefficient is below 0.3 or the ecological resilience index is above 0.7, The value is set to 1.0. Through a dynamic weight allocation scheme, the model can adaptively adjust the importance of each assessment dimension under different risk scenarios. For example, during seasons with high pollution risk, the weight of the spatiotemporal quality axis will be significantly increased to strengthen risk control in the circulation process.
[0019] Regarding the dynamic weight allocation scheme for generating the spatiotemporal quality axis, ecological resilience axis, and social co-governance axis, it should be noted that this scheme achieves real-time adjustment through the establishment of a dynamic weight update mechanism. The system automatically triggers a weight calculation process every 72 hours, recalculating the information entropy and coefficient of variation for each dimension based on the latest collected multi-source heterogeneous data (including circulation node data from the past 3 days, ecological monitoring data, and contract execution records). A manual trigger interface is also provided, allowing the weight recalculation process to be initiated immediately when regulatory authorities receive major complaints (such as mass food safety incidents) or sudden changes in the ecological environment (such as abnormal soil indicators caused by extreme weather). The dynamic weight allocation results are synchronized to the three-dimensional dynamic evaluation model in real time, ensuring that the comprehensive evaluation index can promptly reflect the current quality and safety situation. For example, during the high-temperature summer period, if three consecutive complaints of excessive pesticide residues occur in a major vegetable-producing area, the system will automatically identify increased volatility in the social co-governance axis data. Using the entropy weight method, the weight of this dimension will be increased from the usual 0.3 to 0.45. Simultaneously, the weight of the ecological resilience axis will be fine-tuned using the coefficient of variation method, ultimately forming a dynamic evaluation system that places greater emphasis on social supervision and feedback.
[0020] S204. Based on the dynamic weight allocation scheme, the K-fold cross-validation method is used to verify the model prediction accuracy. The sensitivity of each dimension index is analyzed through Monte Carlo simulation. The genetic algorithm is used to iteratively optimize the weight coefficients and threshold parameters to generate a verified and optimized spatiotemporal-ecological-social three-dimensional dynamic evaluation model with adaptive adjustment capabilities.
[0021] In step S204, the K-fold cross-validation method and genetic algorithm require detailed explanation. The K-fold cross-validation method randomly divides the historical dataset (containing over 100,000 agricultural product quality and safety assessment samples from the past 3 years, each sample containing complete three-dimensional data and actual quality and safety level labels) into K=10 mutually exclusive subsets. Nine subsets are used as the training set, and one subset as the test set. This process is repeated 10 times, using a different test set each time. The average accuracy of the 10 validation results is then used as the evaluation metric for model prediction performance. In this embodiment, this method is used to verify the model's stability under different data distributions. When the average prediction accuracy is ≥92% and the standard deviation is ≤3%, the model is considered to have initially passed validation. Monte Carlo simulation analysis adds ±15% random perturbation to each dimension indicator (such as spatiotemporal entropy, ecological resilience index, and compliance score), repeats the simulation 1000 times, and observes the fluctuation range of the comprehensive evaluation index. A larger fluctuation range indicates a higher sensitivity of that dimension indicator to the evaluation results. For example, if the average fluctuation of the comprehensive evaluation index is 12% after the perturbation of the spatiotemporal quality axis index, while the average fluctuation of the social co-governance axis index is 5%, it indicates that the spatiotemporal quality axis is more sensitive, and the accuracy of its data collection needs to be emphasized in model optimization. During the genetic algorithm optimization process, the weight coefficients in the dynamic weight allocation scheme (spatiotemporal quality axis weight w1, ecological resilience axis weight w2, and social co-governance axis weight w3, satisfying w1+w2+w3=1) and the threshold parameters of each dimension (such as the spatiotemporal entropy safety threshold and the ecological resilience index warning threshold) are encoded into a chromosome of length 6 (w1, w2, w3, T1, T2, T3), where T1-T3 are the key thresholds for the three dimensions. A fitness function is constructed based on the model prediction accuracy (objective function 1) and the mean squared error between the evaluation results and the actual risk level (objective function 2, which needs to be minimized). The initial population size is set to 50, the crossover probability is 0.7, and the mutation probability is 0.1. After 100 generations of iterative evolution, the chromosome with the highest fitness is selected as the optimal parameter combination. For example, after optimization by the genetic algorithm, the optimal weight combination is obtained as w1=0.42, w2=0.35, w3=0.23, the spatiotemporal entropy safety threshold T1=0.65 (entropy value below this value indicates low risk), the ecological resilience index warning threshold T2=0.4 (index below this value triggers a warning), and the social co-governance compliance threshold T3=0.85 (score below this value requires strengthened supervision). This enables the model to maintain high prediction accuracy while significantly reducing its oversensitivity to extreme data and achieving adaptive adjustment capabilities.
[0022] As an optional embodiment of the present invention, optionally, in step S3, based on the three-dimensional dynamic evaluation model, dynamic weight allocation and data fusion are performed on the spatiotemporal quality axis, ecological resilience axis, and social co-governance axis to generate a comprehensive evaluation index and risk correction coefficient, including: S301. Based on the dynamic weight allocation scheme of the three-dimensional dynamic evaluation model, the weight adaptive adjustment mechanism is triggered by the real-time data stream of the Internet of Things, and the sliding window algorithm is combined to perform rolling calculation on the data of the most recent N time periods to generate real-time weight calibration results optimized and adjusted by the genetic algorithm. In step S301, the details regarding IoT real-time data, adaptive adjustment mechanisms, and sliding window algorithms need to be explained. The IoT real-time data stream encompasses multi-source sensing data across the entire agricultural product supply chain, from planting to distribution. Specifically, this includes: soil sensors deployed at planting bases (real-time collection of pH, nitrogen, phosphorus, and potassium content, and heavy metal concentration, sampling once per hour); environmental monitoring stations (monitoring air temperature and humidity, light intensity, and precipitation, sampling once every 30 minutes); GPS positioning and temperature / humidity recorders for the logistics cold chain (uploading location and vehicle temperature data every 5 minutes); and rapid testing terminals at farmers' markets (collecting pesticide residues, veterinary drug residues, and microbial indicators daily, with at least 3 samples per stall per day). This data is transmitted in real-time to the system data platform via the 5G / NB-IoT protocol. After preprocessing by edge computing nodes (including outlier removal, data completion, and format conversion), a standardized real-time data stream is formed. The adaptive adjustment mechanism triggers weight adjustments based on changes in the characteristics of the real-time data stream. When abnormal fluctuations occur in a certain dimension of data (such as a sudden increase of more than 15% in soil heavy metal concentration) or key indicators exceed preset thresholds (such as cold chain temperatures remaining above 8°C for 2 consecutive hours), the system automatically initiates the weight calibration process without manual intervention. In the sliding window algorithm, the value of N is dynamically set according to the data update frequency. For example, N=48 (corresponding to a 24-hour data window) is set for high-frequency environmental data (30 minutes / time), and N=7 (corresponding to a 7-day data window) is set for low-frequency detection data (1 time / day). By performing rolling calculations on the data of the most recent N time periods through the sliding window, data trend changes can be captured in real time, avoiding interference from outliers at a single time point on the weight calculation. For example, when an increase in the pesticide residue exceedance rate of vegetables in a certain production area is detected for 3 consecutive periods within the sliding window, the system will trigger a pre-adjustment of the social co-governance axis weights based on changes in the mean and variance of the data within the window.
[0023] S302. Based on the real-time weight calibration results, a three-dimensional data fusion function is constructed using the weighted geometric mean method to calculate the standardized data fusion values of spatiotemporal entropy, equivalent value of ecosystem services, and smart contract execution rate, thereby generating a comprehensive evaluation index that includes synergistic effects. The expression for the 3D data fusion function is: in, This represents the standardized data values of the spatiotemporal quality axis. This represents the standardized data value of the ecological resilience axis. This represents the standardized data value of the social co-governance axis. , , Indicates dynamic weights, + + =1; In step S302, it should be explained in detail that the weighted geometric mean method, compared with the arithmetic mean method, can better reflect the synergistic effect between data of different dimensions, and is especially suitable for the fusion of indicators of different dimensions. Specifically, the standardized data values for the spatiotemporal quality axis integrate the agricultural product circulation time entropy (reflecting supply chain efficiency), spatial distribution concentration (reflecting regional supply stability), and logistics loss rate (reflecting preservation technology level). After range standardization, the values range from [0,1], with larger values indicating better spatiotemporal quality. The standardized data values for the ecological resilience axis are obtained by weighted summation of ecosystem service value equivalents (such as soil conservation value and water conservation value) and pollution resistance indices (such as pest and disease occurrence frequency and heavy metal enrichment coefficients), also standardized to the [0,1] range. Larger values represent stronger ecosystem support for quality and safety. The standardized data values for the social co-governance axis integrate the automatic fulfillment rate of smart contracts (such as the compliance rate of blockchain-based transactions), the response timeliness of public complaints (average processing time), and the certification coverage of third-party testing institutions. Higher standardized values within [0,1] indicate a more complete social supervision and governance system. Through a three-dimensional data fusion function, dynamic weights ( , , The Ecological Resilience axis is geometrically weighted with the standardized values of each axis, so that the Comprehensive Evaluation Index (CEI) not only reflects the independent contribution of each dimension, but also highlights the interaction between dimensions. For example, when the weight of the Ecological Resilience axis is... When improving, if the standardized data value of the ecological resilience axis remains at a high level, the positive impact on CEI will be amplified through the geometric product effect. Conversely, if the data of a certain dimension decreases significantly (such as the standardized data value of the social co-governance axis dropping below 0.3 due to a surge in complaints), even if other dimensions perform well, CEI will decrease significantly due to the geometric product characteristic, thus more sensitively capturing the comprehensive risks of quality and safety.
[0024] S303. Based on the comprehensive evaluation index, a formula for calculating the risk correction coefficient is constructed using the seasonal pollution risk coefficient and the ecological resilience threshold. The confidence interval is verified by the Bootstrap sampling method. The quality and safety level boundaries are divided by combining fuzzy clustering analysis to generate the comprehensive evaluation index and the risk correction coefficient.
[0025] The formula for calculating the risk adjustment factor is as follows: in, This represents the risk adjustment coefficient, used to dynamically adjust the risk sensitivity of the comprehensive evaluation index. This represents the risk amplification factor, with a value range of [0.2, 0.5]. It is used to quantify the risk amplification effect when the risk of seasonal pollution exceeds the ecological resilience threshold. Indicates the seasonal pollution risk coefficient. Ecological resilience threshold.
[0026] In step S303, the Bootstrap sampling method and fuzzy clustering analysis require detailed explanation. The Bootstrap sampling method generates 1000 Bootstrap samples by repeatedly sampling with replacement from the original dataset (containing over 5000 historical records with comprehensive evaluation indices, actual quality and safety levels, and corresponding risk correction coefficients). Each sample has the same size as the original dataset. The risk correction coefficient is recalculated for each Bootstrap sample, and a 95% confidence interval is constructed. The calculated risk correction coefficient is considered statistically stable when the mean fluctuation range of the risk correction coefficients for all samples is ≤ ±0.05 and the confidence interval covers the original calculated value. For example, if the original risk correction coefficient is 1.2, and the 95% confidence interval after Bootstrap sampling is [1.18, 1.22], it indicates that the coefficient has high reliability under different data sampling scenarios. Fuzzy clustering analysis is used to delineate the boundaries of quality and safety levels. First, the product of the Comprehensive Evaluation Index (CEI) and the Risk Correction Coefficient (RC) is used as the clustering characteristic index. The existing Fuzzy C-means (FCM) algorithm is then used to divide the samples into five quality and safety levels (Excellent, Good, Medium, Warning, and Risk). The algorithm calculates the probability of each sample belonging to different levels using a membership function. When a sample has a membership degree ≥ 0.6 to the "Warning" level and ≥ 0.3 to the "Risk" level, it is determined to be in a critical warning state. The cluster centers are determined through iterative optimization. For example, the final level boundaries are: Excellent (CEI×RC ≥ 0.85), Good (0.70 ≤ CEI×RC < 0.85), Medium (0.55 ≤ CEI×RC < 0.70), Warning (0.40 ≤ CEI×RC < 0.55), and Risk (CEI×RC < 0.40), achieving a refined division of quality and safety levels.
[0027] As an optional embodiment of the present invention, optionally, in step S4, formulating a differentiated regulatory strategy and an optimal resource allocation scheme based on the comprehensive evaluation index and risk correction coefficient includes: S401. Based on the comprehensive evaluation index and risk correction coefficient, a two-dimensional evaluation matrix is constructed using the K-means clustering algorithm. Combined with the sliding window mechanism, the quality and safety levels are dynamically divided into high, medium, and low levels to generate a level division result that matches the real-time risk level. In step S401, the construction of the two-dimensional evaluation matrix and the sliding window mechanism requires detailed explanation. The two-dimensional evaluation matrix uses the comprehensive evaluation index as the vertical axis and the risk correction coefficient as the horizontal axis, dividing the plane into 9 evaluation regions, each corresponding to a different combination of risk characteristics. The vertical axis CEI is divided into 5 intervals according to [0,0.40), [0.40,0.55), [0.55,0.70), [0.70,0.85), and [0.85,1]. The horizontal axis RC is divided into 3 intervals according to [0,1.0), [1.0,1.2), and [1.2,1.5] (RC≥1.0 indicates risk amplification, and the larger the value, the stronger the amplification effect). The historical sample CEI and RC data are clustered using the K-means clustering algorithm to generate 3 core cluster centers, corresponding to high, medium, and low risk levels, respectively. For example, when the cluster center is (CEI=0.35, RC=1.3), the surrounding area is classified as high-risk; when the cluster center is (CEI=0.60, RC=1.1), it is classified as medium-risk; and when the cluster center is (CEI=0.80, RC=0.9), it is classified as low-risk. The sliding window mechanism dynamically updates the risk level thresholds. The window size is set to 30 days (corresponding to one regulatory cycle), and it slides every 7 days, re-clustering the real-time CEI and RC data within the window and adjusting the boundary thresholds for each level. For example, during the peak summer season, when the proportion of high-risk samples increases within the window, the algorithm automatically shrinks the CEI threshold for high-risk levels (e.g., lowering it from 0.40 to 0.38) to ensure timely capture of seasonal risk changes.
[0028] S402. Based on the classification results, a differentiated strategy library of spatiotemporal quality, ecological resilience and social co-governance dimensions is constructed using a three-dimensional regulatory strategy matrix. The optimal strategy combination is recommended by combining an expert system and a random forest algorithm to generate a three-dimensional regulatory strategy scheme containing specific measures. S403. Based on the three-dimensional regulatory strategy scheme, a dynamic optimization model for resource allocation is constructed using a multi-objective optimization function. The optimal allocation ratio of detection equipment, human resources, and funding budget is determined by combining genetic algorithms and GIS heat map analysis, and a resource allocation scheme that optimizes regulatory costs, risk coverage, and resource utilization is generated. The expression for the multi-objective optimization function is: in, Represents a multi-objective optimization function. The regulatory cost function represents the total cost under the resource allocation scheme. This represents the risk coverage function, indicating the ability of resource allocation to cover the risks to agricultural product quality and safety. The resource utilization rate function represents the efficiency level of resource allocation. Indicates the first The unit cost coefficients for various resources (such as depreciation costs of testing equipment, labor costs, and capital budget losses) are determined through historical cost data and expert evaluation. This represents a three-dimensional resource allocation vector, corresponding to the allocation ratio of detection equipment. Human resource allocation ratio Fund budget allocation ratio Satisfying constraints + + =1, Indicates the first The contribution coefficient of resource types to risk coverage (such as the detection rate of pollutants by testing equipment and the coverage of regulatory processes by manpower) is determined based on GIS heat maps and historical regulatory data. Indicates the first The utilization efficiency coefficients of various resources (such as equipment utilization rate, manpower utilization rate, and budget execution rate) are calculated through resource usage records and efficiency models. In step S403, regarding the construction of the dynamic optimization model for resource allocation, the genetic algorithm, and GIS heatmap analysis, it is necessary to explain in detail that the dynamic optimization model for resource allocation is based on a multi-objective optimization function, aiming to achieve synergistic optimization of regulatory costs, risk coverage, and resource utilization. This model first constructs a resource-risk-cost correlation database using historical regulatory data, containing input-output records of different types of resources (detection equipment, human resources, and funds) in different production areas and seasons. For example, the positive correlation coefficient between the input of detection equipment and the pollutant detection rate, and the nonlinear relationship between human resource input and regulatory process coverage, are all used as basic parameters of the model. The genetic algorithm, as the core algorithm for solving multi-objective optimization problems, seeks optimization by simulating the process of biological evolution: first, 100 initial resource allocation schemes (i.e., feasible solutions to the three-dimensional resource allocation vector) are randomly generated; then, the three sub-objectives of the multi-objective optimization function (cost minimization, coverage maximization, and utilization maximization) are transformed into a fitness function, and each scheme is evaluated. In the selection operation, a tournament selection method is used to retain schemes with higher fitness. The crossover operation optimizes the combination of schemes by simulating chromosome crossover, for example, by swapping the detection equipment allocation ratios of two parent schemes. The mutation operation randomly adjusts the allocation ratio of a resource with a 5% probability to avoid the algorithm getting trapped in local optima. After 50 iterations, when the rate of change of the optimal fitness value for 10 consecutive generations is ≤0.5%, the iteration stops and the Pareto optimal solution set is output. GIS heatmap analysis is used to achieve precise spatial allocation of resources. The region is divided into 1km×1km grid units, and a risk heatmap is generated based on the product of the comprehensive evaluation index (CEI) and the risk correction coefficient (RC). Red areas represent high-risk grids (e.g., CEI×RC < 0.40), and blue areas represent low-risk grids (e.g., CEI×RC ≥ 0.85). The model spatially matches the resource allocation ratios output by the genetic algorithm with the risk levels of the GIS heatmap. For example, it allocates 30% of the detection equipment, 40% of the human resources, and 35% of the funding budget to high-risk grids, while allocating only 10% of the detection equipment, 15% of the human resources, and 10% of the funding budget to low-risk grids. Simultaneously, it fine-tunes the resource allocation scheme by incorporating spatial attributes such as the area of agricultural products planted within the grid, the location of logistics hubs, and the frequency of historical pollution incidents, ensuring that resources are tilted towards high-risk areas and areas with weak supervision. For instance, although a grid's CEI×RC is in the medium-risk range (0.55≤CEI×RC<0.70), historical data shows that the area has experienced more than three pesticide residue exceeding the standard incidents. The model will automatically increase the human resource allocation ratio of this grid by 10% to enhance on-site inspection efforts. By combining the global optimization of the genetic algorithm with the spatial positioning of the GIS heatmap, the dynamic optimization model for resource allocation can maximize risk coverage and resource utilization while controlling regulatory costs, achieving precise supervision and targeted policy implementation.
[0029] S404. Based on the resource allocation scheme, a dynamic early warning and emergency response linkage system is constructed using a three-level early warning response mechanism. Combined with real-time monitoring indicator data, the corresponding level of emergency response process is automatically triggered to generate a linkage execution scheme that includes level one / level two / level three early warning responses. In step S404, regarding the construction of the dynamic early warning and emergency response system, it is necessary to explain in detail that the dynamic early warning and emergency response system uses a three-level early warning response mechanism as its core framework to achieve fully automated response from risk monitoring to emergency handling. The system first constructs a real-time monitoring indicator database, integrating multi-source data from sensors in production bases (such as soil heavy metal sensors and water quality pH sensors), rapid detection equipment in the distribution process (such as pesticide residue rapid testers), and social complaint platforms. The data update frequency is set to once per hour. The system matches real-time monitoring indicators with the high / medium / low risk levels defined in step S401. When the real-time CEI×RC value of a certain area triggers the corresponding level threshold, the corresponding early warning response process is automatically initiated. A Level 1 warning (corresponding to a high-risk level) is the highest level of response. The system immediately triggers the following linkage mechanisms: It uses the GIS system to pinpoint the specific grid coordinates of the risk area and automatically sends an emergency instruction to the local regulatory authority, including the risk location, pollutant type (e.g., excessive levels of organophosphorus pesticides), and estimated impact range (calculated based on a diffusion model); it simultaneously dispatches the three mobile testing vehicles closest to the risk point (selected via GPS positioning) to the site for re-inspection and initiates preparations for the deployment of emergency material reserves (e.g., antidotes, isolation facilities); and it pushes risk warning information to consumers in the area through official platforms, advising them to suspend the purchase of the relevant batches of agricultural products. A Level 2 warning (corresponding to a medium-risk level) initiates a medium-intensity response. The system sends a risk warning letter to the regulatory authority, requiring on-site verification to be completed within 24 hours, and implementing regulatory measures to increase the frequency of random inspections (from once a month to twice a week) on the involved production entities; the social governance platform simultaneously opens a public supervision channel, encouraging consumers to report suspected problems. Level 3 warnings (corresponding to low-risk levels) primarily focus on preventative measures. The system automatically generates risk alert reports and pushes them to the responsible persons of production entities, reminding them to strengthen production process control (such as adjusting pesticide use plans and optimizing irrigation water quality monitoring frequency). Regulatory departments conduct regular follow-up inspections. The system also features cross-departmental collaboration capabilities, automatically synchronizing warning information to the emergency command platforms of relevant departments such as agriculture and rural affairs, market supervision, and ecological environment, enabling data sharing and joint response. For example, when a Level 1 warning is triggered in a certain area, the system can automatically retrieve the historical pollution treatment case database for that area, providing reference solutions for emergency response, and connect the heads of various departments via video conferencing to initiate online collaborative command. Furthermore, the system has a warning escalation and de-escalation mechanism. Every 6 hours, the risk level is reassessed based on the latest monitoring data. If the risk continues to worsen (e.g., the CEI×RC value further drops below 0.3), the warning level is escalated from Level 2 to Level 1; if the risk is controlled (e.g., the CEI×RC rises back to above 0.55 and remains stable for 24 hours), the warning level is lowered accordingly until it is lifted.Through this dynamic and multi-dimensional early warning and emergency response linkage design, the system can achieve rapid response and precise handling of risks to the quality and safety of edible agricultural products, minimizing safety hazards.
[0030] S405. Based on the aforementioned linkage execution scheme, a closed-loop verification system for regulatory strategies is constructed using digital twins and Monte Carlo simulation. Stress tests are simulated through a virtual regulatory sandbox, and the parameters of the differentiated strategy library are updated regularly to generate differentiated regulatory strategies and optimal resource allocation schemes.
[0031] In step S405, regarding the construction of the regulatory strategy closed-loop verification system and the virtual regulatory sandbox, it is necessary to explain in detail that the regulatory strategy closed-loop verification system, based on digital twin technology and Monte Carlo simulation, constructs a virtual-real integrated strategy verification environment to achieve dynamic evaluation and continuous optimization of differentiated regulatory strategies and resource allocation schemes. The digital twin model first constructs a virtual mapping of the entire edible agricultural product industry chain using 3D modeling technology, encompassing production bases (including parametric models of soil, climate, and crop varieties), distribution links (dynamic models of logistics routes, storage conditions, and transportation tools), and the regulatory network (spatial models of inspection point layout, personnel configuration, and equipment distribution). The strategy schemes and resource allocation data generated in steps S401-S404 are used as model input parameters. Each entity in the model (such as production entities, inspection equipment, and regulatory personnel) is assigned attributes and behavioral rules consistent with reality, such as the detection probability curve of inspection equipment, the inspection efficiency function of regulatory personnel, and the violation probability distribution of production entities. These parameters are determined through training with historical regulatory data and calibration with expert experience. Monte Carlo simulation is used to simulate the random uncertainty in the strategy execution process. By setting up 10,000 independent simulation experiments, each experiment randomly selects possible values for model parameters (such as the probability of a sudden pollution event, random errors in detection equipment, and the random intensity of consumer complaints), running a digital twin model, and recording key indicators after strategy execution, such as the risk event incidence rate, regulatory cost overrun rate, resource idle rate, and emergency response timeliness. The virtual regulatory sandbox is the core experimental platform of the closed-loop verification system. It provides an isolated virtual environment that can simulate various extreme scenarios and stress test conditions. For example, it can simulate regional rainstorms causing farmland flooding and the risk of heavy metal leaching to assess the response effect of existing high-risk level regulatory strategies (such as increasing detection frequency and allocating emergency detection equipment); or it can simulate a sudden tightening of pesticide residue standards (such as a 50% reduction in the maximum residue limit) to test the adaptability of resource allocation schemes (such as the reallocation of detection equipment and human resources) under the new standards. The sandbox incorporates a comprehensive strategy effectiveness evaluation index system, including risk control level (the proportion of risk events reduced), strategy execution efficiency (the amount of regulatory tasks completed per unit of time), cost-effectiveness ratio (the risk reduction value brought by every 10,000 yuan of regulatory investment), and social satisfaction (ratings based on virtual consumer feedback). This multi-dimensional index system comprehensively evaluates the merits of each strategy. During simulation, the system automatically records index changes under different combinations of strategy parameters. For example, when the CEI threshold for high-risk levels is adjusted from 0.40 to 0.35, risk coverage increases by 12%, but regulatory costs increase by 8%. Comparative analysis determines the optimal parameter range. For strategy defects discovered during verification (such as insufficient resource allocation in a certain type of high-risk area leading to a risk event miss rate exceeding 5%), the system automatically reverse-engineers the root cause and feeds it back to the differentiated strategy library in step S402 and the resource allocation model in step S403, adjusting the strategy combination and resource allocation ratio.For example, if simulations show that the detection equipment coverage rate in high-risk grids in remote mountainous areas is only 60% (lower than the target value of 85%), the system will suggest increasing the allocation ratio of portable detection equipment in that area and optimizing the logistics scheduling algorithm to shorten equipment delivery time. Furthermore, the system calibrates the model monthly based on the deviation between real-world regulatory data and simulation results, updating the entity attribute parameters of the digital twin model (such as correcting the actual detection rate of a certain type of detection equipment) and the probability distribution function of the Monte Carlo simulation (such as adjusting the probability of extreme weather events), ensuring that the simulation results in the virtual sandbox are highly consistent with real-world scenarios. Through this closed-loop mechanism of "strategy formulation - simulation verification - parameter optimization - re-verification," the regulatory strategy closed-loop verification system can continuously improve the scientific rigor and adaptability of differentiated regulatory strategies and resource allocation schemes.
[0032] As an optional embodiment of the present invention, optionally, in step S402, based on the grade classification results, a differentiated strategy library of spatiotemporal quality, ecological resilience, and social co-governance dimensions is constructed using a three-dimensional regulatory strategy matrix. The optimal strategy combination is recommended by combining an expert system and a random forest algorithm, generating a three-dimensional regulatory strategy scheme containing specific measures, including: S4021. Based on the high / medium / low three-level quality and safety classification results, a differentiated strategy library is constructed using a three-dimensional matrix of spatiotemporal quality, ecological resilience, and social co-governance to generate a basic strategy combination containing specific measures. In step S4021, it is necessary to explain in detail that the construction of the three-dimensional regulatory strategy matrix uses high / medium / low quality and safety levels as the vertical axis and three core dimensions—spatial-temporal quality, ecological resilience, and social co-governance—as the horizontal axis, forming nine basic strategy units. Each unit corresponds to a combination of dimensional strategies under a specific risk level. The spatiotemporal quality dimension focuses on the quality characteristics of agricultural products at different times (such as planting season, harvest period, and circulation period) and spaces (such as geographical location of production area, climate zone, and soil type), and formulates targeted regulatory measures. For example, the spatiotemporal quality strategy for high-risk areas includes implementing rapid heavy metal testing twice a week for leafy vegetables in acidic soil production areas in the south during the rainy season (temporal dimension) (spatial dimension), and increasing the frequency of full screening for pesticide residues 72 hours before harvest; while low-risk areas can adopt a combination of quarterly random sampling and planting record verification. The ecological resilience dimension focuses on enhancing the agricultural production system's ability to cope with natural risks (such as extreme weather and pests) and anthropogenic pollution (such as non-point source pollution and industrial emissions). Strategies include promoting green pest control technologies (such as pheromones and biopesticides) in high-risk areas, establishing demonstration zones for soil heavy metal pollution remediation, implementing crop rotation and fallow systems and organic fertilizer substitution programs in medium-risk areas, and focusing on ecological monitoring and early warning in low-risk areas, regularly assessing irrigation water quality and the surrounding ecological environment. The social co-governance dimension aims to integrate diverse forces such as government regulation, producer self-discipline, and public participation. Strategies for high-risk areas include establishing a "red list" system for producers and implementing credit-based tiered management, opening a 24-hour complaint hotline with rewards for leads, and organizing expert teams for on-site guidance. Medium-risk areas focus on quality and safety training for producers and the construction of "sunshine workshops" (live-streaming the production process). Low-risk areas focus on publicity and education, enhancing consumer awareness through activities such as "Agricultural Product Quality and Safety Science Popularization Week." Each basic strategy combination includes specific implementing entities (such as agricultural and rural affairs bureaus, township governments, and production enterprises), execution frequency (such as daily, weekly, and monthly), technical standards (such as testing methods and operating procedures), and expected goals (such as the risk reduction ratio and the increase in the pass rate), forming a strategy module that can be directly implemented.
[0033] S4022. Based on the aforementioned basic strategy combination, the expert system rule engine is used to match agricultural regulations and regulatory policies, and the strategy parameters are dynamically adjusted by combining seasonal pollution risk coefficients and ecological resilience thresholds to generate a strategy rule set that conforms to industry standards. In step S4022, regarding the expert system rule engine, it's important to note that the expert system rule engine is the core driver for dynamic adjustment of strategy parameters. It has a built-in multi-level rule base covering national and local agricultural regulations (such as the *Agricultural Product Quality and Safety Law* and the *Pesticide Management Regulations*), industry standards (*National Food Safety Standard: Maximum Residue Limits for Pesticides in Food*), regulatory operating procedures, and historical case experience. The rule engine first verifies the consistency between the basic strategy combination generated in step S4021 and relevant regulations and policies. For example, the frequency of pesticide residue testing in high-risk areas must meet the legal requirement of "at least once a week." If the basic strategy sets it to once every two weeks, the rule is automatically corrected to adjust the frequency to once a week. Based on this, the engine introduces two dynamic parameters—Seasonal Pollution Risk Coefficient (SRC) and Ecological Resilience Threshold (ERT)—to optimize the strategy parameters. Seasonal pollution risk coefficients are calculated based on regional historical data and phenological characteristics. For example, in North China, June to August is the peak season for pesticide use, and the SRC value is set at 1.5. During this period, the detection frequency in high-risk areas is multiplied by the SRC value based on the basic strategy (e.g., adjusting from once a week to 1.5 times a week, i.e., once every 4-5 days). In contrast, during winter (December to February), when pests and diseases occur less frequently, the SRC value is 0.8, and the detection frequency is reduced accordingly. The ecological resilience threshold is set based on the regional ecosystem carrying capacity (e.g., soil organic matter content, water self-purification capacity). When the background value of heavy metals in the soil of a certain area approaches the upper limit of the ERT, the rule engine automatically strengthens the ecological resilience dimension strategy, such as increasing the proportion of organic fertilizer replacing chemical fertilizer from 30% to 50% in the basic strategy and increasing the application frequency of soil conditioners. The rules engine also features a conflict resolution mechanism. When different levels of regulations or dynamic parameters impose different requirements on the same strategy parameter (e.g., national regulations require two random checks per month, while seasonal risks require one per week), the system prioritizes the stricter standard and records the conflict points for review by the expert team. The final generated strategy rule set includes detailed parameter adjustment logic (e.g., "when SRC > 1.2 and ERT < 0.6, the detection frequency = base frequency × SRC × 1.2"), regulatory basis numbers, and dynamic parameter threshold ranges, ensuring that the strategy combination not only meets compliance requirements but also flexibly responds to seasonal and ecological changes.
[0034] S4023. Based on the policy rule set, a policy effect prediction model is constructed using the random forest algorithm, and a genetic algorithm is combined to optimize the dual objective function of risk coverage and resource utilization to generate candidate policy combinations. The mathematical expression for the biobjective function is: in, This represents the objective function for risk coverage, which is a weighted sum of the risk coverage capabilities of each strategy for pollution risk. This represents the strategy combination weight vector. Indicates the first Similar strategies (such as adjusting the detection frequency, strengthening blockchain verification, and investing in ecosystem restoration). Indicates the number of strategy categories. Indicates the first The resource utilization contribution coefficient of the strategy, with a value range of [0.2, 0.8], is obtained by fitting historical resource allocation data using a genetic algorithm. Indicates the first The risk coverage contribution coefficient of the strategy ranges from [0.1, 1.0]. In step S4023, regarding the construction of the strategy effect prediction model and the genetic algorithm, it should be noted that the strategy effect prediction model is based on the random forest algorithm, which constructs a nonlinear mapping relationship between strategy inputs and effect outputs by learning from historical regulatory data. The model's input features include specific measure parameters in the three-dimensional strategy matrix (such as detection frequency, training duration, and remediation investment intensity), seasonal pollution risk coefficients, ecological resilience thresholds, and basic regional attributes (such as arable land area, number of production entities, and average altitude). The output is a comprehensive effect index after strategy implementation, covering key dimensions such as risk coverage, resource utilization rate, regulatory cost, and risk event occurrence rate. During model training, a 5-fold cross-validation method is used to optimize hyperparameters (such as the number of decision trees, maximum tree depth, and minimum number of split samples), and feature importance assessment is used to screen strategy parameters that significantly affect the effect index (e.g., the importance weight of detection frequency is usually higher than that of publicity and education investment) to ensure the model's prediction accuracy. The genetic algorithm is used to solve the Pareto optimal solution of the bi-objective function to generate candidate strategy combinations. The algorithm first encodes the strategy parameters into chromosomes (e.g., detection frequency is encoded as 01-10, representing 1-10 times per month), and randomly generates an initial population of 100 individuals. The fitness function is constructed based on a bi-objective function, transforming the objectives of maximizing risk coverage and resource utilization into a single fitness value through a linear weighting method (the weight coefficients are dynamically adjusted according to regulatory priority; for example, during periods of high risk, the risk coverage weight is set to 0.6, and the resource utilization weight is set to 0.4). Genetic operations include selection (using tournament selection to select individuals with higher fitness from the population), crossover (single-point crossover with a probability of 0.8, exchanging partial gene segments between two chromosomes), and mutation (randomly changing a gene position on a chromosome with a probability of 0.05, such as mutating the detection frequency from 5 times to 6 times). After 50 generations of iterative evolution, the top 20 combinations of strategy parameters with the highest fitness in the population were selected as candidate strategy combinations. These combinations achieved different degrees of balance between risk coverage and resource utilization. For example, a candidate combination may have a risk coverage of 92% but a resource utilization of 75%, while another combination may have a risk coverage of 88% but a resource utilization of 89%.
[0035] S4024. Based on the candidate strategy combination, use a digital twin sandbox to simulate stress test, verify the robustness of the strategy through Monte Carlo simulation, and combine deviation analysis to trigger the particle swarm optimization algorithm to adjust the strategy parameters, thereby generating a three-dimensional regulatory strategy scheme containing specific measures.
[0036] In step S4024, it should be noted that the digital twin sandbox simulation stress test verifies candidate strategy combinations under multi-dimensional extreme conditions by constructing a virtual environment highly consistent with real-world regulatory scenarios. First, the system inputs the parameters of the candidate strategy combinations (such as detection frequency, resource allocation ratio, and emergency response threshold) into the digital twin model. The model includes sub-modules such as production entity behavior models (e.g., farmers' pesticide usage habits and harvesting cycles), environmental impact models (e.g., weather changes and soil pollutant migration patterns), and detection equipment performance models (e.g., detection accuracy and response time), forming a complex, dynamically interactive system. The stress test scenarios include 20 preset scenarios such as extreme natural risks (e.g., 15 consecutive days of torrential rain leading to increased nitrogen and phosphorus loss from the soil), sudden man-made pollution (e.g., leaks from nearby chemical plants causing heavy metal contamination), and abnormal market circulation (e.g., concentrated market launches during holidays leading to insufficient sampling coverage). Custom scenario parameters are also supported (e.g., setting the probability of illegal use of a certain type of pesticide in a specific area to 30%).
[0037] Monte Carlo simulations generate 10,000 sets of scenario parameter combinations through random sampling (such as random combinations of different pollution levels, occurrence probabilities, and impact ranges). Each candidate strategy combination is repeatedly simulated, and the distribution characteristics of indicators such as risk coverage, resource utilization, and emergency response timeliness are recorded for each simulation. For example, for a certain candidate strategy combination, in 10,000 simulations, scenarios with risk coverage below 80% account for 3.2%, indicating that the strategy has a certain risk of failure in extreme scenarios. Robustness verification indicators include the indicator volatility coefficient (standard deviation / mean), extreme scenario pass rate (percentage of scenarios meeting the indicator criteria), and parameter sensitivity (the magnitude of indicator changes caused by small changes in strategy parameters). When the extreme scenario pass rate of a candidate strategy is below 90% or the parameter sensitivity is above 0.5, it is considered to have insufficient robustness.
[0038] The deviation analysis module compares the simulation results with preset target values (such as risk coverage ≥95%, resource utilization ≥85%), calculating the absolute deviation (actual value - target value) and relative deviation (absolute deviation / target value). For strategy parameters with excessive deviations (such as a simulated response time of 6 hours for a certain area's detection equipment deployment, a target value of 4 hours, and a relative deviation of 50%), the system triggers a particle swarm optimization algorithm to fine-tune the parameters. The particle swarm optimization algorithm encodes strategy parameters (such as equipment scheduling priority and detection route planning coefficients) into particle positions, using the minimization of deviation as the objective function, and finds the optimal parameter combination through information sharing and position updates among particles. For example, regarding equipment response time deviation, the algorithm might optimize the "regional priority coefficient" in the logistics scheduling algorithm, adjusting the priority weight of remote mountainous areas from 0.3 to 0.5, thus shortening the simulated response time to 4.2 hours, close to the target value. After three rounds of iterative optimization, one or two optimal strategy combinations were selected to generate a three-dimensional regulatory strategy plan that includes specific measures (such as "pesticide residue testing three times a week in high-risk areas + drone inspections twice a week + portable equipment coverage increased to 80%), parameter thresholds (such as "when soil pH < 5.5, heavy metal testing frequency increased by 50%)", execution process and timeliness requirements. The plan also automatically generates a strategy description and execution Gantt chart.
[0039] Example 2 A dual-dimensional comprehensive evaluation system for agricultural product quality and safety includes a processor and a memory for storing executable instructions. The processor is configured to implement a dual-dimensional comprehensive evaluation method for agricultural product quality and safety when executing the executable instructions. It should be noted that the computer device includes a processor and memory, and may also include one or more of a multimedia component, an input / output (I / O) interface, and a communication component. The processor controls the overall operation of the computer device, completing all or part of the steps of the dual-dimensional comprehensive evaluation method for agricultural product quality and safety. The memory stores various types of data to support device operation and can be implemented by volatile or non-volatile storage devices or combinations thereof, such as SRAM, EEPROM, etc. The multimedia component includes a screen (such as a touchscreen) and an audio component. The audio component has a microphone to receive external audio signals and at least one speaker to output audio signals. The I / O interface provides an interface for the processor and other interface modules (such as a keyboard, mouse, buttons, etc.). The communication component is used for wired or wireless communication between devices. Wireless communication includes Wi-Fi, Bluetooth, etc., and the communication component includes a Wi-Fi module, etc. As a preferred embodiment, the computer device can be implemented using electronic components such as ASICs and DSPs to execute the dual-dimensional comprehensive evaluation method for agricultural product quality and safety.
[0040] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for assessing the quality and safety of edible agricultural products based on localized data integration, characterized in that, The method includes: Collect spatiotemporal quality data, ecological resilience data, and social co-governance data to form a multi-source heterogeneous dataset; Based on the aforementioned multi-source heterogeneous dataset, a three-dimensional dynamic evaluation model of spatiotemporal-ecological-social aspects is constructed. Based on the aforementioned three-dimensional dynamic evaluation model, dynamic weight allocation and data fusion are performed on the spatiotemporal quality axis, ecological resilience axis, and social co-governance axis to generate a comprehensive evaluation index and risk correction coefficient. Based on the comprehensive evaluation index and risk correction coefficient, differentiated regulatory strategies and optimal resource allocation schemes are formulated. Based on the differentiated regulatory strategy and optimal resource allocation scheme, dynamic early warning of agricultural product quality and safety risks is generated, and a visualized two-dimensional comprehensive evaluation report is output; the two dimensions include the quality and safety level dimension and the risk warning dimension.
2. The method for assessing the quality and safety of edible agricultural products based on localized data integration as described in claim 1, characterized in that, The construction of a three-dimensional dynamic evaluation model encompassing spatiotemporal, ecological, and social aspects includes: Based on multi-source heterogeneous datasets, using spatiotemporal entropy calculation models, ecological resilience accounting models, and blockchain smart contract verification models, a three-dimensional initial architecture including spatiotemporal quality axis, ecological resilience axis, and social co-governance axis is constructed, generating a basic model framework including spatiotemporal distribution characteristics of circulation paths, quantitative indicators of ecosystem service value, and social co-governance compliance records. Based on the aforementioned basic model framework, the spatiotemporal entropy, equivalent value of ecosystem services, and smart contract execution rate are normalized using the Min-Max normalization algorithm. A multi-source data fusion algorithm that combines principal component analysis and analytic hierarchy process is then used to generate a data fusion model. Based on the data fusion model, the entropy weight method is used to dynamically calculate the data volatility weights of each dimension, and the coefficient of variation method is used to adjust the weight allocation ratio of seasonal pollution risk coefficient and ecological resilience threshold, thereby generating a dynamic weight allocation scheme for the spatiotemporal quality axis, ecological resilience axis, and social co-governance axis. Based on the dynamic weight allocation scheme, the K-fold cross-validation method is used to verify the model's prediction accuracy. Monte Carlo simulation is used to analyze the sensitivity of each dimension index. A genetic algorithm is used to iteratively optimize the weight coefficients and threshold parameters, generating a verified and optimized spatiotemporal-ecological-social three-dimensional dynamic evaluation model with adaptive adjustment capabilities.
3. The method for assessing the quality and safety of edible agricultural products based on localized data integration as described in claim 2, characterized in that, The expression for dynamically calculating the volatility weights of each dimension of data using the entropy weight method is as follows: in, Indicates the first Dynamic weights of dimensions Indicates the first Information entropy of dimensions Indicates the first The coefficient of variation of dimensions, Indicates the seasonal pollution risk coefficient. Represents the total number of samples. Indicates the standardized first The sample in the Dimensional proportions Indicates the first The sample at the th Standardized data values of dimensions Indicates the first Standard deviation of dimensional data Indicates the first The mean of the dimensional data.
4. The method for assessing the quality and safety of edible agricultural products based on localized data integration as described in claim 1, characterized in that, The comprehensive evaluation index and risk correction coefficient are generated as follows: Based on the dynamic weight allocation scheme of the three-dimensional dynamic evaluation model, the weight adaptive adjustment mechanism is triggered by the real-time data stream of the Internet of Things, and the sliding window algorithm is combined to perform rolling calculations on the data of the most recent N time periods to generate real-time weight calibration results optimized and adjusted by the genetic algorithm. Based on the real-time weight calibration results, a three-dimensional data fusion function is constructed using the weighted geometric mean method to calculate the standardized data fusion values of spatiotemporal entropy, equivalent value of ecosystem services, and smart contract execution rate, thereby generating a comprehensive evaluation index that includes synergistic effects. Based on the comprehensive evaluation index, a formula for calculating the risk correction coefficient is constructed using the seasonal pollution risk coefficient and the ecological resilience threshold. The confidence interval is verified by the Bootstrap sampling method, and the quality and safety level boundaries are delineated by combining fuzzy clustering analysis to generate the comprehensive evaluation index and the risk correction coefficient.
5. The method for assessing the quality and safety of edible agricultural products based on localized data integration as described in claim 4, characterized in that, The formula for calculating the risk adjustment factor is as follows: in, This represents the risk adjustment factor. This represents the risk amplification factor. Indicates the seasonal pollution risk coefficient. Ecological resilience threshold.
6. The method for assessing the quality and safety of edible agricultural products based on localized data integration as described in claim 1, characterized in that, Developing differentiated regulatory strategies and optimal resource allocation plans includes: Based on the comprehensive evaluation index and risk correction coefficient, a two-dimensional evaluation matrix is constructed using the K-means clustering algorithm. Combined with the sliding window mechanism, the quality and safety levels are dynamically divided into high, medium, and low levels to generate a level classification result that matches the real-time risk level. Based on the classification results, a differentiated strategy library of spatiotemporal quality, ecological resilience and social co-governance dimensions is constructed using a three-dimensional regulatory strategy matrix. The optimal strategy combination is recommended by combining an expert system and a random forest algorithm to generate a three-dimensional regulatory strategy scheme containing specific measures. Based on the aforementioned three-dimensional regulatory strategy, a dynamic optimization model for resource allocation is constructed using a multi-objective optimization function. By combining genetic algorithms and GIS heat map analysis, the optimal allocation ratio of detection equipment, human resources, and funding budget is determined, generating a resource allocation scheme that synergistically optimizes regulatory costs, risk coverage, and resource utilization. Based on the resource allocation scheme, a dynamic early warning and emergency response linkage system is constructed using a three-level early warning response mechanism. Combined with real-time monitoring indicator data, the corresponding level of emergency response process is automatically triggered to generate a linkage execution scheme that includes level one / level two / level three early warning responses. Based on the aforementioned coordinated execution scheme, a closed-loop verification system for regulatory strategies is constructed using digital twins and Monte Carlo simulation. Stress tests are simulated through a virtual regulatory sandbox, and the parameters of the differentiated strategy library are updated regularly to generate differentiated regulatory strategies and optimal resource allocation schemes.
7. The method for assessing the quality and safety of edible agricultural products based on localized data integration as described in claim 6, characterized in that, The generation of a three-dimensional regulatory strategy plan that includes specific measures includes: Based on the high / medium / low three-level quality and safety classification results, a differentiated strategy library is constructed using a three-dimensional matrix of spatiotemporal quality, ecological resilience, and social co-governance to generate basic strategy combinations containing specific measures. Based on the aforementioned basic strategy combination, the expert system rule engine is used to match agricultural regulations and regulatory policies, and the strategy parameters are dynamically adjusted by combining seasonal pollution risk coefficients and ecological resilience thresholds to generate a set of strategy rules that conform to industry standards. Based on the policy rule set, a policy effect prediction model is constructed using the random forest algorithm, and a genetic algorithm is combined to optimize the dual objective function of risk coverage and resource utilization to generate candidate policy combinations. Based on the candidate strategy combination, a stress test is simulated using a digital twin sandbox, the robustness of the strategy is verified through Monte Carlo simulation, and the strategy parameters are adjusted by particle swarm optimization algorithm triggered by bias analysis, thereby generating a three-dimensional regulatory strategy scheme containing specific measures.
8. A quality and safety assessment system for edible agricultural products based on localized data integration, characterized in that, The system includes: processor; Memory used to store processor-executable instructions; The processor is configured to implement the dual-dimensional comprehensive evaluation method for agricultural product quality and safety as described in any one of claims 1 to 7 when executing the executable instructions.