A fentanyl drug full-cycle circulation traceability management system

By assigning unique numbers to batches of fentanyl-related drugs and using blockchain for evidence storage and circular geometric feature verification, a strong correlation verification layer is established, which solves the limitation of cross-link data verification in the existing system and realizes efficient traceability and safe management of drug circulation.

CN121352826BActive Publication Date: 2026-05-12夏芮智能科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511906621.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-05-12
Estimated Expiration
2045-12-17

AI Technical Summary

Technical Problem

Existing fentanyl drug distribution traceability systems have limitations in cross-stage data correlation verification. They lack built-in computational verification mechanisms, which makes data consistency verification complex and affects the efficiency and reliability of credible traceability of the distribution path.

Method used

A batch coding module is used to assign a unique batch number to each drug batch. Combined with a blockchain evidence storage module, the data is stored in a distributed manner. A strong correlation verification layer is established by calculating the common chord between data blocks based on circular geometric features through an association verification module. The index building module organizes the data into a spherical spatial index structure. Combined with an intelligent query module, this enables rapid cross-stage traceability queries.

Benefits of technology

It enables full recording, secure storage, and rapid querying of drug distribution data, improving the credibility and security of traceability data, and timely detection of abnormal circulation risks, thus ensuring the reliability and safety of drug distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121352826B_ABST
    Figure CN121352826B_ABST
Patent Text Reader

Abstract

The application provides a fentanyl drug full-cycle circulation traceability management system, and relates to the technical field of data traceability, comprising: a batch coding module for assigning a unique batch number to each drug batch according to standardized data to form a drug traceability data block; a blockchain storage module for uploading the drug traceability data block to a blockchain network for distributed storage through a consensus mechanism, generating a unique hash value and a timestamp for each data block; and mapping the key space-time attributes of each data block into a circular geometric feature. The application realizes the secure anti-tampering, correlation credibility and rapid positioning query of fentanyl drug full-cycle circulation data through unique batch coding, blockchain distributed storage, geometric feature correlation verification and hierarchical spherical space indexing construction, and provides efficient and reliable support for drug full-life-cycle traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data traceability technology, and in particular to a full-cycle traceability management system for fentanyl-type drugs. Background Technology

[0002] In the circulation and supervision of specially controlled drugs such as fentanyl, establishing a reliable end-to-end traceability system is of great significance. Some existing technical solutions usually use centralized databases or blockchain to independently store data at each stage. However, these solutions may have certain limitations in achieving cross-stage data correlation verification. Most systems focus on recording individual events, while the correlation between events is relatively independent, lacking a built-in, computable verification mechanism to strengthen the integrity of the entire data chain.

[0003] For example, in the drug transportation process, existing systems may generate separate, timestamped data records for the operations of "warehouse outbound" and "transport vehicle receipt". Although each record may have tamper-proof features, the spatiotemporal logical consistency between these two records is often difficult for the system to verify automatically and efficiently. If inconsistencies occur in the transportation data, the process of discovering and verifying such correlation anomalies may be quite complex, which may affect the efficiency and reliability of credible traceability of the distribution path to some extent. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide a full-cycle traceability management system for fentanyl-related drugs, which improves the credibility and security of traceability data.

[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0006] Firstly, a full-cycle traceability management system for fentanyl-related drugs includes:

[0007] The batch coding module is used to assign a unique batch number to each drug batch based on standardized data, forming a drug traceability data block.

[0008] The blockchain evidence storage module is used to upload drug traceability data blocks to the blockchain network for distributed storage through a consensus mechanism, generate a unique hash value and timestamp for each data block, and map the key spatiotemporal attributes of each data block to circular geometric features.

[0009] The association verification module is used to calculate the common chord between different circular geometric features based on the principle of determining the positional relationship between circles, so as to establish a strong association verification layer between data blocks. By analyzing the relative positional relationship between circular geometric features, cross-verification and association strengthening of data blocks are performed to obtain blockchain traceability data with enhanced anti-tampering and association verification capabilities.

[0010] The index building module is used to organize traceability data points from each stage into a hierarchical spherical spatial index structure based on blockchain traceability data. The spherical spatial index is composed of multiple spherical nodes.

[0011] The intelligent query module receives drug serial numbers or vehicle VIN codes and quickly locates the data set most relevant to the query conditions based on a spherical spatial index. It then retrieves the corresponding standardized data for the entire lifecycle across different stages and integrates and generates a full-chain traceability report for drug components to complete the full lifecycle traceability query for drug components.

[0012] In a second aspect, a computing device includes:

[0013] One or more processors;

[0014] A storage device for storing one or more programs that, when executed by one or more processors, enable the one or more processors to implement the system.

[0015] Thirdly, a computer-readable storage medium storing a program that, when executed by a processor, implements the system.

[0016] The above-described solution of the present invention has at least the following beneficial effects:

[0017] By collecting heterogeneous data from multiple sources across various stages and performing standardized processing, a unique batch number is assigned to each drug batch. This design organically integrates previously fragmented raw material information, production data, and warehousing records, preventing traceability failures caused by data chaos from the outset. Through a consensus mechanism, traceability data blocks are distributed and stored on a blockchain network. Each data block generates a unique hash value and timestamp. This distributed storage model prevents data from being arbitrarily modified by a single entity, while the hash value and timestamp provide reliable proof of data integrity and timeliness. Even if data at one node becomes abnormal, it can be quickly restored through backups at other nodes, enhancing the reliability of traceability data. This approach enhances both accuracy and security by mapping key spatiotemporal attributes of data blocks to circular geometric features. A strong correlation verification layer is established by calculating common chords based on the positional relationships between circles. Cross-verification of data blocks is achieved by analyzing the relative positions of these geometric features. When the spatiotemporal logic of data from adjacent stages is consistent, the corresponding circular features will form a valid common chord; otherwise, feature anomalies will occur. This visual verification method based on geometric relationships transforms abstract data associations into calculable and judgmentable logical relationships, enabling automatic verification of cross-stage data consistency, reducing the cost of manual intervention, strengthening the correlation between data, making the traceability chain more robust, and promptly identifying abnormal circulation risks in drug distribution.

[0018] The system organizes traceability data points at each stage into a hierarchical spherical spatial index, utilizing the spatial inclusion relationships of spherical nodes to form an efficient retrieval and navigation structure. Combined with the intelligent query module's support for multi-condition queries such as drug serial numbers and vehicle VIN codes, it can quickly locate the data set most relevant to the query conditions based on the spherical spatial index. It can retrieve full lifecycle data across stages and generate a complete traceability report. This design overcomes the inefficiency of linear retrieval, enabling rapid mastery of information across the entire drug distribution chain and providing efficient data support for emergency response and accountability. The system covers the entire lifecycle of drugs, from raw material procurement to recycling and dismantling. Through the collaboration of various modules, it achieves full data recording, secure storage, correlation verification, and rapid querying, allowing regulatory authorities to comprehensively grasp every stage of drug circulation. This not only enables rapid location of problematic stages and tracing of responsible parties when drug quality issues arise, but also allows for early identification of abnormal circulation trends through data correlation analysis, effectively preventing illegal drug leakage and ensuring the safe circulation of specially managed drugs. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of a full-cycle circulation traceability management system for fentanyl-type drugs provided in an embodiment of the present invention.

[0020] Figure 2 This is a flowchart illustrating the process of assigning a unique batch number to each drug batch based on standardized data, forming a drug traceability data block, as provided in an embodiment of the present invention. Detailed Implementation

[0021] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0022] like Figure 1 As shown, an embodiment of the present invention proposes a full-cycle traceability management system for fentanyl-type drugs, comprising:

[0023] The batch coding module is used to assign a unique batch number to each drug batch based on standardized data, forming a drug traceability data block.

[0024] The blockchain evidence storage module is used to upload drug traceability data blocks to the blockchain network for distributed storage through a consensus mechanism, generate a unique hash value and timestamp for each data block, and map the key spatiotemporal attributes of each data block to circular geometric features.

[0025] The association verification module is used to calculate the common chord between different circular geometric features based on the principle of determining the positional relationship between circles, so as to establish a strong association verification layer between data blocks. By analyzing the relative positional relationship between circular geometric features, cross-verification and association strengthening of data blocks are performed to obtain blockchain traceability data with enhanced anti-tampering and association verification capabilities.

[0026] The index building module is used to organize traceability data points from each stage into a hierarchical spherical spatial index structure based on blockchain traceability data. The spherical spatial index is composed of multiple spherical nodes.

[0027] The intelligent query module receives drug serial numbers or vehicle VIN codes and quickly locates the data set most relevant to the query conditions based on a spherical spatial index. It then retrieves the corresponding standardized data for the entire lifecycle across different stages and integrates and generates a full-chain traceability report for drug components to complete the full lifecycle traceability query for drug components.

