Dairy product tracing method based on block chain

By using a blockchain-based dairy product traceability method, which utilizes data blocks, a spatiotemporally coupled self-organizing model, and a grey relational algorithm to dynamically generate traceability links, the adaptability and reliability issues of existing dairy product traceability methods are resolved, achieving efficient and reliable dairy product traceability.

CN120851902AActive Publication Date: 2025-10-28ANHUI SCI & TECH UNIV

Patent Information

Application Number
CN202510947967.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-10-28
Estimated Expiration
2045-07-10

AI Technical Summary

Technical Problem

Existing dairy product traceability methods are difficult to adapt to the differentiated needs of different industry players, lack personalized and precise traceability capabilities, and lack objective evaluation of the traceability chain, resulting in a high misjudgment rate and insufficient credibility.

Method used

By adopting a blockchain-based approach, data from the dairy production process is collected and divided into data blocks. Combined with a spatiotemporal coupled self-organizing model and a grey relational algorithm, traceability links are dynamically generated, and applicability assessments and optimizations are performed. Multi-level visual traceability displays are supported.

Benefits of technology

It achieves the integrity, traceability, and tamper-proof nature of dairy product traceability data, improves the credibility of the traceability process and the stability of the link construction, supports personalized responses and various traceability needs, meets the visualization needs of different users, and enhances public trust.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120851902A_ABST
    Figure CN120851902A_ABST
Patent Text Reader

Abstract

The invention discloses a dairy product traceability method based on a block chain, and relates to the field of dairy products, the dairy product traceability method based on the block chain comprises the following steps: S1, collecting dairy product production flow data, and dividing the data into a plurality of dairy product data blocks for storage; s2, obtaining traceability characteristic parameters, presetting a weight database to carry out weight distribution, and carrying out matching based on a weight distribution result; s3, presetting a dynamic traceability link generation mechanism according to the space-time coupling self-organizing model, and generating a dairy product traceability link; s4, presetting an adaptability threshold rule base, and performing adaptability evaluation; s5, optimizing and adjusting the dairy product traceability link, and updating the adaptability threshold rule; and S6, tracing the dairy product, and generating a multi-level visual tracing result. According to the invention, the dairy product production process data is packaged into the data blocks and stored in the block chain database, so that the integrity, traceability and tamper-proofing performance of the traceability data are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of dairy products, and more particularly, to a blockchain-based method for tracing the origin of dairy products. Background Technology

[0002] Dairy products are processed foods made from the milk secreted by dairy animals and are widely used in the food industry. Common dairy products include milk, cheese, butter, yogurt, and milk powder. Dairy products are typically rich in protein, fat, lactose, vitamins, and minerals, and are an important part of many diets. Their main nutrients make significant contributions to human health, especially supporting bone health. Dairy products are an essential part of people's daily diet, and with active government promotion and increasing public awareness of milk consumption, per capita dairy consumption is expected to continue to rise, indicating a broad market prospect. However, as the dairy product supply chain becomes increasingly complex, existing methods for tracing the origin of dairy products are becoming less and less ideal.

[0003] Existing dairy product traceability methods often rely on fixed templates or manually generated rules to create traceability chains, making it difficult to adapt to the diverse needs of different industry players. They cannot dynamically adjust the chain generation strategy based on user roles, business tasks, or actual process differences, resulting in insufficient personalized and precise traceability capabilities. Furthermore, they lack a mechanism for objectively evaluating the applicability of traceability chains, making it difficult to distinguish between high-reliability chains and low-quality paths. The absence of a chain evaluation, ranking, and optimization system based on data indicators and business rules leads to high false positive rates and insufficient reliability. Currently, no effective solutions have been proposed to address these technical issues. Summary of the Invention

[0004] The purpose of this invention is to provide a blockchain-based method for tracing dairy products, thereby overcoming the aforementioned technical problems existing in related technologies.

[0005] To achieve the above objectives, the specific technical solution adopted by the present invention is as follows:

[0006] A blockchain-based method for tracing dairy products is provided, comprising the following steps:

[0007] S1. Collect dairy product production process data, divide the dairy product production process data into several dairy product data blocks, and store them in a blockchain database;

[0008] S2. Analyze the traceability requirements of dairy products, obtain traceability feature parameters, preset a weight database, assign weights to traceability feature parameters and dairy product data blocks, and perform matching based on the weight assignment results;

[0009] S3. Based on the spatiotemporal coupling self-organizing model, a dynamic traceability link generation mechanism is preset, and a dairy product traceability link is generated based on the matching results;

[0010] S4. Preset an applicability threshold rule base, and use the applicability threshold rules in the applicability threshold rule base combined with the grey relational algorithm to evaluate the applicability of the dairy product traceability link;

[0011] S5. Optimize and adjust the dairy product traceability chain based on the applicability assessment results, and update the applicability threshold rules;

[0012] S6. Based on the optimized dairy product traceability link, trace dairy products and generate multi-level visualized traceability results according to user permission levels.

[0013] As a preferred solution, the process involves analyzing the traceability requirements of dairy products, obtaining traceability feature parameters, pre-setting a weighted database, assigning weights to the traceability feature parameters and dairy product data blocks, and matching based on the weight assignment results, including the following steps:

[0014] S21. Clean the traceability information of dairy products and clarify the traceability requirements.

[0015] S22. Based on the traceability requirements, set the rules for extracting traceability feature parameters, and extract traceability feature parameters from the traceability information of dairy products according to the rules;

[0016] S23. Preset the weight database and set the mapping relationship between the traceability feature parameters and the weights;

[0017] S24. Map the weight values ​​in the weight database to the traceability feature parameters and dairy product data blocks according to the weight mapping relationship;

[0018] S25. Calculate the feature weight score and block weight score of the mapped traceability feature parameters and dairy product data blocks, and match the mapped traceability feature parameters and dairy product data blocks based on the score similarity.

[0019] As a preferred approach, the process of calculating the mapped traceability feature parameters and the feature weight score and block weight score of the dairy product data blocks, and matching the mapped traceability feature parameters and dairy product data blocks based on score similarity includes the following steps:

[0020] S251. Calculate the feature weight score of the source feature parameter based on the mapping weight value, and perform normalization processing.

[0021] S252. Obtain the traceability feature parameter set in the dairy product data block, and calculate the block weight score of the dairy product data block based on the standardized weight score of each feature parameter in the traceability feature parameter set.

[0022] S253. Construct feature weight score vectors and block weight score vectors based on feature weight scores and block weight scores;

[0023] S254. The cosine similarity algorithm is used to calculate the score similarity between the feature weight score vector and the block weight score vector.

[0024] S255. A preset score similarity judgment threshold is set. When the score similarity is greater than or equal to the similarity judgment threshold, the traceability feature parameters and the dairy product data block are determined to be a matching relationship. When the score similarity is less than the similarity judgment threshold, it is considered a mismatch, and feedback optimization is performed.

[0025] As a preferred approach, a dynamic traceability link generation mechanism is pre-set based on the spatiotemporal coupling self-organizing model, and the generation of dairy product traceability links based on the matching results includes the following steps:

[0026] S31. Construct a spatiotemporally coupled self-organizing model based on the time and spatial parameters in the dairy product data block;

[0027] S32. Based on the score similarity matching results, select the successfully matched traceability feature parameters and dairy product data blocks, and construct a traceability node set;

[0028] S33. Based on the spatiotemporal coupled self-organizing model, a dynamic traceability link generation mechanism is set up, and a dairy product traceability link is generated based on the dynamic traceability link generation mechanism.

[0029] S34. Verify the structural consistency between the traceability node set and the dairy product traceability link, and perform self-organizing optimization on the dairy product traceability link based on the verification results.

[0030] S35. Output the optimized dairy product traceability link.

[0031] As a preferred approach, constructing a spatiotemporally coupled self-organizing model based on the temporal and spatial parameters in the dairy product data block includes the following steps:

[0032] S311. Extract the block time parameters and block space parameters from the dairy product data block, and clean the extracted data;

[0033] S312. Construct a spatiotemporal feature matrix based on the cleaned block time parameters and block spatial parameters;

[0034] S313. Establish a coupling relationship diagram based on the temporal order and spatial proximity of block time parameters and block spatial parameters;

[0035] S314. Merge the spatiotemporal feature matrix and the coupling relationship diagram, and set self-organizing rules to obtain a spatiotemporal coupled self-organizing model.

[0036] S315. Verify and optimize the spatiotemporal coupling self-organizing model, and output the verified and optimized spatiotemporal coupling self-organizing model.

[0037] As a preferred approach, based on the scoring similarity matching results, successfully matched traceability feature parameters and dairy product data blocks are selected, and a traceability node set is constructed, including the following steps:

[0038] S321. Obtain the rating similarity matching results and set the rating threshold for successful matching;

[0039] S322. Based on the scoring threshold, select the successfully matched traceability feature parameters and dairy product data blocks;

[0040] S323. Based on the successfully matched traceability feature parameters and dairy product data blocks, extract node time parameters, node spatial parameters and node association attribute information, and construct a traceability node set.

[0041] S324. Perform deduplication and structural integrity checks on the source node set, and output the deduplication-checked source node set.

[0042] As a preferred approach, a dynamic traceability link generation mechanism is set up based on the constructed spatiotemporal coupled self-organizing model, and the generation of dairy product traceability links based on the dynamic traceability link generation mechanism includes the following steps:

[0043] S331. Based on the spatiotemporal coupling self-organizing model and the process chain data in the dairy product data block, a dynamic traceability link generation mechanism is set up.

[0044] S332. Based on the process chain data, identify the source node and target node for traceability;

[0045] S333. Generate an initial link path by using a dynamic tracing link generation mechanism to trace the source node and the target node.

[0046] S334. Perform reachability verification and optimization on the initial link path, and use the optimized initial link path as the dairy product traceability link output.

[0047] As a preferred approach, a pre-defined applicability threshold rule base is established, and the applicability of the dairy product traceability chain is evaluated using the applicability threshold rules in the applicability threshold rule base combined with the grey relational algorithm, including the following steps:

[0048] S41. Based on the traceability requirements of dairy products, construct an applicability threshold rule base and set a rule matching strategy;

[0049] S42. Based on the rule matching strategy, the applicability threshold rules in the applicability threshold rule base are matched with the dairy product data blocks to obtain the applicability threshold rule set;

[0050] S43. Extract the link feature index vector from the dairy product traceability link, and use the link feature index vector into the grey relational algorithm to evaluate the applicability of the dairy product traceability link.

[0051] S44. Compare the applicability threshold rule set with the applicability of the dairy product chain to obtain the applicability evaluation result.

[0052] As a preferred approach, the applicability threshold rules in the applicability threshold rule base are matched with the dairy product data blocks based on a rule matching strategy to obtain the applicability threshold rule set, including the following steps:

[0053] S421. Parse the block attribute parameters of the dairy product data block and clean the block attribute parameters;

[0054] S422. Based on the rule-based matching strategy, match the cleaned block attribute parameters with the applicability threshold rules in the applicability threshold rule base;

