Developing Context Awareness Mobile Application for Blood Donation

— The implementation of context awareness in smartphones is getting broader. Through embedded sensors in smartphones, they are able to detect the device’s location and communicate through radio frequency. By communicating through Near Field Communication (NFC), smartphones are able to read NFC tags in short distances to understand the context of the information. Developing a mobile application in the context of blood donation will allow the application to assist donors through the process of donation and improves the user’s experience. The blood donation study is conducted at the National Blood Centre (NBC) in Malaysia. In developing the mobile application, the system architecture and development pattern were designed. The system architecture is presented to understand the requirements of implementing the application. The Model-View-Presenter (MVP) pattern was utilized to develop the application to ensure the development followed the standard procedure. The mobile application with the context awareness ability was evaluated through interviews with potential end users and the stakeholders of NBC. The evaluation resulted in positives responses and offered valuable feedbacks.


I. INTRODUCTION
Smartphones have become an important device for people to carry wherever they go.By 2018, the number of smartphones produced would have reached 2.53 billion [1].The reason for the high demand for smartphones is because of its capability to assist users in carrying out their daily tasks.The three patterns reflecting the capabilities of the smartphone are: logistical, relational, and informational [2].Finding the nearest gas station, browsing for information, performing online transactions and scheduling meetings are among the daily activities where smartphones can assist the users with minimum effort.
The capabilities of smartphones in performing the actions are boosted by embedded sensor devices such as Global Positioning System (GPS), Near Field Communication (NFC), accelerometer, gyroscope, and magnetometer [3]- [5].Smartphones capture surrounding data through these sensors and the applications analyze the data to generate results.By using the captured data, the applications can keep the users informed and the device's physical state [6].
The context awareness capability of smartphones have been used and applied in several areas such as mobile learning [7], mobile commerce [8], and healthcare [9].This research will apply the context awareness' capability in healthcare specifically in the process of blood donation.
In Malaysia, the main blood supplier for hospitals' usage is the National Blood Centre (NBC) [10].Through the investigation conducted in NBC, issues were discovered during the blood donation process.The following are examples of some of the issues.When a donor registers in blood donation counter, the registrar will request for the donor's donation book that contains the donor's history.If a donor does not bring the book, the registrar will then issue a new one.This situation is common especially when the donation was not planned.NBC also rewards loyal donors by giving prizes through the points collected through the donation but the points can only be monitored by NBC and not the donors.When blood supply is low, SMS are sent to donors to encourage donation.However, SMS has limited number of characters and is bound to the network cost each time it is sent.
The issues discovered can be handled more efficiently by utilizing the capability of context awareness in smartphones.This research paper proposes a context awareness mobile application which can assist donors through the process of donation and improve the user's experience.The mobile application is named Mobile Donation Assistant (MDA).

INTERNATIONAL JOURNAL ON INFORMATICS VISUALIZATION VOL 2 (2018) NO 3 e-ISSN : 2549-9904 ISSN : 2549-9610
This paper begins with introducing the capability of context awareness in smartphones and issues that occurred during blood donation which can be solved by developing a mobile application for donors.To ensure that the application is developed properly, the system architecture and its development pattern are designed explained in sections II and III.The developed application, being the main result is explained in Section IV.Section V shows the results from evaluation through interviews from prospective users and stakeholders of the NBC.This paper concludes with discussions and future works in these areas.

II. SYSTEM ARCHITECTURE
To develop the context awareness system, the MDA application is required to communicate with the sensors and other resources.This section discusses the components required in the system architecture and the scenario of communications supported by the architecture.

A. Components in System Architecture
Fig. 1 shows the system architecture.The roles of each component are described as follow: • Internet.Internet connection is the backbone of the system communication.• Google server.Google server provides two services are used by the application.Google Place service returns information about a geographic location or prominent point of interest.Google Cloud messaging service allows push messaging for Android devices.• Web service.The web service is developed with the PHP server-side scripting language.The web service locates the database according to the server location and connects to the database.When the web service receives a query, the web server translates it to a java script object notation (JSON).JSON structure can be read by Android as a JSON object [11].• Server.The server responses to the query and passes it back to the web service.• Database.The database is developed with MySQL and stores all data on blood donation and user data.• NFC tag.There are two kinds of NFC tags.The first NFC tag is placed at the registration counter known as the start tag.The second tag is placed at the bleeding room called the finish tag.The start tag represents the starting process of the donation while finish tag represents the end of a successful donation.Each of the tag contains two data: place of the donation (for example at NBC headquarter) and start or end.• Smartphone.In order to fully utilize the system functions, the donor's smartphone must be equipped with NFC, GPS, Wi-Fi or 3G connections with ample internal memory space.NFC is required to communicate with the NFC tag.GPS is required to obtain the phone's fine location.Wi-Fi or 3G is used to connect to the internet and also to acquire the phone's coarse location in case the GPS cannot be used (For example when the phone is inside a building).Internal memory is used to store user id and user setting so that the user would not need to sign in every time he launches the application.In order to fit the requirements, Android is chosen as the mobile application operating system.