[0028] In this embodiment of the invention, by collecting multi-stage, multi-source, heterogeneous data and performing standardized processing, a unique batch number is assigned to each drug batch. This design integrates previously fragmented raw material information, production data, and warehousing records into an organic whole, preventing traceability failures caused by data chaos from the source. Through a consensus mechanism, traceability data blocks are distributed and stored on a blockchain network. Each data block generates a unique hash value and timestamp. The distributed storage mode prevents data from being arbitrarily modified by a single entity, while the hash value and timestamp provide reliable proof of data integrity and timeliness. Even if data at one node becomes abnormal, it can be quickly restored through backups at other nodes, improving traceability accuracy. To ensure the credibility and security of data, key spatiotemporal attributes of data blocks are mapped to circular geometric features. Based on the principle of positional relationship between circles, a common chord is calculated to establish a strong correlation verification layer. By analyzing the relative positions of geometric features, cross-verification of data blocks is achieved. When the spatiotemporal logic of data in adjacent links is consistent, the corresponding circular features will form a valid common chord; otherwise, feature anomalies will occur. This visualization verification method based on geometric relationships transforms abstract data associations into calculable and judgmental logical relationships, realizing automatic verification of cross-link data consistency, reducing the cost of manual intervention, and strengthening the correlation between data, making the traceability chain tighter and timely detecting abnormal circulation risks in drug distribution.

[0029] The system organizes traceability data points at each stage into a hierarchical spherical spatial index, utilizing the spatial inclusion relationships of spherical nodes to form an efficient retrieval and navigation structure. Combined with the intelligent query module's support for multi-condition queries such as drug serial numbers and vehicle VIN codes, it can quickly locate the data set most relevant to the query conditions based on the spherical spatial index. It can retrieve full lifecycle data across stages and generate a complete traceability report. This design overcomes the inefficiency of linear retrieval, enabling rapid mastery of information across the entire drug distribution chain and providing efficient data support for emergency response and accountability. The system covers the entire lifecycle of drugs, from raw material procurement to recycling and dismantling. Through the collaboration of various modules, it achieves full data recording, secure storage, correlation verification, and rapid querying, allowing regulatory authorities to comprehensively grasp every stage of drug circulation. This not only enables rapid location of problematic stages and tracing of responsible parties when drug quality issues arise, but also allows for early identification of abnormal circulation trends through data correlation analysis, effectively preventing illegal drug leakage and ensuring the safe circulation of specially managed drugs.

[0030] In another preferred embodiment of the present invention, the process of obtaining standardized data is as follows:

[0031] This system collects multi-source heterogeneous data on fentanyl-related drugs across the stages of raw material procurement, production and processing, warehousing management, transportation and distribution, clinical use, and recycling and disposal. Specifically, it includes: collecting core data such as raw material type, origin, purity, purchase quantity, supplier qualification certificates, purchase contract numbers, and raw material inspection reports; automatically retrieving electronic data such as purchase orders and qualification registrations through integration with the supplier management system; after raw materials arrive on-site, quality inspectors extract samples for testing according to sampling standards, and manually enter the test results to form a complete data set for the procurement process; collecting data on raw material input quantity, input time, production equipment operating parameters (such as stirring speed, reaction temperature, and pressure), production process execution records, intermediate product inspection data, and finished product inspection indicators; real-time acquisition of operating parameters through built-in sensors in the production equipment; manual recording of input information and inspection results at each stage by operators; synchronous integration with the production execution system to form comprehensive production process data; and collecting data on raw material and finished product warehousing time, warehousing inspection results, storage location, warehouse environment temperature and humidity, outbound time, and outbound handover records. It utilizes the warehouse management system to obtain electronic data on inbound and outbound documents, and collects real-time temperature and humidity data through environmental sensors distributed throughout the warehouse. Warehouse managers manually supplement records of location adjustments and inventory counts to ensure the completeness of warehouse data; they collect data on transport vehicle qualifications, carrier information, transport routes, temperature and humidity during transport, and cargo handover records. Real-time driving trajectory data is obtained through vehicle-mounted GPS devices, and transport environmental parameters are collected by vehicle-mounted temperature and humidity sensors. This data is then integrated with the transport management system to retrieve vehicle and carrier registration information. During loading and unloading, both the sender and receiver sign to confirm the handover record, which is then electronically entered into the system to form a closed-loop transport data system. Data is also collected on the department receiving the medication, the personnel receiving it, the quantity received, patient information, and dosage. The system collects basic data on drug use, including usage time and remaining drug recovery status, by connecting with the hospital information system to obtain data on drug requisition approval and clinical use. Medical staff enter actual usage details and remaining drug recovery records after drug administration to ensure traceability of clinical data. The system also collects data on the batch, quantity, recycling unit, recycling time, destruction method, and destruction supervision records of recycled drugs. Electronic data of recycling documents is captured through the recycling management system. Key nodes during the destruction process are recorded by video surveillance, such as drug warehousing, destruction initiation, and residue disposal. Supervisors verify the data on-site and enter destruction confirmation information, forming data on the entire recycling and destruction process.

[0032] Standardize multi-source heterogeneous data to generate standardized data. Specifically, for missing data, first identify key data fields, such as raw material purity, finished product inspection indicators, and transportation qualification numbers. If the data is key, initiate a supplementary data collection process, contacting the responsible personnel at the corresponding stage (such as purchasing specialists, quality inspectors, and carriers) to supplement the data. For non-key data (such as warehouse location notes and secondary parameters of transport vehicles), fill the gaps using statistical characteristic values ​​of similar data, for example, by using the average level of similar data from the same batch. For abnormal data, set judgment criteria based on the common reasonable ranges of data at each stage. The reasonable range for raw material purity is 99.5% to 99.9%, and the reasonable range for warehouse and transportation temperature and humidity is 2℃ to 8℃ (temperature) and 35% to 65% (humidity). The reasonable range for production equipment agitation... The reasonable range for speed is 100 to 300 rpm, the reasonable range for reaction temperature is 20°C to 60°C, the reasonable range for the latitude and longitude of the transportation trajectory is -90° to 90° latitude and -180° to 180° longitude, and the reasonable range for the feeding amount error is ±5%. For data exceeding these ranges, the original collection records are checked against the actual business scenario. If it is a collection error (such as entering an extra digit during data entry), the data is corrected to the reasonable range. If it is a real special situation (such as extreme weather causing the temperature and humidity to temporarily exceed the standard during transportation), the data is retained and the reason is noted. For duplicate data, the collection time and the reliability of the data source of the duplicate records are compared (automatic system collection > manual entry with signature confirmation > manual entry without confirmation). The record with the latest collection time or the higher reliability of the source is retained, and the other duplicates are removed.

[0033] Subsequently, data normalization was performed. Date data was uniformly formatted as year-month-day hour:minute:second, coordinate data was uniformly converted to standard latitude and longitude format (retaining 6 decimal places), and numerical data was uniformly measured in units of measurement (weight unit uniformly kilogram, temperature unit uniformly Celsius, purity unit uniformly %, length unit uniformly Meter). For suppliers, production workshops, warehouse locations, carriers, etc., a unified code was generated according to the rule of category abbreviation + feature identifier + serial number. Finally, data association and binding were performed, and core identification information related to drug batches (such as purchase contract number, production batch number, warehouse location code, transportation order number) was extracted from the data of each link. The cleaned and normalized data of each link of raw material procurement, production and processing, warehousing management, transportation and distribution, clinical use, and recycling and disposal were linked and integrated by batch identifier to ensure that all data of the same drug batch form a logically coherent set of associations. Finally, standardized data with a unified structure and standardized format was generated that can be directly used for subsequent traceability operations.

[0034] This embodiment uses multi-stage, full-process data collection to ensure full coverage of data at all key nodes in drug distribution, without missing any core information. Standardized processing eliminates problems such as format differences and coding conflicts in multi-source heterogeneous data, making the scattered data form a unified and standardized whole, improving data consistency and usability, ensuring the integrity and accuracy of the traceability chain, and improving the operational efficiency of the entire traceability management system.

[0035] In a preferred embodiment of the present invention, a unique batch number is assigned to each drug batch according to standardized data to form a drug traceability data block, including:

[0036] Based on standardized data, material identification information for each drug batch is extracted. A unique batch number is assigned to each batch according to this information. Specifically, this involves: first, extracting the material identification information. The system calls the data parsing interface to filter the core material identification fields for each drug batch from the standardized data's production basic information module. These fields include the primary raw material classification code, raw material origin code, manufacturer qualification number, production workshop number, and initial feeding timestamp (accurate to the second). For example, if a batch of drugs has the primary raw material classification code fentanyl 001, the origin code 010 (country), the manufacturer qualification number 0258, the workshop number 03, and the feeding timestamp 08:30:25 on December 1, 2025, then the complete material identification information set is a combination of these fields. Then, a unique batch number is generated according to preset rules. The total length of the code is 20 digits, and its structure consists of a fixed prefix, a material identification derivative code, and a check code. The fixed prefix is ​​the abbreviation FTN for fentanyl, clearly indicating the drug category. The material identification derivative... When generating the code, first take the last 3 digits of the raw material primary classification code, the last 3 digits of the origin code, the last 4 digits of the enterprise qualification number, the last 2 digits of the workshop number, and the last 4 digits of the material input timestamp (e.g., the last 4 digits of the timestamp are 0830), and concatenate them sequentially to form a 16-bit basic code. Then, sum the ASCII values ​​corresponding to each character of the basic code, and take the remainder of the sum when divided by 100 to obtain a 2-bit supplementary value. The basic code and the supplementary value are combined to form an 18-bit intermediate code. The check code is generated using a modulo-11 algorithm. First, the 18 digits of the intermediate code are arranged from right to left... The batch number is assigned a weight from 2 to 19. The sum of the products of each digit and its corresponding weight is calculated, and then the remainder of this sum is taken when divided by 11. If the remainder is 10, the check code is X. Otherwise, the remainder is taken directly. The check code and the intermediate code are combined to form a 20-digit unique batch number. Finally, a uniqueness check is performed. The generated batch number is compared with the historical batch number database stored in the blockchain. If there is a duplicate, a derivative code is regenerated to supplement the value until there is no matching record in the historical database. After the check is passed, the batch number is bound to the corresponding material identification information.

