Chinese herbal medicine traceability method and system based on knowledge graph and deep learning
By using knowledge graph and deep learning methods, the matching between the physical entity of Chinese herbal medicine and the traceability path is dynamically determined, which solves the problems of insufficient evaluation precision and low robustness in existing technologies and realizes high-precision traceability of the quality status of Chinese herbal medicine.
Patent Information
- Application Number
- CN202611320610.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-11-27
AI Technical Summary
Existing traceability schemes for traditional Chinese medicines struggle to dynamically determine the match between the physical entity and the traceability path, resulting in insufficient precision in quality status assessment. Furthermore, they lack adaptive reconstruction methods when IoT sensor data is missing, reducing the robustness of the traceability results.
This study employs a knowledge graph and deep learning approach to acquire multimodal observation features and traceability information of traditional Chinese medicine (TCM). It then uses a pre-trained spatiotemporal evolution deep learning model to perform temporal state deduction, calculate feature residuals, and dynamically adjust tolerance thresholds to determine whether the physical entity of TCM matches the traceability path.
This improves the precision of quality status assessment of Chinese herbal medicines and the robustness of traceability results, reduces false alarms and false negatives of progressive quality damage that cannot be detected due to fixed thresholds, and ensures the continuity and accuracy of traceability results under non-ideal conditions.
Smart Images

