Cream raw material detection and traceability method based on distributed storage
Patent Information
- Application Number
- CN202611180872.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-09-18
AI Technical Summary
[0003]然而,奶油原料溯源涉及牧场、冷链、第三方检测及乳企等多个利益主体,产生的多源异构质检文件独立存储于本地数据库,导致同一批次但在不同工序产生的质检文件离散化存储,当终端产品抽检不合格需进行跨机构溯源时,传统的基于中心化索引的逐级调取溯源方法,只能依据简单的静态批次标识在异构数据库间执行低效率的串行轮询或盲目的全网广播寻址,导致溯源检索响应效率低下;同时缺乏对离散化的质检文件的全局防篡改与连续性协同校验机制,一旦恶意篡改本地存储的质检文件或故意隐藏关键节点数据,整个溯源链路的真实性与完整性便无法确证,难以满足高敏感度奶油原料对质量安全精准溯源的需求
上述的基于分布式存储的奶油原料检测溯源方法,由于根据奶油质检状态数据计算相邻两工序节点间的工艺耦合强度系数,并通过工艺耦合强度系数对各个工序质检文件进行工艺关联分组,得到批次工艺关联图谱;当执行跨机构溯源检索时,首先,通过奶油的物理状态数据快速识别不同工序质检文件之间在物理时间与生化演变上的内在强耦合特征;随后,根据工艺关联图谱指导溯源管理平台跳过无关节点,进行定向的分组数据预取与拉取;相对于现有技术中传统的基于中心化索引的逐级调取溯源方法只能依据简单的静态批次标识在异构数据库间执行低效率的串行轮询或盲目的全网广播寻址的方式,本发明的分组关联机制能够精准匹配奶油原料在流转中的非均匀动态变化特征,避免了在无工艺关联的节点间执行无效的广播通信与冗余查询,同时确保了强关联节点数据的就近与优先获取,有效减少了跨节点通信开销,显著提升了溯源检索的响应效率。
Smart Images