[0037] The system extracts various data from standardized data to identify the raw material composition, storage environment, transportation trajectory, and recycling results corresponding to each drug batch. Specifically, using the generated unique batch number as the search keyword, the system traverses the standardized data warehouse to filter various core data for each batch. Raw material composition data is filtered by including raw material type, purity, supplier name, and inspection certificate number. Storage environment data is filtered by including inbound time, outbound time, storage location number, temperature and humidity records during storage, and inventory count results. Transportation trajectory information is filtered by including carrier name, vehicle number, origin, destination, key coordinates of the route, and temperature and humidity data during transportation. Recycling results are filtered by including the name of the recycling unit, recycling time, recycling quantity, destruction method, and signature information of the destruction supervisor. During the filtering process, the system automatically verifies the correlation between data and batch number, eliminating data without a clear batch affiliation. For duplicate records within the same data category, the record with the most recent collection time and the highest source credibility is retained to ensure that the filtered data accurately corresponds to the target batch.

[0038] By performing data association operations, various types of filtered data are bound to their corresponding unique batch numbers, forming a bound data set. Specifically, this involves: establishing a data association mapping table using the unique batch number as the core association key; binding each type of data, such as raw material composition, storage environment, transportation trajectory, and recycling results, to its corresponding batch number, clarifying the batch affiliation of each data entry; and performing dual verification during the binding process: first, completeness verification, checking whether all types of data have been associated with the batch number and whether any key data points have been omitted; and second, consistency verification, comparing overlapping fields (such as drug name and specifications) in different stages of the same batch to ensure consistent descriptions and no conflicts. If any unassociated data is found, it is added; if conflicting data is found, it is marked as abnormal and triggers manual verification. After verification and correction, the data is rebound, ultimately forming a bound data set with the batch number as the index and various types of data linked in an orderly manner.

[0039] Based on the bound dataset, a structured drug traceability data block is established. Specifically, this includes: constructing a structured drug traceability data block based on the bound dataset using a three-layer architecture: a basic information layer, a process data layer, and a verification information layer. The basic information layer stores core identifier data such as batch number, complete material identification information, and data block generation time. The process data layer stores filtered data for each process according to the circulation sequence of raw material procurement, warehousing management, transportation and distribution, and recycling. Each process data is labeled with its collection time and data source. The verification information layer stores data integrity identifiers (such as the number of data entries in each process), consistency verification results, and data association status identifiers. After construction, the system standardizes the format of the data blocks, unifies field naming and data types, ensures the data block structure is well-organized, and ultimately forms a complete structured drug traceability data block.

[0040] This embodiment extracts core material identification information and generates unique batch numbers to establish a unique traceability identity for each drug batch, ensuring the uniqueness and accuracy of the traceability process; it filters various types of data for the corresponding batches, eliminating irrelevant information to ensure the relevance and effectiveness of the traceability data; it uses the batch number as the core for data association and binding to avoid data chaos and make the scattered data from various stages form an organic whole; and it constructs structured data blocks to standardize data storage format and improve the usability and management efficiency of traceability data.

[0041] In a preferred embodiment of the present invention, drug traceability data blocks are uploaded to a blockchain network for distributed storage via a consensus mechanism, and a unique hash value and timestamp are generated for each data block; the key spatiotemporal attributes of each data block are mapped to circular geometric features, including:

[0042] Based on drug traceability data blocks, a blockchain network access operation is performed. The drug traceability data blocks are uploaded to the blockchain network through a consensus mechanism to complete distributed storage. Specifically, this includes: first, performing blockchain node access authentication. The system's built-in blockchain access module reads the digital certificate of the traceability management system (containing the enterprise's unique identifier, public key, and certification authority signature) and sends an access request to the consensus node in the blockchain network. The consensus node performs dual verification of the request information: first, it verifies the validity of the digital certificate by decrypting the certificate signature using the certification authority's public key and comparing the decryption result with the certificate content; second, it verifies the qualifications of the access entity by querying the pre-stored fentanyl-related drug regulatory whitelist in the blockchain to confirm that the enterprise's qualification number for accessing the system is within the whitelist. After successful verification, the network assigns a temporary access node ID, establishes an encrypted communication link (using the AES-256 encryption algorithm), and completes access preparation. Subsequently, the drug traceability data block is preprocessed. The system automatically extracts the core information of the data block (unique batch number, key data summary of each stage) to generate a data digest. At the same time, in accordance with the data transmission specifications of the blockchain network, the JSON format data block is converted into the network-recognizable ProtocolBuffers format, and the data volume is compressed (the compression ratio is calculated based on the original data size, and the compressed volume = original volume × fixed compression coefficient 0.35 + 10KB basic redundancy), thereby improving transmission efficiency.

[0043] Finally, data upload and storage are completed through a consensus mechanism. This system adopts a practical Byzantine fault-tolerant consensus mechanism. The specific process is as follows: the access node sends the preprocessed data block as a proposal to all consensus nodes; each consensus node completes the integrity verification of the data block within 500 milliseconds (checking whether the three-layer architecture of the data block is complete) and returns the verification result of passing or rejecting; the access node counts the verification pass rate, calculated by dividing the number of nodes that returned passing results by the total number of nodes participating in the verification. When the verification pass rate reaches 80% or more, consensus is reached, and the data block is synchronously written to the local ledger of each node; if the pass rate is not reached, a new data proposal is generated (supplementing the missing verification information) and verification is initiated again until consensus is reached. After consensus is reached, each node stores the data block in the local distributed database, completing the distributed storage operation.

[0044] After the distributed storage is completed, a unique hash value and timestamp are generated for each successfully stored data block. Specifically, the hash value calculation uses the SHA-256 encryption algorithm, taking the complete content of the data block (including the basic information layer, the process data layer, the verification information layer, and metadata) as input. The specific calculation process is as follows: the data block content is grouped into 512-bit groups, and each group is padded (to ensure the data length is 512×n+448 bits, where n is a positive integer), supplementing the original data length information (64 bits) to form a complete group; eight 32-bit hash initial values ​​are initialized, these initial values ​​are derived from the first 32 digits of the fractional part of the square root of the first eight prime numbers; then 64 rounds of iterative calculations are performed, each round using five fixed operation functions (namely...). Selection function, Majority function Large right shift functions Large right shift functions Small right shift function The system employs a small right shift function (called cyclically over 64 rounds) and 64 fixed constants. These constants are derived from the first 32 digits of the fractional part of the cube root of the first 64 prime numbers, such as 428a2f98 in round 1 and 71374491 in round 2. Each round of computation combines the current group of data with the hash value from the previous round and updates the hash value through function operations. After 64 rounds of iteration, the final eight 32-bit hash values ​​are concatenated to form a unique 256-bit (32-byte) hash value. This hash value serves as the digital fingerprint of the data block. If any modification is made to the content of the data block, the hash value will change fundamentally. The timestamp generation uses the global synchronized time of the blockchain network, rather than the local time of a single node, to ensure the consistency of the time sequence. When a data block reaches consensus and is written to the ledger, the access node requests the current standard time from the time synchronization node of the blockchain network. The time synchronization node calculates the average based on the local time of more than half of the nodes in the network. The calculation method is to sum the time values ​​of each node and divide by the number of nodes. The result is accurate to milliseconds and forms a standard timestamp. The generated hash value and timestamp are bound to the corresponding data block in the form of key-value pairs and stored in the index of each node. At the same time, the hash value and timestamp are added to the verification information layer of the data block to complete the identification and strengthening of the data block.

[0045] Based on the corresponding unique hash value and timestamp, key spatiotemporal attribute data is extracted from the stored data blocks. Specifically, the system uses the generated unique hash value as the primary search key and the timestamp as an auxiliary search condition. A global search is performed in the index library of each node in the blockchain to quickly locate the corresponding data block storage address. The complete data block content is read through the address, and then spatiotemporal attribute data is extracted from the stage data layer of the data block. The data is extracted according to the circulation stage. Specifically, in the production and processing stage, the start time of material feeding, the completion time of production, and the latitude and longitude coordinates of the production workshop are extracted; in the warehousing management stage, the inbound time, the outbound time, the latitude and longitude coordinates of the warehouse, and the three-dimensional coordinates of the storage location (converted from warehouse number + row number + layer number to X / Y / Z coordinates) are extracted; in the transportation and distribution stage, the departure time, the arrival time, the real-time latitude and longitude coordinates of the transport vehicle (one record every 2 minutes), and the coordinates of the loading and unloading locations are extracted; and in the recycling and dismantling stage, the recycling reception time, the dismantling start time, and the latitude and longitude coordinates of the dismantling site are extracted.

