Blockchain-based pharmaceutical supply chain traceability management method and system

By collecting, purifying, and structuring drug trajectory records, a drug circulation link is generated and a data block structure is dynamically designed. The behavior of key business roles is analyzed, which solves the shortcomings of existing technologies in drug supply chain compliance assessment and achieves efficient and quantifiable drug traceability management.

CN121836758BActive Publication Date: 2026-05-15SHAANXI SCI TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHAANXI SCI TECH UNIV
Filing Date
2026-03-16
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing drug supply chain traceability systems are unable to conduct in-depth compliance analysis of the specific business roles recorded on the chain, resulting in regulatory agencies and end users lacking effective basis for judging the authenticity and compliance level of the circulation process. Furthermore, the unified data structure leads to incomplete information records or wasted storage resources.

Method used

The system collects the original trajectory records of drugs flowing through each node, performs purification and structuring operations, and generates a purified set of structured events. It generates drug circulation links based on preset event association logic, dynamically designs data block structures to match node requirements, and generates on-chain data blocks. It parses on-chain files to extract key business role operation behavior sequences, compares them with preset rules to determine compliance, and calculates traceability credibility metrics.

Benefits of technology

It achieves flexible adaptability and efficient storage for the pharmaceutical supply chain, can automatically assess the compliance of key business roles, provide quantifiable quality and trust evaluation criteria, and improves the system's storage space utilization efficiency and data processing timeliness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121836758B_ABST
    Figure CN121836758B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of drug traceability based on blockchain, in particular to a drug supply chain traceability management method and system based on blockchain, comprising: purifying and structuring the events of the drug flowing through each node, and linking them into a complete circulation link in time sequence. According to the specific business and regulatory requirements of each node in the link, the data content and frequency required to be recorded are dynamically determined, and a special data block structure matching the same is designed to encapsulate the information. All data blocks are connected in sequence to form an unalterable circulation file. Finally, by analyzing the file to extract the behavior sequence of each key business role, comparing with the preset rules to determine compliance, and calculating the traceability credibility quantitative value of the batch of drug supply chain, the method realizes fine adaptation of data storage and objective quantification of traceability credibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain-based drug traceability technology, and more particularly to a blockchain-based drug supply chain traceability management method and system. Background Technology

[0002] The current pharmaceutical supply chain traceability field widely adopts blockchain technology to ensure data immutability by recording key events on the chain. Mainstream solutions pre-define a uniform data format, with all nodes recording information according to this fixed structure and generating blocks at a fixed frequency. This static model shows limitations in complex scenarios involving multiple types of nodes, including production, warehousing, logistics, distribution, and end-users. Different nodes have substantial differences in their business nature, compliance requirements, and data generation rhythms. A uniform data structure often leads to incomplete information records or the generation of numerous invalid fields, resulting in wasted storage resources. Furthermore, the fixed block generation frequency is difficult to match the varying rhythms of data recording required on the chain, from high-frequency production operations to low-frequency logistics status updates, affecting data timeliness and overall system efficiency.

[0003] The current system's trustworthiness primarily relies on the tamper-proof nature of blockchain technology, focusing on verifying the existence of data and the continuity of the chain. However, this approach cannot conduct in-depth compliance analysis of the operational behaviors of specific business roles reflected in the on-chain records. The pharmaceutical distribution process is constrained by multiple complex business rules and regulatory provisions. Traditional technologies struggle to reconstruct the complete behavioral sequences of specific roles from discrete event records and automatically compare them with established rules. Therefore, existing solutions remain at the data presentation stage, unable to generate objective quantitative assessments of the overall compliance of the supply chain and the trustworthiness of traceable data. This leaves regulatory agencies and end-users lacking effective evidence to judge the authenticity and compliance level of the distribution process. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing a blockchain-based method and system for pharmaceutical supply chain traceability management.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: a blockchain-based pharmaceutical supply chain traceability management method, comprising:

[0006] Collect the original trajectory records generated by the flow of drugs through each node, perform purification and structuring operations, and generate a purified set of structured events;

[0007] Based on the preset event association logic, the purified structured event set is linked sequentially to generate a drug circulation link with causal relationship and continuous time attribute.

[0008] Based on the business attributes and regulatory requirements of different nodes in the drug circulation chain, the data dimensions and recording density required for each node are determined, and the data block structure carrying the information of the node is dynamically designed so that the internal partitions of the data block structure correspond to the data dimensions and the generation frequency of the data blocks matches the recording density.

[0009] The event information of each node in the drug circulation chain is formatted and encapsulated according to the designed data block structure to generate on-chain data blocks for the location nodes;

[0010] The on-chain data blocks generated by all location nodes are aggregated and linked in a blockchain-style manner according to time sequence and circulation relationship to form an on-chain immutable archive reflecting the complete circulation process of medicines;

[0011] The system analyzes the immutable files on the blockchain, extracts the operational behavior sequence of each key business role in the supply chain network, compares it with the pre-set rules for the drug distribution process, determines the compliance of the behavior of each key business role, and then calculates the traceability reliability quantification value for a specified batch of drugs in the supply chain.

[0012] Preferably, the step of performing cleansing and structuring operations to generate a cleaned-up structured event set includes:

[0013] The original trajectory record includes drug identification, physical environment parameters, information of the personnel handling the operation, and a timestamp.

[0014] Identify outlier data points in the original trajectory record caused by sensor malfunctions or input errors;

[0015] An analysis method based on the context of nearby events is used to correct or remove outlier data points;

[0016] Identify and merge duplicate record entries generated at different time points for the same operation event in the original trajectory record;

[0017] Record entries that have been corrected, eliminated, and merged are reorganized according to a unified field template to generate standardized event record units;

[0018] Based on the continuity of timestamps between event recording units, the standardized event recording units are initially sorted to form the purified structured event set.

[0019] Preferably, the step of linking the purified structured event set sequentially based on preset event association logic to generate a drug circulation link with causal relationships and continuous time attributes includes:

[0020] Define standardized input and output event types for each location node in the supply chain network;

[0021] Traverse the purified structured event set and classify the events into input or output events of the corresponding nodes based on the occurrence location and content of the event record unit.

[0022] Based on the identifier of the drug entity, all event record units belonging to the same drug entity are grouped;

[0023] Within each group, the output events of the previous node and the input events of the next node are logically matched and linked according to the order of timestamps.

[0024] Verify the temporal continuity and logical causality of the linked event sequence, fill in missing logical links or mark the locations of logical breakpoints, and generate the drug circulation link.

[0025] Preferably, the dynamically designed data block structure carrying location node information includes:

[0026] Assign a separate block data field to each dimension in the data dimension;

[0027] Based on the record density, set the data filling trigger conditions for the block data fields. High record density corresponds to event-triggered filling, and low record density corresponds to periodic filling.

[0028] Configure a link field for recording the hash value of the preceding block and a header field for recording the metadata of this block for each data block structure;

[0029] Based on the business attributes of location nodes, define the specific additional verification information fields required to be included in their data block structure to form a complete block structure template.

[0030] Preferably, the step of formatting and encapsulating the event information of each location node in the drug circulation chain according to the designed data block structure to generate on-chain data blocks for the location nodes includes:

[0031] When an event that meets the data filling trigger condition occurs at a location node, or when a periodic filling time point is reached, the data block generation process is triggered.

[0032] Extract the latest event information corresponding to the location nodes in the drug circulation chain;

[0033] Based on the block structure template of the location node, the latest extracted event information is filled into the corresponding block data field;

[0034] Calculate the header field information of the block to be generated and fill the link field with the hash value of the previously generated on-chain data block;

[0035] A hash operation is performed on the entire filled data block to generate a unique digital fingerprint of the data block. This digital fingerprint is then used as part of the data block for final encapsulation to obtain the on-chain data block of the location node.

[0036] Preferably, the on-chain data blocks generated by all location nodes are linked in a blockchain-style manner according to time sequence and circulation relationship to form an immutable on-chain archive reflecting the complete circulation process of the drug, including:

[0037] Collect on-chain data blocks generated by all relevant location nodes throughout a complete drug distribution cycle;

[0038] Using the unique identifier of the drug entity as an index, all collected on-chain data blocks are categorized.

[0039] Under each drug category, the events are first arranged in strict chronological order according to the timestamps of the events recorded in each chain data block.

[0040] Secondly, verify the flow logic relationship between data blocks on adjacent chains in the timing arrangement to ensure that the output state of the previous data block matches the input state of the next data block.

[0041] The verified, chronologically and logically arranged sequence of on-chain data blocks is cryptographically linked using the preceding hash value linking field contained within each data block to form an irreversible blockchain strip, which serves as the on-chain immutable archive.

[0042] Preferably, the unalterable files on the parsing chain extract the operational behavior sequence of each key business role in the supply chain network, including:

[0043] Based on the predefined mapping relationship between key business roles and location nodes, the on-chain data blocks corresponding to all location nodes under the responsibility of a specific key business role are selected from the immutable on-chain archives.

[0044] Analyze each filtered on-chain data block and extract operation behavior records that record operation actions, operation objects, operation time and operation results;

[0045] According to the time sequence, all the extracted operation behavior records are sorted and linked together to form the initial operation behavior sequence of the key business role;

[0046] The system merges and abstracts consecutive similar operations in the initial operation sequence, retains independent operations with time intervals, and generates a normalized operation sequence.

[0047] Preferably, the comparison with pre-set drug distribution process rules to determine the compliance of the behavior of each key business role includes:

[0048] The pre-defined rules for the drug distribution process are decomposed into a set of specific constraints applicable to different key business roles. Each constraint includes a triggering scenario, a set of permitted operations, and a set of prohibited operations.

[0049] Iterate through each operational behavior record in the standardized operational behavior sequence of key business roles;

[0050] For the current operation behavior record, determine its triggering scenario based on the operation time and the operation object;

[0051] Match the specific actions in the current operation behavior record with the set of permitted operations and the set of prohibited operations in the triggering scenario;

[0052] If the action exists in the set of permitted actions, the action is marked as compliant; if the action exists in the set of prohibited actions, or no matching item is found in the set of permitted actions, the action is marked as non-compliant.

[0053] Compliance flags are collected from all operational records of key business roles, and a compliance assessment report for each key business role is generated.

[0054] Preferably, the step of further calculating the traceability reliability quantification value for a specified batch of drug supply chain includes:

[0055] Based on the compliance assessment report for each key business role, the ratio of the number of compliant operations performed by the key business role in the circulation process of a specified batch of drugs to the total number of operations is calculated to generate the role behavior compliance rate.

[0056] Based on the predefined business role weight allocation table, determine the weight coefficient of each key business role in the supply chain traceability credibility assessment;

[0057] The compliance rate of each key business role is weighted and summed with its corresponding weight coefficient to generate a preliminary supply chain credibility score.

[0058] Extract event integrity indicators from the immutable files on the blockchain for a specified batch of drugs. The event integrity indicators are obtained by calculating the ratio of the number of events actually recorded to the number of events that should theoretically be recorded.

[0059] The timestamp continuity index is extracted from the on-chain immutable archive. The timestamp continuity index is calculated by detecting whether the time interval between adjacent event records exceeds a preset threshold.

[0060] The preliminary supply chain credibility score, event integrity index, and timestamp continuity index are input into a pre-trained credibility quantification model for multi-dimensional fusion calculation to generate the traceability credibility quantification value for the specified batch of drug supply chain.

[0061] Preferably, the present invention also includes a blockchain-based drug supply chain traceability management system, the system including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor, when executing the computer program, implements the steps of the blockchain-based drug supply chain traceability management method described above.