B. Communication Scenario of the System Architecture
The system architecture is designed to match with scenarios of mobile application functionalities.The first scenario is when the mobile application requests, updates or inserts data into the database.The application performs the actions by communicating with the web service.The application sends a HTTP post method to the web service and the web service then translates it to a standard query language (SQL) executable command which will be passed to the server to obtain data from the database.
The second scenario happens when the user performs a blood donation.During the beginning and the end of the donation process, the application reads the NFC tag (The phone's NFC feature has to be activated to start this feature).When the phone is close enough to the a NFC tag (within 4 cm), the phone automatically reads the data and then opens the application.If the application has been opened, the application then reads the content of the data.If the content is detected as a valid tag, the application captures the starting or ending points of the donation process.After the application successfully reads the NFC tag, it will then update the information to the server database.
The next scenario is during the process of receiving notifications from the server.During user registration, the application requests for an application identification number with the Google cloud messaging service.After Google server responds with the identification number, the application stores it in the phone memory and in the server's database.The identification number is unique for each donor's phone, and is used to represent the donor himself.
When user activates the function of location awareness, the phone registers the donation site locations with Google location service.If the phone enters the areas that have been previously registered to the service, the service triggers the application and the application will notify a user.GPS and 3G or Wi-Fi is used to locate the location of the device from time to time.

III. MODEL VIEW PRESENTER OF MOBILE APPLICATION
A good mobile application has to be maintainable and wellstructured [12].To accomplish this, the development has to follow standard design patterns.The most suitable design pattern is the model view presenter (MVP) pattern.The MVP or other similar pattern provides a separation, which is useful for modularity, flexibility and testability between different layers of application [12].This section presents the process and explanation of the MVP pattern used by MDA application.

A. Process to Design MVP Pattern
The process starts by categorizing the code followed by the drawing of the diagram.The first step is to categorize the codes into categories suggested as by [13].Most of the codes fall under the presenter layer as they control the application's logic and views.Then the codes in the presenter layer are divided into two categories: adapters and helpers, or activities and fragments.The adapters and helpers are placed on top of the activities and fragments because they are 'closer' to the data which is presented in the model layer.
The next step is to draw the arrows as they represent which class triggers which other class.The arrows pointing to the view layers have a slightly different meaning.They represent the views that triggered the class so that the class triggers the others.The views placed in the view layer are supposedly all views that existed in the activities or in the fragments.In order to save the space of the model, only the views that caused the changes in the presenter layer are shown.

B. Components in MVP of the Application
In the model layer, there are three important components: Google API, web server, and NFC tag.Other components in this layer are the android operating system and model data such as donation, campaign item, user detail, and announcement item.Google API is used to create the phone's identification number and for passing notification from the server to the MDA application.The web server processes the request from the MDA and for retrieving data from the database.The NFC tag stores the string data representing the starting and ending of the blood donation process.
The presenter layer consisting of java classes exists in the program.This layer is divided to two parts which are the upper and lower parts.The upper layer is closer to the model layer which is why adapter and helper are in the upper parts.All adapter classes act as bridge communication between other classes to the data (existed in model layer) or external source.For example, GcmAdapter assists the connection and getting the identification number using Google API.GcmIntentService, GcmBroadcastReceiver and GcmMessageHandler are similar to the adapter but they assist in receiving incoming notification and passing it to the Android operating system.Then the operating system triggers the application in case the user chooses to open it.The helper classes' task is to simplify any process that seems complicated.For example, Date Helper helps in conversion of date format used in java to the date format used in MySQL.Since this conversion occurred in different processes, it is then more efficient to create a helper class.
The presenter layer's lower part consists of an activity and fragments.This application only has one activity which is MainActivity while the rests are fragments.All the fragments are embedded in MainActivity.This structure is used because of the ability to read the NFC tag.Reading and processing a NFC tag can only be done within an activity.To solve this, all fragments must live inside the activity.With this configuration, the phone will still be able read and process the tag regardless of what the user is currently using the phone for.
In the real meaning of view layer, a view displays the application state during each process controlled by the presenter layer.However, due to the limitation of the diagram space, this report only presents the significant view components that triggered the changes of the state.For example, SubmitButton is the view that determines the state changes of the registration process; MenuButton determines the fragment triggered by a user, etc. Fig. 2 shows the MVP pattern of the MDA application.

IV. MOBILE DONATION ASSISTANT INTERFACES AND FEATURES
The system consists of two main applications: back end and front end applications respectively.The back end application is a notification manager application which resides on the server side.The only function of this application is to send notification to the front end application.The front end application resides on the donor's smartphone.The front end application is called the Mobile Donation Assistant (MDA).The application has the following features: sign in, registration, main menu, making donation, checking donation history, checking announcement, browsing campaign sites and notification setting.

A. Notification Manager
Notification manager is an application developed for the NBC to broadcast an announcement to donors.The recipient can be filtered according to categories of: blood group, rhesus and validity days.Validity days are calculated based on the donors' last donation.The administrator can also modify the sender of an announcement.Fig. 3 shows the interface of the notification manager.When the administrator sends an announcement, the notification manager runs three operations.The first is to insert the announcement detail to the NBC database.Secondly, the application captures the Google cloud messaging (GCM) identification number of donors according to the filter given by the administrator.Lastly, the application sends the messages and GCM identification numbers to the GCM service.After that, GCM service automatically broadcasts to the donors' devices.

B. Sign In
Sign in is the first feature of the MDA application.If donors have been registered, which means that the donors have used the application previously, the donors would only be required to input their user id and login.When the application is reinstalled on different device, donors can obtain their previous record by providing the user id.All necessary information is stored in the server database.

C. Registration
Registration is a feature for donors when they use the application for the first time.The application asks input in terms of identity number, name, address and gender.The identity number is the data used to sign in.
During registration, three main processes will occur.Firstly, the application will search in database to check for duplication of the identification number.If no duplication was found, the application registers the application to the GCM service to obtain the GCM identification number.Lastly, the donors' data is stored in the database along with the GCM's identification number.

D. Main Menu
The main menu is the interface where all features of the MDA can be accessed by users.The buttons represents the features, the star image represents reward points collected by donors, blood drop represents the blood group of donors, picture in the middle represents donors' profile picture, and remaining days of donation is shown at the bottom.Fig. 4 shows the main menu's interface.

E. Making Donation
Making donation is a feature of the MDA to start and end the donation by communicating with NFC tags as well as to obtain reward points.Making donation has four interfaces representing the stages of donation: registration, blood group check, doctor check and blood donation.
Each of the interfaces is equipped with a list of processes happening at each donation stage and pictures supporting the processes.The other reason for using pictures is to motivate donors to be less anxious as the processes are normal in any blood donation.Motivational messages are also displayed on the interfaces to motivate donors of their contribution in helping to save lives.
Additional instructions are displayed on the first and the last interfaces asking users to put the phone on top of the NFC tags provided.When the phone successfully communicates with the tag, the instruction will change to a message that states the successful reading.
When the application reads a tag, several processes will occur.The first is validation to ensure that the tag recognizes the NFC tag's format and a correct NBC tag.Then, the application differentiates the content of the tag, whether the tag contains the start or end strings.If the tag contains the start string, the application will insert a donation record to database with a start value of 1.When the tag contains an end string, then the application will update the current donation record by changing the end value to 1.

Fig. 5 Making donation interfaces
When the start and end values become 1 then the application knows that the donation process has finished and reward points must then be updated.Fig. 5 shows the interfaces of start and end processes of making a donation.

F. Checking Donation History
Donors can check their donation history with this feature.The list of donations that have been made is displayed.Each item in the list is equipped with the place of donation, date and the status of donation.If donors have failed to donate on a certain date, a red cross image will appear on the left side.On the other hand, if the donors have successfully donated, a green check mark image will appear.
Donors can view details of each donation by pressing any of the items in the list.In the detail interface, additional information such as blood amount, blood component and doctor's note are shown for future reference.The additional information is input by the NBC staff.This means that the information is only available when the NBC has updated them.
Fig. 6 shows the interfaces for checking history

G. Checking Announcements
Donors can view announcements sent by NBC using this feature.For each announcement, a title, a message and announcement date will be shown.

H. Browsing Campaign Sites
This feature allows donors to browse campaign sites held by NBC according to their desired date.The list of campaign sites will appear along with the organizers name and status of the campaign.Status of a campaign site is coloured with red if the campaign has passed and green if the campaign has not yet been carried out.The interface of list of campaign sites is shown in Fig. 7 (left figure).
Donors can also view details of each campaign site by choosing the desired campaign site on the list.A detailed campaign site interface is shown in Fig. 7 (middle and right figures).Additional information shown includes location, date and time of campaign sites.
The MDA application also provides additional assistances to donors if they are not familiar with the campaign site's location.Donors can view the location on Google map or request Google map to navigate them directly to the location.

I. Notification Setting
There are two main settings that user can set: reminder and campaign site location awareness.Reminder is used to remind donors when would be the next suitable time for them to give donation again.Users can modify a suitable time for them to receive the notification.Fig. 8 shows the interface of notification setting.
The second setting is whether users want to be notified if users are near the current active campaign sites.Near means that the user (which means the smartphone) is detected to be in certain radius to any campaign sites' location.If this setting is activated, a notification will when the user enter the area.
There are a series of processes that will occur before the location awareness feature can be activated.Firstly, the application loads the campaign sites' information from database to grab the address of the campaign sites.Then, the addresses are converted into longitude and latitude coordinates.At times, the addresses provided by NBC are not complete which will result in failure in conversion to coordinates.If the coordinate conversion succeeds, the coordinates are then registered to Google location service, along with the radius and expiry time.Expiry time indicates the duration of Google location service storing the coordinates.
An appropriate expiry time is crucial for users so that the registered coordinates do not conflict with other applications existing in users' smartphone.This is because of the restriction from Google of a maximum number of coordinates that can be registered being 100 for each device [14].Because of this, MDA will apply a 12-hour expiry time.The reason of choosing 12 hours is because campaign sites coordinates are updated every day at 7 am and no campaigns will be active after 7 pm.The mobile application of MDA is evaluated by interviewing potential users (blood donors) and stakeholders of NBC.Both parties have different points of view and different needs.Therefore, it is essential to obtain feedback from both parties.The number of potential users for respondents was not limited but the interview will stop when it reaches a saturation point.Saturation is reached when the researcher gathers data to the point of diminishing returns, where nothing new is being added [15].Theoretical saturation, in effect, is the point at which no new insights can be obtained, no new themes identified, and no issues arise regarding a category of data [16].
The main objectives of the interview are to obtain feedback of the functionality usability of the application prototype.To acquire the feedback, respondents are requested to perform a series of tasks (based on the functionalities of the application).After respondents have finished executing each task, the interviewer asks a series of question regarding the task.The feedbacks from the respondents were then recorded.
Aside from obtaining the respondents' feedback, the behaviour of respondents during the usage of the application was also observed.This observation is important to improve the user interface and overcome any unexpected behaviour.
At the end of the interview session, the interviewer asked questions that summarized the response of respondents.The questions cover suggestions for new functions, overall comments regarding the application and whether the respondents would want to use the application if it is available.The results of the three questions helped to determine whether the respondents felt positively about the application or otherwise.
If there was a software bug during the testing, the probable cause would also be recorded.When the bugs are significant enough to disrupt the evaluation, then the application is repaired before the next interview is carried out.Fig. 9 shows the process of obtaining the evaluation.

A. Evaluation Result of Mobile Application Prototype
Three NBC's workers and nine donors were involved and evaluated the application.NBC's staffs include the chief of the Information Technology department, a programmer and a blood expert.Most donors have donated between one and ten times.
Both stakeholders and potential users responded positively to the application.All users liked the application and they would want to use the application if it is implemented.Only one donor was not sure as the donor has passed the allowable age for donation.The stakeholders also like the application stating that it would be useful if it is implemented.

B. Problems during Evaluation
Although positive responses were received, some problems occurred during the evaluation.These were functionality problems and usability issues.The following are some selected issues chosen because of the importance and relevance to the improvement of this application.

1) Loading Speed
One of the weaknesses of the application is the dependency on the Internet.Most of the operations in the application required a communication with the server.When there is no Internet connection or when server has a problem, the user is unable to run the application.
At the beginning of evaluation, loading speed was considerably slow and at time with no progress.This problem occurred because of the low server bandwidth.This issue has been solved by migrating to the university's server.

