Next Article in Journal
Analog Realization of a Fractional Recursive Variable-Type and Order Operator for a Particular Switching Strategy
Previous Article in Journal
Improved RSSI-Based Data Augmentation Technique for Fingerprint Indoor Localisation
Previous Article in Special Issue
Artificial Neural Network Blockchain Techniques for Healthcare System: Focusing on the Personal Health Records
Open AccessArticle

A Blockchain and Machine Learning-Based Drug Supply Chain Management and Recommendation System for Smart Pharmaceutical Industry

Department of Computer Engineering, Jeju National University, Jejusi 63243, Korea
Author to whom correspondence should be addressed.
Electronics 2020, 9(5), 852;
Received: 29 April 2020 / Revised: 15 May 2020 / Accepted: 18 May 2020 / Published: 21 May 2020
(This article belongs to the Special Issue Blockchain Based Electronic Healthcare Solution and Security)


From the last decade, pharmaceutical companies are facing difficulties in tracking their products during the supply chain process, allowing the counterfeiters to add their fake medicines into the market. Counterfeit drugs are analyzed as a very big challenge for the pharmaceutical industry worldwide. As indicated by the statistics, yearly business loss of around $200 billion is reported by US pharmaceutical companies due to these counterfeit drugs. These drugs may not help the patients to recover the disease but have many other dangerous side effects. According to the World Health Organization (WHO) survey report, in under-developed countries every 10th drug use by the consumers is counterfeit and has low quality. Hence, a system that can trace and track drug delivery at every phase is needed to solve the counterfeiting problem. The blockchain has the full potential to handle and track the supply chain process very efficiently. In this paper, we have proposed and implemented a novel blockchain and machine learning-based drug supply chain management and recommendation system (DSCMR). Our proposed system consists of two main modules: blockchain-based drug supply chain management and machine learning-based drug recommendation system for consumers. In the first module, the drug supply chain management system is deployed using Hyperledger fabrics which is capable of continuously monitor and track the drug delivery process in the smart pharmaceutical industry. On the other hand, the N-gram, LightGBM models are used in the machine learning module to recommend the top-rated or best medicines to the customers of the pharmaceutical industry. These models have trained on well known publicly available drug reviews dataset provided by the UCI: an open-source machine learning repository. Moreover, the machine learning module is integrated with this blockchain system with the help of the REST API. Finally, we also perform several tests to check the efficiency and usability of our proposed system.
Keywords: blockchain; machine learning; drug supply chain; healthcare; smart contract; hyperledger fabrics blockchain; machine learning; drug supply chain; healthcare; smart contract; hyperledger fabrics

1. Introduction

Counterfeit drugs are a very big challenge for the pharmaceutical industry worldwide. One question arises here: what does Counterfeit drug mean? According to WHO, “The drug which is manufactured fraudulently, mislabeled, with low quality, hiding the source detail or identity and does not follow the defined standard is considered to be fake or Counterfeits” [1]. The survey provided from the WHO stated that in underdeveloped countries every 10th drug use by the consumers is counterfeit and has low-quality [2]. This WHO claim may not be perfect or have more than this because there is no accurate estimation or statistics of counterfeits drugs. The use of this low quality and non-standard medicine causes a negative impact and may increase the death rate. Counterfeit drugs may contain some active or genuine ingredients but the amount of these ingredients is not proper and may be low or high, it contains some toxic impurities at the production level and it can cause some serious health issues in humans while using. Sometimes the manufacturer of these fake medicines used the logo of some reputed and popular pharma company to enter their drugs easily in the market without facing hurdles. Therefore, these drugs affect the sales of popular and expansive medicines like antibiotics, cancer, painkillers, many other cardiac medicines, etc., and also have a lot of side effects and cause more serious health problems. As we mentioned above, almost 10–15% of the drugs are fake worldwide but in the case of developing countries, the ratio of these drugs are more around 30%. The annual deaths due to malaria disease are around 0.7 million and death due to counterfeit drugs are almost 0.2 million from them [3]. As you know, the increasing use of technologies also provides more ways to supply these fake drugs in the market. Due to technology emergence, the distribution of these fake drugs is also increased day by day. The FBI and International Anti-Counterfeiting Coalition (IACC) reported that the counterfeiting is one of the largest criminal businesses of the 21st century and growing rapidly every day by introducing new fake pharma manufacturers into the market [4,5].
In the present time, everyone has the basic right to get better health facilities. The various numbers of drugs have been introduced in the market with a new name and labels every day because of the increasing number of new diseases everywhere. These medications help the patient get moment alleviation from unbearable pain. Instead of benefits from these drugs, there are many disadvantages because the authenticity of these manufacturer organizations is not registered or known they are unknown and do not follow the specified standards. Many deaths are reported from developing countries due to the usage of these fake drugs and more victims of these drugs are children according to WHO [3,6]. As indicated by the statistics, yearly business loss of around $200 billion dollars is reported by US pharma companies due to these counterfeit drugs [1]. These drugs may not help the patients to recover from the disease but have many other dangerous side effects. These medicines are a serious threat to human health. These fake drugs are delivered through different complex networks; that is the reason it is difficult to detect these counterfeit drugs. The US allocates around a $3.2 trillion budget for the health care sector and a quarter of this budget is utilized only for the management of a secure supply chain process [7,8]. There are few expert opinions and suggestions to overcome and prevent counterfeit drug problems, which include the secure and transparent drug delivery and supply chain process, enhance control and management of drug market at the pharmacy, distributors and hospital level and the use of latest technologies to continuously track the drugs at every level of supply chain [9,10]. From the above-mentioned points, the secure drug supply chain management is very important to prevent this issue. For this problem, the best system which can trace and track the drug delivery at every phase staring from supplier’s raw material, manufacturing product, distribution stage, pharmacy, clinics and consumers, respectively is needed to prevent counterfeit drugs. Furthermore, the latest innovation in the field of computing that can handle the supply chain and track the product is Blockchain. The Blockchain can secure the supply chain process and keep track of the delivery very efficiently [11,12].
Blockchain is a revolutionary technology that is based on the consensus protocol introduced by Satoshi Nakamoto in 2008; basically, it is specially designed to store the transactions log for a well-known cryptocurrency named as Bitcoin [13]. The blockchain provides a very rich digital ledger software to store the data records, executed transaction logs in the form of arranged numbers of blocks. More directly, it is a secure distributed kind of database. The digital information related to each transaction, its time, date, price and also the participants involved in this transaction are stored in a block. The stored information is distributed within the blockchain network; where many independent nodes participate to validate the transactions without knowing each other and without any kind of trust among them. There are two hash codes inside each block in the network namely prior and current hash codes. The prior hash code is for the preceding block and the current code is for the block itself. Moreover, if one block information is changed then all the information about that block should be changed accordingly. All the blocks inside the network are strongly linked together and protected with transaction codes and crypto codes as well. The other important feature is strong mathematical algorithms which give the ability to miner nodes to validate these blocks without affecting the data of miner nodes and after validation blocks could be added to the blockchain network. That is the reason the blockchain system ensures security and transparency [14]. The blockchain network is an increasing chain of multiple blocks and stored the information according to defined rules. In the network, there are many miner nodes for adding new blocks in the chain to form a transaction; they work independently; they operate and control with a single protocol. The blockchain network is a distributed system that contains all the information about the transactions and participants and keeps track of all the record history. By the functionality, blockchain network is divided into three types; private, public and consortium blockchain, respectively. There is no admin node to check and control the transactions but all the miner nodes or participants can check and validate the transactions in permission-less or public blockchain networks [15]. The miner nodes are also capable to participate in consensus process and validity between the nodes is accomplished by consensus [16,17]. For example, Ethereum and Bitcoin networks, etc. The data and transactions are handled by one central entity known as the admin node in the consortium blockchain network. Admin can control the data by using public and private access. Some of the data could be public and some are shown to the specific type of private participants based on business terms. These kinds of networks are not fully decentralized and support both public and private data. e.g., Hyper ledger fabrics platform, etc. In the private blockchain network, all the data and transactions stored in the network are strictly private. All the information and data is only shared with the authorized members of the network. The only admin node can add the authorize members to the network which is quite similar to the consortium network in one aspect. e.g., Hyperledger, multichain networks, etc. [18].
Blockchain technology is the best option for handling and securing the process of the pharmaceutical drug supply chain. Some of the pharma companies are using blockchain in their supply chain and others are focusing to shift toward blockchain due to its diverse features [11,19]. The reason why most of the industries want to shift toward blockchain technology is because it provides a distributed decentralized ledger electronically where all the pair nodes in the network can see and validate the transactions related information. One more thing is its consensus algorithm which empowers the network to store the only validated information in the repository and eliminate the problem of the duplicate transaction. Furthermore, the network failure probability is very low because more nodes from the failure threshold are functioning and besides, fault tolerance is very strong.
This manuscript introduces blockchain using Hyperledger fabric for the secure drug supply chain management. It is capable of continuous monitoring and tracking of the drug delivery process to resolve counterfeiting issues. The goal is not only to resolve secure drug delivery, but also provide the best suitable drug to the users. To this end, we introduced a machine learning-based recommendation system that is trained using previously collected drug user reviews data-set: the data-set was collected through web crawling and contains the comments and ratings based on the disease condition of the consumers. Furthermore, machine learning models N-gram and LightGBM are trained on that dataset to recommend the best and effective drugs to the consumers of the system. The brief working of our proposed system is as follows: firstly, a blockchain-based novel drug supply chain system is developed in which the participants, supplier, manufacturer, distributor, pharmacy, hospitals and clinics of the drug delivery smart pharmaceutical network are used to store and share the information through the blockchain network efficiently and securely. The system provides a user-friendly WEB interface for handling and tracking of the drugs. Furthermore, we have utilized the Hyperledger composer REST API for the connectivity of web applications to the blockchain network. In the proposed solution, the validation and authentication of transaction requests are achieved by defining the rules in access control policy and history. In this work, Couch-DB is used for storing a large number of transaction records and is the best option to eliminate the data redundancy problem and provide separate storage for each node in the blockchain network. The final product enables the consumers e.g., patients to track the medicine origin with authenticity. The other advantage of our system is to recommend the best and top-rated drugs to the customers of the system with the help of machine learning algorithms. Further, the machine learning module is integrated with the blockchain network and the participants of the system can use both features of the proposed system together. Afterward, the models are also able to learn from the comments and ratings provided at the client web application and updates the recommendation results accordingly.
The rest of the paper is organized as follows. Section 2 contains the background literature of previously developed systems. In Section 3, the overview of the blockchain-based drug supply chain management system and detail design and architecture of the proposed system is explained. Further, a smart contract and transaction procedure of the blockchain network are also discussed. The machine learning-based drug recommendation analysis and is well explained in Section 4. Section 5 explains the implementation of the proposed system and its working. Furthermore, the experimental results of both modules: blockchain-based drug supply chain management and system and machine learning-based drug prediction and recommendation are discussed in Section 6. Finally, the paper is concluded.