[0062] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0063] Differentiated data block internal structures and generation frequencies are customized for different business nodes. The set of data fields required by the node corresponds to the block partition, and the data uploading rhythm matches the block generation frequency. This eliminates the problems of field redundancy or record missing caused by a uniform data structure, making the data stored on the chain highly refined and fully aligned with the actual business of the nodes. While meeting diverse regulatory requirements, it improves the storage space utilization efficiency and data processing timeliness of the blockchain, enabling the entire system to flexibly adapt to the complex and ever-changing business scenarios of the pharmaceutical supply chain.

[0064] Instead of viewing individual events in isolation, this approach extracts continuous sequences of operational behaviors from immutable on-chain archives. Each role's behavioral sequence is automatically compared to pre-defined drug distribution rules to determine compliance. Based on the compliance assessments of all relevant roles, an algorithm aggregates and calculates a quantitative value characterizing the traceability reliability of the entire batch of drugs' supply chain. This represents a leap from passively providing proof of data existence to proactively assessing behavioral compliance and overall credibility, providing regulators and consumers with a deeper, quantifiable basis for quality and trust evaluation that goes beyond simply demonstrating chain integrity. Attached Figure Description

[0065] Figure 1 The flowchart below illustrates the blockchain-based drug supply chain traceability management method described in this invention.

[0066] Figure 2 A flowchart for generating the purified structured event set;

[0067] Figure 3 To generate a flowchart of the drug distribution chain;

[0068] Figure 4 A bar chart showing the average operational compliance rate of key business roles in the blockchain pharmaceutical supply chain.

[0069] Figure 5 A bar chart comparing key indicators of the blockchain-based pharmaceutical supply chain. Detailed Implementation

[0070] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0071] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0072] See Figure 1 The system collects raw trajectory records of drugs as they flow through various nodes of the supply chain. These records undergo purification and structuring operations to remove noise and standardize the format, generating a purified structured event set. Based on a pre-defined event association logic, the purified structured event set is linked sequentially to construct a drug circulation link with causal relationships and continuous time attributes. According to the business attributes and regulatory requirements of different nodes in the drug circulation link, the system determines the data dimensions and recording density required for each node, and dynamically designs the data block structure to carry the node information, ensuring that the internal partitions of the data block structure correspond to the data dimensions and the data block generation frequency. Matching the recorded density; formatting and encapsulating the event information of each node in the drug circulation chain according to the designed data block structure to generate on-chain data blocks corresponding to each node; summarizing the on-chain data blocks generated by all nodes and linking them in a blockchain-style manner according to time sequence and circulation relationship to form an on-chain immutable file reflecting the complete drug circulation process; parsing the on-chain immutable file, extracting the operational behavior sequence of each key business role in the supply chain network, comparing it with the pre-set drug circulation process rules, determining the compliance of the behavior of each key business role, and then calculating the traceability credibility quantification value for the supply chain of a specified batch of drugs.

[0073] In one embodiment of the present invention, see [reference] Figure 2The original trajectory record contains drug identification, physical environment parameters, operator information, and timestamps. Outlier data points caused by sensor malfunctions or input errors are identified in the original trajectory record. An analysis method based on the context of adjacent events is used to correct or remove outlier data points. Duplicate record entries for the same operation event at different time points in the original trajectory record are identified and merged. The corrected, removed, and merged record entries are reorganized according to a unified field template to generate standardized event record units. The standardized event record units are initially sorted based on the continuity of timestamps between event record units to form the purified structured event set.

[0074] In practice, the raw trajectory records generated by the flow of drugs through each node are cleaned and structured to generate a cleaned set of structured events. The raw trajectory records contain drug identification, physical environment parameters, operator information, and timestamps. For example, the record generated at the storage node for a batch of drugs identified as "BATCH2024-001" might include temperature "25°C", humidity "60%", operator "OP-001", and timestamp "2024-01-19T10:00:00Z". Outlier data points in the raw trajectory records caused by sensor malfunctions or input errors are identified, specifically physical environment parameter values ​​that significantly deviate from reasonable ranges or timestamp logic errors. In some embodiments, an analysis method based on proximity event context is used to correct or remove outlier data points. This method judges based on the data trends of adjacent valid data points or similar drugs within the same time period. For example, if an abnormal temperature value of "-10°C" is identified, and the temperature values ​​of other valid records for the same drug within five minutes before and after are all around "25°C", then the arithmetic mean of these valid temperature records, "25°C", is used to correct and replace the abnormal value data point. If a reasonable correction basis cannot be found for the abnormal value data point in the context, then the entire record entry containing the abnormal value data point is removed.

[0075] It is understandable that identifying and merging duplicate record entries for the same operation event at different time points in the original trajectory records is necessary. These duplicate entries are usually caused by repeated system interface calls or network delays leading to retransmissions. They manifest as multiple records with identical drug identification, operator, and core operation content, but with extremely close timestamps. For example, regarding the warehousing operation of drug "BATCH2024-001," two identical entries were recorded at timestamps "2024-01-19T10:05:00Z" and "2024-01-19T10:05:02Z." These two entries are identified as duplicate entries for the same operation event and merged into one record. The merged record's timestamp can be the earliest timestamp, "2024-01-19T10:05:00Z." For outlier data points in physical environment parameters, the analysis method based on the context of nearby events can employ interpolation algorithms. These algorithms calculate replacement values ​​based on valid data points before and after the data points. One implementation formula for the interpolation algorithm is as follows:

[0076]

[0077] in: This indicates the correction result for the abnormal parameter values ​​to be corrected. Indicates the previous valid time point The parameter value, Indicates the next valid time point The parameter value, This represents the timestamp corresponding to the outlier data point. Data comparison shows that the original trajectory records may contain irregular, missing, or conflicting entries, while each standardized event record unit in the purified structured event set conforms to a unified field template and is arranged in order by timestamp. For example, if the original record has N entries, the purified structured event set has M standardized event record units, where M≤N, and the logical consistency of the sequence is improved.