Figure REF-OBJ-1784273508933-000073 
Figure REF-OBJ-1784273508933-000074 
Figure REF-OBJ-1784273508933-000075
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology, and in particular to a method for detecting and tracing the source of cream raw materials based on distributed storage. Background Technology
[0002] From milking at the farm, through cold chain transfer, third-party sampling inspections, to warehousing at dairy companies, the quality of cream raw materials, as a highly sensitive semi-finished dairy product, is significantly affected by the dynamic changes in microbial metabolism and acidity. Establishing a full life-cycle testing and traceability system is a core means to ensure food safety.
[0003] However, the traceability of cream raw materials involves multiple stakeholders, including pastures, cold chain logistics, third-party testing, and dairy companies. The resulting heterogeneous quality inspection documents are stored independently in local databases, leading to the discretization of quality inspection documents for the same batch produced in different processes. When the final product fails the inspection and cross-institutional traceability is required, the traditional traceability method based on centralized indexes can only perform inefficient serial polling or blind network broadcasting between heterogeneous databases based on simple static batch identifiers, resulting in low traceability retrieval response efficiency. At the same time, there is a lack of global anti-tampering and continuous collaborative verification mechanisms for discretized quality inspection documents. Once the locally stored quality inspection documents are maliciously tampered with or key node data is deliberately hidden, the authenticity and integrity of the entire traceability chain cannot be verified, making it difficult to meet the needs of highly sensitive cream raw materials for accurate traceability of quality and safety. Summary of the Invention
[0004] Based on this, the present invention provides a method for detecting and tracing the source of cream raw materials based on distributed storage, in order to solve at least one of the above-mentioned technical problems.
[0005] To achieve the above objectives, a method for tracing and detecting cream raw materials based on distributed storage is provided. This method is executed by a traceability management platform, which is communicatively connected to a distributed storage network and a blockchain system. The blockchain system deploys blockchain smart contracts and maintains a blockchain ledger. The method includes the following steps: Step S1: Obtain batch identification data of the cream raw materials; determine the corresponding cream processing technology based on the batch identification data; obtain process quality inspection documents and cream quality inspection status data at each process node of the cream processing technology. Step S2: Calculate the process coupling strength coefficient between two adjacent process nodes based on the cream quality inspection status data; group the quality inspection documents of each process according to the process coupling strength coefficient to obtain the batch process association map; Step S3: Obtain the file location records of each process quality inspection document in the distributed storage network; construct a batch traceability index tree based on the file location records and the batch process association map, and call the blockchain smart contract to put the batch traceability index tree on the chain for evidence storage, generating a batch on-chain index; Step S4: The traceability management platform responds to the input target traceability request, retrieves the corresponding batch on-chain index from the blockchain ledger based on the target batch identifier of the target traceability request, and pulls the process quality inspection file from the distributed storage network based on the batch on-chain index to output the target traceability result.
[0006] Compared with the prior art, this disclosure has at least the following advantages: The aforementioned method for tracing and detecting cream raw materials based on distributed storage calculates the process coupling strength coefficient between adjacent process nodes based on cream quality inspection status data, and then groups the quality inspection documents of each process according to the process coupling strength coefficient to obtain a batch process association map. When performing cross-institutional traceability retrieval, firstly, the inherent strong coupling characteristics between quality inspection documents of different processes in terms of physical time and biochemical evolution are quickly identified through the physical state data of cream. Subsequently, the traceability management platform is guided by the process association map to skip irrelevant nodes and perform targeted pre-fetching and retrieval of grouped data. Compared with the traditional traceability method based on centralized indexes in the prior art, which can only perform inefficient serial polling or blind full-network broadcast addressing between heterogeneous databases based on simple static batch identifiers, the group association mechanism of this invention can accurately match the non-uniform dynamic change characteristics of cream raw materials in circulation, avoid performing invalid broadcast communication and redundant queries between nodes without process association, and ensure the proximity and priority acquisition of data of strongly associated nodes, effectively reducing cross-node communication overhead and significantly improving the response efficiency of traceability retrieval.
[0007] Furthermore, by acquiring the file location records of quality inspection documents for each process in the distributed storage network, a batch traceability index tree is constructed based on the file location records and the batch process association map. The batch traceability index tree is then stored on the blockchain using a blockchain smart contract, generating a batch on-chain index. In response to traceability requests, the on-chain index is retrieved from the blockchain ledger. When generating and verifying the entire lifecycle traceability chain, firstly, the distributed storage network ensures the secure storage and content addressing and retrieval of large physical files. Subsequently, the batch traceability index tree solidifies the location records and process associations across institutions in an immutable blockchain ledger, achieving global collaborative registration. Compared to existing technologies that lack a global anti-tampering and continuous collaborative verification mechanism for discrete quality inspection documents, this invention, through a two-layer alignment verification mechanism of distributed storage and blockchain ledger, can ensure the topological continuity and fingerprint consistency of heterogeneous quality inspection data across institutions during traceability splicing. This avoids logical breaks and verification failures caused by malicious tampering of locally stored quality inspection documents or deliberate concealment of key node data by a stakeholder, thereby improving the authenticity and integrity of the entire lifecycle traceability chain and meeting the needs for accurate traceability of the quality and safety of highly sensitive cream raw materials. Attached Figure Description
[0008] Figure 1 This is a schematic diagram of the steps of the cream raw material detection and traceability method based on distributed storage of the present invention; Figure 2 for Figure 1 A detailed flowchart illustrating the implementation steps of step S3. Figure 3 This is a network architecture diagram for the traceability and detection of cream raw materials according to the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0009] The technical method of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0010] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.
[0011] It should be understood that although the terms "first," "second," etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are used merely to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0012] To achieve the above objectives, please refer to Figures 1 to 3 This invention provides a method for tracing and detecting cream raw materials based on distributed storage. This method is executed by a traceability management platform, which is communicatively connected to a distributed storage network and a blockchain system. The blockchain system deploys blockchain smart contracts and maintains a blockchain ledger. The method includes the following steps: Step S1: Obtain batch identification data of the cream raw materials; determine the corresponding cream processing technology based on the batch identification data; obtain process quality inspection documents and cream quality inspection status data at each process node of the cream processing technology. In one embodiment, the traceability management platform retrieves the batch management ledger from the dairy company's production execution system to obtain the unique batch code of the cream raw material to be tested. Based on the batch identification data, the platform matches the corresponding cream processing flow in its database. For example, this flow includes four process nodes in sequence: milking at the dairy farm, cold chain transportation, third-party sampling inspection, and dairy company warehousing. When quality inspection is performed at each process node, the local system of each node automatically extracts and uploads the process quality inspection file in portable document or image format, and simultaneously records the cream quality inspection status data corresponding to the inspection time. For example, it extracts the physicochemical and biochemical indicators such as pH value and target bacterial count from the quality inspection report. The target bacterial count includes, but is not limited to, one or more microbial indicators suitable for the quality control of cream raw materials, such as lactic acid bacteria, psychrophilic bacteria, Enterobacteriaceae, yeast, and mold, which can be preset according to the actual testing standards of the cream raw materials.
[0013] Step S2: Calculate the process coupling strength coefficient between two adjacent process nodes based on the cream quality inspection status data; group the quality inspection documents of each process according to the process coupling strength coefficient to obtain the batch process association map; In one embodiment, the pH difference and quality inspection time interval of the cream raw materials at two adjacent process nodes (e.g., the cold chain transportation node and the third-party sampling node) are extracted to calculate the pH decay intensity per unit time. At the same time, the target microbial count data corresponding to these two nodes are extracted to calculate the actual target microbial proliferation rate, and it is compared with the pre-set proliferation time window standard value to obtain the target microbial time window deviation coefficient. Finally, the pH decay intensity and the target microbial time window deviation coefficient are weighted and summed to calculate the process coupling strength coefficient reflecting the closeness of the physicochemical state evolution of these two nodes. The pre-set proliferation time window standard value is a benchmark reference value obtained by statistically averaging the target microbial proliferation data of all quality-inspected cream batches in the same process stage within a historical year.
[0014] Specifically, a strong coupling threshold is set, based on the experience of historical traceability experts, to distinguish the severity of the evolution of inter-process relationships. For example, the strong coupling threshold is set to 0.75. The calculated process coupling strength coefficient of each adjacent node is compared with this threshold one by one. If the process coupling strength coefficient is greater than or equal to 0.75, it is determined that the cream quality changes drastically and are interdependent between two adjacent processes, and they are marked as strong correlation pairs. Process nodes that are consecutively marked as strong correlation pairs in time sequence are grouped into the same process correlation group. For example, the temperature-fluctuating link from cold chain handover to sampling and warehousing is grouped into the "high-risk monitoring group for easy spoilage". A unique group identifier is assigned to each process correlation group, and each group and its internally bound process quality inspection documents are connected in sequence according to the cream processing time sequence, finally generating a batch process correlation map that reflects the dynamic evolution logic of the batch.
[0015] Step S3: Obtain the file location records of each process quality inspection document in the distributed storage network; construct a batch traceability index tree based on the file location records and the batch process association map, and call the blockchain smart contract to put the batch traceability index tree on the chain for evidence storage, generating a batch on-chain index; In one embodiment, the process quality inspection documents of each node are uploaded to the distributed storage network. The distributed storage system extracts features from the file content using a content hash algorithm, generates a unique content hash identifier, and records the physical address of the primary storage node and the address of the replica node where the file is actually stored. The content hash identifier is bound to these physical addresses to form a file location record that can accurately trace the physical storage location of the file.
[0016] In one embodiment, the process of constructing a batch traceability index tree based on file location records and batch process association graphs is as follows: a multi-level tree data structure is constructed, with batch identifier data as the root node, process association group identifiers as intermediate layer nodes, and file location records corresponding to quality inspection documents of each process as leaf nodes, establishing a hierarchical mapping relationship from batch to group and then to the physical address of the specific file; subsequently, a pre-deployed blockchain smart contract is invoked to encapsulate the topological relationship data of this batch traceability index tree and its root hash value into an on-chain request and send it to the blockchain network. After verification by the blockchain consensus node, it is packaged and written into the block ledger, solidified into an immutable batch on-chain index.
[0017] Step S4: The traceability management platform responds to the input target traceability request, retrieves the corresponding batch on-chain index from the blockchain ledger based on the target batch identifier of the target traceability request, and pulls the process quality inspection file from the distributed storage network based on the batch on-chain index to output the target traceability result.
[0018] In one embodiment, when a regulator or consumer inputs the identifier of a target batch that has a quality anomaly and needs to be traced in the terminal system (initiating a target traceability request), the traceability management platform first connects to the blockchain node. Based on the target batch identifier, it accurately locates and retrieves the on-chain index of the stored batch in the blockchain ledger, thereby parsing out the complete batch traceability index tree structure. Next, based on the process association grouping hierarchy recorded in the index tree, the traceability management platform guides the data request scheduling, reads the file location record (i.e., content hash identifier and node address) from the leaf node, and initiates a direct addressing instruction to the distributed storage network. The distributed storage network quickly locates and downloads the corresponding process quality inspection file based on the address. Finally, the retrieved process quality inspection files from each stage are spliced and integrated according to the original time sequence and process association map to generate a globally coherent and tamper-proof target traceability result, which is displayed to the requesting end.
[0019] The following is a breakdown of several terms used in this application: Distributed storage networks are decentralized storage architectures that distribute data across multiple physical nodes. Through content addressing, redundancy backups, and node collaboration mechanisms, they achieve high availability and fault tolerance. Compared to traditional centralized storage, distributed storage networks avoid single points of failure and, by sharding files and storing them on nodes in different geographical locations, ensure data recovery even if some nodes fail. They are widely used in scenarios such as large-scale data storage, content distribution, and blockchain file storage.
[0020] Blockchain is a decentralized distributed ledger technology that provides immutable, secure, and reliable data storage. It combines distributed storage, peer-to-peer transmission, consensus mechanisms, and cryptography. Transactions and information are recorded chronologically through a continuously growing chain of data blocks. Each block contains the hash value of the previous block, forming a chain structure that ensures data integrity, traceability, and transparency, preventing malicious data tampering.
[0021] A blockchain system refers to a distributed system formed by multiple blockchain nodes (including consensus nodes, ledger nodes, synchronization nodes, etc.) interconnected through a peer-to-peer network. It is responsible for deploying blockchain smart contracts, maintaining the blockchain ledger, and providing interfaces for on-chain evidence storage and contract invocation for upper-layer applications. The traceability management platform in this application communicates with the consensus nodes of the blockchain system. The consensus nodes receive on-chain requests, execute smart contract logic, and write batch on-chain indexes into the blockchain ledger, ultimately synchronizing them to all nodes in the network.
[0022] Blockchain smart contracts are automated programs deployed on a blockchain network. They define contract terms and execution logic in code, and when preset conditions are triggered, the smart contract automatically executes the corresponding operation without third-party intervention. Smart contracts are decentralized, immutable, and automatically executed. Their execution process and results are permanently recorded in the blockchain ledger, and they are widely used in digital asset management, traceability authentication, automated auditing, and other fields.
[0023] A blockchain ledger is a distributed database used in a blockchain system to record all transactions and state changes. It consists of blocks linked together in chronological order. Each participating node maintains a complete or partial copy of the ledger, and a consensus mechanism ensures the consistency of the ledger data across all nodes. The blockchain ledger uses cryptographic hashing and digital signature technology to ensure that historical records are immutable and publicly verifiable, providing a reliable data foundation for traceability, auditing, and trust building.
[0024] Preferably, process quality inspection documents and corresponding cream quality inspection status data at each process node in the cream processing flow are obtained, including: When the local data acquisition unit of each process node performs a quality inspection operation, it simultaneously collects the process quality inspection document, quality inspection timestamp, pH value sampling data of cream, and target microbial count data corresponding to the current batch. Using batch identifier data as the primary key, the quality inspection timestamps reported by each process node are sorted in ascending order of time sequence to obtain the process time sequence table; The pH value sampling data and target microbial count data of the cream corresponding to each process node in the process time sequence table are spliced together in time sequence to generate cream quality inspection status data.
[0025] In one embodiment, the specific operation of obtaining process quality inspection documents and cream quality inspection status data at each process node is as follows: When the quality inspection operation is triggered, the local data acquisition unit (such as a smart terminal or sensor gateway) distributed at each process node such as "milking in the pasture, cold chain transportation, and third-party random inspection" synchronously captures the digital quality inspection report of the current batch of cream and encapsulates it into a process quality inspection document; at the same time, the system clock is called to record the current quality inspection timestamp accurate to the second, and the pH sampling data of the cream output by the pH meter (e.g., pH value of 6.5) and the target bacterial count data output by the microbial micro counting device (e.g., containing 10,000 colony-forming units per gram) are extracted simultaneously, and the above multi-source data are packaged and sent to the traceability management platform.
[0026] In one implementation of this embodiment, after receiving the collected data messages from various distributed nodes, the traceability management platform retrieves the reporting records of all process nodes belonging to the same batch in the central relational database using the batch identifier data as the primary key. It then extracts the quality inspection timestamp from each record, calls the quicksort algorithm, and sorts the records in ascending order from earliest to latest according to the chronological order of occurrence. This generates a process time sequence table that records the time trajectory of the cream raw materials from the source to the end, such as the dairy farm milking time, cold chain loading time, third-party sampling inspection time, and dairy company warehousing time arranged in sequence.
[0027] In one embodiment, the traceability management platform extracts pH value sampling data and target microbial count data sequentially from the corresponding process node data according to the order determined by the process time sequence table. These numerical parameters are converted into key-value pairs and assembled into a string sequence containing time nodes and corresponding physicochemical index characteristics according to the topological structure of the process sequence. This string sequence completely records the dynamic evolution trajectory of acidity and microbial activity of the cream raw materials during the circulation cycle, and defines the sequence as cream quality inspection status data to reflect the quality change characteristics of the cream raw materials throughout their entire life cycle.
[0028] Preferably, the process coupling strength coefficient between two adjacent process nodes is calculated based on the cream quality inspection status data, including: Extract the pH value difference between two adjacent process nodes in the cream quality inspection status data, and calculate the time interval between the nodes based on the quality inspection timestamps corresponding to the two process nodes respectively; The pH decay intensity per unit time is calculated by the ratio of the pH difference to the time interval. Extract the target microbial count data corresponding to each of two adjacent process nodes, and use the target microbial count data of the process node with the earlier time series as the baseline value to calculate the target microbial proliferation rate of the process node with the later time series. The target bacterial community's proliferation rate is compared with the preset standard value of the proliferation time window to obtain the target bacterial community's time window deviation coefficient. The process coupling strength coefficient between two adjacent process nodes is generated by weighted summation of pH decay intensity and target bacterial community time window deviation coefficient.
[0029] In one embodiment, the traceability management platform reads the pH sampling values of two adjacent process nodes from the cream quality inspection status data and extracts the corresponding quality inspection timestamps for each node. It calculates the pH difference by measuring the absolute value of the difference between the pH sampling values of the two nodes, and simultaneously calculates the time interval between the two quality inspection timestamps. A pH attenuation intensity calculation model is constructed, and the calculation formula is as follows: In the formula, This indicates the rate of decrease in pH value per unit time. This represents the difference in pH value between two adjacent process nodes; This represents the time interval between two process nodes. The attenuation intensity reflects the rate of acidity change of the cream raw materials during the transfer process from the perspective of chemical evolution.
[0030] In one implementation of this embodiment, the process of calculating the target bacterial community proliferation rate is as follows: The target bacterial community count data (e.g., total lactic acid bacteria count) of the earlier and later process nodes are read respectively; using the data of the earlier process node as a baseline, a ratio calculation is performed to obtain the target bacterial community proliferation rate. A mathematical model for the target bacterial community proliferation rate is constructed, and the calculation formula is: In the formula, Indicates the proliferation rate of the target bacterial population; This represents the target microbial count value at the later process node in the time series. This represents the target microbial count at the earlier process node in the time series. This ratio intuitively reflects the intensity of microbial activity within a specific process flow.
[0031] In one implementation of this embodiment, the logic for generating the process coupling strength coefficient is as follows: First, a preset standard value for the proliferation time window is obtained. This standard value is an empirical constant obtained by retrieving the average microbial growth rate of the cream raw material within the standard cold chain temperature fluctuation curve under laboratory conditions and combining it with a weighted average of historical batch data. Then, the proliferation rate of the target microbial community is compared with this standard value to obtain the target microbial community time window deviation coefficient. Finally, the process coupling strength coefficient is generated using a weighted summation algorithm, calculated as follows: ; In the formula, This represents the process coupling strength coefficient between two adjacent process nodes; This indicates the attenuation intensity of the pH value calculated above; This represents the target bacterial community proliferation rate calculated above; This represents the preset standard value for the proliferation time window; and These are preset pH and microbial weighting items, whose values are pre-set based on the sensitivity of the cream category, and the sum of the two is one.
[0032] Preferably, the quality inspection documents of each process are grouped according to the process coupling strength coefficient to obtain a batch process correlation map, including: The process coupling strength coefficient between each pair of adjacent process nodes is compared with a preset strong coupling threshold. Pairs of adjacent process nodes with a process coupling strength coefficient greater than or equal to the preset strong coupling threshold are marked as strongly associated pairs, and pairs of adjacent process nodes with a process coupling strength coefficient less than the preset strong coupling threshold are marked as weakly associated pairs. Based on the time sequence of the cream processing process, all adjacent process node pairs are traversed. Process nodes that are continuously marked as strongly associated pairs are grouped into the same process association group. The average process coupling strength coefficient of all strongly associated pairs in the group is calculated as the group coupling strength coefficient of the group. For two adjacent process nodes marked as a weakly associated pair, the two process nodes in the weakly associated pair are respectively assigned to two adjacent process association groups; A unique process association group identifier is assigned to each process association group, and the process association group identifier and the corresponding group coupling strength coefficient are bound to the process quality inspection documents corresponding to all process nodes within the process association group. The process association groups are connected in chronological order according to the cream processing process to generate a batch process association map.
[0033] In one embodiment, 100 batches of high-quality cream samples that have completed circulation within a standard cold chain environment and rated processing time are randomly selected from the production history database. The distribution range of the process coupling strength coefficient between adjacent processes is statistically analyzed. The lower quartile of this range (e.g., a value set to 0.75) is selected as the boundary for determining the strength of the correlation. The calculated coefficients are compared with 0.75 one by one. If the coefficient is greater than or equal to 0.75, the adjacent process node pair is marked as a strongly correlated pair, indicating that the biochemical evolution between the two processes meets the standard expectation. If the coefficient is less than 0.75, it is marked as a weakly correlated pair, representing the risk of long-term storage or drastic fluctuations in the external environment between the processes.
[0034] In one embodiment, the traceability management platform sequentially scans all marked adjacent process node pairs according to the chronological order of the cream processing flow. If multiple consecutive process node pairs are detected as strongly associated pairs (e.g., process 1 and process 2, process 2 and process 3 are both strongly associated), these associated process nodes (process 1, 2, 3) are merged into the same process association group. Subsequently, a group coupling strength calculation model is constructed, and the calculation formula is: In the formula, Indicates the first Grouping coupling strength coefficient of each process-related group; This indicates the total number of strongly related pairs contained within the group; Indicates the number within this group The mean value of the process coupling strength coefficient corresponding to each strong correlation pair reflects the overall stability level of the biochemical properties of the butter raw materials within that specific process stage.
[0035] In one implementation of this embodiment, the logic for processing weakly correlated pairs and dividing them into groups is as follows: when two adjacent process nodes marked as weakly correlated pairs are encountered during the traversal, it is determined that the node pair is at a logical discontinuity in the biochemical evolution and does not meet the merging conditions. At this time, taking the weakly correlated pair as the boundary, the process node with the earlier time sequence is assigned to the end of the previous process correlation group to which it belongs, while the process node with the later time sequence is assigned to the next process correlation group as the starting point. Through this dynamic segmentation mechanism, the discrete processes of the entire life cycle are reorganized into several logically close process sets according to the biochemical coupling characteristics, which effectively solves the problem that simple time-series correlation in traditional traceability cannot reflect the depth of raw material quality changes.
[0036] In one embodiment, a unique hexadecimal-formatted process association group identifier is assigned to each divided process association group, and the identifier, the previously calculated group coupling strength coefficient, and the process quality inspection file content corresponding to all nodes within the group are bound together as metadata. Finally, according to the initial temporal direction of the butter processing process, a directed acyclic graph network topology is used. Each process association group that has completed data binding is set as a vertex of the graph, and the actual chronological order of the butter processing flow is set as a directed edge of the graph. The vertices and directed edges are sequentially connected to construct a batch process association graph with a multi-level topology.
[0037] Preferably, the process involves obtaining the file location records of each process's quality inspection documents in a distributed storage network, including: Content addressing encoding is performed on the process quality inspection documents corresponding to each process association group in the batch process association map to generate content hash identifiers for each process quality inspection document; Process quality inspection files within the same process-related group are preferentially scheduled to the physical adjacent primary storage nodes and their replica storage node clusters in the distributed storage network. They are written using the content hash identifier as the address key, and the physical node address of the primary storage node and the replica storage node address of each process quality inspection file are recorded. The content hash identifier, physical node address, and copy storage node address of each process quality inspection document are bound to the corresponding process association group identifier in the batch process association map to obtain the document location record.
[0038] In one embodiment, the traceability management platform retrieves the original process quality inspection files corresponding to each process association group from the batch process association map and reads their binary data stream information. It then calls a preset secure hash algorithm 256 to perform feature extraction operations on the file content, generating a 64-bit hexadecimal feature string, which is defined as the content hash identifier of the process quality inspection file. This identifier serves as the file's unique digital fingerprint, ensuring accurate addressing through the data content itself in the distributed storage network, effectively avoiding the risk of location failure due to filename tampering or naming conflicts in heterogeneous databases.
[0039] In one implementation of this embodiment, the process of preferentially scheduling process quality inspection files within the same process-related group to a cluster of physically adjacent primary storage nodes and their replica storage nodes in a distributed storage network and recording their addresses includes: parsing the routing topology diagram of the distributed storage network, calculating the network communication hop count and local area network subnet mask, and selecting storage server clusters with network latency below 5 milliseconds and physically deployed in the same data center or adjacent racks; considering that process quality inspection files within the same process-related group (such as group 01) are often concurrently read in batches when dealing with subsequent quality traceability, these sets of quality inspection files with highly coupled biochemical states are collectively and directionally scheduled to the aforementioned selected clusters. In a cluster of servers physically adjacent to each other, the network communication overhead for future cross-node data retrieval is minimized. When performing file data write operations, the storage control program uses the previously generated content hash identifier as the unique addressing primary key, uses the file binary data stream as the key-value pair value to complete the distributed write, and automatically reports the storage confirmation status by the underlying file system after successful write. Based on this, the network protocol address of the primary storage node that actually carries the file is accurately recorded, such as 192.168.10.50, and the addresses of the two replica storage nodes used to meet fault tolerance and redundancy backup, such as 192.168.10.51 and 192.168.10.52.
[0040] Specifically, the operation of binding various parameters to obtain file location records is as follows: For each process quality inspection file successfully written to the distributed storage network, the traceability management platform initializes a standardized lightweight mapping data dictionary in memory; the content hash identifier of the process quality inspection file, the network protocol address of the primary storage node, and the addresses of all replica storage nodes are written into this data dictionary as physical location attributes; at the same time, the process association group identifier (such as group 01) to which the file belongs is extracted from the batch process association graph and written into the dictionary as a business logic attribute; for example, the mathematical mapping model for constructing file location records is as follows: In the formula, Indicates the generated first Document location record of each process quality inspection document; This indicates the number to which the file belongs. Individual process-related group identifiers; This indicates the file corresponding to the first A content hash identifier; This represents the physical node's Internet Protocol address that was actually written to the primary storage node; This represents the set of addresses of the allocated replica storage nodes.
[0041] As an example of the present invention, please refer to Figure 2 In step S3, a batch traceability index tree is constructed based on the file location record and the batch process association map. The blockchain smart contract is then invoked to upload the batch traceability index tree to the blockchain for evidence storage, generating a batch on-chain index. This includes the following steps: Step S31: Using batch identifier data as the root node, process association group identifiers in the batch process association graph as intermediate layer nodes, and file location records as leaf nodes, attach the group coupling strength coefficients corresponding to each process association group identifier to the corresponding intermediate layer nodes to construct a batch traceability index tree. In one embodiment, a multi-level hierarchical multi-branch tree data structure is initialized in memory space; the batch identifier data obtained in the preceding process is assigned to the root node of the multi-branch tree as the unique entry key for the entire traceability data; subsequently, the data in the batch process association graph is read, and the process association group identifiers are instantiated as intermediate layer nodes connected to the root node, and the corresponding group coupling strength coefficients calculated in the preceding process are attached to the corresponding intermediate layer node objects as structured attributes; further, the file location records contained in each group, i.e., the binding data of the content hash identifier and the physical network address of the storage node, are instantiated as bottom-level leaf nodes connected to the corresponding intermediate layer nodes; the root node, intermediate layer nodes and leaf nodes are sequentially connected according to their hierarchical and containment relationships through memory reference pointers, and finally a complete batch traceability index tree that maps heterogeneous and dispersed data and its process biochemical association logic is constructed.
[0042] Step S32: Perform a hash operation on the batch traceability index tree to obtain the batch index root hash value; In one embodiment, the process of hashing the batch traceability index tree to obtain the batch index root hash value follows Merkle tree verification logic: First, an initial digest operation is performed on the file location record content of all leaf nodes to generate a basic hash layer; then, a recursive join hash algorithm is used to concatenate the hash values of adjacent nodes pairwise and perform the hash operation again, converging upwards layer by layer. The batch index root hash value calculation model is constructed, and the calculation formula is as follows: In the formula, This represents the generated batch index root hash value. This indicates the preset cryptographic hash function (such as SHA-256 or SM3). This represents a string concatenation operation. and These represent the summary hash values of the left and right branch nodes in the current node hierarchy, respectively. This root hash value serves as a digital digest of the entire index tree. Any malicious tampering with the process grouping logic or storage address will cause a huge offset in this value, thereby ensuring the integrity of the traceability index data.
[0043] Step S33: Encapsulate the node relationship data of the batch traceability index tree and the hash value of the batch index root into an on-chain anchoring request, submit it to the blockchain smart contract for on-chain storage, and the blockchain ledger records the mapping relationship between the batch identifier data and the batch traceability index tree in the current block to generate the batch on-chain index.
[0044] In one embodiment, the traceability management platform serializes and encapsulates the node topology relationship data of the batch traceability index tree with the previously calculated batch index root hash value to construct an on-chain anchoring request message. Subsequently, the platform sends the on-chain anchoring request to a pre-deployed blockchain smart contract in the blockchain network through the application programming interface provided by the blockchain system. After the blockchain smart contract is triggered, it automatically executes the code logic. After verifying that the request data format and digital signature are correct, it instructs the blockchain consensus nodes to perform distributed consensus, using the batch identifier data as the primary key for global retrieval, and the hierarchical relationship text of the batch traceability index tree and the root hash value as the key-value pair values, and writes them together into the currently being packaged block ledger space. As the block is packaged and appended to the blockchain main chain, the decentralized blockchain ledger permanently and immutably records the precise mapping relationship between the batch identifier data and the batch traceability index tree, and synchronously returns a transaction confirmation hash, marking the formal completion of the generation of the batch on-chain index that can be used for cross-institutional trust traceability retrieval.
[0045] Preferably, before retrieving the corresponding batch on-chain index from the blockchain ledger based on the target batch identifier of the target traceability request, and before pulling the process quality inspection document from the distributed storage network based on the batch on-chain index, the method further includes: Based on the target batch identifier of the target traceability request, the corresponding batch traceability index tree is obtained from the blockchain ledger, and the process association group identifier and additional group coupling strength coefficient corresponding to each intermediate layer node in the batch traceability index tree are extracted. Any two adjacent process association groups in the batch process association diagram are defined as the first process association group and the second process association group, respectively; wherein, the time sequence of the second process association group is after the first process association group; Using the group coupling strength coefficient of the first process-related group as the weight, the prefetch triggering timing threshold of the second process-related group is calculated; wherein, the higher the group coupling strength coefficient, the lower the prefetch triggering timing threshold. The retrieval progress of the first process-related group is monitored in real time. When the real-time retrieval completion progress of the first process-related group reaches the corresponding prefetch triggering threshold, the file location record corresponding to the second process-related group is read from the leaf node of the batch traceability index tree, and a targeted batch retrieval request is initiated to the main storage node cluster corresponding to the second process-related group based on the file location record. The retrieved process quality inspection files are written to the local retrieval buffer to obtain the target traceability retrieval data.
[0046] In one embodiment, after receiving a traceability request containing the target batch identifier, the traceability management platform obtains the corresponding batch traceability index tree by accessing the blockchain ledger, parses out the process association group identifier and the additional group coupling strength coefficient carried by each intermediate layer node, and defines any two sequentially adjacent process association groups in the process flow as the first process association group (time-first) and the second process association group (time-second), respectively, aiming to use the biochemical evolution correlation between the two to guide the data retrieval order.
[0047] In one implementation of this embodiment, the logic for calculating the prefetch trigger timing threshold of the second process-related group is as follows: A prefetch trigger timing threshold calculation model is constructed, and the calculation formula is: In the formula, This represents the calculated prefetch triggering threshold for the second process-related group, expressed as a percentage. This represents the preset baseline trigger limit constant, which is an empirical value of 0.9 based on the average addressing latency of the distributed network under standard load. This represents the correlation sensitivity adjustment coefficient, with a value range between 0.15 and 0.4. This represents the grouping coupling strength coefficient of the first process association group. The higher the coefficient, the more continuous the biochemical evolution of the cream raw materials between the two processes, and the lower the corresponding prefetch triggering threshold. The core of this model is that when the biochemical indicators show that the two process nodes belong to strong biochemical association, it is predicted that the user will access the subsequent data immediately after viewing the current data. Therefore, the fetching task can be started in advance by lowering the threshold.
[0048] In one implementation of this embodiment, the process of real-time monitoring of the retrieval progress and triggering targeted batch retrieval is as follows: When the traceability management platform executes the data retrieval task for the first process-related group, the number of files successfully retrieved is counted in real time by calling the status interface of the local retrieval task manager. A real-time retrieval completion progress calculation model is constructed, and the calculation formula is: In the formula, This indicates the real-time retrieval progress of the first process-related group; This indicates the number of quality inspection files that have been downloaded and verified within this group; This indicates the total number of quality inspection documents contained in the group. When the real-time progress value reaches or exceeds the prefetch triggering threshold calculated above, the file content hash identifier and physical node address corresponding to the second process associated group are immediately read from the leaf node of the batch traceability index tree, and an asynchronous targeted batch fetch request is automatically initiated to the main storage node cluster in the distributed storage network.
[0049] In one embodiment, the traceability management platform stores the captured quality inspection file data stream of the second process-related group into a memory fetch buffer with high-speed read and write capabilities, and establishes a temporary index mapping based on the content hash identifier. When the display of the first process-related group is completed and the next stage data is ready to be loaded, the second process-related group data that is already in a ready state can be read directly from the local fetch buffer, thereby forming a complete target traceability fetch data containing information on multiple processes. This prefetching mechanism based on biochemical coupling strength effectively eliminates the network round-trip latency when retrieving large files from heterogeneous databases across institutions, and significantly improves the overall response performance.
[0050] Preferably, the process involves retrieving the corresponding batch on-chain index from the blockchain ledger based on the target batch identifier of the target traceability request, and then pulling the process quality inspection document from the distributed storage network based on the batch on-chain index, including: The process quality inspection documents in the target traceability data are systematically spliced together to form a traceability document link; Recalculate the content hash identifier for each process quality inspection document in the traceability file chain, and compare it one by one with the content hash identifier recorded in the file location record in the batch chain index; If the hash identifiers of the contents of all process quality inspection documents are consistent with those recorded on the batch chain index, then the traceability link integrity verification is deemed to have passed, and the traceability document link is output as the target traceability result. If the content hash identifier of any process quality inspection document is inconsistent with that recorded in the batch chain index, or if the process quality inspection document is missing, the process quality inspection document will be marked as an abnormal node, and a traceability link abnormal report will be generated.
[0051] In one embodiment, the traceability management platform first parses the batch process association map corresponding to the target batch, extracts the defined process sequence logic and grouping hierarchy relationship; then, it retrieves the acquired process quality inspection documents from the local retrieval buffer, and performs logically ordered splicing in strict accordance with the order of their respective process association groups and the physical timestamp order of the process nodes within each group; the generated traceability document link forms a digital quality inspection evidence flow covering the entire life cycle of cream raw materials from the pasture to the processing end.
[0052] In one implementation of this embodiment, the process of recalculating the content hash identifier and performing a comparison is as follows: The traceability management platform re-executes binary data stream reading operations on each process quality inspection file in the traceability file chain using a stream processor, and extracts the current fingerprint digest using a secure hash algorithm that is completely consistent with the one used when the file was added to the database and uploaded to the blockchain. A content consistency verification model is constructed, and the calculation formula is: ; In the formula, Indicates the first The consistency verification result of the content of the quality inspection documents for each process is 1, which indicates that the data is complete and 0 indicates that the data is abnormal. This represents the hash identifier of the process quality inspection document content, which has been recalculated locally. This represents the original hash value recorded in the batch on-chain index obtained from the blockchain ledger. This comparison model, by performing a two-layer alignment between the file fingerprints in distributed storage and the evidence fingerprints on the blockchain, can accurately identify whether data has been maliciously tampered with during heterogeneous transmission.
[0053] In one implementation of this embodiment, the logic for determining whether the traceability link integrity verification has passed and outputting the result is as follows: By traversing the verification results of all nodes in the traceability file link, it is determined whether the full consistency requirement is met. A link integrity evaluation model is constructed, and the calculation formula is: ; In the formula, Indicates the completeness of the traceability chain; This indicates the total number of quality inspection documents related to the processes involved in this batch of cream raw materials; Indicates the first in the link The consistency verification results of the content of the quality inspection documents for each process are used. If the calculated link integrity value is equal to 1, the traceability link is determined to have extremely high authenticity and integrity. The traceability management platform automatically converts the traceability document link into a visual chart and outputs it to the terminal device as the target traceability result.
[0054] In one embodiment, the specific operation for generating a traceability link anomaly report is as follows: if the link integrity value is found to be less than 1 during the comparison process, that is, if the content hash identifier of any process quality inspection document does not match the record on the chain, or if the file is physically missing due to the storage node's lack of response, then the node is immediately marked as an anomaly node; the traceability management platform then traces the process association group identifier, the name of the affiliated institution, and the physical Internet Protocol address of the main storage node corresponding to the anomaly node from the batch traceability index tree; finally, the detected hash conflict information, data missing location, and associated responsible entity information are encapsulated to generate a traceability link anomaly report containing an electronic timestamp. Through this anomaly monitoring mechanism, traceability failure caused by individual entities maliciously concealing data or tampering with local records can be effectively prevented, ensuring the rigor of traceability for the quality and safety of highly sensitive cream raw materials.
[0055] Preferably, before constructing a batch traceability index tree based on the document location record and the batch process association map, and before calling the blockchain smart contract to store the batch traceability index tree on the blockchain, the process further includes: The blockchain smart contract extracts the quality inspection timestamps corresponding to the process association group identifiers in the batch traceability index tree; Determine whether the quality inspection timestamp meets the preset monotonically increasing time sequence constraint rule. If there is a time sequence reversal, reject the current on-chain anchoring request and return feedback information carrying the time sequence anomaly pair identifier to the traceability management platform that initiated the request, so as to trigger the traceability management platform to reorder the process quality inspection documents and resubmit the on-chain evidence storage application. If the preset time-series monotonically increasing constraint rule is met, the blockchain smart contract will perform the on-chain write operation to generate a batch of on-chain indexes.
[0056] In one embodiment, the specific operation of the blockchain smart contract to extract the quality inspection timestamp is as follows: When a blockchain node receives an on-chain anchoring request initiated by the traceability management platform, it automatically triggers a pre-deployed blockchain smart contract. The smart contract performs a traversal and parsing of the batch traceability index tree in the request message, and sequentially extracts the key metadata fields corresponding to the process-related group identifiers of each intermediate layer. By accurately locating the time attribute tags in the metadata, the contract obtains the quality inspection timestamp data recorded when the quality inspection operation of each process node in that group occurs, and extracts it into the contract's temporary cache sequence according to the logical hierarchy of the process flow, providing the original basis for subsequent logical consistency verification.
[0057] In one implementation of this embodiment, the process of determining whether the quality inspection timestamp satisfies the preset monotonically increasing temporal constraint rule is as follows: The smart contract constructs a temporal logic compliance judgment model, the core logic of which lies in verifying the irreversibility of the biochemical evolution of cream raw materials and the processing flow on the physical timeline. The temporal compliance judgment model is constructed using the following formula: ; In the formula, This indicates the result of the timing compliance verification. This indicates the total number of intermediate level nodes in the batch traceability index tree; This indicates the order according to the process logic. The quality inspection timestamp value corresponding to each process-related group; Indicates the number immediately following it. The quality inspection timestamp value corresponding to each process-related group; This is a sign discrimination function; it takes a value of 1 when the independent variable is greater than 0, and a value of 0 otherwise. If the calculated verification result... If the value is 1, then it is determined that all process data of this batch of cream raw materials satisfy the temporal monotonically increasing constraint rule and there is no logical conflict.
[0058] In one implementation of this embodiment, the logic for handling time-series reversal and triggering feedback is as follows: If the result output by the discrimination model is 0, meaning that the timestamp of a subsequent process group is earlier than or equal to the timestamp of a preceding process group, the smart contract determines that the batch of data has a time-series reversal anomaly. At this time, the smart contract immediately rejects the current on-chain anchoring request and encapsulates the group identifiers of the two adjacent processes with the detected timestamp conflict into an anomaly pair information, which is returned to the traceability management platform through the blockchain system feedback interface. After receiving the feedback, the traceability management platform automatically starts the data traceability self-inspection program, re-sorts the logical order and performs physical time verification on the quality inspection documents involved in the anomaly pair until the time-series logic is met, and then initiates the on-chain application again.
[0059] In one embodiment, the specific operation of the blockchain smart contract to perform the on-chain write operation and generate the batch on-chain index is as follows: after the time sequence compliance verification is passed, the blockchain smart contract automatically calls the consensus module to write the batch identifier data, the complete topology of the batch traceability index tree and the corresponding index root hash value into the latest block of the blockchain ledger. By assigning a globally unique transaction hash value to the transaction and establishing an association mapping between the transaction hash and the batch identifier in the ledger, the batch on-chain index is generated.
[0060] Preferably, if any inconsistency or missing content hash identifier exists in any of the process quality inspection documents, the corresponding process quality inspection document is marked as an abnormal node. After generating a traceability link anomaly report, the process further includes: When the traceability link anomaly report is due to the main storage node in the distributed storage network being unresponsive, resulting in the missing process quality inspection documents, it is determined that the main storage node is disconnected. Read the address of the replica storage node corresponding to the missing process quality inspection file from the file location record of the batch chain index, and send a retry pull request to the replica storage node address to repair the missing node; If all replica storage node addresses fail to be retrieved, the process node name, batch identifier data, and content hash identifier corresponding to the missing process quality inspection file will be recorded in the traceability link anomaly report, and a traceability alarm will be output to the terminal device.
[0061] In one embodiment, when the traceability management platform performs the task of retrieving process quality inspection documents based on the batch on-chain index, it sends a synchronization handshake signal to the physical Internet Protocol address of the main storage node recorded in the file location record through the network probing protocol; it also starts a preset timeout monitoring timer, the threshold of which is set to 3 seconds (this value is determined based on the average round-trip latency of the distributed network in a local area network environment and after reserving 2 times redundancy); if no response signal is received from the physical address after the timeout period ends, or if an error code indicating that the node is unreachable is returned, it is determined that the main storage node is in a disconnected state, and the corresponding process quality inspection documents cannot be obtained normally due to the interruption of the physical link.
[0062] In one implementation of this embodiment, the logic for reading the replica storage node address from the file location record and performing a retry fetch is as follows: The traceability management platform accesses the loaded batch traceability index tree, locates the leaf node to which the missing file belongs, and extracts the pre-bound replica storage node address set from its metadata field. According to the priority sequence of the backup addresses, it sequentially initiates targeted data completion requests to each replica node. A self-healing repair model for missing nodes is constructed, and the calculation logic is as follows: ; In the formula, This indicates the self-healing repair result of the missing node. A value of 1 indicates successful repair, and a value of 0 indicates failure. Represents the logical OR operator; This indicates the total number of replica storage nodes corresponding to the file (e.g., the default number is 3). Indicates the first The availability discrimination value of each replica storage node is set to 1 if the replica node successfully returns a data block that matches the content hash identifier, and 0 otherwise. Through this model, as long as there is at least one live replica node in the distributed storage network, the data loss in the traceability link can be automatically repaired.
[0063] In one implementation of this embodiment, the specific process for recording missing information and outputting a source tracing alarm is as follows: if the calculation result of the missing node self-healing repair model... A value of 0 indicates that neither the primary storage node nor any replica storage nodes can provide valid quality inspection document data, suggesting a physical loss of quality inspection evidence for that process node. In this case, the traceability management platform automatically extracts the process node name associated with the missing node in the batch traceability index tree, the batch identifier data of the batch of cream raw materials, and the content hash identifier of the original record. This key information is written into the deep analysis field of the traceability chain anomaly report, triggering the voice or pop-up alarm module of the terminal device to output a traceability alarm message containing a "logical break in the evidence chain" prompt to the supervisory personnel. Through this multi-replica completion and failure notification mechanism, the continuity of traceability for highly sensitive cream raw materials can be guaranteed to the greatest extent, and timely warnings can be issued in the event of extreme data loss, avoiding quality and safety risks caused by information asymmetry.
[0064] The cream raw material detection and traceability method based on distributed storage provided in this application relates to the field of food safety traceability and data storage technology. This method is executed by a traceability management platform, which can be deployed on terminal devices or servers, or implemented as a software module running on a terminal or server. In some embodiments, the terminal device can be a smartphone, tablet, laptop, desktop computer, portable testing instrument, or barcode scanner used by quality inspectors. The server can be configured as an independent physical server, a server cluster composed of multiple physical servers, or a distributed system. It can also be configured as a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. The aforementioned traceability management platform can be deployed on such a cloud server, and the distributed storage node server or blockchain node server can also adopt the form of a cloud server. The software can be an application implementing the cream raw material detection and traceability method, but is not limited to the above forms.
[0065] It should be noted that in the various specific embodiments of this application, when processing data related to the identity or characteristics of cross-institutional entities, such as commercial quality inspection data from ranches, cold chain logistics, third-party inspection agencies, and dairy companies, processing node parameters, and the identity and behavior of quality inspection personnel, permission from each participating party or a data sharing agreement will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards concerning food safety and data security. In addition, when embodiments of this application require obtaining sensitive core quality inspection information from various stakeholders, individual permission or consent from the relevant stakeholders will be obtained through pop-ups or redirects to confirmation pages. Only after obtaining clear individual permission or consent will the necessary cross-institutional data required for the proper functioning of the embodiments of this application be acquired.
[0066] Please see Figure 3 The diagram shown illustrates the network architecture for traceability testing of cream raw materials provided in this application embodiment. This architecture uses a traceability management platform as its core execution entity. The traceability management platform is connected to a distributed storage network and a blockchain system. The distributed storage network and blockchain system are distributed systems formed by multiple data nodes (any form of computer device connected to the network, such as servers providing storage resources, blockchain node servers providing consensus computation, etc.) connected through network communication. A peer-to-peer (P2P) network is formed between the data nodes, and the P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In the distributed storage network and blockchain system, any machine that meets the access rules, such as servers or terminals, can join and become a data node. The traceability management platform communicates with the storage nodes of the distributed storage network and the consensus nodes of the blockchain system. It should be noted that routing is used to achieve information transmission between the traceability management platform and multiple data nodes, as well as between the data nodes themselves.
[0067] Therefore, the embodiments should be considered as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of the equivalents of the application are intended to be included within the invention.
[0068] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.
Claims
1. A method for detecting and tracing the source of cream raw materials based on distributed storage, characterized in that, The cream raw material detection and traceability method based on distributed storage is executed by a traceability management platform. The platform is communicatively connected to a distributed storage network and a blockchain system. The blockchain system deploys blockchain smart contracts and maintains a blockchain ledger. The cream raw material detection and traceability method based on distributed storage includes the following steps: Step S1: Obtain batch identification data of the cream raw materials; determine the corresponding cream processing technology based on the batch identification data; obtain process quality inspection documents and cream quality inspection status data at each process node of the cream processing technology. Step S2: Calculate the process coupling strength coefficient between two adjacent process nodes based on the cream quality inspection status data; group the quality inspection documents of each process according to the process coupling strength coefficient to obtain the batch process association map; Step S3: Obtain the file location records of each process quality inspection document in the distributed storage network; construct a batch traceability index tree based on the file location records and the batch process association map, and call the blockchain smart contract to put the batch traceability index tree on the chain for evidence storage, generating a batch on-chain index; Step S4: The traceability management platform responds to the input target traceability request, retrieves the corresponding batch on-chain index from the blockchain ledger based on the target batch identifier of the target traceability request, and pulls the process quality inspection file from the distributed storage network based on the batch on-chain index to output the target traceability result.
2. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 1, characterized in that, Obtain process quality inspection documents and corresponding cream quality inspection status data at each step of the cream processing flow, including: When the local data acquisition unit of each process node performs a quality inspection operation, it simultaneously collects the process quality inspection document, quality inspection timestamp, pH value sampling data of cream, and target microbial count data corresponding to the current batch. Using batch identifier data as the primary key, the quality inspection timestamps reported by each process node are sorted in ascending order of time sequence to obtain the process time sequence table; The pH value sampling data and target microbial count data of the cream corresponding to each process node in the process time sequence table are spliced together in time sequence to generate cream quality inspection status data.
3. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 2, characterized in that, Calculate the process coupling strength coefficient between two adjacent process nodes based on the cream quality inspection status data, including: Extract the pH value difference between two adjacent process nodes in the cream quality inspection status data, and calculate the time interval between the nodes based on the quality inspection timestamps corresponding to the two process nodes respectively; The pH decay intensity per unit time is calculated by the ratio of the pH difference to the time interval. Extract the target microbial count data corresponding to each of two adjacent process nodes, and use the target microbial count data of the process node with the earlier time series as the baseline value to calculate the target microbial proliferation rate of the process node with the later time series. The target bacterial community's proliferation rate is compared with the preset standard value of the proliferation time window to obtain the target bacterial community's time window deviation coefficient. The process coupling strength coefficient between two adjacent process nodes is generated by weighted summation of pH decay intensity and target bacterial community time window deviation coefficient.
4. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 1, characterized in that, By grouping the quality inspection documents of each process step according to the process coupling strength coefficient, a batch process correlation map is obtained, including: The process coupling strength coefficient between each pair of adjacent process nodes is compared with a preset strong coupling threshold. Pairs of adjacent process nodes with a process coupling strength coefficient greater than or equal to the preset strong coupling threshold are marked as strongly associated pairs, and pairs of adjacent process nodes with a process coupling strength coefficient less than the preset strong coupling threshold are marked as weakly associated pairs. Based on the time sequence of the cream processing process, all adjacent process node pairs are traversed. Process nodes that are continuously marked as strongly associated pairs are grouped into the same process association group. The average process coupling strength coefficient of all strongly associated pairs in the group is calculated as the group coupling strength coefficient of the group. For two adjacent process nodes marked as a weakly associated pair, the two process nodes in the weakly associated pair are respectively assigned to two adjacent process association groups; A unique process association group identifier is assigned to each process association group, and the process association group identifier and the corresponding group coupling strength coefficient are bound to the process quality inspection documents corresponding to all process nodes within the process association group. The process association groups are connected in chronological order according to the cream processing process to generate a batch process association map.
5. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 1, characterized in that, Obtain the file location records of each process's quality inspection documents in the distributed storage network, including: Content addressing encoding is performed on the process quality inspection documents corresponding to each process association group in the batch process association map to generate content hash identifiers for each process quality inspection document; Process quality inspection files within the same process-related group are preferentially scheduled to the physical adjacent primary storage nodes and their replica storage node clusters in the distributed storage network. They are written using the content hash identifier as the address key, and the physical node address of the primary storage node and the replica storage node address of each process quality inspection file are recorded. The content hash identifier, physical node address, and copy storage node address of each process quality inspection document are bound to the corresponding process association group identifier in the batch process association map to obtain the document location record.
6. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 1, characterized in that, Step S3 involves constructing a batch traceability index tree based on the file location record and the batch process association map, and then calling a blockchain smart contract to store the batch traceability index tree on the blockchain, generating a batch on-chain index. This includes the following steps: Step S31: Using batch identifier data as the root node, process association group identifiers in the batch process association graph as intermediate layer nodes, and file location records as leaf nodes, attach the group coupling strength coefficients corresponding to each process association group identifier to the corresponding intermediate layer nodes to construct a batch traceability index tree. Step S32: Perform a hash operation on the batch traceability index tree to obtain the batch index root hash value; Step S33: Encapsulate the node relationship data of the batch traceability index tree and the hash value of the batch index root into an on-chain anchoring request, submit it to the blockchain smart contract for on-chain storage, and the blockchain ledger records the mapping relationship between the batch identifier data and the batch traceability index tree in the current block to generate the batch on-chain index.
7. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 1, characterized in that, Before retrieving the corresponding batch on-chain index from the blockchain ledger based on the target batch identifier of the target traceability request, and before pulling the process quality inspection documents from the distributed storage network based on the batch on-chain index, the process also includes: Based on the target batch identifier of the target traceability request, the corresponding batch traceability index tree is obtained from the blockchain ledger, and the process association group identifier and additional group coupling strength coefficient corresponding to each intermediate layer node in the batch traceability index tree are extracted. Any two adjacent process association groups in the batch process association diagram are defined as the first process association group and the second process association group, respectively; wherein, the time sequence of the second process association group is after the first process association group; Using the group coupling strength coefficient of the first process-related group as the weight, the prefetch triggering timing threshold of the second process-related group is calculated; wherein, the higher the group coupling strength coefficient, the lower the prefetch triggering timing threshold. The retrieval progress of the first process-related group is monitored in real time. When the real-time retrieval completion progress of the first process-related group reaches the corresponding prefetch triggering threshold, the file location record corresponding to the second process-related group is read from the leaf node of the batch traceability index tree, and a targeted batch retrieval request is initiated to the main storage node cluster corresponding to the second process-related group based on the file location record. The retrieved process quality inspection files are written to the local retrieval buffer to obtain the target traceability retrieval data.
8. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 7, characterized in that, Based on the target batch identifier in the target traceability request, the corresponding batch on-chain index is retrieved from the blockchain ledger, and the process quality inspection documents are pulled from the distributed storage network according to the batch on-chain index, including: The process quality inspection documents in the target traceability data are systematically spliced together to form a traceability document link; Recalculate the content hash identifier for each process quality inspection document in the traceability file chain, and compare it one by one with the content hash identifier recorded in the file location record in the batch chain index; If the hash identifiers of the contents of all process quality inspection documents are consistent with those recorded on the batch chain index, then the traceability link integrity verification is deemed to have passed, and the traceability document link is output as the target traceability result. If the content hash identifier of any process quality inspection document is inconsistent with that recorded in the batch chain index, or if the process quality inspection document is missing, the process quality inspection document will be marked as an abnormal node, and a traceability link abnormal report will be generated.
9. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 1, characterized in that, Before constructing a batch traceability index tree based on document location records and batch process association maps, and before calling a blockchain smart contract to store the batch traceability index tree on the blockchain, the following steps are also included: The blockchain smart contract extracts the quality inspection timestamps corresponding to the process association group identifiers in the batch traceability index tree; Determine whether the quality inspection timestamp meets the preset monotonically increasing time sequence constraint rule. If there is a time sequence reversal, reject the current on-chain anchoring request and return feedback information carrying the time sequence anomaly pair identifier to the traceability management platform that initiated the request, so as to trigger the traceability management platform to reorder the process quality inspection documents and resubmit the on-chain evidence storage application. If the preset time-series monotonically increasing constraint rule is met, the blockchain smart contract will perform the on-chain write operation to generate a batch of on-chain indexes.
10. The method for detecting and tracing the source of cream raw materials based on distributed storage according to claim 8, characterized in that, If any inconsistency or missing content hash identifier exists in any of the quality inspection documents for all processes, the corresponding quality inspection document will be marked as an abnormal node. After generating a traceability link anomaly report, the report will also include: When the traceability link anomaly report is due to the main storage node in the distributed storage network being unresponsive, resulting in the missing process quality inspection documents, it is determined that the main storage node is disconnected. Read the address of the replica storage node corresponding to the missing process quality inspection file from the file location record of the batch chain index, and send a retry pull request to the replica storage node address to repair the missing node; If all replica storage node addresses fail to be retrieved, the process node name, batch identifier data, and content hash identifier corresponding to the missing process quality inspection file will be recorded in the traceability link anomaly report, and a traceability alarm will be output to the terminal device.