2. Related Work

Blockchain has emerged as a revolutionary technology that stores and transmits data in a secure, fault-tolerant and transparent manner. This is possible due to distributed ledger-based technology. The blockchain has the full potential to make any organization secure, efficient, transparent and decentralized. Since the blockchain entered the public eye through Bitcoin [13], researchers have never stopped striving to extend blockchain applications to non-financial fields. Among these non-financial fields, the healthcare industry is one of the industries that have shown more impact on the blockchain. Although, the research on developing blockchain assisted applications is quite new and developing rapidly. As a result, researchers in the healthcare industry have been working hard to keep up with research fronts in this field. We summarize the blockchain applications which are currently used in the healthcare field, to give a glimpse into the mist-filled blockchain technology application field, which belongs to the future development direction of the healthcare industry [17,20].
Nowadays blockchain applications are not only restricted to cryptocurrency but also used in many other areas like agriculture [21], healthcare [22], finance [23], education [24], transportation [25], supply chain [26], etc. In 2018, Ref. [27] a blockchain-based agriculture supply chain management and traceability system were developed: named as agriBlockIoT. This system can manage the supply chain of food products and trace where it comes from. AgriBlockIoT system is developed with two separate blockchain network platforms; Hyperledger Fabrics and Ethereum. Furthermore, both networks are compared with each other in terms of latency and transaction per second. The system ensures that the data and information generated with different sensors are stored in secure, immutable, transparent manners. In the same year, Ref. [28] combine radio frequency identification (RFID) sensor technology and blockchain technology to achieve a blockchain architecture Internal wood chain traceability system, this system will trace information and wood quality Relevant information is integrated into an online system, using blockchain technology to remove features and distributed storage secure storage of data information and transaction records. In 2019,authors [29] have been proposed a blockchain and electronic product code (EPC) based information service food safety traceability system, this system uses blockchain features of technology traceability, time stamping and tamper resistance knowledge mechanism to accurately record valid data throughout the food supply chain, sharing and specific tracking to prevent data tampering and trust in the process of information interaction, information leakage and other issues for effective detection and prevention of food safety issues. Compared to the above emphasis on traceability of agricultural products, wood, food and medicine. A pseudo traceability system is required. In 2016 [30], traditional Chinese medicine (TCM) quality traceability system, which can track changes in external information such as manufacturing and distribution processes and the inherent quality of traditional Chinese medicine retrospective. In 2018, Ref. [31] comparative research proposes a data collection, storage, analytical and visual data management system that can ensure different supply chain parameters system interoperability among participants.
The traceability of medicine systems have their advantages, but can not meet the data storage decentralization at the same time. Three requirements: informationization, comprehensive and tamper-proof information and information privacy. Blockchain technology has unique advantages in the application of traceability systems: the decentralization and distributed storage characteristics of blockchain technology can ensure data reliability. Information transparency and complete reliability of data flow; the characteristics of technology traceability and data tamper resistance can effectively solve the problem in the supply chain; counterfeiting and shoddy issues; anti-tampering and time stamping of blockchain technology data. The characteristics can be used to provide evidence and accountability and resolve disputes between various parties. Not combining the technical advantages of the blockchain and the shortcomings of the current medical anti-counterfeiting traceability system, in this study [26], a blockchain assisted medicine traceability system is proposed to prevent counterfeit drug problems in the market.
Electronic medical records (EMR) systems are developed with the help of a blockchain network for securing the healthcare industry. Blockchain has the characteristics of decentralization, anti-tampering, data traceability, reliability, smart contracts, security and privacy, which are in line with the requirements of electronic medical records [32,33]. Guardtime [34], a Dutch company for data security, developed a blockchain assisted system for the patient’s identities verification. All country individuals will get a card, which uses the blockchain to correlate EMR data with each other. A hash code is assigned to each update whenever a transaction is triggered in the blockchain network. Due to blockchain, the audit records in the EMR are tamper-proof and beyond modification. Tamper-resistant logs could be used to store information status in existing healthcare databases. Any updates in the database (such as registered records, etc.) will be assigned a timestamp and password while writing the transaction in a block. The blockchain system ensures the integrity and safety of medical data [35].
The second application related to EMR is MedRec [36], a project co-sponsored by MIT Laboratories and Beth Israel Medical Center. MedRec provides health care a secure and transparent way to share and transmit the data between each other. This blockchain application is designed to protect the proxy rights of each patient and the right to know others’ access to their healthcare data. Patients can share these permissions on the blockchain to share the data for future research purposes. Although all the locations and data transaction logs are maintained in the blockchain network. At the same time, if you want to achieve true interaction, supporting software is also necessary. Another example is the Gem Health Network developed by Gem [37], an American startup, using the Ethereum blockchain platform. it permits various medical practitioners to use the same data which is stored in the network. There are many similar ones, such as Healthbank, which continuously works to enable patients to use the blockchain platform to fully control their data; Medicalchain has built a blockchain-based platform and promotes sharing patient medical records and working hard; Healthcoin [38] plans to build a global EMR system. In addition, other participants in different plans and projects centered on the blockchain include Factom, HealthCombix, Patiententory, SimplyVital, IBM Watson, BurstIQ, Bowhead, QBRICS, Nuco and more. Problem-solving methods are indeed necessary, but at the implementation level, these methods face the following problems: the interactivity between different EMR solutions based on the blockchain security, scalability and privacy of data are the major issues in EMR systems. The pharmaceutical industry generally faces a problem that can have direct consequences for patients: the circulation of fake or inferior drugs. Blockchain technology has proven capable of solving this problem [39,40,41]. Remote patient monitoring [42] is possible due to the emergence of internet of thing (IoT) sensors and smartphone devices. These devices can collect a large amount of biomedical data and medical professionals can easily check the condition of the patients, instruct in terms of medicine, etc. so, blockchain provides enough features to achieve this [43].
In this work, authors [44] have proposed blockchain based framework for securing the delivery of biopharmaceutical products. This system utilizes the stochastic simulation for guiding the blockchain network where the system can be able to protect the biopharmaceutical products from counterfeiting, fraud, theft and temperature diversion as well. Although, the proposed system improves the efficiency, transparency, security and reliability of the supply chain process. The smart contracts for the system were defined based on the proof of authority (PoA) mechanism. Finally, the system can provide real-time monitoring for distributed data streams within the blockchain network. The results prove that the performance of the system is satisfactory. In this paper, the authors [45] have been proposed information management and tracking system for drug delivery in the pharma industry. They have been used different technologies for securing the drug supply chain such as RFID, electronic product code information service (EPCIS). The research environment was developed by using two theoretical models collective action theory and transaction cost theory. They defined many rules for all the stakeholders that are participating in the drug delivery process. The business of counterfeiting drugs is a major problem for all pharmaceutical manufacturers and health organizations. All the international health organizations want to overcome this issue but the sales of these drugs increase day by day. The author of this paper [46] proposes a system with the help of blockchain technology for the traceability of drugs and also controls the process of the supply chain as well, where each participant of the system can be able to track and check the drug delivery at each stage. The proposed system has been based on a case study only.
In this work, authors [47] have proposed an Ethereum-based blockchain network for tracking the shipment of the products. It can manage and track the supply chain of different items while shipping in smart containers. They have developed this system based on smart contracts between the product sender and receiver without the involvement of the third party. This paper [48] explains the complete survey and existing developed approaches related to the medicine supply chain. It can also explain the multiple procedures of how counterfeits drugs enter into the system and how these medicines affect financially to original manufacturers. One of the important reasons for drug counterfeiting is improper supply chain systems. After that, they have developed a blockchain-based system for secure end to end (E2E) drug delivery but no details are given about the real-time results and implementation. The work presented in this paper [49] encounters how to eliminate the drug counterfeiting issue and provides the consumers with original medicines. The blockchain is the solution to this issue because it ensures the features of traceability, security and transparency. They have designed a blockchain-based system and also used QR code security for medicine security. After that, the original medicines which are manufactured with the authentic brand has been delivered to the consumers safely.This is another work [50] related to blockchain applicability in the supply chain procedure. The supply chain is the supply of goods from the manufacturer to consumers, so while supplying these products quality of the product should be maintained. There are some frauds, corruption occurs which enters the fake products into these supply chain process. This system encounters the fake product issue and provides a way of the secure and transparent supply chain by using blockchain technology.
In this paper, authors [51] have proposed and developed a software which connects Ethereum-based blockchain network with different information systems of enterprises. This system can be able to share information among their partners securely. The blockchain enables the system to provides a different level of data access, data integrity, data visibility and authenticity support to partner companies while sharing the information. Moreover, a simulation environment has been designed in the supply chain scenario and performs some statistical operations for testing the validity of the system. The results of this simulation show that the blockchain system is the best instrument for securing the supply chain process and also establish trust between different companies. It can also increase the performance of the system and reduced fraudulent or misconduct occurs in companies.
A blockchain-based system for the traceability of the drugs has been proposed in this paper [52] named as a Drugledger. This system ensures data authenticity, security, privacy and traceability as well. The architecture of the system is based on a service-oriented mechanism and better than peer to peer (P2P) traditional architecture. Drugledger could provide stable and efficient storage for the drug supply chain process. Overall the work presented in this paper provides a systematic and practical theme on how the blockchain system could tracks and manage the drug supply chain process. In this work [53], another blockchain-enabled drug supply chain management system to overcomes counterfeiting drug problems namely CounterChain is presented. it can extend the level of visibility of drugs at each level of the delivery process and provides the consumers with authentic and original products. It can also increase the level of trust between vendors, manufacturers, retailers and distributors because they are the major stakeholders of the CounterChain. Due to this, the system can be able to eliminate counterfeit drugs to enter the chain.
Hence, blockchain technology is not only used in healthcare, finance, agriculture, cryptocurrency, etc., but also used in every filed. Many researchers are developing the blockchain applications in many fields such as smart grid, vehicle-to-grid, connected vehicles, edge computing and cloud computing and cyber–physical systems [54,55].

