A food safety production monitoring and tracing method based on digital visualization
By using weighted cross-validation and blockchain evidence storage technology, the problems of data verification accuracy and security in food production traceability have been solved, realizing an efficient and safe food traceability solution that meets the actual needs of small and medium-sized businesses.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU XIANER INTELLIGENT TECH CO LTD
- Filing Date
- 2026-03-30
- Publication Date
- 2026-06-16
AI Technical Summary
Existing food production traceability solutions lack sufficient accuracy in verifying core production data such as raw material ratios, making it impossible to accurately determine the validity of production data. Blockchain-based evidence storage solutions suffer from data redundancy and insufficient security, and the full data upload process leads to low evidence storage efficiency, making it difficult to verify the authenticity of traceability information.
By establishing an encrypted communication link between the food supervision platform and merchants and clients, core production data is collected and weighted for cross-verification. After generating a standardized data table, key information is screened and encrypted, and then transmitted to the blockchain network for distributed storage. This generates tamper-proof certificates, and an invisible anti-counterfeiting code is embedded in the QR code, enabling differentiated traceability information display for multiple roles.
It enables multi-dimensional and accurate verification of food production data, improves the efficiency of evidence storage, reduces costs, enhances the security and authenticity of traceability information, and balances convenience and comprehensiveness.
Smart Images