[0078] In one embodiment of the present invention, see [reference] Figure 3This process involves defining standardized input and output event types for each node in the supply chain network, traversing the purified structured event set, and classifying event record units into input or output events of the corresponding node based on their occurrence location and content. All event record units belonging to the same drug entity are grouped according to the drug entity's identifier. Within each group, the output events of the preceding node and the input events of the following node are logically matched and linked based on timestamp order. The continuity and causality of the linked event sequence in time are verified, missing logical links are filled in, or locations with logical breakpoints are marked, generating the drug circulation link. Independent block data fields are allocated to each dimension in the data dimension. Data filling trigger conditions for block data fields are set according to record density: high record density corresponds to event-triggered filling, and low record density corresponds to periodic filling. Each data block structure is configured with a link field for recording the hash value of the preceding block and a header field for recording the metadata of this block. Based on the business attributes of the location node, specific additional verification information fields required for its data block structure are defined, forming a complete block structure template.

[0079] In practical implementation, a drug circulation chain with causal relationships and continuous time attributes is generated, and a data block structure carrying location node information is dynamically designed. Standardized input and output event types are defined for each location node in the supply chain network. For example, the standardized output event type for a "production node" is defined as "drug production," and the standardized input event type for a "warehousing node" is defined as "drug warehousing," and the standardized output event type is defined as "drug warehousing." The purified structured event set is traversed, and the event record unit is classified as the input or output event of the corresponding node based on the occurrence location node and content. For example, an event record unit that occurs in "production workshop A" and has the content "packaging completed" is classified as an output event of the "production node."

[0080] In some embodiments, all event record units belonging to the same drug entity are grouped according to the identifier of the drug entity, such as "BATCH2024-001". All event record units containing this identifier are grouped into the same group. Within each group, the output event of the previous node and the input event of the next node are logically matched and linked according to the timestamp sequence. For example, if drug "BATCH2024-001" has an output event "Drug Production" at the "Production Node" at timestamp T1, and an input event "Drug Entry" at the "Storage Node" at timestamp T2 (T2 is later than T1), then these two events are logically linked, indicating that the drug has flowed from the production stage to the storage stage. The continuity of the linked event sequence in time and the logical causality are verified. The timestamp interval between adjacent events is checked to see if it is within a reasonable business time range, and the event type is checked to see if it conforms to the preset flow order. Positions where abnormal time intervals or logical type mismatches are detected are marked, and the drug flow chain is generated.

[0081] In practice, each dimension within the data dimension is assigned an independent block data field. The data dimensions for location nodes are determined by business attributes and regulatory requirements, with each dimension also assigned an independent block data field. Data filling trigger conditions for the block data fields are set based on record density: high record density corresponds to event-triggered filling, and low record density corresponds to periodic filling. For example, for the "Temperature Records During Transportation" field, which requires high-frequency monitoring, its data filling trigger condition is set to "trigger every 15 minutes or when the temperature change exceeds 2°C"; for the "Vehicle Number" field, which has a lower update frequency, its data filling trigger condition is set to "trigger at the start of each transportation task".

[0082] It is understandable that each data block structure is configured with a link field to record the hash value of the preceding block and a header field to record the metadata of this block. The header field must at least include the timestamp of this block, the location node identifier, and the block version number. Based on the business attributes of the location node, specific additional verification information fields are defined for the data block structure to include. For example, the data block structure of a "customs clearance node" needs to include a "customs clearance permit hash" field, and the data block structure of a "hospital pharmacy receiving node" needs to include a "receiving personnel digital signature" field, thus forming a complete block structure template. Data comparison shows that, compared with a fixed block structure, the dynamically designed data block structure generates blocks for "transportation nodes" that mainly contain time-series environmental monitoring data, while the blocks generated for "distributor nodes" mainly contain commercial invoice information. The internal field composition and filling frequency of the two types of blocks are different.

[0083] Optionally, the quantization of recording density and the setting of trigger conditions can be based on the following relationship:

[0084]

[0085] in: This indicates the data population trigger condition pattern. Indicates event-triggered population. Indicates a fixed time interval For periodic filling, and These represent the quantization values ​​for high and low recording density levels, respectively. This represents the density threshold used to determine the trigger mode.

[0086] In one embodiment of the present invention, a data block generation process is triggered when an event that meets the data filling trigger condition occurs at a location node or when a periodic filling time point is reached. The latest event information corresponding to the location node in the drug circulation chain is extracted. Based on the block structure template of the location node, the extracted latest event information is filled into the corresponding block data field. The header field information of the block to be generated is calculated, and the hash value of the previously generated on-chain data block is filled into the link field. A hash operation is performed on the entire filled data block to generate a unique digital fingerprint of the data block. This digital fingerprint is then used as part of the data block for final encapsulation to obtain the on-chain data of the location node. Data blocks: On-chain data blocks generated by all relevant nodes within a complete drug circulation cycle are collected. Using the unique identifier of the drug entity as an index, all collected on-chain data blocks are categorized. Under each drug identifier, they are first strictly arranged in chronological order according to the timestamps of the events recorded in each on-chain data block. Secondly, the flow logic between adjacent on-chain data blocks in the chronological arrangement is verified to ensure that the output state of the previous data block matches the input state of the next data block. The verified, chronologically and logically arranged on-chain data block sequence is cryptographically linked through the preceding hash value link field contained in each data block, forming an irreversible blockchain strip as the on-chain immutable archive.

[0087] In practical implementation, the event information of location nodes is encapsulated into on-chain data blocks, and these on-chain data blocks are linked to form an immutable on-chain archive. The data block generation process is triggered when a location node experiences an event that meets the data filling trigger condition or reaches a periodic filling time point. For example, for a transportation node, when an onboard sensor detects that the temperature exceeds a preset threshold, the event-triggered filling process is triggered; for a warehousing node, if its recording density is set to periodic filling once a day, the periodic filling process is triggered at a fixed time each day. The latest event information corresponding to the location nodes in the drug distribution chain is extracted. The latest event information includes details of the specific event that triggered the generation process and its associated drug identifier, timestamp, and other contextual data.