3. Design and Architecture of Blockchain-Based Drug Supply Chain Management and Recommendation System (DSCMR)

3.1. Overview of Drug SCM Procedure in Smart Pharma

The decentralized distributed nature of blockchain technology has extended the security and privacy of the drug supply chain of the pharmaceutical industry. The complete drug supply chain management and recommendation (DSCMR) mechanism is presented with participants and blockchain network in Figure 1 in which users can manage and updates the whole supply chain activities. The data related to the users of the system suppliers, manufacturer, distributors, pharmacies, hospitals, doctors and patients are stored in the blockchain-based system. The assets of the DSCMR systems are drug, raw material, order and record repository. Each user of the system is provided with client application based front-end where they can easily perform their transaction and communicate with the blockchain network. During the whole DSCMR procedure all the relevant participants of the system can track the status of the drug delivery by using the client application. On the other hand, there is a data storage pool, which is a separate data library, also called stored-off blockchain. It is a great tool for analytics and visualization of data because visualization of data can not only be required for this system but medical-related institutes can also be used for their projects and in our system we have also used this store-off storage pool for the machine learning module and the machine learning model recommends the best drug to our customers. Moreover, system users get permission to check the complete details of drugs, raw materials and other relevant information like expiry date, price, manufacture date, etc.
To accomplish the purpose of the consistency of distributed ledger, there are peer nodes in the system whose responsibility has to run the consensus algorithm. In our system, the first supplier sends the raw material to the drug company. Each participant of the system has a web application portal where each user can log-in and perform the transaction. Suppose a manufacturer orders place for raw material, any peer node of the network can validate the transaction and after validating the submitted transaction, the supplier receives that order. Afterward, when the raw material order is ready to deliver then supplier performs the confirm order event. On the other hand, if a customer does a detailed check of a company’s medicine data, only he/she can perform that actions which are defined as permission rules in the blockchain network. In another case, if a doctor wants to place an order to a medicine company then he/she can place the order using our proposed blockchain system as the same steps defined in the above-mentioned scenario. Firstly, authentication of that doctor, submit the transaction proposal, manufacturers validate the transaction, then confirm the transaction of the doctor and notify the order status by sending event message successful transaction.

3.2. Detail Architecture of Proposed DSCMR System

The important and primary goal of the blockchain network is to store information in a distributed way where each block contains multiple transactions. These transactions are stored in an encrypted and hashed manner for security concerns. The proposed system is a service-oriented framework for the users which provides the distributed ledger and smart contract functionalities as service. The main design of the proposed system is shown in Figure 2. The proposed system is divided into two modules; the first one is the drug supply chain management system and the second is the recommendation system. In this system, end-user (suppliers, distributors, pharmacy, doctors, manufacturer and patients) can perform the transaction by using the front-end web application where they can perform medicine orders, raw material supply, update the medicine data, update orders, update the records, deliver drugs, data sharing, track drug at every step of supply, drug management, customers management, etc. The first primary goal of this system is to prevent counterfeit drugs and provide a secure SCM system to the end-users. Our proposed system is secure because of blockchain security and integrity management features. Each user of the system can be able to track the delivery of the medicine by using this DSCMR system. Furthermore, the proposed system is able to perform the CRUD (create, read, update, delete) operations between the connected peer nodes. However, for the security between the nodes, we have introduced the channels concepts to make the whole network to separate private networks where the same channels nodes can directly share the data to particular nodes without exposing to other nodes. Due to the concept of this channel, each participant can create their own private network for security purposes. Suppose in our system, patients are not directly able to perform more transactions; only interact with the system for checking whether the drug they purchase from the pharmacy is original or fake by just scanning the bar code place at the drug packet. The information related to the drug-like manufacturer company, manufacturing date, expiry date, price, etc. are provided to the patients. This happened due to the blockchain channels concept. Even we can restrict the suppliers to only perform the transaction related to raw material with the manufacturer. These participants are in separate channels and used the system as a private network. Another module of our proposed system is the machine learning-based recommendation system, which works to recommend the best medicine to pharmaceutical company customers. In this module, we have used the machine learning algorithms Ngram, LightGBM and sentimental analysis, which has been trained on the comments data set provided by the customers on the websites about the medicine either good or bad. Based on this training our model has been recommended the best medicine to the customers like pharmacies, doctors, clinics, hospitals and patients.
There are also many drug supply chain management systems in the literature but our proposed system is not to deal only with SCM but also the recommendation of good medicines to customers. The other unique feature of our DSCMR system is that it is developed on the basis of the permissioned-blockchain system. Due to this feature, only the particular participants are able to use the system. In this network, users are validated and enrolled from user administrator by providing them confidential credentials and certificates of enrollment. Afterward, the users are able to use this secure blockchain network. Furthermore, the consensus algorithm is responsible to connect the enrolled user with the private network where they can perform the transactions and also manage the transaction orders. Each peer node of this blockchain network has a smart contract and distributed ledger in simulated environments where they can able to store the data and execute the transaction as well. Due to the smart contract, these nodes are able to validate the transaction after the execution and write that transaction block into the ledger. The main aim of the consensus algorithm is to maintain the only one history of the transaction and also make sure no invalid transaction would be stored in that history. The consensus protocol is used to keep the consistency of the ledger to provide a unique hash code and digital signature for every transaction. The disturbed ledger in the proposed system keeps all the transaction record histories transparent, event, logs of every transaction and action performed by the users. The detail design and architecture of the system is shown in Figure 2.

3.3. Smart Contract of DSCMR

Simple definition of smart contract is to provide the parties a transparent and conflict free way to exchange the property, money, shares or anything without involving a third party agent or broker. This is the best feature of blockchain platform. Technically, smart contract is multiple lines of computer code which enforce the agreement done between two parties without paying any amount to middle man. This code consists of predefined set of rules in which both groups done agreement with each other. This contract is automatically triggered when the specified condition meets same as database events. Moreover, smart contracts facilitate the users to manage the access rights and their assets among different parties. These smart contracts are stored and managed in distributed ledger of blockchain platform where they are completely protected and secured from the deletion and tampering. Smart contract is a secure way to implement business terms and conditions in some lines of computer code which could be enforced and triggered automatically by the consensus algorithm of blockchain network. Some major open challenges occur while writing smart contracts are as follows; a new programming language is used for writing the smart contract named as Solidity, that is why learning rate for this language is very low and hard to maintain. Moreover, the execution rate of transactions is low and take more time to complete because the transactions are executed among all the peer nodes of the network periodically or in sequence. We overcome this issue by deploying the smart contracts only for specified nodes not for all nodes in network. Therefore, some defined set of nodes can validate the transactions and execution performance of the proposed system is also increased drastically. Furthermore, we used Java and Node.JS popular programming languages for writing smart contracts. It is easy for developers to write business logic’s in other programming languages. the procedure of smart contract execution with ledger is presented in Figure 3.