[0046] After extraction, the data is filtered and purified to remove obviously abnormal spatiotemporal data (such as data whose latitude and longitude exceed the range of Earth's coordinates). The confidence level of the spatiotemporal data of each stage is calculated by dividing the number of valid data records in that stage by the total number of extracted data records. For data in stages with a confidence level of less than 90%, the system automatically marks and supplements the extraction of backup data for that stage. For example, if the coordinates of the transportation stage are missing, the coordinates of the toll station in the highway toll records are extracted. Finally, a key spatiotemporal attribute dataset is formed by organizing the stages, time and space coordinates. Each data record is associated with a corresponding hash value fragment to ensure data traceability.

[0047] Based on spatiotemporal attribute data, the coordinates of the center point and radius parameters of a circle are determined. The circular boundary is constructed by calculating the distances from the center point to each spatiotemporal data point, thus mapping the discrete spatiotemporal attribute data into a circular geometric feature with clear geometric characteristics. Specifically, this includes: first, determining the coordinates of the circle's center point; then, using a spatiotemporal weighted average method; converting the timestamps in the spatiotemporal attribute data into numerical time factors by subtracting the initial timestamp from the original timestamp to obtain the time difference in seconds; and finally, converting the spatial coordinates to Cartesian coordinates (longitude as the X-axis and latitude as the Y-axis, using the conversion formula X = ...). Longitude × 111319.9, Y = Latitude × 111319.9 × cos(Latitude × π / 180), where π is taken as 3.1416); then calculate the weight of each spatiotemporal data point: time weight = time factor of the data point / sum of time factors of all data points; spatial weight = 1 - average spatial distance between the data point and all data points / maximum spatial distance; comprehensive weight = time weight × 0.4 + spatial weight × 0.6; the center point coordinates (X0, Y0) are calculated by multiplying the X coordinate of each data point by the sum of the corresponding comprehensive weights, and the Y coordinates are calculated similarly, i.e., X0 = Y0= Where Xi and Yi are the planar coordinates of the i-th data point, and Wi is the comprehensive weight of the i-th data point; then, the radius parameter of the circle is calculated. Based on the spatial distance from the center point to each spatiotemporal data point, the average and standard deviation of all distances are calculated. The radius = average distance + standard deviation × 1.5, ensuring that more than 99% of the data points can be included within the circle; the distance calculation uses the Euclidean distance formula, that is, the distance D from a data point to the center point = ... Average value = / Number of data points, standard deviation= Then, a circular boundary is constructed, with the calculated (X0, Y0) as the center and the radius as the distance threshold. A circular geometry is drawn, and each spatiotemporal data point is marked inside the circle. If there are data points outside the circle, the radius is readjusted (increased by 0.5 times the standard deviation) until all data points are included. Finally, geometric feature verification is performed, calculating the circular data coverage (number of data points inside the circle / total number of data points) and compactness (radius / maximum distance of data point distribution). The coverage must reach 100%, and the compactness must be less than 0.8. If the verification passes, the final circular geometric feature is formed and bound to the hash value and timestamp of the corresponding data block for storage. If it fails, the center point coordinates and radius are recalculated until the requirements are met.

[0048] This embodiment ensures the legitimacy of blockchain access entities through strict node authentication and encrypted communication, preventing unauthorized data access from contaminating regulatory data. The combination of distributed storage and a consensus mechanism frees data blocks from the control of a single node, preventing malicious tampering or deletion and providing a trusted storage medium for traceability data, thus resolving the single point of failure and trust crisis issues of centralized storage. A unique hash value provides an immutable digital fingerprint for each data block; any change to the data content will invalidate the hash value, facilitating rapid verification of data integrity. Globally synchronized timestamps establish a unified timeline benchmark, clearly defining the temporal relationship of data at each stage. This approach addresses the issues of chaotic time records and difficulty in defining time sequences during data tracing. It utilizes hash values ​​and timestamps as retrieval clues to achieve accurate and rapid extraction of spatiotemporal data, avoiding blind and redundant data extraction. Data is extracted and purified by stage, ensuring the effectiveness and relevance of spatiotemporal data while preserving the connection between the data and the original data blocks, guaranteeing the traceability of spatiotemporal data. Furthermore, it transforms discrete spatiotemporal data into intuitive circular geometric features, converting abstract data associations into computable geometric relationships, achieving a structured expression of data features, breaking the limitations of relying on manual judgment in data association, and improving the automation and accuracy of association verification.

[0049] In a preferred embodiment of the present invention, based on the principle of determining the positional relationship between circles, a common chord between different circular geometric features is calculated to establish a strong correlation verification layer between data blocks. By analyzing the relative positional relationship between circular geometric features, cross-validation and correlation strengthening are performed on the data blocks to obtain blockchain traceability data with enhanced anti-tampering and correlation verification capabilities, including:

[0050] The system acquires the circular geometric features corresponding to multiple data blocks, including the center coordinates and radius parameters of each circle. Specifically, this involves: first, determining the range of data blocks; then, based on traceability requirements (such as full-cycle traceability of a batch of drugs or comparison of multiple batches in a specific distribution process), receiving user-inputted query conditions, such as the range of drug batch numbers or the type of distribution process; and using these conditions as the retrieval basis, accessing the blockchain's distributed index, which stores a mapping table of data block hash values, circular geometric features, and timestamps. The system filters out all data block hash values ​​that meet the requirements based on the query conditions, and then locates the storage address of the circular geometric feature corresponding to each hash value. Next, circular geometric feature extraction is performed. The system reads the complete geometric feature data from the located storage address. The feature information corresponding to each data block contains three core parts: the center coordinates (X, Y, X, Y ... The coordinates (0, Y0) are Cartesian coordinates calculated using a spatiotemporal weighted average method; the radius parameter R is the radius of the circle calculated based on the distribution of data points; the feature association identifier is composed of the first 8 bits of the data block hash value and the second-level value of the timestamp, used to clarify the correspondence between the geometric feature and the original data block; finally, feature validity verification is performed. The system checks whether each extracted circular geometric feature contains complete center coordinates, radius parameters, and association identifiers, and verifies the consistency between the feature association identifier and the data block hash value (by comparing the first 8 bits of the hash value with the corresponding part in the identifier). If there are missing feature information or inconsistent associations, the system automatically marks it as an invalid feature and rereads the geometric features of the corresponding data block from the blockchain to ensure that all the finally obtained circular geometric features are complete, valid, and accurately bound to the data block.

[0051] Based on circular geometric features, the system calculates the center-to-center distance between any two circles. Specifically, it first constructs a feature dataset. The system organizes all extracted circular geometric features into a two-dimensional data table based on feature association identifiers, center X-coordinates, center Y-coordinates, and radii. Each circle is represented as a row in the data table, ensuring a consistent data format. If there are N target data blocks, the number of center-to-center distance pairs to be calculated is N×(N-1) / 2. The system iterates through the data table using a double loop to generate all possible pairs of two circles, avoiding redundant calculations. For example, if the distance between circle A and circle B has already been calculated, the distance between circle B and circle A will not be calculated again. Then, the center-to-center distance is calculated using the Euclidean distance formula as the core calculation method. For any two circles A (center coordinates Xa, Ya) and B (center coordinates Xb, Yb), the formula for calculating the center-to-center distance is d = ... , during the calculation process, the system first squares the differences in the X coordinates and Y coordinates of the two circle centers respectively, then adds the two squared results, and finally takes the square root of the added result to obtain the distance between the circle centers; to ensure calculation accuracy, all coordinate values and calculation results are retained to four decimal places, and the square root operation is implemented using the Newton iteration method, with the iteration termination condition being that the difference between two consecutive calculation results is less than 0.0001; for example, if the center coordinates of circle A are (12568.3245, 18956.7821) and the center coordinates of circle B are (12572.1563, 18960.3452), then the difference in the X coordinates is 12572.1563 - 12568.3245 = 3.8318, which is 14.6827 after squaring; the difference in the Y coordinates is 18960.3452 - 18956.7821 = 3.5631, which is 12.6957 after squaring; the sum of the two is 27.3784, and the distance between the circle centers d is obtained after taking the square root; after the calculation is completed, the system binds and stores the feature association identifier of each combination pair with the corresponding distance between the circle centers to form an associated data set of circle A identifier, circle B identifier, and distance between the circle centers.

[0052] According to the relationship between the distance between the circle centers and the radii of the two circles, the intersection state of the two circles is determined. When it is determined that the two circles are in an intersection state, the common chord formed by the intersection of the two circles is calculated, which specifically includes: first, the positional relationship between the two circles is determined. The system extracts the distance between the circle centers d of each circle combination pair from the associated data set, as well as the radii Ra (radius of circle A) and Rb (radius of circle B) of the two circles respectively. According to the numerical relationship between d and Ra, Rb, the positional relationship between the two circles is divided into five categories. When d > Ra + Rb, it is determined to be separated; when d = Ra + Rb, it is determined to be externally tangent; when |Ra - Rb| < d < Ra + Rb, it is determined to be intersecting; when d = |Ra - Rb|, it is determined to be internally tangent; when d < |Ra - Rb|, it is determined to be internally contained. During the determination process, the system first calculates the numerical values of Ra + Rb and |Ra - Rb|, then compares the distance between the circle centers with these two numerical values respectively, automatically matches the corresponding positional relationship type, and adds a positional relationship label to each combination pair; subsequently, the common chord is calculated for the intersecting circle pairs. , the calculation process is divided into two steps. The first step is to calculate the distance from the circle center to the common chord. For the two intersecting circles A and B, let the distance from the center of circle A to the common chord be Da, and the distance from the center of circle B to the common chord be Db. According to the geometric relationship, Da = , Db = , and Da + Db = d (when the centers of the two circles are on both sides of the common chord) or |Da - Db| = d (when the centers of the two circles are on the same side of the common chord). Through combined derivation, we can obtain ; the second step is to calculate the length L of the common chord. According to the Pythagorean theorem, half of the length of the common chord is Therefore, the length of the common chord L = 2 × Therefore, the length of the common chord L = Simultaneously, the system also needs to determine the equation of the line containing the common chord. Based on the center (Xa, Ya) of circle A and the center (Xb, Yb) of circle B, the slope k1=(Yb) of the line connecting the two centers is first calculated. Ya) / (Xb Xa), since the common chord is perpendicular to the line connecting the two centers, the slope of the common chord is k2 = 1 / k1; then, combined with the midpoint coordinates of the common chord ((Xa+Xb) / 2, (Ya+Yb) / 2), the equation of the line containing the common chord can be obtained by using the point-slope method. After the calculation is completed, the system binds and stores the identifier of the intersecting circle pair, the length of the common chord, the equation of the common chord line, and the corresponding center distance and radius parameters to form an intersection feature association set.