[0088] In some embodiments, the latest extracted event information is filled into the corresponding block data fields according to the block structure template of the location node. The block structure template is dynamically designed and determined by the embodiment. For example, if the block structure template of the transportation node includes block data fields such as "temperature record", "geographic location", and "vehicle ID", the extracted block data fields are filled into the corresponding fields respectively. The header field information of the block to be generated is calculated and the hash value of the previously generated on-chain data block is filled into the link field. The header field information includes the generation timestamp of the current block "2024-01-19T14:30:00Z", the location node identifier "transportation node-truck01" and the block sequence number "005"; the previously generated on-chain data block refers to the previous block generated by the same location node or the last block generated by the logically previous node in the drug circulation link, and its hash value is a hexadecimal string of length 64.

[0089] It is understood that a hash operation is performed on the entire filled data block to generate a unique digital fingerprint for the data block. The hash operation uses the SHA-256 algorithm to process the complete data after concatenating the block header field, link field, and all block data fields. This digital fingerprint is then used as part of the data block for final encapsulation. The digital fingerprint is typically recorded in the block header field or a separate verification field, resulting in the on-chain data block of the location node. On-chain data blocks generated by all relevant location nodes within a complete drug distribution cycle are collected. A complete drug distribution cycle refers to the entire process from the start of drug production to final consumption or destruction. Relevant location nodes include manufacturers, logistics providers, warehouses, distributors, pharmacies, etc.

[0090] In practice, all collected on-chain data blocks are categorized using the unique identifier of the drug entity as an index. For example, all on-chain data blocks containing the drug identifier "BATCH2024-001" are grouped into the same set. Under each drug identifier category, the on-chain data blocks are first arranged in strict chronological order according to the timestamps of the events recorded in each block. The timestamps are obtained by parsing from the block header field or specific data fields. Secondly, the logical relationship between adjacent on-chain data blocks in the chronological order is verified to ensure that the output state of the previous data block matches the input state of the next data block. For example, it is verified whether the "outbound" status recorded in the previous on-chain data block and the "in transit" status recorded in the next on-chain data block are logically connected. The chronologically and logically arranged on-chain data block sequence that passes the verification is cryptographically linked using the preceding hash value link field contained in each data block. Each on-chain data block contains a digital fingerprint pointing to the previous block, forming an irreversible blockchain strip as the on-chain immutable archive.

[0091] Optionally, the process of performing a hash operation on the entire filled data block to generate a unique digital fingerprint can be expressed by the following formula:

[0092]

[0093] in: This represents the hash value, or unique digital fingerprint, of the currently generated on-chain data block. This indicates the cryptographic hash function used. This indicates the content of the header field of the current data block on the chain. This represents the hash value of the previously generated on-chain data block. This represents the content after concatenating all block data fields, symbol. This represents a concatenation operation of strings or byte sequences. Data comparison shows that the original location node event information consists of scattered and differently formatted data records, while the final immutable on-chain archive is a data chain that is tightly linked by time and logic. Any modification to the content of a historical block will cause a chain reaction of changes in the hash values ​​of all subsequent blocks. The data structure of a single block on the chain is uniform, but the content varies from node to node.

[0094] In one embodiment of the present invention, based on the predefined mapping relationship between key business roles and location nodes, on-chain data blocks corresponding to all location nodes under the responsibility of a specific key business role are selected from the immutable on-chain archive. Each selected on-chain data block is parsed to extract operation behavior records that record operation actions, operation objects, operation times, and operation results. All extracted operation behavior records are sorted and concatenated in chronological order to form an initial operation behavior sequence for the key business role. Continuous similar operations in the initial operation behavior sequence are merged and abstracted, while independent operations with time intervals are retained to generate a standardized operation behavior sequence. The pre-defined drug distribution process rules are decomposed into specific rules applicable to different key business roles. The system generates a set of constraints, each containing a triggering scenario, a set of permitted operations, and a set of prohibited operations. It iterates through each operation record in the standardized sequence of operations for key business roles. For each record, the triggering scenario is determined based on its operation time and target. The specific action in the record is then matched against the set of permitted and prohibited operations within that triggering scenario. If the action exists in the set of permitted operations, the action is marked as compliant; otherwise, it is marked as non-compliant. The compliance marking results for all operation records of key business roles are then tallied to generate a compliance assessment report for the key business roles.

[0095] In practical implementation, the operation behavior sequences of key business roles are extracted from the immutable on-chain archives, and the compliance of these behaviors is determined. Based on the predefined mapping relationship between key business roles and location nodes, on-chain data blocks corresponding to all location nodes responsible for a specific key business role are selected from the immutable on-chain archives. For example, if the predefined mapping relationship between key business roles and location nodes specifies that the "warehouse manager" role is responsible for the "central warehouse" and "regional cold storage" location nodes, then when parsing the immutable on-chain archive of drug "BATCH2024-001", all data blocks generated by the "central warehouse" and "regional cold storage" location nodes are selected. Each selected on-chain data block is parsed to extract operation behavior records that record operation actions, operation objects, operation times, and operation results. For example, parsing an on-chain data block from the "central warehouse" might extract the operation behavior record as "Action: Inbound verification, Object: BATCH2024-001, Time: 2024-01-19T10:05:00Z, Result: Qualified".

[0096] In some embodiments, all extracted operation behavior records are sorted and concatenated in chronological order to form an initial operation behavior sequence for the key business role. Specifically, all extracted operation behavior records are sorted in ascending order based on their operation time field, forming a timeline-arranged behavior list. Consecutive similar operations in the initial operation behavior sequence are merged and abstracted, while independent operations with time intervals are retained, generating a standardized operation behavior sequence. For example, if a "warehouse manager" performs three consecutive "temperature recording" operations on the same batch of medicines within a short period, these would be three independent records in the initial operation behavior sequence, but are merged and abstracted into a single "temperature monitoring (duration period: T1 to T2)" record in the standardized operation behavior sequence. Independent operations with large time intervals or different operation objects, such as "inbound verification" and "outbound verification," are retained as two independent records.