[0055] S423. Summarize and conclude the several matched applicability threshold rules to obtain the applicability threshold rule set;

[0056] S424. Validate and optimize the applicability threshold rule set, and output the validated and optimized applicability threshold rule set.

[0057] As a preferred approach, extracting the link feature index vector from the dairy product traceability chain and then using the link feature index vector in a grey relational algorithm to evaluate the suitability of the dairy product traceability chain includes the following steps:

[0058] S431. Extract node information and path information from the dairy product traceability chain, and construct a chain feature index vector based on the node information and path information;

[0059] S432. Generate a reference link indicator vector for applicability comparison based on historical applicability links;

[0060] S433. Using the grey relational algorithm, calculate the correlation between the link feature index vector and the reference link index vector to obtain the link applicability score of the dairy product traceability link.

[0061] S434. Verify and optimize the link suitability score, and output the verified and optimized link suitability score as the basis for subsequent link suitability judgment.

[0062] The beneficial effects of this invention are as follows:

[0063] 1. This invention encapsulates dairy product production process data into data blocks and stores them in a blockchain database, ensuring the integrity, traceability, and tamper-proof nature of traceability data. This enhances the data credibility foundation in the dairy product traceability process and improves the authority of dairy product quality and safety supervision. Furthermore, by setting a weighted mapping relationship between traceability feature parameters and dairy product data blocks, and combining this with a cosine similarity algorithm for scoring and matching, the feature adaptation accuracy of traceability nodes is improved. This enables customized link construction logic, supporting personalized responses to various traceability needs. Moreover, based on the time and space parameters of dairy product data, a spatiotemporally coupled self-organizing model is constructed. Leveraging the model's self-organizing and scalable capabilities, it can dynamically generate structurally sound and optimally pathed traceability links in complex node networks, improving the stability, scalability, and timeliness of link construction.

[0064] 2. This invention uses a pre-defined applicability threshold rule base and a grey relational algorithm to comprehensively evaluate the generated traceability links using multiple indicators, achieving a quantitative evaluation of the link quality. It can also optimize the rule model through comparative analysis, thereby supporting high-quality iteration and self-learning optimization of the traceability links. Furthermore, it generates multi-level visual traceability display schemes based on user permission levels, meeting the visualization needs of different users such as regulatory agencies, consumers, and enterprises, achieving transparent display of traceability information, hierarchical authorization, and ease of use and readability, thereby enhancing public trust. Attached Figure Description

[0065] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0066] Figure 1 This is a method for tracing dairy products based on blockchain according to an embodiment of the present invention. Detailed Implementation

[0067] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.

[0068] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0069] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments, such as... Figure 1 As shown, the method for tracing dairy products based on blockchain according to an embodiment of the present invention includes the following steps:

[0070] S1. Collect dairy product production process data, divide the dairy product production process data into several dairy product data blocks, and store them in a blockchain database;

[0071] Specifically, the dairy production process data includes process and environmental data from multiple stages such as raw material receiving, processing, quality inspection, packaging, warehousing, and cold chain transportation. Data is collected through PLC control modules, MES systems, barcode scanners, quality inspection instruments, and smart sensors deployed on the production site. This data includes information such as raw material batch number, sterilization temperature, stirring rate, fermentation time, pH value, packaging serial number, ambient temperature and humidity, and GPS positioning. Each data acquisition device is connected to an edge gateway via an industrial Ethernet network and uploads data synchronously. All collected data is timestamped and identified by the device to build a complete traceability data structure.

[0072] Data can be divided according to production batch number, process stage node, or time period. Each data block includes a block header and a block body. The block header contains the block ID, generation timestamp, previous block hash, signature information, etc., while the block body contains the collected data set, data digest (e.g., Merkle tree root), data check code, etc. All data fields are standardized to ensure uniform data format. At the same time, to ensure data integrity and traceability, the data body is digitally signed.

[0073] A blockchain platform based on a consortium blockchain architecture is adopted. Block hashes, signature digests, index information, etc. are written into the ledger through chaincode (smart contracts) to achieve on-chain data storage. For block content with large data volume, a combination of on-chain and off-chain methods can be adopted. The main data is encrypted and stored off-chain, and then bound to the on-chain metadata through hash reference. On-chain transactions are confirmed by the blockchain consensus mechanism to ensure the immutability and distributed consistency of traceability data throughout its entire life cycle.

[0074] S2. Analyze the traceability requirements of dairy products, obtain traceability feature parameters, preset a weight database, assign weights to traceability feature parameters and dairy product data blocks, and perform matching based on the weight assignment results;

[0075] Specifically, the process of analyzing dairy product traceability requirements, obtaining traceability feature parameters, pre-setting a weight database, assigning weights to traceability feature parameters and dairy product data blocks, and matching based on the weight assignment results includes the following steps:

[0076] S21. Clean the traceability information of dairy products and clarify the traceability requirements.

[0077] Specifically, the collected raw data undergoes denoising, deduplication, field standardization, outlier handling, and missing value completion. First, redundant records, inconsistent timestamp formats, and inconsistently encoded device numbers in the raw data are cleaned and standardized to a standard format. Second, a rule-based outlier identification method is used to detect whether indicators such as temperature and pH value exceed the rated operating range of the equipment, and abrupt change points are identified using a time sliding window method. For missing parameters, linear interpolation and Lagrange interpolation methods are used to complete the data, ensuring the integrity and continuity of traceability information. At the same time, a field mapping dictionary is introduced to perform structured and standardized transformation on unstructured or semi-structured data.

[0078] After data cleaning, traceability requirements are clarified through user input, task scenario classification, and industry standard models. Based on user roles (such as consumers, regulatory agencies, and manufacturers) and application scenarios (such as quality accountability, anomaly investigation, and supply chain monitoring), the types of traceability targets that users are interested in can be analyzed. The traceability requests input by users are extracted through natural language parsing or parameterized configuration and transformed into structured requirement forms. The forms include requirement type, time range, traceability granularity, target attribute fields, etc. Historical traceability task records and typical industry traceability scenario templates can be referenced to perform requirement clustering and identification, assisting users in quickly modeling traceability targets.

[0079] S22. Based on the traceability requirements, set the rules for extracting traceability feature parameters, and extract traceability feature parameters from the traceability information of dairy products according to the rules;

[0080] Specifically, the system parses the traceability requirement information input by the user, identifies the traceability scenario type to which it belongs, such as product accountability, anomaly detection, flow monitoring, environmental compliance, etc., and then calls the corresponding parameter template from the preset feature parameter rule library according to different traceability scenarios. The template contains information such as field name, field alias, source module, whether it is required, field data type, and matching rules. At the same time, it refers to the keywords or target field prompts in the user input, performs secondary filtering and adjustment on the template parameters, generates the traceability feature parameter extraction rule set corresponding to the current task, and establishes a parameter data source mapping relationship table.

[0081] Based on the established rules for extracting traceability feature parameters, field filtering, matching, and formatting are performed on dairy product traceability information to extract task-related feature parameters. First, fields from different sources are uniformly mapped using a field alias table to ensure that fields such as sterilization temperature belong to the same feature dimension. Second, the extracted fields undergo type standardization conversion, including unified timestamp format, unit conversion, and numerical precision control. Third, missing fields are filtered based on the required fields identified by the rules. Missing but required fields trigger an alert or completion mechanism, which uses methods such as historical averages, upstream and downstream interpolation, and logical deduction to complete the data. Finally, a structured feature parameter set is formed, including field name, value, unit, source, and credibility score, providing input for subsequent traceability link generation.

[0082] S23. Preset the weight database and set the mapping relationship between the traceability feature parameters and the weights;

[0083] Specifically, setting up a pre-defined weight database and configuring the mapping relationship between traceability feature parameters and weights includes: First, based on the traceability requirements and target scenario, a pre-defined weight database needs to be established. This database consists of multiple weight dimensions, each corresponding to different traceability feature parameters. The weight dimensions are set based on factors such as the importance, relevance, and credibility of the traceability data, combined with expert experience or industry standards, assigning different weight values. An initial weight is assigned to each traceability feature parameter, with a weight value ranging from 0 to 1, representing the degree of influence of that feature on the final traceability result.

[0084] Next, traceability feature parameters will be associated with their corresponding weight values ​​through mapping rules. First, based on different traceability scenarios and target requirements, relevant traceability feature parameters (such as production temperature, batch number, and outbound time) are selected. For each selected feature parameter, the corresponding weight value is retrieved from a pre-defined weight database, and this weight is mapped one-to-one or many-to-one to the feature parameter. Each feature parameter will be mapped to one or more related weight dimensions. For example, product quality scoring may depend on both sterilization temperature and production time, while logistics monitoring may depend on features such as transportation temperature and storage time. The weight database should also include a dynamic update mechanism to cope with different traceability needs or changes in the external environment. For instance, if the impact of a feature parameter, such as cold chain monitoring, on traceability needs increases, the weight value of that feature can be automatically adjusted based on historical data and analysis results, thereby affecting subsequent traceability assessment results. Finally, through an automated rule engine or manual adjustment, the mapping relationship between feature parameters and weights is completed, ensuring the accuracy and flexibility of data matching in different scenarios.

[0085] S24. Map the weight values ​​in the weight database to the traceability feature parameters and dairy product data blocks according to the weight mapping relationship;

[0086] Specifically, mapping the weight values ​​in the weight database to traceability feature parameters and dairy product data blocks according to the weight mapping relationship includes: First, based on the previously set feature parameter extraction rules, identifying all feature parameter sets involved in the current traceability task, and retrieving matching weight templates from the weight database. Each template is jointly determined by the traceability scenario type and task objective, defining the weight distribution of each feature parameter in the current task, such as sterilization temperature of 0.85°C and transportation time of 0.6 seconds. Each weight value in the template is then matched one-to-one with the corresponding traceability feature parameter to construct a parameter weight mapping table.

[0087] Subsequently, weight values ​​are assigned to the actual dairy product data blocks according to the mapping table. Specifically, for each data block, the cleaned and structured set of fields is extracted and matched with the traceability feature parameters involved in the current task. Fields that match successfully are appended with their corresponding weight values, forming a data structure with weight annotations. Each data field can be encapsulated as a four-tuple, including field name, field value, field source module, and field weight. During the construction of this structure, field alias resolution, unit conversion, and type unification are supported to ensure consistency and accuracy in field identification. In multi-block joint traceability tasks, a block weight coefficient mechanism is introduced, assigning a block weight coefficient to each data block based on its process stage (e.g., processing, packaging, transportation) or trust level; for example, the processing block is set to 1.0, and the transportation block to 0.8. Finally, the comprehensive weight value of each field is calculated, determined by both the field weight and the weight of the block it belongs to, and is used in subsequent feature scoring, link ranking, and applicability evaluation modules.

[0088] S25. Calculate the feature weight score and block weight score of the mapped traceability feature parameters and dairy product data blocks, and match the mapped traceability feature parameters and dairy product data blocks based on the score similarity.