[0053] A strong correlation verification layer is established based on a common chord. By analyzing the relative positional relationships between multiple circular geometric features, cross-validation is performed on the corresponding data blocks to obtain the cross-validation results. Specifically, this involves: First, establishing a strong correlation verification layer. The system uses the common chord as the core correlation link, associating all data blocks corresponding to intersecting circles into a network. Specifically, each pair of intersecting circles forms a correlation edge through the common chord. Multiple interconnected circles (e.g., circles A intersect with B, and B intersects with C, then A, B, and C form a correlation network) constitute a correlation subgraph, and each correlation subgraph is a strong correlation verification layer. In the verification layer, the system labels each correlation edge with the length of the common chord (reflecting the correlation strength; the longer the common chord, the tighter the data block correlation) and the correlation link type (e.g., correlation between production and warehousing links, correlation between warehousing and transportation links). Simultaneously, the hash value and timestamp of each data block are added as node attributes to the verification layer, forming a visualized correlation network structure. Then, cross-validation is performed. The verification content is divided into two dimensions: one is spatiotemporal logic... The first step is consistency verification. Based on the timestamps and geometric positions of each data block in the verification layer, it determines whether the corresponding circulation links of the data blocks conform to the chronological order and spatial transfer logic. For example, the timestamp of the data block in the production link should be earlier than that in the warehousing link, and their circular geometric features should intersect (reflecting spatial connection). If the timestamps are reversed or the circles are separated, it is marked as a spatiotemporal logic anomaly. The second step is data content consistency verification. It extracts the core fields (such as drug batch number and raw material composition) of the related data blocks in the verification layer for comparison to ensure that the core information of the data in each link of the same batch of drugs is consistent. If there is a batch number mismatch or component data conflict, it is marked as a content consistency anomaly. During the cross-validation process, the system classifies the anomalies according to their severity (minor anomalies are data format defects; general anomalies are non-core field inconsistencies; severe anomalies are core field conflicts or spatiotemporal logic inversions), and records the identifier, anomaly type, and specific differences of the abnormal data blocks. Finally, it forms a cross-validation result that includes a list of data blocks that have passed verification, a list of abnormal data blocks, and the reasons.

[0054] Based on the cross-validation results, the correlation between data blocks is strengthened to obtain blockchain traceability data with enhanced anti-tampering and correlation verification capabilities. Specifically, for verified data blocks, the core is to add correlation identifiers and supplementary indexes to make the correlation between data blocks searchable and traceable. In practice, a unique correlation verification layer ID is uniformly added to all data blocks in the same verification layer. The identifier contains the core information of that layer, namely the combination of related links, such as production-warehousing-transportation, common chord key parameters (length, linear equation), and cross-validation pass timestamp, to ensure that each data block can be clearly assigned to the corresponding correlation network. In the verification information layer of each data block, a list of hash values ​​of related data blocks is added. For example, the list of production data blocks contains the hash values ​​of warehousing and transportation data blocks, and the list of warehousing data blocks contains the hash values ​​of production and transportation data blocks, so that the effect of quickly locating the correlation data of the entire process can be achieved through any data block.

[0055] For marked abnormal data blocks, different handling strategies are adopted according to the severity to ensure that only trustworthy data can enter the traceability chain. Minor anomalies are handled by automatic system correction, i.e., calling the data standardization processing module to repair the data according to a unified format, such as correcting the timestamp 2025.12.1 to 2025-12-0100:00:00. After correction, the verification process is resubmitted, and if it passes, it is included in the associated system. General anomalies are handled by triggering manual verification. The system pushes the hash value and abnormal fields of the abnormal data block, such as carrier remarks differences, to the responsible persons at the corresponding links, such as warehouse managers and transportation dispatchers. After the responsible persons check the actual business records, they supplement the difference explanation or correct the data. After manual confirmation, the data is re-verified. Severe anomalies are handled by initiating risk isolation and early warning. The system isolates the data block from the associated network, suspends its participation in traceability, and notifies the supervisors via SMS and system pop-ups. After verification by the supervisors, if the data is confirmed to be incorrect, such as a batch number entry error, it is directly deleted. If the data is confirmed to be valid, such as a timestamp deviation caused by special circumstances, the supervisors supplement the regulatory supporting materials and re-initiate the verification.

[0056] After all data blocks have been processed, the system synchronizes the updated content to the blockchain to ensure that the strengthened associations are immutable. This involves using data blocks with added association identifiers and bidirectional indexes as input, and recalculating their hash values ​​using the SHA-256 algorithm. Because of the added association information, the new hash values ​​are completely different from the original hash values, directly reflecting the updated status of the data blocks. Using a Byzantine fault-tolerant consensus mechanism, the updated data blocks and new hash values ​​are synchronized to the local ledgers of each blockchain node. Simultaneously, the blockchain index is updated, rebinding the new hash values, association identifiers, and the list of associated data blocks to ensure that subsequent queries can directly retrieve the strengthened association data. Ultimately, after the above processing, the resulting blockchain traceability data not only retains the tamper-proof characteristics of individual data blocks but also strengthens the association of data across all stages through association identifiers and bidirectional indexes, achieving the regulatory requirement of individual traceability and full-chain traceability.

[0057] This embodiment ensures a one-to-one correspondence between the acquired circular geometric features and data blocks through precise positioning and validity verification using a blockchain index library. This avoids association errors caused by feature confusion or missing features, guaranteeing the accuracy of association verification. Standardized distance calculation methods and precise computational logic provide quantitative basis for determining the positional relationship between two circles, avoiding errors caused by subjective judgment. Batch processing also improves computational efficiency. Geometric relationships transform data block associations into computable common chord features, making abstract data associations concrete and providing objective geometric basis for data block association. Precise determination of intersection states ensures that subsequent verification is only performed on data blocks with logical associations, reducing invalid computations. A strong association verification layer realizes networked association of data blocks, breaking the isolation of data in traceability. Cross-validation ensures data reliability from both spatiotemporal and content dimensions, automatically identifying abnormal data and improving the credibility and regulatory efficiency of traceability data. Association identifiers and bidirectional indexes strengthen data block associations, making the traceability chain clearer and more complete. An abnormal data processing mechanism and blockchain re-certification further enhance data anti-tampering capabilities, ensuring that the final traceability data is both closely associated and secure.

[0058] In a preferred embodiment of the present invention, based on blockchain traceability data, the traceability data points of each stage are organized into a hierarchical spherical spatial index structure, wherein the spherical spatial index is composed of multiple spherical nodes, including:

[0059] Based on blockchain traceability data, the system extracts spatiotemporal coordinate information of traceability data points at each stage. Specifically, this includes: First, locating the traceability data. The system uses a blockchain index library to filter all data blocks (covering production, warehousing, transportation, and recycling stages) of the target batch of drugs throughout their entire lifecycle, based on the drug's unique batch number or a strong-association verification layer ID. Each data block's stage data layer stores corresponding spatiotemporal attribute data. The system uses preset field matching rules, such as keywords like production workshop coordinates, warehouse coordinates, and transportation node coordinates, to locate the core spatiotemporal data fields for each stage. Then, spatiotemporal coordinate extraction is performed, extracting the coordinates of key data points for different stages. Specifically, in the production stage, the system extracts the latitude and longitude coordinates of raw material input points, intermediate product inspection points, and finished product outbound points; in the warehousing stage, it extracts... The latitude and longitude coordinates of the receiving and inspection points, storage locations, and outbound handover points are extracted. For the transportation stage, the latitude and longitude coordinates of the departure point, intermediate stop points, and destination receiving point are extracted. For the recycling stage, the latitude and longitude coordinates of the recycling receiving point and dismantling operation point are extracted. Simultaneously, the timestamp corresponding to each coordinate point is extracted, forming a raw data set of stage type - spatiotemporal coordinates (longitude, latitude) - timestamp - data block hash value. Finally, the coordinate format is standardized, converting the extracted latitude and longitude coordinates into Cartesian coordinates required for spherical space calculations: X = longitude × 111319.9, Y = latitude × 111319.9 × cos(latitude × π / 180) (π is taken as 3.1416). After conversion, four decimal places are retained, and the timestamps are converted into numerical timestamps, ultimately forming a standardized spatiotemporal coordinate dataset.

[0060] Based on spatiotemporal coordinate information, an initial spherical spatial node is constructed. Specifically, this involves: first, grouping data according to the circulation process. The system splits the spatiotemporal coordinate dataset into independent data groups such as production, warehousing, transportation, and recycling based on the process type field, ensuring that data points within the same group belong to the same circulation process and avoiding cross-process data mixing that could lead to node construction deviations; then, determining the core coordinates of each group and calculating them using a spatiotemporal weighted average method. For a data group of a specific process, the planar coordinates (Xi, Yi) of each data point and the numerical timestamp Ti are used as calculation factors to first calculate the time weight of each data point. Wi= ( (This is the sum of the timestamps of all data points in the group), then calculate the core coordinates (Xc, Yc), using the formula: , The core coordinates represent the aggregation center of the data points in this stage, reflecting the concentrated location of the spatiotemporal data in that stage. Finally, the center and radius of the initial spherical node are calculated, with the center coordinates directly using the aforementioned core coordinates (Xc, Yc). The radius calculation is based on the spatial distance from the center to all data points within the group. First, the distance Di from each data point to the center is calculated using the Euclidean distance formula. Then, take the maximum value Dmax among all Di, and the radius R = Dmax + (Dmax × 0.1), where the 10% increase is for redundancy, to ensure that all data points in this stage can be contained by the spherical node. For example, if the maximum distance from a data point in a certain storage group to the center of the sphere is 250 meters, then the radius is 250 + 25 = 275 meters. Each initial spherical node is associated with the type of the corresponding stage, the list of data block hash values, and the timestamp range to complete the initial node construction.

[0061] After the initial spherical spatial nodes are constructed, the data space is divided into multiple interconnected spherical regions based on the principle of spherical space partitioning. Specifically, this involves: firstly, performing association clustering. Based on the initial spherical nodes and considering the correlation between stages in the drug distribution process (e.g., the order of production, warehousing, transportation, and recycling), a density-based clustering algorithm (DBSCAN) is used to cluster all initial nodes and scattered data points. The core parameters for clustering are set as follows: the neighborhood radius is 1.2 times the average radius of the initial nodes, and the minimum number of data points is 3 (to ensure the statistical significance of the clustering results). During the clustering process, initial nodes in adjacent distribution stages (e.g., production nodes and warehousing nodes) are preferentially grouped into the same cluster because their data have a natural correlation. After clustering, each cluster becomes a spherical region to be partitioned. The initial domain structure is established; then, the parameters of each spherical region are calculated. For each cluster, the center and radius of the region are recalculated. The center (Xz, Yz) is the spatiotemporal weighted average coordinate of all data points within the cluster; the radius Rz is the maximum distance Dmax' from all data points within the cluster to the center, with an additional 5% redundancy, i.e., Rz = Dmax' × 1.05. Finally, the regional relationships are labeled. Based on the drug circulation sequence and the association logic during clustering, each spherical region is labeled with an associated region ID. For example, spherical region A corresponding to the production stage is labeled with its downstream associated region B corresponding to warehousing; warehousing region B is labeled with upstream associated region A and downstream associated region C (transportation region). This method ensures that the divided spherical regions are not isolated, but form an association network consistent with drug circulation.

[0062] Calculate the spatiotemporal boundary information of the data points contained in each spherical region to obtain the spatial inclusion relationship between spherical regions. Specifically, this includes: First, calculating the spatiotemporal boundary information. The boundary information of each spherical region is divided into spatial boundary and temporal boundary. The spatial boundary is the coordinates of the region's center (Xz, Yz) and radius Rz. The temporal boundary is the minimum value Tmin and the maximum value Tmax of the numerical timestamps of all data points in the region, i.e., the time range corresponding to the data in that region. For example, if the Tmin of a transportation region is 1733040000 seconds (corresponding to November 30, 2024) and the Tmax is 1733126400 seconds (corresponding to December 1, 2024), then the time boundary is that 24-hour period. The spatiotemporal boundary information is bound and stored with the region ID and the list of associated regions. Then, calculate the spatial inclusion relationship by selecting any two spherical regions. For region A (center Xa, Ya, radius Ra) and region B (center Xb, Yb, radius Rb), the distance Dab between the two centers is first calculated using the Euclidean distance formula. Then, the inclusion relationship is determined based on the numerical relationship between Dab and Ra and Rb. When Dab + Ra ≤ Rb, region A is completely included in region B; when Dab + Rb ≤ Ra, region B is completely included in region A; when |Ra - Rb| < Dab < Ra + Rb, the two regions intersect but have no inclusion relationship; when Dab ≥ Ra + Rb, the two regions are disjoint. For example, if region A has a radius of 200 meters, region B has a radius of 500 meters, and the distance between the two centers is 250 meters, then since 250 + 200 = 450 ≤ 500, A is included in B. The system performs this calculation for all pairs of regions, records the spatial relationship of each pair of regions, and forms a region inclusion relationship table.

[0063] Based on the spatial inclusion relationship between spherical regions, a hierarchical spherical spatial index structure is established, specifically including: First, dividing the index into levels. According to the spatial inclusion relationship and the macroscopic level of the circulation links, the index is divided into three levels. The top level is the overall process area, corresponding to a spherical area containing all data points of the circulation links. Its center is the spatiotemporal weighted average coordinate of all data points, and its radius is the maximum distribution distance of data points within the overall area. The middle level is the link aggregation area, corresponding to the spherical areas formed by the clustering of production, warehousing, transportation, etc. Each middle level area is contained within the top level area. The bottom level is the subdivided operation area, further subdividing the initial spherical nodes in the middle level areas. For example, the warehousing area is subdivided into spherical nodes corresponding to the inbound area, storage area, and outbound area. Each bottom level area is contained within the corresponding middle level area, forming a hierarchical structure of overall area, link area, and operation area.

[0064] Subsequently, an index association is constructed, creating an index entry for each level of spherical region. Each index entry includes a region ID, spatiotemporal boundary information, a list of associated region IDs, and the hash value index of the underlying data block. The top-level index entry is associated with all middle-level region IDs; middle-level index entries are associated with their corresponding top-level and bottom-level region IDs; and bottom-level index entries are associated with their corresponding middle-level region IDs and the storage address of the specific data block. Simultaneously, spatiotemporal retrieval factors are embedded in the index. These factors, combining time and spatial boundaries as core elements, are key components for achieving accurate multi-condition queries. By embedding these spatiotemporal retrieval factors into the index and structurally binding the region's time boundaries (Tmin, Tmax) with its spatial boundaries (sphere center coordinates, radius), a composite retrieval dimension of spatial range and time interval is formed. When querying source data for a certain condition, both spatial location (e.g., a latitude and longitude range) and time range (e.g., a date range) can be input simultaneously. The retrieval factors will quickly match spherical regions that meet both conditions, thereby locating the corresponding index entry and associated data block, efficiently supporting queries based on a combination of time range and spatial location conditions.

[0065] Finally, the index storage and optimization are completed, converting the hierarchical index structure into a key-value pair format supported by the blockchain (the key is the region ID + hierarchy identifier, and the value is the complete index item), and synchronizing it to the distributed index library of the blockchain. To improve query efficiency, the system pre-sorts the index, arranging the middle-level indexes according to the time boundary of the region and the bottom-level indexes according to the X coordinate of the spatial location, ultimately forming a spherical spatial index structure that combines hierarchical association and query efficiency.

[0066] This embodiment extracts and standardizes the spatiotemporal coordinates of core data points at each stage, ensuring the accuracy and reliability of the data source for spatial structure construction and avoiding misjudgments of spatial relationships due to coordinate confusion. Coordinates are associated with data block hash values ​​to solve the problem of data and location disconnect in traceability. Spherical nodes are constructed by grouping by stage to achieve aggregated management of data from each stage, forming structured units from scattered spatiotemporal data. Redundancy radius design ensures complete inclusion of data points, preventing data omissions and improving the integrity of the spatial structure. Combining circulation logic and density clustering, the spherical region ensures that it conforms to data distribution characteristics and is also associated with drug circulation. This approach avoids arbitrary regional divisions; the labeling of relationships creates an organic network of regions, enhancing the relevance of data queries; clear spatiotemporal boundaries provide precise filtering conditions for data queries, reducing invalid data retrieval; geometric calculations quantify the inclusion relationships between regions, providing an objective basis for index hierarchy division, avoiding hierarchical chaos, and ensuring the logic and stability of the index structure; the hierarchical structure improves the retrieval efficiency of traceability data, solving the pain point of "time-consuming queries in flat indexes"; the combination of index and blockchain retains the convenience of index queries while inheriting the tamper-proof characteristics of blockchain, and supports spatiotemporal combination queries to meet multi-dimensional regulatory needs.

[0067] In a preferred embodiment of the present invention, drug serial number or vehicle VIN code data is received, and the data set most relevant to the query conditions is quickly located based on a spherical spatial index. Corresponding standardized data for the entire lifecycle is retrieved across stages, and a full-chain traceability report of the drug component is generated by integrating and generating the data to complete the full lifecycle traceability query of the drug component, including:

[0068] The system receives user-input drug serial numbers or vehicle VIN codes as query conditions. Based on these conditions, it determines the initial query position in a spherical spatial index. Using the principle of spherical nearest neighbor search, it calculates the spatial distance between the query point and each spherical node to obtain a spatial distance ranking result. Specifically, the process includes: The first stage is query condition parsing and validity verification. The system receives user-input query data through a visual interactive interface, supporting two types of core conditions: 1) a unique drug serial number (an 18-digit code generated by the manufacturer according to regulatory standards, containing the manufacturer code, production year, and batch number); 2) a vehicle VIN code (vehicle identification code, associated with transportation data). Upon receipt, a format verification is immediately performed. For example, the serial number must conform to the structure of the first 6 digits of the manufacturer code, 4 digits of the year, and 8 digits of the batch number; the VIN code must be a 17-digit alphanumeric combination. If the verification fails, an input format error message is returned with the problem location marked. If the verification passes, the core identifier of the query condition is extracted. The second stage determines the initial query position. If the query condition is a drug serial number, the system directly matches the core data corresponding to the serial number through the blockchain index. The process begins by extracting the associated spatiotemporal coordinates of a data block, such as the coordinates of the finished product outbound point in the production process. These coordinates are then converted to Cartesian coordinates using a predetermined formula: X = longitude × 111319.9, Y = latitude × 111319.9 × cos(latitude × 3.1416 / 180). These coordinates serve as the initial query point. If the query condition is a vehicle VIN code, the corresponding data block in the transportation process is first matched to extract the coordinates of the transportation departure point or destination and perform a planar transformation, which serves as the initial query point. The third stage involves performing a spherical nearest neighbor search and distance sorting to determine the initial query point. Using the query point (Xq, Yq) as a reference, the underlying node data in the spherical spatial index is called to calculate the spatial distance between the query point and the center (Xn, Yn) of each spherical node. The distance calculation adopts the Euclidean distance formula. The calculation process is as follows: first calculate the square of the difference in X coordinates, then calculate the square of the difference in Y coordinates; add the two squared results and take the square root to obtain the straight-line distance between the two points. After the calculation is completed, all spherical nodes are sorted from near to far to form a spatial distance sorting result. At the same time, the region ID of each node is associated with the hash value of the data block it contains.