3.4. Transactions Execution Procedure in DSCMR

This section explains the transactional procedure of the drug supply chain management system: how a transaction should be accomplished in the blockchain network is shown in Figure 4. First of all, users are given the front-end of a client application that allows the user to connect to the blockchain system using their registered credentials and can complete their transaction requests. Registering all participants in the blockchain network is the responsibility of the administrator only after which a user may be able to perform the transaction. In order to submit a transaction proposal in the blockchain network, the user login on the client application and submits his transaction request using the registered credentials. After that, the transaction proposal is sent to all the peer nodes. These peer nodes are divided into two categories; either committers or endorsers. The responsibility of the endorsers is to execute or sign the transition proposals and gives the approval if it is valid and fulfill the smart contract criteria otherwise deny it. On the other hand, committer peers are to validate the results of the transactions before writing it into the transaction block of the ledger. Moreover, in order to understand the difference between these two kinds of peers is actually you can say that endorser peers are the special kind of committer peers who holds the predefined smart contract. Furthermore, these endorser peers execute the smart contract of requested transactions in their own simulated environment before updating to the ledger when they receive the transactions proposal. The endorser peers will extract the read and written data while executing the transaction in the simulated environment which is known as the RW set. In the read data of the RW set which contains the information of world state before transaction and on the other side written data is actually what is written in the world state after executing the transaction in a simulated environment. After that, the endorser peers will return back the signed transaction to the client application with RW sets. The client again submits the signed transaction with all RW sets to the consensus manager and it will deliver the transaction into the committers nodes; and also ordered the data into a block. Afterward, the committers nodes validate the transaction by matching the current world state and then transaction data is written into the ledger. Finally, the ledger is updated according to the written data. In the end, committer peers will send the notification to the client for transaction status either submitted or not. The communication of client application with blockchain network is established with the help of REST API and software development kit (SDK).

4. Machine Learning-Based Drug Prediction and Recommendation Module

Nowadays, the growing number of software-based applications for the health care industry continuously generates a huge amount of patient health Record data. There are many healthcare-related applications developed on the basis of these datasets for monitoring and controlling the patient’s health condition. The medical health care analysts and data scientists are interested to use these datasets and develop an automated system for the healthcare industry. The medicine selection and recommendation for an automated system is a difficult task. It is possible after understanding the effects of medicines, depending on patients’ conditions and symptoms, one can easily select and recommend which drugs are better and popular. However, there are many positive or negative reviews about each available medicine, the researchers are still struggling to develop a system which recommends one best medicine on the basis of these reviews.
This section, explains the second part of our system named as automated drug recommendation system which is developed using natural language processing and machine learning techniques. First of all, we use the publicly available UCI drug review [56] dataset to train the models and predict the most effective and top-rated drugs to the customers of the pharmaceutical industry. The dataset consists of public comments or reviews and ratings at different pharmaceutical websites about the medicines; either it may be positive or negative. We will explain about the dataset in detail later. The steps of our recommendation system are data analysis and preprocessing, Machine learning models and recommendation is shown in Figure 5. The dataset contains reviews, ratings from the users of the medicines on the basis of patients’ medical conditions i.e., acne, pain, birth control, anesthesia, etc. After that, our data analysis and prepossessing module consist of two parts; data analysis and preprocessing. In the data analysis phase, we completely understand and analyze the data by doing some visualization plots. On the other hand, in the second preprocessing part, we used data processing techniques to remove all the missing values from the dataset and make it clean for further operations. The next module of the recommendation system is machine learning and natural language processing module where the two models N-gram and Lightgbm are used with the help of sentimental analysis techniques. These models are trained on the UCI Drug review dataset and one open-source emotion sentimental library is also used for better training purposes. After training, our models recommend the best and top-rated drugs for the specific patient conditions i.e., acne, anxiety, pain, etc. Moreover, our recommendation system is able to train itself by getting new reviews and comments from the client application of our system and update the recommendation results accordingly. when customers query in our DSCMR system for top-rated and relevant drugs according to condition; our recommendation module got active and recommends the best medicine among others. Finally, our system is able to recommend the most effective and best drug to the customers of the pharmaceutical industry i.e., pharmacist, doctors, hospitals and patients.

4.1. Dataset

In this drug recommendation module of our proposed system, we are using one of the best publicly available datasets of the drugs form UCI Machine learning datasets repository [56]; which contains the reviews and ratings provided from patients on medicines experiences. This dataset is provided from well known pharmaceutical web sites: and Hence, we used the dataset in our experiment. According to the professionals, is one of the large and most visited pharmaceutical related information providing websites for the customers and healthcare experts as well. It provides reviews about specific drugs on the basis of condition i.e., pain, acne, anxiety, blood pressure, etc., the user can also give the star rating points according to satisfaction level to these drugs starting from 0 to 10. The provided reviews dataset is not a big dataset but it is well structured and easy to use for the training of any deep learning models. The available reviews are categories into three groups side effects, benefits and overall comments. The dataset is gathered from these resources which contain user ratings and reviews by using an automatic web crawler and python soup library. After the crawling results, the total dataset has 215,063 drug reviews, the total number of targeted drugs are 541 [57]. Afterward, the total number of target websites to collect this dataset are 63,376. Moreover, we used this dataset for the training and testing of our machine learning models. after that, once the models are trained and used with blockchain framework with the help of REST API and recommends the medicines according to condition; after that our model will be used the customer’s reviews and ratings on our own client application of our proposed framework and models will learn with the passage of time and recommends the top rating and best drugs to customers. Table 1 shows some records of the used dataset with seven attributes (unique ID, drug Name, condition, review, rating, date and useful count) for a better understanding of data. Moreover, the attribute drug name present, the names of the drugs; review attribute contains the reviews written in the form of text about the drugs; condition attribute represent the condition for the drugs, for example, blood pressure, acne, pain, etc.; star rating up to 10; the date is the date of the review entry and the last attribute useful count presents the number of persons found that comment useful.

4.2. Data Analysis and Preprocessing

To better understand the dataset we have used some methods of data analysis and visualization in which important features of the dataset are well explained using graphs. As can be seen in Table 1, our dataset has a total of seven attributes, including uniqueID, drugName, condition, review, rating, date and usefulcount. As the drugName and condition are plotted to check how many unique values there are in the dataset of these two attributes. Figure 6 illustrates the number of drugs present in the dataset on the basis of each condition and how many drugs and their weight for each condition in the dataset. You can see that birth control, pain, depression, acne and high blood pressures related medicines are more in the dataset. The amount of not listed drugs also has many records in this dataset because these drugs are presented with no condition, these values affect the training accuracy of the model. We will eliminate these drug records in the data preprocessing phase.
For checking the positive and negative review effect we have used the different emotion extractions techniques but the 4-gram classifier as compared to other grams is a better option to classify the emotions from comments and shows better results whether it’s a positive and negative review. Afterward, the rating provided in the dataset is analyzed by counting the weight of all the rating options: suppose how many times each value comes from 1 to 10. The rating weight according to mean is shown in Figure 7, where we can see that most of the customers gives four rating values 10, 9, 1 and 8 as well. Furthermore, most of the consumers give 10 rating points almost double than the others; it means that almost 69,000 drugs got more rating points from customers. Hence, the values of the positive comment are more than the negative. On the other hand, after analyzing the dataset, we have used preprocessing operations data cleaning, removal of missing values and sentimental analysis to eliminate some typos and errors in the dataset. After validation, all the missing values, typos and errors are removed from the dataset and its completely clean and ready to use for the machine learning module.

4.3. Deep Learning Models

In this section, we are going to explain the models used for the recommendation of drugs in our proposed system; natural language processing model (NLP) N-gram for predicting the probability of a word in a sequence [58], LightGBM for reducing the low gradient features and sentiment analysis dictionary adding for the purpose of emotional analysis [59].

4.3.1. N-gram

Models that are used to derive probabilities of words from a word sequence are called language models. Basically, the N-gram model is a type of language model that is used to calculate the probability distribution of any word from a sequence. It is a probability oriented model that is trained on a collection of text named as corpus. The N-gram model estimates the probability by counting how many times word sequences occur in the given corpus. Suppose an N-1 word sequence is given to an N-gram model, it will predict those words that have a high probability of occurrence in the sequence. N-gram means the sequence of N words: a bigram is a sequence of two words like “don’t disturb”, “my car” and “your notebook”, similarly trigram is a sequence of three words like “please don’t disturb”, and “close the door”.
For example, how the N-gram model predicts the probability of a word in a corpus? Consider we have two sequences “heavy flood” and “heavy rain”; for these kinds of sentences N-gram model will predict the probability of word heavy with rain is more than with flood in the training collection of text. However, the probability of second-word rain will be more and selected by the model [60,61]. It is useful in many natural language processing applications like speech recognition, word similarity comparison, part of speech tagging, predictive word input, natural language generation, grammar application, machine translation and sentiment extraction. The training accuracy and loss of the N-gram model in our DSCMR framework is presented in Figure 8.

4.3.2. Light Gradient Boosting Machine (LightGBM)

