Food safety data tracing method
By constructing a resilient traceability chain based on multi-node sensors and a contextual credibility scoring mechanism, the problems of data consistency and credibility assessment in food traceability were solved, achieving highly reliable and visualized traceability reports and improving the efficiency of food safety incident response.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-04-07
AI Technical Summary
Existing food traceability methods lack a systematic evaluation mechanism for multi-sensor data, which fails to effectively identify and correct abnormal data, affecting the integrity and stability of the traceability chain. Furthermore, they lack a quantifiable and visualized credibility scoring mechanism.
By acquiring multi-dimensional traceability data from a multi-node sensor cluster, contextual credibility analysis is performed to construct a resilient traceability chain, embed credibility scores, and set an anomaly tolerance field in the traceability path to generate a high-credibility dataset and evaluation report.
It improves the reliability of traceability data and the auditability of visualization reports, thereby enhancing the timeliness of food safety incident response and the credibility of traceability results.
Smart Images

Figure CN121808474A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of food safety information technology, and in particular to a method for tracing food safety data. Background Technology
[0002] Ensuring food safety has become a core concern for both regulatory authorities and businesses throughout the entire food supply chain. With the widespread deployment of IoT sensing devices and sensor technologies, environmental information from each stage of food production, transportation, storage, and sales can be collected in real time, forming a data foundation for traceability. However, due to differences in sensor performance, complex deployment environments, and instability in transmission links, the raw data collected suffers from poor consistency, high noise levels, and uncertain reliability, seriously affecting the accuracy of subsequent food safety incident traceability and the credibility of data-based accountability.
[0003] In existing technologies, most traceability methods rely solely on data source or timestamp sorting to construct the traceability chain, lacking a systematic evaluation mechanism for data quality. This is particularly problematic when there are biases in redundant multi-sensor data, making it impossible to effectively identify and correct abnormal data, thus affecting the integrity and stability of the traceability chain. Furthermore, there is a lack of quantifiable and visualized credibility scoring mechanisms. Therefore, there is an urgent need to propose a food safety data traceability method to address these technical challenges. Summary of the Invention
[0004] To achieve the above objectives, the present invention provides a method for tracing food safety data.
[0005] A method for tracing food safety data includes the following steps: S1: Obtain multi-dimensional traceability data of the target food from a sensor cluster deployed at multiple nodes in the food supply chain, including environmental parameters and sensor status parameters, and output the initial traceability data stream; S2: Perform contextual credibility analysis on the initial traceability data stream. Calculate the contextual credibility score for each data batch by comparing the logical consistency of readings from different sensors at the same node. S3: Based on contextual credibility scoring, filter and correct the initial source data stream to generate a highly credible dataset; S4: Construct a resilient traceability chain using a high-confidence dataset, in which each data block is associated with its corresponding contextual credibility score; S5: When a traceability query request is received, the credibility of the overall traceability path is calculated based on the contextual credibility score of each data block in the elastic traceability chain, and an evaluation report with credibility is generated.
[0006] Optionally, S1 specifically includes: S11: Real-time data streams corresponding to the target food are obtained from multiple types of sensors deployed in the food production, transportation, storage and sales process. The multiple types of sensors include temperature and humidity sensors, light intensity sensors, gas concentration sensors and equipment operation status sensors, covering the environment and equipment operation status of the entire supply chain node. S12: Tag the raw data collected by each sensor, bind it to the corresponding timestamp, sensor number, supply chain node number and target food identifier, and construct a raw data tuple containing data content and traceability attributes; S13: Classify and organize the raw data tuples in S12, extract the environmental parameters and sensor state parameters respectively, and combine them to form the initial traceability data stream.
[0007] Optionally, S2 specifically includes: S21: Collect and organize multiple sets of environmental parameter data collected in the same supply chain node at the same time period, and form reading sets of temperature group, humidity group, light intensity group and gas concentration group according to parameter type. S22: Identify outliers in the reading set of each type of parameter, remove single data points that exceed the preset reasonable physical range, and generate a cleaned reference dataset; S23: Based on the reference dataset, calculate the degree of deviation between each sensor reading and the central trend value of the set, and statistically analyze the proportion of readings whose deviation is within the set tolerance range; S24: Based on the deviation ratio of each parameter in S23, construct the logical consistency evaluation result of the current data batch, and combine the weight coefficient of each type of parameter in the traceability scenario to comprehensively output the contextual credibility score of the corresponding batch.
[0008] Optionally, S23 specifically includes: S231: For each type of environmental parameter, the median of the cleaned reference dataset is selected as the set central trend value for the corresponding parameter type; S232: Calculate the corresponding deviation value based on the difference between the current reading of each sensor and the ensemble central trend value. ; S233: Set the tolerance threshold for the current parameter type to filter out deviation values from all sensors. The number of sensors less than or equal to the tolerance threshold, expressed as the percentage of deviation compliance in all readings.
[0009] Optionally, S24 specifically includes: S241: Based on the deviation ratio results of various environmental parameters obtained in S23, establish a parameter-level logical consistency matrix, where each matrix element corresponds to the deviation pass rate of a type of parameter. S242: Assign weight coefficients to different types of environmental parameters in the source tracing scenario and calculate the contextual credibility score for the current batch. .
[0010] Optionally, S3 specifically includes: S31: Bind the context credibility score output in S2 to the corresponding data batch to construct a data batch index structure with scores; S32: Set a scoring threshold for reliable data extraction. When the context reliability score of a data batch is higher than the scoring threshold, all sensor readings in the corresponding batch are directly retained. If it is lower than the scoring threshold, sensor data of each parameter type in the batch are removed. S33: For batch data below the scoring threshold, compare the deviation value of each sensor with the set central trend value for each category parameter, eliminate abnormal readings with deviations exceeding the set tolerance limit, and correct and fill the remaining valid data using trend compensation to form reconstructed reliable data items. S34: Collect all data batches that have been filtered and corrected by S32 and S33 into a unified high-reliability dataset for the current stage.
[0011] Optionally, S4 specifically includes: S41: Sort each batch of data in the high-reliability dataset according to the collection time order, and extract the traceability element information corresponding to each batch, including collection timestamp, supply chain node number, parameter type and corresponding reliability score; S42: Based on the sorted traceability element data, construct a directed chain structure, and connect adjacent data batches one by one through chain pointers according to the time evolution direction to form a preliminary traceability chain; S43: Embed the corresponding context credibility score for each data node and set an anomaly tolerance field to identify the fault tolerance range of the node under credibility boundary conditions; S44: Perform consistency verification and redundancy analysis on the completed traceability chain structure, eliminate duplicate records, and output a flexible traceability chain structure.
[0012] Optionally, S43 specifically includes: S431: Assign an anomaly tolerance field to each high-confidence data node, the anomaly tolerance field including a confidence lower limit threshold. ; and parameter fluctuation tolerance range ; During the operation or query of the traceability chain: When the actual credibility score of a data node is lower than its corresponding If so, the fault tolerance mechanism will be triggered; When the parameter data is within the fluctuation tolerance range Within this range, the node is marked as being in a critical trusted state; When it exceeds the tolerance range If the node is unavailable, it will be marked as an unusable node and removed during path calculation.
[0013] Optionally, S5 specifically includes: S51: After receiving the traceability query request, parse the elastic traceability chain corresponding to the queried target food and extract the contextual credibility score sequence of all associated data blocks in the chain, where each score value corresponds to a data block of a time threshold node in the chain. S52: Set the criteria for judging link validity, including the following two conditions: Judgment Criterion 1: The credibility score of any data block in the scoring sequence. It must not be lower than the set minimum tolerance confidence threshold. ; Judgment criterion 2: The number of unusable nodes allowed in the scoring sequence must not exceed the total number of nodes. ; If both of the above conditions are met, the link is considered complete; otherwise, the current query is terminated and a link error message is output. S53: Based on the credibility scores of each data block, a weighted average is used to calculate the overall path credibility score. .
[0014] Optionally, S5 further includes: S54: Retrieve the unique identifier information of the target food recorded in the query request, and extract the list of elastic traceability chain nodes participating in this path scoring, including the timestamp, supply chain node number and contextual credibility score of each node; S55: Based on the preset report structure template, construct the five structural areas of the evaluation report, including the title information area, food labeling information area, link node information area, node scoring details area, and path credibility output area. S56: Fill the corresponding structure area with the traceability node data and scoring results obtained in S54, and then output an evaluation report with credibility.
[0015] The beneficial effects of this invention are: This invention constructs a flexible traceability chain based on multi-node sensor data and combines it with a contextual credibility scoring mechanism to achieve logical consistency assessment, outlier removal, and trend compensation correction of initial traceability data, thereby improving the overall reliability of the traceability data. The data of each node is not only associated in chronological order, but also embedded with credibility scores and anomaly tolerance fields, so that the integrity and path continuity of the traceability chain can still be guaranteed even when the credibility of some nodes is insufficient.
[0016] This invention presents results in a structured report format, allowing users to intuitively obtain the credibility level of each node and the overall credibility of the path; it enhances the auditability of traceability results and the reference value for traceability decisions, and improves the timeliness of food safety incident response. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only for this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of a food safety data traceability method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the computational context credibility scoring process according to an embodiment of the present invention. Detailed Implementation
[0019] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. It should also be noted that, to make the embodiments more comprehensive, the following embodiments are the best and preferred embodiments, and those skilled in the art can use other alternative methods to implement some well-known technologies; moreover, the accompanying drawings are only for more specific description of the embodiments and are not intended to specifically limit the present invention.
[0020] It should be noted that the use of terms such as "an embodiment," "an embodiment," "an exemplary embodiment," and "some embodiments" in the specification indicates that the described embodiment may include a specific feature, structure, or characteristic, but not every embodiment necessarily includes that specific feature, structure, or characteristic. Furthermore, when a specific feature, structure, or characteristic is described in connection with an embodiment, implementing such a feature, structure, or characteristic in conjunction with other embodiments (whether explicitly described or not) should be within the knowledge of those skilled in the art.
[0021] Generally, terms can be understood at least partly from their use in context. For example, depending at least partly on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in a singular sense, or a combination of features, structures, or characteristics in a plural sense. Additionally, the term "based on" can be understood not necessarily to convey an exclusive set of factors, but rather, alternatively, depending at least partly on the context, to allow for the presence of other factors that are not necessarily explicitly described.
[0022] like Figures 1-2As shown, a food safety data traceability method includes the following steps: S1: Obtain multi-dimensional traceability data of the target food from a sensor cluster deployed at multiple nodes in the food supply chain, including environmental parameters and sensor status parameters, and output the initial traceability data stream; S1 specifically includes: S11: Real-time data streams corresponding to the target food are obtained from multiple types of sensors deployed in the food production, transportation, storage and sales process. The multiple types of sensors include temperature and humidity sensors, light intensity sensors, gas concentration sensors and equipment operation status sensors, covering the environment and equipment operation status of the entire supply chain node. S12: Tag the raw data collected by each sensor, bind it to the corresponding timestamp, sensor number, supply chain node number and target food identifier, and construct a raw data tuple containing data content and traceability attributes; S13: The raw data tuples in S12 are classified and organized. Environmental parameters (including temperature, humidity, light intensity and gas concentration) and sensor status parameters (including voltage, current, operating mode and sampling frequency) are extracted separately and combined to form an initial traceability data stream. Through the above steps, it is possible to systematically obtain environmental and equipment operating status information from multiple types of sensors deployed at high density throughout the entire food supply chain. This ensures the multi-dimensionality and completeness of traceability data and provides an accurate and traceable data foundation for subsequent credibility analysis and traceability path assessment.
[0023] S2: Perform contextual credibility analysis on the initial traceability data stream. Calculate the contextual credibility score for each data batch by comparing the logical consistency of readings from different sensors at the same node. S2 specifically includes: S21: Collect and organize multiple sets of environmental parameter data collected in the same supply chain node at the same time period, and form reading sets of temperature group, humidity group, light intensity group and gas concentration group according to parameter type. S22: Identify outliers in the reading set of each type of parameter, remove single data points that exceed the preset reasonable physical range, and generate a cleaned reference dataset; S23: Based on the reference dataset, calculate the degree of deviation between each sensor reading and the central trend value of the set, and statistically analyze the proportion of readings whose deviation is within the set tolerance range; S24: Based on the deviation ratio of each parameter in S23, construct the logical consistency evaluation result of the current data batch, and combine the weight coefficient of each type of parameter in the traceability scenario to comprehensively output the contextual credibility score of the corresponding batch. Through the above steps, it is possible to effectively identify local anomalies or hardware failure interference in multi-sensor data, construct a stable and quantifiable credibility scoring mechanism, thereby improving the reliability of the overall traceability data and the accuracy of subsequent processing.
[0024] S23 specifically includes: S231: For each type of environmental parameter, the median of the cleaned reference dataset is selected as the set central trend value for the corresponding parameter type to improve robustness to outliers; S232: Calculate the corresponding deviation value based on the difference between the current reading of each sensor and the ensemble central trend value. The deviation is measured in absolute difference form, and its calculation formula is as follows: ,in, Indicates the first The deviation value of each sensor; Indicates the first Environmental parameter readings collected by each sensor; This represents the median of all sensor readings for the corresponding parameter type. S233: Set the tolerance threshold for the current parameter type to filter out deviation values from all sensors. The number of sensors less than or equal to the tolerance threshold, expressed as the proportion of the total readings, represents the deviation compliance rate. The formula for this rate is: ,in, This indicates the proportion of readings where the deviation value is within the tolerance range for the corresponding parameter type; Indicates satisfaction The number of sensors under the conditions; This indicates the total number of sensors of the current parameter type. By using the above-mentioned median-based central tendency extraction and deviation pass rate statistical method, the interference of outliers on the results can be effectively reduced. Furthermore, the tolerance evaluation method enables the quantitative judgment of the stability and consistency of multi-sensor readings, thereby providing accurate and controllable basic support for subsequent logical consistency evaluation.
[0025] S24 specifically includes: S241: Based on the deviation ratio results of various environmental parameters obtained in S23, establish a parameter-level logical consistency matrix to reflect the stability characteristics of each type of environmental parameter in the current data batch, where each matrix element corresponds to the deviation pass rate of a type of parameter. S242: Assign weight coefficients to different types of environmental parameters in the source tracing scenario and calculate the contextual credibility score for the current batch. The formula is: ,in, This represents the contextual credibility score for the current data batch; Indicates the first Weighting coefficients for class environment parameters; Indicates the first The percentage of environmental parameters that meet the deviation requirements; This indicates the number of environmental parameter types involved in the scoring calculation. Through the above steps, the unified quantification of multi-parameter deviation results can be achieved. Combined with their actual importance in food traceability, a scientific and effective contextual credibility score can be obtained, thus laying a solid foundation for high-credibility data extraction and subsequent path evaluation.
[0026] S3: Based on contextual credibility scoring, filter and correct the initial source data stream to generate a highly credible dataset; S3 specifically includes: S31: Bind the context credibility score output in S2 to the corresponding data batch to construct a data batch index structure with scores, which serves as the input basis for filtering and correction. S32: Set a scoring threshold for reliable data extraction. When the context reliability score of a data batch is higher than the scoring threshold, all sensor readings in the corresponding batch are directly retained. If it is lower than the scoring threshold, sensor data of each parameter type in the batch are removed. S33: For batch data below the scoring threshold, compare the deviation value of each sensor with the set central trend value for each category parameter, eliminate abnormal readings with deviations exceeding the set tolerance limit, and correct and fill the remaining valid data using trend compensation to form reconstructed reliable data items. S34: The data batches filtered and corrected by S32 and S33 are uniformly collected into a high-reliability dataset for the current stage, which will be used for the construction of the subsequent elastic traceability chain. Through the above filtering and reconstruction steps, the interference of abnormal data sources on the overall data quality can be effectively eliminated, while retaining valid information with complete structure and consistent logic. This ensures that the generation process of the high-reliability dataset has both stability and adaptability, providing a solid data guarantee for the subsequent chain traceability construction.
[0027] The operating principle of the trend compensation method is as follows: After removing outlier readings that exceed the tolerance threshold, numerical inference and imputation are performed on the remaining valid data based on their trends over time. Specifically, the remaining readings for a given parameter are first sorted by time, and then a local linear trend or moving average model is constructed based on the magnitude of change between adjacent points. When a data point is missing due to removal, the estimated value of the missing point can be derived from the trend direction and magnitude of change of the two valid points before and after it, and this estimated value is used as the corrected data to fill in the corresponding position. This method maintains data continuity and statistical structure consistency without introducing externally intervened data, improving the overall stability and reliability of the completed dataset.
[0028] S4: Build a resilient traceability chain using a high-confidence dataset, where each data block in the resilient traceability chain is associated with its corresponding contextual credibility score; S4 specifically includes: S41: Sort each batch of data in the high-reliability dataset according to the collection time order, and extract the traceability element information corresponding to each batch, including collection timestamp, supply chain node number, parameter type and corresponding reliability score; S42: Based on the sorted traceability element data, construct a directed chain structure, and connect adjacent data batches one by one through chain pointers according to the time evolution direction to form a preliminary traceability chain; S43: Embed the corresponding context credibility score in each data node and set an anomaly tolerance field to identify the fault tolerance range of the node under credibility boundary conditions, so as to enhance the link recovery capability of the tracing chain in the event of local node damage or loss. S44: Perform consistency verification and redundancy analysis on the completed traceability chain structure, eliminate duplicate records, and output an elastic traceability chain structure with structural stability, fault tolerance, and data scoring binding characteristics. Through the above steps, dynamic traceability chain construction driven by time sequence and credibility information can be realized, so that the chain structure not only has the integrity of the traceability path, but also has anomaly tolerance and link elasticity, providing structured support for subsequent trusted path evaluation and trusted data tracking.
[0029] S43 specifically includes: S431: Assign an anomaly tolerance field to each high-trust data node. The anomaly tolerance field includes a trustworthiness lower limit threshold. This is used to define the minimum acceptable confidence boundary for the node; and the parameter fluctuation tolerance range. This is used to record the maximum acceptable fluctuation range of various environmental parameters; During the operation or query of the traceability chain: When the actual credibility score of a data node is lower than its corresponding Then the fault tolerance mechanism will be triggered, based on The fluctuation tolerance of each parameter determines whether the node data can still be used for the construction or reference calculation of the link tracing path; When the parameter data is within the fluctuation tolerance range If the overall credibility score is below the threshold but no fluctuation exceeds the limit, the node is marked as a critical credibility state, allowing it to participate in the tracing process as a suboptimal node in subsequent paths. When it exceeds the tolerance range If a node is found to be unavailable, it will be marked as unusable and removed from the path calculation. Through the above-mentioned exception tolerance field settings and dynamic judgment mechanism, it is possible to allow some boundary nodes to participate in path construction within a reasonable range while ensuring the overall credibility of the traceability chain. This will improve the fault tolerance capability and traceability continuity of the chain, and ensure that the system can maintain the integrity of the chain structure and logical coherence even when some node data deviates.
[0030] S5: When a traceability query request is received, the credibility of the overall traceability path is calculated based on the contextual credibility score of each data block in the elastic traceability chain, and an evaluation report with credibility is generated. S5 specifically includes: S51: After receiving the traceability query request, parse the elastic traceability chain corresponding to the queried target food and extract the contextual credibility score sequence of all associated data blocks in the chain, where each score value corresponds to a data block of a time threshold node in the chain. S52: Set the criteria for judging link validity, including the following two conditions: Judgment Criterion 1: The credibility score of any data block in the scoring sequence. It must not be lower than the set minimum tolerance confidence threshold. ; Judgment criterion 2: The number of unusable nodes allowed in the scoring sequence must not exceed the total number of nodes. ; If both of the above conditions are met, the link is considered complete and subsequent calculations can continue; otherwise, the current query is terminated and a link error message is output. S53: Based on the credibility scores of each data block, a weighted average is used to calculate the overall path credibility score. The formula is: ,in, Indicates the first Contextual credibility score for each data block; Indicates the first The weight of each data block in the path can be configured based on the location of the supply chain node or the time distance. This indicates the number of valid data blocks involved in the calculation. Through the above steps, it is possible to ensure that reasonable credibility assessment results are output under the premise that the path quality is controllable, thereby enhancing the reliability and practical applicability of the food safety data traceability system.
[0031] S5 also includes: S54: Retrieve the unique identifier information of the target food recorded in the query request, and extract the list of elastic traceability chain nodes participating in this path scoring, including the timestamp, supply chain node number and contextual credibility score of each node; S55: Based on the preset report structure template, construct the five structural areas of the evaluation report, including the title information area, food labeling information area, link node information area, node scoring details area, and path credibility output area. S56: Fill the corresponding structure area with the traceability node data and scoring results obtained in S54, and then output an assessment report with credibility. Through the above steps, the credibility scoring results can be associated with the traceability chain data and output, providing effective support for supervision and event analysis.
[0032] This invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of this invention. To provide the public with a thorough understanding of this invention, specific details are described in detail in the following preferred embodiments; however, those skilled in the art will fully understand the invention even without these details. Furthermore, to avoid unnecessary misunderstanding of the essence of this invention, well-known methods, processes, procedures, components, and circuits are not described in detail.
[0033] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for tracing food safety data, characterized in that, Includes the following steps: S1: Obtain multi-dimensional traceability data of the target food from a sensor cluster deployed at multiple nodes in the food supply chain, including environmental parameters and sensor status parameters, and output the initial traceability data stream; S2: Perform contextual credibility analysis on the initial traceability data stream. Calculate the contextual credibility score for each data batch by comparing the logical consistency of readings from different sensors at the same node. S3: Based on contextual credibility scoring, filter and correct the initial source data stream to generate a highly credible dataset; S4: Construct a resilient traceability chain using a high-confidence dataset, in which each data block is associated with its corresponding contextual credibility score; S5: When a traceability query request is received, the credibility of the overall traceability path is calculated based on the contextual credibility score of each data block in the elastic traceability chain, and an evaluation report with credibility is generated.
2. The food safety data traceability method according to claim 1, characterized in that, S1 specifically includes: S11: Real-time data streams corresponding to the target food are obtained from multiple types of sensors deployed in the food production, transportation, storage and sales process. The multiple types of sensors include temperature and humidity sensors, light intensity sensors, gas concentration sensors and equipment operation status sensors, covering the environment and equipment operation status of the entire supply chain node. S12: Tag the raw data collected by each sensor, bind it to the corresponding timestamp, sensor number, supply chain node number and target food identifier, and construct a raw data tuple containing data content and traceability attributes; S13: Classify and organize the raw data tuples in S12, extract the environmental parameters and sensor state parameters respectively, and combine them to form the initial traceability data stream.
3. The food safety data traceability method according to claim 1, characterized in that, S2 specifically includes: S21: Collect and organize multiple sets of environmental parameter data collected in the same supply chain node at the same time period, and form reading sets of temperature group, humidity group, light intensity group and gas concentration group according to parameter type. S22: Identify outliers in the reading set of each type of parameter, remove single data points that exceed the preset reasonable physical range, and generate a cleaned reference dataset; S23: Based on the reference dataset, calculate the degree of deviation between each sensor reading and the central trend value of the set, and statistically analyze the proportion of readings whose deviation is within the set tolerance range; S24: Based on the deviation ratio of each parameter in S23, construct the logical consistency evaluation result of the current data batch, and combine the weight coefficient of each type of parameter in the traceability scenario to comprehensively output the contextual credibility score of the corresponding batch.
4. The food safety data traceability method according to claim 3, characterized in that, S23 specifically includes: S231: For each type of environmental parameter, the median of the cleaned reference dataset is selected as the set central trend value for the corresponding parameter type; S232: Calculate the corresponding deviation value based on the difference between the current reading of each sensor and the ensemble central trend value. ; S233: Set the tolerance threshold for the current parameter type to filter out deviation values from all sensors. The number of sensors less than or equal to the tolerance threshold, expressed as the percentage of deviation compliance in all readings.
5. The food safety data traceability method according to claim 4, characterized in that, S24 specifically includes: S241: Based on the deviation ratio results of various environmental parameters obtained in S23, establish a parameter-level logical consistency matrix, where each matrix element corresponds to the deviation pass rate of a type of parameter. S242: Assign weight coefficients to different types of environmental parameters in the source tracing scenario and calculate the contextual credibility score for the current batch. .
6. The food safety data traceability method according to claim 1, characterized in that, S3 specifically includes: S31: Bind the context credibility score output in S2 to the corresponding data batch to construct a data batch index structure with scores; S32: Set a scoring threshold for reliable data extraction. When the context reliability score of a data batch is higher than the scoring threshold, all sensor readings in the corresponding batch are directly retained. If it is lower than the scoring threshold, sensor data of each parameter type in the batch are removed. S33: For batch data below the scoring threshold, compare the deviation value of each sensor with the set central trend value for each category parameter, eliminate abnormal readings with deviations exceeding the set tolerance limit, and correct and fill the remaining valid data using trend compensation to form reconstructed reliable data items. S34: Collect all data batches that have been filtered and corrected by S32 and S33 into a unified high-reliability dataset for the current stage.
7. The food safety data traceability method according to claim 1, characterized in that, S4 specifically includes: S41: Sort each batch of data in the high-reliability dataset according to the collection time order, and extract the traceability element information corresponding to each batch, including collection timestamp, supply chain node number, parameter type and corresponding reliability score; S42: Based on the sorted traceability element data, construct a directed chain structure, and connect adjacent data batches one by one through chain pointers according to the time evolution direction to form a preliminary traceability chain; S43: Embed the corresponding context credibility score for each data node and set an anomaly tolerance field to identify the fault tolerance range of the node under credibility boundary conditions; S44: Perform consistency verification and redundancy analysis on the completed traceability chain structure, eliminate duplicate records, and output a flexible traceability chain structure.
8. The food safety data traceability method according to claim 7, characterized in that, Specifically, S43 includes: S431: Assign an anomaly tolerance field to each high-confidence data node, the anomaly tolerance field including a confidence lower limit threshold. ; and parameter fluctuation tolerance range ; During the operation or query of the traceability chain: When the actual credibility score of a data node is lower than its corresponding If so, the fault tolerance mechanism will be triggered; When the parameter data is within the fluctuation tolerance range Within this range, the node is marked as being in a critical trusted state; When it exceeds the tolerance range If the node is unavailable, it will be marked as an unusable node and removed during path calculation.
9. A food safety data traceability method according to claim 8, characterized in that, S5 specifically includes: S51: After receiving the traceability query request, parse the elastic traceability chain corresponding to the queried target food and extract the contextual credibility score sequence of all associated data blocks in the chain, where each score value corresponds to a data block of a time threshold node in the chain. S52: Set the criteria for judging link validity, including the following two conditions: Judgment Criterion 1: The credibility score of any data block in the scoring sequence. It must not be lower than the set minimum tolerance confidence threshold. ; Judgment criterion 2: The number of unusable nodes allowed in the scoring sequence must not exceed the total number of nodes. ; If both of the above conditions are met, the link is considered complete; otherwise, the current query is terminated and a link error message is output. S53: Based on the credibility scores of each data block, a weighted average is used to calculate the overall path credibility score. .
10. A food safety data traceability method according to claim 9, characterized in that, The S5 also includes: S54: Retrieve the unique identifier information of the target food recorded in the query request, and extract the list of elastic traceability chain nodes participating in this path scoring, including the timestamp, supply chain node number and contextual credibility score of each node; S55: Based on the preset report structure template, construct the five structural areas of the evaluation report, including the title information area, food labeling information area, link node information area, node scoring details area, and path credibility output area. S56: Fill the corresponding structure area with the traceability node data and scoring results obtained in S54, and then output an evaluation report with credibility.