[0089] Specifically, calculating the mapped traceability feature parameters and the feature weight score and block weight score of the dairy product data block, and matching the mapped traceability feature parameters and the dairy product data block based on the score similarity includes the following steps:

[0090] S251. Calculate the feature weight score of the source feature parameter based on the mapping weight value, and perform normalization processing.

[0091] Specifically, the process of calculating and normalizing the feature weight scores of traceability feature parameters based on the mapped weight values ​​includes: First, for each dairy product data block, extracting the field values, corresponding weight values, and data validity identifiers of the feature parameters that have been mapped to weights; then, calculating the preliminary feature weight score for each feature parameter using the formula: Feature Weight Score = Parameter Weight Value × Parameter Validity Factor. The validity factor is used to dynamically adjust the score. When the parameter data is complete, without missing data, and without anomalies, the validity factor is 1. If the parameter has missing or anomalies, a decay value between 0 and 1 is given according to the severity.

[0092] Next, the preliminary weight scores of all feature parameters are summarized to obtain the sum of the scores of all parameters in the current task. The score of each feature parameter is then normalized by dividing the sum by this total. After normalization, the weight score of each feature falls within the range of 0 to 1, and the sum of all scores equals 1. The formula is as follows:

[0093]

[0094] Where n represents the total number of traceability feature parameters involved in the current task, and i represents the i-th feature parameter currently being processed. The normalized feature weight score can effectively reflect the relative importance of each parameter in this traceability task and avoid the problem of score imbalance caused by different total feature weights in different scenarios. Finally, the normalized feature weight score is bound to the field information of the dairy product data block to form a feature vector structure with the final weight score.

[0095] S252. Obtain the traceability feature parameter set in the dairy product data block, and calculate the block weight score of the dairy product data block based on the standardized weight score of each feature parameter in the traceability feature parameter set.

[0096] Specifically, obtaining the traceability feature parameter set from the dairy product data block includes: First, based on the previously established traceability feature parameter extraction rules, traversing the structured field information stored in the block, and matching each field name, alias, or tag with a preset feature parameter mapping table to filter out the set of fields relevant to the current traceability requirements, forming the traceability feature parameter set within the data block. When the same parameter may appear in multiple blocks or have multiple sources, the optimal value is selected based on dimensions such as the reliability of the field source and the age of the timestamp, ensuring the uniqueness and accuracy of the feature parameter set.

[0097] Based on the acquired set of traceability feature parameters, a standardized weight score is extracted for each feature parameter. This score is obtained by normalizing the result after calculating the single-parameter weight mapping multiplied by the effectiveness factor, representing the relative influence of the parameter on the current traceability requirements. The standardized weight scores of all feature parameters within the same data block are then summed in a weighted manner to form the block weight score for that block. The specific calculation formula is as follows:

[0098]

[0099] Where m represents the number of valid traceability feature parameters within the data block, and the feature weight score... q R is the standardized weight score for the i-th feature parameter. q This is an optional feature parameter correction factor (e.g., when considering upstream and downstream logical dependencies or weight transfer). If no correction is needed, the default value is 1. If the traceability requirement involves multiple block comparisons, the block weight score can be calculated for each data block. Then, based on the process stage or credibility of the block, the block level weight coefficient can be set, and further superimposed or weighted averaged to generate a comprehensive weight for multiple blocks. This weight is used for subsequent traceability link sorting, applicability scoring, and anomaly location. Finally, the block weight score is bound to the block's metadata (such as block ID, hash, and timestamp) to generate complete block weight description information. This information can serve as the basic data support for intelligent traceability link generation, similarity calculation, and visualization.

[0100] S253. Construct feature weight score vectors and block weight score vectors based on feature weight scores and block weight scores;

[0101] Specifically, constructing the feature weight score vector involves: First, extracting standardized traceability feature parameter weight scores from the current dairy product data block. Each score value represents the relative importance of the feature in this traceability task. Following a fixed order of parameters (e.g., by field ID, dictionary order, or priority sequence), the normalized weight scores of each parameter are sequentially arranged into a one-dimensional vector, denoted as the Feature Weight Score Vector (Feature, Weight, Score, Vector, or FWSV). Each element in this vector represents the standardized weight score of a feature parameter. This vector is a dense vector with the same dimension as the number of traceability parameters, used for subsequent analysis operations such as similarity comparison and vector distance calculation with features from other blocks.

[0102] Next, based on the constructed feature weight score vector and the metadata information within the block, the block weight score of the current data block is calculated. After obtaining the final score of a single block, it is combined with the scores of all other blocks to form a multi-dimensional block score vector, denoted as the block weight score vector (Block, Weight, Score, Vector, or BWSV for short). Each element in this vector represents the comprehensive weight score of a data block. The comprehensive weight score of each block is obtained by multiplying and summing the weight scores of all features within the block with the corresponding correction factors or credibility indicators. Finally, the feature weight score vector (FWSV) and the block weight score vector (BWSV) are used as two basic vector structures for the tracing task, for feature similarity matching (using methods such as cosine similarity), multi-block score comparison (such as weight ranking and main chain selection), and block visualization of the tracing path (such as drawing weight radar charts and score heatmaps).

[0103] S254. The cosine similarity algorithm is used to calculate the score similarity between the feature weight score vector and the block weight score vector.

[0104] Specifically, cosine similarity measures the cosine of the angle between two vectors. By calculating the cosine value, we can determine the directional similarity between two vectors. The value ranges from -1 to 1, with the following meanings: 1 indicates complete similarity (the two vectors have the same direction), 0 indicates no similarity (the two vectors are orthogonal and have no directional relationship), and -1 indicates complete opposites (the two vectors have completely opposite directions). The formula for calculating cosine similarity is:

[0105]

[0106] Here, Cosine Similarity is the cosine similarity, AB is the dot product (inner product) of vectors A and B, and ||A|| is the magnitude of vector A (i.e., the length of the vector), and ||B|| is the magnitude of vector B. The similarity calculation between the feature weight score vector and the block weight score vector assumes the following: The FWSV (Feature Weight Score Vector) is a vector composed of the standardized weight scores of each feature parameter, with each feature parameter in the FWSV corresponding to a weight score, and these scores forming a vector. The BWSV (Block Weight Score Vector) is a vector composed of the comprehensive weight scores of each data block, and the comprehensive scores of each block in the BWSV also form a vector. The dot product (inner product) is calculated by multiplying the corresponding elements of the two vectors and summing them. For the feature weight score vector and the block weight score vector, the elements at corresponding positions in the feature weight score vector and the block weight score vector are multiplied and then summed. Then, the magnitude of each vector is calculated by taking the square root of the sum of the squares of its elements. Finally, the similarity between the two vectors is calculated using the cosine similarity formula.

[0107] If the calculated cosine similarity is close to 1, it means that the two vectors are very similar in direction, that is, their feature weight scores and block weight scores are highly consistent to some extent. If the calculated cosine similarity is close to 0, it means that the two vectors are orthogonal, that is, there is no correlation or similarity between them. If the calculated cosine similarity is close to -1, it means that the two vectors are completely opposite in direction, that is, there is almost no similarity between them, which may represent different traceability needs or data patterns.

[0108] S255. A preset score similarity judgment threshold is set. When the score similarity is greater than or equal to the similarity judgment threshold, the traceability feature parameters and the dairy product data block are determined to be a matching relationship. When the score similarity is less than the similarity judgment threshold, it is considered a mismatch, and feedback optimization is performed.

[0109] Specifically, when constructing a source tracing matching model, a similarity threshold needs to be pre-defined to determine whether there is a matching relationship between the feature weight score vector and the block weight score vector. This threshold means that if the calculated similarity is higher than or equal to this value, the two feature expressions are considered sufficiently similar and thus a match; otherwise, they are considered a mismatch. This threshold is typically set in the following ways: empirically, such as a default value of 0.80 or 0.85; based on the mean plus standard deviation calculated from the training set samples; or automatically determined based on the optimal F1 score evaluated on the validation set. For example, a threshold of 0.80 means a match when the similarity is ≥0.80, otherwise it is considered a mismatch.

[0110] After obtaining a set of feature weight score vectors and a block weight score vector for a data block, the following judgment process is executed to calculate cosine similarity. The standard cosine similarity algorithm is used to calculate the similarity score between the feature weight score vector and the block weight score vector, with a value range of [-1, 1], but often between [0, 1]. A threshold comparison judgment is then performed. If the score similarity is ≥ a preset threshold, the current feature and block are determined to be a match; this match is recorded in the task matching graph or matching mapping table for link construction or label assignment; it can serve as a component node in the subsequent tracing path. If the score similarity is < a preset threshold, it is determined to be a mismatch; simultaneously, a feedback optimization mechanism is initiated to continuously improve matching accuracy and robustness.

[0111] To avoid false rejections or solidified biases, a feedback analysis process should be automatically triggered after each mismatch determination. This process records the current scoring context, including feature weight scoring vectors, block weight scoring vectors, similarity values, task IDs, block IDs, timestamps, etc. It can also capture auxiliary information such as task type and business tags. The reasons and contextual characteristics are then analyzed: Is the low similarity due to missing feature dimensions (e.g., missing partial feature scores)? Are individual high-weight feature values ​​abnormal in this block? Is the overall feature expression offset, only numerically similar but semantically inconsistent? Then, strategy optimization is performed (including at least one of the following): Dynamically adjusting the threshold: If critical similarity false rejections frequently occur in multiple tasks, the threshold can be slightly lowered (e.g., 0.80-0.78); Feature correction: For feature items with abnormal weights or incorrect expressions, rule repair or model retraining is triggered; Data completion: If important features are found to be missing in a block, supplementary data collection logic or interpolation can be scheduled to form an optimization loop. Each mismatch record can be accumulated in the feedback optimization log library, and the triggered behaviors are periodically statistically analyzed to drive the continuous evolution of the scoring mechanism.

[0112] S3. Based on the spatiotemporal coupling self-organizing model, a dynamic traceability link generation mechanism is preset, and a dairy product traceability link is generated based on the matching results;

[0113] Specifically, the process of generating a dynamic traceability link based on a pre-defined dynamic traceability link generation mechanism using a spatiotemporal coupled self-organizing model, and generating a dairy product traceability link based on the matching results, includes the following steps:

[0114] S31. Construct a spatiotemporally coupled self-organizing model based on the time and spatial parameters in the dairy product data block;

[0115] Specifically, constructing a spatiotemporally coupled self-organizing model based on the temporal and spatial parameters in the dairy product data block includes the following steps:

[0116] S311. Extract the block time parameters and block space parameters from the dairy product data block, and clean the extracted data;

[0117] Specifically, the dairy product data block typically contains structured metadata fields, such as processing time, transportation start and end time, packaging time, warehousing time, outbound time, temperature control collection time, etc. These belong to the block's time parameters. At the same time, the fields may also contain geographical or geographic identification information, such as production location, storage location, origin, destination, coordinates, logistics trajectory, etc. These belong to the block's spatial parameters.