[0097] It is understandable that the pre-defined rules for the drug distribution process are decomposed into a set of specific constraints applicable to different key business roles. Each constraint includes a triggering scenario, a set of permitted operations, and a set of prohibited operations. Taking the role of "cold chain transporter" as an example, refer to Table 1 for a specific set of constraints.

[0098] Table 1: Operational Constraints for Cold Chain Transport Personnel

[0099] Triggering Scenario Permitted Operation Set Prohibited Operation Sets The medicine is being transported at a normal temperature. {Continuous temperature recording, location reporting} {Open the insulated box, delay reporting} Medicines being transported in transit at temperatures exceeding limits {Emergency temperature recording, alarm sending, location reporting, contact dispatch} {Ignore alarm, turn off sensor} Transportation mission start / end {Scan to load, confirm delivery, take photo to sign for receipt} {Unauthorized handover, premature termination of the trip}

[0100] In practice, each standardized operational behavior record in the sequence of key business roles is traversed. For example, the standardized operational behavior sequence of "cold chain transporter" Zhang San is traversed. For each operational behavior record, its triggering scenario is determined based on its operation time and object. For example, a record might be "Action: Send Alarm, Object: BATCH2024-001, Time: 2024-01-19T14:30:00Z". Combined with the temperature monitoring status of the medicine at that time (temperature exceeded limit), its triggering scenario is determined to be "Medicine in transit, temperature exceeded limit". The specific operational action in the current record is then matched with the permitted and prohibited operation sets under the triggering scenario. The action "Send Alarm" exists in the permitted operation set of the "Medicine in transit, temperature exceeded limit" scenario.

[0101] If an action exists in the permitted action set, the action is marked as compliant; if an action exists in the prohibited action set or no matching item is found in the permitted action set, the action is marked as non-compliant. The compliance marking results of all action records for key business roles are statistically analyzed to generate a compliance assessment report for the key business roles. The compliance assessment report can be a summary list, listing the compliance status of each action record and providing the total number of compliant and non-compliant actions. Data comparison shows that the original action sequence without comparison is merely a list of actions, while the compliance assessment report generated after comparison with preset rules clearly identifies that "Cold Chain Transporter" Zhang San's "sending alarm" action was compliant, while his "delayed reporting" action was non-compliant during the transportation of "BATCH2024-001" medicine.

[0102] Optionally, the matching process between the operation action and the set of constraints can be described by the following logical expression:

[0103]

[0104] in: This indicates the compliance flag result for the current operational behavior. This indicates the specific action recorded in the current operation log. This represents the set of permitted operations within the triggering scenario. This represents the set of prohibited operations under the triggering scenario, symbol. Indicates "belongs to", symbol It represents the logical "OR".

[0105] See Figure 4This is a bar chart showing the average operational compliance rate of key business roles in the blockchain-based pharmaceutical supply chain. It visually illustrates the operational compliance performance of five core roles in the pharmaceutical distribution process. The high compliance rate of quality inspectors can be used as a benchmark to analyze their process design and control experience, which can then be applied to the operational standards of other roles. For links with low compliance rates, more refined operational record-keeping and automatic verification functions can be added to the blockchain system to reduce the scope for human error. It clearly reveals that the "cold chain transporter" is the compliance risk point in the entire supply chain, with the lowest compliance rate, indicating that this link is most prone to operational irregularities or violations, and is a potential source of risk to pharmaceutical quality and safety. Leveraging the immutability of blockchain, this chart can be linked to specific operational records on the chain. When pharmaceutical quality issues arise, the responsible role and its specific violations can be quickly identified, achieving precise traceability.

[0106] In one embodiment of the present invention, a role behavior compliance rate is generated by statistically analyzing the ratio of the number of compliant operations performed by each key business role in the circulation process of a specified batch of drugs to the total number of operations based on the compliance judgment report of each key business role. A weight coefficient for each key business role in the supply chain traceability credibility assessment is determined according to a predefined business role weight allocation table. The role behavior compliance rate of each key business role is weighted and summed with its corresponding weight coefficient to generate a preliminary supply chain credibility score. An event integrity index for the circulation path of a specified batch of drugs is extracted from the immutable on-chain archive. The event integrity index is obtained by calculating the ratio of the number of events actually recorded to the number of events that should theoretically be recorded. A timestamp continuity index is extracted from the immutable on-chain archive. The timestamp continuity index is calculated by detecting whether the time interval between adjacent event records exceeds a preset threshold. The preliminary supply chain credibility score, event integrity index, and timestamp continuity index are input into a pre-trained credibility quantification model for multi-dimensional fusion calculation to generate the traceability credibility quantification value for the supply chain of the specified batch of drugs.

[0107] In practice, a traceability reliability quantification for a specified batch of pharmaceutical supply chain is calculated. Based on the compliance assessment report for each key business role, the ratio of the number of compliant operations performed by that role during the distribution of the specified batch of pharmaceuticals to the total number of operations is calculated to generate the role's behavior compliance rate. For example, for the pharmaceutical batch "BATCH2024-001," the parsed compliance assessment report shows that the key business role "Production Quality Inspector" performed 50 operations on "BATCH2024-001" during the production process, of which 48 were marked as compliant. Therefore, the role's behavior compliance rate for "Production Quality Inspector" is calculated to be 0.96. Similarly, roles such as "Cold Chain Transporter," "Warehouse Manager," and "Pharmacy Pharmacist" also have their corresponding role behavior compliance rates calculated based on their respective compliance records and the total number of operations performed.