Figure CN123181014A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent traceability and quality safety technology of Chinese medicinal materials, and in particular to a method and system for tracing the origin of Chinese medicinal materials based on knowledge graphs and deep learning. Background Technology
[0002] The supply chain of traditional Chinese medicine (TCM) covers multiple time- and space-bound stages, including harvesting at the place of origin, primary processing at the place of origin, cold chain transportation, and warehousing. Its authenticity and quality stability are crucial to ensuring the efficacy of TCM and the safety of clinical use. With the digital and intelligent upgrading of the supply chain, in the process of cross-regional and long-cycle circulation, the full-process, high-precision, and reliable traceability of the physical phenotype and key components of TCM as they evolve with the environment has become a core technical requirement for the standardized development of the TCM industry.
[0003] Currently, typical traceability solutions for traditional Chinese medicine mainly rely on logistics monitoring systems that combine IoT sensor nodes with blockchain technology. These systems acquire time-series data on the circulation environment by deploying temperature and humidity sensors during warehousing and transportation. They then upload material batch identifiers and environmental data to a centralized database or blockchain ledger, triggering deviation alarms using preset fixed environmental upper limit thresholds, thus enabling the tracking and preservation of material circulation paths and environmental records.
[0004] In practical applications, the aforementioned schemes focus on discrete monitoring and post-event evidence preservation of environmental parameters, with judgment logic primarily based on static threshold comparisons. However, the changes in the physical phenotypes and active ingredients of traditional Chinese medicine during circulation often present a continuous evolutionary process under the cumulative effects of environmental stress and time. Threshold exceedance judgments at a single time point cannot fully reflect the cumulative effects of the superposition of minute fluctuations, potentially affecting the accuracy of material quality status assessment. Furthermore, when IoT sensors experience partial loss of time-series data due to signal obstruction or equipment malfunction, existing systems typically lack adaptive reconstruction methods that combine physical property evolution laws with spatiotemporal correlation information. This can easily lead to discontinuities in the quality deduction of broken segments, thereby reducing the overall robustness of traceability results to some extent. Summary of the Invention
[0005] The purpose of this application is to provide a method and system for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning, so as to solve the problem of difficulty in dynamically determining the matching between traditional Chinese medicine entities and traceability paths.
[0006] To address the aforementioned technical problems, this application provides the following technical solutions: The first aspect of this application provides a method for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning, the method comprising: The multimodal observation features of the Chinese herbal medicine to be tested are obtained, and the traceability path information corresponding to the Chinese herbal medicine to be tested is extracted; wherein, the traceability path information includes at least the harvesting time, the initial place of origin node, and the time series sequence of the logistics environment; Based on the source tracing path information, spatiotemporal state evolution constraints corresponding to the source tracing path information are matched in a pre-constructed knowledge graph of Chinese herbal medicine evolution; wherein, the spatiotemporal state evolution constraints include at least the benchmark phenotypic parameters characterizing the physical properties of the initial place of origin, and the physical change rules characterizing the phenotypic evolution trend with environment and time. The source tracing path information and the spatiotemporal state evolution constraints are input into a pre-trained spatiotemporal evolution deep learning model. Using the baseline phenotypic parameters as the initial state, the model performs a time-series state deduction along the logistics environment time sequence under the evolutionary constraints of the physical change rules, and outputs the expected current phenotypic features of the Chinese herbal medicine under the circulation history. Calculate the feature residuals between the multimodal observation features and the expected current phenotypic features, and calculate the spatiotemporal evolution tolerance threshold that matches the source tracing path information based on the spatiotemporal state evolution constraints; Determine whether the feature residual exceeds the spatiotemporal evolution tolerance threshold; if it does, determine that the herbal medicine under test has a traceability anomaly where the physical entity does not match the traceability path information.
[0007] A second aspect of this application provides a system for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning, the system comprising: The traceability information acquisition module is used to acquire multimodal observation features of the Chinese herbal medicine to be tested and extract the traceability path information corresponding to the Chinese herbal medicine to be tested; wherein, the traceability path information includes at least the harvesting time, the initial place of origin node, and the time sequence of the logistics environment; The spatiotemporal evolution constraint matching module is used to match the spatiotemporal state evolution constraints corresponding to the source tracing path information in a pre-constructed knowledge graph of Chinese herbal medicine evolution based on the source tracing path information; wherein, the spatiotemporal state evolution constraints include at least the benchmark phenotypic parameters characterizing the physical properties of the initial place of origin, and the physical change rules characterizing the phenotypic evolution trend with the environment and time. The expected phenotypic feature inference module is used to input the source tracing path information and the spatiotemporal state evolution constraints into a pre-trained spatiotemporal evolution deep learning model. With the benchmark phenotypic parameters as the initial state, it performs time-series state inference along the time sequence of the logistics environment under the evolutionary constraints of the physical change rules, and outputs the expected current phenotypic features of the Chinese herbal medicine to be tested under the circulation history. The residual and threshold calculation module is used to calculate the feature residual between the multimodal observation features and the expected current phenotypic features, and to calculate the spatiotemporal evolution tolerance threshold that matches the source path information based on the spatiotemporal state evolution constraints. The traceability anomaly determination module is used to determine whether the feature residual exceeds the spatiotemporal evolution tolerance threshold; if it does, it is determined that the Chinese herbal medicine under test has a traceability anomaly where the physical entity does not match the traceability path information.
[0008] Compared to existing technologies, the method and system for tracing the origin of traditional Chinese medicine (TCM) provided in this application, based on knowledge graphs and deep learning, treats the phenotypic changes of TCM during its circulation as a physical evolution process continuously driven by the physical property benchmarks of the place of origin and environmental stress. It matches the corresponding spatiotemporal state evolution constraints in the TCM evolution knowledge graph with the traceability path information, uses a pre-trained deep learning model to deduce the expected current phenotypic features along the time sequence of the logistics environment, and compares the residual between the actual multimodal observation features and the expected features with the tolerance threshold dynamically adjusted with the circulation history to determine whether the physical entity matches the traceability path information. The aforementioned methods replace the static threshold comparison at a single time point in existing technologies with continuous evolutionary deduction. This allows the cumulative effect of small fluctuations in environmental stress over time to be incorporated into the deduction process, thereby reducing false alarms and missed alarms caused by the inability to detect gradual quality damage due to fixed thresholds, and improving the precision of the quality status assessment of traditional Chinese medicine. At the same time, through the physical property evolution laws and spatiotemporal correlation information provided by the knowledge graph, when there are local gaps in the time series data of the logistics environment, the missing segments can be reconstructed by interpolation in accordance with physical property constraints, avoiding the interruption and expansion of deviation in the quality deduction of broken chain segments, and improving the continuity and robustness of traceability results under non-ideal perception conditions. Attached Figure Description
[0009] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of this application are illustrated by way of example and not limitation, with the same or corresponding reference numerals denoteing the same or corresponding parts, wherein: Figure 1 A flowchart illustrating a method for tracing the origins of traditional Chinese medicine based on knowledge graphs and deep learning is shown schematically. Figure 2 The diagram illustrates the structure of a traditional Chinese medicine traceability system based on knowledge graphs and deep learning. Detailed Implementation
[0010] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0011] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains.
[0012] The methods described in the embodiments of this application will be explained in detail below.
[0013] This embodiment provides a method for tracing the origin of traditional Chinese medicine (TCM) based on knowledge graphs and deep learning. This method can be applied to tasks related to quality traceability and entity consistency determination of TCM in scenarios such as TCM planting bases, primary processing plants at the place of origin, cold chain transportation, warehousing and logistics centers, hospital pharmacies, and third-party quality inspection agencies. In this embodiment, the algorithm processing task can be flexibly deployed on cloud servers or edge computing terminals such as testing equipment and warehouse management terminals, according to the actual needs of the scenario. The task is completed collaboratively between the cloud server and each testing / management terminal through a wireless communication network.
[0014] Step 110: Obtain the multimodal observation features of the Chinese herbal medicine to be tested, and extract the traceability path information corresponding to the Chinese herbal medicine to be tested; wherein, the traceability path information includes at least the harvesting time, the initial place of origin node, and the time sequence of the logistics environment.
[0015] Specifically, this step is used to collect the current physical and biochemical phenotypic characteristics of the Chinese herbal medicine to be tested through multimodal sensing and detection equipment, and to retrieve the traceability and circulation records of the batch in conjunction with the batch certificate.
[0016] The multimodal observation features include at least two of the following: optical image features characterizing the surface color and microstructure of the herbal medicine under test; near-infrared spectral absorption band features characterizing the secondary metabolites and molecular structure of the herbal medicine under test; and electromagnetic microwave response features characterizing the water content state of the herbal medicine under test. Considering that the quality changes of herbal medicine during the circulation process involve multiple physical dimensions such as appearance, internal composition, and water state, a single modal feature is difficult to fully describe the current physical state and is easily affected by environmental interference. Therefore, this embodiment preferably collects the above three types of features simultaneously to form cross-dimensional complementarity and improve the robustness of subsequent consistency determination.
[0017] The acquisition of multimodal observation features specifically includes: using an industrial optical camera to image the tested Chinese herbal medicine from multiple angles, extracting its surface color distribution and epidermal microtexture to obtain optical image features; using a near-infrared spectrometer to collect diffuse reflectance spectra in the 900nm to 1700nm wavelength range to obtain near-infrared spectral absorption band features characterizing secondary metabolites and molecular structures; and using a microwave moisture analyzer to detect the bound water state inside the material and obtain the electromagnetic microwave response characteristics of water content. The collected feature data are then denoised, normalized, and stitched together to obtain the multimodal observation feature vector of the tested Chinese herbal medicine.
[0018] The extraction of traceability path information specifically includes: reading the batch electronic tag on the packaging using an RFID reader or barcode scanning terminal to obtain a unique batch identifier, and then querying and parsing the traceability path information registered for that batch from a traceability database or a distributed blockchain evidence storage system based on this identifier. This traceability path information includes a harvest timestamp recording the harvest date, initial origin node information containing the latitude and longitude of the origin and the plot number, and a logistics environment time series continuously recorded by vehicle-mounted or package-embedded IoT environmental sensors at a preset sampling period; the logistics environment time series includes temperature time series, relative humidity time series, and cumulative irradiance time series data arranged chronologically.
[0019] Finally, the multimodal observation feature vector of the Chinese herbal medicine under test and the traceability path data package containing harvesting time, initial origin node information and logistics environment time sequence are output as data input for subsequent spatiotemporal evolution constraint matching and state inference.
[0020] Step 120: Based on the source tracing path information, match the spatiotemporal state evolution constraints corresponding to the source tracing path information in the pre-constructed Chinese herbal medicine evolution knowledge graph; wherein, the spatiotemporal state evolution constraints include at least the benchmark phenotypic parameters characterizing the properties of the initial place of origin, and the physical change rules characterizing the phenotypic evolution trend with environment and time.
[0021] This step, based on the traceability path information obtained in step 110, matches the corresponding spatiotemporal state evolution constraints in the pre-constructed traditional Chinese medicine (TCM) evolution knowledge graph. This TCM evolution knowledge graph consists of origin nodes and directed evolutionary relationship edges. Origin nodes carry baseline phenotypic parameters corresponding to the origin and harvest time, used to characterize the physical property baseline of the batch of TCM at its initial origin. Directed evolutionary relationship edges connect adjacent physical property state nodes, representing the process of material moving from one flow node to the next, and carrying physical change rules of phenotypic changes with environment and time. Matching spatiotemporal state evolution constraints includes two parts: first, locating the target origin node based on the initial origin and harvest time, and reading the baseline phenotypic parameters; second, traversing the evolutionary relationship edges along the time sequence of the logistics environment, and extracting phenotypic change rate parameters as physical change rules.
[0022] The following detailed explanation of the process of matching spatiotemporal state evolution constraints in this step, in conjunction with specific implementation methods, further illustrates the following: Step 121: Based on the initial place of origin and harvesting time in the traceability path information, locate the corresponding target place of origin node in the Chinese herbal medicine evolution knowledge graph, and read the node attribute set attached to the target place of origin node as the baseline phenotypic parameter.
[0023] Specifically, the initial origin identifier and harvest timestamp are extracted from the traceability information, and the geographical coordinates and harvest timestamp corresponding to the initial origin identifier are mapped to the corresponding phenological period or solar term, which together serve as the joint retrieval key. A graph database query engine is used to perform node matching operations in a pre-constructed knowledge graph of the evolution of traditional Chinese medicine, locating the target origin entity node that precisely corresponds to the spatial location and harvest time of the production area.
[0024] After localization, the pre-attached node attribute set on the target origin node is read. This node attribute set may include: initial color space distribution characteristics, initial surface texture roughness index, initial moisture content baseline value, and initial spectral absorption peak distribution in a specific band. These attributes correspond to the baseline reference values for surface color, apparent texture, absorption spectrum, and moisture content dimensions in subsequent multimodal observation features. Finally, the read attributes are structured, encapsulated, and vectorized to generate a baseline phenotypic parameter vector, which serves as the initial state input for subsequent spatiotemporal state deduction.
[0025] Step 122: Based on the logistics environment time sequence in the traceability path information, sequentially traverse the evolutionary relationship edges that match the logistics environment time sequence in the traditional Chinese medicine evolution knowledge graph, and extract the phenotypic change rate parameters attached to the evolutionary relationship edges as physical change rules.
[0026] In the knowledge graph of the evolution of Chinese herbal medicine, evolutionary relationship edges connect adjacent physical property state nodes, representing the process of material moving from one flow node to the next; the phenotypic change rate parameter attached to each relationship edge is the expected change rate of the material's phenotypic characteristics under the environmental conditions of that flow segment.
[0027] In practice, the logistics environment time series is divided into several continuous time intervals according to the time sequence. The ambient temperature, relative humidity and cumulative irradiance in each time interval are used as matching conditions. Evolutionary relationship edges that connect adjacent physical property state nodes and have the same environmental stress range are retrieved in the graph.
[0028] During the traversal, phenotypic change rate parameters attached to each evolutionary relationship are read and extracted. These parameters describe the rate of change of phenotypic characteristics of traditional Chinese medicine under specific environmental factors over a unit of time. Specifically, they include at least one of the following parameters: a surface color decay rate coefficient characterizing the effect of environmental temperature, used to quantitatively describe the rate at which the surface color of the material darkens under temperature thermal stress; a tissue moisture loss rate coefficient characterizing the effect of environmental humidity, used to quantitatively describe the rate of tissue moisture evaporation and loss under the influence of humidity gradient; and a natural pigment photodegradation rate coefficient characterizing the effect of environmental light, used to quantitatively describe the photochemical degradation rate of endogenous pigment molecules under light radiation.
[0029] The aforementioned phenotypic change rate parameters can be obtained through postharvest physiological experiments on the same variety of Chinese herbal medicine under different environmental stress conditions, or by fitting the correlation between historical logistics monitoring data and concurrent multimodal observation characteristics, or by extracting data from publicly available literature on the metamorphic kinetics of medicinal materials. When constructing a knowledge graph of the evolution of Chinese herbal medicine, these parameters are pre-loaded into the corresponding evolutionary relationship edge attributes according to the origin node, variety type, and environmental conditions of the circulation section, so that they can be directly called upon during subsequent traversal and extraction.
[0030] In a preferred embodiment, the physical change rules may further include an effective component degradation function determined based on the Arrhenius reaction rate equation, used to quantify the attenuation and loss of the effective components of the medicinal material due to accumulated environmental thermal stress, and a nonlinear water evaporation kinetic model determined based on the environmental temperature and humidity distribution, used to dynamically quantify the rate of water dispersion and weight loss in the material tissue. The aforementioned kinetic functions and models can be used in conjunction with the aforementioned phenotypic change rate coefficients to jointly constitute the physical change rules for the dynamic changes in the phenotypic and composition of traditional Chinese medicine during circulation.
[0031] Finally, the phenotypic change rate parameters extracted from each evolutionary relationship edge along the way are spliced together in the order of the logistics time series interval to form a dynamic evolution parameter sequence. This sequence serves as a physical change rule that constrains the phenotypic evolution process of the Chinese herbal medicine under test throughout its entire circulation life cycle. It is then output to the subsequent deep learning model deduction stage and, together with the baseline phenotypic parameters output in step 121, serves as the input for step 130.
[0032] In summary, this step transforms the discretely recorded supply chain flow trajectory into continuous state evolution conditions constrained by post-harvest physiological laws and environmental response dynamics. This provides initial states and evolutionary boundaries for subsequent time-series state extrapolation of deep learning models, preventing the extrapolation results from deviating from the actual physical property changes of traditional Chinese medicine.
[0033] Step 130: Input the source tracing path information and the spatiotemporal state evolution constraints into the pre-trained spatiotemporal evolution deep learning model. Using the baseline phenotypic parameters as the initial state, perform temporal state deduction along the time sequence of the logistics environment under the evolutionary constraints of the physical change rules, and output the expected current phenotypic features of the Chinese herbal medicine under the circulation history.
[0034] This step employs a pre-trained spatiotemporal evolution deep learning model to extrapolate the phenotypic changes of the tested Chinese herbal medicines during their circulation process. This model can utilize a spatiotemporal graph neural network incorporating physical priors or a recurrent neural network based on physical information. The network structure possesses the ability to transmit hidden states along the time dimension, used to describe the cumulative changes in phenotypic characteristics of Chinese herbal medicines under the continuous influence of multiple environmental factors such as temperature, humidity, and light.
[0035] During the model pre-training phase, environmental monitoring data from historical circulation batches and corresponding phenotypic detection data are used for joint training. Simultaneously, the training set can be expanded by incorporating controlled temperature and humidity accelerated aging test samples. In addition to the phenotypic prediction error term, the loss function also introduces an irreversible decay constraint term for physical properties, ensuring the network maintains compliance with physical laws while learning data features.
[0036] During the simulation, the baseline phenotypic parameters obtained in step 121 are used as the initial state variables. The physical change rules obtained in step 122 are then organized into a rule vector according to time steps. The state is updated step by step along the time series of the logistics environment. For the t-th time step interval, the phenotypic feature state vector at the beginning of that interval is used as the basis. As input, combined with the environmental stress vector within this interval and corresponding physical change rule vector The state at the end of the interval is obtained through model calculation. The state update relationship can be represented as: ; in, This is the phenotypic feature state vector derived at the current time step; This is the phenotypic feature state vector from the previous time step; This is the environmental stress vector composed of the ambient temperature, relative humidity, and cumulative irradiance corresponding to the current time step; This is the vector of physical change rules at the current time step extracted from the evolutionary knowledge graph; For the nonlinear state transfer function of the deep learning model; These are the learnable weight parameters for the model; This is an element-wise modulation operator used to constrain the gradient of hidden layer state changes in the network through physical change rules, so as to avoid the inference results deviating from the actual range of physical property changes of Chinese herbal medicines.
[0037] The simulation process iterates continuously along the time axis from the start of harvesting to the current detection time, and finally outputs the expected current phenotypic feature vector of the Chinese herbal medicine to be tested under the complete circulation history, which serves as a comparison benchmark for subsequent feature residual calculation.
[0038] Step 140: Calculate the feature residual between the multimodal observation features and the expected current phenotypic features, and calculate the spatiotemporal evolution tolerance threshold that matches the source tracing path information based on the spatiotemporal state evolution constraints.
[0039] This step calculates the feature residuals between the multimodal observation features obtained in step 110 and the expected current phenotypic features derived in step 130, and calculates the spatiotemporal evolution tolerance threshold that matches the current source tracing path information based on spatiotemporal state evolution constraints.
[0040] Specifically, the phenotypic changes of Chinese herbal medicines during circulation include both a deterministic degradation trend determined by environmental stress and cumulative uncertainties caused by factors such as random fluctuations in temperature and humidity and sensor measurement errors. Therefore, it is necessary to first align and differ the actual observed features with the expected phenotypic features in a multidimensional feature space to obtain feature residuals that reflect the degree of deviation of the physical entity; then, using the historical environmental fluctuation data and circulation duration information contained in the spatiotemporal state evolution constraints, the cumulative uncertainty is converted into the tolerance interval width corresponding to the circulation history, thereby generating a spatiotemporal evolution tolerance threshold that adaptively adjusts with the actual circulation situation.
[0041] The following detailed explanation of the process for calculating the characteristic residuals in this step, in conjunction with specific implementation methods, further illustrates the following: Step 141: Calculate the component deviations between the multimodal observed features and the expected current phenotypic features in the dimensions of surface color, apparent texture, absorption spectrum, and water content.
[0042] Multimodal observation features include three categories: optical image features, near-infrared spectral absorption band features, and water content electromagnetic microwave response features. Optical image features are further subdivided into two deviation calculation dimensions: surface color and apparent texture. Near-infrared spectral absorption band features correspond to the absorption spectrum dimension, and water content electromagnetic microwave response features correspond to the water content dimension, for a total of four deviation dimensions. In practice, four sub-features—surface color, apparent texture, absorption spectrum, and water content—are first extracted from the multimodal observation feature vector and the expected current phenotypic feature vector, and then aligned and differencing them dimension by dimension.
[0043] For the surface color dimension, the actual collected color features and the expected color features are uniformly mapped to the CIELAB color space, and the color difference distance between the two on the lightness axis, red-green axis and yellow-blue axis is calculated respectively to obtain the surface color component deviation, which is used to reflect the degree of darkening and fading of the material surface due to oxidation or pigment degradation.
[0044] For the apparent texture dimension, the actual apparent texture features and the expected apparent texture features are calculated by vector inner product and cosine distance in the texture feature space composed of local binary mode features and gray-level co-occurrence matrix features. The apparent texture component deviation is used to reflect the degree of deformation such as epidermal shriveling and wrinkling caused by tissue moisture loss.
[0045] For the absorption spectrum dimension, the actual near-infrared absorption spectral response data and the expected spectral characteristics are differentially analyzed band by band at continuous wavelengths, and the root mean square error and spectral angular distance of the whole band are calculated to obtain the absorption spectral component deviation, which is used to reflect the degree of degradation of endogenous secondary metabolites during the circulation process.
[0046] For the moisture content dimension, the difference between the actual measured internal bound water state parameters and the corresponding moisture content benchmark value in the expected current phenotypic characteristics is calculated to obtain the moisture content component deviation, which is used to reflect the degree of deviation between the internal bound water state of the material structure and the theoretically deduced state.
[0047] Finally, the component deviations obtained from the above four dimensions are combined into a component deviation vector, which serves as the input for subsequent variety-differentiated weighted fusion calculations.
[0048] Step 142: Match the physical sensitivity weight coefficients corresponding to each dimension component according to the variety type of the Chinese herbal medicine to be tested; wherein, the physical sensitivity weight coefficients are used to characterize the differences in the degradation sensitivity of the Chinese herbal medicine to be tested under different physical dimensions with time and environmental changes.
[0049] Specifically, based on the variety of the Chinese herbal medicine to be tested, the physical sensitivity weight coefficients corresponding to the four dimensions of surface color, apparent texture, absorption spectrum and moisture content are matched to form the physical sensitivity weight coefficient vector corresponding to that variety.
[0050] In practice, the variety identification and medicinal part classification of the Chinese herbal medicine to be tested are first analyzed, and the sensitivity weight configuration corresponding to that variety is queried in the physical property parameter database of the Chinese herbal medicine evolution knowledge graph. The physical sensitivity weight coefficient is used to characterize the difference in degradation sensitivity of the Chinese herbal medicine variety under different physical dimensions with time and environmental changes.
[0051] For example, for flowering and fruiting herbs such as honeysuckle and safflower, or herbs rich in pigments, the surface of their medicinal parts is rich in natural pigments such as anthocyanins and flavonoids. These pigments are extremely sensitive to light, heat, and oxygen, and are easily oxidized and degraded during the transfer process, causing the petals to change from bright to dark brown or fade. Surface color change is the most direct and core indicator of quality deterioration for this type of herb, and should have the highest weight in deviation assessment. Therefore, the weight of the surface color dimension can be set to 0.5 to 0.6. Meanwhile, changes in components such as pigment degradation and loss of volatile oils will cause changes in near-infrared spectral absorption characteristics, but the distinguishability of these changes is usually slightly lower than that of direct color changes. Therefore, the weight of the absorption spectrum dimension is secondary, set at 0.3. Flowering and leafing herbs rarely show obvious epidermal shrinkage or shriveling deformation during transfer, and the weight of the surface texture dimension is correspondingly lower, set at 0.1 to 0.2. The initial moisture content of this type of herb is inherently low, and moisture fluctuations have a limited impact on overall quality assessment; the weight of the moisture content dimension is set at 0.05 to 0.15.
[0052] For rhizomatous Chinese medicinal herbs such as ginseng and angelica, their tissues are dense and have a high initial moisture content. Their active ingredients are mainly saponins, polysaccharides, and volatile oils. During the handling process, these active ingredients are susceptible to hydrolysis or oxidative degradation due to temperature and humidity. Simultaneously, moisture evaporation can cause deformation such as grooving and wrinkling of the epidermis. These two changes have the most significant impact on the quality of rhizomatous medicinal materials, while surface color is relatively stable and changes less. Therefore, the absorption spectrum dimension, reflecting changes in components, should be given the highest weight, set at 0.45 to 0.5; the apparent texture dimension, reflecting the degree of moisture loss and deformation, has the next highest weight, set at 0.35 to 0.4; the surface color dimension has a weight of 0.1 to 0.2; and the moisture content dimension, as an auxiliary confirmation indicator, has its information partially reflected through the texture and spectral dimensions, with a weight of 0.05 to 0.1.
[0053] The general principles for setting the weights mentioned above include: prioritizing the primary degradation dimension, meaning that the physical dimension most prone to degradation and having the greatest impact on quality during the circulation of the variety is given the highest weight; information complementarity, meaning that overlapping dimensions are avoided from repeatedly occupying high weights, so that the weight of each dimension reflects the degree to which it independently provides quality information; normalization constraint, meaning that the sum of the weights of each dimension is 1, ensuring the comparability of feature residuals between different varieties; and adjustability, meaning that the weight configuration can be pre-set in the knowledge graph and can also be further optimized and adjusted according to actual test data.
[0054] Step 143: Based on the physical sensitivity weight coefficient, perform weighted fusion calculation on the component deviations of each dimension to obtain a comprehensive deviation evaluation value that expresses the degree of deviation between the current physical entity and the expected evolution, which is used as the feature residual.
[0055] Specifically, based on the physical sensitivity weighting coefficient, the deviations of each dimension obtained in step 141 are weighted and fused to obtain a comprehensive deviation evaluation value, which is used as the feature residual.
[0056] This embodiment uses a weighted sum of squares and square root method to calculate the comprehensive deviation evaluation value. The formula is: ; in, This is the comprehensive deviation evaluation value; These are the physical sensitivity weighting coefficients for surface color, apparent texture, absorption spectrum, and moisture content, respectively. These are the component deviations for the corresponding dimensions in step 141. The sum of all weight coefficients is 1.
[0057] Using the above formula, the dimensions with larger deviations are squared and magnified to make them occupy a more significant proportion in the comprehensive result. At the same time, the weighting coefficient is used to suppress the interference of insensitive dimensions, and finally a scalarized feature residual is obtained, which is used for subsequent comparison with the spatiotemporal evolution tolerance threshold.
[0058] The following section, in conjunction with specific implementation methods, further explains the process of calculating the spatiotemporal evolution tolerance threshold in this step: Step 144: Extract historical environmental fluctuation benchmark data corresponding to the initial place of origin node and the logistics environment time series from the knowledge graph of Chinese herbal medicine evolution.
[0059] In practice, the process begins by analyzing the transportation start time, logistics nodes along the route, and seasonal periods in the time series of the logistics environment, using spatial paths and time periods as joint retrieval conditions. Then, historical environmental statistics for the same geographical area and month period as the current transportation route are queried from the knowledge graph. These historical environmental statistics can be derived from pre-stored regional meteorological statistics and historical flow monitoring records.
[0060] The extracted historical environmental fluctuation benchmark data can include: the root mean square deviation of temperature and humidity in the target production area during historical harvest seasons, the typical temperature fluctuation range of the logistics transportation route in the same month, the probability of humidity abrupt changes, the standard deviation of illuminance fluctuations, the normal fluctuation range of relative humidity, and the inherent environmental disturbance benchmark caused by geographical and climatic differences in specific routes. The role of historical environmental fluctuation benchmark data is to provide a normal environmental fluctuation benchmark for the actual logistics environment under the corresponding season, thereby helping the system to determine whether the current circulation environment deviates from the normal state, and adaptively adjust the tolerance threshold accordingly, so that the final traceability anomaly judgment is neither too lenient nor too harsh.
[0061] Finally, the historical environmental statistical indicators extracted from each section along the route are packaged into historical environmental fluctuation benchmark data according to the flow topology order, which serves as a reference input for subsequent assessment of the deviation of the actual logistics environment and dynamic adjustment of tolerance limits.
[0062] Step 145: Evaluate the environmental deviation of the logistics environment time sequence during the flow process.
[0063] In practice, the actual environmental parameters at each sampling moment in the logistics environment time series are compared with the corresponding historical environmental benchmark values. For the first... Calculate the actual temperature at each sampling time. Compared with historical temperature benchmark average The absolute difference, the actual relative humidity Compared with historical humidity baseline average The absolute difference, the actual cumulative illuminance Compared with historical average illumination The absolute difference; then divide each absolute difference by the corresponding temperature standard deviation in the historical fluctuation baseline data. Humidity standard deviation Standard deviation of light This yields the standardized deviation of each dimension at that moment.
[0064] The environmental deviation is obtained by summing the standardized deviations at each sampling time along the entire flow time series and then averaging them. : ; in, This represents the total number of valid sampling moments in the time sequence of the logistics environment. The first The historical baseline mean values for temperature, humidity, and illumination at each sampling time are derived from the historical environmental fluctuation baseline data extracted in step 144. These represent the corresponding historical temperature standard deviation, historical humidity standard deviation, and historical light standard deviation, respectively.
[0065] By dividing by the historical standard deviation for dimensionless processing, the deviations of environmental parameters with different physical dimensions are unified to the same scale. This allows for the filtering out of routine small-scale environmental fluctuations and highlights extreme stress abrupt changes caused by equipment failure, carriage damage, or abnormal exposure to sunlight. The final environmental deviation is... This serves as the input control variable for subsequent dynamic adjustment of the spatiotemporal evolution tolerance threshold.
[0066] Step 146: Based on the historical environmental fluctuation benchmark data and the environmental deviation, perform time-series cumulative adjustment on the preset benchmark tolerance limit along the circulation history to generate a spatiotemporal evolution tolerance threshold that matches the current circulation history; wherein, the tolerance range width of the spatiotemporal evolution tolerance threshold adaptively widens as the environmental deviation or circulation duration increases.
[0067] In practice, the spatiotemporal evolution tolerance threshold is calculated using the following formula. : ; in, This serves as the final spatiotemporal evolution tolerance threshold. The baseline tolerance limit is a preset value for the Chinese herbal medicine variety to be tested, representing the inherent phenotypic deviation that is allowed under ideal standard circulation conditions. The environmental deviation obtained in step 145; This represents the total cumulative circulation time of the material from the time of harvest to the current detection time. The standard transportation reference time corresponding to this circulation path can be read from the knowledge graph of the evolution of traditional Chinese medicine. The environmental deviation adjustment coefficient is preferably set between 0.3 and 0.8. The time accumulation expansion factor is preferably in the range of 0.2 to 0.5, and is used to control the extent to which the increase in circulation time widens the tolerance range.
[0068] After normalization by historical standard deviation, Using a value between 0.3 and 0.8 can keep the impact of environmental deviations on the threshold within a reasonable range, avoiding false alarms due to being too small or false negatives due to being too large. Within the typical range of changes, Setting the value to 0.2 to 0.5 can make the broadening effect of the time accumulation effect on the threshold moderate, preventing the threshold from being too narrow or too wide. The specific value can also be mapped based on the overall variance in the historical environmental fluctuation benchmark data extracted in step 144. The greater the historical inherent fluctuation, The value is increased accordingly, making the threshold more tolerant of fluctuations in normal environments; Then, fine-tuning is made based on the variety's sensitivity to cumulative degradation over time.
[0069] Through the aforementioned multiplicative adjustment mechanism, when the environmental deviation increases during the actual circulation process, or the cumulative circulation time is significantly longer than the standard transportation time, the spatiotemporal evolution tolerance threshold is adjusted. The tolerance range is correspondingly increased, thus reasonably accommodating normal accelerated degradation of materials under harsh or long-term circulation conditions. Conversely, when the circulation environment is stable and the duration is close to the standard value, the threshold remains narrow to ensure the ability to detect minor deviations in physical properties. The final spatiotemporal evolution tolerance threshold serves as a benchmark for subsequent judgments on whether characteristic residuals exceed the standard.
[0070] In summary, the tolerance judgment boundary determined in step 140 is no longer a fixed value, but dynamically widens as the degree of environmental deviation and the duration of circulation increase. This avoids misjudging normal quality degradation occurring under harsh transportation conditions as traceability anomalies, and also avoids missing material property discrepancies caused by mid-transit substitutions or other issues due to excessively wide thresholds. This provides a comparative benchmark with both sensitivity and anti-interference capabilities for subsequent traceability anomaly judgment.
[0071] Step 150: Determine whether the feature residual exceeds the spatiotemporal evolution tolerance threshold; if it does, determine that the herbal medicine under test has a traceability anomaly where the physical entity does not match the traceability path information.
[0072] Specifically, this step compares the feature residuals obtained in step 143 with the spatiotemporal evolution tolerance threshold generated in step 146 to determine whether the feature residuals exceed the tolerance range.
[0073] The judgment logic is as follows: if the feature residual is less than or equal to the spatiotemporal evolution tolerance threshold, it means that the actual physical phenotypic deviation of the tested Chinese herbal medicine is still within the normal range that can be explained by the circulation history, and it can be determined that its physical entity is consistent with the traceability path information; if the feature residual exceeds the spatiotemporal evolution tolerance threshold, it means that the actual observed physical property deviation can no longer be reasonably explained by the environmental stress and time accumulation effect in the normal circulation process, and it is determined that the tested Chinese herbal medicine has a traceability anomaly where the physical entity does not match the traceability path information.
[0074] It should be noted that steps 151 to 153 are subsequent processing branches executed when the feature residuals do not exceed the spatiotemporal evolution tolerance threshold; steps 154 to 156 are subsequent processing branches executed when the feature residuals exceed the spatiotemporal evolution tolerance threshold. These two branches are executed independently of each other based on the determination result of step 150. Therefore, there is no sequential connection between steps 154 and 153 in terms of their numbering.
[0075] In one implementation, when it is determined in step 150 that the feature residuals do not exceed the threshold, the baseline drift of the place of origin can be monitored by combining the feature residual distribution of consecutive batches from the same place of origin. If a consistency deviation trend is confirmed, the baseline phenotypic parameters in the knowledge graph are adaptively calibrated. The specific implementation method will be described in subsequent embodiments. The following, in conjunction with specific implementation methods, further explains the process of adaptively calibrating and updating the knowledge graph of traditional Chinese medicine evolution when it is determined that the feature residuals do not exceed the spatiotemporal evolution tolerance threshold: Step 151: When it is determined that the feature residual does not exceed the spatiotemporal evolution tolerance threshold, the feature residual distribution of consecutive preset batches of Chinese herbal medicines of the same variety originating from the same initial place of origin is statistically analyzed.
[0076] When it is determined that the characteristic residuals of the current batch do not exceed the spatiotemporal evolution tolerance threshold, the characteristic residual data of that batch is included in the origin physical property stability statistical queue. In specific implementation, the initial origin node identifier and variety type code are used as the aggregation key, and a sliding statistical window for the corresponding origin and variety is maintained in the background. The window length can be set according to the actual statistical significance requirements, for example, taking 10 to 30 consecutive batches. When the number of batches of the same origin and variety that have passed the verification consecutively within the window reaches the preset value, the characteristic residuals of these batches in terms of surface color, apparent texture, absorption spectrum, and moisture content are extracted in time sequence. After time sequence alignment, the mean, variance, and deviation direction of the residuals in each dimension are calculated to form a characteristic residual distribution matrix.
[0077] The feature residual distribution matrix is used to determine whether the initial origin node has a physical property baseline drift caused by climate change during the growing season, and serves as the data basis for adaptive calibration of the corresponding baseline phenotypic parameters in the knowledge graph.
[0078] Step 152: When the characteristic residuals of consecutive preset batches show a consistent deviation trend, it is determined that the initial origin node has a physical property baseline drift caused by climate change during the growing season.
[0079] This step, based on the characteristic residual distribution matrix, performs a consistency analysis on the deviation trends of consecutive batches within a statistical window. Specifically, it extracts the signed component deviations of each batch within the window in the dimensions of surface color, apparent texture, absorption spectrum, and moisture content, and calculates the positive and negative consistency ratios of the deviation directions for each dimension. When more than a preset proportion (e.g., 85%) of samples in consecutive batches within the same dimension exhibit deviations in the same direction, and the dispersion of the residuals for each batch is below a preset stability threshold, it indicates that these deviations are systematic and not caused by random measurement noise or occasional disturbances in individual batches.
[0080] If the aforementioned consistency deviations occur simultaneously across multiple dimensions, or persist in at least one core quality dimension among surface color, apparent texture, and absorption spectrum, it is determined that the initial production node experienced changes in climatic conditions such as accumulated temperature, precipitation, and sunshine during the corresponding growing season, leading to an overall deviation of the natural phenotypic background of the produced material from the historical baseline. This indicates a baseline drift in physical properties caused by climate change during the growing season. In this case, a baseline drift diagnostic signal is generated, and the physical dimension and direction of the deviation are recorded as the basis for subsequent calibration.
[0081] Step 153: Based on the average offset of the feature residuals, adaptively calibrate and update the baseline phenotypic parameters of the corresponding initial origin nodes in the Chinese herbal medicine evolution knowledge graph.
[0082] Specifically, once it is determined that there is a baseline drift in physical properties at the initial origin node, the baseline phenotypic parameters of that origin node in the knowledge graph of Chinese herbal medicine evolution are calibrated and updated based on the average offset of consecutive batches within the statistical window.
[0083] In practice, the average residual vectors of each batch within the statistical window are first calculated separately for surface color, apparent texture, absorption spectrum, and moisture content, to obtain the average offset vector. Then, update the baseline phenotypic parameters as follows: ; in, This is the calibrated reference phenotypic parameter vector; The original baseline phenotypic parameter vector currently stored in the knowledge graph is the baseline value used as the initial state quantity in step 121. The average offset vector contains the mean deviations of each dimension: surface color, apparent texture, absorption spectrum, and moisture content. The adaptive calibration coefficient is preferably in the range of 0.1 to 0.3.
[0084] The value is determined based on the number of batches within the statistical window and the variance of residual fluctuations. Its actual function is to apply damping smoothing to the offset, so that the reference parameters are updated only with the gradual changes in the climate of the place of origin, avoiding high-frequency oscillations or over-correction of the spectral reference due to a few extreme batches.
[0085] After the calculation is completed, The baseline attribute fields of the corresponding initial origin node and variety in the knowledge graph are written back, overwriting the original baseline phenotypic parameters. When new batches originating from this origin are read from the baseline parameters in step 121 and subsequently extrapolated, the updated baseline values can be directly called, ensuring that the traceability judgment baseline is consistent with the actual physical property levels under the current climatic conditions of this origin.
[0086] On the other hand, when it is determined in step 150 that the feature residual exceeds the spatiotemporal evolution tolerance threshold, steps 154 to 156 are executed to complete the abnormal evidence storage and risk handling.
[0087] Step 154: Generate a source diagnosis log containing the excess amount of the feature residuals and the abnormal flow node segments.
[0088] In practice, the excess of the characteristic residual relative to the spatiotemporal evolution tolerance threshold is first calculated. This excess can be expressed as an absolute difference or a relative percentage of excess, reflecting the degree of physical property anomaly. At the same time, the component deviations of surface color, apparent texture, absorption spectrum, and moisture content are compared to determine the main physical dimensions that cause the residual to exceed the limit.
[0089] Subsequently, a reverse search is performed along the time sequence of the logistics environment. Combining the topology of the circulation path and the environmental monitoring data of each section and storage node, sections with sudden increases in environmental deviation, continuous temperature and humidity exceeding the safe range, abnormally high illuminance, or abnormal long-term stagnation are identified and located as abnormal circulation node sections.
[0090] Finally, the batch unique identifier, detection timestamp, deviation of each dimension component, excess of feature residuals, main abnormal dimensions, start and end times and location information of abnormal flow node segments, corresponding operation responsibility party identifiers, and abnormal risk level codes are structurally encapsulated to generate a traceability and diagnostic log. This log is used for subsequent early warning and control instruction generation and blockchain evidence storage.
[0091] Step 155: Generate a traceability early warning control instruction based on the traceability diagnosis log and send it to the warehouse logistics management system to lock the entry and exit permissions and circulation status of the batch of materials corresponding to the Chinese herbal medicine to be tested.
[0092] In practice, the unique batch identifier, current cargo location or transport vehicle information, and abnormal risk level are extracted from the traceability diagnostic log. This information is then encapsulated according to a preset system integration interface protocol into a traceability early warning control command containing a batch freeze instruction, a blocking reason code, and an isolated cargo location assignment. Subsequently, this command is pushed to the warehouse logistics management system in real time via a message queue or application programming interface.
[0093] After receiving and verifying the instruction, the warehouse logistics management system modifies the status of the batch of materials in the database to frozen or isolated, revokes its related permissions such as outbound, picking, allocation, transfer, and inbound shelving, and triggers alarms or interlocks at inbound / outbound gates, sorting lines, or handheld terminal interfaces to prevent abnormal materials from entering subsequent circulation stages. After execution, the system returns a control execution confirmation receipt, forming a complete closed loop for abnormal batch management.
[0094] Step 156: Trigger the supply chain traceability contract in the distributed traceability blockchain, write the traceability diagnostic log and anomaly judgment result into the blockchain ledger, and freeze the digital traceability certificate corresponding to the Chinese herbal medicine to be tested.
[0095] In practice, the traceability diagnostic logs, anomaly judgment results, excess feature residuals, and detection timestamps are standardized, their encrypted hash digests are calculated, and the quality inspection nodes digitally sign them before broadcasting them to the blockchain network. After the blockchain consensus nodes verify the legality of the transactions, they execute the anomaly handling logic in the pre-deployed supply chain traceability contract and write the traceability diagnostic logs and their hash values into the blockchain ledger.
[0096] In addition, after retrieving the corresponding digital traceability certificate based on the batch's unique identifier, the contract changes its state from active to frozen in the on-chain state machine and attaches the index key value of the anomaly diagnosis log to the certificate's metadata. Subsequently, when downstream enterprises, regulatory agencies, or end users scan the code to query, they can receive risk warning information containing on-chain evidence hashes and anomaly details.
[0097] Finally, the system outputs on-chain confirmation credentials that record the block height and transaction hash value, as well as frozen digital traceability credentials, completing the blockchain evidence storage and credential status locking for abnormal batches.
[0098] In a preferred embodiment, to address the situation where local data loss may occur in the time series of logistics environments due to reasons such as sensor power failure, signal blockage, or communication interruption, this embodiment also provides a data compensation and tolerance adjustment mechanism.
[0099] When the logistics environment time series extracted in step 110 has local missing parts, step 160 can be executed before step 120 to perform data interpolation to complete the data, so that the subsequent spatiotemporal evolution deep learning model can continuously perform state inference. At the same time, considering that the interpolated data itself introduces the uncertainty of prediction, step 170 can be executed after step 146 and before step 150. The spatiotemporal evolution tolerance threshold is adaptively widened according to the duration of the missing period or the proportion of missing data, so as to transform the data uncertainty into a reasonable relaxation of the judgment boundary and avoid normal materials being misjudged as abnormal due to the interruption of objective data.
[0100] The specific implementation of this mechanism is described below.
[0101] Step 160: When there are local data gaps in the logistics environment time series, retrieve historical environmental statistics data corresponding to the same time period and the same transfer route in the traditional Chinese medicine evolution knowledge graph, and interpolate to fill in the locally missing data.
[0102] In practice, the completeness of the logistics environment time series is first verified to locate the start and end times of the missing intervals and the corresponding transit segments, and the duration of the missing time is recorded. Using the season and month, day and night time, and geographical identifier of the segment where the missing period is located as search criteria, the temperature, humidity, and light intensity statistics of the segment in the same historical period and area are queried in the Chinese herbal medicine evolution knowledge graph.
[0103] Using the immediately preceding and following valid measured data points as boundary anchors, and combining them with the changing trends of historical statistical data, the environmental parameters of each sampling point within the missing period are smoothly interpolated and reconstructed. This ensures that the completed curve remains continuous at the boundary, avoiding abrupt numerical changes. The final result is a logistics environment time series with continuous timestamps and complete numerical values, which is used for subsequent environmental deviation calculations and state extrapolation.
[0104] Step 170: Adaptively widen the permissible range of the spatiotemporal evolution tolerance threshold according to the duration of the missing period or the proportion of missing data.
[0105] After data completion in step 160, the data missing ratio is calculated based on the duration of the identified missing time periods. This is the ratio of the cumulative missing duration of each missing period to the total cumulative circulation time since harvesting. The spatiotemporal evolution tolerance threshold obtained in step 146 is calculated using the following formula. Make corrections: ; in, The corrected spatiotemporal evolution tolerance threshold is used for the final feature residual comparison; The missing risk compensation coefficient is preferably set between 0.1 and 0.4. The specific value can be determined based on the sensitivity level of the herbal medicine variety to environmental fluctuations; the higher the sensitivity, the lower the risk. The larger the value, the better. In actual logistics scenarios, the range of values for this parameter is typically between 5% and 30%, with missing data rates usually ranging from 5% to 30%. The product of the missing percentage and the tolerance threshold directly determines the extent to which the tolerance threshold is widened. A value less than 0.1 indicates insufficient threshold widening under moderate data loss, making it difficult to effectively compensate for the risk of misjudgment caused by interpolation errors; if A threshold greater than 0.4 excessively broadens the threshold when data loss is severe, potentially weakening the ability to detect genuine data swapping or adulteration anomalies. Therefore, a range of 0.1 to 0.4 strikes a balance between data loss tolerance and the stringency of anomaly detection. The specific value can also be adjusted within this range based on the sensitivity level of the herbal medicine variety to environmental fluctuations. The higher the sensitivity, the larger the value should be.
[0106] This correction widens the tolerance range as the proportion of missing data increases, thus incorporating interpolation estimation bias into the judgment boundary and preventing compliant materials from being misjudged as abnormal due to missing objective data. The corrected threshold is then passed to step 150 to replace the original threshold for feature residual comparison.
[0107] This application views the phenotypic changes of Chinese herbal medicines during circulation as a physical evolution process continuously driven by the physical property benchmarks of the place of origin and environmental stress. It matches the corresponding spatiotemporal state evolution constraints in the knowledge graph of Chinese herbal medicine evolution with the traceability path information, uses a pre-trained deep learning model to deduce the expected current phenotypic features along the time sequence of the logistics environment, and compares the residual between the actual multimodal observation features and the expected features with the tolerance threshold dynamically adjusted with the circulation history to determine whether the physical entity matches the traceability path information. The aforementioned methods replace the static threshold comparison at a single time point in existing technologies with continuous evolutionary deduction. This allows the cumulative effect of small fluctuations in environmental stress over time to be incorporated into the deduction process, thereby reducing false alarms and missed alarms caused by the inability to detect gradual quality damage due to fixed thresholds, and improving the precision of the quality status assessment of traditional Chinese medicine. At the same time, through the physical property evolution laws and spatiotemporal correlation information provided by the knowledge graph, when there are local gaps in the time series data of the logistics environment, the missing segments can be reconstructed by interpolation in accordance with physical property constraints, avoiding the interruption and expansion of deviation in the quality deduction of broken chain segments, and improving the continuity and robustness of traceability results under non-ideal perception conditions.
[0108] Based on the same inventive concept, as an implementation of the above-mentioned method for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning, this application also provides a system for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning. Figure 2 This is a structural diagram of the system in an embodiment of this application. See also... Figure 2 As shown, the system includes: The traceability information acquisition module is used to acquire multimodal observation features of the Chinese herbal medicine to be tested and extract the traceability path information corresponding to the Chinese herbal medicine to be tested; wherein, the traceability path information includes at least the harvesting time, the initial place of origin node, and the time sequence of the logistics environment; The spatiotemporal evolution constraint matching module is used to match the spatiotemporal state evolution constraints corresponding to the source tracing path information in a pre-constructed knowledge graph of Chinese herbal medicine evolution based on the source tracing path information; wherein, the spatiotemporal state evolution constraints include at least the benchmark phenotypic parameters characterizing the physical properties of the initial place of origin, and the physical change rules characterizing the phenotypic evolution trend with the environment and time. The expected phenotypic feature inference module is used to input the source tracing path information and the spatiotemporal state evolution constraints into a pre-trained spatiotemporal evolution deep learning model. With the benchmark phenotypic parameters as the initial state, it performs time-series state inference along the time sequence of the logistics environment under the evolutionary constraints of the physical change rules, and outputs the expected current phenotypic features of the Chinese herbal medicine to be tested under the circulation history. The residual and threshold calculation module is used to calculate the feature residual between the multimodal observation features and the expected current phenotypic features, and to calculate the spatiotemporal evolution tolerance threshold that matches the source path information based on the spatiotemporal state evolution constraints. The traceability anomaly determination module is used to determine whether the feature residual exceeds the spatiotemporal evolution tolerance threshold; if it does, it is determined that the Chinese herbal medicine under test has a traceability anomaly where the physical entity does not match the traceability path information.
[0109] This application views the phenotypic changes of Chinese herbal medicines during circulation as a physical evolution process continuously driven by the physical property benchmarks of the place of origin and environmental stress. It matches the corresponding spatiotemporal state evolution constraints in the knowledge graph of Chinese herbal medicine evolution with the traceability path information, uses a pre-trained deep learning model to deduce the expected current phenotypic features along the time sequence of the logistics environment, and compares the residual between the actual multimodal observation features and the expected features with the tolerance threshold dynamically adjusted with the circulation history to determine whether the physical entity matches the traceability path information. The aforementioned methods replace the static threshold comparison at a single time point in existing technologies with continuous evolutionary deduction. This allows the cumulative effect of small fluctuations in environmental stress over time to be incorporated into the deduction process, thereby reducing false alarms and missed alarms caused by the inability to detect gradual quality damage due to fixed thresholds, and improving the precision of the quality status assessment of traditional Chinese medicine. At the same time, through the physical property evolution laws and spatiotemporal correlation information provided by the knowledge graph, when there are local gaps in the time series data of the logistics environment, the missing segments can be reconstructed by interpolation in accordance with physical property constraints, avoiding the interruption and expansion of deviation in the quality deduction of broken chain segments, and improving the continuity and robustness of traceability results under non-ideal perception conditions.
[0110] This application also provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a program for a method for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning. When the processor executes the computer program, it implements all the steps in the aforementioned method for tracing the origin of traditional Chinese medicine based on knowledge graphs and deep learning, such as S110 to S150 and their sub-steps. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the aforementioned system embodiments.
[0111] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0112] The electronic device may be a computing device such as a server or cloud server deployed in a knowledge graph and deep learning-based traditional Chinese medicine traceability system. The electronic device may include, but is not limited to, processors and memory. Those skilled in the art will understand that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the electronic device may also include data acquisition cards and output cards for connecting sensors and actuators, network communication devices, buses, etc.
[0113] The processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (OPGs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the electronic device, connecting various parts of the entire electronic device via various interfaces and lines.
[0114] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to system usage, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart memory card, secure digital card, flash memory card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0115] Wherein, if the modules / units integrated in the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0116] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for tracing the origin of traditional Chinese medicinal herbs based on knowledge graphs and deep learning, characterized in that, The method includes: The multimodal observation features of the Chinese herbal medicine to be tested are obtained, and the traceability path information corresponding to the Chinese herbal medicine to be tested is extracted; wherein, the traceability path information includes at least the harvesting time, the initial place of origin node, and the time series sequence of the logistics environment; Based on the source tracing path information, spatiotemporal state evolution constraints corresponding to the source tracing path information are matched in a pre-constructed knowledge graph of Chinese herbal medicine evolution; wherein, the spatiotemporal state evolution constraints include at least the benchmark phenotypic parameters characterizing the physical properties of the initial place of origin, and the physical change rules characterizing the phenotypic evolution trend with environment and time. The source tracing path information and the spatiotemporal state evolution constraints are input into a pre-trained spatiotemporal evolution deep learning model. Using the baseline phenotypic parameters as the initial state, the model performs a time-series state deduction along the logistics environment time sequence under the evolutionary constraints of the physical change rules, and outputs the expected current phenotypic features of the Chinese herbal medicine under the circulation history. Calculate the feature residuals between the multimodal observation features and the expected current phenotypic features, and calculate the spatiotemporal evolution tolerance threshold that matches the source tracing path information based on the spatiotemporal state evolution constraints; Determine whether the feature residual exceeds the spatiotemporal evolution tolerance threshold; if it does, determine that the herbal medicine under test has a traceability anomaly where the physical entity does not match the traceability path information.
2. The method according to claim 1, characterized in that, The multimodal observation features include at least two of the following features: Optical image features characterizing the surface color and microstructure of the Chinese herbal medicine under test; The near-infrared spectral absorption band characteristics characterize the secondary metabolites and molecular structure of the Chinese herbal medicines to be tested; The electromagnetic microwave response characteristics of the water content, which characterize the state of bound water inside the Chinese herbal medicine to be tested.
3. The method according to claim 1, characterized in that, The step of matching the spatiotemporal state evolution constraints corresponding to the source path information in the pre-constructed knowledge graph of Chinese herbal medicine evolution based on the source path information includes: Based on the initial place of origin and harvesting time in the traceability path information, the corresponding target place of origin node is located in the Chinese herbal medicine evolution knowledge graph, and the node attribute set attached to the target place of origin node is read as the baseline phenotypic parameter. Based on the logistics environment time sequence in the traceability path information, the evolutionary relationship edges that match the logistics environment time sequence are sequentially traversed in the traditional Chinese medicine evolution knowledge graph, and the phenotypic change rate parameters attached to the evolutionary relationship edges are extracted as physical change rules.
4. The method according to claim 3, characterized in that, The phenotypic rate of change parameter includes at least one of the following parameters: A coefficient characterizing the rate of surface color decay under the influence of ambient temperature; The coefficient characterizing the rate of tissue moisture loss under the influence of environmental humidity; The photodegradation rate coefficient of natural pigments characterizing the effect of ambient light.
5. The method according to claim 1, characterized in that, The calculation of the feature residuals between the multimodal observed features and the expected current phenotypic features includes: Calculate the component deviations between the multimodal observed features and the expected current phenotypic features in the dimensions of surface color, apparent texture, absorption spectrum, and water content, respectively. Based on the variety type of the Chinese herbal medicine to be tested, the physical sensitivity weight coefficients corresponding to each dimension component are matched; wherein, the physical sensitivity weight coefficients are used to characterize the differences in the degradation sensitivity of the Chinese herbal medicine to be tested under different physical dimensions with time and environmental changes; Based on the physical sensitivity weighting coefficient, the component deviations of each dimension are weighted and fused to obtain a comprehensive deviation evaluation value that expresses the degree of deviation between the current physical entity and the expected evolution, which serves as the feature residual.
6. The method according to claim 1, characterized in that, The step of calculating the spatiotemporal evolution tolerance threshold that matches the source tracing path information based on the spatiotemporal state evolution constraints includes: Historical environmental fluctuation benchmark data corresponding to the initial place of origin node and the time sequence of the logistics environment are extracted from the knowledge graph of the evolution of traditional Chinese medicine. Assess the environmental deviation of the aforementioned logistics environment time series during the circulation process; Based on the historical environmental fluctuation benchmark data and the environmental deviation, the preset benchmark tolerance limit is adjusted over time along the circulation history to generate a spatiotemporal evolution tolerance threshold that matches the current circulation history. The tolerance range of the spatiotemporal evolution tolerance threshold is adaptively widened as the environmental deviation or the duration of the flow increases.
7. The method according to claim 1, characterized in that, After determining whether the feature residual exceeds the spatiotemporal evolution tolerance threshold, the method further includes: When it is determined that the feature residual does not exceed the spatiotemporal evolution tolerance threshold, the feature residual distribution of consecutive preset batches of the same type of Chinese herbal medicine originating from the same initial place of origin is statistically analyzed. When the characteristic residuals of consecutive preset batches show a consistent deviation trend, it is determined that the initial production node has a physical property baseline drift caused by climate change during the growing season; Based on the average offset of the feature residuals, the baseline phenotypic parameters of the corresponding initial origin nodes in the Chinese herbal medicine evolution knowledge graph are adaptively calibrated and updated.
8. The method according to claim 1, characterized in that, After determining that the physical entity of the herbal medicine to be tested does not match the traceability path information, the method further includes: Generate a source diagnosis log containing the excess amount of the aforementioned feature residuals and abnormal flow node segments; The traceability diagnosis log is used to generate a traceability early warning control instruction and send it to the warehouse logistics management system to lock the entry and exit permissions and circulation status of the corresponding batch of the Chinese herbal medicine to be tested. Trigger the supply chain traceability contract in the distributed traceability blockchain, write the traceability diagnostic log and anomaly judgment results into the blockchain ledger, and freeze the digital traceability certificate corresponding to the Chinese herbal medicine to be tested.
9. The method according to claim 1, characterized in that, After extracting the traceability path information corresponding to the Chinese herbal medicine to be tested, the method further includes: When there are local data gaps in the logistics environment time series, historical environmental statistics data corresponding to the same time segment and the same transfer route corresponding to the missing time period are retrieved from the Chinese herbal medicine evolution knowledge graph, and the locally missing data is interpolated to fill in the missing data. The permissible range of the spatiotemporal evolution tolerance threshold is adaptively widened based on the duration of the missing period or the proportion of missing data.
10. A traceability system for traditional Chinese medicine based on knowledge graphs and deep learning, characterized in that, The system includes: The traceability information acquisition module is used to acquire multimodal observation features of the Chinese herbal medicine to be tested and extract the traceability path information corresponding to the Chinese herbal medicine to be tested; wherein, the traceability path information includes at least the harvesting time, the initial place of origin node, and the time sequence of the logistics environment; The spatiotemporal evolution constraint matching module is used to match the spatiotemporal state evolution constraints corresponding to the source tracing path information in a pre-constructed knowledge graph of Chinese herbal medicine evolution based on the source tracing path information; wherein, the spatiotemporal state evolution constraints include at least the benchmark phenotypic parameters characterizing the physical properties of the initial place of origin, and the physical change rules characterizing the phenotypic evolution trend with the environment and time. The expected phenotypic feature inference module is used to input the source tracing path information and the spatiotemporal state evolution constraints into a pre-trained spatiotemporal evolution deep learning model. With the benchmark phenotypic parameters as the initial state, it performs time-series state inference along the time sequence of the logistics environment under the evolutionary constraints of the physical change rules, and outputs the expected current phenotypic features of the Chinese herbal medicine to be tested under the circulation history. The residual and threshold calculation module is used to calculate the feature residual between the multimodal observation features and the expected current phenotypic features, and to calculate the spatiotemporal evolution tolerance threshold that matches the source path information based on the spatiotemporal state evolution constraints. The traceability anomaly determination module is used to determine whether the feature residual exceeds the spatiotemporal evolution tolerance threshold; if it does, it is determined that the Chinese herbal medicine under test has a traceability anomaly where the physical entity does not match the traceability path information.
