|Computers, Materials & Continua |
Intelligent Microservice Based on Blockchain for Healthcare Applications
1Department of Computer Engineering, Jeju National University, Jeju-si, 63243, Korea
2College of Computing and Informatics, Saudi Electronic University, Riyadh, Saudi Arabia
3SAP Pakistan Liaison Office, Islamabad, 44010, Pakistan
4Department of Telecommunication Networks and Data Transmission, The Bonch-Bruevich Saint-Petersburg State University of Telecommunications, Saint Petersburg, 193232, Russia
5Peoples’ Friendship University of Russia (RUDN University) 6 Miklukho-Maklaya St, Moscow, Moscow, 117198, Russian Federation
*Corresponding Author: Ammar Muthanna. Email: email@example.com
Received: 21 March 2021; Accepted: 22 April 2021
Abstract: Nowadays, the blockchain, Internet of Things, and artificial intelligence technology revolutionize the traditional way of data mining with the enhanced data preprocessing, and analytics approaches, including improved service platforms. Nevertheless, one of the main challenges is designing a combined approach that provides the analytics functionality for diverse data and sustains IoT applications with robust and modular blockchain-enabled services in a diverse environment. Improved data analytics model not only provides support insights in IoT data but also fosters process productivity. Designing a robust IoT-based secure analytic model is challenging for several purposes, such as data from diverse sources, increasing data size, and monolithic service designing techniques. This article proposed an intelligent blockchain-enabled microservice to support predictive analytics for personalized fitness data in an IoT environment. The designed system support microservice-based analytic functionalities to provide secure and reliable services for IoT. To demonstrate the proposed model effectiveness, we have used the IoT fitness application as a case study. Based on the designed predictive analytic model, a recommendation model is developed to recommend daily and weekly diet and workout plans for improved body fitness. Moreover, the recommendation model objective is to help trainers make future health decisions of trainees in terms of workout and diet plan. Finally, the proposed model is evaluated using Hyperledger Caliper in terms of latency, throughput, and resource utilization with varying peers and orderer nodes. The experimental result shows that the proposed model is applicable for diverse resource-constrained blockchain-enabled IoT applications and extensible for several IoT scenarios.
Keywords: Internet of things; blockchain; microservice; fitness service
Internet of Things (IoT) is an emerging field with advanced tools and technologies, including data processing and analysis approaches to improve efficiency and productivity in the IoT environment. In IoT, the sensors and actuators are coupled with information and communication technology in a digital environment where data is extracted, processed, and analyzed to support intelligent IoT applications.
Data analytics play an immense role in multiple dimensions, including healthcare, business, infrastructure handling, energy management, security, safety, etc. . However, due to its huge usage, new challenges are faced in the IoT analytics community. Some of them include complexity faced while processing IoT data streamed from different devices, handling various formats of data, annotating sensor observations in real-time to know about meaning and context, especially using and processing this data along with maintenance-related services instead of unreliable approaches. Such issues have an adverse impact on scalability, efficiency, and reusability in IoT applications. There is a need for such models to overcome the said issues and provide helpful information from IoT data.
The blockchain is designed on distributed ledger technology, which was created to store irreversible financial records. The record of each transaction in a blockchain is secured through allowed participants to sign the transaction. The blockchain comprises a block that includes a digitally encrypted block and signed as a time stamp. At last, the chain is secured and protected using advanced cryptographic algorithms . A blockchain comprises a distributed ledger database containing six layers: network, data, smart contract, consensus, application, and service. The data layer and network layer are typically where data acquisition, authorization, and control are performed . The smart contract, consensus protocol, and incentive structure functionality are deemed part of the smart contract layer and consensus mechanism. Furthermore, a massive amount of computing power and resources are consumed by the blockchain consensus protocol, resulting in lower throughput and latency . The blockchain network’s back-end functionality is managed by the service layer, which is exposed to the application layer. The front end and back end communicate which each other, which is handled by the application layer. Various new blockchain technologies, including permission and privacy mechanisms, consensus algorithms, permission and privacy methods, and smart contracts, have been implemented over the last few years. The blockchain contains public and private blockchains. The network is managed and regulated by the registered users in a private blockchain. Similarly, a registered participant in a permissioned blockchain takes part in the block creation mechanism, whereas anyone in a permissionless blockchain may participate in the consensus and block creation mechanisms. As a result, the permissioned blockchain is considered more scalable, transparent, and customizable .
In recent years, the Internet of Things (IoT) has brought immense changes in human lives [6,7]. Several thousand devices make up the Internet of Things, which monitors the environment, gathers sensory data, and sends it to a central location. Healthcare is one of the most rapidly growing areas among the various applications [7–10]. Besides, some IoT-enabled fitness devices provide trainee safety by overcoming muscle imbalance, monitoring workout plans, and alerting trainees when taking rest . During training, each trainer’s activity is tracked by these fitness embedded devices. The Internet of Things (IoT) provides practical mechanisms for maximizing production in a variety of fields. Despite its vast capabilities, the Internet of Things is plagued by many problems currently being researched by scientists. Big data analytics, connectivity, centralization, security, hardware capacities, GIS visualization user data privacy are just a few of the issues that need to be addressed .
Machine learning that learns, infers the knowledge, and complies with the processed data, is another eminent domain currently gaining attention. Similarly, by regulating and wielding raw data, blockchain technology plays a significant role in computer science . One of the greatest challenges the data science community faces is incorporating noisy IoT sensor data, such as missing data records, inaccurate data format, and redundancy . The data can be conveniently checked for data analytics with the aid of a blockchain-based smart contract.
The following are the principal contributions of this paper:
• For IoT applications, we present a Blockchain-based Intelligent Microservice to assist Predictive Analytics for Personalized Fitness Data. We present the main characteristics of predictive analytics before developing and deploying them as microservices. As a result, each autonomous microservice is responsible for analytic functionality and is composed of other microservices that are part of the containerized environment to meet the service’s goals.
• The proposed models assemble both the mechanisms (i.e., knowledge-based and data-driven models) to process and analyze IoT data. Semantic web and machine learning technologies have been considered in this perspective.
• The proposed system is a permissioned blockchain model, which ensures that the IOT device’s information is secured. The system logs and transaction history are accessed by authorized users only.
• The proposed Blockchain-Based Intelligent Microservice enabled Predictive Analytics model is a simple solution in which the interactive client application communicates with the blockchain network via a RESTful API. The addition of a RESTful API boosts system performance by allowing for data offloading and computing.
• Besides, intelligent fitness service is provided via creating a prototype application, demonstrating the proposed IoT blockchain architecture.
• The intelligent fitness service analyses the fitness data of a trainee and recommends a plan for workout and diet.
• Finally, the Hyperledger Caliper is used to assess the intelligent fitness service’s efficiency and robustness in the context of latency, resource utilization, and throughput. The outcomes validate the usefulness of the proposed model.
2 Literature Review
In this section, we’ll go over some of the existing blockchain-related work that’s been combined with AI and IoT. Modern technology, including a combination of artificial intelligence and blockchain, is transforming the Internet of Things [11–19].
A decentralized and distributed platform is provided by blockchain technology. On the other hand, artificial intelligence is used in IoT-based applications to process and analyze data and provide decision-making capabilities and intelligence to the device. A plethora of electronic devices has aided mankind in digitizing, sharing, digitizing, and delivering data pertaining to fitness for both trainees and trainers in recent years. This section encompasses details regarding existing blockchain-based fitness applications.
Elliott et al.  demonstrated an incentive-based app that motivates engagement in physical activity. This project aims to show and measure changes in the physical activity of a user, like counting of steps taken in a day. Derlyatka et al.  suggested a sweatcoin, a digital currency that provides an incentive for users to engage in physical activity. This approach aims to harness physical data of a user in the form of count for taken steps and provide a reward in the form of sweatcoin. In 2018, Joseph Anthony, the founder of a startup in Switzerland, created an app that tracks users’ physical activity. Run2Play is a startup that aims to motivate people to engage in physical activity . Martin introduced the Movement app, an Ethereum startup, in 2017 to incentivize people for physical activities like treadmill running, jogging, and any other outdoor physical activity. The study also created a marketplace where users of the movement app may utilize their tokens to purchase nutrition items and fitness equipment. Furthermore, the app also provides a facility for other cryptocurrencies . Jaroslav created a fitness app in 2016 with the goal of teaching people how to exercise properly. Truegym, an Ethereum-based startup, uses machine learning strategies to examine fitness data collected from devices and trainers in order to suggest training plans to each user . Drake created The Hustle, a fitness application, in 2018. The Hustle is a blockchain application based on Ethereum that focuses on encouraging fitness, wellness, and well-being while incentivizing people to remain healthy. The company creates an Ethereum token that is given to users who engage in fitness-related activities. Each user is given a built-in wallet in which HUSL token is transferred, where it can be readily exchanged for other currencies like ETH, BTC, or USD [25–33].
As previously stated, these blockchain-based platforms are open-source or permissioned ones, making it impossible for the average user to update or alter the existing system to suit their needs. Furthermore, most of the techniques discussed in the literature review pertaining to blockchain and IoT, and they either reward users with a token for providing fitness data or incentivize users with a token. However, none of these approaches harness a permissioned blockchain platform, termed as Hyperledger fabric, to drive body composition functions using a blockchain-enabled predictive analytics-based microservice. Furthermore, most of the contemporary fitness-related applications employ system’s built-in crypto-currency, lowering the system’s performance in terms of computing power during the transaction. As per the authors’ knowledge, there have been no functional approaches that use blockchain-based microservice-enabled predictive analytics to determine body composition.
3 System Model
3.1 Data Transformation and Preprocessing
In data transformation and preprocessing, the collection of IoT data acquired from the IoT fitness devices is prepared for analytic procedures. The data preprocessor receives the IoT fitness data via IoT gateway based on MQTT interface. Multiple data preprocessing functions such as data cleaning, integration, and normalization are applied to the data to make data consistent. Data cleaning removes noise from the data and fills missing values using the data imputation approach. In data integration, the data acquired from multiple IoT fitness devices are gathered into a unified structure. Data normalization is used to aggregate and transform the data in the normalized range to make data consistent.
3.2 Service Support Functions for Micro-Services
The service support function provides micro-services functionality for the proposed intelligent, personalized fitness data safety management system. The support function provides services which include management and configuration, discovery, and handling micro-services template. The micro-service registry is used to mapped instances and identifiers using the search capabilities in the discovery function. Similarly, in the management support function, the analytic and identification micro-service is selected in response to the service requests. Furthermore, the management function also provides support such as configuration settings for every micro-service. In micro-service template management, information related to each template is stored and retrieved through an interface. Moreover, the data-controlled access is also provided by the service support function in analytics micro-services. The micro-service also contains references of repository and registry with service templates. Furthermore, some additional functions are also included, such as micro-service adaption, observer, and orchestration management. In the micro-service observer, the data and log of failure operation are analyzed and validate the remote calls and protect the operation from failure. The micro-service orchestration is used to integrate and preserve various micro-service operations output, which is later combined in the form of result. Finally, the micro-service adaption management is responsible for managing the adaption rule, which influences the micro-services according to the environment. The adaption management sole duty is to trigger new scripts are described in the rule based on the type and condition of micro-service.
3.3 Prediction Analytics in Micro-Services
The prediction analytics micro-service layer describes the analytic function which is embedded in micro-services. These analytic functions include data pre-processing, feature extraction, selection of new features, and data annotation. The prediction analytic micro-service output is evaluated according to the steps summarized in Fig. 2. Initially, the fitness data is acquired from IoT fitness devices containing missing values, inconsistent structure, and unprocessed. The unprocessed data is denoted as matrix αfitness. The unprocessed fitness devices data matrix αfitness is passed to the data processing micro-service, which enhances the data by recovering the missing values through an imputation approach and improves data inconsistencies for better analytic procedures. Afterward, the pre-processed data matrix αfitness is passed to one step higher for data normalization and transformation, which denotes βfitness matrix. The βfitness matrix also contains data from different heterogeneous sources like smart wrist watch etc. Finally, the normalized data is provided to the orchestration micro-service, which forms a refined data matrix γfitness. The analytic processing micro-service used the γfitness matrix for applying machine learning approaches to compute results.
The micro-services are fine-grained services where each service is loosely coupled and provide functionalities in an isolated manner. The overall service objective is achieved by combining the functionality of several micro-service. The machine learning development approaches used to support IoT fitness data analytics have become extrusive for many IoT-based intelligent applications. The proposed system includes the following micro-service tasks such as data pre-processing, feature extraction, model selection, and visualization. The proposed prediction analytics micro-service using the Restful micro-service API. The extracted feature using fitness data based on micro-service to improve the performance accuracy. We have carried out some additional statistical approaches on selected features for fitness data to enhance system accuracy. Afterward, the related features are used in the learning process. In the learning process, the appropriate learning model selection is made by micro-services used to train over fitness data and improve the error rate with test data. Lastly, the prediction output generated from the micro-services are used by prediction visualization to get more insight from the fitness data.
3.4 Blockchain-Based Personalized Fitness Data Safety Management
This section will discuss the design of the proposed blockchain-based personalized fitness data safety management platform. The ready data, as presented in Fig. 2 is passed to the blockchain system. The user personal and fitness data acquired from IoT fitness devices are secured and using blockchain-based encrypted mechanisms. The blockchain’s fitness data is stored in the distributed ledger compared to traditional centralized cloud storage. The stored fitness data is shared among the system’s authentic user, who are authorized to access the fitness data with the fitness trainee’s consent. Whenever the trainer or other system users want to access the trainee data, the real-time alert is triggered and delivered to the trainee, requiring a permission grant for data sharing. Furthermore, the ready data is encrypted using blockchain technology, where smart contracts are designed and digital signed by the system’s users. The blockchain based distributed ledger technology provides the tamper-proof and immutable data structure with data transparency, consistency, security, and user privacy. Similarly, the fitness data’s end-user or stack-holder includes trainee, trainer, fitness manager, healthcare providers, fitness center, and insurance companies. Fig. 3 shows the scenario of a blockchain-based fitness data safety management platform.
Fig. 4 represents the services exposed by the blockchain-based personalized fitness data safety management platform. We have used Hyperledger Composer to design Restful API, a tool set that allows us to create smart contracts and blockchain applications to solve real-world problems. The Restful API is created us composer-rest-server, which is used to generate the API from the deployed blockchain network and accessed from anywhere through HTTP or REST clients. The proposed Restful API is divided into three components, i.e., action, resource, and verb. The resources are the path where the client sent the request, e.g., apiupdateDietPlan. Similarly, the verb represents the particular action performed on the request, e.g., DELETE, PUT, POST, UPDATE. Lastly, the resources are the functionalities used in the proposed system, e.g., workout plan, trainee appointment, diet plan, equipment management, etc.
3.5 Management in Personalized Fitness Data Safety Management System
The proposed system also supports trainee mobility management (MM) in two scenarios. The MM in the proposed system can be explained as if the trainee wants to change the fitness center from A to B, and then the system will give two options defined in a smart contract, i.e., delete existing ID or create a new ID. The trainee can either delete the current fitness ID before moving from fitness center A to B, or the trainee can use the same fitness ID. The trainee fitness ID is used to keep track of personalized trainee fitness records within the blockchain network. Fig. 5 presents the trainee MM scenario with existing traineeID, in which the trainee shift from fitness A to B with all his previous data.
In scenario one, the trainee record and TraineeID will remain the same only fitnessCenterID will be updated as defined in the smart contract. The participant like trainer and manager can easily access the trainee personal fitness record with trainee’s permission through uniquely identified TraineeID defined in the smart contract. Moreover, the trainee can also permit system users to access personal fitness data within the blockchain network.
Similarly, in MM Scenario 2, the TraineeID will be deleted in case of trainee mobility from fitness center A to B. The personal fitness data associated with the specific TraineeID will be removed from the blockchain network as defined in the smart contract. Afterward, the new TraineeID was generated, which uniquely identified the trainee record within the blockchain. The system user can access the trainee’s personal record through the newly generated TraineeID with the trainee’s permission. Fig. 6 illustrated the MM scenario 2 with newly generated TraineeID.
4 Implementation Environment
There are five components of the proposed model. These include intelligent fitness blockchain network, IoT gateway, fitness IoT server, fitness blockchain, predictive analytics model, and fitness blockchain front-end development. The proposed platform is implemented and tested on an eighth-generation machine having an Intel Core i-5 CPU, 8 GB of RAM, and Ubuntu Linux 18.04 LTS installed. The docker engine 18.06.1-ce and docker composer 1.13.0 versions are harnessed for blockchain development, and they stipulate the development environment for setting up the docker image and container on the virtual machine. The docker adds the docker engine run-time environment. We employed Hyperledger Fabric, an open-source framework hosted by the Linux Foundation, for client software toolkit (SDK) development utilizing Node 8.11.4. A web interface, composer web-playground that creates smart contracts using a business network archive component (BNA). DBcouch is a database that defines the ledger’s current state and is employed to manage the back-end of the blockchain network. Smart contract management is done through the composer command-line interface (CLI). Finally, the proposed system business logic is known to the front-end GUI through a REST API created by the composer REST server. Likewise, the development environment and the implementation technologies necessitate an IoT fitness device server running on a Raspberry Pi that serves as an IoT gateway. Besides, Android Things has been installed on the Raspberry Pi to support Java programming.
5 Implementation Environment
This section deals with details regarding the usage of IoT fitness data, pre-processing, selection of those features that are highly correlated, and prediction using a variety of well-known prediction algorithms. The Fitness center of Jeju National University in South Korea is considered to take fitness-related data for the experiment. The trainee’s name, along with other personal information, monthly Diet plan, monthly workout plan, and IoT fitness device information like device name, model, device type, model, and so on, are all included in the dataset. Over the last eight years (2013–2020), the purchased IoT fitness dataset contains 100,000 customized fitness records. To maintain fitness trainees’ health profile, a workout and diet plan is suggested based on the following fitness types: average, obese, and athlete.
IoT fitness data collection, its pre-processing and normalization, training and testing of machine learning models, and performance assessment are all stages of the predictive analytic model. The raw data is converted into reliable data in the pre-processing data layer, which is used to uncover knowledge and hidden patterns via harnessing deep learning methods. Data cleaning is the first step in the data pre-processing process, and it involves removing duplicates, blank space, changing text to upper or lower case, and spell-checking. Afterward, data integration is performed which involves combining data from different sources to give the user a unified view of the data and formatting it for pattern mining. The resulting dataset is then subjected to data transformation. Data transformation can be done in various ways, including feature construction, generalization, normalization, and smoothing, among others. We used normalization to normalize parameters between 0 and 1. Normalization takes all of the attributes to the same scale. The Data acquisition process and faulty sampling cause missing values in data. Missing values can lead to erroneous estimates, statistical miscalculations, and even incorrect conclusions. In the proposed system, we use a probabilistic model based on maximum probability to fill in the missing values.
The proposed intelligent fitness service’s scalability and robustness are evaluated using trainee body composition functions. We calculated body composition functions in the proposed system, which include FFM, BFP, BMI, BMR, and WHR, among other parameters. These characteristics are fed into machine learning algorithms that suggest diet and workout plans. The IoT fitness dataset is used in this system, and it contains labels such as diet plan 1 to 3, workout plan 1, workout plan 1 to 3. Tab. 1 shows all of the corresponding diet and work plans.
The fitness data is also used to evaluate various machine learning algorithms, including SVM, DT, K-NN, and LR. The fitness dataset is used to train and test these learning models, with an 80:20 ratio of data distribution for training and testing. The suggested system’s learning models are assessed using ten-fold cross-validation. Various experiments were conducted to evaluate the performance of current machine learning approaches. The outcomes reveal that the SVM model performed better than the LR, K-NN, and DT methods with a 93.1% accuracy, as presented in Tab. 2. Training and testing of classifiers are done using the IoT fitness dataset, and 10-fold cross-validation is employed to assess them.
6 Performance Analysis and Evaluation
Hyperledger Caliper is used to evaluate the proposed intelligent blockchain fitness service. An open-source benchmarking tool named Hyperledger Caliper, a benchmarking tool is utilized to assess blockchain-based platform performance. Evaluation measures such as transaction latency, resource utilization, and Transactions Per Second (TPS) are used to determine the model. Hyperledger Fabric stipulates ordering services with the help of ordering nodes. These nodes manage the ordering of transactions. The proposed case study’s effectiveness and performance were assessed, harnessing three types of ordering services: solo-raft, solo, and raft, each with a different transaction send rate range of 25 TPS–200 TPS. The latency of raft and solo ordering is greater than that of simple solo ordering, as shown in the graph; it is because of enhancement in transport layer security (TLS), which provides more authentication and security between peer nodes.
We conducted several experiments in the proposed system by changing the number of endorser peers in the network. The peer node in charge of endorsing the proposed transaction is known as the endorser peer. Invoking of the endorser peer function is done using chain code. The function is used to endorse each transaction before it is committed. By changing the number of peer nodes in Figs. 7 and 8, we were able to assess the efficiency of the proposed case study for average latency and throughput. It can be seen from the graph that as the number of peer nodes in the network grows, the network’s latency increases. The network’s peer node degrades its performance in terms of traffic volume, resulting in a decrease in network throughput. Fig. 7 shows the effect of changing peer nodes on network latency at transaction send rates of 25–200 TPS. The latency increase is found to be proportional to the number of peers in the network. The increase in the number of peer nodes and the network’s traffic volume also increases, resulting in a decrease in throughput, as shown in Fig. 8.
Considering varying transaction send rates, Fig. 9 exhibits the least, most, and average latency. Fig. 10 depicts solo, raft, and solo-raft throughput according to least, most, and average throughput. This is due to having a single node that does not demand an additional TLS mechanism, the solo order achieves the highest throughput among other ordering services, according to the graph.
7 Comparison Analysis
Tab. 2 presented a performance evaluation of the proposed model that depicts that the SVM classifier outperformed compared to other classifiers. To assess the effectiveness of the designed model, we further compared it with other existing work. We have contemplated [32,34–36] for assessment with the design model in the context of accuracy. Tab. 3 shows the comparative analysis of the framework with previous models.
Recently, IoT analytics has grabbed major attention and provided various opportunities to enhance sensor data performance by discovering hidden patterns. There exists a pool of challenges to effectuate IoT data analytics. The main challenges are: handling heterogeneous IoT data from various sources and analyzing voluminous sensor data with a small number of processors. The IoT fitness case study was used to evaluate the feasibility of the proposed model.
To analyze the proposed blockchain model’s performance, like workout and diet plans for fitness users, we designed an Intelligent Microservice for IoT fitness data by employing a blockchain approach that enables the smart contracting facility store user personalized fitness data and suggest fitness plan accordingly. The developed system uses a permissioned blockchain network to address problems such as data security, scalability, and identity, etc. Besides, a client-facing interactive front-end application is being developed to showcase the fitness services.
Lastly, Hyperledger caliper is used for testing that evaluates the proposed model’s performance for latency, throughput and resource utilization and amending network parameters. The smart contracts integrated inference engine dramatically improves the model’s performance in the context of resource utilization and throughput. This work can be applied to a variety of fields, including healthcare and smart industries. The designed service model may be further enhanced in terms of ensuring its interoperability with other IoT frameworks. Different consensus and data storage algorithms can also be contemplated when evaluating the transaction data and processing rate’s efficiency.
Acknowledgement: This paper has been supported by the RUDN University Strategic Academic Leadership Program.
Funding Statement: The authors received no specific funding for this study.
Conflicts of Interest: The authors declare that they have no conflicts of interest to report regarding the present study.
|This work is licensed under a Creative Commons Attribution 4.0 International License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.|