Ice cream food quality and safety traceability management system based on big data

CN122573140APending Publication Date: 2026-08-14JINING DIVINO FOOD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

各类业务数据散落于不同系统,无法实现统一归档与集中管理

Benefits of technology

对冰淇淋生产链产生的原料数据、加工环境数据、成品检测数据进行统一格式归集,纳入分布式存储集群进行集中管理,统一规范多源异构数据的存储标准。通过标准化数据清洗与跨环节关联映射处理,打通生产各环节数据壁垒,串联形成覆盖全流程的冰淇淋批次溯源链。依托完整溯源链搭建食品安全风险评估矩阵,整合多维度安全评价指标,建立系统化的风险量化评定体系,改变零散数据无法开展整体性风险研判的局限,为食品质量安全评估提供规整化的数据基础与结构化评价依据。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122573140A_ABST
    Figure CN122573140A_ABST
Patent Text Reader

Abstract

This invention discloses a big data-based traceability and management system for ice cream food quality and safety, belonging to the field of food traceability management technology. It includes collecting raw material data, processing environment data, and finished product testing data through IoT terminals deployed in the ice cream production chain. All types of data are processed in a unified format and stored in a distributed storage cluster. Data cleaning and correlation mapping are performed within the cluster to generate a complete ice cream batch traceability chain and construct a food safety risk assessment matrix. The assessment matrix is ​​then integrated into a graph database to build a dedicated risk propagation map for each batch of ice cream. After receiving the target batch number, the front-end query interface can quickly retrieve and match the corresponding risk propagation map in the graph database and output a risk traceability report. This system achieves unified collection and standardized correlation integration of data from the entire ice cream production chain. Relying on a graph database to depict risk correlation and propagation relationships, it can quickly complete batch traceability retrieval and safety risk tracing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of food traceability management technology, specifically a big data-based traceability and tracking management system for ice cream food quality and safety. Background Technology

[0002] The ice cream production process encompasses multiple stages, including raw material supply, workshop processing, and finished product testing. This long production chain involves a wide variety of data. Existing food quality and safety traceability systems often employ a model of independent recording and decentralized storage at each stage. The various data collected by IoT terminals in the production chain lack a unified standardized format and a dedicated distributed storage architecture for centralized aggregation. As a result, various business data are scattered across different systems, making unified archiving and centralized management impossible.

[0003] The lack of standardized data cleaning processes and cross-process correlation mapping mechanisms among data from different stages of production results in fragmented data that cannot be linked to form a complete batch traceability chain covering the entire production cycle. Furthermore, the industry lacks the technical means to build a standardized risk assessment matrix based on end-to-end traceability information; risk assessment relies solely on single indicators, failing to achieve a multi-dimensional and systematic risk management system.

[0004] Conventional traceability platforms typically use ordinary relational databases to store business information, lacking the ability to deeply characterize risk relationships and unable to independently establish risk propagation structures for individual batches. Traceability queries can only retrieve scattered entry information, failing to fully elucidate the risk transmission logic or generate structured traceability reports. Traditional models suffer from weak data integration capabilities, simplistic risk modeling methods, and insufficient correlation traceability functions, making it difficult to meet the needs of full-chain quality control, precise batch traceability, and closed-loop tracking of safety risks in the ice cream food industry. Summary of the Invention

[0005] This invention aims to solve at least one of the technical problems existing in the prior art; Therefore, this invention proposes a big data-based traceability and management system for ice cream food quality and safety, comprising: The data acquisition module acquires raw material data, processing environment data, and finished product testing data through multiple IoT acquisition terminals distributed throughout the ice cream production chain; The data storage module uploads the raw material data, the processing environment data, and the finished product testing data to a distributed storage cluster in a unified data format. The data processing module performs data cleaning and correlation mapping on the raw material data, the processing environment data, and the finished product testing data in the distributed storage cluster to generate a complete ice cream batch traceability chain. The risk assessment module constructs a food safety risk assessment matrix based on the ice cream batch traceability chain. The graph construction module inputs the food safety risk assessment matrix into a graph database and creates a risk propagation graph for each batch of ice cream in the graph database. The query output module receives a target ice cream batch number through a front-end query interface, retrieves the corresponding risk propagation map from the graph database based on the target ice cream batch number, and outputs a risk traceability report for that batch of ice cream.

[0006] Furthermore, the step of acquiring raw material data, processing environment data, and finished product testing data through multiple IoT data acquisition terminals distributed throughout the ice cream production chain specifically includes: A first type of IoT data acquisition terminal is deployed in the storage tanks of ice cream ingredient suppliers. The first type of IoT data acquisition terminal has a built-in temperature sensor and a pH sensor. The first type of IoT acquisition terminal is configured to continuously acquire the raw material temperature value and raw material pH value in the raw material storage tank at a first sampling frequency, and encapsulate the timestamp of the acquisition time and the identification code of the storage tank together into a raw material data packet; A second type of IoT data acquisition terminal is deployed at each processing node in the ice cream production workshop. The second type of IoT data acquisition terminal has a built-in air particulate matter sensor, air temperature sensor and air humidity sensor. The second type of IoT acquisition terminal is configured to continuously collect the air particulate matter concentration, air temperature value and air humidity value at the processing node at the second sampling frequency, and the timestamp of the collection time and the identification code of the processing node are encapsulated together into a processing environment data packet. A third type of IoT data acquisition terminal is deployed at the end of the finished ice cream packaging line. The third type of IoT data acquisition terminal has a built-in infrared component analyzer and a visual imaging module. The third type of IoT acquisition terminal is configured to acquire the fat content, protein content and packaging appearance image of each ice cream product at a third sampling frequency, and encapsulate the timestamp of the acquisition time and the batch number of the finished product together into a finished product detection data packet; After adding a checksum to the raw material data packet, the processing environment data packet, and the finished product testing data packet, they are forwarded to the distributed storage cluster through the wireless gateway.

[0007] Furthermore, the step of uploading the raw material data, the processing environment data, and the finished product testing data to a distributed storage cluster in a unified data format specifically includes: The raw material temperature value, raw material pH value, timestamp of the acquisition time, and identification code of the storage tank are parsed from the raw material data packet. The air particulate matter concentration, air temperature value, air humidity value, timestamp of the collection time, and identification code of the processing node are parsed from the processing environment data packet. The fat content value, protein content value, packaging appearance image, timestamp of the collection time, and batch number of the finished product are parsed from the finished product test data package. The parsed raw material temperature value, raw material pH value, storage tank identification code, and corresponding collection time timestamp are combined into a raw material record line. The raw material record line is stored in a key-value pair structure, where the key is a string combining the storage tank identifier and the timestamp, and the value is a string concatenated with the raw material temperature value and the raw material pH value. The parsed air particulate matter concentration, air temperature value, air humidity value, processing node identification code, and corresponding collection time timestamp are combined into an environmental record line. The environmental record line is stored in a key-value pair structure, where the key is a string combining the processing node identifier and the timestamp, and the value is a string concatenated with the air particulate matter concentration, air temperature value, and air humidity value. The parsed fat content value, protein content value, image hash value of the packaging appearance image, finished product batch number, and corresponding timestamp of the collection time are combined into a finished product record row. The finished product record row is stored in a key-value pair structure, where the key is a string combining the finished product batch number and the timestamp, and the value is a string concatenated with the fat content value, protein content value, and image hash value. The raw material record line, the environmental record line, and the finished product record line are written to different data shards in the distributed storage cluster, and three replicas are created for each data shard and stored on different physical nodes.