The Gradient Boosting Tree in the machine learning domain has a very popular algorithm and there are some effective ways to use it, including extreme gradient boosting (XGBOOST) and parallel gradient boosting regression tree (pGBRT). There are many engineering optimization methods used in these algorithms but when the dimensions of the features are high and the data is too large then the efficiency and scalability of these models are not satisfactory. One of the major reasons for this issue is that for any single feature it checks all the data instances for information gain which is a time-consuming process. To eliminate this issue, Microsoft has provided a novel solution that contains two new techniques, named as gradient-based one side sampling (GOSS) and exclusive feature bundle (EFB).
In the GOSS model, small gradient data instance will be excluded because only data instances with high gradients are important for the estimation of information gain. A large amount of data portion is eliminated for training the model. Hence, the data instance with a low gradient will not affect the model estimation accuracy. In our case, only data instances are used with high gradients for information gain. However, the GOSS can provide accurate estimation with small data size. On the other side, EFB is used for feature reduction, by grouping mutually exclusive features together. In EFB the greedy algorithm can be utilized to reduce the features in an effective manner without affecting the accuracy of information gain. Microsoft named these GOSS and EFB based implementations as lightGBM. Lastly, lightGBM is the more fast and accurate model than the other GBDT. They claim that it is 20 times faster than other GBDT models [59]. Some important features extracted by lightGBM model are shown in Figure 9.

4.4. Sentimental Analysis

For the third sentimental analysis part, we used a third-party open-source library provided form Harvard University for adding emotional analysis in our proposed recommendation system. This library contains the definitions of words either positive or negative. In our solution, we calculate the ratio of positive and negative if the estimated ratio is above 0.5 then the count is positive otherwise negative.

5. Implementation of Blockchain-Based DSCMR System

The tools and technologies used for the implementation of the proposed system test-bed are presented in Table 2 with their required configurations. We build and deploy our proposed test-bed in two separate environments. For providing the users an attractive graphical user interface, we used front-end languages like HTML, CSS, JAVASCRIPT, JQUERY and a third party framework twitter bootstrap for developing client web-based application. The open-source Hyperledger Fabrics blockchain technology is used for the deployment of this system which requires docker engine, python, node JS and VS code as prerequisites. The Linux operating system Ubuntu 18.04 LTS is used for the deployment of the blockchain network. the Hyperledger composer is utilized for building the business logic’s of the proposed network where we have defined our participants, assets, access control rules and smart contracts [18,62]. The client application is connected with the blockchain business network through the composer REST server in which participants can visualize and performs all the activities at their own web-based portals. The user can generate HTTP requests using GET, POST, PUT, DELETE methods through and response will be provided through the blockchain system accordingly.

5.1. Smart Contract Development for DSCMR System

The Hyperledger composer is the best open-source option for the development of blockchain-based applications. One of the major features of this network is to design the smart contract for the business network easily and efficiently. The smart contract in the Hyperledger-based business network consists of four major components; model for defining the participants, script for business logic, access control rule for permission or security and queries for accessing the ledger database. The participants run the business network and each participants have some assets and can perform transactions. The participants of our proposed system are suppliers, manufacturers, distributors, pharmacies, doctors, hospitals and patients. Particularly, the assets of our system are drug, raw material, orders, record repository of system. The participants of the system are defined in the business network is shown in Figure 10. On the other side, transactions of the system are defined during the development of smart contracts, how a user can interact with assets, performs transactions, events, participants involved in the private network, more specifically each and every activity is defined during smart contract development. The event functions are also parts of the transaction process function and execution procedure is similar to the transaction. Moreover, some of the defined transactions and events of our system are presented in Table 3.
There are four major things to define while building blockchain network with Hyperledger fabric: model file, for defining participants, script file for defining smart contract functions, access control rules file, for defining rule and query file, for performing some actions like select, update, etc. Figure 11 represents the one of script file function which is defined for performing a transaction. this transaction function is for updating the drug detail like expiry date, price, manufacturing date, etc. This script file contains the functions of the transactions related to create, delete and update the assets as well as participants in our blockchain-based DSCMR system. We used JavaScript language for writing these transaction functions while modeling the smart contract. The two transaction functions are presented in this diagram sharerecordwithpharmacy and sharerecordwithdistributors.
In the access control rules file, rules are defined to control the operations of users, in which all the users of the system who can perform the action and who cannot, are written using the rules access control language. In which users are given permissions to read, write and delete data. This is a great way to give users limited access to a blockchain network-based system. The queries are also required to retrieve or update the data in the world state of the blockchain network. in Hyperledger composer based business network these queries are written in a separate file by using a bespoke query language. These queries are quite similar to SQL database type statements and conditions. More specifically, the query which is written for Hyperledger composer consists of a statement and description. In the statement part statements keywords similar to SQL are used like SELECT, ORDER BY, WHERE, OR, AND, etc. for the development of rules in a query. The second part is description of that query which contains function string for deploying the specific rules.

5.2. Distributed Ledger in DSCMR System

The Hyperledger fabric is developed on the basis of distributed ledger technology which consists of two parts, a blockchain part, and the world state part. Hyperledger fabric can configure multiple world state databases to maintain the set of current values or states of the system for providing the functionality to access the current ledger states at any phase. The world state database part is capable to store the states of ledger efficiently and also retrieves when application or user needed. So, it can store the current state automatically and the developer of the system can check it easily without looking at the full log of transactions. The data are stored inside the world state database in the key-value pair [63].
The ledger communication is shown in Figure 12. The world state database automatically updated the state value when the state is changed or performed some transactions. Two appropriate options Couch DB and Level DB are available for the world state database. The first option means level DB is default state database which stored the data of smart contract in key-value pair and exists within each pair node of the network. The second option is Couch DB which is an alternative solution to level DB and provides rich queries environment and modeled the smart contracts in the JSON file format. Therefore this is the best option while storing the large data and queries the actual data instead of key values. Furthermore, the Couch DB format and indexed the data in the JSON file format and store it instead of key-value pair. The results of the query in couch DB gives real data contents. It also supports all kinds of queries to access data content through the REST API. Due to these features, we used couch DB in our proposed system to store the data related to our network. In the Figure 12 drug asset record is stored in the ledger and it has a key-value pair. It can also store simple and complex key-value pairs as single and multiple values. On the other hand, the second part is blockchain, which has the ability to store the set of operations and changes occurs in the world state database in the form of transactions log. After that, these transactions can be stored in the form of blocks and connected together in a chain-like structure. The transactions are stored in a sequence in the blockchain network. The blockchain provides data immutability features; nobody can change or delete the data once stored.

6. Results and Discussion

6.1. Execution Results of Drug Supply Chain Management (DSCM)

In this part, we explain the working of a DSCM system while communicating with the blockchain network. As we already discussed, the client application user interface is provided to each participant of the system where they can start their transaction after validating the identity. The client application communicates with the blockchain network by using a REST server composer in which each request is sent through the REST server and will store the transaction in the blockchain network. The client web application portal is shown in Figure 13 for drug management where manufacture can add, update and delete the drug details in the blockchain network. Afterward for adding new as well as available drug data manufacturer is given a web form to fill the entries and store the filled data in the blockchain network. For adding drug details in the blockchain system using this web form DrugID, Name, company name, manufacture date, expiry date, types are needed to be shown in Figure 14. The manufacturer also shares the drug record data repository with the other participants like distributors, pharmacies, hospitals and doctors as well. The drug management portal will allow users to perform create, read, update, and delete (CRUD) operations with the help of the application user interface. The users can also update the information on the existing drug by sending the update request through the user interface to the blockchain network [64].
Figure 15 illustrates the Hyper-ledger REST server composer front end where we can also perform queries directly. The communication between client application and blockchain network is done through this Hyper-ledger REST server composer. Moreover, the user can direct queries to this REST server for the transaction to validate; it shows the metadata of the transaction. In this Figure 15, the updatedrugdetail query is instantiated from the client application to the REST server for transaction submission. The response of the REST server is also shown in the JSON data format which contains the metadata of the updatedrugdetail transaction.
Similarly, Figure 16 shows the previous transaction history performed in our proposed blockchain-based system. This portal shows all the activities done through the web application to the blockchain network; either it should be a transaction, add some participants, assets to the system. The attributes of this history portal represent the time and date of the transaction activity performed, type of the transaction and the participants of the system who is involved in this transaction to perform. This portal shows the log of all the transactions performed in the blockchain network. From this history portal, users can see the detail of each transaction but did not able to alter the value; it is protected from the blockchain network. The user can also view the transaction detail by just clicking at view transaction button: a view only web form with transaction detail is presented in Figure 17.

6.2. Experimental Results of Machine Learning Based Drug Recommendation Module