[0069] Based on the spatial distance sorting results, the data set matching the query conditions is located to obtain the location data set. Specifically, this includes: First, candidate node filtering is performed. The system presets a distance threshold (this threshold is 1.5 times the average radius of the spherical nodes at the corresponding level, automatically calculated and stored during index construction). Spherical nodes with a distance less than or equal to the threshold are extracted from the sorting results as candidate nodes. For example, if the average radius of the underlying nodes surrounding the initial query point is 300 meters, the threshold is set to 450 meters, retaining only nodes with a distance ≤ 450 meters, thus narrowing the subsequent matching range. Then, data association matching is performed. For each data block contained in the candidate node, its core association fields are extracted and matched with the query conditions. If the query condition is a drug serial number, the matching data block... The system ensures that the drug serial number and batch number fields are completely consistent. If the query condition is the vehicle VIN code, it matches the transport vehicle VIN code and carrier information fields of the data block. At the same time, it verifies whether the transport period corresponding to the VIN code overlaps with the data block timestamp. During the matching process, a field full match rule is adopted. If there is a difference in the core fields, the data block is directly excluded. Finally, the results are deduplicated and integrated. Since different spherical nodes may contain associated copies of the same data block, the system uses the data block hash value to deduplicate, retains the data block with a unique hash value, removes duplicates, and integrates them to form a location data set. Each data in the set contains the complete content of the data block, the circulation link to which it belongs, the associated spherical node information, and the matching basis with the query condition.

[0070] Based on the location-based dataset, a full-chain traceability report for fentanyl-related drugs is generated by retrieving corresponding standardized data across all stages of the drug's lifecycle. Specifically, this involves: first, performing cross-stage data retrieval; extracting the hash value of any data block from the location-based dataset; and tracing the upstream and downstream related data of that data block through a strong correlation verification layer's hash value list. For example, from a data block in the warehousing stage, data blocks in the upstream production and downstream transportation stages can be retrieved. Then, starting from the transportation stage data block, the retrieval continues to the downstream recycling stage data until all circulation stages of the drug from production to recycling are covered. During the retrieval process, the system automatically records the association paths of data at each stage to ensure the integrity of the traceability chain. Subsequently, data standardization processing is performed, sorting all data blocks retrieved across stages according to the circulation order of production, warehousing, transportation, and recycling, and unifying the field formats of the data at each stage. The latitude and longitude coordinates are retained to 6 decimal places; core fields (such as raw material composition, purity, and test results) are expressed according to regulatory standard terminology, for example, 99.5% purity is standardized as 99.5% effective ingredient purity, while duplicate fields and redundant information are removed, retaining only key traceability data; finally, a structured full-chain traceability report is generated, which is divided into four core modules: basic information module (drug serial number, batch number, manufacturer, production date); process details module (presenting the time, location, operator, key data and corresponding data block hash values ​​of each process in the order of circulation); correlation verification module (recording the correlation basis of data in each process, such as common chord parameters and cross-validation results); and anomaly alert module (marking the anomaly type and handling result if there is historical abnormal data). Each data item in the report is associated with a corresponding blockchain data block storage address, supporting traceability verification.

[0071] The entire supply chain traceability report is output to complete the full lifecycle traceability query of fentanyl-related drugs. Based on this report, the completeness and consistency of the data are verified to obtain a validated full supply chain traceability report. Specifically, the completeness verification focuses on the coverage of key stages and the integrity of fields. Stage coverage verification checks whether the report includes all circulation stages of the drug's entire lifecycle. If a stage is missing (e.g., only production and warehousing are included, but transportation and recycling are missing), the stage is marked as abnormal, and data for that stage is automatically retrieved. Field integrity verification checks whether the data for each stage includes the mandatory fields required by regulations; for example, the production stage must include... The source of raw materials and the inspector's number are required. The transportation process must include the driver's qualification number. If any required fields are missing, the field will be marked as missing. Consistency verification is divided into two categories: spatiotemporal logic and content association. Spatiotemporal logic verification checks whether the timestamps and spatial locations of adjacent processes are consistent. For example, the production completion time must be earlier than the warehousing entry time, and the spatial distance between the warehousing exit point and the transportation departure point must be within a reasonable range (e.g., ≤5 kilometers). If they do not meet the requirements, the spatiotemporal logic will be marked as missing. Content association verification checks whether the core data across processes is consistent. For example, the drug serial number and batch number must be exactly the same in each process, and the description of raw material components must be consistent. If there is a conflict, the content consistency will be marked as missing.

[0072] After all validations are completed, the results are judged. If there are no abnormal markers, the validation is judged as passed. If there are minor abnormalities (such as missing non-required fields) but the core data is correct, the abnormality is marked and the validation is judged as conditionally passed. If there are serious abnormalities, such as core field conflicts or missing key links, the validation is judged as failed and the data is retrieved again. Only the reports of validation passed and conditionally passed are allowed to proceed to the next step. The reports of conditionally passed must be marked with an abnormality prompt when outputting.

[0073] The verified full-chain traceability report is converted into a specified output format to generate a formatted full-chain traceability report. Specifically, the system supports two format specification methods: first, users actively select the output format during querying, such as PDF, Excel, JSON, and XML; second, a default format is automatically matched based on the user's identity, such as PDF for regulatory users, Excel for enterprise users, and JSON for system interface calls. If the user does not actively select a format and there is no default format for their identity, PDF is used uniformly as the output format. Subsequently, field mapping and format conversion are performed. Structured processing is applied to the characteristics of different formats. The PDF format uses a column layout, with basic information and related verification modules on the left, and the process details module on the right according to the timeline. Key data is highlighted in bold; Excel format is organized into tables according to the structure of link-field name-field value-data source, supporting data filtering and editing; JSON and XML formats retain the report's hierarchical structure, and field names adopt regulatory standards to facilitate data exchange between systems. During the conversion process, it is ensured that all data items are completely preserved without information loss; finally, format verification is performed to check whether the converted report meets the corresponding format specifications. PDF must ensure clear fonts, complete charts, and continuous page numbers; Excel must ensure consistent cell formatting and correct formulas (if statistical data is included); JSON / XML must ensure correct syntax and complete tags. If the verification fails, the conversion is repeated until a formatted full-chain traceability report that conforms to the specifications is generated.