[0008] Furthermore, the step of performing data cleaning and association mapping on the raw material data, the processing environment data, and the finished product testing data in the distributed storage cluster to generate a complete ice cream batch traceability chain specifically includes: The raw material record line is read from the distributed storage cluster. The raw material temperature value and raw material pH value in the raw material record line are checked for missing values. When the raw material temperature value is missing for three consecutive time points, the missing value is estimated by linear interpolation based on the raw material temperature value at the two time points before and after the missing value. The environmental record line is read from the distributed storage cluster, and anomaly detection is performed on the air particulate matter concentration in the environmental record line. When a single air particulate matter concentration value is detected to exceed a preset multiple of the historical average, the anomaly value is replaced with the arithmetic mean of the air particulate matter concentrations at the previous time point and the next time point. The finished product record line is read from the distributed storage cluster, and the consistency of the fat content value and protein content value in the finished product record line is checked. When the ratio of the fat content value to the protein content value exceeds the standard formula ratio range, the finished product record line is marked as a record to be reviewed. Based on the identification code of the storage tank in the raw material record line and the batch number of the finished product in the finished product record line, a material flow mapping table is established from the storage tank to the production workshop and then to the finished product packaging. Align each mapping relationship in the material flow mapping table with the corresponding timestamp of the collection time on the time axis, remove isolated record rows that cannot be matched on the time axis, and obtain the aligned record row set; Extract all raw material record lines, environmental record lines, and finished product record lines with the same finished product batch number from the aligned record line set, arrange them in ascending order according to the timestamp of the collection time, and generate a complete ice cream batch traceability chain.

[0009] Furthermore, the material flow mapping table is generated by matching the storage tank identifier with the preset production plan batch material allocation table.

[0010] Furthermore, the step of constructing a food safety risk assessment matrix based on the ice cream batch traceability chain specifically includes: Extract the raw material temperature value at each collection time from the ice cream batch traceability chain, and calculate the maximum, minimum and average raw material temperature values ​​of the batch of ice cream during the entire raw material storage stage; Extract the pH value of the raw materials at each collection time from the ice cream batch traceability chain, and calculate the magnitude and rate of change of the pH value of the raw materials in the entire raw material storage stage of the batch of ice cream; Extract the air particulate matter concentration, air temperature value, and air humidity value at each collection moment from the ice cream batch traceability chain, and calculate the integral value of air particulate matter concentration, the variance of air temperature value fluctuation, and the cumulative offset of air humidity value for the batch of ice cream throughout the entire processing stage. Extract the fat content and protein content of the batch of ice cream from the batch traceability chain, and calculate the deviation of the fat content from the standard fat content and the deviation of the protein content from the standard protein content. The maximum raw material temperature value, the minimum raw material temperature value, the average raw material temperature value, the variation range of the raw material pH value, the rate of change of the raw material pH value, the integral value of the air particulate matter concentration, the variance of the air temperature value fluctuation, the cumulative offset of the air humidity value, the deviation value of the fat content value, and the deviation value of the protein content value are each used as a risk assessment dimension. A safety threshold range is preset for each risk assessment dimension. The actual value of each risk assessment dimension is mapped to the corresponding safety threshold range to obtain the risk level score of each risk assessment dimension. The risk level scores of all risk assessment dimensions are arranged into a multi-dimensional vector in the order of raw material stage, processing stage and finished product stage. This multi-dimensional vector is used as the food safety risk assessment matrix for this batch of ice cream.

[0011] Furthermore, the safety threshold range is calculated by adding or subtracting three times the standard deviation from the historical data average of this evaluation dimension.

[0012] Furthermore, the step of inputting the food safety risk assessment matrix into a graph database and establishing a risk propagation map for each batch of ice cream in the graph database specifically includes: Extract the risk level score of the raw material stage from the food safety risk assessment matrix, and write the risk level score of the raw material stage as the raw material node attribute into the graph database. The risk level score of the processing stage is extracted from the food safety risk assessment matrix, and the risk level score of the processing stage is written into the graph database as a process node attribute. Extract the risk level score of the finished product stage from the food safety risk assessment matrix, and write the risk level score of the finished product stage as the finished product node attribute into the graph database. In the graph database, a first directed edge is created between the raw material node and the process node. The direction of the first directed edge is from the raw material node to the process node. The weight value of the first directed edge is equal to the product of the risk level score of the raw material stage and the risk level score of the processing stage. In the graph database, a second directed edge is created between the process node and the finished product node. The direction of the second directed edge is from the process node to the finished product node. The weight value of the second directed edge is equal to the product of the risk level score of the processing stage and the risk level score of the finished product stage. A unique batch identifier node is created for each batch of ice cream in the graph database, and the raw material node, the process node, and the finished product node are respectively connected to the batch identifier node to form a risk propagation graph centered on the batch identifier node; When multiple batches of ice cream use the same batch of raw materials from the same supplier, a shared raw material node is established between the risk propagation maps corresponding to the multiple batches of ice cream, and the risk propagation maps of the multiple batches of ice cream are connected through the shared raw material node.

[0013] Furthermore, the step of receiving a target ice cream batch number through a front-end query interface, retrieving the corresponding risk propagation graph in the graph database based on the target ice cream batch number, and outputting a risk traceability report for that batch of ice cream specifically includes: The system receives a target ice cream batch number input by the user through the front-end query interface, performs format verification on the target ice cream batch number, and confirms that the target ice cream batch number conforms to the preset batch number encoding rules. Perform a node matching query in the graph database to find batch identifier nodes whose batch identifier node values ​​in the node attributes completely match the target ice cream batch number. When a perfectly matching batch identifier node is found, start from that batch identifier node and traverse all raw material nodes, all process nodes, and all finished product nodes connected to that batch identifier node. Read the risk level score of the raw material stage from each raw material node, read the risk level score of the processing stage from each process node, and read the risk level score of the finished product stage from each finished product node; Based on the directions of the first directed edge and the second directed edge, the risk level scores of the raw material stage, the processing stage, and the finished product stage are linked together to form a risk transmission path sequence. Read the weight values ​​of the first directed edge and the second directed edge from the graph database, and append the weight values ​​to the corresponding positions in the risk transmission path sequence; The risk transmission path sequence, the weight value of the first directed edge, and the weight value of the second directed edge are combined into a structured risk report, and the structured risk report is output in the form of a visual chart as the risk traceability report for this batch of ice cream.

[0014] Furthermore, the visualization chart is a Sankey diagram that includes risk level scores, risk transmission path sequences, and directed edge weights.

[0015] Compared with the prior art, the beneficial effects of the present invention are: Raw material data, processing environment data, and finished product testing data generated throughout the ice cream production chain are collected in a unified format and centrally managed within a distributed storage cluster, standardizing the storage of multi-source heterogeneous data. Through standardized data cleaning and cross-stage correlation mapping, data barriers between different production stages are broken down, forming a complete batch traceability chain for ice cream. Based on this comprehensive traceability chain, a food safety risk assessment matrix is ​​built, integrating multi-dimensional safety evaluation indicators to establish a systematic risk quantification assessment system. This overcomes the limitations of fragmented data in conducting holistic risk assessments, providing a standardized data foundation and structured evaluation basis for food quality and safety evaluation.

[0016] By integrating the food safety risk assessment matrix into a graph database and leveraging the associative storage characteristics of graph data structures, a risk propagation map is independently constructed for each batch of ice cream. The inherent logical connections between each node in the production process are fully preserved, recording the correlation and transmission relationships of safety risks throughout the production chain, achieving structured storage and solidified associations of risk elements. By inputting the target batch number through a front-end query interface, the corresponding risk propagation map can be accurately retrieved from the graph database, automatically integrating all-chain related information to generate a standardized risk traceability report. A complete operational process is established, from data collection, chain construction, risk modeling to graph retrieval and report output, strengthening the data integration and risk traceability capabilities of the entire food production process. This enables rapid batch information retrieval, precise risk source location, and complete safety chain review, supporting the orderly implementation of routine supervision and full-process traceability management of ice cream food quality and safety. Attached Figure Description