Figure CN122222639A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of food safety, and in particular, it is a method for monitoring and tracing food safety production based on digital visualization. Background Technology
[0002] With the development of large-scale production in the food industry, the production process involves multi-dimensional data such as equipment operation, raw material ratios, and environmental control. Consumers' demand for transparency in the food production process is increasing, and regulatory authorities urgently need efficient means of monitoring production data. However, existing traceability solutions mostly focus on data recording and display, lacking precise verification mechanisms for core production data. Furthermore, blockchain evidence storage often involves uploading all data to the chain, resulting in low storage efficiency and high node deployment costs, making it difficult to meet the actual application needs of small and medium-sized businesses.
[0003] In existing technologies, food safety production traceability mostly adopts the QR code traceability model, which generates traceability codes by collecting basic data from the production process to achieve preliminary traceability of production information. Meanwhile, some solutions introduce blockchain technology to enhance data credibility, using simple hash encryption to store production data on the blockchain.
[0004] This method mainly addresses two core technical problems in existing technologies: First, the existing food production traceability schemes lack sufficient accuracy in verifying core production data such as raw material ratios. They rely solely on simple data recording to achieve traceability, which cannot accurately determine the validity of production data and makes it difficult to ensure the standardization of the food production process. Secondly, existing blockchain-based evidence storage solutions suffer from data redundancy and insufficient security. Uploading all data to the blockchain results in low evidence storage efficiency and lacks enhanced encryption mechanisms such as salt value obfuscation. Data evidence is easily tampered with, and the authenticity of traceability information is difficult to verify effectively.
[0005] Specifically, the accuracy of raw material ratios in food production directly determines product quality. Existing technologies do not consider the differences in the impact of different raw materials on product quality and use a single deviation judgment standard, resulting in low accuracy in identifying abnormal raw material ratios and making it easy to misjudge qualified data or miss abnormal data.
[0006] Meanwhile, existing blockchain evidence storage methods often directly upload raw data to the chain without filtering or strengthening encryption of key information. This not only increases the storage and computing power burden on blockchain nodes, but also poses a risk of hash values being forged. When consumers scan the code to query, it is impossible to effectively verify whether the traceability information has been tampered with, thus reducing the credibility of the traceability system. Summary of the Invention
[0007] This invention proposes a method for monitoring and tracing food safety production based on digital visualization.
[0008] A method for monitoring and tracing food safety production based on digital visualization includes the following steps: S1. Establish encrypted communication links between the food supervision platform and the merchant end, client end, and data processing end to collect core production data from the merchant end and key feedback data from the client end; S2. Perform multi-dimensional weighted cross-validation on the collected data, accurately identify abnormal information through deviation correction design, and generate a standardized production process data table after supplementing abnormal and missing data. S3. After filtering and encrypting key information in the standardized data table, the data is transmitted to the blockchain network for distributed storage and generates tamper-proof credentials. S4. Generate traceability QR codes containing anti-counterfeiting information based on blockchain-stored evidence data, complete multi-terminal transmission and spraying, and realize differentiated traceability information display and authenticity verification for multiple roles.
[0009] Preferably, step S1 includes the following steps: S11. A communication encryption mechanism is constructed by combining the SM2 asymmetric encryption algorithm and the SM4 symmetric encryption algorithm to encrypt the transmitted data. At the same time, the link integrity is verified by the cyclic redundancy check algorithm to ensure the security of data transmission. S12. Comprehensively collect data on the merchant's production equipment operating parameters, raw material ratios, environmental temperature and humidity, raw material source information, product quality inspection results, as well as client user order characteristics and quality feedback data. Mark the core fields to ensure the completeness and relevance of the collected data.
[0010] Preferably, step S2 includes the following steps: S21. A lightweight verification model is constructed using the gradient boosting tree algorithm. The model focuses on the correlation between raw material ratio data and quality inspection results for consistency verification. By designing a weighted deviation correction coefficient and a multi-raw material comprehensive deviation coefficient, the deviation coefficient is calculated by combining the weight of raw material quality influence, the deviation between actual and standard ratios, and the deviation level correction coefficient. This accurately quantifies the degree of deviation of different raw material ratios and efficiently identifies data anomalies. S22. Integrate raw material source information, production process data, cross-validation results, and product quality inspection results, and standardize and encapsulate them according to preset field formats and data type requirements to form a structured data table, providing standardized data support for subsequent blockchain evidence storage.
[0011] Preferably, step S3 includes the following steps: S31. The SHA256 hash algorithm is used to filter and extract key information and calculate hash values in the standardized production process data table. Before extraction, the key information is salted and encrypted to reduce the amount of data on the chain, thereby improving the efficiency of evidence storage and reducing the cost of node deployment. S32. Construct a consortium blockchain network that includes food supervision nodes, merchant nodes, and traceability center nodes. Use a simplified Byzantine fault-tolerant consensus mechanism to achieve lightweight node deployment. Distribute the data table and corresponding hash values for storage. Combine secondary hash verification to generate tamper-proof credentials and enhance the security of evidence storage.
[0012] Preferably, step S4 includes the following steps: S41. Encapsulate the product's unique identifier, tamper-proof certificate, core production information, and hidden anti-counterfeiting code, and generate a traceability QR code using the QR code encoding standard. During the encoding process, ensure that the hidden anti-counterfeiting code does not affect the basic QR code recognition function. S42. Configure differentiated traceability information display templates according to user roles, provide core traceability information to consumers, provide full-process production and traceability data to merchants, and provide complete production data and evidence details to regulators, taking into account both ease of query and comprehensive supervision.
[0013] Preferably, S1 and S2 have a data interaction and adaptation mechanism to ensure the accuracy of data verification: S1 prioritizes transmitting the labeled core field data to the data processing end to provide targeted data for model verification. The verification model of S2 dynamically adjusts the verification parameters and deviation correction coefficients according to the core field type to adapt to different data characteristics; When S2 detects missing or abnormal data, it sends a supplementary data collection instruction to S1. The supplementary data is preferentially included in the standardized data table to ensure the integrity of the verification data.
[0014] Preferably, S3 and S4 have a data association mechanism to enhance traceability security and verification efficiency. After generating the tamper-proof credential, S3 transmits the block hash value to the data processing end for simplified encoding, balancing encoding efficiency and security. When S4 generates a QR code, it embeds the encoded string to establish a unique association between the evidence data and the QR code. When consumers scan the code to query, the traceability center extracts the encoded string to restore the hash value, sends a secondary hash verification request to the consortium blockchain, and quickly determines the authenticity of the traceability information based on the feedback results.
[0015] As a preferred option, for fresh food production scenarios, the cross-validation model in S21 additionally incorporates environmental temperature and humidity time-series data as input features, introduces environmental temperature and humidity influence correction weights when calculating the deviation coefficient, and performs secondary correction based on the deviation between actual and standard environmental temperature and humidity, further improving the verification accuracy of core data in fresh food production and providing more reliable data support for the standardized management of fresh food production.
[0016] Preferably, the QR code encapsulation data in S41 also includes shelf-life information, which includes the product's production completion time, shelf-life duration, and recommended consumption deadline. A preset shelf-life warning rule is set up so that a warning sign is generated when the product is nearing or exceeding its shelf-life. During traceability display, a warning prompt is pushed to the consumer, optimizing the consumer traceability experience and providing auxiliary data for shelf-life management for merchants and regulators.
[0017] Preferably, the invisible anti-counterfeiting code is achieved by embedding a preset high-frequency texture pattern in the non-critical module area of the QR code. This pattern is invisible to the human eye and needs to be identified by the high-frequency filtering function of a dedicated scanning tool. The embedding process does not change the grayscale value of the original data module of the QR code, which not only enhances the anti-counterfeiting performance of traceability information, but also does not affect the convenience of ordinary scanning tools to query core traceability information, thus balancing security and practicality.
[0018] The present invention has the following beneficial effects: 1. This invention achieves multi-dimensional weighted cross-validation of core production data by designing a weighted deviation correction coefficient, a multi-raw material comprehensive deviation coefficient, and a lightweight verification model, combined with raw material quality weights and scenario characteristics; it also relies on a data interaction and adaptation mechanism to supplement abnormal data, accurately identify data anomalies, provide reliable data support for the standardized management of food production, and adapt to the needs of special scenarios such as fresh produce.
[0019] 2. This invention reduces the amount of data uploaded to the blockchain by filtering key information and using salt-based obfuscation encryption. Combined with the lightweight deployment of the consortium blockchain, it improves the efficiency of evidence storage and reduces costs. Through the SHA256 hash algorithm, secondary hash verification, and encoding association mechanism, it constructs multiple layers of protection and generates tamper-proof certificates throughout the entire process, balancing evidence storage efficiency and data security.
[0020] 3. This invention configures differentiated traceability templates according to user roles, accurately matching the needs of consumers, merchants, and regulators, while taking into account both ease of query and comprehensive supervision; the QR code embeds an invisible anti-counterfeiting code, coupled with a shelf-life warning mechanism, which strengthens anti-counterfeiting while providing safety reminders, achieving a unity of convenience, security, and practicality. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the steps of a food safety production monitoring and traceability method based on digital visualization according to the present invention. Detailed Implementation
[0022] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions in the embodiments of this invention will be clearly described below in conjunction with the examples.
[0023] Example 1 like Figure 1As shown, this invention proposes a method for food safety production monitoring and traceability based on digital visualization, specifically including the following steps: S1. Multi-terminal trusted data collection and real-time communication construction: Establish communication links between the merchant end, client end and data processing end based on the food supervision platform to collect core production data from the merchant end and key feedback data from the client end. S2. Intelligent cross-validation and production process data integration: Multi-dimensional cross-validation of collected data, and generation of standardized production process data table after supplementing abnormal or missing data. S3. Blockchain notarization and anti-tampering processing: The standardized production process data table is transmitted to the blockchain network for notarization processing to generate anti-tampering certificates. S4. Dynamic traceability QR code generation and multi-terminal traceability service: Based on blockchain-stored evidence data, traceability QR codes are generated and transmitted and sprayed across multiple terminals, enabling multi-terminal traceability information display and authenticity verification.
[0024] Furthermore, step S1 also includes S11 national cryptographic algorithm encrypted communication link construction, specifically by using a combination of SM2 asymmetric encryption algorithm and SM4 symmetric encryption algorithm to deploy a communication encryption mechanism, encrypting the transmitted data between the merchant end, the client end and the food supervision platform, and simultaneously using a cyclic redundancy check algorithm to verify the integrity of the transmitted data link. Step S1 also includes S12, which involves accurately collecting core data. Specifically, it involves collecting the operating parameters of the production equipment on the merchant's side, raw material ratio data, environmental temperature and humidity data, raw material source information, and product quality inspection results. At the same time, it involves collecting the order characteristics and quality feedback data of the client users. Based on the subsequent cross-validation requirements, the core fields such as raw material ratio and quality inspection results in the collected data are marked.
[0025] Furthermore, step S2 also includes S21 lightweight multi-dimensional cross-validation, which specifically involves using a gradient boosting tree algorithm to construct a lightweight validation model, focusing on the consistency verification of the correlation between raw material ratio data and quality inspection results, and realizing the data validity judgment by calculating the deviation coefficient between the raw material ratio parameters and the quality inspection pass threshold. Step S2 also includes S22, which generates a standardized production process data table. Specifically, it integrates the raw material source information, production process data, cross-validation results and product quality inspection results collected in step S1, and encapsulates them in a standardized manner according to preset field formats and data type requirements to form a structured data table adapted for blockchain storage and QR code parsing.
[0026] Furthermore, step S3 also includes S31 data table hash extraction, specifically using the SHA256 hash algorithm to extract key information and calculate hash values from the standardized production process data table generated in step S2, thereby compressing the amount of data uploaded to the chain. Step S3 also includes S32 lightweight deployment of the consortium blockchain, which specifically involves building a consortium blockchain network that includes food supervision nodes, merchant nodes, and traceability center nodes. Byzantine fault-tolerant consensus mechanism is adopted to simplify the node consensus process, thereby achieving lightweight deployment of consortium blockchain nodes. Standardized production process data tables and corresponding hash values are uploaded to the consortium blockchain nodes for distributed storage, generating tamper-proof credentials containing block indexes and hash values.
[0027] Furthermore, step S4 also includes S41 generating an integrated anti-counterfeiting and evidence storage QR code, specifically encapsulating the product's unique identifier, the tamper-proof certificate generated in step S3, and the core production information into a traceability QR code using the QR code encoding standard, while embedding an invisible anti-counterfeiting code based on texture features during the QR code encoding process. Step S4 also includes S42 multi-terminal differentiated traceability information display, which specifically involves configuring traceability information display templates for consumers, merchants, and regulators based on access permissions. Consumers are shown the source of raw materials, key production nodes, and quality inspection results, while merchants and regulators are shown complete information including cross-validation processes and blockchain evidence details.
[0028] Furthermore, there is a data interaction and adaptation mechanism between steps S1 and S2. Specifically, after completing the core data collection, step S1 will prioritize transmitting the marked core field data to the data processing end. The cross-validation model in step S2 will dynamically adjust the validation parameters according to the core field type to improve validation efficiency. If, after completing cross-validation, step S2 finds that data is missing or abnormal, it sends a targeted supplementary data collection instruction to the merchant or client in step S1. After step S1 completes the supplementary data collection according to the supplementary data collection instruction, it prioritizes transmitting the supplementary data to step S2 to be incorporated into the standardized production process data table. There is a data association mechanism between steps S3 and S4. Specifically, after generating the tamper-proof certificate in step S3, the block hash value is transmitted to the data processing end. When generating the traceability QR code in step S4, the block hash value is simplified and encoded and then embedded into the QR code data to realize the real-time association between the blockchain data and the QR code. After the traceability QR code is applied in step S4, when consumers scan the code to query, the traceability center automatically extracts the block hash value from the QR code and sends a hash verification request to the consortium blockchain network in step S3. The consortium blockchain node returns the verification result, and the traceability center displays the corresponding information to the consumer after determining the authenticity of the traceability information based on the verification result.
[0029] Example 2 This embodiment focuses on the entire process of multi-terminal trusted data interaction, lightweight intelligent verification, consortium blockchain notarization, and anti-counterfeiting traceability, realizing trusted management of food production data from collection to traceability query. The detailed technical implementation process is as follows: First, execute step S1, which involves building a secure and reliable multi-terminal communication link and accurately collecting core data to provide basic data support for subsequent data processing and evidence storage.
[0030] Specifically, step S11, the establishment of the national cryptographic algorithm-encrypted communication link, involves deploying the communication encryption logic using a two-layer encryption mechanism combining the SM2 asymmetric encryption algorithm and the SM4 symmetric encryption algorithm. First, the SM2 algorithm is used to complete the key negotiation between the food supervision platform and the merchant, client, and data processing end.
[0031] Specifically, the food supervision platform acts as a key distribution center, pre-generating key pairs for the SM2 algorithm. The public key is publicly available, while the private key is securely stored by the platform. When merchants, clients, and data processing terminals send key negotiation requests to the food supervision platform, they include their own device identification information. After verifying the legitimacy of the request based on the device identification information, the food supervision platform sends the SM2 public key to each requesting terminal. Each terminal encrypts its own generated SM4 session key using the SM2 public key and sends it back to the food supervision platform. The platform decrypts the SM4 session key using the SM2 private key, thus completing the key negotiation process.
[0032] After key negotiation, all data transmitted between each terminal and the food supervision platform is encrypted using the SM4 symmetric encryption algorithm, with CBC mode selected. The initial vector is generated by a random number generator to ensure the uniqueness of the initial vector for each encryption. Simultaneously, to ensure the integrity of the transmitted data, a Cyclic Redundancy Check (CR) algorithm is used to verify the integrity of the encrypted data. Specifically, a CR code is calculated on the encrypted data to generate a 32-bit CR value, which is transmitted along with the encrypted data. After receiving the data, the receiving end recalculates the CR value on the encrypted data and compares it with the transmitted CR value. If they match, the data transmission is considered complete; otherwise, a data retransmission mechanism is triggered.
[0033] Among them, the polynomial selection of the cyclic redundancy check algorithm This polynomial has strong error detection capabilities and can effectively identify single-bit errors, multi-bit errors, and burst errors during transmission.
[0034] The specific implementation of step S12, accurate core data collection, involves the merchant side collecting core production data through deployed data collection terminals. This includes real-time collection of production equipment operating parameters via the equipment's built-in communication interfaces, including but not limited to RS485 and Ethernet interfaces. Collected parameters include, but are not limited to, equipment operating speed, operating current, operating voltage, and cumulative operating time. Raw material proportioning data is collected through the digital interface of the raw material weighing equipment, recording the name, weight, proportion, and batching time of each raw material. Environmental temperature and humidity data is collected through temperature and humidity sensors deployed in different areas of the production workshop. These sensors are digital temperature and humidity sensors, with a collection frequency set to once per minute. The collected data is transmitted to the merchant's data collection terminal via a wireless communication module. Raw material source information is manually entered through the merchant's input interface or automatically obtained by scanning the traceability code provided by the raw material supplier. Entered information includes, but is not limited to, raw material name, supplier name, supplier qualification number, purchase batch, and warehousing time. Product quality inspection results are collected through the testing interface of the quality inspection equipment, including but not limited to test data and quality inspection conclusions for microbiological, physicochemical, and sensory indicators.
[0035] The client collects user order characteristics and quality feedback data through the user interface. User order characteristics include order number, product name, quantity purchased, purchase time, and delivery address. Quality feedback data includes product appearance evaluation, taste evaluation, shelf life satisfaction, and feedback information on whether there are any quality problems.
[0036] After the above data collection is completed, before the merchant-side data collection terminal and client transmit the collected data to the food supervision platform, the core fields in the collected data are marked according to the subsequent cross-validation requirements. The marking rules are pre-issued to each collection terminal by the data processing terminal. The core fields include the proportion of each raw material in the raw material ratio data, the various test indicators and quality inspection conclusions in the quality inspection results. The marking method is to add a preset marker identifier to the field header so that the cross-validation model in the subsequent step S2 can quickly identify and extract the core data.
[0037] Based on the encrypted communication link built in step S1 and the core data collected, step S2, intelligent cross-validation and production process data integration, is performed. This step uses lightweight intelligent verification to determine the validity of data, and generates a standardized data table after supplementing abnormal or missing data, providing structured data for subsequent blockchain notarization.
[0038] The specific implementation of step S21, lightweight multi-dimensional cross-validation, involves constructing a lightweight validation model using the gradient boosting tree algorithm. The training process of the model is as follows: First, historical production data is collected as training samples. The training samples include historical raw material ratio data, corresponding product quality inspection results, and data validity labels. Valid data is marked as 1, and invalid data is marked as 0. The training samples are preprocessed, including missing value imputation using the mean imputation method; outlier removal using the 3σ criterion; and data standardization using min-max standardization to map the data to the [0,1] interval. The preprocessed training samples are divided into a 70% training set and a 30% test set. The ratio of each raw material in the raw material ratio data is used as the input feature, and the data validity label is used as the output label to train the gradient boosting tree model.
[0039] The training samples must cover at least 50 common food types and 1,000 batches of valid production data; the data validity label is based on the national standards of the corresponding food, such as GB 2760 and GB 2763. Data that meets all national standards and has a raw material ratio deviation of ≤ ±5% is marked as valid (1), otherwise it is marked as invalid (0).
[0040] The gradient boosting tree model uses a logarithmic loss function, sets the decision tree depth to 3 layers, the learning rate to 0.1, and the number of iterations to 100. The model parameters are optimized by minimizing the loss function using gradient descent.
[0041] After the model training is completed, the labeled core field data transmitted to the data processing end in step S1 is input into the trained gradient boosting tree model. The consistency verification is carried out by focusing on the correlation between raw material ratio data and quality inspection results. Specifically, the validity of the data is judged by calculating the weighted deviation correction coefficient between the raw material ratio parameters and the quality inspection pass threshold.
[0042] Considering that different raw materials have different weights in terms of their impact on food quality, and that a single relative deviation is insufficient to accurately reflect the actual risk level of the raw material ratio, this embodiment uses a weighted deviation correction coefficient formula instead of the traditional relative deviation formula. The specific formula is as follows: in, , is the weighted deviation correction coefficient for the i-th raw material ratio parameter; The quality impact weighting coefficient for the i-th raw material is [0.5, 1.5]. It is pre-configured by the food supervision platform based on the degree of influence of the raw material on product quality. The weighting is 1.2-1.5 for key raw materials and 0.5-0.8 for auxiliary raw materials. This represents the actual proportion of the i-th raw material. This is the standard proportion of the i-th raw material, i.e., the raw material proportion threshold corresponding to passing quality inspection; is the deviation level correction coefficient for the i-th raw material, with a value range of [0, 0.3]. It is set according to the deviation sensitivity level of the raw material, with 0.2-0.3 for highly sensitive raw materials and 0-0.1 for low-sensitive raw materials. It is the minimum value among all the standard proportions of raw materials; This is the maximum value among all the standard proportions of raw materials.
[0043] To further improve the accuracy of judging the overall effectiveness of multi-raw material combination ratios, after calculating the weighted deviation correction coefficient for a single raw material, a multi-raw material comprehensive deviation coefficient formula is introduced to comprehensively evaluate the deviations of all raw material ratios in the same batch of products. The formula is as follows: in, This is the comprehensive deviation coefficient for multiple raw materials; This represents the total number of raw material types in this batch of products; is the weighted deviation correction coefficient for the i-th raw material; Let be the weighting coefficient for the quality influence of the i-th raw material.
[0044] Quantified by the degree of influence of raw materials on product quality: core raw materials, such as raw milk in dairy products. Auxiliary ingredients, such as seasonings ; Set according to raw material deviation sensitivity: highly sensitive raw materials, such as food additives. Low-sensitivity raw materials, such as drinking water .
[0045] For invalid or anomalous data output by the gradient boosting tree model, the data processing end marks the corresponding anomalous fields to provide a basis for subsequent data completion; for valid data output by the model, the original data is retained and associated with the corresponding validation results, including data from single raw materials. and multiple raw materials .
[0046] The specific implementation of generating the standardized production process data table in step S22 involves integrating the raw material source information, production process data, cross-validation results from step S1, and product quality inspection results, and standardizing and encapsulating them according to preset field formats and data type requirements. The preset field formats are predefined by the data processing end and include field names, field codes, data types, data lengths, and precision requirements. Field codes use 8-digit numeric codes, with the first two digits representing the data category and the last six digits representing the specific field. Data types include string, numeric, and date / time types. Raw material names and supplier names, for example, use string types, and the data length is set to 64 bytes. Other data types include production equipment operating speed, operating current, and weighted deviation correction coefficients. Comprehensive deviation coefficient Numeric data types are used, with a precision of 4 decimal places; purchase batches, warehousing times, etc., are date and time data types, with the format set to: "YYYY-MM-DDHH:MM:SS".
[0047] During the standardization and encapsulation process, the integrated data undergoes field matching and format conversion. Non-standard format data is converted into a preset format. For example, date and time data in different formats are uniformly converted into the "YYYY-MM-DDHH:MM:SS" format, and the precision of numerical data is uniformly adjusted to a preset precision. At the same time, a unique identifier field is added to the data table. The unique identifier field is generated using a UUID universal unique identification code to ensure the uniqueness of each standardized production process data table.
[0048] After encapsulation, a structured data table adapted for blockchain storage and QR code parsing is formed. This data table is stored in JSON format to facilitate subsequent data transmission and parsing.
[0049] During the interaction between steps S1 and S2, a data interaction adaptation mechanism is followed. Specifically, after completing the core data collection and marking the core fields in step S1, the marked core field data is transmitted to the data processing end first through the SM4 encrypted communication link. The transmission priority is achieved by setting the priority level of the data transmission queue. The transmission priority of the core field data is set to the highest level, and other non-core data is set to ordinary priority, ensuring that the core data is processed first by the cross-validation model in step S2.
[0050] After receiving the core field data, the cross-validation model in step S2 dynamically adjusts the validation parameters according to the core field type. For example, for the key raw material field in the raw material ratio data, the decision tree splitting threshold of the gradient boosting tree model is adjusted to 0.03, and the raw material is... The upper limit of the value has been increased to 1.5; for the auxiliary raw material field, the splitting threshold has been adjusted to 0.06. The lower limit of the value is reduced to 0.5, and the verification efficiency and accuracy are improved by dynamically adjusting the verification parameters and weight coefficients.
[0051] Step S2: After completing cross-validation, if missing or abnormal data is found, including... , If a field is missing, the data processing terminal sends a targeted supplementary data collection instruction to the merchant or client in step S1 via the encrypted communication link. The supplementary data collection instruction includes the name of the missing or abnormal data field, data collection requirements, supplementary data collection time limit, and corresponding verification parameters, such as the raw material's... , After receiving the supplementary data collection instruction, the merchant or client re-collects the corresponding data according to the instruction requirements. After collection, the supplementary data is transmitted to step S2 via the encrypted communication link. Step S2 incorporates the supplementary data into the standardized production process data table and recalculates the corresponding... and Replace any missing or abnormal data and validation results to ensure the integrity and accuracy of the data table.
[0052] Based on the standardized production process data table generated in step S2, step S3, blockchain notarization and anti-tampering processing, is performed. This step achieves distributed notarization of data through hash extraction and consortium blockchain deployment, generating tamper-proof certificates to ensure the authenticity and immutability of production data. Specifically, step S31, data table hash extraction, employs the SHA256 hash algorithm to extract key information and calculate hash values from the standardized production process data table generated in step S2, thereby compressing the amount of data uploaded to the blockchain. The filtering rules for key information are predefined by the data processing end. The key information to be filtered includes the unique identifier of the data table, core information on the source of raw materials, core data on raw material proportions, core information on quality inspection results, and cross-validation results. The filtering method involves matching field codes to select key fields and corresponding data that meet the rules.
[0053] To further enhance the uniqueness and security of hash calculations, this embodiment adds data salt obfuscation processing before SHA256 hash calculation. The specific process is as follows: First, a random salt value is generated; the filtered key information is converted into a UTF-8 encoded byte stream and concatenated with the byte stream of the random salt value; the concatenated byte stream is padded so that the length of the byte stream modulo 512 is 448. The padding rule is to add a 1 at the end of the byte stream, followed by several 0s, until the length requirement is met; the length information of the original byte stream is added to the end of the padded byte stream, represented by a 64-bit binary number; the padded byte stream is grouped into 512-bit groups, and eight rounds of hash operations are performed on each group. Each round of operations includes message expansion, compression function processing, etc., finally yielding a 256-bit hash value, which is the unique hash identifier of the standardized production process data table. Simultaneously, the random salt value is bound to the hash value for storage, providing a salt value matching basis for subsequent hash verification.
[0054] The specific implementation of step S32, lightweight deployment of the consortium blockchain, involves constructing a consortium blockchain network comprising food regulatory nodes, merchant nodes, and traceability center nodes. The network's node architecture adopts a layered design, including an application layer, consensus layer, data layer, and network layer. The application layer is responsible for node data interaction and business logic processing; the consensus layer is responsible for implementing the consensus mechanism between nodes; the data layer is responsible for data storage and management; and the network layer is responsible for communication connections between nodes. The roles of each node are as follows: food regulatory nodes are responsible for the management and supervision of the consortium blockchain network, including node access review, consensus parameter configuration, data supervision, and salt value generation rule management; merchant nodes are responsible for uploading their standardized production process data tables, corresponding hash values, and random salt values, and receiving evidence storage feedback information from the consortium blockchain network; and traceability center nodes are responsible for storing traceability-related data, responding to hash verification requests during traceability queries, and managing the association mapping relationship between QR codes and hash values.
[0055] The consortium blockchain network employs a Byzantine fault-tolerant consensus mechanism to simplify the node consensus process, enabling lightweight deployment of consortium blockchain nodes. The simplified process of the Byzantine fault-tolerant consensus mechanism is as follows: First, the merchant node initiates a consensus request, signing the standardized production process data table, corresponding hash values, and random salt values using the SM2 algorithm, and then broadcasting it to other nodes in the consortium blockchain network. Upon receiving the consensus request, each node verifies the legality of the received data, including whether the data format meets requirements, whether the SM2 signature is valid, and the matching of the hash value with the data. After successful verification, each node temporarily stores the data in its local cache and simultaneously sends verification success feedback information to other nodes, including the node identifier and verification timestamp. When a merchant node receives verification success feedback information from more than 2 / 3 of the nodes, it triggers the consensus confirmation process. Each node writes the data to its local distributed ledger and updates the block index information, completing the consensus process. Compared to the traditional Byzantine fault-tolerant consensus mechanism, the simplified process reduces the number of redundant communication interactions by three rounds, lowers the consensus latency from seconds to milliseconds, reduces the computing power consumption and communication bandwidth usage of nodes, and enables lightweight deployment of consortium blockchain nodes.
[0056] After consensus is reached, the standardized production process data table, corresponding hash values, and random salt values are uploaded to each node of the consortium blockchain for distributed storage. The storage method uses block storage, with each block containing a block header and a block body. The block header includes a version number, the hash value of the previous block, Merkle root hash, timestamp, block height, and a random salt digest. The block body includes the standardized production process data table, the corresponding hash value, SM2 signature information, and transaction records. Simultaneously, the consortium blockchain network generates a tamper-proof credential containing a block index, block hash value, and salt digest. The block index identifies the block's location in the blockchain, the block hash value is the block header hash value, and the salt digest is the MD5 hash value of the random salt. This tamper-proof credential is transmitted to the data processing end via an encrypted communication link, providing a basis for matching hash identifiers and salt values for subsequent QR code generation.
[0057] Based on the tamper-proof certificate and blockchain-stored evidence data generated in step S3, step S4, dynamic traceability QR code generation and multi-terminal traceability service, is executed. This step generates an integrated anti-counterfeiting and evidence-stored QR code and completes multi-terminal transmission and spraying to achieve differentiated traceability information display and authenticity verification across multiple terminals. Specifically, step S41, the integrated anti-counterfeiting and evidence-stored QR code generation, involves encapsulating the product's unique identifier, the tamper-proof certificate generated in step S3, core production information, and salt value summary. The product's unique identifier uses a combination of product code and batch code. The product code is a unique product identifier code pre-applied by the merchant, and the batch code is a unique code for the product's production batch. The combined code format is "product code batch code serial number," with connectors removed and pure character combinations used. The serial number is a unique number for products within the same batch, ensuring the uniqueness of each product's unique identifier.
[0058] Core production information includes raw material sources, supplier names, and purchase batches; key production milestones, such as ingredient preparation time, production start time, and production end time; quality inspection results and conclusions; cross-validation results, including the overall deviation coefficient Z; and data encapsulation using JSON format, which encapsulates the product's unique identifier, tamper-proof certificate, core production information, and salt value summary into a single JSON data object. An example of this encapsulation is shown below. {"productId":"SP202506001PC202506150001", "blockCert":{"blockIndex":"10086","blockHash":"a1b2c3d4e5f6...","saltDigest":"f7g8h9i0j1k2..."}, "rawMaterial":{"supplier":"XX Agricultural Technology Co., Ltd.","batch":"2025061001"}, "productionNode":{"batchingTime":"2025-06-1508:30:00","startTime":"2025-06-1509:00:00","endTime":"2025-06-1516:00:00"}, "qualityInspection":{"result":"Qualified"}, "verification":{"Z":"0.0325"} }
[0059] After encapsulation, a traceability QR code is generated using the QR code encoding standard. Version 7 of the QR code is selected. This version of the QR code contains 45×45 modules and can store up to 512 bytes of character data, which meets the storage requirements of the encapsulated data in this embodiment.
[0060] The QR code encoding process includes steps such as data encoding, error correction encoding, constructing final information, and module placement. The error correction level is set to H level, with an error correction capability of up to 30%, which can effectively ensure the recognition accuracy of the QR code. The data encoding adopts byte mode, converting the JSON data object into a UTF-8 encoded byte stream before encoding.
[0061] Meanwhile, an invisible anti-counterfeiting code based on texture features is embedded during the QR code encoding process. The embedding method of the invisible anti-counterfeiting code is to embed a preset texture feature pattern in the non-critical module area of the QR code, which does not affect the recognition of the QR code. The texture feature pattern adopts a high-frequency texture pattern, which is invisible to the human eye and can only be recognized by the high-frequency filtering function of a dedicated scanning tool.
[0062] The generation process of the invisible anti-counterfeiting code is as follows: First, a high-frequency texture pattern is designed. The pattern uses a 2×2 pixel high-frequency grid pattern with a grid line width of 0.1 pixels and a grid spacing of 0.2 pixels, and adopts a grayscale gradient design. Then, the non-critical module areas of the QR code are determined. Through QR code encoding rule analysis, the module areas other than the 10% area around the positioning pattern, the 5% area on both sides of the timing pattern, and the 8% area around the alignment pattern are selected as non-critical module areas. Finally, the high-frequency texture pattern is embedded into the non-critical module areas at a 1:1 ratio. During the embedding process, a pixel superposition method is used to ensure that the grayscale values of the original data modules of the QR code are not changed, thus completing the embedding of the invisible anti-counterfeiting code.
[0063] The specific implementation of step S42, multi-terminal differentiated traceability information display, is as follows: the traceability information display templates for consumers, merchants, and regulators are configured according to access permissions. The access permissions are configured through user role division. Consumer users are ordinary users, merchant users are merchant administrators, and regulators are regulators. Different roles correspond to different access permissions, and the permission levels are from high to low as regulators, merchants, and consumers.
[0064] The consumer-facing template displays information including raw material sources, key production milestones, quality inspection results, and cross-validation results. The interface uses a simple list format, with each information item accompanied by a corresponding icon for easy viewing of core information. The merchant-facing template, in addition to the consumer-facing content, also displays production equipment operating parameters, environmental temperature and humidity data, and single-raw-material weighted deviation correction coefficients. The supplementary collection records are displayed on a details page, supporting filtering and viewing of production process data by time dimension. The content displayed on the regulatory end is configured to include not only the content displayed on the merchant end, but also blockchain evidence details, SM2 signature verification results, and consensus process records. The display interface supports viewing and downloading the original data table and verification report.
[0065] During the interaction between steps S3 and S4, the evidence storage data association mechanism is followed. Specifically, after generating the anti-tampering certificate in step S3, the block hash value and salt digest are transmitted to the data processing end through an encrypted communication link. The data processing end performs joint simplified encoding on the block hash value and salt digest. The simplified encoding method adopts Base64url encoding, which concatenates the 256-bit block hash value and the 128-bit salt digest and converts them into printable ASCII characters. The length of the encoded characters is controlled within 64 bits to adapt to the storage capacity of the QR code.
[0066] In step S4, when generating the traceability QR code, the combined simplified encoded string is embedded in the QR code's encapsulated data to achieve real-time association between the blockchain evidence data, salt value, and QR code, ensuring that each QR code corresponds to a unique blockchain evidence data and salt value.
[0067] Step S4: After generating the traceability QR code, the QR code data is transmitted to the traceability center and the merchant via an encrypted communication link. The traceability center associates and stores the QR code data with the corresponding standardized production process data table, block hash value, and salt value, establishing a mapping relationship table between the QR code, the product's unique identifier, the block hash value, and the salt value. After receiving the QR code data, the merchant uses a QR code spraying device to spray the traceability QR code onto the product packaging. The spraying position is selected in a prominent position on the product packaging, and the spraying precision is set to 300 DPI to ensure that consumers can easily scan the code for inquiry.
[0068] When consumers scan the code to check the product, they use a scanning device to scan the traceability QR code on the product packaging. The scanning device parses the packaged data in the QR code, extracts the product's unique identifier and the string after combined simplified coding, and sends the extracted information to the traceability center.
[0069] After receiving the information, the traceability center automatically extracts the combined simplified encoding string from the QR code, decodes it using Base64url, and restores it to the original block hash value and salt digest. Then, it sends a hash verification request to the consortium blockchain network in step S3. The verification request contains the restored block hash value, salt digest, and product unique identifier.
[0070] After receiving a verification request, the traceability center node in the consortium blockchain network queries the corresponding block information based on the product's unique identifier, extracts the block header hash value and salt digest of the block, and compares them with the block hash value and salt digest in the verification request, respectively. At the same time, it queries the corresponding random salt value based on the salt digest, obtains the standardized production process data table stored in the block, recalculates the hash value of the data table, and performs a second comparison with the block header hash value.
[0071] If both comparisons match, the traceability information is deemed authentic, and a verification pass result is generated. If either comparison fails, the traceability information may have been tampered with, and a verification failure result is generated. The consortium blockchain node returns the verification result to the traceability center. After determining the authenticity of the traceability information based on the verification result, the traceability center displays the corresponding information to the consumer: if the verification passes, the traceability information display template configured by the consumer is displayed, and the "Information has been certified and is authentic and reliable" label is displayed at the bottom of the page; if the verification fails, a message indicating that the information verification failed is displayed, along with the contact information of the regulatory authority, suggesting that the consumer contact the relevant regulatory authority for verification.
[0072] For traceability queries on both the merchant and regulatory sides, merchant administrators and regulatory personnel log into their respective management systems using their terminal devices, enter the product's unique identifier or scan the traceability QR code on the product packaging, and the management system sends a traceability query request to the traceability center. The request includes user role information and query parameters.
[0073] The traceability center verifies access permissions based on the user role of the requesting party. Once verification is successful, it displays the corresponding traceability information template to the requesting party: Merchant administrators can view the complete traceability information of their merchant's products, including replenishment records and production equipment operation details; regulatory personnel can view the complete traceability information of all merchant products, including blockchain evidence details and consensus process records, and can download original data tables and verification reports to achieve comprehensive supervision of the food production process.
[0074] This embodiment achieves reliable data collection, intelligent verification, blockchain-based evidence storage, and anti-counterfeiting traceability for food production through the organic synergy of the above steps. The innovative formula design of the weighted deviation correction coefficient and the comprehensive deviation coefficient improves the accuracy of raw material ratio verification. The design of salt value obfuscation and joint coding enhances the security of hash-based evidence storage. Multi-terminal permission adaptation and secondary hash verification ensure the authenticity and relevance of traceability information, providing consumers with reliable traceability query services and offering regulatory authorities effective regulatory tools, thus safeguarding food safety in both production and consumption.
[0075] Example 3 This embodiment takes the processing and production of fresh fruits and vegetables as the application background. In this scenario, the production and processing of fresh fruits and vegetables is sensitive to environmental temperature and humidity. The accuracy of raw material ratio and storage shelf life directly affect product quality. Consumers pay close attention to the transparency and freshness of the production process of fresh products. Regulatory authorities need to accurately supervise the data of the entire fresh production process.
[0076] The technical features that distinguish this embodiment from Embodiments 1 and 2 are as follows: This embodiment employs a dedicated data collection and time-series preprocessing solution adapted to fresh food scenarios, intelligent verification incorporating environmental factors, layered consensus consortium blockchain notarization, and an anti-counterfeiting and traceability scheme including shelf-life warnings. The specific implementation is as follows: S1: Multi-terminal trusted data acquisition and time series preprocessing 1. Communication link setup: The system adopts the SM2 and SM4 combination encryption and cyclic redundancy check mechanism. During key negotiation, each end carries an additional fresh food processing scenario identifier to meet the security requirements of scenario-based data transmission. 2. Core Data Acquisition: Collect parameters of fresh produce-specific production equipment, such as the rotation speed of washing equipment, the power of cutting equipment, and the operating pressure of preservation equipment; additionally record the exposure time of easily oxidized fruits and vegetables after ingredient preparation; collect environmental temperature and humidity data every 30 seconds, and preprocess them by sliding window mean filtering to eliminate instantaneous fluctuations; 3. Additional Information: Raw material sourcing information includes harvesting time and cold chain transportation temperature and humidity records; product quality inspection results include microbial indicators and the interval between quality inspection and production completion time; client-side data collection on cold chain delivery requirements and feedback on spoilage issues; 4. Core Field Marking: Add environmental temperature and humidity time series preprocessed data and raw material cold chain transportation temperature and humidity records as core marking fields to facilitate subsequent targeted verification.
[0077] S2: Intelligent cross-validation incorporating environmental factors 1. Validation of model optimization: A gradient boosting tree model that integrates environmental temperature and humidity factors is adopted. The environmental temperature and humidity time series preprocessed data are incorporated into the input features, focusing on the correlation verification between raw material ratio, temperature and humidity and quality inspection results.
[0078] 2. Deviation Coefficient Calculation: A weighted deviation correction coefficient including an environmental correction factor is used, combined with the weight of raw material quality influence, deviation level correction coefficient, and the deviation between actual and standard ambient temperature and humidity for comprehensive calculation; the multi-raw material comprehensive deviation coefficient is retained, and the anomaly judgment threshold is adjusted to... , .
[0079] 3. Data completion mechanism: The supplementary collection instruction includes additional environmental standard values: standard temperature and humidity. For missing time series data of environmental temperature and humidity, data from adjacent time points are collected and then reprocessed using a sliding window.
[0080] 4. Standardized data tables: Integrate fresh produce-specific information such as cold chain transportation records and environmental temperature and humidity pre-processing data. Add environmental temperature and humidity data category codes to the field codes to ensure that the data is adapted to the fresh produce scenario for evidence storage and traceability.
[0081] S3: Layered Consensus Consortium Chain Notarization 1. Key information filtering: Prioritize the extraction of core information about fresh produce, such as harvest time, cold chain transportation temperature and humidity records, deviation coefficients with environmental correction, and temperature and humidity values in fresh-keeping warehouses, to reduce the amount of data uploaded to the blockchain.
[0082] 2. Consortium Blockchain Architecture: Construct a layered architecture with a core consensus layer, such as food regulatory nodes; a general consensus layer, such as merchant nodes; and a data service layer, such as traceability center nodes, clearly defining the division of labor among nodes at each level.
[0083] 3. Consensus Mechanism Optimization: A layered Byzantine fault-tolerant consensus mechanism is adopted. After a merchant node initiates a request, it undergoes preliminary verification by the food supervision node and secondary verification by the ordinary consensus layer. Consensus is completed when more than 2 / 3 of the nodes pass the verification. The consensus latency is reduced to within 500 milliseconds, which is suitable for the high-frequency evidence storage needs of fresh food data.
[0084] 4. Tamper-proof certificate: The salt value is stored in association with the unique identifier of the fresh product. The certificate generation logic is consistent with the implementation example, ensuring data relevance and security.
[0085] S4: Anti-counterfeiting and traceability service including shelf-life warning 1. QR code packaging: Add shelf life information: production completion time, shelf life duration, and recommended consumption deadline; preset warning rules: generate a warning icon if there are less than 3 days left until the recommended consumption deadline; the packaged data retains an invisible anti-counterfeiting code, and the embedding logic is the same as in Example 1.
[0086] 2. Differentiated display across multiple platforms: Consumers will be provided with additional information on harvesting time, temperature and humidity of the cold storage warehouse, shelf life, and warnings. When a warning is issued, it will display: "The shelf life is approaching, it is recommended to consume it as soon as possible." Merchants will have added records of temperature and humidity during cold chain transportation and time-series data on environmental temperature and humidity. Regulatory authorities will focus on verifying the accuracy of fresh raw material ratios and temperature and humidity control data, and will support the download of original data tables.
[0087] 3. Traceability Verification Logic: After scanning the code, the traceability center verifies the authenticity of the traceability information, simultaneously analyzes the shelf life information and warning signs, and provides freshness reminders to consumers; merchants can filter and view temperature and humidity changes during the production and storage stages by time, and regulators can verify the compliance of temperature and humidity control throughout the entire process.
[0088] This embodiment, through the above-mentioned technical optimizations adapted to fresh food scenarios, achieves reliable collection of fresh food production data, accurate verification by integrating environmental factors, efficient blockchain evidence storage, and anti-counterfeiting traceability that also considers freshness queries. It ensures the standardization of the fresh food production process and the authenticity of data, meets consumers' needs for freshness queries, and meets the full-process supervision requirements of regulatory authorities.
[0089] This embodiment, through the organic synergy of the above steps, addresses the unique characteristics of fresh fruit and vegetable processing and production scenarios, achieving reliable data collection for fresh food production, intelligent verification incorporating environmental factors, hierarchical consensus alliance chain notarization, and anti-counterfeiting traceability including shelf-life warnings.
[0090] By designing a weighted deviation correction coefficient formula with environmental correction factors, the accuracy of verifying the synergistic effects of raw material ratios and the environment in fresh food scenarios is improved; by deploying a layered consensus alliance chain, the efficiency of high-frequency data storage for fresh food is optimized and the node deployment cost is reduced; and by designing a QR code with shelf-life warning, the needs of consumers to query the freshness of fresh food products are met.
[0091] The entire solution ensures the standardization of the fresh food production process and the authenticity of the data, provides consumers with convenient services that take into account both traceability information and freshness indicators, and provides regulatory authorities with precise means of supervising the entire fresh food production process, helping to improve the safety level of fresh food production and consumption.
[0092] It should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for food safety production monitoring and traceability based on digital visualization, characterized in that, Includes the following steps: S1. Establish encrypted communication links between the food supervision platform and the merchant end, client end, and data processing end to collect core production data from the merchant end and key feedback data from the client end; S2. Perform multi-dimensional weighted cross-validation on the collected data, accurately identify abnormal information through deviation correction design, and generate a standardized production process data table after supplementing abnormal and missing data. S3. After filtering and encrypting key information in the standardized data table, the data is transmitted to the blockchain network for distributed storage and generates tamper-proof credentials. S4. Generate traceability QR codes containing anti-counterfeiting information based on blockchain-stored evidence data, configure differentiated traceability information display templates according to user roles, and transmit and spray corresponding information to multiple terminals.
2. The method for food safety production monitoring and traceability based on digital visualization according to claim 1, characterized in that, S1 includes the following steps: S11. A communication encryption mechanism is constructed by combining the SM2 asymmetric encryption algorithm and the SM4 symmetric encryption algorithm to encrypt the transmitted data, and at the same time, the link integrity is verified by the cyclic redundancy check algorithm. S12. Collect all data from the merchant's production equipment operating parameters, raw material ratio data, environmental temperature and humidity data, raw material source information, product quality inspection results, as well as client user order characteristics and quality feedback data, and mark the core fields.
3. The method for food safety production monitoring and traceability based on digital visualization according to claim 1, characterized in that, S2 includes the following steps: S21. A lightweight verification model is constructed using the gradient boosting tree algorithm. The model focuses on the consistency verification of the correlation between raw material ratio data and quality inspection results. By designing a weighted deviation correction coefficient and a multi-raw material comprehensive deviation coefficient, the deviation coefficient is calculated by combining the weight of raw material quality influence, the deviation between actual and standard ratios, and the deviation level correction coefficient. This accurately quantifies the degree of deviation of different raw material ratios. S22. Integrate raw material source information, production process data, cross-validation results, and product quality inspection results, and standardize and encapsulate them according to preset field formats and data type requirements to form a structured data table, providing standardized data support for subsequent blockchain evidence storage.
4. The method for food safety production monitoring and traceability based on digital visualization according to claim 1, characterized in that, S3 includes the following steps: S31. Use the SHA256 hash algorithm to filter and extract key information and calculate hash values in the standardized production process data table. Before extraction, the key information is salted and encrypted. S32. Construct a consortium blockchain network that includes food supervision nodes, merchant nodes, and traceability center nodes. Use a simplified Byzantine fault-tolerant consensus mechanism to achieve lightweight node deployment. Distribute the data table and corresponding hash values for storage. Combine secondary hash verification to generate tamper-proof credentials and enhance the security of evidence storage.
5. The method for food safety production monitoring and traceability based on digital visualization according to claim 1, characterized in that, S4 includes the following steps: S41. Encapsulate the product's unique identifier, tamper-proof certificate, core production information, and hidden anti-counterfeiting code, and generate a traceability QR code using the QR code encoding standard. During the encoding process, ensure that the hidden anti-counterfeiting code does not affect the basic QR code recognition function. S42. Configure differentiated traceability information display templates according to user roles, provide core traceability information to consumers, provide full-process production and traceability data to merchants, and provide complete production data and evidence details to regulators.
6. The method for food safety production monitoring and traceability based on digital visualization according to claim 1, characterized in that, The S1 and S2 have a data interaction and adaptation mechanism to ensure the accuracy of data verification. S1 prioritizes transmitting the labeled core field data to the data processing end to provide targeted data for model verification. The verification model of S2 dynamically adjusts the verification parameters and deviation correction coefficients according to the core field type to adapt to different data characteristics; When S2 detects missing or abnormal data, it sends a supplementary data collection instruction to S1. The supplementary data is preferentially included in the standardized data table to ensure the integrity of the verification data.
7. The method for food safety production monitoring and traceability based on digital visualization according to claim 1, characterized in that, The S3 and S4 have a data association mechanism to enhance traceability security and verification efficiency. After generating the tamper-proof credential, S3 transmits the block hash value to the data processing end for simplified encoding, balancing encoding efficiency and security. When S4 generates a QR code, it embeds the encoded string to establish a unique association between the evidence data and the QR code. When consumers scan the code to query, the traceability center extracts the encoded string to restore the hash value, sends a secondary hash verification request to the consortium blockchain, and quickly determines the authenticity of the traceability information based on the feedback results.
8. The method for food safety production monitoring and traceability based on digital visualization according to claim 3, characterized in that, For fresh food production scenarios, the cross-validation model in S21 additionally incorporates environmental temperature and humidity time-series data as input features. When calculating the deviation coefficient, it introduces environmental temperature and humidity influence correction weights and performs secondary correction based on the deviation between actual and standard environmental temperature and humidity, further improving the verification accuracy of core data for fresh food production.
9. A method for food safety production monitoring and traceability based on digital visualization according to claim 5, characterized in that, The QR code encapsulation data of S41 also includes shelf-life information, which includes the product's production completion time, shelf-life duration, and recommended consumption deadline. It also includes preset shelf-life warning rules, which generate warning signs when the product is nearing or exceeding its shelf-life. During traceability display, warning prompts are pushed to consumers simultaneously, optimizing the consumer traceability experience and providing auxiliary data for shelf-life management for merchants and regulators.
10. A method for food safety production monitoring and traceability based on digital visualization according to claim 5, characterized in that, The invisible anti-counterfeiting code is achieved by embedding a preset high-frequency texture pattern in the non-critical module area of the QR code. This pattern is invisible to the human eye and needs to be identified by the high-frequency filtering function of a dedicated scanning tool. The embedding process does not change the grayscale value of the original data module of the QR code.