[0108] In some embodiments, the weight coefficient of each key business role in the supply chain traceability credibility assessment is determined according to a predefined business role weight allocation table. This table is pre-defined based on factors such as the role's scope of responsibility in the supply chain and its impact on drug quality and safety. For example, a predefined business role weight allocation table might specify: "Production Quality Inspector" weight coefficient 0.3, "Cold Chain Transporter" weight coefficient 0.4, "Warehouse Manager" weight coefficient 0.2, and "Pharmacy Pharmacist" weight coefficient 0.1, with the sum of all weight coefficients being 1.0. A preliminary supply chain credibility score is generated by weighting and summing the compliance rate of each key business role's behavior with its corresponding weight coefficient.

[0109] It is understandable that an event integrity index for the circulation path of a specified batch of drugs is extracted from the immutable on-chain archive. This index is obtained by calculating the ratio of the actual number of recorded events to the theoretically required number of recorded events. The theoretically required number of recorded events is pre-calculated based on a standardized business model of drug category and distribution path. For example, for injectable drugs like "BATCH2024-001" that require a complete cold chain, the theoretically complete standard process from production to pharmacy should record 85 key events. The actual number of recorded events is obtained by counting the total number of standardized event record units belonging to "BATCH2024-001" in the immutable on-chain archive. Assuming 82 event record units are counted, the event integrity index is 82 / 85≈0.9647. A timestamp continuity index is also extracted from the immutable on-chain archive. This index is calculated by detecting whether the time interval between adjacent event records exceeds a preset threshold. The preset threshold is set based on the reasonable maximum interval time for each business process; for example, the threshold is set to 8 hours in the warehousing process and 4 hours in the transportation process. For the complete event sequence of “BATCH2024-001”, calculate the time difference between adjacent events one by one, and count the number of event intervals that exceed the preset threshold of the corresponding stage. Assuming there are 84 adjacent intervals, and 2 of them time out, the timestamp continuity index is calculated as (84-2) / 84≈0.9762.

[0110] In practical implementation, the preliminary supply chain credibility score, event integrity index, and timestamp continuity index are input into a pre-trained credibility quantification model for multi-dimensional fusion calculation to generate the traceability credibility quantification value for the specified batch of pharmaceutical supply chain. The pre-trained credibility quantification model is a mathematical calculation function trained using historical batch pharmaceutical traceability data and authoritative manual audit results to learn how to map multiple dimensions of indicators into a comprehensive credibility evaluation value. For example, the preliminary supply chain credibility score of 0.943, event integrity index of 0.9647, and timestamp continuity index of 0.9762 calculated for "BATCH2024-001" are used as a set of input vectors into the credibility quantification model. Data comparison shows that each individual indicator input into the model reflects the credibility level of different aspects of the supply chain, while the model's output value is a comprehensive quantitative evaluation result that integrates role behavior compliance, event record integrity, and temporal logical coherence. For example, the model output value... =0.932, which represents the traceability reliability quantification value for the supply chain of the "BATCH2024-001" batch of drugs.

[0111] Optionally, the multi-dimensional fusion computation process of the pre-trained reliable quantification model can be expressed by the following functional expression:

[0112]

[0113] in: This represents the quantified traceability reliability of the drug supply chain for a specified batch, as output by the model. This represents the pre-trained confidence metric model function. This represents the initial supply chain credibility score. This indicates the completeness of the input events. This function represents the continuity index of the input timestamps. The specific form can be linear regression, neural networks, or other computable forms trained on historical data.

[0114] See Figure 5This is a bar chart comparing key indicators of the blockchain-based pharmaceutical supply chain. It shows the "Event Completeness Index" and "Timestamp Continuity Index" for five drug batches. These two indicators are the core basis for calculating the credibility of supply chain traceability. For batches BATCH2024-002 and BATCH2024-004, which have low indicators, on-chain data verification should be triggered immediately to locate the specific links and responsible roles where events are missing or time is interrupted, and to promptly supplement or correct the records. The operational processes of benchmark batches such as BATCH2024-005 can be analyzed in depth to extract best practices for ensuring event completeness and time continuity, and then promoted to the entire supply chain. The overall indicator values ​​are at a high level of 0.93 to 0.99, indicating that the blockchain system performs excellently in ensuring the completeness and continuity of drug circulation records, effectively improving the transparency and credibility of the supply chain.

[0115] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A blockchain-based method for traceability management of the pharmaceutical supply chain, characterized in that, include: Collect the original trajectory records generated by the flow of drugs through each node, perform purification and structuring operations, and generate a purified set of structured events; Based on the preset event association logic, the purified structured event set is linked sequentially to generate a drug circulation link with causal relationship and continuous time attribute. Based on the business attributes and regulatory requirements of different nodes in the drug circulation chain, the data dimensions and recording density required for each node are determined, and the data block structure carrying the information of the node is dynamically designed so that the internal partitions of the data block structure correspond to the data dimensions and the generation frequency of the data blocks matches the recording density. The event information of each node in the drug circulation chain is formatted and encapsulated according to the designed data block structure to generate on-chain data blocks for the location nodes; The on-chain data blocks generated by all location nodes are aggregated and linked in a blockchain-style manner according to time sequence and circulation relationship to form an on-chain immutable archive reflecting the complete circulation process of medicines; The system analyzes the immutable files on the blockchain, extracts the operational behavior sequence of each key business role in the supply chain network, compares it with the pre-set rules for the drug distribution process, determines the compliance of the behavior of each key business role, and then calculates the traceability reliability quantification value for a specified batch of drug supply chain. The dynamically designed data block structure carrying location node information includes: Assign a separate block data field to each dimension in the data dimension; Based on the record density, set the data filling trigger conditions for the block data fields. High record density corresponds to event-triggered filling, and low record density corresponds to periodic filling. Configure a link field for recording the hash value of the preceding block and a header field for recording the metadata of this block for each data block structure; Based on the business attributes of location nodes, define the specific additional verification information fields required to be included in their data block structure to form a complete block structure template.