[0017] Figure 1 This is a sequence diagram of the ice cream food quality and safety traceability management system based on big data as described in this invention; Figure 2 A flowchart illustrating the workflow for IoT data acquisition terminals to obtain various types of production data. Figure 3 A flowchart for constructing a food safety risk assessment matrix. Detailed Implementation

[0018] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] See Figure 1The specific implementation of the big data-based ice cream food quality and safety traceability management system is as follows: The overall implementation scheme of the system includes a data acquisition module, a data storage module, a data processing module, a risk assessment module, a graph construction module, and a query output module. The data acquisition module acquires raw material data, processing environment data, and finished product testing data through multiple IoT acquisition terminals distributed in the ice cream production chain. The data storage module uploads the raw material data, processing environment data, and finished product testing data to a distributed storage cluster in a unified data format. The data processing module performs data cleaning and correlation mapping on the raw material data, processing environment data, and finished product testing data in the distributed storage cluster to generate a complete ice cream batch traceability chain. The risk assessment module constructs a food safety risk assessment matrix based on the ice cream batch traceability chain. The graph construction module inputs the food safety risk assessment matrix into a graph database and establishes a risk propagation graph for each batch of ice cream in the graph database. The query output module receives a target ice cream batch number through a front-end query interface, retrieves the corresponding risk propagation graph in the graph database based on the target ice cream batch number, and outputs a risk traceability report for that batch of ice cream.

[0020] In one embodiment of the present invention, when deploying the first type of IoT data acquisition terminal, refer to... Figure 2 A first type of IoT data acquisition terminal is deployed in the storage tanks of ice cream ingredient suppliers. This first type of IoT data acquisition terminal has built-in temperature and pH sensors. It is set to continuously collect the temperature and pH values ​​of the ingredients in the storage tanks at a first sampling frequency, and encapsulate the timestamp of the collection time and the identification code of the storage tank into an ingredient data package. A second type of IoT data acquisition terminal is deployed at each processing node in the ice cream production workshop. This second type of IoT data acquisition terminal has built-in air particulate matter, air temperature, and air humidity sensors. It is set to continuously collect the air particulate matter concentration and air humidity at the processing node at a second sampling frequency. The data includes air temperature and humidity values, and the timestamp of the collection time and the identification code of the processing node are encapsulated into a processing environment data packet. A third type of IoT data acquisition terminal is deployed at the end of the ice cream finished product packaging line. This third type of IoT data acquisition terminal has a built-in infrared component analyzer and a visual imaging module. The third type of IoT data acquisition terminal is set to collect the fat content value, protein content value and packaging appearance image of each ice cream finished product at a third sampling frequency. The timestamp of the collection time and the finished product batch number are encapsulated into a finished product detection data packet. After adding a check code to the raw material data packet, the processing environment data packet and the finished product detection data packet, they are forwarded to the distributed storage cluster through the wireless gateway.

[0021] The raw material temperature value, raw material pH value, timestamp of the collection time, and identification code of the storage tank are parsed from the raw material data package. The air particulate matter concentration, air temperature value, air humidity value, timestamp of the collection time, and identification code of the processing node are parsed from the processing environment data package. The fat content value, protein content value, packaging appearance image, timestamp of the collection time, and batch number of the finished product are parsed from the finished product detection data package. The parsed raw material temperature value, raw material pH value, identification code of the storage tank, and corresponding timestamp of the collection time are combined into a raw material record line.

[0022] The raw material record line is stored using a key-value pair structure. The key is a string combining the storage tank identifier and a timestamp, and the value is a string concatenated with the raw material temperature and pH values. The parsed air particulate matter concentration, air temperature, air humidity, processing node identification code, and corresponding collection time timestamp are combined into an environmental record line, which is also stored using a key-value pair structure. The key is a string combining the processing node identifier and a timestamp, and the value is a string concatenated with the air particulate matter concentration, air temperature, and air humidity values. The parsed fat content, protein content, image hash value of the packaging appearance image, finished product batch number, and corresponding collection time timestamp are combined into a finished product record line, which is also stored using a key-value pair structure. The key is a string combining the finished product batch number and a timestamp, and the value is a string concatenated with the fat content, protein content, and image hash value. The raw material record line, environmental record line, and finished product record line are written to different data shards in the distributed storage cluster, and three copies are created for each data shard and stored on different physical nodes.

[0023] In practical implementation, a first type of IoT data acquisition terminal is deployed in a storage tank of an ice cream ingredient supplier. This terminal has a built-in temperature and pH sensor and is set to continuously collect the temperature and pH values ​​of the ingredients in the storage tank at a first sampling frequency of once every 30 seconds. The timestamp of the collection time and the storage tank's identification code are encapsulated together as an ingredient data package. A second type of IoT data acquisition terminal is deployed at the mixing and stirring processing node in the ice cream production workshop. This terminal has a built-in air particulate matter sensor, air temperature sensor, and air humidity sensor and is set to continuously collect the air particulate matter concentration, air temperature, and humidity values ​​at the mixing and stirring processing node at a second sampling frequency of once every 10 seconds. The data includes air humidity values, and the timestamp of the collection time and the identification code of the processing node are encapsulated into a processing environment data package. At the end of the ice cream packaging line, a third type of IoT data acquisition terminal is deployed. The third type of IoT data acquisition terminal has a built-in infrared component analyzer and a visual imaging module. The third type of IoT data acquisition terminal is set to collect the fat content value, protein content value and packaging appearance image of each ice cream product at a third sampling frequency of one sampling frequency per product. The timestamp of the collection time and the product batch number are encapsulated into a finished product detection data package. After adding a check code to the raw material data package, the processing environment data package and the finished product detection data package, they are forwarded to the distributed storage cluster through a wireless gateway. The check code is generated using a cyclic redundancy check algorithm and has a length of 16 bits.

[0024] In some embodiments, the raw material temperature value, raw material pH value, timestamp of the collection time, and identification code of the storage tank are parsed from the raw material data package; the air particulate matter concentration, air temperature value, air humidity value, timestamp of the collection time, and identification code of the processing node are parsed from the processing environment data package; and the fat content value, protein content value, packaging appearance image, timestamp of the collection time, and batch number of the finished product are parsed from the finished product testing data package. The parsed raw material temperature value, raw material pH value, identification code of the storage tank, and the corresponding timestamp of the collection time are combined into a raw material record row. The raw material record row is stored in a key-value pair structure, where the key is a string combining the identification code of the storage tank and the timestamp, and the value is a string concatenated with the raw material temperature value and the raw material pH value.

[0025] The parsed air particulate matter concentration, air temperature, air humidity, processing node identification code, and corresponding timestamp of the collection time are combined into an environmental record row. The environmental record row is stored in a key-value pair structure, where the key is a string combining the processing node identification code and the timestamp, and the value is a string concatenated with the air particulate matter concentration, air temperature, and air humidity values. The parsed fat content, protein content, image hash value of the packaging appearance image, finished product batch number, and corresponding timestamp of the collection time are combined into a finished product record row. The finished product record row is stored in a key-value pair structure, where the key is a string combining the finished product batch number and the timestamp, and the value is a string concatenated with the fat content, protein content, and image hash value. The raw material record row, environmental record row, and finished product record row are written to different data shards in the distributed storage cluster, and three copies are created for each data shard and stored on different physical nodes.

[0026] Optionally, the image hash value of the packaging appearance image is extracted from the packaging appearance image using a perceptual hashing algorithm. The calculation formula for the perceptual hashing algorithm is as follows:

[0027] in: This refers to an image of the packaging. This represents the generated 64-bit image hash value. This represents the binary quantization value of the i-th low-frequency coefficient obtained by scaling the packaging appearance image to 8×8 pixels and then performing a discrete cosine transform. In some embodiments, when the raw material record line, environmental record line, and finished product record line are written to different data shards in the distributed storage cluster, the record lines are allocated to the corresponding data shards according to the hour interval to which the timestamp of the collection time belongs. The size of each data shard is set to 64 megabytes. When a data shard reaches 64 megabytes, the data shard is closed and a new data shard is created. When creating three replicas for each data shard, the first replica is stored on the same physical node as the data shard writing node, the second replica is stored on a different physical node located in the same rack as the writing node, and the third replica is stored on another physical node located in a different rack than the writing node.

[0028] It is understandable that the checksum in the raw material data packet is used to detect whether a bit error has occurred in the raw material data packet during transmission before the wireless gateway forwards it to the distributed storage cluster. When the wireless gateway detects that the checksum does not match the content of the raw material data packet, it discards the raw material data packet and sends a retransmission request to the first type of IoT acquisition terminal. The checksums in the processing environment data packet and the finished product detection data packet are generated using the same cyclic redundancy check algorithm as the raw material data packet, and the same error detection and retransmission mechanism is implemented.

[0029] Optionally, if the first type of IoT acquisition terminal fails to receive an acknowledgment signal from the wireless gateway after sending raw material data packets three times consecutively, it will temporarily store the unacknowledged raw material data packets in its local cache and upload the temporarily stored raw material data packets in batches after the next successful transmission; the second type of IoT acquisition terminal and the third type of IoT acquisition terminal perform the same local caching and batch retransmission operations.

[0030] It is understandable that the identification code of the storage tank adopts a globally unique identifier format, with a length of 32-bit hexadecimal string. The identification code of the processing node adopts a three-segment code consisting of the factory number, the production line number, and the node sequence number. The finished product batch number adopts a three-segment code consisting of the production date, the production line number, and the sequence number. The timestamp is represented by the number of milliseconds that have elapsed since 00:00 on January 1, 1970.

[0031] In one embodiment of the present invention, the raw material record line is read from the distributed storage cluster, and missing value detection is performed on the raw material temperature value and raw material pH value in the raw material record line. When three consecutive time points of raw material temperature value are missing, the missing value is estimated using linear interpolation based on the raw material temperature values ​​of the two time points before and after the missing value. The environmental record line is read from the distributed storage cluster, and outlier detection is performed on the air particulate matter concentration in the environmental record line. When a single air particulate matter concentration value is detected to exceed a preset multiple of the historical average, the outlier value is replaced with the arithmetic mean of the air particulate matter concentrations of the previous and next time points. The finished product record line is read from the distributed storage cluster, and consistency verification is performed on the fat content value and protein content value in the finished product record line. When the fat content... When the ratio of the value to the protein content value exceeds the standard formula ratio range, the finished product record is marked as a record pending verification. Based on the identification code of the storage tank in the raw material record and the finished product batch number in the finished product record, a material flow mapping table is established from the storage tank to the production workshop and then to the finished product packaging. Each mapping relationship in the material flow mapping table is aligned with the timestamp of the corresponding collection time on the timeline. Isolated record rows that cannot be matched on the timeline are removed to obtain an aligned record row set. All raw material record rows, environmental record rows, and finished product record rows with the same finished product batch number are extracted from the aligned record row set and arranged in ascending order according to the timestamp of the collection time to generate a complete ice cream batch traceability chain. The material flow mapping table is generated by matching the storage tank identifier with the preset production plan batch ingredient table.

[0032] In practice, raw material record rows are read from the distributed storage cluster. Missing value detection is performed on the raw material temperature and pH values ​​in these record rows. When three consecutive time points of raw material temperature value are missing, linear interpolation is used to estimate the missing value based on the raw material temperature values ​​at the two time points before and after the missing value. The formula for linear interpolation is as follows:

[0033] in: Indicates missing moments The calculated results of the raw material temperature value, This represents the raw material temperature value at the second time point before the missing time. This represents the raw material temperature value at the second time point after the missing time. The timestamp value representing the missing moment. and These represent the timestamp values ​​at two points in time, one before and one after. The environmental record line is read from the distributed storage cluster, and anomaly detection is performed on the air particulate matter concentration in the environmental record line. When a single air particulate matter concentration value exceeds a preset multiple of the historical average, the anomaly is replaced with the arithmetic mean of the air particulate matter concentrations at the previous and next time points. The preset multiple of the historical average is set to 3 times, and the historical average is calculated from all air particulate matter concentration values ​​within the same hourly interval of the same processing node over the past 30 days. The finished product record line is read from the distributed storage cluster, and consistency verification is performed on the fat content and protein content values ​​in the finished product record line. When the ratio of the fat content value to the protein content value exceeds the standard formula ratio range, the finished product record line is marked as a record pending review. The standard formula ratio range is between 1.8 and 2.2 for the fat content value divided by the protein content value.

[0034] In some embodiments, a material flow mapping table is established from the storage tank to the production workshop and then to the finished product packaging based on the identification code of the storage tank in the raw material record row and the finished product batch number in the finished product record row. The material flow mapping table is generated by matching the identification code of the storage tank with a preset production plan batch material allocation table. The production plan batch material allocation table records the identification code of the raw material supplier's storage tank, the feeding time window, and the identification code of each processing node corresponding to each finished product batch number. Each mapping relationship in the material flow mapping table is aligned with the timestamp of the corresponding collection time on the time axis. The specific operation of time axis alignment is as follows: for each raw material record row, the feeding time window containing the timestamp of its collection time is searched in the production plan batch material allocation table. If the feeding time window containing the timestamp is not found, the raw material record row is marked as an isolated record row.

[0035] For each environmental record line, the corresponding processing node in the production plan batch material table is searched based on the timestamp of its collection time to determine whether it is in production operation at that time. If the processing node is in shutdown state at that time, the environmental record line is marked as an isolated record line. For each finished product record line, the packaging time window corresponding to the finished product batch number is searched based on the timestamp of its collection time in the production plan batch material table. If the timestamp of the collection time is not within the packaging time window, the finished product record line is marked as an isolated record line. All record lines marked as isolated record lines are removed to obtain the aligned record line set.

[0036] Optionally, when detecting outliers in the air particulate matter concentration in the environmental record line, the preset multiple of the historical average value is dynamically adjusted according to the cleanliness level of the processing node. For processing nodes with a cleanliness level of 10,000, the preset multiple is set to 2.5 times; for processing nodes with a cleanliness level of 100,000, the preset multiple is set to 3 times; and for processing nodes with a cleanliness level of 1 million, the preset multiple is set to 3.5 times.

[0037] In some embodiments, all raw material record lines, all environmental record lines, and all finished product record lines with the same finished product batch number are extracted from the aligned record line set and arranged in ascending order according to the timestamp of the collection time to generate a complete ice cream batch traceability chain. Specifically, the raw material record lines with the same finished product batch number are arranged in ascending order according to the timestamp of the collection time to form a raw material stage sequence; all environmental record lines with the same finished product batch number are arranged in ascending order according to the timestamp of the collection time to form a processing stage sequence; all finished product record lines with the same finished product batch number are arranged in ascending order according to the timestamp of the collection time to form a finished product stage sequence; the raw material stage sequence, processing stage sequence, and finished product stage sequence are spliced ​​together end to end in chronological order; a production start marker is inserted between the last timestamp of the raw material stage sequence and the first timestamp of the processing stage sequence; and a packaging start marker is inserted between the last timestamp of the processing stage sequence and the first timestamp of the finished product stage sequence to obtain a complete ice cream batch traceability chain.

[0038] It is understandable that the determination of three consecutive time points in missing value detection is based on the continuity of the timestamps at the time of collection. That is, when the difference between the time interval of two adjacent timestamps and the sampling interval corresponding to the first sampling frequency is less than 5% of the sampling interval, it is considered as a consecutive time point. When the raw material pH value also shows three consecutive missing time points, the same linear interpolation method is used to estimate the missing value of the raw material pH value based on the raw material pH values ​​of the two time points before and after the missing value.