[0118] The specific extraction process is as follows: First, all fields in the data block are traversed, and keyword matching is performed using a pre-defined parameter naming mapping table. For example, time-related fields identify keywords such as "time," "moment," and "collection time"; spatial fields identify keywords such as "address," "location," "location," "coordinates," and "geocode." For the identified fields, their content format is further analyzed to ensure it conforms to the expected data type: time fields should be standard timestamps, date strings, or convertible formats; spatial fields should be parsable addresses, coordinate pairs, or structured location identifiers (such as administrative division codes). Then, the confirmed fields are extracted into standard time and spatial parameter formats.

[0119] After extraction, to ensure the accuracy of subsequent analysis or similarity calculations, the original extraction results need to be cleaned. This mainly includes filtering out empty or placeholder (e.g., —, None, N / A) time and space fields; configurable options for allowing missing fields, such as retaining only time-based data blocks or requiring both time and space fields to exist. Format standardization validation: All time fields are converted to a unified format. If the format is non-compliant (e.g., 202307-33), it is removed or recorded as an anomaly; coordinates must be within a valid numerical range (latitude -90 to 90, longitude -180 to 180), otherwise they are considered invalid. Outlier removal and correction suggestions: Check if the time is earlier than the minimum allowed time (e.g., before 1970) or later than the current time; for cases of duplicate, overly dense, or abnormally offset coordinates, record the anomaly and suggest data source correction. Renaming and field mapping unification: Map field names to standard internal field identifiers.

[0120] S312. Construct a spatiotemporal feature matrix based on the cleaned block time parameters and block spatial parameters;

[0121] Specifically, the temporal and spatial parameters of the data blocks are mapped into structured numerical features for subsequent model training, similarity calculation, path reasoning, or visualization analysis. Cleaned dairy product data blocks typically contain the following fields: time parameters (e.g., processing time, packaging time, warehousing time, outbound time, transportation start and end times); spatial parameters (e.g., latitude and longitude coordinates, origin location code, warehouse location, transportation route start and end points); all time parameters are converted into comparable numerical representations, such as timestamps or relative times (e.g., seconds from the task start time). Latitude and longitude coordinates can be used directly or binned as needed (e.g., divided into regional grids), or the geographical location can be mapped to administrative division codes, city IDs, grid numbers, etc. The straight-line distance between the start and end points can be calculated, or directional features such as path offset angles and orientations can be constructed. Combining time and space, the following features can be extracted to supplement modeling: time period × geographic location cross-coding (e.g., daytime transportation × high-latitude regions); statistics on active time periods in specific regions; spatiotemporal continuity scoring (determining whether the path and time conform to the flow logic); and unique spatiotemporal identifiers for blocks (e.g., generated jointly by block ID + timestamp + coordinate grid). The extracted time and space numerical features are organized into a unified matrix structure, where each row represents a data block and each column represents a spatiotemporal dimension feature. This feature matrix can be used as model input or for score vectorization, spatiotemporal similarity matching, etc.

[0122] S313. Establish a coupling relationship diagram based on the temporal order and spatial proximity of block time parameters and block spatial parameters;

[0123] Specifically, constructing a spatiotemporal coupling graph based on block time and spatial parameters involves: First, extracting standardized timestamps and geographic coordinates from the cleaned data blocks, ensuring that all time fields are comparable numerical types (such as Unix timestamps), and unifying spatial fields to standard geographic coordinates (WGS84 coordinate system). Each block node will be assigned unique time and spatial attribute labels as the basic characteristics of the nodes in the graph.

[0124] Next, all blocks are sorted according to chronological order. For each pair of blocks with a temporal relationship, their time difference is checked to see if it falls within a set acceptable window (e.g., 0-72 hours). When the temporal flow logic is satisfied, a directed edge is established between the two blocks, pointing towards the later block, and may include a time interval as an edge weight for subsequent sorting or shortest chain calculation. Simultaneously, the straight-line distance between any two blocks is calculated based on geographic coordinates. When the distance is less than a preset spatial proximity threshold (e.g., 5km or 10km), the two blocks are considered to have spatial coupling. A spatial edge is added to the graph, which is undirected, and its actual distance value or its reciprocal is recorded as the edge weight to represent the coupling strength. Finally, all temporal and spatial edges are added to the spatiotemporal coupling graph, forming a graph structure composed of nodes (blocks) and multiple types of edges (spatiotemporal). Each edge in the graph represents a possible transmission, flow, or proximity relationship between two blocks. Edges that simultaneously satisfy temporal order and spatial proximity can be marked as strongly coupled edges, and are preferentially used in tasks such as tracing the main path or discovering abnormal paths. For practical use, this coupling graph can be exported as a graph database (such as Neo4j) structure or converted into a matrix representation for use as input for deep learning model graph construction, supporting batch scoring, path prediction, and visualization.

[0125] S314. Merge the spatiotemporal feature matrix and the coupling relationship diagram, and set self-organizing rules to obtain a spatiotemporal coupled self-organizing model.

[0126] Specifically, the spatiotemporal feature matrix and the coupling graph are combined. The spatiotemporal feature matrix transforms the temporal and spatial parameters of dairy product data blocks into a structured numerical feature matrix, where each row represents a block and each column represents a feature dimension. For example, the columns of the matrix can include timestamps, geographic coordinates, time differences, distances, transportation durations, etc. The coupling graph describes the temporal flow and spatial proximity relationships between different data blocks by constructing directed and undirected graphs of spatiotemporal coupling. Nodes in the graph represent data blocks, and edges represent the spatiotemporal relationships between blocks.

[0127] Merging methods include node merging: Each block node in the graph has a corresponding spatiotemporal feature vector. These features come from each row of the spatiotemporal feature matrix, so each row of the spatiotemporal feature matrix can be used as an attribute of the graph node to expand the existing coupling graph. Alternatively, edge merging: Edges in the coupling graph represent the spatiotemporal relationships between blocks. The representation of edges can be enriched by adding spatiotemporally related features (such as time difference, spatial distance, etc.) to the edge attributes. The values ​​in the spatiotemporal feature matrix can be mapped to the edges in the coupling graph, thereby enhancing the graph's expressive power.

[0128] The design of self-organizing rules aims to dynamically adjust the graph structure through the interaction of nodes and edges, learning potential spatiotemporal correlation patterns. By setting rules, nodes and edges in the graph adaptively adjust based on local information, continuously optimizing spatiotemporal coupling relationships. Self-organizing rule design can be based on the feature vectors of graph nodes and the spatiotemporal relationships of their neighbors. Common rules include: each node's feature vector is updated with weights based on the spatiotemporal features of its neighbors; edge weights are dynamically adjusted based on the similarity and coupling strength between nodes. For example, if two nodes are highly coupled spatiotemporally (meeting both temporal sequence and spatial proximity), the edge weight between them can be increased. Self-organizing optimization includes local structure optimization: based on the features and similarity of adjacent nodes, nodes and edges in the graph continuously adjust to optimize the spatiotemporal coupling structure. For example, in some tracing chains, it may be necessary to strengthen the correlation strength between certain features to help the model better capture specific patterns. Alternatively, global pattern discovery can be employed: as self-organization progresses, the global structure of the graph gradually reveals specific spatiotemporal coupling patterns, helping to uncover deeper relationships between data blocks. For example, it may be discovered that certain production and storage locations exhibit strong spatiotemporal coupling within a specific time period, thereby optimizing the traceability path. By merging the spatiotemporal feature matrix and the coupling relationship graph, and iteratively updating according to self-organization rules, a spatiotemporal coupled self-organizing model can ultimately be obtained.

[0129] S315. Verify and optimize the spatiotemporal coupling self-organizing model, and output the verified and optimized spatiotemporal coupling self-organizing model.

