Gefencing in ehealth Mbile Services Prject by Fatimah Zahra (7515) Faculty f Cmputer Science Free University f Bzen-Blzan Italy, 2009
Cntents Cntents...2 Figures...2 1. Intrductin...3 2. System Functins...3 3. User Interface...5 4. Architectural Design... 11 4.1 Patient s Implementatin... 11 4.2 Caregiver s Implementatin... 13 5. Limitatins and Future Wrks... 16 Figures Figure 1 Gefencing in ehealth...3 Figure 2 Use cases...5 Figure 3 Main screen f patients' applicatin...6 Figure 4 Bundary list screen...7 Figure 5 Add, edit and delete bundary screen...7 Figure 6 Main screen f caregivers' applicatin...8 Figure 7 Patients list screen...9 Figure 8 Add, edit and delete patient screen... 10 Figure 9 View lcatin screen... 10 Figure 10 Deplyment diagram... 11 Figure 11 Patients' class diagram... 13 Figure 12 Caregivers' class diagram... 15 2
1. Intrductin Currently, many elder peple with dementia live independently. These peple d nt feel entirely cnfident ging ut n their wn. They might just take a walk and frget where they are. This situatin can cause difficulties fr them and their caregivers. With the develpment f GPS technlgy in mbile phnes and gefencing, these peple might have mre freedm and safer t g ut. Gefence is a virtual bundary n a gegraphic area. The bundary is defined by set f crdinates. S the term f gefencing here refers t a use f lcatin-based service fr the prcess f setting up a virtual perimeter that smene r smething might crss. When the bundary is crssed, a user can be ntified. Figure 1 Gefencing in ehealth 1 Thus, t help peple with dementia stay independent, the authr decided t build a mbile applicatin that uses GPS and the principle f gefencing t keep track these peple. 2. System Functins This applicatin has tw types f user, which are: Patients Caregivers (dctrs, emergency services, nursing persnnel, health care prviders) The fllwing table is the detail descriptin f functinalities fr each type f users: Patients Caregivers Setting fr the bundary. Send alerts t the caregivers if patients are ut f the bundary and vibrate the patient s mbile Manage a list f patients. Receive alerts when the patients are ut f the bundary. 1 http://blgs.frum.nkia.cm/blg/art-hlpainens-frum-nkia-blg/2009/03/21/gefencing-in-ehealth 3
device. Update their lcatin peridically t the caregivers. Receive the last updated psitin f patients. View the lcatin f patients T have a better/clearer understanding f what this applicatin can d and hw, the authr has perfrmed several analyses which are screen and interactin, usage, and envirnment analysis. 1. Screen and interactin analysis The emulatr fr the caregivers is the DefaultClrPhne, while fr the patients is the DefaultGrayPhne. The mbile phnes fr patients need t have built-in GPS and supprt WMA (Wireless Messaging API). Mbile phnes fr caregivers shuld als supprt WMA. Fr the caregivers, they need mbile phnes with big screen size and high reslutin. Fr patients side: Patients need t give their cnsent fr being tracked. After they have agreed, the initial setting fr the bundary will be dne. After that, the patients nly need t turn n the applicatin. N ther inputs required. The bundary will be inputted at the initial setting f the patients mbile devices. The input will be the pairs f pints. Frm this infrmatin, the applicatin will create rectangle bundaries. Patients applicatin will send alert t the caregivers if they are ut f the bundary. Patients applicatin will update their lcatin peridically t the caregivers. Fr caregivers side: 2. Usage analysis Only patient s name, phne number, and status are being displayed in the patients list. The status f the patients will be displayed with clr sign. Fr this applicatin, green circle fr still inside the bundary, and red circle fr utside the bundary. Caregivers can view the lcatin f the patients frm the last update. Fr this usage analysis, use cases have been created t define functinalities fr each user s mbile phnes. The fllwing is the diagram: 4
3. Envirnment analysis Figure 2 Use cases The ther device/netwrk that this applicatin interacted is nly with the GPS satellite. 3. User Interface The fllwing are the detail flws f interactin between users and the applicatin. 1. Patients applicatin Launch the applicatin After user clicks Launch, main screen f the applicatin will shw. If n bundaries set yet, the status will shw NOT ACTIVE. This means that the functin fr checking the user s psitin against the bundaries is nt being perfrmed. After adding new bundary, this functin will start checking. 5
Figure 3 Main screen f patients' applicatin Set the bundary After the user click Set Bundary, the applicatin will shw the bundary list, with pair f pints in it. Frm the Menu, users can chse t Add Bundary, Edit Bundary r Delete Bundary. 6
Figure 4 Bundary list screen If user chses Add Bundary, the applicatin will shw an input frm t fill in with crdinates (latitude, lngitude). While fr Edit Bundary, the frm will be displayed with data pints selected. Als, if user wants t delete the bundary, a cnfirmatin message will be displayed befre the real deletin started. Figure 5 Add, edit and delete bundary screen 7
2. Caregivers applicatin Launch the applicatin After user clicks Launch, main screen f the applicatin will shw. User will need t click Enter t access the functinalities. Manage a list f patients Figure 6 Main screen f caregivers' applicatin After the user clicks Enter, a list f patients is displayed. The patients data that are being shwn cnsist f name, phne number and status f the patients. The status here means whether a patient is inside the bundary r nt. This situatin is represented by the circle where green circle means inside the bundary and red circle means utside the bundary. Frm the Menu, user can chse t Add Patient, Edit Patient, Delete Patient r View Lcatin. 8
Figure 7 Patients list screen If user chses Add Patient, the applicatin will shw an input frm t fill in with name and phne number f the patient. While fr Edit Patient, the frm will be displayed with data patient selected. Als, if user wants t delete the patient, a cnfirmatin message will be displayed befre the real deletin started. 9
View lcatin Figure 8 Add, edit and delete patient screen If user chses View Lcatin n a specific patient, the applicatin will shw the psitin f the patient n the map. The Details is fr displaying the last mdified time f patient s lcatin. Figure 9 View lcatin screen 10
4. Architectural Design Fr the architectural design, deplyment and class diagrams will be used. Frm figure 10, it shws that the deplyment f this applicatin is very simple and easy. It nly needs tw executin envirnments which are the users mbile phnes. Frm the patients phne, it will send messages t the caregivers phne. Als, nly patients phne cnnects t the GPS satellite. Figure 10 Deplyment diagram Fr the applicatin s implementatin, it will be described using class diagrams. Fllwing are the explanatins f the implementatin fr each user s types. 4.1 Patient s Implementatin The structure f the cde fr patients implementatin is described as fllws: Class Name Rle Name Main Methds Rle PatientMidlet extends MIDlet CmmandListener Main midlet createlcatinprvider::vid Create LcatinPrvider instance fr PatientGPSTrackter and PatientGPSUpdater class settickerstatus::vid startapp::vid Set ticker string t ACTIVE r NOT ACTIVE Display the main frm and starts 2 threads fr PatientGPSTracker and PatientGPSUpdater BundaryList extends List CmmandListener Display a list f bundaries getselectedbundary::bundary ppulatelist::vid Get the selected bundary Add bundaries t the list BundaryFrm extends Frm Create frm fr add and edit bundary addbundary::vid isinputvalid::blean Add the new bundary, cnnect t BundaryDAO Checking the input, return false if there is any empty field 11
Class Name Rle Name Main Methds CmmandListener setbundary::vid Set the bundary that is ging t be updated BundaryDAO Bundary PatientGPSTracker Runnable, LcatinListener PatientGPSUpdater Runnable, LcatinListener SmsSender Runnable PatientUtil Cnnect t the bundary database and perfrmed CRUD n it POJO fr represents a bundary Thread fr tracking patient peridically Thread fr updating patient s lcatin t caregivers peridically Thread t send messages t caregivers General utility class updatebundary::vid addbundary::vid deletebundary::vid getallbundary::vectr getbundaryid::int updatebundary::vid createbundary::bundary getdbstring::string getstring::string isequal::blean getxx::typexx setxx::vid checkbundary::blean sendalert::vid lcatinupdated::vid sendmessage::vid ladimage::image Rle Update the bundary selected, cnnect t BundaryDAO Add new bundary Delete a bundary Retrieve all bundaries Get the bundary id (recrd id) Update a bundary Create a bundary frm a String with frmat lat1 lng1 lat2 lng2 Return bundary in the database string representatin lat1 lng1 lat2 lng2 Return bundary in string with frmat (lat1,lng1),(lat2,lng2) Check whether this bundary equals with the bundary prvided in the parameter Getter and setter methds fr all the private fields Check the current psitin f the patient against the bundaries set Send messages t caregiver if the patient ut f the bundary and return inside the bundary. Send messages t caregivers abut the current psitin f the patient peridically Start a new thread t send a message t caregiver Read an image file and return the image The relatinship between classes is described in the fllwing class diagram: 12
Figure 11 Patients' class diagram 4.2 Caregiver s Implementatin The structure f the cde fr caregivers implementatin is described as fllws: Class Name CaregiverMidlet extends MIDlet CmmandListener, Runnable PatientsList extends List CmmandListener PatientFrm extends Frm CmmandListener Rle Main midlet and receive messages frm patients Display a list f patients Create frm fr add and edit patient Name prcessmessage::vid getselectedpatient::pundary ppulatelist::vid addpatient::vid isinputvalid::blean setpatient::vid updatepatient::vid Main Methds Rle Filtering incming messages. If it is an alert message, it will display a warning alert. Fr update messages, it will update the patient s lcatin in the database. While fr alert messages, it will update bth patient s lcatin and status in the database. Get the selected patient Add patients t the list PatientDAO Cnnect t addpatient::vid Add new patient Add the new patient, cnnect t PatientDAO Checking the input, return false if there is any empty field Set the patient that is ging t be updated Update the patient selected, cnnect t PatientDAO 13
Class Name Rle Name Main Methds Rle RecrdCmparatr the patient database and perfrmed CRUD n it attachpatientdata::patient cmpare:int deletepatient::vid Attach all data f a patient int the Patient instance, based n the phne number Fr srting the patients based n its name in ascending rder Delete a patient getallpatients::vectr Retrieve all patients updatelcatin::vid Update the lcatin f a patient updatepatient::vid Update the patient s data updatestatus::vid Update the patient s status Patient POJO fr represents a patient createpatient::patient getxx::typexx Create a patient frm a String with frmat phnen name status latitude lngitude lastmdified Getter and setter methds fr all the private fields setxx::vid PatientMap extends Canvas CmmandListener Display the patient s lcatin using the map cnvertcrdinatestxy::int[] getpatient::patient paint::vid Cnvert latitude and lngitude crdinates int XY crdinates Get the patient fr this map Paint the map and psitin f the patient setpatient::vid Set the patient fr this map DetailsFrm extends Frm CmmandListener Shw infrmatin f patient that is n the map DetailsFrm cnstructr Display a frm with last mdified infrmatin f patient s lcatin CaregiverUtil General utility class createscaledimage::image ladimage::image Scaled an image t fit in the screen size Read an image file and return the image The relatinship between classes is described in the fllwing class diagram: 14
Figure 12 Caregivers' class diagram In this implementatin, there are several cde reuses. Belw is the detail explanatin fr each reuse: Methd name: createscaledimage It is lcated at CaregiverUtil class and used fr fitting an image t the screen size. This cde was taken frm Frum Nkia Wiki 2. Methd name: secndalg It is lcated at PatientMap class and used fr cnverting latitude and lngitude crdinates int XY crdinates. This cde was taken frm CityGuide prject s example f Sun WTK. Prblem encuntered while implementatin was the mapping f latitude and lngitude crdinates int XY crdinates image map. This issue was slved by reusing the cde frm the CityGuide prject (example f Sun WTK) and adjusted the cde by changing a little the calculatin fr the Y-pint. Other prblem encuntered was the database access. If tw applicatins (patient and caregiver) ran tgether, ne f them culd nt read the database, and it depends n wh ran first. This prblem was slved by using different device emulatr, s the lcatin f the database will als different. Fr caregiver, it used DefaultClrPhne, while fr patient, it used DefaultGrayPhne. 2 Hw t Fit an Image t the Screen Size - http://wiki.frum.nkia.cm/index.php/hw_t_fit_an_image_t_the_screen_size 15
5. Limitatins and Future Wrks This applicatin has several limitatins. First, the bundaries are transfrmed int rectangles. Secnd, the map used is already fixed, which is nly fr arund Dum f Blzan. Third, the caregivers can t track the current lcatin f patients. Furth, the detail infrmatin displayed fr patients lcatin is nly the last mdified time. Thus, fr the future wrks, the applicatin shuld be able t transfrm the bundaries int flexible frms and track the patients current psitin. In additin, it will be better if the map displayed is using the GgleMap API, s that fr the lcatin f each patient, it will display a different map. 16