[0039] Optionally, when three consecutive time points of raw material temperature values ​​are detected as missing, if any of the raw material temperature values ​​at the two time points before and after the missing value are also marked as missing, then the linear interpolation method is abandoned, and the missing value is replaced by the average of all normal raw material temperature values ​​within the same time period of the day. It can be understood that the verification mark in the finished product record line is retained when generating the ice cream batch traceability chain and participates in the calculation of the food safety risk assessment matrix as an independent input parameter in the subsequent risk assessment module. For every unit deviation of the ratio of fat content to protein content in the finished product record line corresponding to the verification mark from the standard formula ratio range boundary value of zero, a penalty coefficient of 0.1 is added to the risk assessment matrix.

[0040] In one embodiment of the present invention, see [reference] Figure 3 The process involves extracting raw material temperature values ​​at each sampling time from the ice cream batch traceability chain, calculating the maximum, minimum, and average raw material temperature values ​​for that batch of ice cream during the entire raw material storage phase, extracting raw material pH values ​​at each sampling time from the ice cream batch traceability chain, calculating the variation range and rate of change of the raw material pH values ​​for that batch of ice cream during the entire raw material storage phase, extracting air particulate matter concentration, air temperature value, and air humidity value at each sampling time from the ice cream batch traceability chain, calculating the integral value of air particulate matter concentration, the variance of air temperature value fluctuation, and the cumulative offset of air humidity value for that batch of ice cream during the entire processing phase, extracting the fat content and protein content values ​​for that batch of ice cream from the ice cream batch traceability chain, calculating the deviation values ​​of the fat content value from the standard fat content value and the deviation values ​​of the protein content value from the standard protein content value, and then... The maximum raw material temperature, the minimum raw material temperature, the average raw material temperature, the variation range of the raw material pH value, the rate of change of the raw material pH value, the integral value of the air particulate matter concentration, the variance of the air temperature fluctuation, the cumulative offset of the air humidity value, the deviation value of the fat content value, and the deviation value of the protein content value are each used as a risk assessment dimension. A safety threshold range is preset for each risk assessment dimension. The actual value of each risk assessment dimension is mapped to the corresponding safety threshold range to obtain the risk level score of each risk assessment dimension. The risk level scores of all risk assessment dimensions are arranged into a multi-dimensional vector in the order of raw material stage, processing stage, and finished product stage. This multi-dimensional vector is used as the food safety risk assessment matrix for this batch of ice cream. The safety threshold range is calculated by adding or subtracting three standard deviations from the average value of the historical data of this assessment dimension.

[0041] In practice, the raw material temperature values ​​at each sampling time are extracted from the ice cream batch traceability chain, and the maximum, minimum, and average raw material temperature values ​​of the batch of ice cream during the entire raw material storage stage are calculated. The pH values ​​of the raw materials at each sampling time are also extracted from the ice cream batch traceability chain, and the magnitude and rate of change of the pH values ​​of the batch of ice cream during the entire raw material storage stage are calculated. The formula for calculating the rate of change of the pH values ​​is as follows:

[0042] in: This indicates the rate of change in the pH value of the raw material. This indicates the pH value of the raw material at the last sampling point during the raw material storage phase. This indicates the pH value of the raw material at the first sampling point during the raw material storage phase. The timestamp representing the last data collection moment. The timestamp representing the first data collection moment, with a change range equal to... and The absolute value of the difference; extracting the air particulate matter concentration, air temperature value, and air humidity value at each collection moment from the ice cream batch traceability chain, calculating the integral value of air particulate matter concentration, the variance of air temperature value fluctuation, and the cumulative offset of air humidity value for the batch of ice cream throughout the entire processing stage. The integral value of air particulate matter concentration is obtained by summing the air particulate matter concentration at all collection moments in the processing stage according to the time interval. The variance of air temperature value fluctuation is obtained by dividing the sum of the squares of the differences between all air temperature values ​​in the processing stage and the average air temperature value by the number of collections. The cumulative offset of air humidity value is obtained by summing the differences between the air humidity value at each collection moment in the processing stage and the standard humidity value. Extracting the fat content value and protein content value of the batch of ice cream from the ice cream batch traceability chain, calculating the deviation value of fat content value from the standard fat content value and the deviation value of protein content value from the standard protein content value. The standard fat content value and standard protein content value are respectively taken from the product formula document corresponding to the batch of ice cream.

[0043] In some embodiments, the maximum raw material temperature value, minimum raw material temperature value, average raw material temperature value, variation range of raw material pH value, rate of change of raw material pH value, integral value of air particulate matter concentration, variance of air temperature value fluctuation, cumulative offset of air humidity value, deviation value of fat content value, and deviation value of protein content value are each used as a risk assessment dimension. A safety threshold range is preset for each risk assessment dimension. The safety threshold range is calculated based on the average value of historical data for the assessment dimension plus or minus three times the standard deviation. The historical data is taken from the set of measurement values ​​of all batches of ice cream produced on the same production line in the past year on the same risk assessment dimension. The average value is the arithmetic mean of the set, and the standard deviation is the standard deviation of the set. The actual value of each risk assessment dimension is mapped to the corresponding safety threshold range to obtain the risk level score of each risk assessment dimension. The mapping rule is as follows: when the actual value is within the safety threshold range, the risk level score is 0; when the actual value exceeds the upper boundary of the safety threshold range, the risk level score is equal to (actual value minus upper boundary) divided by the upper boundary; when the actual value is below the lower boundary of the safety threshold range, the risk level score is equal to (lower boundary minus actual value) divided by the lower boundary.

[0044] Optionally, for the two risk assessment dimensions of air temperature value fluctuation variance and air humidity value cumulative offset, if the actual value is less than the lower boundary of the safety threshold range, the risk level score is directly set to 0, because if the fluctuation variance or cumulative offset is too small, it will not introduce food safety risks. For the deviation values ​​of fat content and protein content, after mapping to obtain the risk level score, it is necessary to multiply it by an adjustment coefficient. The adjustment coefficient is equal to the Hamming distance between the hash value of the packaging appearance image of the batch of ice cream and the hash value of the standard image divided by 64.

[0045] In some embodiments, the risk level scores of all risk assessment dimensions are arranged into a multi-dimensional vector in the order of raw material stage, processing stage, and finished product stage. The risk level scores corresponding to the raw material stage include scores for five dimensions: maximum raw material temperature value, minimum raw material temperature value, average raw material temperature value, variation range of raw material pH value, and rate of change of raw material pH value. The risk level scores corresponding to the processing stage include scores for three dimensions: integral value of air particulate matter concentration, variance of air temperature value fluctuation, and cumulative offset of air humidity value. The risk level scores corresponding to the finished product stage include scores for two dimensions: deviation value of fat content value and deviation value of protein content value. This multi-dimensional vector is used as the food safety risk assessment matrix for a batch of ice cream, and the total number of dimensions of the multi-dimensional vector is ten.

[0046] It is understandable that when calculating the rate of change of the acidity and alkalinity of raw materials, if the total number of sampling times during the raw material storage stage is less than three, the rate of change cannot be calculated. In this case, the risk level score of the rate of change dimension is directly set to twice the upper boundary of the safety threshold interval. When calculating the integral value of air particulate matter concentration, if the time interval between two adjacent sampling times is not uniform, the width of each trapezoidal region is calculated using the actual timestamp difference, in seconds.