2. The blockchain-based pharmaceutical supply chain traceability management method as described in claim 1, characterized in that, The process of performing cleansing and structuring operations to generate a cleaned and structured event set includes: The original trajectory record includes drug identification, physical environment parameters, information of the personnel handling the operation, and a timestamp. Identify outlier data points in the original trajectory record caused by sensor malfunctions or input errors; An analysis method based on the context of nearby events is used to correct or remove outlier data points; Identify and merge duplicate record entries generated at different time points for the same operation event in the original trajectory record; Record entries that have been corrected, eliminated, and merged are reorganized according to a unified field template to generate standardized event record units; Based on the continuity of timestamps between event recording units, the standardized event recording units are initially sorted to form the purified structured event set.

3. The blockchain-based drug supply chain traceability management method as described in claim 2, characterized in that, The aforementioned event association logic, based on preset parameters, links the purified structured event set sequentially to generate a drug circulation link with causal relationships and continuous time attributes, including: Define standardized input and output event types for each location node in the supply chain network; Traverse the purified structured event set and classify the events into input or output events of the corresponding nodes based on the occurrence location and content of the event record unit. Based on the identifier of the drug entity, all event record units belonging to the same drug entity are grouped; Within each group, the output events of the previous node and the input events of the next node are logically matched and linked according to the order of timestamps. Verify the temporal continuity and logical causality of the linked event sequence, fill in missing logical links or mark the locations of logical breakpoints, and generate the drug circulation link.

4. The blockchain-based drug supply chain traceability management method as described in claim 3, characterized in that, The process of formatting and encapsulating the event information of each node in the drug distribution chain according to a pre-designed data block structure to generate on-chain data blocks for each node includes: When an event that meets the data filling trigger condition occurs at a location node, or when a periodic filling time point is reached, the data block generation process is triggered. Extract the latest event information corresponding to the location nodes in the drug circulation chain; Based on the block structure template of the location node, the latest extracted event information is filled into the corresponding block data field; Calculate the header field information of the block to be generated and fill the link field with the hash value of the previously generated on-chain data block; A hash operation is performed on the entire filled data block to generate a unique digital fingerprint of the data block. This digital fingerprint is then used as part of the data block for final encapsulation to obtain the on-chain data block of the location node.

5. The blockchain-based pharmaceutical supply chain traceability management method as described in claim 1, characterized in that, The on-chain data blocks generated by all location nodes are linked in a blockchain-style manner according to time sequence and circulation relationship, forming an immutable on-chain archive reflecting the complete circulation process of the medicine, including: Collect on-chain data blocks generated by all relevant location nodes throughout a complete drug distribution cycle; Using the unique identifier of the drug entity as an index, all collected on-chain data blocks are categorized. Under each drug category, the events are first arranged in strict chronological order according to the timestamps of the events recorded in each chain data block. Secondly, verify the flow logic relationship between data blocks on adjacent chains in the timing arrangement to ensure that the output state of the previous data block matches the input state of the next data block. The verified, chronologically and logically arranged sequence of on-chain data blocks is cryptographically linked using the preceding hash value linking field contained within each data block to form an irreversible blockchain strip, which serves as the on-chain immutable archive.

6. The blockchain-based drug supply chain traceability management method as described in claim 1, characterized in that, The tamper-proof files on the parsing chain extract the operational behavior sequences of each key business role in the supply chain network, including: Based on the predefined mapping relationship between key business roles and location nodes, the on-chain data blocks corresponding to all location nodes under the responsibility of a specific key business role are selected from the immutable on-chain archives. Analyze each filtered on-chain data block and extract operation behavior records that record operation actions, operation objects, operation time and operation results; According to the time sequence, all the extracted operation behavior records are sorted and linked together to form the initial operation behavior sequence of the key business role; The system merges and abstracts consecutive similar operations in the initial operation sequence, retains independent operations with time intervals, and generates a normalized operation sequence.

7. The blockchain-based drug supply chain traceability management method as described in claim 6, characterized in that, The process is compared with pre-set drug distribution rules to determine the compliance of the behavior of each key business role, including: The pre-defined rules for the drug distribution process are decomposed into a set of specific constraints applicable to different key business roles. Each constraint includes a triggering scenario, a set of permitted operations, and a set of prohibited operations. Iterate through each operational behavior record in the standardized operational behavior sequence of key business roles; For the current operation behavior record, determine its triggering scenario based on the operation time and the operation object; Match the specific actions in the current operation behavior record with the set of permitted operations and the set of prohibited operations in the triggering scenario; If the action exists in the permitted action set, the action is marked as compliant; if the action exists in the prohibited action set, or no match is found in the permitted action set, This action will then be marked as non-compliant. Compliance flags are collected from all operational records of key business roles, and a compliance assessment report for each key business role is generated.

8. The blockchain-based pharmaceutical supply chain traceability management method as described in claim 1, characterized in that, The process then calculates a traceability reliability quantification for a specified batch of drugs in the supply chain, including: Based on the compliance assessment report for each key business role, the ratio of the number of compliant operations performed by the key business role in the circulation process of a specified batch of drugs to the total number of operations is calculated to generate the role behavior compliance rate. Based on the predefined business role weight allocation table, determine the weight coefficient of each key business role in the supply chain traceability credibility assessment; The compliance rate of each key business role is weighted and summed with its corresponding weight coefficient to generate a preliminary supply chain credibility score. Extract event integrity indicators from the immutable files on the blockchain to identify the circulation path of a specified batch of drugs. The event integrity indicators are obtained by calculating the ratio of the number of events actually recorded to the number of events that should theoretically be recorded. The timestamp continuity index is extracted from the on-chain immutable archive. The timestamp continuity index is calculated by detecting whether the time interval between adjacent event records exceeds a preset threshold. The preliminary supply chain credibility score, event integrity index, and timestamp continuity index are input into a pre-trained credibility quantification model for multi-dimensional fusion calculation to generate the traceability credibility quantification value for the specified batch of drug supply chain.

9. A blockchain-based pharmaceutical supply chain traceability management system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the blockchain-based drug supply chain traceability management method according to any one of claims 1 to 8.