cell phone will send the extracted data from Mobile GIS to the server ... been developed and deployed on an android phone, which it responsibility was to get the ... a low-cost GPS tracking system using GPS and GPRS on cheap mobile phone.
Kurdistan Region of Iraq Ministry of Higher Education and Scientific Research University of Zakho
Proposed Succoring System for Patients using Mobile GIS Based on WCF Technology
A THESIS SUBMITTED TO THE COUNCIL OF THE FACULTY OF SCIENCE, UNIVERSITY OF ZAKHO IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCEINCOMPUTER SCIENCE
BY
Sanaa Enwiya Rizqo (B.SC. COMPUTER SCIENCE- 2007)
Supervised by
Dr. Ayad Ghany Ismaeel Assistant Professor
1435 A.H.
2713 K.
2013 A.D.
Supervisor's Certification I certify that this thesis entitled "Proposed Succoring System for Patients using Mobile GIS based on WCF Technology"was prepared under my supervision at the Department of Computer Science, Faculty of Science in the University of Zakho in partial fulfillment of the requirements for the Master Degree in Computer Science.
Signature: Name: Dr. Ayad Ghany Ismaeel Assistant professor Date:
/
/2013
Chairman's Certification In view of the available recommendation, I forward this thesis for debate by Examining Committee.
Signature: Name: Abdulhakeem O. Mohammed Assistant Lecture Chairman, Computer Science Department Date:
/
/2013
Page |i
Dedication
I dedicate this thesis to:
My Parents for their Love, endless support and encouragement.… My beloved Brothers and Sisters… All my friends…
P a g e | ii
Acknowledgements
Foremost, I am grateful to GOD for giving me the strength and confidence to achieve my goal.
I would like to express my deep gratitude to my supervisor Dr. Ayad Ghany Ismaeel, for his effective and helpful discussion during the progress of this thesis. My thanks and grateful to the President of the University of Zakho Dr.Lazgeen A. Jamil , and to the Dean of Faculty of Science Dr. Fadhil H. Easif, and to the Head of Computer Science Dept. Mr. Abdulhakim O. Mohammed for their support and encouragement. I am also grateful to everyone who helped me to complete this work. Finally, I owe my deepest gratitude to my family and friends, for they were the source of motivation and encouragement.
P a g e | iii
Abstract According to statistics of the World Health Organization (WHO), there is large number of sick persons with different diseases worldwide. Moreover, there is a lack of succor services which provide help with quick response for these individuals. This could lead to an increase in patients’ mortality. This thesis offers a succoring system, which enable the patient to trigger the request of help to get succored based on his/her location. The proposed system is the first tracking system that works 24/7 online and offers the succoring service only when the patient needs it. This service is enabled by the patient through sending a request for succoring using mobile Geographic Information System (GIS) based on Windows Communication Foundation (WCF) technology. The request, which contains his/her ID, Longitude and Latitude, will be sent by click of one button. This request will be send via Internet to a PC holding Web service and database, which the patient was registered previously on it. Then the Web service will locate the patient on Google Maps and retrieve the patient's information from the database. This information will be used by the Web service to notify the nearest and most suitable Emergency Service Center (ESC), which will send succoring facility to the patient’s location. Moreover, the Web service will send Short Message Service over IP (SoIP) to inform the patient’s emergency contacts. Finally, the proposed system is found effective in handling large number of requests within short period of time at a rate of 1 sec per request. This is related to the use of WCF technology. Furthermore, the process of request and reply for the patients’ emergency cases is achieved in cost-effective way due to this technology, which allows sending data via Internet through the available mobile communication networks. The proposed system can be implemented in minimum configurations (hardware and software) to minimize the overall cost of operation and manufacturing.
P a g e | iv
List of Contents Dedication.............................................................................................................i Acknowledgements……………………………………………………………..ii Abstract………………………………………………………………………. ..iii List of Figures………………………………………………………………….……….vi List of Algorithms……………………………………………………………..viii List of Tables……………………………………………………………………ix List of Abbreviations…………………………………………………………....x Chapter 1: Introduction 1.1 Overview ......................................................................................................................1-1 1.2 Related Works ..............................................................................................................1-3 1.3 Aims of the Thesis .......................................................................................................1-6 1.4 Thesis Layout ...............................................................................................................1-7
Chapter 2: Background Theory 2.1 Introduction ..................................................................................................................2-8 2.2 Tracking System ..........................................................................................................2-8 2.`3 Geographic Information Systems (GIS) ....................................................................2-11 2.3.1 GIS Functions................................................................................................................... 2-12 2.3.2 GIS Components .............................................................................................................. 2-13
2.4 Global Positioning System (GPS) ..............................................................................2-14 2.4.1 Advantages of GPS........................................................................................................... 2-15 2.4.2 The Segments of GPS ....................................................................................................... 2-15
2.5 Mobile Geographic Information System (Mobile GIS) ............................................2-17 2.5.1 Advantage of using Mobile GIS: ...................................................................................... 2-19 2.5.2 The Composition of Mobile GIS ...................................................................................... 2-19
2.6 General Packet Radio Service (GPRS) ......................................................................2-21 2.7 Short Message Service over IP (SoIP) ......................................................................2-23 2.8 Windows Presentation Foundation (WPF) ................................................................2-24 2.9 Windows Communication Foundation (WCF) ..........................................................2-25 2.9.1 WCF Architecture............................................................................................................ 2-27 2.9.2 Message Exchange Patterns (MEPs) .............................................................................. 2-28 2.9.3 WCF Communication Protocols ...................................................................................... 2-29
Page |v
Chapter 3: Proposed System 3.1 Introduction ................................................................................................................3-30 3.2 General Architecture of the Proposed Succoring System ..........................................3-30 3.3 Server Model .............................................................................................................3-33 3.3.1 Database ........................................................................................................................... 3-33 3.3.2 Web Service ..................................................................................................................... 3-35
3.4 Client Model ..............................................................................................................3-42 3.4.1 Registration on the Client Model...................................................................................... 3-44 3.4.2 Help Page on the Client Model ........................................................................................ 3-47
3.5 Emergency Service Center Model .............................................................................3-48
Chapter 4: Implementation of the Proposed System and Results Discussion 4.1 Introduction ................................................................................................................4-51 4.2 Required Configuration for Developing the Proposed System ..................................4-51 4.3 Required Configuration for Operating the Proposed System ....................................4-52 4.3.1 Server and ESC Sides: ...................................................................................................... 4-53 4.3.2 Client Side ........................................................................................................................ 4-53
4.4 The Implementation of the Proposed System .............................................................4-54 4.4.1 Client Model ..................................................................................................................... 4-54 4.4.2 Server Model .................................................................................................................... 4-61 4.4.3 Emergency Service Center Model .................................................................................... 4-69
4.5 Search Tools of the Web Service ...............................................................................4-74 4.5.1 Requests Search Tool ....................................................................................................... 4-74 4.5.2 Patients Search Tool: ........................................................................................................ 4-77 4.5.3 ESCs Search Tool ............................................................................................................. 4-79
4.6 Discussion of the Results ...........................................................................................4-81 4.7 Comparison with other Related Systems ...................................................................4-83
Chapter 5: Conclusions and Future Works 5.1 Conclusions ................................................................................................................... 85 5.2 Recommendation for Future Works .............................................................................. 87
References...…………….......……………………………………………..…..88
P a g e | vi
List of Figures Figure 1.1: Tracking System Diagram……………………………………………………...1-2 Figure2.1: System uses a hand held apparatus ....................................................................2-10 Figure 2.2: Elements of the GPS tracking kit ........................................................................2-10 Figure 2.3: The three segments of GPS .................................................................................2-16 Figure 2.4: The orientation of the 24 GPS satellites .............................................................2-16 Figure 2.5: Mobile GIS platform ...........................................................................................2-18 Figure 2.6: SMS over IP Architecture ..................................................................................2-23 Figure 2.7: Communication through the endpoint.................................................................2-27 Figure 2.8: Base schema of callback/ duplex communication .............................................2-29 Figure 3.1: General architecture of the proposed system ......................................................3-31 Figure 3.2: General flowchart of the proposed system..........................................................3-32 Figure 3.3: Structure of ESCs table .......................................................................................3-33 Figure 3.4: Structure of New_ Request table ........................................................................3-34 Figure 3.5: Structure of Registration table ............................................................................3-34 Figure 3.6: Structure of Request_info table ..........................................................................3-35 erugiF 3.7: Flowchart shows main tasks of Web service ......................................................3-36 Figure 3.8: Flowchart of client model ...................................................................................3-43 Figure 4.1: Registration mode on mobile application ...........................................................4-56 Figure 4.2: Shows the response of the system after first registration ....................................4-57 Figure 4.3 : Notifying message for entering invalid ID ........................................................4-58 Figure 4.4: Help page of mobile application .........................................................................4-59 Figure 4.5: Notifying message of successful request transmission .......................................4-60 Figure 4.6: Notifying message of non-successful request transmission ................................4-60 Figure 4.7: Shows Registration table at the database ............................................................4-61 Figure 4.8: Shows ESCs table at the database .......................................................................4-62 Figure 4.9: Saved records at New_Requests table ................................................................4-62 Figure 4.10: Saved records at Request_Info table ................................................................4-63 Figure 4.11: The main GUI of the Web service ....................................................................4-64 Figure 4.12: Displaying new requests with their location at the Web service in Map view ………………………………………………………………………………………...4-66
P a g e | vii Figure 4.13: Displaying new requests with their location at the Web service in Satellite view…………………………………………………………………………………………4-67 Figure 4.14: Displaying information of a patient at the Web service....................................4-67 Figure 4.15: SoIP message for the emergency contacts ........................................................4-68 Figure 4.16: Hyperlink location of the patient at the emergency contact mobile .................4-69 Figure 4.17: login interface of the ESC model ......................................................................4-69 Figure 4.18: The main GUI of the ESC model ......................................................................4-70 Figure 4.19: Map and Satellite views at the ESC model .......................................................4-72 Figure 4.20: Request color change at the Web service..........................................................4-73 Figure 4.21: Request search tool (New Requests) .................................................................4-75 Figure 4.22: Request search tool (Done requests) .................................................................4-76 Figure 4.23: Request search tool (Both requests) ..................................................................4-76 Figure 4.24: Showing all the registered patients in the system .............................................4-77 Figure 4.25: Patient's information search tool (by ID) ..........................................................4-78 Figure 4.26: Patient information search tool (by Disease) ....................................................4-78 Figure 4.27: ESC's information search tool (by ID) ..............................................................4-79 Figure 4.28: Showing all the ESCs in the system .................................................................4-79 Figure 4.29: Adding new ESC at the Web service ................................................................4-80 Figure 4.30: Error message for duplicated IDs entering .......................................................4-80 Figure 4.31: Updating information of ESC ...........................................................................4-81 Figure 4.32: Deleting an ESC at the Web service .................................................................4-81
P a g e | viii
List of Algorithms Algorithm 3.1: Calculating the age of patient .......................................................................3-37 Algorithm 3.2: Sending SoIP ................................................................................................3-37 Algorithm 3.3: Haversine equation ......................................................................................3-38 Algorithm 3.4: Displaying the information of patient(s) at the Web service ........................3-39 Algorithm 3.5: Adding ESC on the server model .................................................................3-40 Algorithm 3.6: Updating the information of the ESC at the server model ............................3-41 Algorithm 3.7: Deleting the information of the ESC at the server model .............................3-41 Algorithm 3.8: Creating list of birth dates within client model ............................................3-44 Algorithm 3.9: Registration mode .........................................................................................3-46 Algorithm 3.10: Sending help request from client to server .................................................3-47
P a g e | ix
List of Tables Table 2.1: WCF Feature Comparison ...................................................................................2-26 Table 4.1: The description of the Web service GUI ..............................................................4-65 Table 4.2: The description of the ESC GUI ..........................................................................4-71 Table 4.3: Comparing the proposed system with other Systems. ..........................................4-84
Page |x
List of Abbreviations 2-D
Two Dimensional
3-D
Three Dimensional
API
Application Program Interface
API
Application Programming Interface
CIMD
Computer Interface Message Distribution
COM
Component Object Model
CSD
Circuit Switched Data
DB
Database
DBMS
Data Base Management System
EDGE
Enhanced Data for Global Evolution
ESC
Emergency Service Center
GIS
Geographic Information System
GPRS
General Packet Radio Service
GPS
Global Positioning System
GSM
Global System for Mobile Communications
GUI
Graphical User Interface
HTTP
Hypertext Transfer Protocol
IMEI
Irrational Mobile Equipment Identity
IP
Internet Protocol
ISP
Internet Service Provider
LBS
Location Based Services
LINQ
Language Integrated Query
MEP
Message Exchange Patterns
MS
Mobile Station
MSMQ
Microsoft Message Queue
PC
Personal Computer
RFID
Radio-Frequency Identification
SDK
Software Development Kit
SM
Short Message
SM-GW
Short Message Gateway
SMPP
Short Message Peer to Peer
P a g e | xi SMS
Short Message Service
SMSC
Short Message Service Center
SOAP
Simple Object Access Protocol
SoIP
Short Message Service over IP
SPSS
Statistical Product and Service Solutions
SS7
Signaling System 7
TCP
Transmission Control Protocol
UCP
Universal Computer Protocol
UI
User Interface
WCF
Windows Communication Foundation
WHO
World Health Organization
WPF
Windows Presentation Foundation
WSE
Web Services Enhancements
XAML
Extensible Application Markup Language
XML
Extensible Markup Language
P a g e | 1-1
Chapter 1: Introduction 1.1 Overview A patient with a chronic/non-chronic disease, such as asthma, diabetes and congenital heart could turn into a critical case; critically ill patient requires a rapid clinical response [1]. According to the World Health Organization (WHO), the numbers of patients with these diseases are increasing per year [2]. Therefore, this thesis will take into consideration the mentioned illnesses above as examples, while it can be used for other medical cases. Asthma patient faces attacks of breathing difficulties, which can be fatal without a quick treatment [3]. The statistics indicates that there were 300 million people affected by Asthma in 2010, and this number will goes up to 400 million people world-wide by 2025 [1]. Another chronic disease is diabetes, which can be defined as an abnormal sugar level in the patient’s blood [4], estimations provided by the WHO pointed out that in 2025 the diabetics will reach 333 million worldwide from 135 million patients in 1995 [1]. Moreover, congenital heart disease is a birth-defect which can be untreatable at early ages; therefore, a properly made tracking system is required in this case to prevent fatality. Globally, over 1,000,000 babies born with such defect each year [2]. These diseases put a heavy burden on sociality. Patients from different ages will require escorts to make sure that they will get a fast medical response. For example, a new inhaler device should be presented as soon as possible to asthma patient if the old one runs out. Therefore, a mobile alert system with a tracking ability is vital to provide a proper medical response without the intervention of another person beside the patient. There are several systems dealt with dedicated alarm systems designed for medical reasons. The systems presented in [4][5] requested devoted
P a g e | 1-2
microprocessor and I/O devices (screen and keyboard). Moreover, these systems mainly relied on the dedicated tracking technology to identify the location of the patient. The dedicated alert systems in the mentioned papers used the Global Positioning System (GPS) to provide the tracking facility. A traditional tracking systems developed in [6] used a handheld GPS receiver device for tracking the location depend on real time tracking and continuity on the interval of tracking. Figure (1.1) shows a diagram of a traditional tracking system.
Figure 1.1: Tracking System Diagram
The people currently are depending on their mobile devices, which usually contain all the new technologies to provide the main structure for the proposed succoring system in this thesis. This will reduce the cost further because of the client terminal will request only software program, while the required hardware is integrated within the cell phone. Therefore, there is a needed for an emergency system which can track and request help, only in case they required it and there is no one around to assist them. Moreover, the
P a g e | 1-3
assistant should be provided in a quick manner. This thesis proposed a system with following technologies and modes.
1- Mobile GIS (Geographic information system): This technology integrates one or more of the following technologies; Mobile devices, GPS and Wireless communications for Internet GIS access [2]. The cell phone will send the extracted data from Mobile GIS to the server to be displayed on Google Maps.
2- General packet Radio Service (GPRS): The mobile terminal sends the extracted data through GPRS data channel to a special TCP/IP server (a PC with fixed IP address) linked to the Internet [2].
3- Windows Communication Foundation (WCF): Is a framework for building service-oriented applications. WCF allows the sending of data as asynchronous messages from one service endpoint to another [7].
4- Short Message Service over IP (SoIP): Is a service that provides a connectionless transfer of short messages channels in cellular network. Therefore, providing a mode using this technology will give a cost effective solution [8].
1.2 Related Works In 2009, A. U. Alahakone and V. Ragavan, [9] presented the development of a GIS for path planning and navigation of mobile objects. The system involved GIS implementation using Google Maps to visualize the routes of mobile objects acquired from GPS receivers over a GPRS network. A spatial database built into the system to record the geographic information for later
P a g e | 1-4
referencing. The GIS module was developed to perform route assignments and display the historical information saved in the data repository.
In 2009, K. Hasan, M. Rahman, and A. Haque, [6] proposed and implemented a low cost object tracking system using GPS and GPRS. The system allowed the user to view the present and the past positions recorded of the targeted object on Google Maps through the internet. The object’s position data were stored in the database for live and past tracking. This technique provided the advantage of the low-cost unlike the previous technique that depended on SMS, which turned out to be expensive, for the communication to the server.
In 2011, R. Gupta and B. Reddy, [10] proposed a cost effective method for tracking human’s mobility using GPRS and GPS allowing the mobility of the tracked object to be followed using mobile phone, which equipped with an internal GPS receiver and a GPRS transmitter. A mobile phone application had been developed and deployed on an android phone, which it responsibility was to get the GPS location and send it to a remote location by creating a GPRS packet. This application was developed with JavaScript Ajax based Google Map API integrated, which will be responsible for the showing the current location of the mobile phone into it. The mobile's Irrational Mobile Equipment Identity (IMEI) number had been used as a unique identifier, which would be sent along with the coordinates. Moreover, the person's position is saved in a Mobile Object Database (MOD).
In 2011, M. Mohandes, [11] developed a system for the tracking and identifying pilgrims in the Holy areas, in Makah-Saudi Arabia, during the Hajj period (Pilgrimage). The area was already covered by a sophisticated3.5G network by several service providers. Upon request or periodically, the mobile
P a g e | 1-5
phone sends it’s UID, latitude, longitude, and time stamp using Internet. A server maps the latitude and longitude information on Google Maps or any GIS. If the Internet connection is lost the mobile phone stores the location information in its memory until the Internet connection is restored, then sends all the stored location information and clears this information from its memory. The developed system works in coordination with a Radio-Frequency Identification (RFID) system.
In 2011, R.K.Moloo and V.K.Digumber, [12] proposed and implemented a low-cost GPS tracking system using GPS and GPRS on cheap mobile phone devices. Their system allowed the user to view real time positioning and recorded tracks of a mobile phone adapted for the system. It reads the current GPS location of the mobile phone device using a GPS Receiver, which may be external or integrated in the device, and sends data to a main server database via GPRS on a GSM network. The web application for this system has been developed using PHP, MySQL and Google Maps APIs, which used for location visualization. Furthermore, the system used the free email-text messaging attribute of the two major mobile network operators (Orange and Emtel) in Mauritius to send Geofence alerts to the users in case of their adapted mobile phone devices have reached a restricted zone set through the web application.
Finally, In 2012, A. G. Ismaeel, [2] suggested an emergency system for succoring sick child locally, when he/she required that and there isn't someone around to help. In this emergency system the web application has been developed using C# based on MySQL and Google Maps for the location visualization. Furthermore, the child will send a SMS contains his/her ID and coordinates (Longitude and Latitude) via GPRS network to a web server. In this step, the server will locate the sick child on Google Maps and retrieve the child's information, which has been saved in the registration stage, from the database.
P a g e | 1-6
According to this information the web server will send the succoring facility and at the same time will inform the parent’s emergency contacts the child’s case using SMS mode through GPRS network.
Most of the mentioned related works above focused on tracking of persons without the facility of alerting the medical services to provide the proper treatment for the patients. Moreover, the overall cost of most of these systems is still noticeably high considering the relatively slow responses of these systems. Therefore, the proposed system in this thesis will try to tackle the mentioned points through using technologies, such as WFC, to provide better system response besides using minimum hardware and software configurations.
1.3 Aims of the Thesis The motivation behind the proposed system can be summarized as follows: 1- Design a succoring system for patients using mobile GIS based on WCF technology to enhance the performance and throughput of the system by offering a fast request for medical response to assist a patient with critical case.
2- Reduce the overall cost of the system by using mobile GIS which contains build-in GPS receiver and has internet access through its GPRS transmitter.
P a g e | 1-7
1.4 Thesis Layout The remaining parts of the thesis are outlined as the following:
Chapter 2: Explains the main principal concepts such as the theoretical background of the mobile GIS and other technologies that are used for connecting the client with the server and ways of transferring data in the proposed system.
Chapter 3: Presents the proposed system which consist of three models (Client, Server and ESC) and illustrate the algorithms that are used for the programming this system.
Chapter 4: Exhibits and discusses the experimental results of the proposed system and then compares the proposed system with other related works.
Chapter 5: Present conclusions of the thesis and possible future works for the thesis.
P a g e | 2-8
Chapter 2: Background Theory 2.1 Introduction This chapter contains background and theoretical base for the topic in hand. This chapter will review all the techniques, modes and technologies required (such as tracking system, GIS and GPS techniques, mobile GIS, GPRS, SoIP mode, WPF and WCF technologies) in the implementation of the proposed system. It will also show how to employ these techniques and technologies in every aspect of the Server, Clients and ESC through diagrams, flowcharts and algorithms.
2.2 Tracking System Tracking systems are mainly constructed to monitor a mobile object, these systems utilize different technologies such as radio waves, cellular communication and GPS to pin point the location of the subject. The apparatus of the system may include two units. The first one is mounted on or carried by the mobile subject. This unite may have the ability to monitor many data such as system integrity, motion, temperature, audio beside the location. The second unit is to receive the data from the remote first unit, which is equipped with a transmitter, and analysis the received data to be displayed with the requested format. Moreover, the second unit can be considered as a monitoring station with a fixed location or it can be mobile too. These systems are used to monitor a variety of objects such as animals, automobiles, hazardous environments and human being, who will be the concern of this thesis [13].
P a g e | 2-9
The early version of tracking system used the concept of following the direction of the strongest signal to find the location of the subject. For example, a rescue transmitter apparatus adapted to be worn on a person’s wrist. The transmitter will transmit a microwave signal in case of emergency and this signal can be received by a search and rescue craft. The relative position may be determined using a directional antenna and following the direction of the strongest signal. The positioning will not be absolute as in the GPS case and other data or information may not be available [13]. This is the main drawback for this system because of finding the subject’s location will cost a lot of time which is essential to keep the person in stress alive. Moreover, this system may be inefficient in tracking an object in constant movement because of the technique of following the strongest signal. Currently, most of the tracking systems are using the GPS technology to find the absolute location of the monitored subject. The early versions of the tracking systems based on GPS used dedicated GPS receivers to provide this function. For example, Figure (2.1) illustrate a system uses a hand held apparatus which contains dedicated GPS receiver and cellular telephone transmitter to perform the tasks of getting the GPS signal and sending the location information to the main station. Figure (2.2) illustrates various types of dedicated GPS tracking devices [14].
P a g e | 2-10
Figure 2.1: System uses a hand held apparatus [15]
Figure 2.2: Elements of the GPS tracking kit
P a g e | 2-11
The latest versions of GPS tracking systems are depending of cell phones because many of these devices are currently containing a built-in GPS receiver and cellular transmitter beside a powerful processer to provide the functionality of a smart device [2][10]. In the present time, tracking a person's mobility has became a crucial issue and a cost effective system utilizes mobile phone equipped with GPS and GPRS rather than using a handheld GPS receiver will be an advantage [10].
2.3 Geographic Information Systems GIS is one of the major stages of any planning process in order to make decisions about a specific problem or issue. Presently, the GIS technology is relatively mature. The concept of GIS has been widely accepted as a technological tool for understanding the geo-locations of objects and making intelligent decisions. Additionally, GIS organizes geographic data so that a person can read a map and select the necessary information for a specific project, problem or task [16]. GIS can be considered as a technique that manipulates, integrates and mapping geographical information based on positional coordinates (Latitude/ Longitude). It is a powerful system with high accuracy. Therefore, it is being used as the main backbone for a variety of path planning and navigation technologies, which widely used in the industry today. Tracking, security management, fleet management and industrial robot navigation are some common applications utilizing this tool [9][17]. GIS software, such as ArcGIS, MapPoint and Google Maps, have been developed and integrated to accurately plot and display positional information. Google APIs are freely available and accessible on the internet and provide both satellite and street maps. GIS systems incorporate several layers, each one provide a different set of information to represent positional data, for example
P a g e | 2-12
Google Maps APIs provides the ability to embed many types of layers to enhance the quality of the data representation of the GIS system. The Google Maps APIs layers are [9]: 1) Markers: are one point objects or features that have geographical position reference (Latitude/Longitude) without length or area. For example, plot of mobile towers, trees and traffic signs. 2) Poly-lines: are object(s) with a specific length on the map without an area and this can present roads, rails and any other type of routes. 3) Polygons: Represents a specific area on the map, such as borders of a specific district or neighborhoods within a city. 4) Info Windows: Displays the information and the attributes combined with the geo-object, such as marker number, location, speed, date and time, for each marker mapped onto the map.
2.3.1 GIS Functions There are four basic functions of GIS; Data capture (data entry), Data management, spatial analysis and presenting results [18]. a) Data Capture: There are many types of the Data that GIS uses, these data come from many sources and variable types and are stored in different forms. Data sources are mainly manual digitization/scanning of aerial photographs, paper maps, and existing digital data. Remote-sensing satellite imagery and GPS are also data input sources for GIS. b) Data Management: In this stage, GIS manage the entered and stored data from the first stage, after data are collected and integrated. Effective data management includes all of the following aspects; data security, data integrity, data storage and retrieval, and data maintenance abilities. c) Spatial Analysis: Spatial analysis is the most important function of GIS which makes it distinct from other systems such as Computer Aided
P a g e | 2-13
Design and Drafting (CADD). The spatial analysis provides functions such as spatial interpolation, buffering and overlay operations. d) Presenting Results: IS can present the results in many different and fascinating ways; this information can be presented in a way which anyone in the decision making series can take the decision easily and clearly. These abilities of GIS have given rise to new fields such as exploratory cartography and scientific visualization. Visual presentation is one of the most fascinating aspects of GIS for communicating the results of analysis to decision makers.
2.3.2 GIS Components Most the reviewed resources divided the components into five parts [19], which will be considered as follows: 1) Hardware: There are many devices involved in the building concept of the GIS. The computer system is the essential part of hardware. Other devices like scanners, printer, plotters, GPS receivers and leveling devices are also necessary and used within GIS. 2) Software: Is considered the most important component. It gives the function and tools needed to store, analyze, and display geographic information.GIS software varies from a system to another, but all of them share the same functions and targets, which obtain the final models, maps, diagrams or results to be ready for the decision makers. 3) Data: The data is the backbone of any GIS system. If there is no data to collect, enter, analyze and display, there will be no results then decision making. Data also have many types. Commonly GIS classify the Data into two major types; Raster data and Vector Data.GIS can integrate spatial data with other data resources, such as traffic and weather reports.
P a g e | 2-14
Moreover, GIS uses Data Base Management System (DBMS), which is commonly used by most organizations, to manage the spatial data. 4) Method: Method usually refers to how to collect, enter, analyze and display the data. This should be done within a clear and well-structured plan for the GIS system. 5) People (GIS users): Is every person who participates in the process of the GIS or planning project from the stage of detecting the problems to the decision making stage. They can be professional programmers, data entries, cartographers to the decision makers.
2.4 Global Positioning System GPS is a satellite-based positioning system planned by the U.S. Department of Defense in the early 1970s and has been operational since 1995. The system enables the positioning of objects near the surface of the Earth, 24 hour a day over the week. It does not require any subscription fee to use the system as long as a GPS receiver is purchased before using the service. Prior to May 1st, 2000, GPS signals were intentionally embedded with errors known as the Selective Availability. After this date, the GPS signals have been free of intentional errors [20]. GPS is increasingly being adopted by private and public enterprises to track and monitor humans for Location Based Service (LBS) and GIS. Some of these applications include personal locators for children, the elderly or those who suffer from Alzheimer’s or memory loss. Moreover, law forces can use it to monitor parolees for law enforcement, security or personal protection purposes. The continual miniaturization of the GPS chipset means that receivers can take the form of wristwatches, bracelets and mini mobiles, with the ability to pinpoint the longitude and latitude of a subject [21].
P a g e | 2-15
Currently, GPS has become a useful tool for the positioning of objects. Robustness GPS equipments, its reliability and ease-of-use are some of the factors that makes GPS system popular in survey works. With emerging new GPS technology, many positioning methods and sophisticated software have been developed to collect field data efficiently for real-time or post-processing purposes. Thus, GPS technology had became more efficient in survey jobs, engineering surveys and other mapping purposes [22][23].
2.4.1 Advantages of GPS 1) GPS operates 24-hour in most weather conditions. 2) GPS does not need direct visibility between the base and monitoring points with the minimal user interaction. 3) GPS surveying allows acquisition of a large number of high resolution observables at a relatively high speed. 4) GPS can monitor large areas without a drastic reduction in the precision of the measurements for 3-Dimensional (3-D) positioning information [22].
2.4.2 The Segments of GPS The GPS consists of three segments; the space segment, the control segment and the user segment, as shown in Figure (2.4) [20]:
P a g e | 2-16
Figure 2.3: The three segments of GPS
1- The space segment includes 24 satellites that broadcast navigation signals to receivers through carrier waves. Figure (2.5) shows the orientation of the 24 satellites that are distributed in 6 circular orbits with an inclination angle of 55o in groups of 4 satellites. Each satellite is located at 26,565.5 km away from the Earth’s center, orbiting the globe every 12 hours. The shown arrangement guarantees that 6 to 11 satellites are always in view at any point on the globe’s surface provided that they are not blocked by physical interruptions.
Figure 2.4: The orientation of the 24 GPS satellites
P a g e | 2-17
2- The control segment traces the satellites through ground control stations to monitor their locations and check their status. The need for this segment is for that the satellites can go out of their planned positions and may need adjustment to maintain the designed spacing in the GPS satellite network. 3- The user segment refers to the user-end GPS receiver that calculates the time that the radio signals travel from the satellites to the GPS receiver. The communication is “one-way” in the sense that the satellites only emit the radio signals while the user-end GPS receiver only receives the signals. A GPS receiver receives the signals from at least three satellites to calculate distance and uses a triangulation technique to compute its two dimension (latitude and longitude) position. To compute three dimension (latitude, longitude and altitude) position, at least four satellites is required [24].
2.5 Mobile Geographic Information System (Mobile GIS) Mobile GIS is the expansion of GIS technology from the office into the field. Mobile GIS accommodate the functionality of typical GIS for field-based personnel use to capture, store, update, manipulate, analyze, and display geographic information. The integrated software/hardware framework allows the access to the geospatial data and services through mobile devices via wireless networks. Mobile GIS integrates one or more of the following technologies as shown in Figure (2.6) [25]: Mobile devices. Global Positioning System. Wireless communications for Internet to access GIS.
P a g e | 2-18
Figure 2.5: Mobile GIS platform [26]
Traditionally, Geographic data travels into the field in the form of paper maps. The editing of these maps used to be performed using sketches and notes. Once back in the office, these field edits were deciphered and manually entered into the GIS database. This accumulated process does not allow the GIS to be updated frequently. Moreover, the processes of field data collection and editing are time consuming and error prone [27]. The rapid development of present science and technology, embedded mobile information equipment is an emerging product which is widely applied in human life. These embedded devices are popular for their small size, lightweight, portable and powerful. The needs of society and the development of technology have promoted the combination of GIS and embedded devices. Mobile GIS is a product of embedded systems which integrate GIS functionalities. At the same time, it is also an ideal solution for navigation, location, map querying and spatial data management [28]. The developments in mobile GIS have enabled GIS to be taken into the field as digital maps on compact mobile computers, which provide field access to enterprise geographic information. This enables organizations to add real-time information to their database and applications to speed up their analysis and display the data for enhanced decision making [27].
P a g e | 2-19
2.5.1 Advantage of using Mobile GIS: There are many advantages come by using mobile GIS devices for environmental management and habitat monitoring. For example field workers can easily carry mobile GIS devices to the field for data collection and validation tasks. With wireless communication capability, users can perform real-time data updates and exchanges between the centralized map servers and distributed mobile clients. Another advantage of mobile GIS solution is that the GIS framework can be integrated with the GPS equipment seamlessly to provide comprehensive geodetic measurements and navigation functions [29].
2.5.2 The Composition of Mobile GIS Mobile GIS is mainly composed by [25]: 1)The mobile smart terminal unit: The mobile smart terminal can serve as a client, which can be low consumption portable device.
2) Wireless communication network: The wireless communication network is a connecting bridge between the user terminal and application server. It is wirelessly transmits user's commands to the geography information application server, and then passes the server's analysis result to the user terminal. Presently, the most used wireless communication networks include; GPRS, Enhanced Data for Global Evolution (EDGE). 3) Server: Is the backstage service mechanism of the mobile GIS and includes the Web, GIS and database server. GIS application server is an essential part of overall system, and it has the following function: the data reorganization, storage, the basic geographic information inquiry and the analysis function. The server should have powerful computing ability and the ability of processing the massive visiting request. The database server is the storage center for the mobile GIS data.
P a g e | 2-20
4) Positioning: Can be achieved mainly through the built-in GPS module of mobile GIS. GPS positioning has high accuracy. Through positioning mobile users can be informed with the closest points of interest. Many parameters should be considered while designing mobile GIS for a specific application especially for emergency management. Generally there are five different architectures for mobile GISs [30]: a) Stand Alone Client This is the simplest mobile GIS architecture. In this architecture geodata, mobile GIS software and the customized application reside entirely on the client that is a mobile device. b) Client Server Here the geodata is moved to a separate computer and served to the client by GIS server software through a wireless network. However, dependency of this system to the continuous connection between the client and the server reduces its flexibility. In other words, if the connection failed, the mobile GIS will no longer work. c) Distributed Client Server Similar to previous architecture, geodata is stored in the server but some parts of the information are also stored into the mobile device. In this architecture, the mobile GIS (client) will be usable in all cases (disconnected from the server or not). The mobile device will connect to the server after disconnection and the data will be synchronized with the server. d) Services This architecture views the GIS server as a web service and allows for other web services to be part of the application. As long as these web services use the same communications protocol, the mobile device(s) can
P a g e | 2-21
communicate with all of them. Furthermore, the web services can also communicate between themselves. e) Peer to Peer A peer to peer architecture will allow for communication between mobile devices. Each mobile device will store a part of the information so that the need for a server can be removed.
2.6 General Packet Radio Service Over the last decade, demands of mobile communication have seen an explosive growth where the coverage of second-generation (2G) mobile communication standard such as Global System for Mobile Communications (GSM) reached (1.5) billion people across more than (212) countries. Many of these are emerging countries where the convenience of wireless communication can greatly enrich people’s lives in different ways [31]. GSM network is currently the most extensive coverage and the most common wireless communication network, so constructing data transmission system based on GSM network can have a wide range of applications, which can be well applied in
monitoring,
scheduling,
autonomous
navigation
system,
intelligent
transportation, and other remote data acquisition and control systems [32]. GPRS stands out as one major development in the GSM standard that benefit from packet switched techniques to provide mobile subscribers with the much needed high bit rates for burst data transmissions [33]. GPRS is a new type of data transmission technology based on the existing GSM network. Using packet switching mode, GPRS occupied wireless resources only in the actual send and receive data. GPRS can theoretically provide the transmission efficiency up to (171.2) Kbit/s. This means that through the portable computer, GPRS users can browse the Internet quicker than before, and the transmission rate makes some of sensitive mobile multimedia applications possible. In
P a g e | 2-22
addition to speed advantage, GPRS has "always online" characteristic that makes users connected with the network at any time [34]. GPRS is a low-cost wireless data communication system provided by cell phone operators. Cell phones are the booming technology reaching most parts of the world and crossing the boundary between the developed and the developing world. For this reason, GSM/GPRS is one of the best low cost possible communication media for data transmission [6]. GPRS is different from the Circuit Switched Data (CSD) connection included in the GSM standards. In CSD, a data connection establishes a circuit, and reserves the full bandwidth of that circuit during the lifetime of the connection. Theoretically, GPRS is ten times faster than the CSD service on GSM networks [31]. GPRS is packet-switched which means that multiple users can share the same transmission channel. This will allow the total available bandwidth to be immediately dedicated to those users who are actually sending at any given moment. Moreover, it will provide higher utilization where users only send or receive data intermittently [35]. GPRS achieves faster connection speeds due to a cutting-edge technology. The first is the General Packet. Rather than sending information in a steady stream through a single channel as current phones do, a GPRS enabled the device to break the information down into packets and send them over multiple channels (up to eight). Each packet travels by the quickest available route to the recipient, where it is reassembled into the original message. Sending packets by several different channels increases the speed of transmission and cuts down on signal errors [35].
P a g e | 2-23
2.7 Short Message Service over IP Short Message Service (SMS) is a mechanism of delivery of short messages over the mobile networks. It is a store and forward way of transmitting messages to and from mobiles. The message from the sending mobile is stored in a central Short Message Service Centre (SMSC), which then forwards it to the destination mobile. This means if the recipient was not available, the short message will be stored and sent later. Each short message can be no longer than (160) characters, which can be text (alphanumeric) or binary non-text Short messages [36]. This thesis will not use this technique because of the overall cost of the data will be greater in the case of using SMS than internet in transmitting the message. Therefore, SoIP will be used instead of traditional SMS. Figure (2.7) illustrates the architecture of SoIP and each block of this figure is explained below. According to this figure, the mobile phone or the soft phone delivers the short message (SM) to the SM gateway either using carrier or using TCP/IP link, then SM gateway forwards it to SMSC using protocols. At receiver side SMSC, it uses different protocols to deliver the message to the gateway [8].
Figure 2.6: SMS over IP Architecture
A. Short Message Gateway (SM-GW) SMS gateway is a device or service offering SMS transit, which is transferring messages to mobile network traffic from other media, or vice versa,
P a g e | 2-24
allowing transmission or receipt of SMS messages with or without the use of a mobile phone [36]. It sends the short messages from the Mobile Station (MS) or Soft phone over TCP/IP link to the SMSC and it is also capable of receiving short messages from SMSC [8]. A typical use of the gateway would be to forward simple e-mail to a mobile phone recipient. SMS gateway is a fast and reliable way for mass / bulk SMS sending. It deals with mobile service provider and sends SMS with sender identity as textual sender ID and authentication [36].
B. Short Message Service Center (SMSC) SoIP uses gateways to communicate with the SMSC, which can store messages in its database until they are successfully delivered to the user. The gateways perform protocol encoding and decoding with the SMSC. The protocols used at the SMSC can be Short Message Peer to Peer (SMPP), Universal Computer Protocol (UCP) or Computer Interface Message Distribution (CIMD). The SoIP provider for this work is using SMPP and Signaling System 7 (SS7). The SMPP v3.4 is an open industry standard protocol designed to provide a flexible data communications interface for transferring short message data [8]. SS7 is a set of protocols which provides fast, efficient, reliable transfer and delivery of signaling information across the GSM network. It supports both switched voice and non-voice applications. Moreover, it provides extremely fast data connections among mobile switching centers. This allows the networks to obtain Enhanced services data while the call is being connected [37].
2.8 Windows Presentation Foundation (WPF) This technology will be used in the Server and ESC of the system to provide the proper software interface. WPF is Microsoft’s new generation User
P a g e | 2-25
Interface (UI) framework to create applications with a rich user experience. It is part of .NET framework. WPF possesses rich interactive ability. It provides the UI, 2-D/3-D graphics, documents and multimedia support [38]. One of the key concepts of WPF development is an almost total separation of design and functionality. This separation enables designers and C# developers to work together on projects with a degree of freedom that previously required advanced design concepts or third-party tools. This functionality is to be welcomed by all; small teams and hobbyist developers as well as huge teams of developers and designers that work together on large-scale projects [39]. WPF includes the standard familiar controls, which draws every text, border, and background fills itself. As a result, WPF can provide much more powerful features that provide alter way for any piece of screen content to be rendered. By using these features, it is possible to restyle common controls, such as buttons, without writing any code. Similarly, transformation objects can be used to rotate, stretch, scale, and skew anything in the user interface, and even WPF’s baked-in animation system can be used to do it right before the user’s eyes [40]. The language used for user interface design in WPF is Extensible Application Markup Language (XAML, pronounced zammel).This is similar to the Extensible Markup Language (XML) used in ASP.NET, which uses XML syntax and enables controls to be added to the user interface in a declarative, and hierarchical way [39].
2.9 Windows Communication Foundation Another technology by Microsoft is used in this work to manage the communication between the Client, Server and ESCs. The WCF is a flagship product of Microsoft on Service Oriented Architecture. It is a part of the Microsoft.NET platform and appeared for the first time in .net3.0 [41]. WCF
P a g e | 2-26
enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments. It allows application to make function as services to provide the client service requestor [42]. These services can be accessed from other applications across machines and network boundaries. Moreover, these services can share functionality across multiple applications to expose data sources or to abstract complicated processes [39]. WCF fuses different distributed technologies and unifies them under one programming model, as shown in Table (2.1). In addition, WCF is designed to reduce development complexity and make developers, who are already familiar with existing technologies such as ASP.NET, .NET Remoting and Web Services, feel comfortable with the new technology. Moreover, while it provides integration and interoperability with the existing .NET technologies, it is also 25% to 50% faster than ASP.NET [43]. Table 2.1: WCF Feature Comparison [43]
Features WS -* Support Web Service interoperability .NET to .NET Communication Distributed Transactions Queued Messaging
WSE ASMX .NET Remoting COM+ MSMQ yes yes
WCF
yes
yes
yes
yes
Yes
yes yes
yes
yes
yes
yes
P a g e | 2-27
2.9.1 WCF Architecture The architecture of WCF appears remarkably simple. The services are deployed, discovered and consumed as a collection of endpoints, each of which is the fusion of the Address (A), Binding (B) and contract (C), known as ABC. The service must have at least one endpoint, as illustrated Figure (2.8) [43]. - An address defines where the service is located including the location of the server and the transport protocol. The location portion of the address indicates the name of the target machine, site, or network. - A binding defines how to communicate with the service. The communication relates to multiple aspects, such as message encodings, transport protocols, security options, and communication patterns. - A contract specifies what operations the service can do.WCF defines four contracts, including service contract which describes operations that the client can perform on the service, data contract which describes data types passed to and from the service. The third one is fault contract which depicts the errors raised by the service and how the service deals with errors. Finally, message contract which allows the service to interact directly with messages [43].
Figure 2.7: Communication through the endpoint
P a g e | 2-28
2.9.2 Message Exchange Patterns (MEPs) WCF offers various ways to exchange messages between client and service. These operation types are often referred to as MEPs. In general, the type of operation used to communicate with the service is part of the service; a certain MEP may even place some constraints on the allowed bindings as not every WCF binding actually supports all available MEPs. Throughout the next three paragraphs the various MEPs supported by WCF are presented [39]: A. Request-Reply Request-Reply is WCF’s default operation mode, which will be used in this work. Using this MEP, the client issues a call to the service in the form of a message and blocks until it gets a reply. If the service does not respond within the specified timeframe, the client will get a Timeout-Exception. B. One-Way In this case, messages are sent from the client to the WCF operation but no response is sent. This is useful when no response is required. For example, a creation of WCF operation can result in the WCF host server rebooting, in this case waiting for a response is not desirable. C. Callback / Duplex In this type, the WCF allows the service to call back the clients and invoke a client method. The process of duplex communication method is shown below in Figure (2.9). Callback operations are especially useful when it comes to events and notifying the client whether some event has happened on the service side. However, in order to enable the service to call back the client, it has to know the client’s endpoint IP address. Therefore, it is necessary for the client to call the service method. This saves the callback channel to the client’s endpoint for later use. Therefore, it will be possible for the service to send messages to the client and invoke certain methods.
P a g e | 2-29
Figure 2.8: Base schema of callback/ duplex communication [44]
2.9.3 WCF Communication Protocols The communication with WCF services can be done through a variety of transport protocols [39]: 1. HTTP: Gives the ability to communicate with WCF services from anywhere, including across the Internet. HTTP communications can be used to create WCF Web services. 2. TCP: Gives the ability to communicate with WCF services on the local network or across the Internet if the firewall is configured appropriately. 3. Named pipe: Gives the ability to communicate with WCF services that are on the same machine as the calling code, but reside in a separate process. 4. MSMQ: This is a queuing technology that enables messages sent by an application to be routed through a queue to arrive at the destination. MSMQ is a reliable messaging technology that ensures that a message sent to a queue will reach it.
P a g e | 3-30
Chapter 3: Proposed System 3.1 Introduction The proposed system presents a tracking system for succoring patients. This proposed system consists of three programming models; Server model, Client model and ESC model. The Server model receives the request from the client (patient’s mobile) and sends it to the nearest ESC, besides sending short message service over the internet to the predefined client’s (patient) emergency contacts. The second model sends a request to the server, which will pass the Client model request to the nearest ESC, which will provide the proper medical care within the geographical restrictions. This chapter will explain all tasks and operation of the programming models of the proposed system by using flowcharts, diagrams and algorithms. Each model will be revealed within the proposed system.
3.2 General Architecture of the Proposed Succoring System The operation of the suggested succoring system consists of multiple architectural steps as shown in Figure (3.1), which represents the relations among the three models (Server, Client and ESC). Figure (3.2) illustrates the general flowchart of the proposed system and summarizes a basic form of the system components to understand the communication processes occurring throughout the system cycle.
P a g e | 3-31
Figure 3.1: General architecture of the proposed system
P a g e | 3-32 Server (Web service + Database)
ESC
Client
Start
Run the web service Install application of client model on patent’s mobile
Add ID, latitude and longitude of all ESC to the system
Using the application Run the application
Open server and run the First service time
No
Yes Log in to the application by entering the ESC’s ID
Sign in, enter patient’s ID
New registration, fill the Information and confirm
Information saved in Database on the Server Help page appears which contains (Latitude, Longitude and a button for sending request to the server)
Get values of latitude and longitude from GPS satellites
Needs help No Yes Patient sends help request (ID, latitude, longitude) to the server
w Server receives the request and retrieve patient’s information from database and display his/her location on map, then send the request to the nearest ESC, at the same time server sends SoIP to patient’s emergency contacts ESC receives the request and patient’s information from the Web service and displays his/her location on the map
The succoring facility heads to the location of the patient
the patent Inform the server the request is processed
End
Figure 3.2: General flowchart of the proposed system
P a g e | 3-33
3.3 Server Model The server in this system contains a database and Web service. This server will be contained within a PC provided with an internet connection and it has a public IP address. The server should be running 24 hours a day, but will provide the tracking service to the patient only when the patient sends the help request to the server. The server works automatically, which means it does not need an operator for receiving the help request from client (patient’s mobile), sending it to the nearest ESC and sending the SoIP to the Emergency contacts.
3.3.1 Database The primary function of the database is storing the incoming data from the clients and saving it on the same computer of the server (no need for a separate server to contain the database). The saved data will be retrieved when requested by the Web service. The database of this system will contain four tables: 1- ESCs: The information in this table is about all the ESCs serving in the system for succoring the patients. The structure of this table is show in Figure (3.3).
Figure 3.3: Structure of ESCs table
2- New_ Request: This table will contain information about the new incoming requests from clients to the server. These requests will be moved from this table and saved in Request_info table after been processed by the ESC. Figure (3.4) illustrates the structure of this table.
P a g e | 3-34
Figure 3.4: Structure of New_ Request table
3- Registration: All the information about the registered patients in the system will be contained in this table. The structure of this table is shown in Figure (3.5).
Figure 3.5: Structure of Registration table
4- Request_info: The data in this table is all the requests that have been processed by the ESCs. The structure of this table is shown in Figure (3.6).
P a g e | 3-35
Figure 3.6: Structure of Request_info table
3.3.2 Web Service The main tasks of the Web service are explained in the Figure (3.7). The help requests that sent from the clients (patients) will be stored in the database (New_Request table) and will appear on the main interface of the Web service. All the information appears on the Web service and even the ones sent to the emergency contacts are displayed in straightforward fashion. For example, the Web service will convert the patient’s date of birth to a number that reflects the patient’s age. This will be done to facilitate identifying the patient’s age straightforward from the Web service message for the ESC’s staff. The age will be calculated for the date of birth as shown in Algorithm (3.1).
When the Web service receives the request from the patient, it will send the request to the nearest ESC from the patient and at the same time it will send SoIP to the emergency contacts of the patient to inform them that the patient needs help from them. The SoIP of emergency contacts will contain the (name, disease and location) of the patient. Algorithm (3.2) shows the programming steps of sending SoIP.
P a g e | 3-36
Start
Run the web service
Add ID, latitude and longitude of all ESC to the system
Wait for requests from patients
Is there request
No
Yes
Receive the request from Patient
Retrieve patient’s information from Database and display his/her location on the map
Send request of the patient with his/ her information to the nearest ESC and send SoIP to patient’s emergency contacts
End Figure 3.7: Flowchart shows main tasks of Web service
P a g e | 3-37
Input: birth date (year, month, day) of the patient Output: Age
Step 1: compare day with the current day
// get the current day form PC of server
If (day > Current day) Decrees Current month; Step 2: Compare month with the current month
// get the current month form PC of server
If (month > Current month) Decrees Current year; Step 3: Age= Current year – year; Step 4: End. Algorithm 3.1: Calculating the age of patient
Input: New request(s) Output: SoIP to emergency contacts of the patient(s) . Step 1: While (queue is not empty) Retrieve the ID of patient from queue
// base on priority
Retrieve patient’s information from database (New_Rrequest table) Send SoIP Step 2: End. Algorithm 3.2: Sending SoIP
P a g e | 3-38
As mentioned before, the Web service will direct received help request to the nearest ESC to the patient. Therefore, it will need to identify the nearest ESC to patient from the ESCs table. This is done first by calculating the distance between the entire registered ESC on the system and the location of the patient using Haversine equation. This equation gives great circle (shortest distances) between two points on a sphere from their longitudes and latitudes [45]. Algorithm (3.3) explains the calculation of the shortest distance based on Haversine equation between two points. Then the nearest ESC will be given by simple comparison of the resulted distances.
Input: (latitude1 (lat1) and longitude1 (long1)) of the ESC, (latitude 2(lat2) and longitude2 (long2)) of the patient Output: (d) is the distance between patient and ESC on the earth's surface.
Step1: R = radius of the earth (average = 6,371 km) Step2: Δ lat =lat2 - lat1 Step3: Δ long =long2 - long1 Step 4: a = Sin2 (Δ lat/ 2) / 2) + Cos (lat1)*Cos (lat2)* Sin2 (Δ long / 2) Step5: c = 2* Atan2 (Sqrt (a)* Sqrt (1 - a)); Step 6: d = R* c; Step 7: End
Algorithm 3.3: Haversine equation [45]
P a g e | 3-39
The main interface of Web service will contain the following parts:
1. Requests: This part of the interface will be used for displaying the number, information and location of the new requests, done request by ESCs, or both of them in the database. This can be done by selecting a period (start date, end date, start time and end data time). 2. Patients: This part allows the operator to search the patient’s information (using the search bar) by ID or disease. Moreover, it will let the operator to update this information and display the details of all the registered patients. Algorithm (3.4) illustrates the programming steps of displaying the results of searching for patient details (patient’s information) on a table. Input: ID or Disease name of the patient Output: Display information of patient(s)
Step1: If (ID is selected) Retrieve information of patient for entered ID Step 2: Else (Disease is selected) Retrieve information of all patients have that entered disease End if Step3: Display retrieved information Step4: End. Algorithm 3.4: Displaying the information of patient(s) at the Web service
P a g e | 3-40
3. Emergency Service Centers (ESCs): This part will be used for searching the information of ESC by entering its ID or to show all the ESCs that are added to the system with their latitude, longitude and display the total number of ESCs serving in the system. Moreover, in this part a new ESC can be added, updated or to delete an existing one in the system. Algorithm (3.5) explains the programming steps of adding a new ESC to the system, while Algorithm (3.6) illustrates the steps of updating the ESC information. Algorithm (3.7) explains the steps of deleting ESC from the system.
Input: (ID, latitude, longitude) of the ESC Output: New record in data base (ESCs table) Step1: Send the input data to the database Step 2: Calls Search ID function of the ESC If (the input ID is exist) // check the database Show error message (“This ID is already exists in database”) Else Calls add ESC function Add new ESC (new record) to ESC table Show a message (“New record added successfully") End if Step 3: End.
Algorithm 3.5: Adding ESC on the server model
P a g e | 3-41
Input: (ID, new latitude, new longitude) of the ESC Output: update the information of input ID Step 1: Send the input data to the database Step 2: Call Search_ ID function of the ESC If (ID exists in the database) //check the database Call Update function of ESC Update the information of this ID Show a message (“Record updated successfully") Else Show error message (“This ID is not exists in the database”) End if Step3: End. Algorithm 3.6: Updating the information of the ESC at the server model
Input: ID of the ESC Output: Delete record of this ID from database Step1: Send the input ID to the database Step2: Call Search _ID function of the ESC If (ID exists in the database) //check the database Delete record which has the input ID Show a message (“Record deleted successfully") Else Show error message (“This ID is not exists in the database”) End if Step3: End. Algorithm 3.7: Deleting the information of the ESC at the server model
P a g e | 3-42
List of Requests: It will contain all requests sent by the patients to the server for the last 24 hours; new requests (displayed with red color), under process requests (displayed with green color) and done requests (displayed with black color). The location of all requests that are in the list will be displayed as multi markers on the Google Maps contained within the Web service interface. When click on one of the available request, the patient’s location will appear as single marker on Google Maps and his/her address in an info window above the marker. Moreover, the information (phone number, name, age, request time) of the patient will be displayed under the list.
3.4 Client Model The client device is a handset held by the patient, such as a mobile with built-in GPS receiver and GPRS transceiver operating over GSM networks. The main operational steps of client model are illustrated in Figure (3.8).
P a g e | 3-43
Start
Install application of client model on patient’s mobile
Using the application
First time Yes
No
New registration, fill the required information and confirm
Information saved in database on Server
Help page appears which contains (Latitude, Longitude and a button for sending request to the server)
Get values of latitude and longitude from GPS satellites
Needs help No Yes Send help request (ID, latitude and longitude) to the server w End
Figure 3.8: Flowchart of client model
Sign in, enter patient’s ID
P a g e | 3-44
3.4.1 Registration on the Client Model Firstly, the patient should install the application on his/her mobile then fill all the required information fields, which appear first, to be registered in the database of the server. The information fields are as follows: 1 - Phone No: In this field, the patient should enter his/her phone number, which will be patient’s ID. After clicking on this filed the phone keyboard layout will be changed from the default alphabetic mode to the numeric mode. 2 - Name: This field should hold the first and surname of the patient. 3 - Birth Date: This filed will allow the patient to choose his/her birth date by using lists for day, month and year. Algorithm (3.8) illustrates the main programming steps used by the programmer for creating the lists of the birth date within client model. Input: Number of years Output: list of days, months and years Step1: End year= current year
//for determining the range of displayed years // for inserting the patient birth date
//get the current year from pc, e.g. current year=2013
Step 2: Start year= End year- Number of years
//e.g. start year=2013-50= 1963 // start year will be the first displayed year in the list
Step 3: For (int i=start year; i