[0047] Optionally, when the risk level score of any risk assessment dimension exceeds a preset warning threshold, this warning threshold will be used as a trigger condition to automatically append a flag bit to the end of the food safety risk assessment matrix. The flag bit will be set to 1 to indicate that the batch of ice cream has a high-risk dimension. When the risk level scores of all risk assessment dimensions do not exceed the warning threshold, the flag bit will be set to 0. It can be understood that the three standard deviations added or subtracted within the safety threshold range are dynamically recalculated based on the update cycle of the historical data set. The update cycle of the historical data set is set to once every thirty days. Each update removes historical data older than thirty-six months and adds measurement values ​​of newly added batches of ice cream within the last thirty days.

[0048] In one embodiment of the present invention, the risk level score of the raw material stage is extracted from the food safety risk assessment matrix, and this risk level score is written into a graph database as a raw material node attribute. The risk level score of the processing stage is extracted from the food safety risk assessment matrix, and this risk level score is written into the graph database as a process node attribute. The risk level score of the finished product stage is extracted from the food safety risk assessment matrix, and this risk level score is written into the graph database as a finished product node attribute. A first directed edge is created in the graph database between the raw material node and the process node. The direction of the first directed edge is from the raw material node to the process node, and the weight of the first directed edge is equal to the risk level score of the raw material stage and the risk level score of the processing stage. The risk level score is multiplied by the risk level score of the processing stage and the risk level score of the finished product stage. A second directed edge is created between the process node and the finished product node in the graph database. The direction of the second directed edge is from the process node to the finished product node. The weight value of the second directed edge is equal to the product of the risk level score of the processing stage and the risk level score of the finished product stage. A unique batch identifier node is created for each batch of ice cream in the graph database. The raw material node, the process node and the finished product node are respectively connected to the batch identifier node to form a risk propagation graph centered on the batch identifier node. When multiple batches of ice cream use the same batch of raw materials from the same raw material supplier, a shared raw material node is established between the risk propagation graphs corresponding to the multiple batches of ice cream. The risk propagation graphs of the multiple batches of ice cream are connected through the shared raw material node.

[0049] In practical implementation, the risk level scores for the raw material stage are extracted from the food safety risk assessment matrix and written into the graph database as attributes of the raw material nodes. The graph database adopts an attribute graph model, where each node contains a node type identifier and a set of attribute key-value pairs. The risk level scores for the processing stage are extracted from the food safety risk assessment matrix and written into the graph database as attributes of the process nodes. The risk level scores for the finished product stage are extracted from the food safety risk assessment matrix and written into the graph database as attributes of the finished product nodes. A first directed edge is created in the graph database between the raw material node and the process node. The direction of the first directed edge is from the raw material node to the process node, and the weight of the first directed edge is equal to the product of the risk level scores for the raw material stage and the processing stage. The formula for calculating the product is:

[0050] in: This represents the weight value of the first directed edge. This indicates the risk level score at the raw material stage. This represents the risk level score for the processing stage; a second directed edge is created in the graph database between the process node and the finished product node, with the direction of the second directed edge pointing from the process node to the finished product node, and the weight of the second directed edge equal to the product of the risk level score for the processing stage and the risk level score for the finished product stage; a unique batch identifier node is created in the graph database for each batch of ice cream, and the raw material node, process node, and finished product node are connected to the batch identifier node respectively, forming a risk propagation graph centered on the batch identifier node. The connections between the raw material node, process node, and finished product node and the batch identifier node use undirected edges, and the labels of the undirected edges are set to "associated with raw materials", "associated with processes", and "associated with finished products" respectively.

[0051] In some embodiments, when multiple batches of ice cream use the same batch of raw materials from the same supplier, a shared raw material node is established between the risk propagation graphs corresponding to the multiple batches of ice cream. The risk propagation graphs of the multiple batches of ice cream are then connected through the shared raw material node. Specifically, an existing raw material node is retrieved from the graph database. The raw material supplier identifier and raw material batch number of this raw material node are exactly the same as the attributes of the raw material node to be written. The raw material node to be written is replaced with the retrieved existing raw material node. The batch identifier node of the new batch of ice cream is then connected to the existing raw material node through an undirected edge of "associated raw material". At the same time, all outgoing and incoming edges of the existing raw material node are retained, thereby realizing the connection of shared raw material nodes between multiple risk propagation graphs.

[0052] Optionally, when multiple batches of ice cream use the same batch of raw materials from the same supplier but with different processing parameters, the shared raw material node is retained, but each batch identification node is connected to its own independent process node and finished product node. The independent process node contains the risk level score of the processing stage corresponding to each batch, and the independent finished product node contains the risk level score of the finished product stage corresponding to each batch.

[0053] It is understandable that when creating a unique batch identifier node for each batch of ice cream in the graph database, the node identifier of the batch identifier node adopts the string format of the target ice cream batch number plus a fixed prefix, the fixed prefix being "BATCH_", the node identifier of the raw material node adopts the string format of the raw material supplier identifier plus the raw material batch number, the node identifier of the process node adopts the string format of the production line number plus the time window start timestamp, and the node identifier of the finished product node adopts the string format of the finished product batch number.

[0054] In some embodiments, after forming a risk propagation graph centered on a batch identifier node, an integrity check is performed on the risk propagation graph. The integrity check includes checking whether the batch identifier node is connected to at least one raw material node, one process node, and one finished product node. If any type of node is missing, the risk propagation graph is marked as incomplete, and the batch identifier nodes of the incomplete graph are stored in a repair queue. The batch identifier nodes in the repair queue retry connecting to the missing node types in subsequent data update cycles. Optionally, the weight value of the first directed edge... The weight values ​​of the second directed edge are normalized before being written to the graph database. The normalization process divides the weight value by the square root of the product of the risk level scores of the raw material stage, the processing stage, and the finished product stage. The normalized weight values ​​are stored as edge attributes.

[0055] It is understandable that when a shared raw material node connects multiple batches of ice cream in a risk propagation graph, the risk level score of the raw material stage stored in the shared raw material node is taken as the maximum value of the risk level score of the raw material stage among all related batches. When the first directed edge points from the shared raw material node to the process node of each related batch, the weight value of the first directed edge is calculated independently. Each related batch is obtained by multiplying its own processing stage risk level score with the maximum value of the raw material stage risk level score of the shared raw material node.

[0056] In one embodiment of the present invention, a target ice cream batch number input by a user is received through the front-end query interface. The target ice cream batch number is then format-validated to confirm that it conforms to a preset batch number encoding rule. A node matching query is performed in the graph database to find batch identifier nodes whose batch identifier node values ​​in the node attributes completely match the target ice cream batch number. When a completely matching batch identifier node is found, starting from that batch identifier node, all raw material nodes, all process nodes, and all finished product nodes connected to that batch identifier node are traversed. The risk level score for the raw material stage is read from each raw material node, the risk level score for the processing stage is read from each process node, and the risk level score for the finished product stage is read from each finished product node. The risk level scores are determined by connecting the risk level scores of the raw material stage, the risk level scores of the processing stage, and the risk level scores of the finished product stage into a risk transmission path sequence according to the directions of the first directed edge and the second directed edge. The weight values ​​of the first directed edge and the second directed edge are read from the graph database and appended to the corresponding positions in the risk transmission path sequence. The risk transmission path sequence, the weight values ​​of the first directed edge, and the weight values ​​of the second directed edge are combined into a structured risk report, and the structured risk report is output in the form of a visual chart as the risk traceability report for this batch of ice cream. The visual chart is a Sankey diagram that includes risk level scores, risk transmission path sequences, and directed edge weight values.

