NATIONAL UNIVERSITY OF HO CHI MINH CITY
UNIVERSITY OF TECHNOLOGY
FACULTY OF COMPUTER SCIENCE AND ENGINEERING
GRADUATION THESIS
Programming IoT Wearables to Enact a RuleBased Alert Business Process in Smart
Healthcare
Major: Computer Engineering
COMPUTER ENGINEERING COUNCIL
INSTRUCTOR: Dr. Le Lam Son
Student: Duong Tan Huy (1652228)
Lam Bao Duy (1652096)
Ho Chi Minh, 06/2021
ABSTRACT
The Internet of Things is the use of network sensors in physical devices to allow for remote
monitoring and control. This technology has gained massive traction in various spheres like
healthcare, banking, retail, manufacturing, consumer goods etc. It is expected that patient will be
treat more effectively with smart healthcare solutions where real time data are exchanged to help
medical staffs make optimal decisions. In this paper we demonstrate how wearables can be built
semi ± automatically to enact a medical rule-based alert process that assists hospital doctors in
taking care of outbreak patients in dengue epidemic.
ACKNOWLEDGEMENT
We would like sincerely thank to our thesis supervisor Dr. Le Lam Son of the Department
of Faculty of Computer Science and Engineering at Bach Khoa University and my thesis advisor
Dr. Ton Phuoc Long of the Faculty of IT at Industrial University, who enthusiastically assisting us
to build this system. Their support has helped us immensely to move in the right direction and
finish my work.
Last but not least, we are extremely grateful to our family for providing us with unfailing
support and continuous encouragement throughout our years of study. They all kept us going and
this accomplishment would have never been possible without them.
Table of Contents
CHAPTER 1: INTRODUCTION ................................................................................................ 1
1.1
Motivation ......................................................................................................................... 1
1.2
The rise of IOT in healthcare ............................................................................................ 1
CHAPTER 2: BACKGROUND .................................................................................................. 2
2.1 Internet of Things - IoT ......................................................................................................... 2
2.1.1 What is IoT? .................................................................................................................... 2
2.1.2. Fundamental stages of IOT ............................................................................................ 2
2.1.3 IoT Wearables in Healthcare ........................................................................................... 3
2.1.4 Advantages of IoT in Healthcare .................................................................................... 4
2.2 Hypertext Transfer Protocol .................................................................................................. 4
2.3 MVC Architecture ................................................................................................................. 5
2.4 RESTful Web Services .......................................................................................................... 7
2.4.1 What is REST? ................................................................................................................ 7
2.4.2 Making requests .............................................................................................................. 7
2.4.3 HTTP Methods ................................................................................................................ 8
2.4.4 Response Codes............................................................................................................... 8
2.4.5 Advantages and disadvantages of RESTful Web Services ............................................. 8
CHAPTER 3: PROPOSED SYSTEM ......................................................................................... 9
3.1 System goal ............................................................................................................................ 9
3.2 Case Study ............................................................................................................................. 9
3.3 Architecture of the System .................................................................................................... 9
3.3.1 State Machine ................................................................................................................ 11
3.3.2 Use case diagram:.......................................................................................................... 13
3.3.3 Hardware and server design .......................................................................................... 14
Hardware design ..................................................................................................................... 14
3.3.4 Components operating principles: ................................................................................. 17
CHAPTER 4: IMPLEMENTATION ........................................................................................ 24
4.1 Programming Language and Database ................................................................................ 24
4.1.1 Arduino.......................................................................................................................... 24
4.1.2 Spring framework .......................................................................................................... 25
4.1.3 MySQL .......................................................................................................................... 28
4.2 System Implementation ....................................................................................................... 29
i
4.2.1 Arduino IDE .................................................................................................................. 29
4.2.2 Server and Web application .......................................................................................... 30
4.3 Test cases: ............................................................................................................................ 35
4.3.1 Wearable devices: ......................................................................................................... 36
4.3.2: Web application: .......................................................................................................... 37
CHAPTER 5: CONCLUSION AND FUTURE WORK .......................................................... 41
5.1 Conclusion ........................................................................................................................... 41
5.2 Future Work ......................................................................................................................... 41
ii
LIST OF FIGURES
FIGURE 2.1: THE FOUR STAGES OF IOT SOLUTIONS ........................................................................... 3
FIGURE 2.2: BASIC ARCHITECTURE OF A WEB APPLICATION............................................................ 5
FIGURE 2.3: MVC DESIGN PATTERN ................................................................................................. 6
FIGURE 2.4: MVC ARCHITECTURE WITH USER ACTION .................................................................... 6
FIGURE 2.5: REST COMMUNICATIONS BETWEEN CLIENT AND SERVER ............................................. 7
FIGURE 2.6: COMMON HTTP STATUS CODES ................................................................................... 8
FIGURE 3.1: SOLUTION ARCHITECTURE .......................................................................................... 10
FIGURE 3.2: MEDICAL PROCESS ...................................................................................................... 11
FIGURE 3.3: STATE MACHINE OF THE PATIENT¶S WEARABLE .......................................................... 12
FIGURE 3.4: STATE MACHINE OF THE DOCTOR¶S WEARABLE........................................................... 12
FIGURE 3.5: WEB APPLICATION USE CASE DIAGRAM ...................................................................... 13
FIGURE 3.6: COMPONENTS OF PATIENT¶S WEARABLE ..................................................................... 14
FIGURE 3.7: COMPONENTS OF STAFF¶S WEARABLE ......................................................................... 15
FIGURE 3.8: DATABASE STRUCTURE ............................................................................................... 16
FIGURE 3.9: LCD TEXT 1602 PINOUTS ........................................................................................... 18
FIGURE 3.10: LCD TEXT 2004 PINOUTS ......................................................................................... 18
FIGURE 3.11: ESP8266 SPECIFICATIONS ........................................................................................ 19
FIGURE 3.12: ESP8266 PINOUTS..................................................................................................... 20
FIGURE 3.13: PCF8574 SPECIFICATIONS ........................................................................................ 21
FIGURE 3.14: PCF8574 PINOUTS .................................................................................................... 21
FIGURE 3.15: 4X5 KEYPAD PINOUTS ............................................................................................... 22
FIGURE 3.16: DHT11 PINOUTS ....................................................................................................... 22
FIGURE 3.17: LED PINOUTS ............................................................................................................ 23
FIGURE 4.1: DIFFERENT BETWEEN TRADITION AND DEPENDENCY INJECTION PATTERN.................. 25
FIGURE 4.2: SPRING CONTAINER WORKFLOW ................................................................................. 26
FIGURE 4.3: SPRING BEAN LIFECYCLE ............................................................................................. 27
FIGURE 4.4: MYSQL MAIN PROCESS .............................................................................................. 28
FIGURE 4.5 WI-FI CONNECTION CONFIGURATION FOR WEARABLES ................................................ 29
FIGURE 4.6: HOW PATIENTS¶ WEARABLE SEND TEMPERATURE AND CHANGE LED ......................... 29
FIGURE 4.7: HOW DOCTORS WEARABLE RECEIVES PATIENT LIST FOR BROWSING ........................... 30
FIGURE 4.8: KEYPAD ASSIGNATION ................................................................................................ 30
FIGURE 4.9: DATABASE INITIALIZATION ......................................................................................... 31
FIGURE 4.10: LIMIT CONDITION FOR CREATING RECORDS ............................................................... 31
FIGURE 4.11: PROJECT STRUCTURE ................................................................................................ 32
FIGURE 4.12: ROLE RESTRICTIONS .................................................................................................. 33
FIGURE 4.13: LOGIN AND µREMEMBER ME¶ USING COOKIES APIS ................................................... 33
FIGURE 4.15: DOCTOR¶S ACCESS .................................................................................................... 34
FIGURE 4.16: PATIENT¶S ACCESS .................................................................................................... 34
FIGURE 4.17: MYSQL DATABASE¶S CAPACITY TEST ...................................................................... 35
FIGURE 4.18: PATIENT¶S DEVICE .................................................................................................... 36
FIGURE 4.19: DOCTOR¶S DEVICE MAIN SCREEN .............................................................................. 36
FIGURE 4.20: DOCTOR¶S DEVICE DETAIL SCREEN .......................................................................... 37
iii
FIGURE 4.21: LOGIN PAGE .............................................................................................................. 37
FIGURE 4.22: ADMIN HOME PAGE ................................................................................................... 38
FIGURE 4.23: ALL RECORD IN ADMIN VIEW .................................................................................... 38
FIGURE 4.24: RECORD IN DETAIL OF 1 PATIENT .............................................................................. 39
FIGURE 4.25: DOCTOR LIST IN ADMIN VIEW ................................................................................... 39
FIGURE 4.26: PATIENT LIST OF SPECIFIC DOCTORS IN ADMIN VIEW ................................................ 40
iv
LIST OF TABLES
TABLE 3.1 MEDICAL RULE ............................................................................................................... 9
v
CHAPTER 1: INTRODUCTION
1.1
Motivation
The shift in the computing paradigm always opens the door to the next generation of
computer-aided solutions. The success of e-commerce Web portals in the last decades is nowadays
followed by the ever-growing deployment of IoT-driven business processes, giving rise to the term
EHLQJ FRLQHG ³VPDUW´ Business processes of such a smart solution should be geared up to best
harvest IoT technologies like the IoT wearable ± a lightweight device that relies on IoT data-driven
communications to keep people connected purposefully for, fire-fighting, prompting fast-food
clients, and medical treatment, to name just a few. IoT-driven smart solutions are expected to
unlock new ways of handling challenges that most of the world is struggling with: environmental
pollution, disease outbreaks, and natural disaster. There are four fundamentals, yet separable
functions of an IoT application: deploying interconnected devices, capturing data from the devices,
transmitting that information across a data network, and taking action based on the intelligence
collected. From a VRIWZDUHHQJLQHHULQJ¶VSRLQWRIYLHZWKH HQDFWPHQW RI EXVLQHVV SURFHVVHV LQ
such an IoT-based solution necessitates, to some degree, the automation of these functions though
they could be engineered separately.
It would be significant if patients with IoT wearables who are informed daily about their
KHDOWKFDQWDNHDSURDFWLYHUROHLQKHDOWKFDUH7KHSRVVLELOLW\RIXVLQJZLUHOHVVVHQVRUVRQRQH¶V
clothes or body increases comfort, convenience, and the effectivenHVV RI WKH SDWLHQWV¶ KHDOWK
treatment. ConsLGHULQJ WKDW WKHVH FDQ EH PRQLWRUHG DW GLVWDQFH ZLWKRXW DIIHFWLQJ WKH SDWLHQWV¶
routine. Remarkably, medical monitoring can be done in real-time through various devices,
allowing patients to check their situation and getting new orientations via smartphones or tablets.
In this paper, I present a system, called OISP Hospital, where wearables play a central role.
1.2
The rise of IOT in healthcare
With the recent advances in the Internet of Things (IoT), the field has become more and
more developed in healthcare. The Internet of things will help physicians and hospital staff
perform their duties comfortably and intelligently. With the latest advanced technologies, most of
the challenges of using IoT have been resolved, and this technology can be a great revolution and
has many benefits in the future of digital.
Nowadays, thanks to the help of IoT, people can remove barriers such as crowding at
hospitals, saving tremendous costs by monitoring the patient's condition more closely and more
than that, creating a closer relationship between the doctor and the patient by exchanging data
between wearables.
1
CHAPTER 2: BACKGROUND
2.1 Internet of Things - IoT
2.1.1 What is IoT?
The Internet of Things (IoT) refers to a system of interrelated, internet-connected objects
that are able to collect and transfer data over a wireless network without human intervention. These
devices range from ordinary household objects to sophisticated industrial tools
2.1.2. Fundamental stages of IOT
Stage 1: Sensor, aductors
First step consists of the deployment of interconnected devices that includes sensors,
actuators, monitors, detectors, camera systems, etc. These devices collect the data
Stage 2: Internet Gateways and Data Aggregation
A data acquisition system collects raw data from the sensors and converts it from analog
into digital format. the data is also filtered and compressed to an optimum size for transmission.
Stage 3: Edge IT:
Once the data is digitized and aggregated, this is pre-processed, standardized and moved to
the data center.
Stage 4. Data Center and Cloud:
In this stage, data will be analyzed, managed and securely stored for in-depth processing and
follow-up revision for feedback and crucial business decisions. Stage 4 processing may execute
precise analysis by combining data from other sources, both in the digital and physical worlds.
These sources can analyze to identify significant trends and patterns.
2
Figure 2.1: The four stages of IoT solutions (Source: https://intersog.co.il/blog/coding-for-iotwhat-language-does-your-wristband-speak/)
2.1.3 IoT Wearables in Healthcare
Wearable technology in healthcare includes electronic devices that users can wear on their
wrist, like smartwatches which are designed to collect the constantly data of patients' personal
health and exercise. Perhaps the greatest benefit of IoT-enabled wearable medical devices is that
WKHXVHU¶VSURJUHVVZLOOEHWUDFNLQJin the most optimal way though the wearable medical devices
are in high demand because they improve visibLOLW\LQWRUHOHYDQWDVSHFWVRIDQLQGLYLGXDO¶VKHDOWK
status to make more informed decisions about their health. The benefits of using these healthcare
wearables include:
-
Real-Time monitoring
0RQLWRU9XOQHUDEOH3DWLHQWV¶+HDOWKZLWK6WDWXV$OHUWVDQG$ODUms
Patient-Physician Information Sharing
Social Media Sharing Capabilities
3
2.1.4 Advantages of IoT in Healthcare
The major advantages of IoT in healthcare include:
Real-Time monitoring
Real-time monitoring of patients allows hospital staff to react to critical changes
immediately. Thus, they can intervene in the patient's condition at just the right time. Real-time
monitoring is also helpful for remote care. And together with telemedicine, doctors can provide
accurate recommendations to patients thaWFDQ¶WEHVHHQLQSHUVRQ
Fewer Human Errors
Though IoT devices pose the risk of overloading doctors with data, if used correctly, they
FDQ KHOS ZLWK GLDJQRVLV $OVR ,R7 GHYLFHV FDQ KHOS WUDFN SDWLHQWV¶ DFWLYLWLHV DQG UHDFWLRQV WR
medication, which can help to personalize treatment plans and reduce the possibility of medical
errors.
Cost Reduction
IoT enables patient monitoring in real-time, thus significantly cutting down unnecessary
visits to doctors, hospital stays, and re-admissions.
2.2 Hypertext Transfer Protocol
The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed,
collaborative, hypermedia information systems. This is the foundation for data communication for
the World Wide Web (i.e., internet) since 1990.
HTTP is a generic and stateless protocol that can be used for other purposes as well as using
extensions of its request methods, error codes, and headers. HTTP is a TCP/IP based
communication protocol, that is used to deliver data (HTML files, image files, query results, etc.)
on the World Wide Web. The default port is TCP 80, but other ports can be used as well. It provides
a standardized way for computers to communicate with each other. HTTP specification specifies
KRZFOLHQWV¶UHTXHVWGDWDZLOOEHFRQVWUXFted and sent to the server, and how the servers respond to
these requests
4
Figure 2.2: Basic Architecture of a Web Application (Source: https://topdev.vn/blog/http-la-gi/)
2.3 MVC Architecture
MVC architecture is common and widely used in developing app and web application. This
design pattern consists of 3 parts: Model, View and Controller.
5
Figure 2.3: MVC design pattern (Source: https://www.educative.io/blog/mvc-tutorial)
a. Model
This often is the database which is used for storing and managing data.
b. View
As known as Graphical User Interface. The View is a visual representation that directly
interact with users such as table, diagram, chart, etc.
c. Controller
Controller is brains of the system. It connects with Model and View part. The controller
can pass the data from Model to user interface as well as take user inputs from View and
process with its logic then update to the database.
Figure 2.4: MVC architecture with User action (Source: https://www.educative.io/blog/mvctutorial)
6
MVC Architecture advantages:
-
Widely used for designing web applications
Compatible with web application architecture
Loosely coupled (each part works independently with each other)
Reusable without modification
High cohesion
Easy to maintain and modify
2.4 RESTful Web Services
2.4.1 What is REST?
REST stands for Representational State Transfer. It is an architecture that provides
communication between client and server. Client side and server side can be implemented
independently. This makes the paradigm stateless, help RESTful applications become reliable,
quick, high performed and can be managed without affecting the whole system even while it is
operating.
Figure 2.5: REST communications between client and server (Source: https://antmedia.io/restapi-getting-started-guide/)
2.4.2 Making requests
A request from client to the server consists of following:
-
An HTTP Method: define which kind of method to perform
A header: contains client information
A path to a resource
An optional body messages
7
2.4.3 HTTP Methods
The RESTful web services have four basic methods:
-
GET: retrieve resource from the server
POST: create a new resource to the server
PUT: update an existing resource in the server
DELETE: remove a resource from the server
2.4.4 Response Codes
Response code (or Status code) is the code responded from the server to tell the client about
status of the operation. Below are some important status codes that we usually meet.
Figure 2.6: Common HTTP Status Codes (Source:
https://careerguroo.blogspot.com/2015/10/http-status-codes-with-explanation.html)
2.4.5 Advantages and disadvantages of RESTful Web Services
Advantages:
-
Simple and flexible to implement
Variety of data formats such as: JSON, XML, etc.
Fast and high performance
Disadvantages:
-
Headers are required whenever query implementation related
PUT and DELETE cannot be used through firewalls or some browsers
8
CHAPTER 3: PROPOSED SYSTEM
3.1 System goal
With a large number of infections increasing every day during the outbreak of the epidemic,
doctors will have to work very hard to take care of all patients. Therefore, the system was born
with the aim of reducing the workload for medical staff also ensuring patientV¶follow-up is always
optimal.
3.2 Case Study
We walk through a case study of a healthcare process for treating outbreak patients that
suffer from dengue fever in Vietnam. This process monitors patients and alerts doctors using
programmable wearable devices that are coordinated with a rule-based server. This server-side
coordination needs to be customizable to allow the hospital management to, for example, assign/reassign a patient to another doctor/nurse.
3.3 Architecture of the System
Two types of wearable are put in use for the system: one for patients and the other by
doctors or nurses. They are linked to the VHUYHUWKDWFROOHFWVSDWLHQWV¶ERG\WHPSHUDWXUHVDVWLPHseries data. The hospital management can assign the medical rules to treat the dengue cases
optimally. These rules, combined with data collected over time, enable the medical staff to make
priority decisions instead of checking manually and frequently each patient in a chaotic hospital
environment.
Disease Condition
temp [ א37-37.5]
Table 3.1 Medical Rule
Illumination Treatment
Green
temp ( א37.5-38.5] Blue
temp ( א38.5-40]
Purple
temp ( א40-41.5]
Red
Dengue
Out of 4 condition White
above
Recovery phase (close monitoring is necessary to recognize
heart failure or pulmonary edema)
Incubation phase (chest x-ray and abdominal ultrasound)
Febrile phase (monitoring for warning signs and other clinical
parameters)
Emergency phase (measure hematocrit every 1-2 hours, once
every 6 hours)
Abnormal (get to the patient immediately)
9
Figure 3.1: Solution architecture (Source: Enacting a Rule-Based Alert Business Process in Smart
Healthcare Using IoT Wearables [4])
Figure 3.1 shows the overall architecture of the system we built. As mentioned in Table
3.1, each rule states what medical action needs to be taken LIDSDWLHQWV¶ERG\WHPSHUDWXUH
measured by their wearable, reaches a critical level sustainably
The first wearable of the system is for, and supposed to be worn by, patients. It constantly
sends the wearer real-time body temperature to the coordinating server. Many of them are in a
serious health condition and may not be able to cooperate voluntarily. The server keeps track of
WKH SDWLHQW¶V ERG\ WHPSHUDWXUH DQG KHOSV GRFWRUVQXUVHV GHFLGH ZKDW WR GR QH[W LQ D UXOH-based
manner.
The second wearable is to be worn by the medical staff, i.e., doctors and nurses. Its wearer
can query the status of any patient she/he is responsible for. The server maintains a rather simple
database assigning a doctor or nurse to patients she takes care of in the hospital. In case there is at
10
least 1 patient in critical condition, the device will receive a warning. The entire medical process
of monitoring patients is described in Figure 3.2 using a de-facto modeling standard
Figure 3.2: Medical process (Source: Enacting a Rule-Based Alert Business Process in Smart
Healthcare Using IoT Wearables [4])
3.3.1 State Machine
)LJXUHGHVFULEHIRUXVKRZWKHVWDWHPDFKLQHRIWKHSDWLHQW¶VZHDUDEOHWREHGHILQHG
YLVXDOO\ (DFK SDWLHQW¶V ZHDUDEOH PD\ EH LQ RQH RI WKH IROOowing states at run-time: Starting,
Listening, Emergency, Recovery, Incubation, Febrile and Abnormal, the first of which refers to the
moment when the wearable is switched on and establishes Wi-Fi connection to the coordinating
server. The wearable makes a transition to Listening when ready. In this state, the wearable
constantly takes a reading of its ZHDUHU¶VERG\WHPSHUDWXUHWRFRPPXQLFDWHZLWKWKHVHUYHU6KRXOG
the server decide to activate a medical rule, this wearable will change its state to either Emergency,
Recovery, Incubation, Febrile or Abnormal.
11
Figure 3.3: State PDFKLQHRIWKHSDWLHQW¶VZHDUDEOH (Source: Enacting a Rule-Based Alert
Business Process in Smart Healthcare Using IoT Wearables [4])
Figure 3.4: StaWHPDFKLQHRIWKHGRFWRU¶VZHDUDEOH (Source: Enacting a Rule-Based Alert
Business Process in Smart Healthcare Using IoT Wearables [4])
12
- Xem thêm -