This section contained the prediction results generated by our proposed machine learning-based drug recommendation system. Figure 18 illustrates the drug recommendation results from our proposed system on the basis of specific conditions. The drug name with their mean values for specific acne condition is presented. Our system has the ability to successfully recommend the top-rated and best medicine to the customers of the system. However, customers can easily query at our system for the recommendation, which drug is best for pain, blood pressure and any other related diseases condition. The patients can directly query to our system by using our client application and other pharmaceutical customers like pharmacists, doctors and hospitals can also use this system using their credentials.
Figure 19 illustrates the drug recommendation results from our proposed system on the basis of high blood pressure condition. The drug name with their mean values for high blood pressure is presented. Our system has the ability to successfully recommend the top-rated and best medicine to the customers of the system. For the drug recommendation, anyone could be able to use our system but for performing the transaction in our blockchain-based system only the registered users like pharmacy, manufacturer, hospitals, doctors and suppliers are eligible. Patients can also search for the better drug and also track the drug source for validation either drug is original or fake.
The drug recommendation results for anxiety conditions are presented in Figure 20, where the drug name and mean values of that drug are plotted on x and y-axis. Customers of the system can perform this operation by using our client application front end and search for the best medicine. From the back-end, our trained model can predict the drug according to its training. However, the best recommendation results for anxiety or any other condition will be provided to customers.
The drug prediction results by our system for alcohol dependence conditions are presented in Figure 21, where the drug name with mean values are plotted. Customers of the user can perform this operation by using our client application front end and search for the best medicine. However, the best recommendation results for alcohol or any other condition will be provided to customers. For testing the performance of our blockchain network we used an open-source solution Hyperledger-caliper [65] which is developed by the Linux Foundation. This framework supports many blockchain-based solutions for performance testing such as Hyperledger composer, burrow, sawtooth, etc. it can also provide many performance indicators to test the blockchain network i.e., transaction latency, throughput, success rate, etc.
Three different user groups have been used and compared to test the response of our blockchain network. We have run the simulation for a period of 100 ms to test the system as shown in Figure 22. The response time starts to increase as users grow in the network. We have tested the performance of the system by using 90 users for the first time, 270 users for the second time and 320 users for the third time. It can be seen that there was no increase in system response rate for the first two user groups but when using the third user group there was a slight increase in system response. To some extent, the system is also performing stable as users grow.
Figure 23 illustrates the execution of query transactions in the proposed system with minimum, maximum and average latency. Four different user groups are used to test the latency of the blockchain network while querying. These users groups contain 45, 90, 270 and 540 users, respectively. As shown in the Figure 23, in the first scenario with 45 users, the average latency is 53 ms, in the second scenario with 90 users, the average latency is 145 ms, in the third case with 270 users, the average latency is 167 ms and in the last case with 540 users, the average latency is 460 ms.
As aforementioned, the latency rate is directly dependent on the number of users, latency rate increases if we increase the number of users in our system. The minimum and maximum latency for all four groups are presented in Figure 23. Finally, the performance of our system is satisfactory, our both the module work together and provides the users secure, transparent and immutable drug supply chain management and also predicts the best drugs for customers as well. The patients of the drug can also check the source of the drug by just scanning the bar-code on the medicine packet and the system will provide the whole source of that drug. All the customer’s suppliers, distributors, manufacturers, clinics, pharmacies, hospitals and doctors are able to track the drug in the whole SCM system and also check the validate and best drugs just querying with condition acne, anxiety, etc.
Table 4 presents a brief comparison of our system with the existing methodologies. It shows that our system performs better as compared to other existing works in the literature. There are many studies related to blockchain-based drug supply chain management but no one can provide the feature of drug recommendation. The novelty of our system is the machine learning module for recommendation and the integration of that module with a Hyperledger-based permissioned blockchain network where the users of the system pharmacies, doctors, hospital admins and patients can check the originality of the drugs and track the source of these medicines.
All participants in this system can check the most used medicines and top-rated medicines in terms of condition. The machine-learning module of this system will recommend the best medicines according to the conditions. One of the most important things to mention here is that patients can only check the source and supply chain of the medicine so that they can track the medicine whether it is fake or not. This does not mean that patients do not have to go to doctors or an expert pharmacist. With the help of the machine learning module of this system, doctors can also check medicines according to the condition of any patient. However, it can also recommend the best medicines to the doctors or pharmacist but they have the authority of final decision while writing the medicines for the patients. It is a secure and transparent system where no one can enter fake medicines, it completely prevents counterfeiting drugs. All the participants of the system can track the medicines at every step of the supply chain.

7. Conclusions and Future Work

Blockchain technology has changed the traditional supply chain method to a new robust, automated, secure, audible and transparent way. It ensures that the entire supply chain process is foolproof and prevents fake drugs from entering the system completely. The main goals and novelty of our proposed scheme are implementing a blockchain and machine learning-enabled system, which has two modules: the drug supply chain system and the drug recommendation system. The system has used machine learning algorithms and blockchain technology in health care, with excellent results. Several experiments were carried for testing the performance of our system by using some performance indicators such as throughput, transaction response time and latency. The simulation results of our system shows promising performance. This system helps the pharmaceutical companies to eliminate counterfeit medicines problem and a significant increase in the business. As future work, we will increase the network size and implement it in real-time pharmaceutical companies to test the performance and validity of our system. Further, we will also improve our machine learning models in terms of accuracy and recommendation results.

Author Contributions

Data curation, K.A.; Formal analysis, K.A. and T.A.K.; Investigation, M.A.; Methodology, K.A.; Project administration, W.-C.S.; Supervision, W.-C.S.; Validation, T.A.K.; Writing—original draft, K.A.; Writing—review & editing, M.A. All authors have read and agreed to the published version of the manuscript.


This research was supported by the MSIT (Ministry of Science and ICT), Korea, under the ITRC (Information Technology Research Center) support program (IITP-2019-2017-0-01633) supervised by the IITP (Institute for Information and communications Technology Planning and Evaluation). This research was supported by the Korea Research Fellowship program funded by the Ministry of Science and ICT through the National Research Foundation of Korea (2019H1D3A1A01102980).

Conflicts of Interest