2) Usability issues on Making Donation Function
Making donation is the most complex function for users because it requires active participation from users.Users are required to tap buttons during the donation process and were also required to place the phone on top of the NFC tag.
The first issue is with the buttons.On the application's interface, the buttons were not as clear as the pictures and the instructions (refer to Fig. 5).Users tend to focus on the pictures and the instructions rather than the buttons.This issue could be solved if the application provides a guide for first time users.Another way to solve the issue is to change the colour or the placement of the buttons.
The second issue is with the instruction to place the phone on top of the NFC tag.None of the respondents have the experience in using the NFC feature.This proves that although NFC technology has been introduced to Android phones since 2010 [17], the adoption to real system in Malaysia is still not as widespread [18], [19].Furthermore, there are two different tags that users are required to use with the correct sequence (Start tag then finish tag).This issue can be solved by guiding the user during registration and after donation finishes.

C. Feedbacks and Suggestions
Both end users and stakeholders offered good feedbacks and suggestions.The following are some important feedbacks and suggestions: 1) The Idea of Replacing Donor Book All respondents from the end users liked the idea of having the mobile application replacing the donor's book.This is because respondents will always bring their phone but not the donor book.Most of the respondents seldom brought their donor's book to the donation site.However, this idea received different responses from NBC.
According to the stakeholders from NBC, using the mobile application as the donor's book is not merely moving donation  ).Therefore, the book can be used as legal evidence that the donors have donated.In other words, the mobile application would need to obtain approval before the NBC can declare that it can replace the donor's book.This issue will be more challenging as not all donors will have NFC-equipped smartphone.This issue however, can be solved through different approaches.Firstly, the NBC can implement an official mobile application which can then be proposed to MOH for approval.Secondly, the NBC can release the mobile application without announcing that the application replaces the donor's book.When this is installed by many donors who would have used and enjoyed the advantage of the application, there is a stronger case for the NBC to propose for the replacement.