[0130] Specifically, the validation and optimization of the spatiotemporally coupled self-organizing model includes: First, preparing a set of dairy product data blocks with real traceability paths or labeled coupling relationships as a validation set. Extracting the real spatiotemporal path labels (such as time-ordered chains and spatial path nodes) from each block in the validation set and comparing them with the coupling graph structure generated by the model's self-organization, is used to evaluate the accuracy of the model's inference paths, the coverage of coupling edges, and the error association rate. Then, a set of evaluation metrics is used to quantitatively evaluate the current model performance. Commonly used metrics include: path matching rate (whether nodes in the real path are completely and correctly connected by the self-organizing model), edge accuracy (whether the model's coupling edges actually exist), and F1 score (considering both precision and recall). Simultaneously, graph structure similarity metrics (such as edit distance and adjacency matrix similarity) can also be used as evaluation criteria. If the model performs poorly on certain metrics, it indicates problems such as overfitting, overly dense connections, or temporal disorder.

[0131] Based on the above results, the system will automatically enter the optimization phase, applying feedback rules for self-organizing correction: such as adjusting edge weight update rules (slowing down the strengthening speed of unimportant edges), adjusting node update strategies (improving the self-stability of important nodes), or setting edge deletion thresholds to remove redundant connections. Furthermore, a supervised fine-tuning mechanism can be introduced to guide the model structure towards the real path using validation set results, improving structural robustness and interpretability. The final output is an optimized spatiotemporal coupled self-organizing model with the following characteristics: its coupled graph structure more closely resembles the logic of real data flow, the distribution of spatiotemporal edges more closely matches the actual link direction, the feature representation of key nodes is clearer, and the coupled path has stronger traceability readability. This model can be directly deployed online or integrated with downstream traceability analysis models (such as path prediction and anomaly detection) to form a spatiotemporal intelligent closed-loop system.

[0132] S32. Based on the score similarity matching results, select the successfully matched traceability feature parameters and dairy product data blocks, and construct a traceability node set;

[0133] Specifically, based on the score similarity matching results, the successfully matched traceability feature parameters and dairy product data blocks are selected, and a traceability node set is constructed, including the following steps:

[0134] S321. Obtain the rating similarity matching results and set the rating threshold for successful matching;

[0135] Specifically, after constructing the feature weight scoring vector and the target data block feature vector, the scoring similarity between the two is obtained through a similarity calculation function (usually cosine similarity). This scoring value is a real number ranging from [0, 1] to [0, 1]. The higher the value, the more consistent the feature distribution between the two vectors. This similarity value is used as the core basis for determining whether the source feature matches the target block. Next, a matching threshold for the scoring similarity needs to be pre-set to define the boundary between matching and non-matching. This threshold can be manually set according to actual business needs (e.g., 0.85), or the optimal value can be obtained through statistical analysis based on validation set sample data (e.g., using the optimal split point under the ROC curve). When the calculated similarity value is greater than or equal to this threshold, it is considered a successful match; otherwise, it is considered a failed match.

[0136] During the matching process, a matching result label will be output for each comparison object, including: similarity score, whether the match was successful (Boolean), reference threshold, and relevant source tracing feature name. This matching result will be stored in the task cache or result table for subsequent source tracing path analysis or manual review. To enhance robustness, the threshold mechanism can be layered, for example, by introducing two ranges: a strong matching threshold and a weak matching threshold. If the similarity falls between these two ranges, manual review or automatic optimization strategies will be triggered. This mechanism ensures matching accuracy and allows for flexible human-machine collaboration in gray-area scenarios, thereby improving the overall reliability and controllability of source tracing.

[0137] S322. Based on the scoring threshold, select the successfully matched traceability feature parameters and dairy product data blocks;

[0138] Specifically, after calculating the similarity between each set of traceability feature parameters and the dairy product data block, a similarity score is obtained. This score is typically calculated using cosine similarity or weighted vector angle, with the result value falling between [0, 1] and [0, 1]. Each score record includes: traceability feature ID, block ID, similarity score, comparison time, etc. This score reflects the degree of structural and semantic matching between the feature and the target data block. Subsequently, a matching judgment is made based on a pre-set scoring threshold (e.g., 0.85). For each score result, if its similarity is greater than or equal to the set threshold, it is considered that the set of traceability feature parameters and the dairy product data block constitute a matching relationship; otherwise, it is considered a non-matching relationship or a low-confidence match. This scoring threshold can be dynamically adjusted according to the task accuracy requirements, and multi-level thresholds (e.g., strong matching and weak matching) can also be used for classification processing.

[0139] After the judgment is completed, all results with a score similarity greater than or equal to the matching threshold are extracted as successfully matched items. These records are typically organized into a structured output table, containing fields such as feature ID, block ID, score value, and matching status, and written into the matching result set for subsequent use in traceability chain construction, visualization graph generation, or manual verification. To enhance transparency and automation, a matching distribution statistical chart or a hierarchical view of matching confidence scores can also be generated to help operations personnel understand matching accuracy, misjudgment risks, and optimization potential. In this way, while ensuring traceability accuracy, data support is also provided for continuous model iteration and strategy adjustment.

[0140] S323. Based on the successfully matched traceability feature parameters and dairy product data blocks, extract node time parameters, node spatial parameters and node association attribute information, and construct a traceability node set.

[0141] Specifically, after completing the scoring and matching of traceability feature parameters with dairy product data blocks and filtering out all successfully matched records, a corresponding traceability node will be constructed based on each matching pair. Each node represents a dairy product data block successfully identified as a traceability target, and its core features come from the spatiotemporal and attribute information of the block itself. First, the node's time parameters and spatial parameters are extracted from each successfully matched block. Time parameters typically include event time, circulation time, or warehousing / outbound time, which need to be uniformly converted to timestamps or standard time formats; spatial parameters mainly include geocoding of coordinate points to ensure a unified coordinate system for subsequent tasks such as spatial path reconstruction and visualization trajectory drawing.

[0142] Next, the associated attribute information of each node is extracted, including but not limited to: block ID, product batch number, supplier number, processing stage type (such as packaging, inspection, transportation, etc.), data source identifier, and upstream and downstream association IDs. This information helps identify the semantic relationships between nodes when constructing the traceability graph, and assists in operations such as edge generation, path sorting, and main chain extraction. Finally, all nodes that meet the conditions are organized into a structured set, namely the traceability node set. Each node in the set has a unique identifier and complete time, space, and attribute ternary information.

[0143] S324. Perform deduplication and structural integrity checks on the source node set, and output the deduplication-checked source node set.

[0144] Specifically, after constructing the initial set of traceability nodes, deduplication is required to eliminate duplicate node records and avoid introducing redundant links or paths into the subsequent graph structure. Deduplication rules are typically based on the unique identifier of the block, the combination of timestamp and coordinates, and the triplet of batch number and stage type. If multiple records have the same core characteristics or are highly similar (e.g., time difference less than 1 second, coordinate error within an acceptable range), the record with the higher score or more complete data is retained, and other redundant nodes are deleted.

[0145] Next, a structural integrity check will be performed on each node to ensure that it contains complete spatiotemporal and attribute ternary information. The check includes: whether the time parameter is empty or invalid (e.g., negative timestamp, incorrect format); whether the spatial parameter is missing or outside the valid range (latitude and longitude not within Earth coordinates); and whether the attribute fields have key identifiers (e.g., batch number, processing type). Nodes with severe deficiencies or incorrect formats will be marked as structurally incomplete and may be removed as invalid nodes or moved to the pending review set for manual intervention.

[0146] After cleaning, a deduplicated set of source nodes will be generated. Each node has a complete timestamp, standardized coordinates, and necessary attribute identifiers, and there will be no redundancy or conflict within the set. This set can serve as the basic input for the final graph construction and path tracing, and can also be used in advanced analysis processes such as multi-round feature training, path prediction, and node clustering. This deduplication process not only improves the structural accuracy of the source graph, but also lays a solid foundation for the stability and interpretability of subsequent models, ensuring the logical coherence and factual accuracy of the data chain.

[0147] S33. Based on the spatiotemporal coupled self-organizing model, a dynamic traceability link generation mechanism is set up, and a dairy product traceability link is generated based on the dynamic traceability link generation mechanism.

[0148] Specifically, the process of setting up a dynamic traceability link generation mechanism based on the spatiotemporal coupled self-organizing model, and generating a dairy product traceability link based on the dynamic traceability link generation mechanism, includes the following steps:

[0149] S331. Based on the spatiotemporal coupling self-organizing model and the process chain data in the dairy product data block, a dynamic traceability link generation mechanism is set up.

[0150] Specifically, the generation of dynamic traceability links is based on a spatiotemporally coupled self-organizing model, combined with the process chain data (such as raw material receiving - pasteurization - filling - packaging - warehousing and outbound) labeled or inferred from each dairy product data block for matching and guidance. First, based on the temporal sequence and spatial coordinates of each block in the node set, all coupling relationship edges are selected from the self-organizing model, and the types of process links carried by these nodes are cross-referenced as the starting points and candidate transfer points of the path.

[0151] Subsequently, dynamic transfer rules are constructed using process chain logic constraints, namely: reverse process jumps such as packaging-pasteurization are not allowed, and the process chain sequence must be followed. Simultaneously, in each step of dynamic path expansion, a scoring function is constructed to dynamically score each reachable path, considering factors such as edge time weight, spatial distance, coupling strength, and process logic compatibility. The path with the highest score is selected as the optimal transfer path for the current stage. The entire generation process adopts a node-by-node iteration + scoring sorting approach. Each newly generated node is treated as the tail node of the current path, and the search continues downwards until the path endpoint (such as a terminal node for outbound / sales) is reached, or the set time span and spatial jump threshold are reached, at which point generation stops. This mechanism ensures that the generated paths structurally conform to temporal and spatial logic, semantically follow the processing flow, and prioritize links with higher confidence in the scoring mechanism. Finally, the generated dynamic traceability links are organized into a directed graph path set, with each path representing a complete dairy product circulation process. It can be used to automatically draw source trajectory maps, support the cause of abnormal nodes, and diagnose link breakpoints. It can also output structured results for downstream model calls or audit interfaces.

[0152] S332. Based on the process chain data, identify the source node and target node for traceability;

[0153] Specifically, when analyzing dairy product data blocks, information about the corresponding process chain links is extracted from each block, such as raw material receiving, pasteurization, canning, packaging, warehousing, outbound warehousing, transportation, and distribution. By analyzing these process types and their time sequence, a complete process chain model can be established. This process chain is a directed sequence, progressing step by step from production to sales, which allows for node location.

[0154] In a clearly defined traceability path, the source node typically corresponds to the initial stage of the process chain (such as raw material receiving or the first processing). This node is the earliest appearing node on the traceability chain and has a traceable origin. The target node, on the other hand, is the final stage of the chain (such as outbound delivery, terminal distribution, or consumer signature), representing the endpoint where the dairy product reaches its final state. Based on the stage label and timestamp sorting results of each node, the earliest and latest nodes are selected as source and target candidates. To improve accuracy, logical verification can be performed by considering the structural relationships between upstream and downstream nodes. For example, if a node is the earliest in time but its stage type is transportation rather than raw material receiving, it can be excluded from being considered a source node. Only nodes that meet both the logical first stage and the earliest time condition can be recognized as valid traceability source nodes. Similarly, the target node must be a combination of the consumer-end or outbound process and the latest time.

[0155] Ultimately, a unique source node and one or more target nodes will be output for subsequent dynamic path deduction, visual path tracing, and source determination. If multiple candidate target nodes exist (e.g., cross-regional outbound shipments), multiple terminal nodes can be retained for parallel analysis. This method ensures a clear traceability path structure, a well-defined starting point, and a reasonable ending point, providing clear start and end coordinates for constructing the traceability link.

[0156] S333. Generate an initial link path by using a dynamic tracing link generation mechanism to trace the source node and the target node.

[0157] Specifically, after identifying the starting point (source node) and ending point (target node) of the traceability, a dynamic traceability link generation mechanism is initiated to construct an initial link path connecting the two. This mechanism takes the source node as the starting point of the path, continuously expands candidate paths through the graph structure in the spatiotemporally coupled self-organizing model, and follows the process chain sequence, temporal logic, and spatial proximity constraints to ensure that the path generation is realistically feasible.

[0158] During path expansion, a directed path search algorithm (such as time-constrained breadth-first or depth-first traversal) is employed. Each time, starting from the current node, the next node is searched for that meets the following conditions: it is later than the current node in time, its spatial jump distance does not exceed the maximum, and its process logic is consistent with the subsequent steps in the process chain. For example, starting from the filling stage, only packaging or warehousing nodes are accepted as valid path expansion points. To improve path accuracy and efficiency, each candidate path is dynamically scored, considering factors such as edge weights (time interval, distance), node matching scores, and process logic consistency. The path with the highest score is prioritized and retained as the initial link path. If multiple paths with similar scores exist, multiple paths can be retained in parallel for subsequent verification stages.

[0159] The final generated initial link path will be output as a node sequence, structurally presenting a time-ordered chain that connects the source node to the target node step by step. This path possesses logical closure, spatiotemporal consistency, and semantic interpretability, and can serve as the basic framework for subsequent path optimization, anomaly detection, and graph visualization. This mechanism implements a precise source tracing chain generation logic driven from the start point to the end point, adapting to dynamic and complex data scenarios.

[0160] S334. Perform reachability verification and optimization on the initial link path, and use the optimized initial link path as the dairy product traceability link output.

[0161] Specifically, after generating the initial link path, the overall connectivity and logical rationality of the path need to be verified for reachability. First, starting from both ends of the link, check whether the source node has at least one outgoing edge that can be extended backward, and whether the target node can be connected to other nodes in a directed manner. If a path break or a node being suspended is found, a backtracking mechanism will be used to re-evaluate the connecting edges at the break point to determine whether the path interruption was caused by excessive time difference, excessive spatial jump, or inconsistencies in the process.

[0162] Next, path integrity optimization is performed. This involves attempting to fill in missing jumps at breakpoints from a pool of candidate nodes, without violating process logic or spatiotemporal constraints. For example, if the path lacks an warehousing step and jumps directly from packaging to transportation, high-scoring nodes that are time-series between packaging and transportation and have an warehousing process type are automatically inserted to enhance the path's business loop. The weight distribution of each edge in the link and the overall path confidence are also evaluated. If certain path segments have abnormally high time delays, excessively long spatial jumps, or low-similarity edges, edge weights are adjusted or path segments are replaced. Simultaneously, a rule engine can be applied to eliminate logically erroneous links, such as reverse process jumps like delivery before packaging, based on actual process chain constraints.

[0163] Ultimately, the optimized dairy product traceability chain is output, structurally a set of directed paths starting from the source node and connecting layer by layer to the target node. All path nodes have passed spatiotemporal consistency verification, process logic verification, and scoring confidence assessment, possessing high readability and usability. This chain can be directly used for downstream tasks such as map visualization, chain backtracking analysis, and anomaly event location, achieving high-precision and highly reliable dynamic traceability.

[0164] S34. Verify the structural consistency between the traceability node set and the dairy product traceability link, and perform self-organizing optimization on the dairy product traceability link based on the verification results.

[0165] Specifically, the first step is to verify the structural consistency between the traceability node set and the dairy product traceability chain. This process includes two aspects: node consistency and path consistency. Node consistency refers to whether each node in the traceability node set is correctly represented in the traceability chain, that is, whether each block is correctly embedded in the chain structure according to its characteristics such as time, space, and process links. Path consistency refers to whether the path in the traceability chain conforms to the time sequence, spatial proximity, and coupling relationship between nodes in the process chain.

[0166] During the verification process, each node in the traceability chain is first checked to ensure that its position in the chain matches its characteristics within the node set, such as timestamps and process steps. If missing, duplicate, or incorrectly positioned nodes are found, they are marked as structurally inconsistent, and the parts requiring optimization are recorded. Next, path consistency is checked to ensure that the nodes in the chain are correctly connected in chronological order and conform to the flow logic of the process chain. Each edge in the path must represent a valid spatiotemporal transition, and each transition must meet preset spatiotemporal proximity and process logic requirements. Paths that do not meet the conditions (such as reverse flow or crossing excessive distances) are considered inconsistent and require further optimization.

[0167] After structural consistency verification, the process enters the self-organizing optimization phase. Based on the verification results, inconsistencies in the link are automatically adjusted. First, node corrections are performed to ensure the completeness and accuracy of node information. Mismatched nodes are replaced or reordered to ensure consistent node information and spatiotemporal continuity. Non-compliant paths are locally repaired based on spatiotemporal coupling relationships and process chain constraints. For example, for issues like excessive time breaks or spatial jumps in the path, neighboring nodes are introduced, edge weights are recalculated, and the path connection order is adjusted until a link structure conforming to actual flow is restored. During the self-organizing optimization process, a feedback mechanism is also employed to continuously evaluate the correctness and optimization effect of each adjusted link structure, ensuring that the final link better meets traceability requirements globally.

[0168] S35. Output the optimized dairy product traceability link.

[0169] S4. Preset an applicability threshold rule base, and use the applicability threshold rules in the applicability threshold rule base combined with the grey relational algorithm to evaluate the applicability of the dairy product traceability link;

[0170] Specifically, the following steps are involved in setting up an applicability threshold rule base and using the applicability threshold rules in the applicability threshold rule base in conjunction with the grey relational algorithm to evaluate the applicability of the dairy product traceability chain:

[0171] S41. Based on the traceability requirements of dairy products, construct an applicability threshold rule base and set a rule matching strategy;

[0172] Specifically, an applicability threshold rule base needs to be constructed based on the business scenarios and core objectives of dairy product traceability. Applicability refers to the acceptability or trust level of a particular traceability node or path segment in the current traceability task. The rule base should set scoring thresholds around the following core dimensions: time difference threshold (e.g., the time interval between nodes should not exceed 48 hours); spatial jump distance (e.g., the straight-line distance between two nodes should not exceed 50 kilometers); logical legality of process steps (e.g., filling must occur after sterilization); lower limit of similarity score (e.g., feature matching degree ≥ 0.85); data credibility level (e.g., sensor / manual verification of labels takes precedence).

[0173] Next, a rule matching strategy needs to be defined so that these threshold rules can be dynamically referenced during the construction of the traceability chain. Common strategies include: node-by-node filtering strategy (i.e., comparing each threshold item by node feature and retaining only nodes that meet the rules); path scoring strategy (judging the validity of a path based on the average or minimum value of each scoring indicator in the entire path); and dynamic penalty mechanism (if a path segment violates a rule, a score decay is applied or it is marked as a weak link segment).

[0174] Furthermore, to adapt to different traceability objectives and data scenarios, the rule base should support custom configuration and a tiered loading mechanism. For example, a more lenient threshold range can be set for routine regulatory traceability, while a stricter rule set can be loaded for anomaly recall traceability to prioritize accuracy and the integrity of the chain of responsibility. Rule matching strategies can also be adjusted according to task type, prioritizing rapid link construction or high-confidence link verification. Ultimately, through the joint execution of the aforementioned rule base and matching strategies, the most suitable nodes and path segments can be automatically selected during the traceability chain construction process, improving the structural reliability and semantic rationality of the link, and providing flexible and robust technical support for the entire dairy product traceability chain.

[0175] S42. Based on the rule matching strategy, the applicability threshold rules in the applicability threshold rule base are matched with the dairy product data blocks to obtain the applicability threshold rule set;

[0176] Specifically, the process of matching the applicability threshold rules in the applicability threshold rule base with the dairy product data blocks based on the rule matching strategy to obtain the applicability threshold rule set includes the following steps:

[0177] S421. Parse the block attribute parameters of the dairy product data block and clean the block attribute parameters;

[0178] Specifically, it is necessary to parse the block attribute parameters from the original dairy product data blocks. These parameters typically include, but are not limited to: unique block identifier, product batch number, processing type (such as sterilization, packaging, transportation), responsible party (such as manufacturer or warehouse code), data source (such as manual records or sensor data), timestamp, spatial coordinates, etc. These fields are then extracted in a structured manner to generate standardized data tables or feature vector representations, facilitating subsequent modeling and graph structure embedding.

[0179] Next, attribute parameter cleaning is performed to improve data quality and eliminate redundancy and outliers. The cleaned block attribute parameters will possess good consistency, completeness, and interpretability, serving as standard input for subsequent traceability chain construction, graph generation, and node coupling determination. This step forms the data foundation for the entire dairy product traceability modeling process, directly determining the accuracy and stability of link analysis and path determination.

[0180] S422. Based on the rule-based matching strategy, match the cleaned block attribute parameters with the applicability threshold rules in the applicability threshold rule base;

[0181] Specifically, after parsing and cleaning the attributes of the dairy product blocks, these standardized attribute parameters (such as process type, timestamp, geographic coordinates, data source level, etc.) are encapsulated into structured objects for subsequent rule comparison. Each block will serve as a candidate node and enter the rule matching module. Simultaneously, a pre-established applicability threshold rule library is invoked, containing multi-dimensional rule items such as maximum time interval threshold, spatial jump limit, feature similarity baseline, and trusted data source level. Next, the rule matching strategy engine is activated, using the attribute parameters of each cleaned block as input, and comparing each rule in the rule library to perform a matching judgment. The strategy is divided into two categories: hard matching and soft scoring. Hard matching refers to strong constraints such as a time difference of less than 48 hours and a source level not lower than B; if these conditions are not met, it is marked as a mismatch. Soft scoring measures the matching as a score, such as deducting 0.01 points for each kilometer of location offset. Finally, all rule items are summarized to obtain a comprehensive applicability score.

[0182] Based on the matching results, each block is labeled, such as a complete match, partial match, or no match, and its corresponding matching score, rule violation, and specific parameter deviation information are recorded. For partially matched blocks, they can be either added to a pool of pending nodes for manual confirmation or configured as suboptimal connection options (such as backup edges or low-weight path segments) by the path construction logic. Finally, successfully matched nodes are included as high-applicability nodes in the subsequent traceability link generation, ensuring that each connected node is not only structurally sound but also logically reliable under the rule constraints.

[0183] S423. Summarize and conclude the several matched applicability threshold rules to obtain the applicability threshold rule set;

[0184] Specifically, when constructing a traceability node or path, several rules are matched from the applicability threshold rule base according to the rule matching strategy. These rules involve multiple dimensions such as node time interval, spatial jump, process sequence, trusted data source level, and similarity score. Each rule represents a certain business constraint or tolerance. These activated and applied rules need to be archived, that is, the applicability threshold rule set for the current task needs to be constructed.

[0185] Next, these rules are structured and summarized, mainly including the following: rule name and type (e.g., time continuity rule, spatial jump limit); threshold settings (e.g., no more than 48 hours, distance no more than 50 kilometers); matching status (whether enabled / triggered); scope of impact (applicable to nodes, path segments, or the entire chain); severity level (e.g., whether a violation aborts path construction, or whether it is marked as a low-applicability path). Then, these rules can be further unified and abstractly modeled, representing them as a set of constraint functions with priority and dependencies, constituting a complete set of applicability threshold rules. This set can be stored in a configuration file format for easy reuse, version control, or use for subsequent source tracing strategy comparison and analysis.

[0186] Ultimately, this rule set serves as the basis for evaluation and filtering throughout the entire traceability process, providing unified behavioral standards for execution node selection, path construction, and link optimization. It can also be exported or displayed to operations and maintenance personnel for auditing and adjustment, ensuring that the traceability chain generation process operates within a transparent, compliant, and controllable framework.

[0187] S424. Validate and optimize the applicability threshold rule set, and output the validated and optimized applicability threshold rule set.

[0188] Specifically, the existing set of applicability threshold rules needs to be validated to ensure that all threshold settings are feasible, effective, and do not lead to over-filtering or false positives in actual dairy product traceability tasks. The validation phase typically uses historical traceability cases or labeled datasets to replay existing links, applying each threshold from the rule set to each link, and statistically analyzing the pass rate, false filtering rate, and false retention rate. For example, if a rule with a time interval ≤ 48 hours causes too many actually valid nodes to be filtered out, it will be recorded as a potentially overly strict rule.

[0189] Next, the statistical results collected during the verification phase are analyzed, and threshold optimization strategies are implemented. This process can employ manual adjustment or algorithmic optimization (such as grid search or Bayesian optimization), aiming to balance strictness and coverage. For rules with high false positive rates, the threshold can be appropriately relaxed; while for rules that fail to filter out abnormal paths, the threshold can be tightened or new constraints can be added. Optimization suggestion tags are added to rule items, and recommended threshold adjustment ranges are automatically generated. Then, the rule set reconstruction phase begins, updating the parameter values ​​of each rule item based on the optimization suggestions and eliminating redundant, conflicting, or overfitted sub-rules. For example, spatial jumps ≤50km and delivery links ≤100km are distinguished as conditions under different process stages to avoid incorrect filtering caused by a single global threshold. The reconstructed rule set will have higher task adaptability and more refined scenario adaptability. It will eventually output a verified and optimized applicability threshold rule set. This is a structured and versioned rule set, which includes: the name and type of each rule, the optimized parameter threshold, the scope and conditions of application, the reasons for optimization, and the verification score. This rule set can be directly loaded into the traceability chain construction module to ensure that the entire process of subsequent dairy product traceability path generation, node selection, and path scoring is based on the verified and optimized threshold standards, thereby improving the accuracy of link generation and business availability.

[0190] S43. Extract the link feature index vector from the dairy product traceability link, and use the link feature index vector into the grey relational algorithm to evaluate the applicability of the dairy product traceability link.

[0191] Specifically, extracting the link feature index vector from the dairy product traceability chain and then using the link feature index vector in the grey relational algorithm to evaluate the applicability of the dairy product traceability chain includes the following steps:

[0192] S431. Extract node information and path information from the dairy product traceability chain, and construct a chain feature index vector based on the node information and path information;

[0193] Specifically, the first step is to extract node information, which involves obtaining the core attributes of each node from the traceability chain. These attributes include: node ID (unique identifier), process stage type (e.g., sterilization, packaging, transportation), timestamp (event occurrence time), spatial coordinates (latitude and longitude or geocoding), data source credibility level (sensors, manual input, etc.), and upstream / downstream node references (ID of the previous or next stage). Each node is parsed into a structured object, serving as the basis for subsequent indicator calculations. Next, path information, which describes the link attributes that describe the relationships between nodes, is extracted. Path information mainly includes: path segment ID (unique identifier for node pairs), start and end node IDs, time interval (time difference between two nodes), spatial jump distance (straight-line or network distance between two nodes), process sequence legality identifier (e.g., whether it conforms to the logic of sterilization before packaging), and path confidence score (a comprehensive score based on similarity and credibility). This information is used to measure the continuity and reliability of the link.

[0194] After extracting node and path information, a link feature index vector is constructed based on these two data sets. Each link path can be represented as a set of multi-dimensional indicators, including: average time interval, maximum spatial jump, process diversity (number of participating processes), average node confidence level, minimum path confidence score, and total path length (number of nodes). Each indicator is recorded numerically and combined into a complete vector, serving as crucial input for link quality assessment, classification, and traceability decisions. Ultimately, a set of link feature index vectors for each path is output and compared with an applicability threshold rule base or input into subsequent model analysis. This process ensures that the link is not only structurally correct but also possesses clear and interpretable quantitative indicators, facilitating the monitoring and optimization of the entire dairy product traceability process.

[0195] S432. Generate a reference link indicator vector for applicability comparison based on historical applicability links;

[0196] Specifically, a batch of historical dairy product traceability links that have been verified as high-quality will be selected. These links are usually manually labeled, manually confirmed, or have demonstrated high accuracy in actual traceability tasks, and are called the applicability link sample set. Each sample link includes its complete node sequence, path segments, spatiotemporal information, and process steps.

[0197] Next, structured feature extraction is performed on these historical links. The following key indicators are extracted from each link: average time interval between nodes (representing flow speed), average path jump distance (reflecting spatial continuity), number of process steps (measuring link completeness), minimum / maximum path confidence score, average data source level (reflecting data credibility), and number of nodes (representing link complexity). These feature values ​​are standardized and combined into a multi-dimensional vector, forming the link's suitability index vector. Subsequently, the index vectors of all sample links are normalized and clustered to calculate the mean, variance, and suitability range of different link types. Finally, one or more reference index vectors are obtained, representing the structural feature model that a highly suitable link should possess under different process routes, logistics models, or regulatory standards—that is, a reference suitability index vector set.

[0198] S433. Using the grey relational algorithm, calculate the correlation between the link feature index vector and the reference link index vector to obtain the link applicability score of the dairy product traceability link.

[0199] Specifically, two sets of input data are prepared: one is the link feature index vector to be evaluated, which describes the performance of the dairy product traceability link in multiple dimensions such as time interval, spatial jump, process diversity, node reliability, and path length; the other is the reference link index vector, which is a standard vector summarized from historical high-applicability links, serving as an ideal model for comparison. To eliminate the influence of dimensions, all vectors are first normalized (e.g., min-max standardization or Z-score standardization) to ensure that each index is within a comparable range. Next, the core idea of ​​the grey relational algorithm is sequence similarity analysis. The absolute difference sequence of the two normalized vectors is calculated one by one according to the index dimension, that is, the numerical difference of each dimension. Then, according to the grey relational coefficient formula:

[0200]

[0201] Among them, x i y is the value of the link to be evaluated on the i-th metric. i This represents the reference link's value on the same metric, while min and max are the minimum and maximum values ​​among all differences, and ρ is the discrimination coefficient (usually taken as 0.5). This coefficient measures the similarity between two links on this metric, with a value range of [0, 1]. The closer it is to 1, the closer it is to the reference model. Then, the correlation coefficients of all dimensions are weighted or equally weighted to obtain the overall grey correlation degree, the formula of which is:

[0202]

[0203] Where v represents the number of indicator dimensions, and γ's value is within the range of [0, 1], with a higher value indicating greater similarity to the reference link and higher applicability. This correlation score is defined as the link applicability score of the dairy product traceability link. Ultimately, the link applicability score will be used as a key indicator for traceability link evaluation, used to decide whether to accept the path as a highly reliable traceability result, whether further optimization is needed, or for prioritizing traceability paths.

[0204] S434. Verify and optimize the link suitability score, and output the verified and optimized link suitability score as the basis for subsequent link suitability judgment.

[0205] Specifically, the initial link applicability scores obtained based on grey relational analysis are validated. This process relies on a batch of historical link data samples with real labels, where each link has been marked as high applicability, medium applicability, or inapplicable. These labeled links are compared with their respective applicability scores to construct a score-result mapping curve, evaluating the accuracy, discriminative power, and risk of misjudgment of the applicability scores. Next, optimization and correction are performed. If a certain score range (e.g., 0.65-0.75) is found to have significant confusion or ambiguous judgments, the scoring mechanism needs to be fine-tuned by adjusting the parameters of the grey relational coefficient (e.g., the discrimination coefficient ρ) or adding weight factors (assigning differentiated weights to different dimensions). Alternatively, a regression fitting model or a classification auxiliary model can be introduced to perform nonlinear calibration of the scores, improving their ability to fit actual applicability.

[0206] After optimization, a new suitability score will be recalculated or mapped for each link, and a score grading standard will be established (e.g., ≥0.85 is high suitability, 0.70-0.85 is medium suitability, and <0.70 is a not recommended path). The new scores are closer to actual business judgments and have stronger interpretability and guidance.

[0207] S44. Compare the applicability threshold rule set with the applicability of the dairy product chain to obtain the applicability evaluation result.

[0208] Specifically, the validated and optimized applicability threshold rule set is invoked. This rule set defines the ideal threshold range or lower limit requirements for each characteristic indicator of the link (e.g., average time interval ≤ 48 hours, spatial jump ≤ 50 kilometers, link similarity ≥ 0.85, etc.). At the same time, the final applicability score for each dairy product traceability link is prepared. This is usually calculated and validated using grey relational analysis, and standardized to the [0, 1] range.

[0209] Next, the comparison strategy module is activated to check the link's applicability score against the threshold requirements of the rule set. If the rule requires a minimum applicability score of ≥0.80, it will determine whether the current link score meets this lower limit. If the link score meets all key rules (including mandatory thresholds and preferred ranges), it will be marked as passing the evaluation. For links that do not meet the thresholds, they will be further divided into partially passing (close to the threshold, optimization suggestions are available) or failing (far below the threshold, need to be removed).

[0210] During the comparison process, each matching result is recorded, outputting not only simple pass / fail labels but also a detailed comparison report. For example: applicability score: 0.87, rule threshold: ≥0.80, matching status: pass, exceeds lower limit: +0.07, etc. This report facilitates subsequent manual review, quality traceability, and model iteration. Finally, the output applicability evaluation result includes the link ID, the final applicability score after verification and optimization, the comparison status with each rule item, and a comprehensive evaluation label (e.g., high applicability is acceptable, medium applicability requires review, inapplicable should be removed). This evaluation result will serve as a standard input for subsequent link selection, queuing, pruning, and quality control, ensuring that the dairy product traceability link is business-usable, regulatory-compliant, and model-explainable.

[0211] S5. Optimize and adjust the dairy product traceability chain based on the applicability assessment results, and update the applicability threshold rules;

[0212] Specifically, based on the applicability assessment results obtained from the preliminary comparison, each link is classified and graded. Generally, they can be divided into three categories: high applicability links (scores far exceeding the rule threshold, which can be directly retained); medium applicability links (scores close to the threshold boundary, requiring optimization or manual review); and low applicability links (scores significantly below the threshold, which should be prioritized for removal or replacement). Medium and low applicability links are first screened to determine the source of their problems, such as excessively long time intervals, low path confidence, or inconsistent process logic.

[0213] Next, a link optimization and adjustment mechanism is initiated. Local corrections are performed on links that can be improved, including node optimization (replacing or supplementing missing or low-confidence nodes), path adjustment (reordering path segments, inserting logical transitions, and reducing abnormal jumps), and weight reassessment (re-weighting important indicators such as temporal continuity and spatial proximity to improve the overall score). Through multiple iterations, the adjusted links are ensured to be closer to the reference link model in terms of indicator dimensions. After link adjustments are completed, the grey relational algorithm is applied again to recalculate the applicability score of the optimized links, and the results are compared with the original evaluation records. If the score significantly improves, proving the adjustment is effective, the link can be upgraded to high or medium applicability and formally incorporated into subsequent traceability chains. Finally, based on the empirical data from optimization verification, the applicability threshold rules are updated: rules with overly strict or lenient thresholds are fine-tuned; indicator weight allocation is adjusted according to new link samples; and new constraints (such as minimum node confidence) are incorporated into the rule base. This updated rule set will be saved in versioned form and used as the benchmark for the next round of traceability tasks, ensuring that link judgment is more scientific, flexible, and adaptable. This process enables continuous improvement of the quality of the supply chain and dynamic iteration of threshold rules, providing accurate and reliable decision support for the traceability of the entire dairy product supply chain.

[0214] S6. Based on the optimized dairy product traceability link, trace dairy products and generate multi-level visualized traceability results according to user permission levels.

[0215] Specifically, based on optimized supply chains, precise traceability is implemented. After the structural optimization, applicability assessment, and rule calibration of the dairy product traceability supply chain are completed, precise traceability tracking will be performed based on highly applicable nodes and paths within the chain. Tracing back from the end node of the target product (such as the consumer terminal or outbound record) involves checking all upstream nodes layer by layer along the supply chain path, forming a complete product lifecycle chain. This chain not only includes basic time and process information but also embeds auxiliary information such as data reliability level and spatial trajectory, laying the data foundation for the final traceability display.

[0216] A multi-layered traceability view is constructed, dynamically generating hierarchical, visualized traceability results based on different user roles (such as consumers, regulators, and enterprise quality control personnel) and their permissions and information needs. The consumer view emphasizes simplicity and readability, displaying only key nodes (such as place of origin, production date, testing information, and transportation history); the regulator view displays the complete path, the entire timeline, data reliability levels, and anomaly warning markers; and the quality control personnel view includes details such as process parameters (temperature, sterilization time), node scores, and path confidence scores.

[0217] Meanwhile, the visualization results, centered on a graph structure and supplemented by interactive components such as a timeline, event list, and map trajectory, form a unified traceability interface. The visible information range can be dynamically rendered based on the visitor's identity. It also supports data export and interactive queries, meeting the traceability, compliance audit, and brand display needs of different business scenarios. Furthermore, while users browse the traceability results, a feedback mechanism is supported, allowing the reporting of suspicious points or abnormal nodes in the trace. Feedback results can be used in reverse to learn trace quality, dynamically adjust rules, and retrain the trace applicability model, forming a data closed-loop optimization mechanism. This makes dairy product traceability no longer a static output, but an adaptive and sustainably evolving intelligent traceability system.

[0218] In summary, by utilizing the above-mentioned technical solutions of this invention, the present invention encapsulates dairy product production process data into data blocks and stores them in a blockchain database, ensuring the integrity, traceability, and tamper-proof nature of traceability data, enhancing the data credibility foundation in the dairy product traceability process, and improving the authority of dairy product quality and safety supervision. Simultaneously, by setting a weighted mapping relationship between traceability feature parameters and dairy product data blocks, and combining this with a cosine similarity algorithm for scoring and matching, the feature adaptation accuracy of traceability nodes is improved, thereby realizing customized link construction logic, supporting personalized responses to various traceability needs. Furthermore, based on the time and space parameters of dairy product data, a spatiotemporally coupled self-organizing model is constructed. Leveraging the model's self-organizing capability and scalability, a traceability link with a reasonable structure and optimal path can be dynamically generated in a complex node network, improving the stability, scalability, and timeliness of link construction.

[0219] Furthermore, this invention uses a pre-defined applicability threshold rule base and a grey relational algorithm to comprehensively evaluate the generated traceability links using multiple indicators, achieving a quantitative assessment of the link quality. It can also optimize the rule model through comparative analysis, thereby supporting high-quality iteration and self-learning optimization of the traceability links. Moreover, it generates multi-level visual traceability display schemes based on user permission levels, meeting the visualization needs of different users such as regulatory agencies, consumers, and enterprises, achieving transparent display of traceability information, hierarchical authorization, and ease of use and readability, thereby enhancing public trust.

[0220] 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 spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for tracing dairy products based on blockchain, characterized in that, Includes the following steps: S1. Collect dairy product production process data, divide the dairy product production process data into several dairy product data blocks, and store them in a blockchain database; S2. Analyze the traceability requirements of dairy products, obtain traceability feature parameters, preset a weight database, assign weights to traceability feature parameters and dairy product data blocks, and perform matching based on the weight assignment results; S3. Based on the spatiotemporal coupling self-organizing model, a dynamic traceability link generation mechanism is preset, and a dairy product traceability link is generated based on the matching results; S4. Preset an applicability threshold rule base, and use the applicability threshold rules in the applicability threshold rule base combined with the grey relational algorithm to evaluate the applicability of the dairy product traceability link; S5. Optimize and adjust the dairy product traceability chain based on the applicability assessment results, and update the applicability threshold rules; S6. Based on the optimized dairy product traceability link, trace dairy products and generate multi-level visualized traceability results according to user permission levels.

2. The method for tracing dairy products based on blockchain according to claim 1, characterized in that, The process of analyzing dairy product traceability requirements, obtaining traceability feature parameters, pre-setting a weight database, assigning weights to traceability feature parameters and dairy product data blocks, and matching based on the weight assignment results includes the following steps: S21. Clean the traceability information of dairy products and clarify the traceability requirements. S22. Based on the traceability requirements, set the rules for extracting traceability feature parameters, and extract traceability feature parameters from the traceability information of dairy products according to the rules; S23. Preset the weight database and set the mapping relationship between the traceability feature parameters and the weights; S24. Map the weight values ​​in the weight database to the traceability feature parameters and dairy product data blocks according to the weight mapping relationship; S25. Calculate the feature weight score and block weight score of the mapped traceability feature parameters and dairy product data blocks, and match the mapped traceability feature parameters and dairy product data blocks based on the score similarity.

3. The method for tracing dairy products based on blockchain according to claim 2, characterized in that, The calculation of the mapped traceability feature parameters and the feature weight score and block weight score of the dairy product data block, and the matching of the mapped traceability feature parameters and the dairy product data block based on the score similarity, includes the following steps: S251. Calculate the feature weight score of the source feature parameter based on the mapping weight value, and perform normalization processing. S252. Obtain the traceability feature parameter set in the dairy product data block, and calculate the block weight score of the dairy product data block based on the standardized weight score of each feature parameter in the traceability feature parameter set. S253. Construct feature weight score vectors and block weight score vectors based on feature weight scores and block weight scores; S254. The cosine similarity algorithm is used to calculate the score similarity between the feature weight score vector and the block weight score vector. S255. A preset score similarity judgment threshold is set. When the score similarity is greater than or equal to the similarity judgment threshold, the traceability feature parameters and the dairy product data block are determined to be a matching relationship. When the score similarity is less than the similarity judgment threshold, it is considered a mismatch, and feedback optimization is performed.

4. The method for tracing dairy products based on blockchain according to claim 1, characterized in that, The step of pre-setting a dynamic traceability link generation mechanism based on a spatiotemporal coupling self-organizing model and generating a dairy product traceability link based on the matching results includes the following steps: S31. Construct a spatiotemporally coupled self-organizing model based on the time and spatial parameters in the dairy product data block; S32. Based on the score similarity matching results, select the successfully matched traceability feature parameters and dairy product data blocks, and construct a traceability node set; S33. Based on the spatiotemporal coupled self-organizing model, a dynamic traceability link generation mechanism is set up, and a dairy product traceability link is generated based on the dynamic traceability link generation mechanism. S34. Verify the structural consistency between the traceability node set and the dairy product traceability link, and perform self-organizing optimization on the dairy product traceability link based on the verification results. S35. Output the optimized dairy product traceability link.

5. The method for tracing dairy products based on blockchain according to claim 1, characterized in that, The construction of the spatiotemporally coupled self-organizing model based on the time and spatial parameters in the dairy product data block includes the following steps: S311. Extract the block time parameters and block space parameters from the dairy product data block, and clean the extracted data; S312. Construct a spatiotemporal feature matrix based on the cleaned block time parameters and block spatial parameters; S313. Establish a coupling relationship diagram based on the temporal order and spatial proximity of block time parameters and block spatial parameters; S314. Merge the spatiotemporal feature matrix and the coupling relationship diagram, and set self-organizing rules to obtain a spatiotemporal coupled self-organizing model. S315. Verify and optimize the spatiotemporal coupling self-organizing model, and output the verified and optimized spatiotemporal coupling self-organizing model.

6. The method for tracing dairy products based on blockchain according to claim 5, characterized in that, The process of selecting successfully matched traceability feature parameters and dairy product data blocks based on the scoring similarity matching results, and constructing a traceability node set, includes the following steps: S321. Obtain the rating similarity matching results and set the rating threshold for successful matching; S322. Based on the scoring threshold, select the successfully matched traceability feature parameters and dairy product data blocks; S323. Based on the successfully matched traceability feature parameters and dairy product data blocks, extract node time parameters, node spatial parameters and node association attribute information, and construct a traceability node set. S324. Perform deduplication and structural integrity checks on the source node set, and output the deduplication-checked source node set.

7. The method for tracing dairy products based on blockchain according to claim 6, characterized in that, The step of setting a dynamic traceability link generation mechanism based on the constructed spatiotemporal coupled self-organizing model, and generating a dairy product traceability link based on the dynamic traceability link generation mechanism, includes the following steps: S331. Based on the spatiotemporal coupling self-organizing model and the process chain data in the dairy product data block, a dynamic traceability link generation mechanism is set up. S332. Based on the process chain data, identify the source node and target node for traceability; S333. Generate an initial link path by using a dynamic tracing link generation mechanism to trace the source node and the target node. S334. Perform reachability verification and optimization on the initial link path, and use the optimized initial link path as the dairy product traceability link output.

8. The method for tracing dairy products based on blockchain according to claim 1, characterized in that, The preset applicability threshold rule base, and the use of the applicability threshold rules in the applicability threshold rule base combined with the grey relational algorithm to evaluate the applicability of the dairy product traceability chain, includes the following steps: S41. Based on the traceability requirements of dairy products, construct an applicability threshold rule base and set a rule matching strategy; S42. Based on the rule matching strategy, the applicability threshold rules in the applicability threshold rule base are matched with the dairy product data blocks to obtain the applicability threshold rule set; S43. Extract the link feature index vector from the dairy product traceability link, and use the link feature index vector into the grey relational algorithm to evaluate the applicability of the dairy product traceability link. S44. Compare the applicability threshold rule set with the applicability of the dairy product chain to obtain the applicability evaluation result.

9. A method for tracing dairy products based on blockchain according to claim 8, characterized in that, The rule-based matching strategy involves matching the applicability threshold rules in the applicability threshold rule base with the dairy product data blocks to obtain the applicability threshold rule set, which includes the following steps: S421. Parse the block attribute parameters of the dairy product data block and clean the block attribute parameters; S422. Based on the rule-based matching strategy, match the cleaned block attribute parameters with the applicability threshold rules in the applicability threshold rule base; S423. Summarize and conclude the several matched applicability threshold rules to obtain the applicability threshold rule set; S424. Validate and optimize the applicability threshold rule set, and output the validated and optimized applicability threshold rule set.

10. A method for tracing dairy products based on blockchain according to claim 8, characterized in that, The process of extracting link feature index vectors from the dairy product traceability chain and then using these vectors in a grey relational algorithm to evaluate the suitability of the dairy product traceability chain includes the following steps: S431. Extract node information and path information from the dairy product traceability chain, and construct a chain feature index vector based on the node information and path information; S432. Generate a reference link indicator vector for applicability comparison based on historical applicability links; S433. Using the grey relational algorithm, calculate the correlation between the link feature index vector and the reference link index vector to obtain the link applicability score of the dairy product traceability link. S434. Verify and optimize the link suitability score, and output the verified and optimized link suitability score as the basis for subsequent link suitability judgment.

Citation Information

Patent Citations

  • Big data processing method for authenticity verification and credible traceability and cloud server

    CN112749181A

  • Emergency processing method and system based on multi-block chain cooperation technology

    CN115842844A

  • Dairy product tracing method based on block chain

    CN118822560A

  • A blockchain-based method and system for detecting and tracing medicinal and edible ingredients

    CN119762100A

  • Decentralized talent background survey data storage and verification method and system

    CN119892491A

Cited By

  • Software development test data security verification method based on block chain

    CN121389199A

  • Blockchain-based software development test data security verification method

    CN121389199B

  • Multi-dimensional data integrated work file tracing method and system

    CN121480980A

  • Dairy product producing area tracing method based on characteristic difference

    CN122193364A