[0057] In the specific implementation, a target ice cream batch number is received from the user through the front-end query interface. The target ice cream batch number is format-validated to confirm that it conforms to the preset batch number encoding rules. The batch number encoding rules are: production date (eight digits) + production line number (two digits) + sequence number (four digits), totaling fourteen characters. A node matching query is executed in the graph database to find batch identifier nodes whose batch identifier node values ​​in the node attributes completely match the target ice cream batch number. The node matching query uses the graph database's index scanning method, and the index is built on the batch identifier node value attribute of the batch identifier node. When a completely matching batch identifier node is found, starting from the batch identifier node, all raw material nodes, all process nodes, and all finished product nodes connected to the batch identifier node are traversed. The traversal operation adopts a breadth-first search strategy, and the traversal depth is limited to two hops. Only nodes directly connected to the batch identifier node are retrieved, and the expansion to other batch identifier nodes connected to shared raw material nodes is not continued.

[0058] In some embodiments, the risk level score of the raw material stage is read from each raw material node, the risk level score of the processing stage is read from each process node, and the risk level score of the finished product stage is read from each finished product node. The risk level scores of the raw material stage, the processing stage, and the finished product stage are concatenated into a risk transmission path sequence according to the directions of the first and second directed edges. The risk transmission path sequence is in the format of a list of triples, where each triple contains a stage name, a risk level score, and a node identifier. The weight values ​​of the first and second directed edges are read from the graph database and appended to the corresponding positions in the risk transmission path sequence. The appending method is to add a weight field after the risk level score of each stage. No weight value is appended after the risk level score of the raw material stage, the weight value of the first directed edge is appended after the risk level score of the processing stage, and the weight value of the second directed edge is appended after the risk level score of the finished product stage.

[0059] Optionally, when it is found during the traversal that the batch identifier node is connected to multiple raw material nodes, multiple process nodes, or multiple finished product nodes, the raw material stage risk level score of each raw material node, the processing stage risk level score of each process node, and the finished product stage risk level score of each finished product node are read respectively. The raw material nodes, process nodes, and finished product nodes are arranged in the order of timestamps, which are taken from the creation time attribute of the connection edge between the raw material node, process node, and finished product node and the batch identifier node.

[0060] In practice, the risk transmission path sequence, the weight values ​​of the first and second directed edges are combined into a structured risk report. The structured risk report uses JSON format, and the JSON object contains three fields: the batch_id field stores the target ice cream batch number, the path_sequence field stores the JSON array of the risk transmission path sequence, and the edge_weights field stores the JSON object composed of the weight values ​​of the first and second directed edges. The structured risk report is output as a risk traceability report for the batch ice cream in the form of a visual chart. The visual chart is a Sankey diagram that includes risk level scores, risk transmission path sequences, and directed edge weight values. The nodes of the Sankey diagram correspond to the stage names of the three levels: raw material stage, processing stage, and finished product stage. The edge width of the Sankey diagram is linearly mapped to the preset minimum and maximum width pixel range according to the weight values ​​of the first and second directed edges. The node color of the Sankey diagram is mapped from green to red according to the risk level score from low to high.

[0061] In some embodiments, when a batch identifier node that completely matches the target ice cream batch number is not found after performing a node matching query in the graph database, the front-end query interface returns an error code indicating "batch number does not exist". At the same time, a red prompt box is displayed on the front-end query interface, with the message "No risk traceability report for the corresponding batch found".

[0062] It can be understood that the risk transmission path sequence in the Sankey diagram is displayed as follows: the risk level score of the raw material stage is displayed inside the raw material stage node, the risk level score of the processing stage is displayed inside the processing stage node, and the risk level score of the finished product stage is displayed inside the finished product stage node. The width of the connection line from the raw material stage node to the processing stage node is equal to the pixel width of the weight value of the first directed edge after linear mapping, and the width of the connection line from the processing stage node to the finished product stage node is equal to the pixel width of the weight value of the second directed edge after linear mapping.

[0063] Optionally, a desensitization step is performed before the structured risk report is output. This desensitization process replaces the raw material supplier identifier at the raw material node with a randomly generated eight-digit alphanumeric combination, replaces the production line number at the process node with a vague identifier in the form of "LINE_XX", and retains the last eight characters of the finished product batch number at the finished product node, replacing the first six characters with asterisks. It can be understood that the Sankey diagram output also includes a data table. This table lists the risk level score and corresponding directed edge weight for each stage in the risk transmission path sequence in rows. The first three columns of the data table are the stage name, risk level score, and weight value, respectively. The fourth column is a bar chart visualization of the risk level score, with the bar length proportional to the risk level score.

[0064] The above embodiments are only used to illustrate the technical methods of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of the present invention without departing from the spirit and scope of the technical methods of the present invention.

Claims

1. A big data-based traceability and management system for ice cream food quality and safety, characterized in that: include: The data acquisition module acquires raw material data, processing environment data, and finished product testing data through multiple IoT acquisition terminals distributed throughout the ice cream production chain; The data storage module uploads the raw material data, the processing environment data, and the finished product testing data to a distributed storage cluster in a unified data format. The data processing module performs data cleaning and correlation mapping on the raw material data, the processing environment data, and the finished product testing data in the distributed storage cluster to generate a complete ice cream batch traceability chain. The risk assessment module constructs a food safety risk assessment matrix based on the ice cream batch traceability chain. The graph construction module inputs the food safety risk assessment matrix into a graph database and creates a risk propagation graph for each batch of ice cream in the graph database. The query output module receives a target ice cream batch number through a front-end query interface, retrieves the corresponding risk propagation map from the graph database based on the target ice cream batch number, and outputs a risk traceability report for that batch of ice cream.

2. The ice cream food quality and safety traceability management system based on big data as described in claim 1, characterized in that, The steps of acquiring raw material data, processing environment data, and finished product testing data through multiple IoT data acquisition terminals distributed throughout the ice cream production chain specifically include: A first type of IoT data acquisition terminal is deployed in the storage tanks of ice cream ingredient suppliers. The first type of IoT data acquisition terminal has a built-in temperature sensor and a pH sensor. The first type of IoT acquisition terminal is configured to continuously acquire the raw material temperature value and raw material pH value in the raw material storage tank at a first sampling frequency, and encapsulate the timestamp of the acquisition time and the identification code of the storage tank together into a raw material data packet; A second type of IoT data acquisition terminal is deployed at each processing node in the ice cream production workshop. The second type of IoT data acquisition terminal has a built-in air particulate matter sensor, air temperature sensor and air humidity sensor. The second type of IoT acquisition terminal is configured to continuously collect the air particulate matter concentration, air temperature value and air humidity value at the processing node at the second sampling frequency, and the timestamp of the collection time and the identification code of the processing node are encapsulated together into a processing environment data packet. A third type of IoT data acquisition terminal is deployed at the end of the finished ice cream packaging line. The third type of IoT data acquisition terminal has a built-in infrared component analyzer and a visual imaging module. The third type of IoT acquisition terminal is configured to acquire the fat content, protein content and packaging appearance image of each ice cream product at a third sampling frequency, and encapsulate the timestamp of the acquisition time and the batch number of the finished product together into a finished product detection data packet; After adding a checksum to the raw material data packet, the processing environment data packet, and the finished product testing data packet, they are forwarded to the distributed storage cluster through the wireless gateway.

