Health Care Project Report
Health Care Project Report
Health Care Project Report
Emergencies
Chanok Plaisub
Pattarin Urapevatcharewan
Titichaya Vongbusayamas
Kittipon Suttisirikul
Authors
1. Chanok Plaisub Student ID: 62011104
2. Pattarin Urapevatcharewan Student ID: 62011192
3. Titichaya Vongbusayamas Student ID: 62011282
4. Kittipon Suttisirikul Student ID: 62011299
................................................
(Natthapong Jungteerapanich)
Advisor
Date ......../......../.......
15 12 2022
Acknowledgment
We would like to express our sincere appreciation to Dr. Natthapong Jungteerapanich, our
advisor. His guidance and supervision has provided a lot of resources needed in
completing our project. We highly acknowledged his willingness to contribute his time
and resources to assist us in any way he could in order to help our initiative succeed.
Also, we would like to express our deep gratitude to Dr. Pipat Sookvatana, Asst.Prof.Dr.
Visit Hirankitti, and Asst.Prof.Dr. Isara Anantavrasilp, for their participation and
providing us with all the facilities that were required.
Furthermore, we would like to extend our thanks to the School of International and
Interdisciplinary Engineering Programs for supporting us. Lastly, we want to thank our
friends who displayed appreciation of our work and motivated us
Abstract
The purpose of this software engineering project is to create a mobile application, called
Safe With Us, that provides fastest and efficient emergency medical services and ensures
the user's safety while going on an adventure by letting the user’s contacts know the user
location and activity. The motivation of this project is to decrease transport lethality,
increase chances of survival, shorten stays in hospital, provide appropriate medical
treatment, and lower complication rates. The application acts as a central platform that
collaborates among health organizations and users. When the user requests an ambulance,
the data that user inputs can help the hospital prepare a well-equipped ambulance for the
user. In Case of Emergency (ICE) is a program that allows first responders to contact the
next of kin of a cell phone owner in order to obtain critical medical or support
information. However, the mobile phone must be unlocked and working. To deliver an
alternative option, we offer Near-Field-Communication (NFC) that is portable and able to
be attached with different types of user’s belongings. The NFC contains user’s both
personal and medical information which can be accessed by medical staff to obtain the
user's information and treat the patient accordingly.
In addition, every activity people do in daily life can lead to the situation where they need
help. Letting your loved ones know about your activities, time, and place, could prevent
the worst case scenario. Safe With Us application allows the user to create their In Case
of Emergency event which includes activity description, date, and time. The event will be
notified to the user’s contact so that the contact can access the user location during the
event time. It also lets the contact know when to expect the user to be back home, and can
reach out for help if something goes wrong.
Table of Contents
Chapter 1 1
Objectives and Problem Description 1
1.1 Motivation 1
1.2 Objectives 1
1.3 Scope of Work 1
1.3.1 System Features / Capabilities 1
1.3.2 Benefits 2
1.4 Thesis Structure 2
Chapter 2 4
Related Works 4
2.1 BES I lert u 4
2.2 EMS1669 5
2.3 Medical ID 6
2.4 DIAL 4242 7
2.5 ICE contact 7
Chapter 3
Background Knowledge 9
3.1 REST API 9
3.2 CRUD 9
3.3 Cross Platform Application 10
3.4 NoSQL Databases 11
3.5 Web Application 13
3.6 Cloud Services 13
3.7 Branching Strategy 14
3.7.1 New features 15
3.7.2 Bug fixes 15
3.8 NFC 15
3.8.1 The NFC reader chip 16
Chapter 4
Requirement Analysis / Design / Architecture 18
4.1 Requirements Analysis 18
4.1.1 Functional Requirements 18
4.1.1.1 Ambulance 18
4.1.1.2 Map 19
4.1.1.3 Medical 19
4.1.1.4 NFC 19
4.1.2 Detailed Functional Requirements 19
4.1.2.1 Ambulance 19
4.1.2.2 Map 20
4.1.2.3 Medical 21
4.1.2.4 NFC 21
4.1.4 Detailed Non-functional requirements 23
4.2 Use Cases 24
4.2.1 Use Case Diagram 24
4.2.2 Brief Use Case Descriptions 25
4.3 System Architecture 27
4.4 Entity Relationship Diagram 34
Chapter 5
Development 35
5.1 Development Tools 35
5.1.1 Client Side 35
5.1.1.1 React 35
5.1.1.2 Next.js 36
5.1.1.2 Vercel cloud 36
5.1.2 Server side 37
5.1.2.1 Express.js 37
5.1.2.2 Databases 37
5.1.2.2.1 MongoDB 37
5.1.2.3 Amazon S3 38
5.1.2.3 Application data storage 38
5.1.2.3 REST API 38
5.1.2.4 Cloud 39
5.1.2.4.1 FireStore 39
5.1.2.4.2 Amazon EC2 39
5.1.2.5 Auto Scaling 40
5.1.2.6 Load Balancing 40
5.1.2.7 Elastic Beanstalk 40
5.1.2.8 Monitoring tool 40
5.1.2.8.1 AWS CloudWatch 40
5.1.2.9 Delivery pipeline 41
5.1.2.9.1 AWS CodePipeline 41
5.1.2.10 Authentication 42
5.1.2.10.1 Firebase Authentication 42
5.1.3 Team and Task Management 42
5.1.3.1 Jira 42
5.1.3.2 Github 43
5.1.3.3 Postman 43
5.1.3.4 GitKraken 43
5.2 Development Techniques 44
5.2.1 Agile Development Process 44
Chapter 6 45
Preliminary Results 45
6.1 Frontend 45
6.1.1 High fidelity prototype 45
6.1.1.1 Request ambulance feature (user view) 45
6.2 Backend 50
6.2.1 Github repository 50
6.2.2 Database connection 51
6.2.2.1 MongoDB 51
6.2.3 Firebase 52
6.2.4 CRUD 52
Chapter 7 57
Current Progress and Future Plans 57
7.1 Current Progress 57
7.1.1 Gantt Chart 58
7.2 Future Plan 59
7.2.1 Google Maps 59
7.2.2 NFC 59
7.2.3 CI/CD 60
7.2.4 Testing 60
7.2.5 Deploying 61
7.2.6 Features 61
Bibliography 62
List of Figures
Table Page
1.1 Motivation
We propose a Mobile application for healthcare and medical emergencies called Safe
With Us. Safe With Us wants to solve the present world health issue by providing decent
health care and medical emergency services. Traditionally, when people need emergency
care, they have to call 1669 or search hospitals’ numbers on the internet. The problems
are the caller might not know the precise location, the dispatch takes a long time to pick
up the call or does not respond to the call at all, the caller might not be able to explain the
symptoms clearly, and some of the callers also complain about the poor services they had
experienced. Additionally, the application allows users to send users’ current location to
their acquaintances in case of an emergency when going to areas where accidents are
likely to happen.
1.2 Objectives
The objective of our project is to develop a mobile application that helps:
1. Save lives by providing medical emergency services to people in the
shortest time
2. Providing health care matching for bedridden patients
3. Ensuring appropriate medical treatment and fastening the treatment
process through the use of medical cards
4. Providing first aid knowledge to increase the survival rate
5. Allowing users to send their current location to their acquaintances
1
● Allow users to input or make changes to personal information in their NFC card
where the information can only be seen by authorized person
● Provide users’ profiles with basic medical information when using an NFC card
1.3.2 Benefits
When visiting doctors, basic medical information can be seen right away when using an
NFC card. Therefore, users do not have to fill out the medical form over and over again
when visiting new hospitals where their information is not recorded in the hospital's
database. Moreover, calling an ambulance through the application will allow users to see
an estimated arrival time of the incoming ambulance. The first aid protocol will also be
shown on the users’ screen, the information will help increase the survival rate of the
patient. Additionally, sharing location when approaching risky areas can help increase
survival rate when it comes to emergency situations.
● Chapter 2 Related Works – proposes the Literature survey, various software that
are relevant to this project, and comparison.
● Chapter 5 System Development - explains the concepts, tools, and techniques that
are used in developing the project.
2
● Chapter 6 Results - refers to the results of the software demonstration, which
consists of the user interfaces of the software and real-world applications.
● Chapter 7 Conclusion and Future work - is the chapter that talks about the
conclusion, future work and improvements to the project.
3
Chapter 2
Related Works
This chapter provides brief details and a comparison of existing software related to
emergency medical services in Thailand and other countries, which is BES I lert u,
EMS1669, Medical ID, DIAL 4242, and ICE contact.
There are several similarities with our application. First, both applications concentrate on
providing medical emergency services where the user can request an ambulance by filling
out an assessment form including images and symptoms. Second, the application will use
the location of the user and the locations of the hospitals in the group and dispatch the
nearest hospital to the user. Third, there is a first aid feature where the first aid procedures
4
are displayed in both applications. However, the Health Care application allows the user
to input their medical information for better medical treatment and has more variety of
first aid procedures. When the user requests an ambulance the hospitals are able to choose
whether to accept the request based on medical information and insurance coverage of the
user, location, and hospital’s facilities to avoid problems while treating the patient.
2.2 EMS1669
Medical emergency notifications were received through the EMS1669 application, with
information including full name, telephone number, email address, gender, year of birth,
and medical information. The application will also display nearby hospitals and first aid
procedures. To request an ambulance the user must provide a telephone number and
attach the incident image. The location of the incident is determined by latitude and
longitude. Additionally, the user is also able to track the ambulance.
The core features of both applications are similar. However, our health care application
has Near-Field Communication where it is used by medical staff to evaluate the most
efficient way to treat patients based on their condition and medical history.
5
2.3 Medical ID
Medical ID allows the creation of medical profiles that can be accessed from your lock
screen. In the case of emergencies, profiles provide quick access to vital information such
as allergies, blood type, medical contacts, and so on, which are critical for first
responders, medics, or medical staff who must take action. Even when the app is closed,
you can share your location with emergency contacts (for up to 24 hours or until you stop
sharing). The display and access of your medical information from your lock screen are
made possible by enabling an accessibility service, which is one of the app's core
features. When you enable the accessibility service, a widget appears on your lock screen.
This widget enables people with disabilities, as well as first responders in an emergency,
to take action and access medical data.
The feature of the Medical ID application is similar to our NFC feature where the
first-responder or medical staff can access a patient's medical information such as blood
type, regular medications, gender, age, etc.
6
2.4 DIAL 4242
DIAL4242, India's largest app-based ambulance network, is designed to provide the best
in emergency care to people across the country through its ambulance services, which are
not only limited to emergencies but can also be used by patients to schedule check-ups
and appointments or simply to get home after being discharged from the hospital. The
mobile app connects users to emergency facilities by providing timely ambulance service
when needed, tracking the vehicle once assigned, and predicting when it will arrive at the
desired location. The cost of the ambulance ride will also be predictable.
Both applications aim to deliver medical services whenever the user needs. Nevertheless,
the Dial 4242 offers an ambulance transportation service for the user that has scheduled
check-ups and appointments. Meanwhile, our application limits the service to those
people who encounter trauma or life-threatening incidents only.
7
Figure 5: ICE contact application
[source: ICE Contact - FREE Personal Safety App - In Case of Emergency]
We adopt the concept about letting your loved ones know about your activities that
include risks such as hiking, partying, and more. Our application has the feature that
functions like delayed message feature in ICE contact. The user will be able to send
notification to their determined contact including their information, date and time, and
location.
8
Chapter 3
Background Knowledge
Developers often implement RESTful APIs by using the Hypertext Transfer Protocol
(HTTP). An HTTP method tells the server what it needs to do to the resource. The
following are four common HTTP methods [2]:
● GET - Clients use GET to access resources that are located at the specified URL
on the server.
3.2 CRUD
When we are building APIs, we want our models to provide four basic types of
functionality. The model must be able to Create, Read, Update, and Delete resources.
Computer scientists often refer to these functions by the acronym CRUD. A model should
have the ability to perform at most these four functions in order to be complete. If an
action cannot be described by one of these four operations, then it should potentially be a
model of its own. The following are CRUD operations [3]:
9
● Update - PUT is the HTTP method used for the CRUD operation, Update.
● Delete - The CRUD operation Delete corresponds to the HTTP method DELETE.
It is used to remove a resource from the system.
Major advantages of using cross platform applications are listed as follows [5]:
● Faster updates and flexibility: Compiling the code faster is a key benefit of
cross-platform application development. Developers can easily share the code
across multiple platforms when using the same programming language.
Cross-platform apps are built with technology that allows switching between
various languages. This also gives developers the flexibility to adopt other
technologies as and when needed.
● Do not have to hire a developer for each platform: Since cross-platform apps
use a single code base and common API, there is no need to hire different teams
for different platforms. This leads to a reduction in developers’ count, which in
turn results in the reduction of total development costs. With cross-platform app
development, businesses don’t have to worry about going over budget.
● Reducing the time and cost of app development: When it comes to time,
cross-platform applications help reduce the time required for the development.
Not only does it take less time overall, but it also reduces time spent on
maintenance and updates because one team is responsible for all versions of your
application instead of many teams like native development requires. This makes it
ideal for quick startups who want to get their presence quickly on multiple
platforms with just one app.
10
functionality. This is where cross-platform app development for android and iOS
Devices can help developing an app for multiple devices which will look and feel
similar irrespective of the platform used for accessing it.
● Performance issues: These apps face performance issues due to the integration
problems with certain operating systems. This arises due to the lack of
compatibility between the native and non-native components of the devices on
which it runs. These apps perform lower in comparison with their native
counterparts.
● Limited number of tools: The app developers find it difficult to bring about cross
platform compliance as the tools for developing these apps are limited. We find
Android and iOS platforms coming out with updated versions that are more
advanced which leaves cross-platform apps lagging behind .
● UX Challenges: It is not that cross platform apps do not have a good user
interface but they sometimes cannot match the seamless performance and
attractive UI as the native apps. They fail to meet user expectations. The slow
loading time with performance related issues can be very discouraging.
● Security Issues: Cyber attacks are not at all that uncommon and mobile apps are
vulnerable to them. With frequent updates, native apps are able to rectify their
loopholes but cross-platform apps are not up to the level of that agility in
addressing security issues.
11
● Store unstructured, semi-structured, or structured data: NoSQL databases
have proven popular because they allow the data to be stored in ways that are
easier to understand or closer to the way the data is used by applications. Fewer
transformations are required when the data is stored or retrieved for use. Many
different types of data, whether structured, unstructured, or semi-structured, can
be stored and retrieved more easily.
● Enable easy updates to schema and fields: In addition, NoSQL databases often
allow developers to directly change the structure of the data.
○ Document databases don’t have a set data structure to start with, so a new
document type can be stored just as easily as what is currently being
stored.
○ With key-value and column-oriented stores, new values and new columns
can be added without disrupting the current structure.
● Take full advantage of the cloud to deliver zero downtime: The scale-out
architecture that most NoSQL databases use does more than provide a clear path
to scaling to accommodate huge datasets and high volumes of traffic. Delivering a
database using a cluster of computers also allows the database to expand and
contract capacity automatically.
● Queries are less flexible: NoSQL databases are more flexible when storing a
wide variety of data structures, but they lack the complex query functionality
found in SQL.
● Less mature: Since SQL has been around a lot longer, it is generally universal
and more mature.
12
In general, NoSQL is preferable to SQL when [10]:
How Web applications work Web applications do not need to be downloaded since they
are accessed through a network. Users can access a Web application through a web
browser such as Google Chrome, Mozilla Firefox or Safari. For a web app to operate, it
needs a Web server, application server, and a database. Web servers manage the requests
that come from a client, while the application server completes the requested task. A
database can be used to store any needed information. Web applications typically have
short development cycles and can be made with small development teams. Most Web
apps are written in JavaScript, HTML5, or Cascading Style Sheets (CSS). Client-side
programming typically utilizes these languages, which help build an application's
front-end. Server-side programming is done to create the scripts a Web app will use.
Languages such as Python, Java, and Ruby are commonly used in server-side
programming [11].
13
applications and the flexibility of working in the cloud. Users can access cloud services
with nothing more than a computer, operating system, and internet connectivity.
All infrastructure, platforms, software, or technologies that users access through the
internet without requiring additional software downloads can be considered cloud
computing services—including the following as-a-Service solutions
Clouds are IT environments that abstract, pool, and share scalable resources across a
network. Clouds enable cloud computing, which is the act of running workloads within a
cloud environment. Clouds are a type of PaaS, because hardware and an application
software platform is provided by another party [12].
Initially, the default branch would-be master. We will create the staging and develop
branches and we will make the develop branch the default branch [13].
● develop (default)
● staging
● master
14
Figure 6: GitHub branching
[source: https://bluecast.tech/blog/git-switch-branch/]
The above branches should be created before developing any features and should not be
deleted at any point in time, as long as the project/application exists.
The analogy is that any commit in the develop branch will be deployed in the
development environment, any commit in the staging branch will be deployed in the
staging environment and any commit in the master branch will be deployed in the
production environment.
3.8 NFC
A Near-Field Communication chip (NFC chip or NFC chipset) is a silicon component or
Integrated Circuit (IC) that can be used in different ways, depending on the targeted
application. When connected to an appropriate antenna, an NFC chip enables short-range,
wireless communication between two devices. This provides an additional layer of
security, as only devices within close proximity of each other can communicate via NFC.
An NFC communication system includes two separate parts: an NFC reader chip and an
NFC tag. The NFC reader chip is the active part of the system because as its name
suggests, it “reads” (or processes) the information before triggering a specific response. It
15
provides power and sends NFC commands to the passive part of the system, the NFC tag.
The NFC technology is frequently used in public transport, where users can pay using
their NFC-enabled ticket or smartphone. In this example, the NFC reader chip would be
embedded in the bus payment terminal, and the NFC passive tag would be in the ticket
(or the smartphone) that receives and replies to the NFC commands sent by the terminal.
There are three types of NFC chips: NFC readers, NFC tags, and NFC controller chips.
Usually, combined with a microcontroller, the NFC reader chip powers up and exchanges
information with one or more NFC tags. Supporting multiple RF protocols and features,
an NFC reader chip can be used in three different modes: Read/Write, Peer to Peer (P2P),
and Card Emulation.
/connectivity/nfc/nfc-chips.html]
16
NFC reader chips are often embedded in smartphones, payment terminals, ticket
machines, car door handles, car center consoles, or as part of a broader payment system,
such as an automotive or transport application, or a gaming device.
/essentials-and-insights/connectivity/nfc/nfc-chips.html]
For example, if an NFC reader is embedded in a door handle, the door can be unlocked
when the authorized NFC-enabled smartphone is brought in close proximity to the door
handle [14].
17
Chapter 4
4.1.1.1 Ambulance
18
4.1.1.2 Map
4.1.1.3 Medical
● The system must allow the doctors to assess the patient's symptoms by means of
medical assessment form
● The system must provide suggested first aid protocol according to user's medical
situation
4.1.1.4 NFC
4.1.2.1 Ambulance
● The system must allow the user to request an ambulance for themselves or
other people.
Users are able to call an ambulance at any time either for themselves or other
people in need. When requesting, the user can put a brief detail of what happened
and scan the NFC tag of other people if the user doesn’t request for themselves.
Once the user requests an ambulance, the user must wait for the hospital to accept
the request.
● The system must categorize the user's urgency based on the medical
assessment form
Once the user requests the ambulance, the system will do a brief categorization of
the emergency case then it will display the result to both the user and the hospital.
● The system must display the patient waiting list along with patient symptoms
and medical information to the hospital
19
The hospital can view all emergency cases that are either pending or accepted. In
each emergency case, it will show all the information of that case and the people
who are requested.
● The system must allow the hospital to accept or decline the case
Some hospitals can not accept all emergency cases, so the system will require the
hospital to either accept or decline. However, the hospital can still see the full
information of each case even though it has not been accepted.
● The system must display the ambulance's estimated time of arrival to the
user
Users can see the estimated time of arrival of the ambulance when the
user-requested case has been accepted. The time that is estimated came from the
estimated time of arrival from the hospital to the requested location at that time.
● The system must allow the user to confirm the arrival of the ambulance
Once the ambulance has arrived the user can confirm to the hospital that it has
arrived.
● The system must show the status of all accepted cases in the hospital view
Each emergency case has various statuses such as dispatched, arrived, or finished.
Each case will also be sorted by status when displayed to the hospital.
● The system must allow the user to chat with an ambulance for further
information
Once the emergency case has been accepted by the hospital, both the hospital and
the requested user can text chat with the hospital for further information while
chatting the hospital can put in the information for easier categorization.
● The system must record the user's ambulance request in the history tab
After the emergency case has been finished, the user that created that case and the
hospital that accepted that case will be able to view it.
4.1.2.2 Map
● The system must allow users to share their location with other users
With the Alert system, users can share their location if they feel unsafe, the user
that can view the shared location must be accepted by the sharer.
● The system must allow users to send an emergency message to other users
20
The user can send either a pre-written emergency message or a new emergency
message to all other users that are in the same group or family, the details in the
message will automatically include the date, time, and the location of the sender.
4.1.2.3 Medical
● The system must allow the doctors to assess the patient's symptoms by means
of a medical assessment form
The hospital will have doctors chat with the patient for further information on the
case, and from the doctors’ view, they can fill out a medical assessment form and
send the result to the patient afterward.
● The system must provide suggested first aid protocol according to the user's
medical situation
Users can look up first aid details of most symptoms on the first aid page, and
after the user creates an emergency case and puts in brief detail or chat with the
doctor, first-aid information of that symptom will pop up and suggest the user.
4.1.2.4 NFC
● The system must allow the only doctor to read full data from the patient’s
NFC card
Doctors can scan a patient's NFC card to access all data within the card if the card
is not disabled, but if other users scan it, the system will display brief information
or some information that the card owner is willing to share.
● The system must allow the user to change their data on the NFC card
Data in the NFC card can be changed only by the owner of that card such as a
Home address, Guardian, Phone number, or Name. Once the user has changed the
information a physical NFC card is required to confirm the change.
● The system must allow the user to scan other people's NFC in case that
person is lost
When users scan an NFC card of another user it will not show the full information
of that card’s owner, but it will only show some information such as Guardian’s
contact information, Home address, or Name. And when the card owner is
reported to be lost, if the card has been scanned it will report to the guardian of
that missing person.
21
4.1.3 Non-functional requirements
Description FURPS+
The design interface of the system must have clear instructions. Usability
The system must be able to handle multiple users at the same time. Performance
The system should be a mobile application that supports both iOS Supportability
and Android.
22
4.1.4 Detailed Non-functional requirements
● The interface of the system must be user-friendly.
The interface must be easy to use, recognizable, and minimalistic as this
application’s target users are elderly people, and people in need.
● The system must be able to handle multiple users at the same time.
As our application is an emergency request application it means user requests
must be responded to instantaneously, and multiple users can request emergency
cases at the same time.
● The system should be a mobile application that supports both iOS and
Android.
Our application aims to be easily accessible to everyone, whether they are young
or old, either using iOS or Android. To help people who need to request an
ambulance or people that feel unsafe.
23
4.2 Use Cases
24
4.2.2 Brief Use Case Descriptions
1. Sign in: The user must input their email address and password, then press the
sign-in button or the user can sign in via google email. The system will do
authentication on the user input. Then, the system will navigate the user to the
Home page.
2. Sign up: The user that does not have an account will input his/her email and the
user will also have to input a matched password into the password fields. Then,
the user selects the role (normal user or medical staff) and presses the sign-up
button. The system will create a new account for her/him. After that, the system
will navigate the user to the Feed page.
3. Forgot password: When the user presses “forgot password?’’, he/she will input
the registered email address. Then the firebase authentication will send the email
for resetting the password directly to that email address which allows the user to
change/ reset the password.
4. Request ambulance: When the user presses the SOS button, the user must input
the requested information. After the user finishes filling in the information and
presses the request button, the system will use that data and send it to nearby
hospitals.
5. View ambulance request history: The user is able to view all ambulance
requests they have made.
6. View first aid: The user can click the First aid button to view suggested first aid.
7. Update medical information: The user can edit medical information at any time
and press the save button to sync the information to the system and NFC.
8. View contacts’ location: The user can view the contacts’ location.
10. Disable/enable location sharing: The user can disable and enable location.
11. Disable/activate NFC: The user can disable his/her own NFC when it is lost and
activate it when found.
12. Scan NFC to view personal data: When the normal user scans the NFC of
another user, only a part of personal data will be displayed.
13. Scan NFC to view medical data: When the medical staff scan an NFC the
personal and medical data of the patient will be displayed.
14. Chat with medical staff: The user(Patient) is able to chat with other
users(Medical Staff).
25
15. Call with medical staff: The user(Patient) is able to call other users(Medical
Staff).
16. Chat with patient: The user(Medical Staff) is able to chat with other
users(Patients).
17. Call with patient: The user(Medical Staff) is able to call other users(Patients).
18. View patient’s ambulance request: The hospitals must be able to view all
ambulance requests made by users (patient).
19. Accept request: The user(Hospital) is able to accept the request for an ambulance
from the users(Patients).
20. Decline Request: The user(Hospital) is able to decline the request for an
ambulance from the users(Patients).
21. Assign request to medical staff: The hospital is able to assign the ambulance
request to medical staff.
22. View status of accepted request: The hospitals must be able to view the status of
an accepted ambulance request.
26
4.3 System Architecture
The overall design demonstrates that we make use of the ElasticBean Stalk, which sits on
top of the EC2 instance and offers an automatic scaling procedure for the server side as
well as the client side. In addition, ElasticBean additionally gives AWS Cloudwatch for
the debugging process. Furthermore, it offers hardware status, information logging, and
other features. For the client-side development that will take place on an EC2 instance,
the tools that we have decided to use are React and React Native (Expo). Our program
utilizes MongoDB and Firestore for the database component, which is responsible for
data collection from the application. Any request that requires real-time communication
to be handled, such as chat, notice, and so on, will be handled by Firestore.
27
Figure 10.1: Authentication Flow (sub-system)
Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made
UI libraries to authenticate users to your app. It supports authentication using passwords,
phone numbers, popular federated identity providers like Google, Facebook and Twitter,
and more. As a result, we came to the conclusion that a more robust web authentication
solution would be Firebase Authentication. It is also simple to scale up the system in the
event that the program in question needs to work with an external source such as Line,
Facebook, or Twitter.
The first step in the Authentication Flow is for the client to register the application with
the Firebase Authentication service, which offers APIs for logging in, registering, and
resetting passwords. Each user will be given a token by Firebase Authentication, and the
client can then provide any API in the system by supplying this token. The backend will
validate the token and decrypt the user information, including the user's id and email
address, in order to map the information to the database (mongoDB).
28
Figure 10.2: Expire Service Flow (sub-system)
This service was developed in response to a business need to establish a framework for
the scheduling or setting of time limits for customer activities, such as the payment
service offered by Shopee. Shopee requires clients to complete a transaction only after
they have placed an order and waited two hours. After this period of time, the system will
stop the transaction process in order to make the payment available to other customers.
This system will continually monitor the process to ensure that the time has arrived, and if
it reaches the predetermined time, it will call back to the backend and perform additional
processing.
Using Redis with Bull.js enables our application to open several nodes on its instance
with a time restriction. Once all of the work has been completed, Redis will close all
instances, which is preferable for business cases that include lowering revenue.
In the event that there is a significant amount of traffic on the system, the load balancer
that Redis offers can be of great assistance to us in our efforts to scale out the instance.
29
Figure 10.3: Image Uploading Flow (sub-system)
We chose to use AWS S3 to store images and videos in the cloud for the image uploading
process. The process starts when the client sends an HTTP (POST) request to the backend
to add an object to the database. Backend will upload the File image to the S3 storage and
get a response as a path on the bucket. Backend will then store these paths on the model
in case there are more GET requests in the future.
# Chat-App Collection
-------------------------
user
user_id_1
user_id_2
name : "chanok"
surname : "plaisub"
//array not suitable
block
0 : user_id_3
1 : user_id_4
2 : user_id_5
mute
0 : user_id_6
1 : user_id_7
2 : user_id_8
//this one is better
delete
user_id_1
30
timestamp
user_id_3
timestamp
group
group_id_1
group_id_2
group_id_3
members :
0 : user_id_2
1 : user_id_3
name : "himb" #optional
type : "private" || "group" #optional for group will set default at
private.
recentMessage
messageText:"hell"
readBy
sendAt: ...
sendBy: ...
message
group_id_1
group_id_2
message
document_id_1
document_id_2
messageText : "Hello my name is Jeff"
sentAt : ...
sentBy : ... @user_id
seen : 1 || 0 #optional seen will set to 1 by !(sendBy)
messageType : ...
Document data structure is a unique type of firestore database which provides real-time
communication on both client to client and client to server. It allows clients to
communicate with low latency time as normal communication services such as Line,
Meta, and etc. This service also provides mini features such as mute, block, and delete.
The system contains three main collections including user, group, and message each has
its own responsibility for handling unique data.
User collection is a collection that handles the data of users, any data that provides user
information can be collected here.
31
Group collection is a collection that manages the data associated with chat rooms,
including recentMessage and field members.
Members : contain a uid of user
RecentMessage : display the most recent message, containing sender and recipient
information as well as the message itself.
32
Elastic Beanstalk is a service for deploying and scaling web applications and services.
Upload your code and Elastic Beanstalk automatically handles the deployment—from
capacity provisioning, load balancing, and auto scaling to application health monitoring.
33
4.4 Entity Relationship Diagram
34
Chapter 5
Development
This chapter describes the system development of the project. This chapter describes the
development techniques used while developing the system. The system components are
divided into 2 main parts, client-side and server-side.
5.1.1.1 React
React (also known as React.js or ReactJS) is a free and open-source front-end JavaScript
library for building user interfaces based on UI components. It is maintained by Meta
(formerly Facebook) and a community of individual developers and companies [15].
35
5.1.1.2 Next.js
Next.js; a React library extension is the development framework of our choice. It gives us
the benefits of SEO optimization on our single-page application. A single-page
application (SPA) is a web application or website that interacts with the user by
dynamically rewriting the current web page with new data from the web server, instead of
the default method of a web browser loading entire new pages.
Next.js enables us to create a single-page application that has all the functionalities and
interactivity we require and still enjoys all the SEO benefits of a static text-based website.
– According to the findings of the State of Frontend report, more than half of developers
do not think of SEO as an important factor during development.
We hosted our frontend Application on Vercel cloud; a cloud platform that enables
developers to host websites that deploy instantly, scale automatically, and require little to
no supervision.
36
5.1.2 Server side
In the client-server model, server-side refers to programs and operations that run on the
server. This is in contrast to client-side programs and operations which run on the client
[16].
5.1.2.1 Express.js
Express is a node js web application framework that provides broad features for building
web and mobile applications. It is used to build a single page, multipage, and hybrid web
application. It's a layer built on top of the Node js that helps manage servers and routes
[17].
5.1.2.2 Databases
5.1.2.2.1 MongoDB
37
5.1.2.3 Amazon S3
Amazon S3 offers scalable storage that lets businesses store and manage endless amounts
of items in the cloud. It not only offers a huge storage allowance but it does so with
extremely fast speeds, allowing users to quickly retrieve and share their stored images.
It’s widely known that AWS is extremely secure, ensuring that each image stored is under
extremely safe protocols and security checks.
In our architecture, we employ S3 storage to store all media files that are uploaded by the
users such as profile pictures, uploaded images, and logos. We can achieve this by using
S3 SDK in our Beanstalk backend to expose upload and retrieve API to the client side
[19].
The REST API approach uses Express JS as the back-end web server and MongoDB as
the document store. This concept easily maps MongoDB’s document model to the REST
API payloads which are JSON by nature.
We chose to deploy our NodeJS backend application in the AWS Elastic Beanstalk
platform. AWS Elastic Beanstalk platform as a service (PaaS) takes our application code
and deploys it while provisioning the supporting architecture and compute resources
required for our code to run. Beanstalk also fully manages the patching and security
updates for those provisioned
38
5.1.2.4 Cloud
5.1.2.4.1 FireStore
Cloud Firestore is a flexible, scalable database for mobile, web, and server development
from Firebase and Google Cloud. Like Firebase Realtime Database, it keeps your data in
sync across client apps through real time listeners and offers offline support for mobile
and web so you can build responsive apps that work regardless of network latency or
Internet connectivity. Cloud Firestore also offers seamless integration with other Firebase
and Google Cloud products, including Cloud Functions [19].
Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in
the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to
invest in hardware upfront, so you can develop and deploy applications faster. You can
use Amazon EC2 to launch as many or as few virtual servers as you need, configure
security and networking, and manage storage. Amazon EC2 enables you to scale up or
down to handle changes in requirements or spikes in popularity, reducing your need to
forecast traffic [20].
39
5.1.2.5 Auto Scaling
We have configured our AWS Elastic Beanstalk environment to include an Auto Scaling
group that manages the Amazon EC2 instances in our environment. In a single-instance
environment, the Auto Scaling group ensures that there is always one instance running. It
will also scale up and down in numbers to the required capacity to handle increasing and
decreasing loads alike.
Together with that we deployed Elastic Load Balancing to automatically distribute our
incoming traffic across multiple targets of Beanstalk instances. It will monitor the health
of its registered targets, and route traffic only to the healthy targets. Elastic Load
Balancing scales our load balancer as our incoming traffic changes over time. It can
automatically scale to the vast majority of workloads [21].
Elastic Beanstalk is a platform within AWS that is used for deploying and scaling web
applications. In simple terms, this platform as a service (PaaS) takes your application
code and deploys it while provisioning the supporting architecture and compute resources
required for your code to run. Elastic Beanstalk also fully manages the patching and
security updates for those provisioned resources [22].
We also employ monitoring automation to add visibility into our project infrastructure.
By using AWS CloudWatch we can stream metrics and log out to the monitoring
dashboard to troubleshoot any problem we might face during development or releases.
40
5.1.2.9 Delivery pipeline
41
5.1.2.10 Authentication
5.1.3.1 Jira
Jira is a project management tool that supports the agile methodologies we use, which is
scrum. Our team used Jira to plan, assign, track and manage the workflow of our team.
Our team employed Jira features, such as project board, project backlog, roadmap, and git
repository features
42
5.1.3.2 Github
Github is an online software development platform used for storing, tracking, and
collaborating on our team software project. Allowing us to upload our own code files,
track files revision, and to work together on projects from anywhere. We employed
essential features like repositories, branches, commits, and pull requests. We add and
modify files locally, then “push” our changes back to the repository where our changes
are displayed to the team enabling us to view changes to the document at different points
in time and able to revert files back to the old version.
5.1.3.3 Postman
Postman is an API platform for building and using APIs. Postman simplifies each step of
the API lifecycle and streamlines collaboration so you can create better APIs—faster.
Using Postman will allow our team to access APIs which are developed by backend
developers [24].
5.1.3.4 GitKraken
GitKraken is a graphical user interface for Git built on top of the Electron framework –
much like the popular Visual Code editor. GitKraken is cross-platform, which means that
43
developers can use it on Windows, Mac, and/or Linux. We used gitkraken for committing
or making changes to the Git repository. Moreover, Gitkraken also shows the summary of
the previous commit in the form of a graph [25].
A timebox is a period of time during which a team works steadily towards the completion
of some goal. An iteration of the Agile process is a timebox during which development
takes place and each timebox is called a Sprint and counted as one cycle of development.
In this project, the duration of each sprint is two weeks long.
44
Chapter 6
Preliminary Results
6.1 Frontend
45
Users are able to sign in or sign up by clicking a button in the landing page, and reset
password by clicking “Forget Password?” in the sign in page. If the user does not have an
account yet, the user can click “Don’t have an account yet?” to create an account. If the
user wants to complete the signup process, the user must also fill in the medical
information.
To request an ambulance, the user must click the “SOS” button and fill out necessary
information. Then, click the “Request” button to request an ambulance. The estimated
time of arrival will be displayed. The user is also able to view the first aid procedures via
the first aid page while waiting for the ambulance. After the ambulance arrives, the user
must click the “confirm arrival” button to confirm the arrival of an ambulance and the
status will be reported to the hospital. The user is able to chat with and call the medical
staff assigned by the hospital via chat page.
46
6.1.1.2 Request Ambulance feature (hospital view)
After the hospital admin signs in, the list of emergency incidents will be displayed. The
admin can choose to accept or decline the incidents by clicking either the “Accept” ot
“Decline” button. The hospital staff can view the details of the incident by clicking the
emergency ID of the desired emergency.
For the emergency detail page, the first photo is the detail of an emergency that includes
the medical information registered on our system (the caller is a patient). Meanwhile, the
second photo does not include the medical information (the caller is not the patient).
47
Figure 34: Staff page
The hospital staff can view the status of the dispatched ambulance in the “Ambulance
status” page.
The user can manage their profile by clicking on the profile icon in the navigation bar.
The user can edit their medical information, View ambulance history, disable or enable
location sharing, and disable or enable their own NFC.
48
6.1.1.4 In Case of Emergency event
The user can view the list of contact’s events and their own events. To view the detail, the
user can simply click the determined event and the event detail page will be displayed.
Also, the user can add more ICE contacts by clicking + button. By clicking the “Create
your event” button, the system will navigate the user to the create event page where the
user can choose the desired contact(s), input all the information about the event. When the
user presses the “Create event” button, the event will be created. Lastly, the user can
remove the event by clicking the “Remove” button.
49
6.2 Backend
GitHub repository for backend development has been created and shared among the team
members. Allowing all team members to access the same code and work together on the
same project via GitHub.
50
6.2.2 Database connection
6.2.2.1 MongoDB
The database for storing text data in backend development has been created and
established. And we created data collections for testing purposes.
51
6.2.3 Firebase
The connection for Firebase has been established. We successfully connected to our
Firebase project and tested the authentication process.
6.2.4 CRUD
All CRUD for the APIs has been implemented and tested that it is working properly via
Postman.
APIs documentation:
https://documenter.getpostman.com/view/16038273/2s8YzWR1DB
Create new
Address /address POST
address
Update address
/address/:id PUT
by id
Delete address by
/address/:id DELETE
id
Table 2: Address API
52
Create new
Emergency case /emergency/case POST
emergency case
Get emergency
/emergency/case/:id GET
case by id
Update
/emergency/case/:id PUT emergency case
by id
Delete emergency
/emergency/case/:id DELETE
case by id
Table 3: Emergency case API
Create new
Emergency
/emergency/contact POST emergency
contact
contact
Get emergency
/emergency/contact/:id GET
contact by id
Get emergency
/emergency/contact/user
GET contacts by user
/:userid
id
Update
/emergency/contact/:id PUT emergency
contact by id
Delete emergency
/emergency/contact/:id DELETE
contact by id
Table 4: Emergency contact API
53
Hospital /hospital POST Create new
hospital
Update hospital
/hospital/:id PUT
by id
Delete hospital by
/hospital/:id DELETE
id
Table 5: Hospital API
Create new
Insurance /insurance POST
insurance
Get insurances by
/insurance/user/:userid GET
user id
Get insurance by
/insurance/:id GET
id
Update insurance
/insurance/:id PUT
by id
Delete insurance
/insurance/:id DELETE
by id
Table 6: Insurance API
54
Create new
Medical
/medical/information POST medical
Information
information
Get medical
/medical/information/:id GET
information by id
Update medical
/medical/information/:id PUT
information by id
Delete medical
/medical/information/:id DELETE
information by id
Table 7: Medical Information API
Update hospital
/medical/staff/:id PUT
staff by id
Delete hospital
/medical/staff/:id DELETE
staff by id
Table 8: Medical staff API
55
User user POST Create new user
56
Chapter 7
We have passed the phase of planning, analyzing, and designing. Most of our main UI
including sign-in, sign-up, medical information, home, and ambulance request page has
already been implemented. During each process, we also record and document this report.
For the back-end part, we have established database connections for mongoDB and
firebase and implemented our database models and CRUD. Moreover the APIs have been
tested with mockup data to ensure that it is working properly. After that, we also create
APIs documentation via Postman since we used Postman to test out our APIs. Our APIs
documentation includes sample requests and responses. Currently, we are in the phase of
implementing where we have to integrate the back-end part to our application and
implement side features.
57
7.1.1 Gantt Chart
58
7.2 Future Plan
7.2.1 Google Maps
We will implement Google Map Platform api into our application in order to embed
Google Maps into mobile apps and web pages, or to retrieve data from Google Maps. We
might also implement Google Map Directions API and Google Map Distance Matrix to
show the direction and distance between two locations. However, both services use a
pay-as-you-go pricing model.
7.2.2 NFC
We will implement the NFC card feature where users can read or write data in the NFC
card. The data that is stored in the NFC card or we could say linked to the NFC card will
be stored in our MongoDB database. NFC data could also be managed using GoToTags
59
Encoder. GoToTags is a Software to encode NFC tags that allows us to encode NFC tags
and integrate the encoding data into our system.
7.2.3 CI/CD
CI/CD is a two-step process that streamlines code development and delivery using
automation. We will implement CI/CD practice to reduce the developers' workload. The
process makes it possible to identify issues and solve them more quickly. Additionally,
CI/CD helps in fast system update releases and quick reaction to customer feedback.
7.2.4 Testing
60
In the future we will use Chai and/or Mocha for unit testing as it makes a small part of the
system to carry out a task and then evaluate the outcome. A failed unit test clearly
identifies the problematic part of the code to easily pinpoint the problem and fix it.
Robot Framework could also be implemented for automated testing. Software testers are
prone to mistakes when manually testing a system, especially when an application has
many lines of code. Testing is made easier for the QA by automation, which also
streamlines check execution compared to manual testing.
7.2.5 Deploying
At some point in the future we will start deploying our frontend application in Vercel and
our backend application in the AWS Elastic Beanstalk platform. Even Though we deploy
our application early, we can still update the application and fix the error quickly using
CI/CD process.
7.2.6 Features
One major problem that we face is that this application is an application that is rarely
used, or you could say users do not want to open our application often, as it is used for
emergency cases and used when the user feels unsafe. We intend to develop a new feature
in the future that will let users use our app more frequently and use the application when
they want to, not when they need to. One feature that we came up with is first-aid and
health information which will show first-aid basics and guide to healthy living.
61
Bibliography
[1] “What Is a Rest Api?” Red Hat - We Make Open Source Technologies for the
Enterprise, https://www.redhat.com/en/topics/api/what-is-a-rest-api.
[2] “What Is RESTful API?” Amazon, The University, 1978,
https://aws.amazon.com/what-is/restful-api/.
[3] “What Is Crud?” Codecademy, https://www.codecademy.com/article/what-is-crud.
[4] “Cross-Platform App Development - Explore Frameworks, Technology and Business
Benefits.” ASPER BROTHERS, 29 Oct. 2022,
https://asperbrothers.com/blog/cross-platform-app-development/.
[5] Admin. “What Are the Benefits of Cross-Platform Application Development?”
Techmango, 2 June 2022,
https://www.techmango.net/what-are-the-benefits-of-cross-platform-application-develop
ment#:~:text=What%20are%20the%20benefits%20of%20cross%2Dplatform%20apps%3
F,platforms%20instead%20of%20just%20one.
[6] The Pros and Cons of Cross-Platform Apps.
https://www.focaloid.com/blog/the-pros-and-cons-of-cross-platform-apps/.
[7] “What Is Nosql? NoSQL Databases Explained.” MongoDB,
https://www.mongodb.com/nosql-explained.
[8] “Advantages of Nosql.” MongoDB,
https://www.mongodb.com/nosql-explained/advantages.
[9] “What Are the Pros and Cons of Nosql.” Adservio,
https://www.adservio.fr/post/what-are-the-pros-and-cons-of-nosql.
[10] Mamun, Al Mahmud Al. “NoSQL Databases: When to Use NoSQL VS SQL.”
ServerWatch, ServerWatch, 19 Jan. 2022,
https://www.serverwatch.com/guides/when-to-use-nosql/.
[11] Contributor, TechTarget. “What Is Web Application (Web Apps) and Its Benefits.”
SearchSoftwareQuality, TechTarget, 26 Aug. 2019,
https://www.techtarget.com/searchsoftwarequality/definition/Web-application-Web-app.
[12] “What Are Cloud Services?” Red Hat - We Make Open Source Technologies for the
Enterprise,
https://www.redhat.com/en/topics/cloud-computing/what-are-cloud-services#what-are-ex
amples-of-cloud-services.
62
[13] Preetham. “Git Branching and Branching Strategy.” DEV Community , DEV
Community , 10 July 2020,
https://dev.to/preethamsathyamurthy/git-branching-and-branching-strategy-4mci.
[14] “What Is an NFC Chip?” STMicroelectronics,
https://www.st.com/content/st_com/en/support/learning/essentials-and-insights/connectivi
ty/nfc/nfc-chips.html.
[15] “React (JavaScript Library).” Wikipedia, Wikimedia Foundation, 8 Nov. 2022,
https://en.wikipedia.org/wiki/React_(JavaScript_library).
[16] Server-Side - Wikipedia. https://en.wikipedia.org/wiki/Server-side.
[17] Sharma, Anubhav. “Express JS Tutorial: What Is Express in Node JS?”
Simplilearn.com, Simplilearn, 13 Oct. 2022,
https://www.simplilearn.com/tutorials/nodejs-tutorial/what-is-express-js.
[18] Taylor, David. “What Is Mongodb? Introduction, Architecture, Features &
Example.” Guru99, 12 Nov. 2022, https://www.guru99.com/what-is-mongodb.html.
[19] “Firestore | Firebase.” Google, Google, https://firebase.google.com/docs/firestore.
[20] What Is Amazon EC2? - Amazon Elastic Compute Cloud.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html.
[21] What Is an Application Load Balancer? - Elastic Load Balancing.
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html.
[22] Hava, Team. “What Is AWS Elastic Beanstalk?” Azure, GCP, Kubernetes and AWS
Diagrams Automated, Hava Pty Ltd, 25 Aug. 2021,
https://www.hava.io/blog/what-is-aws-elastic-beanstalk.
[23] “Firebase Authentication.” Google, Google, https://firebase.google.com/docs/auth.
[24] Postman, https://www.postman.com/.
[25] Berry, Chris. “Git Made Easy with Gitkraken.” Keyhole Software, 19 Jan. 2021,
https://keyholesoftware.com/2021/01/19/git-made-easy-with-gitkraken/.
63