Table Of ContentHindawi
Mobile Information Systems
Volume 2018, Article ID 6071580, 12 pages
https://doi.org/10.1155/2018/6071580
Research Article
HealthNode: Software Framework for Efficiently Designing and
Developing Cloud-Based Healthcare Applications
Ho-KyeongRa ,1HeeJungYoon ,1SangHyukSon,1JohnA.Stankovic,2andJeongGilKo 3
1InformationandCommunicationEngineering,DaeguGyeongbukInstituteofScienceandTechnology(DGIST),Dalseong-Gun,
Daegu,Republicof Korea
2ComputerScience,Universityof Virginia,Charlottesville,VA,USA
3SoftwareandComputerEngineering,AjouUniversity,Yeongtong-gu,Suwon, Republicof Korea
CorrespondenceshouldbeaddressedtoJeongGilKo;[email protected]
Received 19 January 2018; Accepted 1 March 2018; Published 19 April 2018
AcademicEditor:AndreaGaglione
Copyright©2018Ho-KyeongRaetal.ThisisanopenaccessarticledistributedundertheCreativeCommonsAttributionLicense,
whichpermitsunrestricteduse,distribution,andreproductioninanymedium,providedtheoriginalworkisproperlycited.
Withtheexponentialimprovementofsoftwaretechnologyduringthepastdecade,manyeffortshavebeenmadetodesignremote
andpersonalizedhealthcareapplications.Manyoftheseapplicationsarebuiltonmobiledevicesconnectedtothecloud.Although
appealing, however, prototyping and validating the feasibility of an application-level idea is yet challenging without a solid
understanding of the cloud, mobile, and the interconnectivity infrastructure. In this paper, we provide a solution to this by
proposingaframeworkcalledHealthNode,whichisageneral-purposeframeworkfordevelopinghealthcareapplicationsoncloud
platformsusingNode.js.TofullyexploitthepotentialofNode.jswhendevelopingcloudapplications,wefocusonthefactthatthe
implementationprocessshouldbeeased.HealthNodepresentsanexplicitguidelinewhilesupportingnecessaryfeaturestoachieve
quick and expandable cloud-based healthcare applications. A case study applying HealthNode to various real-world health
applications suggests that HealthNode can express architectural structure effectively within an implementation and that the
proposed platformcansupportsystem understandingandsoftwareevolution.
1.Introduction in the healthcare domain. While health and IoTdomains
are being revolutionized in convergence, designing an effec-
The advancement of Internet of Things (IoT) applications tive cloud application asks the researchers to know various
has allowed various data points collected from a large technicaldomainsfromtheserveroperation,localandweb-
numberofheterogeneousdevicestobegatheredinasingle applicationlanguages,todatacommunicationprotocols.For
repository for application development. Naturally, the dis- example, for efficient web development, developers typically
tributed nature of these systems concentrates on the cloud require knowledge of up to five different programming lan-
infrastructure for achieving novel application designs with guages,suchasJavaScript,HTML,CSS,aserver-sidelanguage
the support of integrated data processing and effective re- such as PHP, and SQL.
source management. For overcoming these challenges, a recently introduced
In particular, healthcare-related IoT applications have software platform called Node.js [1] has gained a significant
developedtothepointwhereitnotonlypreservesthesafety amountoftractioninthedevelopercommunities.Specifically,
andhealthofindividualsbutalsoimproveshowphysicians Node.js is a scalable single-threaded server-side JavaScript
delivercare.Usingsmartandmobiledevices,healthcareIoT environmentimplementedinCandC++[2].Developerscan
allowsthedeliveryofvaluabledatatousersandlessensthe build scalable servers without using threading but rather by
need for direct patient-physician interaction. using a simplified model of event-driven programming that
Despitetheirattractiveness,however,implementingsuch usescallbackstosignalthecompletionofatask[3].Owingto
cloud-based applications is not in any way trivial. This is itssimplicity,industryleaderssuchasMicrosoft[4],IBM[5],
especiallytrueforalargenumberofnontechnicalresearchers Netflix [6], PayPal [7], and Walmart [8] have integrated the
2 MobileInformationSystems
support of Node.js into their cloud platforms. Notwith- To guide the development of cloud-based healthcare
standing the recent developments, Node.js’s approach in applicationsusingNode.js,weprovideAPIsandaguideline
developing web applications has made it an attractive alter- thatconstructstheskeletonofessentialcomponentswithin
native to more traditional platforms such as Apache+PHP theimplementation.Wefocusprimarilyonthebackendof
and Nginx servers. the server, which contains the core operational functions.
One of the many benefits of using Node.js is its archi- OurenvisionisthatHealthNodewouldoverallinfluencein
tecturethatmakesiteasytouseasanexpressive,functional developing cloud-based healthcare applications.
languageforserver-sideprogramming[9].Althoughitmay The contributions of this work can be summarized in
be trivial to perform development in Node.js once a de- three-fold:
veloper fully comprehends the language, there are many
(i) A software design that tackles the challenges of
obstaclespriortobeingabletoimplementrealcloud-based
maintaining and updating cloud applications de-
applications for beginners. For example, Node.js requires
veloped using Node.js. This design layout will
multipleinitializationsteps,suchastheconfigurationofthe
support theresulting application tocomprise well-
HTTPpackageandroute.js,whichguideswheretherequest
defined, independent components which lead to
isrouted.Duetotheframeworkbeingrelativelyyoungand
bettermaintainability.Inaddition,newcapabilities
the software yet reaching maturity, developers still face the
can be added to the application without major
lack of documentation support and can face troubles in
changes to the underlying architecture.
receiving support from the development community.
(ii) APIs and implementation guideline that provides
To the best of our knowledge, there has not yet been
explicit, but straightforward instructions for de-
a Node.js software design or implementations guideline
veloping general-purpose Node.js prototype. This
documentation, where developers are influenced to create
well-structured healthcare applications. Nevertheless, for guideline instructs how to (1) create prototypes by
software developers, the fact that organizing the program usingalimitedsetofAPIs,(2)dividemodulesand
design with solid boundaries is crucial in a successful real- organizefunction,(3)allowaclientcommunicateto
worlddeployment.Designinganadhocmodelwillstimulate aserver,(4)utilizecloudapplicationdatabase,and
logicalcomplexityandcausedifficultiesinmaintainingand (5) handle uploading and downloading files.
updating the application over time. Moreover, without Through this guideline, developers can focus on
a sturdy guideline documentation, it takes a significant implementing application logic.
amount of time and needless effort even to configure the (iii) Examples of healthcare application that open the
primary application development environment. possibilities for anew structure of healthcare tobe
In this paper, we present a practical solution for imple- developed. Our software design and guideline can
menting cloud-based healthcare applications by providing bethebasisfordevelopingavarietyofcloud-based
a framework called HealthNode, which consists of (1) healthcare applications. We provide examples of
asoftwaredesignand(2)essentialAPIsandimplementation systems that can be enabled by our work.
guidelines for prototyping. We specifically emphasize on
InSection2,wediscusssomeofthetechnicalchallenges
healthcareapplicationsratherthanothertypesofapplications
of implementing cloud applications using Node.js. We in-
because Node.js is capable of supporting the complex re-
troduce the overall structure of Node.js architecture, li-
quirements that healthcare applications ask, which are the
braries, modules, and functions that make up Node.js
needs to support multiple patient-doctor connections, ex-
applications, as well as HealthNode’s software design in
changemedicaldatawithaunifiedlanguageanddataformat,
Section 3. In Section 4, we present our guideline that in-
and allow reusability of the developed medical components.
structs the implementation procedures for developing
Nevertheless, we put as one of our future work to expand
cloud-based healthcare applications and introduce couple
HealthNode to be applicable for other applications.
potential applications where our work can be applied in
To simplify the use of Node.js, our software de-
Section 5. Finally, we position our work among others in
sign helps developers to easily observe data flow, create
Section 6 and conclude the paper in Section 7.
modules, and add in functions even without detailed
descriptions, which Node.js lacks. We use a top-down
approach that structures our software design with a hier- 2.Challenges
archy of modules and a divide-and-concur approach that
organizes the tasks for each module. The top-down ap- Technically, for developing a cloud-based healthcare ap-
proach helps developers to observe application flow from plication using Node.js, there are many materials both
the main module, which acts as the main class in Java, to online and offline for users to easily get a start on building
other submodules in a top-down manner. It is essentially asoftwareenvironment.However,basedonourexperiences,
thebreakingdownoftheapplicationdevelopmenttogain the level of these tutorials mostly remains in the beginner
insight into its compositional sub-modules. The divide-and- level, and due to its relatively new life cycle, it is fairly
concurapproachbreaksdowneachmoduleintosubmodules difficult to identify the information required to perform
that specify target tasks for each module. This tactic also more advanced tasks. Furthermore, practical troubles that
enablesmultipledeveloperstoworkondifferentportionsof typically arise within this development phase include the
the application simultaneously. lack of (1) a formal software structure, (2) fundamental
MobileInformationSystems 3
guidelines for advanced functionality implementation, and HealthNodedesignthatusesatop-downapproachandthe
(3)real-applicationexamples.Weusetheremainderofthis divide-and-conquer strategy, whichare boththe essence of
section to discuss the importance of such support and the any software development.
challenges that application developers can face due to such
limitations.
3.1.Background
2.1.Usability. There is an active community that supports 3.1.1. Architectural Description of Node.js. Well known for
Node.js.MoredeveloperswatchtherepositoryofNode.jsat its event-based execution model, the Node.js platform ar-
GitHubthanotherrecentlytrendingsoftwareenvironments. chitectureusesasinglethreadforexecutingapplicationcode
Nevertheless, Node.js is relatively new compared to tradi- which simplifies application development. However, heavy
tional web-application frameworks such as ASP.NET. calculations and blocking I/O calls that are executed in the
Therefore,naturally,incontrasttotheseolder frameworks, event thread prevent the applications from handling other
Node.js lacks documentation and examples on how to requests. Node.js tackles this issue by using event loop and
structuretheoverallimplementation.Duetoasmallnumber asynchronousI/Otoremainlightweightinthefaceofdata-
ofeasy-to-followguidelines,Node.jsisnotcommonlyused intensive,real-timeapplications[10].TheNode.jsexecution
to its full capability where developers can create data ex- model is different to the thread-based execution model
changeapplicationsforconnectedinfrastructuresuchasIoT where each client connection is processed by a separate
applications. An ideal application should allow clients to thread.Overall,theplatformmustcoordinatedatainputand
submitdatatoaserverandtheservertorespondbacktothe output adaptably and reliably over a different range of
clients to fully utilize the cloud computation power. distributed systems.
2.2. Feasibility. For beginners to use Node.js for imple- 3.1.2.LibrariesandModulesofNode.js. Node.jscomeswith
menting afullyfunctioning prototype,it takes asignificant an API covering low-level networking, basic HTTP server
amount of time and effort to feasibly set up the basic ap- functionality,filesystemoperations,compression,andmany
plication environment, properly route incoming and out- other common tasks. Moreover, the available external li-
going information, and format the overall application brariesofNode.jscanaddmorecapabilityinamoduleform.
structure. Ideally, to catalyze the development of various The modules are delivered by public or private package
cloud applications, this process should be simple to both registries. The packages are structured according to the
understand and implement. CommonJS package format and can be installed with the
Node Package Manager (NPM) [11].
OursoftwaredesignworksofftheExpresslibrary,which
2.3.MaintainabilityandExtensibility. Indesigningtheback is one of the Node.js packages that support the rapid de-
end of a cloud application using Node.js, existing tutorials velopmentofNode.jscloudapplication[12].Ithelpssetup
often promote examples using only a single module con- middlewares to respond to HTTP requests, specifies
taining all the possible functions, regardless of system de- aroutingtablewhichisusedtoachievevariousactionbased
sign.Usingasinglemodulelimitsthetaskstobedistributed ontheHTTPmethodandURLandallowstopresentHTML
to other modules and therefore diminishes advantages of pagesbasedonpassingargumentstotemplatesdynamically.
designing an organized implementation. Although Node.js Other than public libraries, local modules also can be ref-
supports building a hierarchy of multiple modules, ad hoc erencedeitherbyfilepathorbyname.Unlessthemoduleis
plansofsoftwarestructuringatthehierarchylevelcancause themainmodule,amodulethatisreferencedbyanamewill
increased logical complexity without solid boundaries be- map into a file path.
tween heterogeneous modules. Moreover, to maintain and
update applications efficiently, proper documentation is
essential.However,documentingwithinasinglemoduleor 3.1.3. Functions of Node.js. In programming, a function is
multiple ad hocly planned modules can add additional defined as theportion of code thatperforms a specific task
burdentothecodereviewprocess.Tosupporttheseissues, withseriesofstatements.Ithasacapabilityofacceptingdata
a software design with an organized structure of modules throughparametersforacertaintaskandreturningaresult.
willnotonlyhelpdevelopersindesigningtheirsoftwarebut In Node.js, a function requires extra implementation for
also benefit them in maintaining their applications. Fur- routingrequests.Tosupporttheeaseofrouting,theExpress
thermore, such a repository of modules can ultimately package enables the capability to create middleware func-
benefit the application to be more conveniently extensible tions.Middlewarefunctionsallowsettinguparoutingpath
over time. in one line. In addition, middleware functions are only
accessible by clients and are not accessible by back-end
3.Architecture computation functions. For example, when a client sub-
mitsandrequestsdatatotheserver,oneofthemiddleware
This section first describes the overall structure of the functions is triggered, and output is returned to the client.
Node.jsarchitecture,libraries,modules,andfunctionsthat For accessing data, middleware functions only access data
make up a typical Node.js application. We then present through shared objects or a library such as MongoDB.
4 MobileInformationSystems
Client
Server String query JSON format
ch (role) Libraries mModaiunle ... Database Output
a
pro External
p Sub Sub Sub devices
a
wn module module module ... SerialPort.write()
o
d
p- ...
o
T Child Child Child Child Child
submodule submodule submodule submodule submodule ...
Divide-and-conquer approach (task)
Figure1:HealthNode softwaredesign.
3.2. HealthNode. We now detail two software design pro- main module, a shared component such as a database is
cesses that make up HealthNode. The top-down approach initialized, and necessary submodules are coupled.
helpsdeveloperstocoupleanddecouplemoduleswhilethe Thetop-downapproachiseffectivewhentheapplication
divide-and-conquer approach guides developers to divide idea is clear, and the system design is ready prior to
the task into simpler modules while enabling multiple implementation. Looking at Figure 1, a top-down design
module developments concurrently. We use the top-down concentratesondesigningverticalhierarchylevelsanduses
approachfirstandthenthedivide-and-conquerapproachin couplestoconnectdataflow.Thecouplingprocesshappens
thelatterstepsothattherolesbetweenthemodulesarefirst during the period when modules are added. This process
defined before tasks are assigned to each of the roles. Al- finisheswhenthesubmoduleisreadytobeusedaftertesting
thoughbothofthesetechniquesarecommonlyusedinother andconnectingtoahighermodule.Inaddition,thecoupling
typesofwebandapplicationdevelopments,tothebestofour process can be used for sharing child submodules. In cases
knowledge, there has not been a foundational software when already implemented child submodule is required by
design that supports Node.js implementation structure. other submodules, each of the submodules can couple to
preimplemented child submodule to avoid redundancy.
During implementation, coupling is used to create a weak
3.2.1. Top-Down Approach. The top-down and bottom-up connectionbetweenmodules.Inotherwords,asubmodule
approaches play a key role in software development. The is allowed to use a child submodule only once during
top-downapproachisastandardinheritancepatternwhich implementation.Thedecouplingprocesscanbeeasilydone
decomposesasystemtogaininsightintosubsystems.Each due to the weak connection between all the modules.
subsystem is then refined in yet greater detail in many The decoupling process supports maintaining and
additional subsystem levels until the entire specification is extending the application over time. When a particular
reduced to base elements. This process continues until the submodule expands, in such case as having two different
lowest level of the system in the top-down hierarchy is tasks, the submodule needs to be decomposed. To de-
achieved.Inabottom-upapproach,thebaseelementsofthe compose a module, the decoupling process closes the
system are first specified. These elements are then linked connection between the higher submodules to the current
togethertoformlargersubsystemsuntilacompletetop-level module. This will lead the decoupling process to stop
system is constructed. Using the bottom-up approach may allowing higher modules to use the current submodule.
be beneficial for implementing first-level systems for early Overall, the coupling and the decoupling process is com-
testing. However, the bottom-up approach is not suited pletedbyinitializingandremovingtheconnectionbetween
particularlyforoursoftwaredesignduetoitsrequirementof modules and submodules.
permitting space to grow. Since our study focuses on pro-
totyping, which requires a continuous update, it must be
easy to add and couple modules. However, the bottom-up 3.2.2.DivideandConquer. Divideandconquerisaconcept
strategydoesnotallowthis,andovertime,organizationand of recursively breaking down a system into two or more
maintenance issues may exist. subsystemsuntilthesebecomesimpleenoughtobelabeled
In the software design of HealthNode, a hierarchy directly.Theoutputstothesubsystemsarethencombinedto
structure creates a connection between modules that sup- provide an output to the highest system.
ports data flow. Figure 1 visualizes how HealthNode maps The divide-and-conquer approach is different than the
thetop-downperspectivebystartingfromthemainmodule top-down approachin asensethatthetop-down approach
andinitializingsubmodules.Eachsubmodulecanalsohave defines hierarchy levels while the divide-and-conquer
multiple child submodules with external packages. In the method focuses on horizontally dividing a task in each
MobileInformationSystems 5
take place in the modules, and the communication process
Client
between the client and the server in detail using the fol-
User (Web browser / Server
mobile application) lowing subsections. We will use code snippets to present
usage implementations for the concepts in HealthNode.
URL
URL
Static HTML 4.1. Hierarchy. In the main module, all of the necessary
Static page
librariesrequiredforapplicationdevelopmentareimported
Request
during the initialization stage. As the sample implementa-
Back-end tiononlines1to10inListing1shows,theExpressLibrary,
processing alongwithsupportinglibraries,isfirstimportedtoconstruct
a hierarchical structure of the application along with en-
Response
abling mostof theHTTP utilities.The MongoDB library is
thenimportedtobeusedforcreatingaconnectionbetween
Client
User (Web browser / Server the back-end server and the database.
mobile application) The main module and the submodules are connected
throughacouplingprocessasexemplifiedonlines20and21
Figure2:LocationofHealthNodeinageneralcloudapplication. in Listing 1. Commonly required libraries are shared using
parameters during coupling process. The coupling process
allows a client to access the submodule method. Following
level to specify a task. The higher the module level is, the
the top-down approach, although conventional Node.js
applicationdesignusestaskcharacteristicstodividemodules.
application allows methods in the main module, Health-
Thelowerthemodulelevelis,thedesignconcentratesonthe
Node recommends methods to be exclusively in the sub-
functionalityofhighermodules’basicrequirements.Moreover,
modulestoavoiddesigncomplexity.Havingfunctionsinthe
in HealthNode’s software design, the divide-and-conquer
main module can cause documentation and maintenance
process also reduces redundancy by dividing a module into
issuesduetoitslimitedroleofinitializingthecoretasks.In
groups of reusable and unique task-oriented functions. Since
contrast,submodulescancoupletoandcallfunctionsinthe
oneofthefunctionsormiddlewarefunctionswithinthehigher
child submodule as shown on lines 25 to 30 in Listing 1.
module uses submodules, the divide-and-conquer technique
Whencallingfunctionsinthechildsubmodule,parameters
can be easily applied using one or two lines of code.
with information can be passed to acquire necessary in-
formation. All modules are coupled with only one or two
4.Implementation
linesofcode,whichallowsforasimpledecouplingprocess
forextendingtheapplicationwhenneeded.Thisprocedure
Inthissection,wepresenttheimplementationcomponents
is the first principle in the divide-and-conquer process.
of HealthNode and a step-by-step guideline that instructs
the implementation procedures for developing Node.js
cloudapplicationsusingtheproposedframework.Figure2
4.2. Module. As Figure 3 shows, each of the submodules
shows a general application execution flow from users to
contains initialization blocks and functions that include
clients and then from clients to a server. We focus on the
librariestobeusedwithinthecurrentsubmodule.Notethat
core components located at the back end of the server and
eachfunctionconsistsofmultiplemiddlewarefunctions.For
the communication components that are used between the
thefunctiontobepartofamodule,itrequireseachfunction
clients and the server. Note that we do not look into the
tobeexportedasillustratedthroughListing2(lines1to5).A
detailsoftheserver’sfrontend,sincetherearemanyexisting
middleware function is required when a client needs to
examples of front-end frameworks available [13–15].
communicatetoaserver.Themodulecontainingafunction
InHealthNode,theproposedimplementationguideline
withoutmiddlewarefunctionsusuallysitsasthelowestchild
follows five essential steps:
submodule unless it requires assistance from lower level
(1) A hierarchy structure is set up between modules. child submodules. In other words, if the function is only
used for the back-end computation and called by a higher
(2) A function is placed on each of the modules to be
submodule,thefunctionisaccessiblebycallingthefunction
used for computation.
namesuchas“ChildSubModuleFunction”asListing2shows
(3) A middleware function is added into the function,
on lines 17 to 22. The function can further process com-
which directly communicates to a client.
putation tasks with the data received through a function
(4) Duringtheinitializationprocessofthemainmodule, parameter. Each submodule requires at least one function
database information is configured to be used that may only have a computation task or have both
throughout the implementation process. computation task and middleware functions.
(5) The client prepares the communication procedures
for testing.
4.3. Middleware Functions. As Listing 3 shows, a middle-
Specifically, we describe the implementation details of warefunctioncanbeaddedtoafunction.Eachmiddleware
structuring the hierarchy of the back end, operations that function contains REQUEST and RESPONSE parameters.
6 MobileInformationSystems
(1) //Necessarylibrariesand variables
(2) varexpress=require( express );
...
(9) varmongoClient=require( mongodb ).MongoClient;
(10) varmongoDBuri= mongodb://localhost:27017/database
...
(20) //Couplingsubmodules
(21) require( ./SubModuleONe.js )(app, mongoClient,mongoDBuri);
...
(25) //Couplingto childsub-moduleanditsfunction
(26) varChildSubModule=require( ./ChildSubModuleOne ).FunctionName;
...
(29) //Insideoffuctionor methodcallchildsub-modulefunction
(30) ChildSubModule(data);
LISTING 1: Initializinglibraries,submodules,andchild.
REQUESTandRESPONSEisabasicoperationandkeyfeature
Module
forenablingthecommunicationbetweentheclientsandthe
server.Whenclientsneedinformation,amobileapplication
orawebbrowsersendsaREQUESTmessagetotheserver.A Initialization
requestmessageissentintheformofaquerystring.During (libraries, child submodules)
theREQUESTmessageprocessing,thebodyoftheREQUESTis
primarilyused.Themessageisthenunpackedbyusingthe
Functions
“stringfy”APIfunctionfromthe“querystring”library.After
(accessed by modules)
unpackingthequery,themessageistranslatedintovaluesof
anobject.Valuesofanobjectareusedforexecutingtasksor
Middleware functions
computation. To execute tasks, middleware functions can (accessed by clients)
alsocallfunctionsofferedthroughothermodulestoprocess
back-end computation tasks. In addition to the back-end
computation, external executables, such as compiled ma-
Figure3: Generalstructureofa module.
chine learning algorithms, can also be executed using the
“child_process”libraryasshownonlines1to8inListing4.
Additionally,lines10to20inListing4showanexampleof uses dynamic schemas, which means that records can be
using the “SerialPort” library from the NPM, so that the created without first defining the structure [16]. In Mon-
developmentboardsenabledwithserialcommunicationcan goDB, three basic (yet important) operations are INSERT,
be controlled by the WRITE command and output data. FIND,andDELETE.Toaccessthedatabase,the“MongoDB”
Furthermore,REQUESTcanbeusedtoreceivefile-leveldata. libraryisinitializedinthemainmoduleandsharedwiththe
Byusing“fs”library,anincomingfilecanbeprocessedand submodules.Priortoanydatabaseoperation,aconnectionis
savedtoaparticularlocation(cf.lines26to35inListing4). established by using the CONNECTfunction along with the
EachREQUESTfromtheclientsisansweredattheserver URL and port number of the database server. With the
using a RESPONSE. Specifically, RESPONSE has the role of established connection, query string information can be
returning messages and is in the form of JavaScript Object inserted, deleted, or used for finding data as we show an
Notation (JSON) message. In JSON messages, heteroge- example in Listing 6. For updating documents in the da-
neous information can be stored as an object. Within the tabase, the documents are replaced by using DELETE and
object, there is a collection of <field name,data> pairs and INSERTcommands.
there can be a single object or an array of objects. These
objects can be placed on the JSON message for exchange.
OncetheJSONmessagepreparesnecessaryinformationfor 4.5.Client. Communicatingwiththeserverfromaclientis
theclient,informationissentbacktotheclientbyusingthe also an essential operation. For mobile applications, typi-
WRITEfunctionaswepresentinListing5.Theuploadedfile cally,thecommunicationbetweentheclientandtheserveris
can be accessed from the client by using the “fs” library accomplishedbyusingawebbrowserorHTTPlibrary.For
shown on lines 41 to 49 in Listing 4. aweb browser,the clientretrieves orsends informationby
usingPOSToperationwithstringquery.Specifically,theweb
browser uses JavaScript to embed information in string
4.4. Database. To provide or store information, having query and requests POSTto the server. After sending RE-
adatabaseisalsoessential.Wespecificallychosetosupport QUEST,aRESPONSEfromtheserverisreturnedtotheclient
MongoDBinHealthNode.IncontrasttoMySQL,MongoDB inJSONmessageformat.AspresentedinListing7,theJSON
MobileInformationSystems 7
(1) module.exports=function(app,mongoClient,mongoDBuri){
(2) app.post( /method , function(req,res){
(3) //Methodcontents
(4) });
(5) };
...
(17) functionChildSubModuleFunction(data){
(18) //Usedata
(19) info= Information ;
(20) returninfo
(21) }
(22) exports.ChildSubModuleFunction = ChildSubModuleFunction;
LISTING 2: Structureofa middlewarefunction andchildsubmodulefunction.
(1) varquerystring= require( querystring );
(2) app.post( /method , function(req,res){
(3)
(4) varpostObjectToString= querystring.stringify(req.body);
(5) varpostObject= querystring.parse(postObjectToString);
(6) //Dataon Info is accessedfrompostobject(querystring)
(7) varInfo= postObject[ Info ];
(8) ...
LISTING 3: Exampleofmiddleware function.
message is parsed into readable objects and accessed by HealthNodecanenhancethesecurityduringdataexchange.
aclientwebbrowser.Inamobileapplication,specificallyfor Moreover, the privacy of patient health information is
androids, the Apache HTTP library is used to simulate the passwordprotected.Whenadeveloperimplementsthedata
web browser. The POST operation in mobile applications exchange process, login function needs to be used prior to
works similarly as that of the web browser. requesting data from the server. For example, an Android
applicationorawebbrowserclientcanrequestdatafromthe
server after obtaining login approval.
4.6.HealthNodeAPI. FordesigningtheAPIset,wegathered
general requirements from a number of previous works on
5.Case Study-Based Evaluation
health and home monitoring projects [17, 18] and imple-
mentednecessarymethodsfortheHealthNodeAPI.TheAPI
Therearevarioustypesofcloud-basedhealthcareapplications
usesandextendstheExpresslibrarywhichallowsdevelopers
thatcantakeadvantageofHealthNode’ssoftwaredesignand
to add necessary methods by following the conventional
implementation guidelines. Such examples include applica-
Express implementation rules [12]. We include a library for
tions that simply log information to the cloud through the
Android mobile and web browser applications to commu-
web, exchange medical or healthcare information between
nicate with the HealthNode server applications. Both mobile
mobile devices, or execute physical component actuation
andwebapplicationsAPIenablessendingJSONmessagesand
throughalocalnetwork.Ingeneral,HealthNodesupportsthe
files by accessing middleware functions on the server. The
fundamental requirements for developing of cloud applica-
HealthNode APIs can be installed using the NPM install
tions. These requirements include sending/receiving data,
commands. Starting the server and importing basic libraries
constructingadatabasetostoreinformation,callingexternal
suchas“MongoDB”and“fs”arealreadymanagedbysimply
executables for machine learning algorithms, and ensuring
importing the API. Other than the previously mentioned li-
space for the application to be expanded.
braries, APIs also use the existing “SerialPort” library to
In this section, we evaluate HealthNode by providing
communicate with external development boards such as an
possible application scenarios of how our software design
externally connected Arduino or Raspberry Pi.
and implementation guideline can be used for different
mobile-cloud application development. Note that the case
4.7.Security. Thesecurityofdataexchangebetweenaserver studies benefit from HealthNode due to the framework
andaclientcanbeprotectedusingTransportLayerSecurity (1)followingintuitivedesignstrategieswhichhelp external
(TLS),whichisawell-knownprotocolthatprovidesprivacy fieldmemberstounderstandthesystemdesignandenhance
and data integrity. By following the Express API on TLS, themedicalfeaturesofthesystem,(2)containingapractical
8 MobileInformationSystems
(1) //Executeexternalprogramorclassifier
(2) varquerystring=require( child_process ).executable;
...
(4) app.post( /method ,function(req,res){
(5) executable( ./execProgram + testFile ,function(err, stdout,stderr){
(6) //outputis on stdout
(7) }
(8) });
...
(10) //Forserialport
(11) varSerialPort=require( serialport );
(12) varReadline=SerialPort.parsers.Readline;
(13) varport=newSerialPort( /dev/ttyUSB0 ,{baudrate: 9600});
(14) varparser=port.pipe(Readline({delimiter: \r\n }));
(15) //Gettingdatafromexternalboard
(16) parser.on( data ,function(data){
(17) console.log(data);
(18) });
(19) //Sendingdatatoexternalboard
(20) port.write( somedata );
...
(26) //Fileupload/download
(27) varfs=require( fs );
...
(30) //Fileupload:
(31) app.post( /uploads ,function(req,res){
(32) fs.readFile(req.files.fileU.path, function(err,data){
(33) vardirname= /file/dir/location ;
(34) varnewPath=dirname+ /uploads/ +req.files.fileU.originalname;
(35) fs.writeFile(newPath, data,function(err){
...
(41) //Accessfileonserver:
(42) app.get( /uploads/:file ,function(req, res){
(43) file=req.params.file;
(44) console.log( Filerequested: +file);
(45) vardirname= /file/dir/location ;
(46) varimg=fs.readFileSync(dirname+ /uploads/ +file);
(47) res.writeHead(200,{ Content-Type : image/jpg });
(48) res.end(img, binary );
(49) });
LISTING4:Callingchildsubmodulefunction,controllingexternaldevelopmentboardusingserialcommunication,andmanagingfileexchange.
set of medical application-related methods which allows information ofairquality,pollencount, and asthmaindex.
the developer to utilize or alter the given functions to Furthermore,wecollectphysiologicaldatafromthepatients
complete cloud-based health application implementation, by collecting their lung sounds using an electronic stetho-
and (3) allowing these applications to communicate with scope, and present questionnaires that patients fill out
external sensing systems. manuallyonanAndroidapplication.Thedatacollectedover
time is then displayed through a cloud web application for
5.1. Case Study: AsthmaGuide. To evaluate HealthNode’s both patients and healthcare providers to view.
design and framework, we use one of our previous works, By utilizing HealthNode, AsthmaGuide first gathers re-
AsthmaGuide [17], as a case study. AsthmaGuide is quirements, and consequently, each of the requirements is
amonitoringsystemfor asthmapatients inwhichasmart- placedintoadesignatedrolelevelwiththetop-downapproach
phone is used as a hub for collecting indoor and outdoor and assigned a job with the divide-and-conquer approach as
environmental information and physiological data. Specif- shownin Figure 4.The requirementsaredirectlylinked with
icallyforindoorenvironments,weuseSensordrone[19]to middlewarefunctionsinwhicheachrequirementisresponsible
measure information of the patient’s surroundings such as for exchanging data between the client and the server.
the temperature, humidity, and air quality. For outdoor Figure 4 also shows the list of 26 middleware functions
environmental data, we use a national database to gather thatarerequiredtoimplementAsthmaGuide.Thesemiddleware
MobileInformationSystems 9
(1) module.exports=function(app,mongoClient,mongoDBuri){
(2) app.post( /method ,function(req,res){
(3) res.write( Responseback );
(4) res.end();
(5) });
(6) };
LISTING 5: Exampleof respondingtoREQUEST.
(1) module.exports=function(app,mongoClient,mongoDBuri){
(2) app.post( /method ,function(req,res){
(3) mongoClient.connect(mongoDBuri, function(err,database){
...
(11) collection=database.collection( testingCollection );
(12) //Insteadof insertotherfunctions(delete,find)worksalso
(13) collection.insert(postObject, function(err,records){});
LISTING 6: Example ofMongoDBINSERToperation.
(1) <script>
(2) vardata_server= http://localhost/methodName ;
(3) varrequestInfo={requestInfo: data };
(4) varreceivedData={receivedInfo: };
(5) $(document).ready(function(){
(6) $.post(data_server,requestInfo).done(function(data){
(7) objArr=JSON.parse(data);
(8) if(objArr!= ){
(9) $.each(objArr,function(key1,obj){
(10) receivedData.receivedInfo=obj[ receivedInfo ];
(11) });
LISTING 7: Exampleofrequestingtothe server fromaweb browser.
functionsprovidenecessaryresultsbacktoawebbrowseror developercallstheneededmiddlewarefunctionstorequest
amobiledevicewhileacceptingincomingdatafromclients. and insert data to the server. Besides these simple data
Each of the middleware functions is mapped to the uploadoperations,AsthmaGuiderequiresfarmoremethods
HealthNode design pattern accordingly to the categorized when the system starts interchanging information between
alphabeticletter.Allmiddlewarefunctionsareprebuiltinto apatientandahealthcareprovider.Therefore,HealthNode
HealthNodeandareaccessiblebyimportingtheHealthNode can help reduce the burden of developers by easing the
library.ThelibraryimplementationfollowstheHealthNode developmentcomplexityintheprocessofimplementingand
design pattern, and a developer can reference the imple- maintaining cloud applications.
mentation as well as add the middleware functions to en-
hance their application.
For example, when a patient needs to upload his or 5.2.CaseStudy:SmartHomeAutomationFramework. Another
hercollectedindoor andoutdoorenvironmental dataas case study that we apply HealthNode on is a system called
well as physiological data to the server, middleware func- theSmartHomeAutomationFramework(SHAF)[18].IoT
tions such as “Patientlogin,” “PatientRetrieveZipCode,” coversavariousnetworkofphysicalobjectswithactuation
“PatientRetrieveCountryCode,” “PatientInsertData,” and sensing embedded units. Under the hood, the com-
“FileUploadImageFile,” “FileUploadWaveFile,” “Classi- munication between devices is connected through multiple
fyLungSound,”and“GeneratePatientAdvice”areused.Note networkprotocols.Oneofthedomainsthattakeadvantage
that“ClassifyLungSound”and“GeneratePatientAdvice”are ofIoTishomeautomation.Homeautomationusesdifferent
AsthmaGuideapplication-specificfunctions.Duringmobile types of network protocols such as Wi-Fi, Bluetooth, and
or web-application implementation, the AsthmaGuide ZigBee. However, existing home equipment often requires
10 MobileInformationSystems
A. StartServer
B. DoctorRegister
C. DoctorRegisterCheck Client
D. DoctorLogin
E. DoctorCommentPatient
F. DoctorRetriveComments
G. DoctorRetriveCommentsOfAPatient Server
H. PatientRegister
Main
I. PatientRegisterCheck Libraries Database
(A)
J. PatientLogin
K. PatientRetriveDataByDate
L. PatientRetriveAllData
M. PatientRetrieveMostRecentData el
v
NO.. PPaattiieennttRReettrriieevveeZAidpvCicoede ole le D(Bo~cGto)r P(Hat~ieRn)t File( Tm~aWna)ger
P. PatientRetrieveCountryCode R
Q. PatientInsertData
R. PatientRetriveCommentsFromDoctor
S. EnviromentRetriveInfo
T. FileUploadImageFile Advice generator Classifier Alert sender
U. FileUploadWaveFile (Y) (X) (Z)
V. FileUploadMp4File
W. FileUploadRetrieveFile
Divide task
X. ClassifyLungSound
Y. GeneratePatientAdvice
Z. SendAlert
Figure4: DesigningAsthmaGuideaccording toHealthNodedesign pattern.
network communication-enabled power plugs or devices
that hold a unique communication protocol specified by
Smart home
a manufacturer. While these types of equipment typically
follow astandardcommunication capability, each device is
Smart home central server
Smartphone
limited to communicate only within the same network
protocol. The goal of SHAF is to resolve issues that can be HealthNode
raised due to such limitations.
Specifically, SHAF targets to provide and maintain
a comfortable and healthy living environment for patients. Actuation and
sensing units
For example, the surrounding temperature is a critical
metric for those who are sensitive to cold or hot tempera-
tures such as people with chronic health conditions, given
that extreme (than normal) temperatures can aggravate
varioussymptoms.Figure5illustratesanexampleofSHAF
monitoring and actuating the smart home by using the Figure5: Communicationmap ofSHAF.
HealthNodeframework.WeuseRaspberryPiwithZigBeeas
asmartcentralserverandanArduinowithZigBeeassensor
nodes. For SHAF ZigBee communication, multihop com- module. During maintenance, the developer couples and
munication is enabled for larger homes. The server accepts decouples the submodule by changing one or two lines of
incoming JSON queries where a client can request sensor code. Specifically, using HealthNode’s software design, we
readings or operate an actuation unit. While our current structurethearchitectureofSHAFsothatitcontainsthree
clientapplicationisimplementedonAndroidandWindows submodules (e.g., patient, caregiver, and sensor manager).
smartphones,anyprogramminglanguagesthatcansupport Followedbythearchitecture,multiplemiddlewarefunctions
JSON message requests can communicate with the smart areimplemented.Forexample,thepatientandthecaregiver
home’s central server. submodules are accessed from the mobile or web browsers
SHAF’s server should have the capability of handling by using JSON message requests. When there is a request,
requirements or multiple middleware functions such as one of the middleware function returns the result to the
“AddSensor,”“RemoveSensor,”“RefersehSensorReadings,” client followed by the database operation. The server also
“ActuateSensor,”“LearnHomeUsage,”“AutonomusMode,” logs up-to-date sensing and actuation values by using the
and“HealthyLivingEnvironmentMode.”Althoughthequantity “SerialPort” library and middleware function in the sensor
of the middleware functions is not large, the use of managersubmodule.Furthermore,storeddatacanbeused
HealthNodeallowsforeasiersoftwaremaintenancesinceit byachildsubmodulewithamachine-learningalgorithmfor
instructs task-specific submodules rather than one large automatic environment configuration based on a user’s
Description:To fully exploit the potential of Node.js when developing cloud applications, we focus on the fact that the implementation . Node Package Manager (NPM) [11]. (NRF-2013K1A1A2A02078326), the DGIST Research and . 2013. [36] C. J. Ihrig, Pro Node.js for Developers, Apress, New York, NY,.