[0074] The system pushes a formatted, end-to-end traceability report to the user's device via a pre-defined output interface. After delivery, the report is displayed on the user interface, enabling full-lifecycle traceability of fentanyl-related drugs. Specifically, the report push relies on a pre-defined output interface, with the interface type matching the user's access method. Web users push via HTTP / HTTPS, transmitting the formatted report as a file stream to their browser. Mobile users push via a RESTful interface, supporting report file download and online preview. Third-party platforms such as regulatory systems push via a blockchain smart contract interface, ensuring data transmission security and non-repudiation. During the push process, the system provides real-time feedback on the transmission progress. If a network interruption occurs, the system automatically retryes, returning a push failure message and providing a manual download link after three failed retries. The report is displayed in a layered manner. The improved readability of the report allows users to view the core content of the basic information and process details modules by default. Users can click to expand the details and view the complete fields. The verification and exception notification modules are presented in tabs, which users can switch between as needed. The blockchain data block addresses associated with the report can be clicked to directly link to the blockchain explorer to view the original data. The report also provides operation functions, supporting printing, downloading, and sharing (user permissions must be verified, and sensitive data cannot be shared indiscriminately). Finally, a query log is recorded, which includes the query user's identity information, query conditions, query time, report hash value, push status, etc. The log data is synchronously written to the blockchain for notarization, ensuring the traceability of the query behavior. If users have any objections to the report data, they can apply for re-verification through the report hash value in the log, ensuring the credibility of the traceability results. This completes the entire process of fentanyl-related drug traceability query throughout its entire life cycle.

[0075] This embodiment, based on spherical spatial indexing for distance calculation and precise matching, shortens data retrieval time and avoids the inefficiency caused by traversing all data. A dual verification mechanism ensures a high degree of matching between location data and query conditions, reducing interference from invalid data and improving query accuracy. Cross-stage correlation retrieval breaks down data silos, achieving full lifecycle data aggregation. Standardized processing and structured presentation make reports clear and easy to understand, meeting the reading needs of different users, while the associated blockchain address ensures data verifiability. A secondary verification mechanism further filters abnormal data, ensuring report integrity and consistency, and preventing erroneous data from misleading decisions. Anomaly tiered processing balances regulatory rigor with practical application flexibility, enhancing the report's credibility and practicality. Multi-format support adapts to different scenario needs, improving the applicability of traceability reports. Standardized interfaces and breakpoint resume mechanisms ensure the stability of report delivery, layered display and operational functions optimize user experience, and query log evidence storage strengthens the credibility of the traceability process. Combining spatial indexing technology with blockchain traceability not only meets the regulatory authorities' needs for full-process supervision of fentanyl-related drugs but also provides enterprises and the public with efficient and transparent traceability services, strengthening the risk management capabilities of drug circulation.

[0076] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the system as described above. All implementations in the above system embodiments are applicable to this embodiment and can achieve the same technical effects.

[0077] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the system as described above. All implementations in the above system embodiments are applicable to this embodiment and can achieve the same technical effects.

[0078] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A full-cycle traceability management system for fentanyl-related drugs, characterized in that, include: The batch coding module is used to assign a unique batch number to each drug batch based on standardized data, forming a drug traceability data block. The blockchain evidence storage module is used to upload drug traceability data blocks to the blockchain network for distributed storage through a consensus mechanism, generate a unique hash value and timestamp for each data block, and map the key spatiotemporal attributes of each data block to circular geometric features. The correlation verification module is used to calculate the common chord between different circular geometric features based on the principle of determining the positional relationship between circles, in order to establish a strong correlation verification layer between data blocks. By analyzing the relative positional relationship between circular geometric features, cross-validation and correlation strengthening are performed on the data blocks to obtain blockchain traceability data with enhanced anti-tampering and correlation verification capabilities. This includes: acquiring the circular geometric features corresponding to multiple data blocks, including the center coordinates and radius parameters of each circle; calculating the center distance between any two circles based on the circular geometric features; determining the intersection state between the two circles based on the relationship between the center distance and the radii of the two circles; when the two circles are determined to be in an intersection state, calculating the common chord formed by the intersection of the two circles; establishing a strong correlation verification layer between corresponding data blocks based on the common chord; performing cross-validation operations on the corresponding data blocks by analyzing the relative positional relationship between multiple circular geometric features to obtain cross-validation results; and strengthening the correlation between data blocks based on the cross-validation results to obtain blockchain traceability data with enhanced anti-tampering and correlation verification capabilities. The index building module is used to organize traceability data points from each stage into a hierarchical spherical spatial index structure based on blockchain traceability data. The spherical spatial index is composed of multiple spherical nodes. The intelligent query module receives drug serial numbers or vehicle VIN codes and quickly locates the data set most relevant to the query conditions based on a spherical spatial index. It then retrieves corresponding standardized data across all stages of the drug's lifecycle, integrating and generating a full-chain traceability report for the drug's components. This completes the full-lifecycle traceability query for drug components. The process includes: receiving user-input drug serial numbers or vehicle VIN codes as query conditions; determining the initial query position in the spherical spatial index based on the query conditions; calculating the spatial distance between the query point and each spherical node using the spherical nearest neighbor search principle to obtain a spatial distance ranking result; locating the data set matching the query conditions based on the spatial distance ranking result; retrieving corresponding standardized data across stages of the spherical spatial index based on the located data set; generating a full-chain traceability report for fentanyl-related drugs; and outputting the full-chain traceability report to complete the full-lifecycle traceability query for fentanyl-related drugs.

2. The fentanyl-related drug full-cycle circulation traceability management system according to claim 1, characterized in that, The process of obtaining standardized data is as follows: Collect multi-source heterogeneous data on fentanyl-related drugs in the stages of raw material procurement, production and processing, warehousing management, transportation and distribution, clinical use and recycling and disposal; Standardize multi-source heterogeneous data to generate standardized data.

3. The fentanyl-related drug full-cycle circulation traceability management system according to claim 2, characterized in that, Each drug batch is assigned a unique batch number based on standardized data, forming a drug traceability data block, including: Based on standardized data, material identification information for each drug batch is extracted, and a unique batch number is assigned to each drug batch according to the material identification information. Data such as raw material composition, storage environment, transportation trajectory, and recycling results corresponding to each batch of drugs were extracted from standardized data. By performing data association operations, the selected data types are bound to their corresponding unique batch numbers to form a bound data set; Based on the bound data set, a structured drug traceability data block is established.

4. The fentanyl-related drug full-cycle circulation traceability management system according to claim 3, characterized in that, Drug traceability data blocks are uploaded to the blockchain network for distributed storage through a consensus mechanism, and a unique hash value and timestamp are generated for each data block. The key spatiotemporal attributes of each data block are mapped to circular geometric features, including: Based on drug traceability data blocks, a blockchain network access operation is performed, and the drug traceability data blocks are uploaded to the blockchain network through a consensus mechanism to complete distributed storage. After the distributed storage is completed, a unique hash value and timestamp are generated for each successfully stored data block. Based on the corresponding unique hash value and timestamp, extract key spatiotemporal attribute data from the stored data blocks; Based on spatiotemporal attribute data, the coordinates of the center point and radius parameters of the circle are determined; the circular boundary is constructed by calculating the distance relationship from the center point of the circle to each spatiotemporal data point, so as to map the discrete spatiotemporal attribute data into a circular geometric feature with clear geometric characteristics.

5. The fentanyl-related drug full-cycle circulation traceability management system according to claim 4, characterized in that, Based on blockchain traceability data, the traceability data points at each stage are organized into a hierarchical spherical spatial index structure, which consists of multiple spherical nodes, including: Based on blockchain traceability data, extract the spatiotemporal coordinate information of traceability data points at each stage; Based on the spatiotemporal coordinate information, construct the initial spherical space nodes; After the initial spherical space nodes are constructed, the data space is divided into multiple interconnected spherical regions based on the principle of spherical space partitioning. Calculate the spatiotemporal boundary information of the data points contained in each spherical region to obtain the spatial inclusion relationship between the spherical regions; Based on the spatial inclusion relationship between spherical regions, a hierarchical spherical spatial index structure is established.

6. The fentanyl-related drug full-cycle circulation traceability management system according to claim 5, characterized in that, The entire supply chain traceability report will be output to complete the full lifecycle traceability query for fentanyl-related drugs, including: Based on the full-chain traceability report, verify the completeness and consistency of the report data to obtain a verified full-chain traceability report; Convert the verified full-chain traceability report into the specified output format to generate a formatted full-chain traceability report; The formatted full-chain traceability report is pushed to the user terminal through the preset output interface. After being pushed to the user terminal, the full-chain traceability report is displayed on the user interface, completing the full life cycle traceability query of fentanyl-related drugs.

7. A computing device, characterized in that, Including memory and processor; The memory stores one or more computer programs, the one or more computer programs including instructions; when the instructions are executed by the processor, the computing device performs the system as described in any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for executing the system as described in any one of claims 1 to 6.