The authors declare no conflict of interest.


  1. Williams, L.; McKnight, E. The real impact of counterfeit medications. US Pharm. 2014, 39, 44–46. [Google Scholar]
  2. Newton, P.N.; Green, M.D.; Fernández, F.M.; Day, N.P.; White, N.J. Counterfeit anti-infective drugs. Lancet Infect. Dis. 2006, 6, 602–613. [Google Scholar] [CrossRef]
  3. WHO. Growing Threat from Counterfeit Medicines. Available online: (accessed on 12 February 2020).
  4. Justice, C. Activities of the Institutes Comprising the United Nations Crime Prevention and Criminal Justice Programme Network; Economic and Social Council: New York, NY, USA, 2003.
  5. Roxanne, E.; Lisa, D.; George, P. Anticounterfeiting in the fashion and luxury sectors: Trends and strategies. In Anti-Counterfeiting—A Global Guide; 2013; Available online: (accessed on 1 January 2020).
  6. Harris, J.; Stevens, P.; Morris, J. Keeping it Real: Combating the Spread of Fake Drugs in Poor Countries; International Policy Network: Londn, UK, 2009. [Google Scholar]
  7. Metcalf, D.S.; Bass, J.; Hooper, M.; Cahana, A.; Dhillon, V. Blockchain in Healthcare: Innovations that Empower Patients, Connect Professionals and Improve Care; CRC Press, Taylor & Francis Group: Boca Raton, FL, USA, 2019. [Google Scholar]
  8. Akunyili, D. Fake and counterfeit drugs in the health sector: The role of medical doctors. Ann. Ib. Postgrad. Med. 2004, 2, 19–23. [Google Scholar] [CrossRef]
  9. Dégardin, K.; Roggo, Y.; Margot, P. Understanding and fighting the medicine counterfeit market. J. Pharm. Biomed. Anal. 2014, 87, 167–175. [Google Scholar] [CrossRef] [PubMed]
  10. Blackstone, E.A.; Fuhr, J.P., Jr.; Pociask, S. The health and economic effects of counterfeit drugs. Am. Health Drug Benefits 2014, 7, 216. [Google Scholar]
  11. Khatoon, A. A Blockchain-Based Smart Contract System for Healthcare Management. Electronics 2020, 9, 94. [Google Scholar] [CrossRef]
  12. Soundarya, K.; Pandey, P.; Dhanalakshmi, R. A Counterfeit Solution for Pharma Supply Chain. EAI Endorsed Trans. Cloud Syst. 2018, 3. [Google Scholar] [CrossRef]
  13. Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. 2008. Available online: (accessed on 12 September 2019).
  14. Jamil, F.; Hang, L.; Kim, K.; Kim, D. A Novel Medical Blockchain Model for Drug Supply Chain Integrity Management in a Smart Hospital. Electronics 2019, 8, 505. [Google Scholar] [CrossRef]
  15. Khan, P.W.; Byun, Y.; Namje, P. A Data Verification System for CCTV Surveillance Cameras Using Blockchain Technology in Smart Cities. Electronics 2020, 9, 484. [Google Scholar] [CrossRef]
  16. Viriyasitavat, W.; Hoonsopon, D. Blockchain characteristics and consensus in modern business processes. J. Ind. Inf. Integr. 2019, 13, 32–39. [Google Scholar] [CrossRef]
  17. Pandey, P.; Litoriya, R. Securing E-health Networks from Counterfeit Medicine Penetration Using Blockchain. Wirel. Pers. Commun. 2020. [Google Scholar] [CrossRef]
  18. Hyperledger. Hyperledger Blockchain. Available online: (accessed on 10 January 2020).
  19. Wu, X.; Lin, Y. Blockchain recall management in pharmaceutical industry. Procedia CIRP 2019, 83, 590–595. [Google Scholar] [CrossRef]
  20. Bryatov, S.; Borodinov, A. Blockchain technology in the pharmaceutical supply chain: Researching a business model based on Hyperledger Fabric. In Proceedings of the International Conference on Information Technology and Nanotechnology (ITNT), Samara, Russia, 24–27 April 2019. [Google Scholar]
  21. Lin, Y.P.; Petway, J.R.; Anthony, J.; Mukhtar, H.; Liao, S.W.; Chou, C.F.; Ho, Y.F. Blockchain: The evolutionary next step for ICT e-agriculture. Environments 2017, 4, 50. [Google Scholar] [CrossRef]
  22. Rabah, K. Challenges & opportunities for blockchain powered healthcare systems: A review. Mara Res. J. Med. Health Sci. 2017, 1, 45–52. [Google Scholar]
  23. Amin, A.D. Blockchain technology in banking and finance sector: Its effects and challenges. CARE J. 2020, 31, 349–358. [Google Scholar]
  24. Chen, G.; Xu, B.; Lu, M.; Chen, N.S. Exploring blockchain technology and its potential applications for education. Smart Learn. Environ. 2018, 5, 1. [Google Scholar] [CrossRef]
  25. Astarita, V.; Giofrè, V.P.; Mirabelli, G.; Solina, V. A Review of Blockchain-Based Systems in Transportation. Information 2020, 11, 21. [Google Scholar] [CrossRef]
  26. Tseng, J.H.; Liao, Y.C.; Chong, B.; Liao, S.W. Governance on the drug supply chain via gcoin blockchain. Int. J. Environ. Res. Public Health 2018, 15, 1055. [Google Scholar] [CrossRef]
  27. Caro, M.P.; Ali, M.S.; Vecchio, M.; Giaffreda, R. Blockchain-based traceability in Agri-Food supply chain management: A practical implementation. In Proceedings of the 2018 IoT Vertical and Topical Summit on Agriculture-Tuscany (IOT Tuscany), Tuscany, Italy, 8–9 May 2018; pp. 1–4. [Google Scholar]
  28. Figorilli, S.; Antonucci, F.; Costa, C.; Pallottino, F.; Raso, L.; Castiglione, M.; Pinci, E.; Del Vecchio, D.; Colle, G.; Proto, A.R.; et al. A blockchain implementation prototype for the electronic open source traceability of wood along the whole supply chain. Sensors 2018, 18, 3133. [Google Scholar] [CrossRef]
  29. Lin, J.; Shen, Z.; Zhang, A.; Chai, Y. Blockchain and IoT based food traceability for smart agriculture. In Proceedings of the 3rd International Conference on Crowd Science and Engineering, Singapore, 28–31 July 2018; pp. 1–6. [Google Scholar]
  30. Xu, Q.; Aung, K.M.M.; Zhu, Y.; Yong, K.L. A blockchain-based storage system for data analytics in the internet of things. In New Advances in the Internet of Things; Springer: Berlin, Germany, 2018; pp. 119–138. [Google Scholar]
  31. Bocek, T.; Rodrigues, B.B.; Strasser, T.; Stiller, B. Blockchains everywhere-a use-case of blockchains in the pharma supply-chain. In Proceedings of the 2017 IFIP/IEEE Symposium on Integrated Network and Service Management (IM), Lisbon, Portugal, 8–12 May 2017; pp. 772–777. [Google Scholar]
  32. Dubovitskaya, A.; Xu, Z.; Ryu, S.; Schumacher, M.; Wang, F. Secure and trustable electronic medical records sharing using blockchain. AMIA annual symposium proceedings. Am. Med. Inform. Assoc. 2017, 2017, 650. [Google Scholar]
  33. Jamil, F.; Ahmad, S.; Iqbal, N.; Kim, D.H. Towards a Remote Monitoring of Patient Vital Signs Based on IoT-Based Blockchain Integrity Management Platforms in Smart Hospitals. Sensors 2020, 20, 2195. [Google Scholar] [CrossRef] [PubMed]
  34. Guardtime. Guardtime. Available online: (accessed on 12 March 2020).
  35. Fu, J.; Wang, N.; Cai, Y. Privacy-Preserving in Healthcare Blockchain Systems Based on Lightweight Message Sharing. Sensors 2020, 20, 1898. [Google Scholar] [CrossRef] [PubMed]
  36. Ekblaw, A.C. MedRec: Blockchain for Medical Data Access, Permission Management and Trend Analysis. Ph.D. Thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, 2017. [Google Scholar]
  37. Prisco, G. The Blockchain for Healthcare: Gem Launches gem Health Network with Philips Blockchain Lab. Bitcoin Magazine, 26 April 2016. [Google Scholar]
  38. HealthCoin. HealthCoin. Available online: (accessed on 23 February 2020).
  39. Hang, L.; Choi, E.; Kim, D.H. A novel EMR integrity management based on a medical blockchain platform in hospital. Electronics 2019, 8, 467. [Google Scholar] [CrossRef]
  40. Clauson, K.A.; Breeden, E.A.; Davidson, C.; Mackey, T.K. Leveraging blockchain technology to enhance supply chain management in healthcare. Blockchain Healthc. Today 2018. [Google Scholar] [CrossRef]
  41. Liu, X.; Wang, W.; Guo, H.; Barenji, A.V.; Li, Z.; Huang, G.Q. Industrial blockchain based framework for product lifecycle management in industry 4.0. Robot. Comput. Integr. Manuf. 2020, 63, 101897. [Google Scholar] [CrossRef]
  42. Sloan, B.; Finnegan, S.; Kennedy, P. Remote Patient Monitoring System. U.S. Patent App. 16/442,433, 2 January 2020. [Google Scholar]
  43. Ali, M.S.; Vecchio, M.; Putra, G.D.; Kanhere, S.S.; Antonelli, F. A Decentralized Peer-to-Peer Remote Health Monitoring System. Sensors 2020, 20, 1656. [Google Scholar] [CrossRef]
  44. Xie, W.; Wang, B.; Ye, Z.; Wu, W.; You, J.; Zhou, Q. Simulation-based Blockchain Design to Secure Biopharmaceutical Supply Chain. In Proceedings of the 2019 Winter Simulation Conference (WSC), National Harbor, MD, USA, 8–11 December 2019; pp. 797–808. [Google Scholar]
  45. Wigand, R.T.; Mande, D.M.; Wood, J.D. Information management and tracking of drugs in supply chains within the pharmaceutical industry. In Proceedings of the 2011 Eighth International Conference on Information Technology: New Generations, Las Vegas, NV, USA, 11–13 April 2011; pp. 500–507. [Google Scholar]
  46. Molina, J.C.; Delgado, D.T.; Tarazona, G. Using Blockchain for Traceability in the Drug Supply Chain. In Proceedings of the International Conference on Knowledge Management in Organizations, Zamora, Spain, 15–18 July 2019; Springer: Berlin, Germany, 2019; pp. 536–548. [Google Scholar]
  47. Hasan, H.; AlHadhrami, E.; AlDhaheri, A.; Salah, K.; Jayaraman, R. Smart contract-based approach for efficient shipment management. Comput. Ind. Eng. 2019, 136, 149–159. [Google Scholar] [CrossRef]
  48. Sahoo, M.; Singhar, S.S.; Sahoo, S.S. A Blockchain Based Model to Eliminate Drug Counterfeiting. In Machine Learning and Information Processing; Springer: Berlin, Germany, 2020; pp. 213–222. [Google Scholar]
  49. Kumar, R.; Tripathi, R. Traceability of counterfeit medicine supply chain through Blockchain. In Proceedings of the 2019 11th International Conference on Communication Systems & Networks (COMSNETS), Bengaluru, India, 7–11 January 2019; pp. 568–570. [Google Scholar]
  50. Azzi, R.; Chamoun, R.K.; Sokhn, M. The power of a blockchain-based supply chain. Comput. Ind. Eng. 2019, 135, 582–592. [Google Scholar] [CrossRef]
  51. Longo, F.; Nicoletti, L.; Padovano, A.; d’Atri, G.; Forte, M. Blockchain-enabled supply chain: An experimental study. Comput. Ind. Eng. 2019, 136, 57–69. [Google Scholar] [CrossRef]
  52. Huang, Y.; Wu, J.; Long, C. Drugledger: A Practical Blockchain System for Drug Traceability and Regulation. In Proceedings of the 2018 IEEE International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), Halifax, NS, Canada, 30 July–3 August 2018; pp. 1137–1144. [Google Scholar]
  53. Chitre, M.; Sapkal, S.; Adhikari, A.; Mulla, S. Monitoring Counterfeit Drugs using CounterChain. In Proceedings of the 2019 International Conference on Advances in Computing, Communication and Control (ICAC3), Mumbai, India, 20–21 December 2019; pp. 1–6. [Google Scholar]
  54. Shu, H.; Qi, P.; Huang, Y.; Chen, F.; Xie, D.; Sun, L. An Efficient Certificateless Aggregate Signature Scheme for Blockchain-Based Medical Cyber Physical Systems. Sensors 2020, 20, 1521. [Google Scholar] [CrossRef]
  55. Kim, M.; Park, K.; Yu, S.; Lee, J.; Park, Y.; Lee, S.W.; Chung, B. A secure charging system for electric vehicles based on blockchain. Sensors 2019, 19, 3028. [Google Scholar] [CrossRef] [PubMed]
  56. UCI. Drug Review Dataset. Available online: https://archive.ics.uci.e.,du/ml/datasets/ (accessed on 5 January 2020).
  57. Gräßer, F.; Kallumadi, S.; Malberg, H.; Zaunseder, S. Aspect-based sentiment analysis of drug reviews applying cross-domain and cross-data learning. In Proceedings of the 2018 International Conference on Digital Health, Lyon, France, 23–26 April 2018; pp. 121–125. [Google Scholar]
  58. Chen, M.; Suresh, A.T.; Mathews, R.; Wong, A.; Allauzen, C.; Beaufays, F.; Riley, M. Federated Learning of N-gram Language Models. arXiv 2019, arXiv:1910.03432. [Google Scholar]
  59. Ke, G.; Meng, Q.; Finley, T.; Wang, T.; Chen, W.; Ma, W.; Ye, Q.; Liu, T.Y. Lightgbm: A highly efficient gradient boosting decision tree. In Advances in Neural Information Processing Systems 30; Curran Associates, Inc.: Dutchess County, NY, USA, 2017; pp. 3146–3154. [Google Scholar]
  60. Parsing, C. Speech and Language Processing. 2009. Available online: (accessed on 20 January 2020).
  61. Goldwater, S. ANLP Lecture 6 N-gram Models and Smoothing. 2019. Available online: (accessed on 2 January 2020).
  62. Cachin, C. Architecture of the hyperledger blockchain fabric. In Proceedings of the Workshop on Distributed Cryptocurrencies and Consensus Ledgers, Hangzhou, China, 11–13 May 2016; Volume 310, p. 4. [Google Scholar]
  63. Khan, P.W.; Byun, Y. A Blockchain-Based Secure Image Encryption Scheme for the Industrial Internet of Things. Entropy 2020, 22, 175. [Google Scholar] [CrossRef]
  64. Caliper, H. Hyperledger Caliper Architecture. Available online: (accessed on 10 March 2019).
  65. Hyperledger. Hyperledger Caliper. Available online: (accessed on 5 January 2019).