3. The ice cream food quality and safety traceability management system based on big data according to claim 2, characterized in that, The step of uploading the raw material data, the processing environment data, and the finished product testing data to a distributed storage cluster in a unified data format specifically includes: The raw material temperature value, raw material pH value, timestamp of the acquisition time, and identification code of the storage tank are parsed from the raw material data packet. The air particulate matter concentration, air temperature value, air humidity value, timestamp of the collection time, and identification code of the processing node are parsed from the processing environment data packet. The fat content value, protein content value, packaging appearance image, timestamp of the collection time, and batch number of the finished product are parsed from the finished product test data package. The parsed raw material temperature value, raw material pH value, storage tank identification code, and corresponding collection time timestamp are combined into a raw material record line. The raw material record line is stored in a key-value pair structure, where the key is a string combining the storage tank identifier and the timestamp, and the value is a string concatenated with the raw material temperature value and the raw material pH value. The parsed air particulate matter concentration, air temperature value, air humidity value, processing node identification code, and corresponding collection time timestamp are combined into an environmental record line. The environmental record line is stored in a key-value pair structure, where the key is a string combining the processing node identifier and the timestamp, and the value is a string concatenated with the air particulate matter concentration, air temperature value, and air humidity value. The parsed fat content value, protein content value, image hash value of the packaging appearance image, finished product batch number, and corresponding timestamp of the collection time are combined into a finished product record row. The finished product record row is stored in a key-value pair structure, where the key is a string combining the finished product batch number and the timestamp, and the value is a string concatenated with the fat content value, protein content value, and image hash value. The raw material record line, the environmental record line, and the finished product record line are written to different data shards in the distributed storage cluster, and three replicas are created for each data shard and stored on different physical nodes.

4. The ice cream food quality and safety traceability management system based on big data according to claim 3, characterized in that, The step of performing data cleaning and association mapping on the raw material data, processing environment data, and finished product testing data in the distributed storage cluster to generate a complete ice cream batch traceability chain specifically includes: The raw material record line is read from the distributed storage cluster. The raw material temperature value and raw material pH value in the raw material record line are checked for missing values. When the raw material temperature value is missing for three consecutive time points, the missing value is estimated by linear interpolation based on the raw material temperature value at the two time points before and after the missing value. The environmental record line is read from the distributed storage cluster, and anomaly detection is performed on the air particulate matter concentration in the environmental record line. When a single air particulate matter concentration value is detected to exceed a preset multiple of the historical average, the anomaly value is replaced with the arithmetic mean of the air particulate matter concentrations at the previous time point and the next time point. The finished product record line is read from the distributed storage cluster, and the consistency of the fat content value and protein content value in the finished product record line is checked. When the ratio of the fat content value to the protein content value exceeds the standard formula ratio range, the finished product record line is marked as a record to be reviewed. Based on the identification code of the storage tank in the raw material record line and the batch number of the finished product in the finished product record line, a material flow mapping table is established from the storage tank to the production workshop and then to the finished product packaging. Align each mapping relationship in the material flow mapping table with the corresponding timestamp of the collection time on the time axis, remove isolated record rows that cannot be matched on the time axis, and obtain the aligned record row set; Extract all raw material record lines, environmental record lines, and finished product record lines with the same finished product batch number from the aligned record line set, arrange them in ascending order according to the timestamp of the collection time, and generate a complete ice cream batch traceability chain.

5. The ice cream food quality and safety traceability management system based on big data according to claim 4, characterized in that, The material flow mapping table is generated by matching the storage tank identifier with the preset production plan batch material allocation table.

6. The ice cream food quality and safety traceability management system based on big data according to claim 4, characterized in that, The steps for constructing a food safety risk assessment matrix based on the ice cream batch traceability chain specifically include: Extract the raw material temperature value at each collection time from the ice cream batch traceability chain, and calculate the maximum, minimum and average raw material temperature values ​​of the batch of ice cream during the entire raw material storage stage; Extract the pH value of the raw materials at each collection time from the ice cream batch traceability chain, and calculate the magnitude and rate of change of the pH value of the raw materials in the entire raw material storage stage of the batch of ice cream; Extract the air particulate matter concentration, air temperature value, and air humidity value at each collection moment from the ice cream batch traceability chain, and calculate the integral value of air particulate matter concentration, the variance of air temperature value fluctuation, and the cumulative offset of air humidity value for the batch of ice cream throughout the entire processing stage. Extract the fat content and protein content of the batch of ice cream from the batch traceability chain, and calculate the deviation of the fat content from the standard fat content and the deviation of the protein content from the standard protein content. The maximum raw material temperature value, the minimum raw material temperature value, the average raw material temperature value, the variation range of the raw material pH value, the rate of change of the raw material pH value, the integral value of the air particulate matter concentration, the variance of the air temperature value fluctuation, the cumulative offset of the air humidity value, the deviation value of the fat content value, and the deviation value of the protein content value are each used as a risk assessment dimension. A safety threshold range is preset for each risk assessment dimension. The actual value of each risk assessment dimension is mapped to the corresponding safety threshold range to obtain the risk level score of each risk assessment dimension. The risk level scores of all risk assessment dimensions are arranged into a multi-dimensional vector in the order of raw material stage, processing stage and finished product stage. This multi-dimensional vector is used as the food safety risk assessment matrix for this batch of ice cream.

7. The ice cream food quality and safety traceability management system based on big data as described in claim 6, characterized in that, The safety threshold range is calculated by adding or subtracting three times the standard deviation from the historical data average of this assessment dimension.

8. The ice cream food quality and safety traceability management system based on big data according to claim 6, characterized in that, The steps of inputting the food safety risk assessment matrix into a graph database and creating a risk propagation map for each batch of ice cream in the graph database specifically include: Extract the risk level score of the raw material stage from the food safety risk assessment matrix, and write the risk level score of the raw material stage as the raw material node attribute into the graph database. The risk level score of the processing stage is extracted from the food safety risk assessment matrix, and the risk level score of the processing stage is written into the graph database as a process node attribute. Extract the risk level score of the finished product stage from the food safety risk assessment matrix, and write the risk level score of the finished product stage as the finished product node attribute into the graph database. In the graph database, a first directed edge is created between the raw material node and the process node. The direction of the first directed edge is from the raw material node to the process node. The weight value of the first directed edge is equal to the product of the risk level score of the raw material stage and the risk level score of the processing stage. In the graph database, a second directed edge is created between the process node and the finished product node. The direction of the second directed edge is from the process node to the finished product node. The weight value of the second directed edge is equal to the product of the risk level score of the processing stage and the risk level score of the finished product stage. A unique batch identifier node is created for each batch of ice cream in the graph database, and the raw material node, the process node, and the finished product node are respectively connected to the batch identifier node to form a risk propagation graph centered on the batch identifier node; When multiple batches of ice cream use the same batch of raw materials from the same supplier, a shared raw material node is established between the risk propagation maps corresponding to the multiple batches of ice cream, and the risk propagation maps of the multiple batches of ice cream are connected through the shared raw material node.

9. The ice cream food quality and safety traceability management system based on big data as described in claim 8, characterized in that, The steps of receiving a target ice cream batch number through a front-end query interface, retrieving the corresponding risk propagation map from the graph database based on the target ice cream batch number, and outputting a risk traceability report for that batch of ice cream specifically include: The system receives a target ice cream batch number input by the user through the front-end query interface, performs format verification on the target ice cream batch number, and confirms that the target ice cream batch number conforms to the preset batch number encoding rules. Perform a node matching query in the graph database to find batch identifier nodes whose batch identifier node values ​​in the node attributes completely match the target ice cream batch number. When a perfectly matching batch identifier node is found, start from that batch identifier node and traverse all raw material nodes, all process nodes, and all finished product nodes connected to that batch identifier node. Read the risk level score of the raw material stage from each raw material node, read the risk level score of the processing stage from each process node, and read the risk level score of the finished product stage from each finished product node; Based on the directions of the first directed edge and the second directed edge, the risk level scores of the raw material stage, the processing stage, and the finished product stage are linked together to form a risk transmission path sequence. Read the weight values ​​of the first directed edge and the second directed edge from the graph database, and append the weight values ​​to the corresponding positions in the risk transmission path sequence; The risk transmission path sequence, the weight value of the first directed edge, and the weight value of the second directed edge are combined into a structured risk report, and the structured risk report is output in the form of a visual chart as the risk traceability report for this batch of ice cream.

10. The ice cream food quality and safety traceability management system based on big data according to claim 9, characterized in that, The visualization is a Sankey diagram that includes risk level scores, risk transmission path sequences, and directed edge weights.