2) Suggestion to Add Additional Information
Many respondents suggested that more information regarding blood donation or health knowledge to be included.Information that respondents suggested include: donation reward points, donors' donation report, help page, etc.The mobile application prototype can show the reward points and donation history.However, the respondents wanted more detailed information such as the services that donors are eligible to redeem with the collected reward points, information about donation screening status, diseases detected in donors' blood, etc.
The suggestions to add more information can be interpreted in different ways.Firstly, although monetary payment is not suitable as reward [20], donors' health information can motivate donors to donate.This was discovered by Bart et al. [21] that one of the obstacles for users to enroll blood donation is when they do not get any medical advice.

VI. CONCLUSION AND DISCUSSION
This paper has presented a context aware mobile application which is developed to improve user experience in blood donation.The application has context awareness ability in terms of location and process.The location context is presented by sensing the proximity of user's location with the donation campaign site.The application is also able to distinguish the current blood donation process when the user interacts with NFC tags.
The system architecture and programming design pattern have been presented and explained.The architecture and the pattern supported the foundation of mobile application development.
The developed application received positive feedbacks from potential users and stakeholders of NBC.The users expected the application to be implemented to assist them with the donation process.The stakeholders also felt that the application was helpful for donors and can attract donors to the donation site even if they might not have the intention to donate in the first place.
Positive responses have been received, but the interaction through NFC communication is the most challenging feature for donors even though it shares the most valuable context aware feature.There is a big gap in technology adoption.The lack of knowledge and experience of donors using the technology hindered the true potential of this application.
The other drawback of the NFC communication in this mobile application development is security.Encryption and decryption were not implemented during the reading of NFC tags.This enables the NFC tags to be read by any NFC reader.
The other important lesson received from the NBC stakeholders is the aspect of legality of information.Developing a mobile application will not merely be on fascinating features with latest technology, but must involve legal considerations.Replacing the donor's book with the application is not merely transferring information from nondigital to database but it requires the approval and acknowledgement from MOH.This is a similar situation that occurred to Grab and Uber where legality took high priority before the mobile applications can be used [22].

Fig. 2
Fig. 2 Model View Presenter of blood donation assistant application

Fig. 9
Fig. 9 Process to perform evaluation