Figure 1. Overview of drug supply chain management (DSCM) system with blockchain.
Figure 1. Overview of drug supply chain management (DSCM) system with blockchain.
Electronics 09 00852 g001
Figure 2. Detailed architecture of DSCMR system.
Figure 2. Detailed architecture of DSCMR system.
Electronics 09 00852 g002
Figure 3. Smart contract execution in DSCMR system.
Figure 3. Smart contract execution in DSCMR system.
Electronics 09 00852 g003
Figure 4. Transaction execution procedure in DSCMR system.
Figure 4. Transaction execution procedure in DSCMR system.
Electronics 09 00852 g004
Figure 5. Architecture of machine learning based drug recommendation system.
Figure 5. Architecture of machine learning based drug recommendation system.
Electronics 09 00852 g005
Figure 6. Top rated conditions and their weight in dataset.
Figure 6. Top rated conditions and their weight in dataset.
Electronics 09 00852 g006
Figure 7. Drugs distribution with respect to rating provided by consumers.
Figure 7. Drugs distribution with respect to rating provided by consumers.
Electronics 09 00852 g007
Figure 8. N-gram model training accuracy and loss.
Figure 8. N-gram model training accuracy and loss.
Electronics 09 00852 g008
Figure 9. Important features with respect to high gradient using LightGBM.
Figure 9. Important features with respect to high gradient using LightGBM.
Electronics 09 00852 g009
Figure 10. Participants definition in Hyperledger composer.
Figure 10. Participants definition in Hyperledger composer.
Electronics 09 00852 g010
Figure 11. Smart contract definition in scripts file for a function update drug detail.
Figure 11. Smart contract definition in scripts file for a function update drug detail.
Electronics 09 00852 g011
Figure 12. Blocks, transaction and ledger communication together.
Figure 12. Blocks, transaction and ledger communication together.
Electronics 09 00852 g012
Figure 13. Drug management portal for adding, updating and checking drugs.
Figure 13. Drug management portal for adding, updating and checking drugs.
Electronics 09 00852 g013
Figure 14. Add drugs web form of client web application.
Figure 14. Add drugs web form of client web application.
Electronics 09 00852 g014
Figure 15. Rest server user interface and communication using API.
Figure 15. Rest server user interface and communication using API.
Electronics 09 00852 g015
Figure 16. Transaction history portal.
Figure 16. Transaction history portal.
Electronics 09 00852 g016
Figure 17. Executed transaction view only form.
Figure 17. Executed transaction view only form.
Electronics 09 00852 g017
Figure 18. Top-rated drug recommendation results with acne condition.
Figure 18. Top-rated drug recommendation results with acne condition.
Electronics 09 00852 g018
Figure 19. Drug recommendation results against blood pressure disease condition query.
Figure 19. Drug recommendation results against blood pressure disease condition query.
Electronics 09 00852 g019
Figure 20. Drug recommendation results against anxiety disease condition query.
Figure 20. Drug recommendation results against anxiety disease condition query.
Electronics 09 00852 g020
Figure 21. Drug prediction results of alcohol dependence condition query.
Figure 21. Drug prediction results of alcohol dependence condition query.
Electronics 09 00852 g021
Figure 22. Response time for different query requests.
Figure 22. Response time for different query requests.
Electronics 09 00852 g022
Figure 23. Latency in query transaction.
Figure 23. Latency in query transaction.
Electronics 09 00852 g023
Table 1. Sample of drug review data-set used in our system.
Table 1. Sample of drug review data-set used in our system.
Unique IDDrug NameConditionReviewRatingDateUseful Count
So much better than the creams.101-Mar-0955
218736Opana ERPainThis medicine did nothing at all for my pain. Glad it works for some, but it didn’t for me!21-Aug-0912
147353AlprazolamAnxietyChanged my life completely, I can actually function in social settings.1028-Oct-114
126666EletriptanMigraineThe only migraine medicine that has ever worked on me. Now my
insurance company will not cover it. Guess I will have to pay for it. It works that good!
90969NorcoPainI also have knee pain, shoulder pain, elbow and hand and finger pain. Norco seems to work best on the knee pain.1021-May-1219
Table 2. Tools and technologies for the implementation of the proposed system.
Table 2. Tools and technologies for the implementation of the proposed system.
System ComponentDescription
Operating SystemUbuntu Linux 18.04.1 LTS
CPUIntel (R) Core (TM) i5-7400 CPU at 3.00 GHz
Hyperledger Fabricv1.12
Docker EngineVersion 18.06.1-ce
CLI Toolcomposer-cli, composer-rest-server, composer-playground
Docker ComposerVersion 1.13.
Primary Memory32 GB RAM
Programming Languagepython, tensor-flow
(Client application)Solidity, Node JS, HTML, CSS, JS, Twitter Bootstrap, JQ, angular JS
IDE (Platform)Visual Studio
Table 3. Transaction and events definition in proposed system.
Table 3. Transaction and events definition in proposed system.
Name of ComponentTypeJob
Update Drug DetailsTransactionUpdate the stored drug details
i.e., expiry date, manufacture date, price, etc.
Update Raw MaterialTransactionUpdate the raw material detail
i.e., quantity, expiry date and price.
Update order statusTransactionUpdate order detail from customers
i.e., DrugID, quantity, Drug name, etc.
Share Drug record with WholesalersTransactionShare the manufacturer drug details with
wholesalers and gives permission to share record
i.e., drug name, price, formula, quantity and type.
Share Drug record with distributorTransactionShare the manufacturer drug details with distributors and gives permission to share the record
i.e., drug name, price, formula, quantity and type.
Share Drug record with pharmacyTransactionShare the manufacturer drug details with pharmacy and gives permission to share the record
i.e., drug name, price, formula, quantity and type.
Share Drug record with hospitalsTransactionShare the manufacturer drug details with hospitals and gives permission to share the record
i.e., drug name, price, formula, quantity and type.
Share Drug record with DoctorsTransactionShare the manufacturer drug details with doctors & clinics and gives permission to share the record
i.e., drug name, price, formula, quantity and type.
Share Drug record with patientsTransactionShare the drug detail with patients to check either drug is valid or fake i.e., drug name, price, expiry date, manufacturing date.
Share order detail with distributorsTransactionShare the confirmed order detail with distributors for delivery.
Share drug record with the pharmacy Notification messageEventShare drug record notification event sent a message to the pharmacy for confirmation.
Share drug record with the hospital’s Notification messageEventShare drug record notification event sent a message to the hospitals for confirmation.
Share drug record with the doctor Notification messageEventShare drug record notification event sent a message to the doctors for confirmation.
Update order statusEventThis event sent the message back to the participants for order updates
Share order placed NotificationEventshare order placed notification will be sent message order is placed successfully.
Share order confirmed NotificationEventshare order confirmed notification will be sent the message order is confirmed and ready for delivery.
Share order detail with distributors NotificationEventNotification message for order detail confirmation
Table 4. Comparison of proposed system with existing methods.
Table 4. Comparison of proposed system with existing methods.
WorkCryptoSmart ContractNetwork TypeConsensus DeterminationEfficiencyFunctionality
[12]NoYesPermissionedSingle-CompanyLowDrug SCM
[14]NoYesPermissionedSelected-NodesHighDrug SCM
[26]YesYesPermissionlessComplete-NodesLowDrug SCM
Proposed DSCMRNoYesPermissionedArbitrary- NodesHighDrug SCM & ML-based Recommendation
Back to TopTop