Home
DT099G Report -- Xiaojie Liang(xili1100)
Contents
1. dataType json success function data get the data j ih Synchronization The Google Calendar could catch the changes quickly and make all the events belong to the same account thus remaining the consist ency This organization s event database should also maintain the con sistency with the Google Calendar Google provides access for client ap plications to view and to update calendar events in the form of Google Data API feeds With the powerful Google Calendar Data API this web could create new events edit or delete existing events and query for ex isted events 28 4 5 5 4 5 6 Exercise Monitor on E healthcare System X Liang 2012 06 05 However the question then involves how to know that an event existed in the Google Calendar The unique id is written into the title of the event in order to solve this problem When it is necessary to delete the old event the application will search the event whose title contains the unique id and then delete the event that have been found File Receiver The display on the daily consumption depends on the file up loaded by the client phone Generally uploading a large file which is greater than 2Mb should choose socket programming which supports the resumption of transmission Http transmission is stateless and the transport scale is limited by the server s hardware configuration Gener ally http transmission only supports a file size of less than 2
2. 2 1 3 SEODG oid oie pul ated idea eds EDU MEIN tens Hades dust eects eee dasandeagameaund ate qa Ms 2 1 4 Concrete and verifiable goals ier er tite ten ar rep reg 6t 2 1 5 Oute MUN E ERRIN deat E a A cite EE 3 1 6 Contributo NS etc REN peer a tet ae EEA 3 2 TIGOEY EE ETE E E EE ETER 5 2 1 Mental illness and exercises 2e dott debe sa ba ce etre UP M ES AYEH denied 5 2 2 Privacy POC sweats iae es trahe tet de ag recurs d qe ide e EN ga 5 2 3 Introduction Android 4 0 essere 6 2 4 Str ts Hibernate SpEIIE s o sepe eto evi deo eva sri one du ee EN rr n A E RANT rna 6 3 MetliodOl0ogy 5 sisiicvices een eoe ca 008 550000 60 se UR CE SNM EE NIB Poss Ges be VERE TEM URS G do To po ed 8 3 1 Phone application tnodel iia sectas thes ette t ter barrio Eod edge 8 3 2 Interactions between the participaltS sssesssssesrrsssrsrerersrnrrsrrrrrra 9 3 3 Observer mechanisms of the phone application sesssssrrsssere 9 3 4 WAN A beans mod Lose tei eed ed ee ethane ia asd ies 10 4 DSIDIL EE 50 000500 500000 s 00s 00 s sve ss Grd E EEEE 11 4 1 Overall framework design 62 i eas t rer eor eter pd e dati Boe din 11 4 2 Phone client program CeSigl ssseesrsrersrsrrrrsrsrnrerrnnrersnrnrrsrrrnrr sr nr rr enn 11 4 2 1 GPS service mip lemenit ation 5 lt 5 ucc ecu ese etordi ut o Yap dea dido mu pn es 12 4 2 2 Calendar service implementatlOD decise et eei nte tnos 15 4 2 3 Pedometer service and TextToSpeech servi
3. Mb It was observed on the file feature that even if the whole day s records were written inside the file size is still small The most important considera tion is that the socket server is independent of the web server it is cost consumptive to maintain two servers Finally the http pattern is selected to build the module for the file receiver Consumption Display When the file uploaded from the phone is received the web could display the daily consumption to the healthcare person F Insert title here Q O localhost 8080 MyWeb energyShow jsp pid 1 You Mark Patient Logout service4liang 20120524 Mo Tu we m fr sa suf poa 7 T 7 8 9 10 11 EN po _ o 8 Figure 4 26 the daily consumption pages 20 Exercise Monitor on E healthcare System X Liang 2012 06 05 Referring to the Figure 4 26 a date was selected and the corres ponding conclusion will be shown in a form In order to improve the user s experience the newest JavaScript Calendar JSCal2 11 was used as a tool in order to easily select the date 30 5 1 Exercise Monitor on E healthcare System X Liang 2012 06 05 Results GPS calories collector Figure 5 0 Google Map Sundsvall Nacksta ICA Campus Refer to the Google Map above the tester walks from the Nacksta ICA supermarket to the campus which takes nearly 20 minutes The data is extracted in a form
4. direction sensor and then to analyze these data so as to draw a conclusion regarding the number of calories that have been consumed within a certain period of time At the end the fi nal part of this work will involve the integration of the two parts into one complete application On the healthcare person s side a website should be designed to enable them to deal with the calendar events and to be able to look at the daily exercise report Scope The focus of the project is on the realization of an intelligent re minder in relation to calendar events Observations based on the results of a practical test have shown that the reminder is distinguished by its strong applicability and high sensitivity However for more accurate data with regards to calories consumption not only has a pedometer been chosen as an energy collector but in addition the energy collector has been improved by using GPS In the future it might be possible for this energy collector to be replaced by a more precise instrument At the beginning of this project Nike shoes were chosen to record the steps as they were found to be the most accurate However it was discovered that the chips in these shoes are only available for the iphone and the system for this report is based on Android which is widely used world wide and could thus be cheaper than the iphone It was however felt that the conclusions drawn in relation to the energy collector for this project should be
5. of trigger handler will assist in improving the performance of this application 3 4 Java beans model Data request Jsp Manager Spring aop RE Hibernate relation table gt Figure 3 4 Java Beans Model other tables As can be seen in figure 3 4 when the Java server page requests the data from the Manager class the Manager class attempts to obtain the data from the database through the Hibernate framework the Spring framework interceptor will stop this behaviour and will invoke the validate method in order to check whether or not the access to the database is legal If it is legal then the Manager class is allowed to con tinue running If it is not legal then all access to other tables will be pro hibited 10 4 1 4 2 Exercise Monitor on E healthcare System X Liang 2012 06 05 Design Overall framework design Figure 3 2 shows the basic implementation of the whole project Supported by the instantaneous synchronization of Google Calendar this project would establish two client programs for the phone and the web respectively The phone application is able to read the calendar s events through a built in Google Calendar and the healthcare person could write the events to the Google Calendar through the web A de tailed exhibit is shown in figure 4 0 as follows Google Server create new event Or del
6. shown below Table 5 1 location records only for test not recorded in the application P lt lt f rr Ss ay 24 13 11 34 17 260527899488807 May 24 13 12 40 62 390748099423945 17 26 ay 24 13 13 44 17 263594921678305 ay 24 13 14 49 17 26581646129489 May 24 13 15 51 62 3917374573648 17 266081580892205 ay 24 13 16 56 17 268011178821325 ay 24 13 18 01 17 269227895885706 May 24 13 19 09 62 393415346741676 17 27113176137209 ay 24 13 20 17 17 272433303296566 ay 24 13 21 47 17 275233613327146 May 24 13 22 52 62 39255666267127 _ 17 27557006292045 ay 24 13 23 57 17 279988918453455 ay 24 13 25 03 17 28068989701569 May 24 13 26 09 62 39304180722684 17 28110228665173 27 15 62 39318899344653 17 28263173252344 N A C2 j N O N C2 No e junk A Q A C2 M N O1 m A O1 m M N O1 NO N N Qo Qo N Oo N N Oo m Qo Hx Z ElEIE ed S Z S SISIS S S S E lt N m i Oi 31 5 2 Exercise Monitor on E healthcare System X Liang 2012 06 05 Table 5 2 distance time duration speed between two points 8s jii 25188m jas eas 1755 The table 5 2 shows that the calorie consumption each minute It should be noted that the GPS calories collector works accurately out doors and indoors although it still works it is of a greatly inferior qual ity Thus another calories collector was created for use both indoors and outdoors The pedometer collector wo
7. the body spirit and mind especially on the way home from the work place Activity and exercise are very important for people living with mental illness Indi viduals living with mental illness often have a higher risk for heart dis ease and exercise can play a key part in a wellness plan Activity and exercise are great ways to combat factors that are part of heart disease risk stress high blood pressure weight gain and diabetes all problems commonly found among people living with mental illness Exercise plays a key part in elevating your mood and regulating sleep patterns 3 Relevant researchers have demonstrated that exercise pos sesses antidepressant properties Other research has shown that exercise can improve the functions of the brain In the official website of Nation al Centre for Biotechnology Information a paper is included to state the relation of physical activity and exercise to mental health 4 It be gins with Mental disorders are of major public health significance It has been claimed that vigorous physical activity has positive effects on mental health in both clinical and nonclinical populations This paper reviews the evidence for this claim and provides recommendations for future studies 4 Privacy policy Consider the features of this system the system will inevitably in teract with the user directly or indirectly The following description states the measures taken by the users personal i
8. the windows phone Based on the open source platform of android it is relatively easy to acquire the data from differ ent phone sensors about the accelerated speed and different directions In addition it is also possible to obtain accurate geographic locations by means of satellites signals Large amounts of data are also able to assist in the calculation of the energy consumption of an owner of such a phone over a certain period of time According to the record of the calor ies consumed the phone is able to call an intelligent alarm to remind the patient that the energy consumption did not meet the requirements set by their doctor On the other hand it is also possible for the doctor to specify a detailed schedule for his her patients by signing in to a certain website by means of a computer This then means that the calendar events will be synchronized to Android phone belonging to the same Google account 1 2 1 3 1 4 Exercise Monitor on E healthcare System X Liang 2012 06 05 Overall aim The project s overall aim is to achieve an intelligent design for a smart phone reminder and a location separation of the participants Two people in one group are involved in implementing this theme project The author of this project will implement an intelligent reminder and collect the location data by means of a GPS sensor The work of the second member of the group is to collect large amounts of data from the phone s gravity sensor and
9. to create Struts 2 The 2 x framework is the best choice for teams who value elegant solutions to difficult problems 6 Hibernate is an open source framework used as a middleware which maps from Java classes to database tables Through the encapsulation of Hibernate it becomes possible to visit the database tables in a similar manner to process object oriented The convenience of using Hibernate is that Hibernate takes care of the mapping from Java classes to data base tables and from Java data types to SQL data types In addition it provides data query and retrieval facilities It can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC 7 Spring is an open source framework consisting of many widely used modules The Spring Framework helps you build Java Applications faster because it allows you to focus on your business problem rather than the plumbing code that connects components and systems 8 3 1 Exercise Monitor on E healthcare System X Liang 2012 06 05 Methodology Phone application model Pedometer Calories SD card Calculator GPS Google i Calendar Remus Figure 3 1 core model of the whole application Referring to figure 3 1 This shows the core model of the whole phone application As can be seen a pedometer or GPS are used as the calories collectors At any gi
10. A OC cos wA BD sin wB OD R cos wB BE R sin wB sin w A AB AE BE 13 Exercise Monitor on E healthcare System X Liang 2012 06 05 AB R R 2 R xcos Z AOB dp 408 180 The formula is only applied to that the location with east latitude and north longitude which is fortunately suitable for a Swedish geo graphic location After the value of speed has been obtained another formula can be used to calculate the caloric expenditure during physical activity Energy Expenditure Formula kcal per min 0 0175 METS body weight kg Example A person weighing 75kg walking at a speed of 4mph 4METS will use approximately 0 0175 4 75 5 25 kcal per min METS is the abbreviation of metabolic equivalents Different values are shown in table 4 4 Table 4 4 METS values METS Type of exercise 2 56 Walking 1 88mph 2 5 Walking 3 00mph 6 0 Walking 4 00mph 9 8 Running 6 00mph 11 0 Running 7 00mph Finally the calories collector must record the segmented consumption into a file The file s standard format appears as follows lt xml version 1 0 encoding UTF 8 standalone yes gt lt root gt energy start xx end xx gt xxx lt energy gt energy start xx end xx gt xxx lt energy gt lt root gt 14 4 2 2 Exercise Monitor on E healthcare System X Liang 2012 06 05 Calendar service implementation When t
11. Bachelor thesis Major Subject Exercise Monitor on E healthcare System Xiaojie Liang xili1100 student miun se 09 Mittuniversitetet MID SWEDEN UNIVERSITY Campus H rn sand Universitetsbacken 1 SE 871 88 Campus Sundsvall Holmgatan 10 SE 851 70 Sundsvall Campus stersund Kunskapens v g 8 SE 831 25 stersund Phone 46 0 771 97 50 00 Fax 46 0 771 97 50 01 Exercise Monitor on E healthcare System X Liang 2012 06 05 Abstract With the rapid development of terminal hardware mobile users and network environments the scale of the mobile Internet appears to be catching up with the desktop Internet Positioning System phone sensors and applications which are able to be used anywhere have caused the arrival and increase in usage of the smart phone and the world has become mobile first Within medical fields the smart phone is also regarded as an acceptable assistant for nurses and patients as based on the advantages of mobile Internet It is possible for healthcare personnel to assign tasks for the patients from a different place if there is a computer connected to the Internet In addition the smart phones is able to act as a nurse and remind the patients to complete their tasks Accordingly it has become a necessity to achieve this electronic healthcare system for hospitals The objective of this research project is to summarize the procedures of this development and release the relevant software based on an Andr
12. JavaScript API V2 Reference https developers google com maps documentation javascript v2 reference 4 June 2012 The New Coolest DHTML Calendar http www dynarch com projects calendar 14 June 2012 35 Exercise Monitor on E healthcare System X Liang 2012 06 05 Appendix A Documentation of own developed program code See the attachment MyWeb_US war and CalendarOps_US rar 36
13. aders Preview Response Cookies Timing Request URL http 192 168 1 2 8888 videoweb video manage do Request Method POST Status Code 9288 OK Request Headers view source Accept text html application xhtml xml application xml q 0 9 g 0 8 Accept Charset IS0 8859 1 utf 8 q 7 q 8 3 Accept Encoding gzip deflate sdch Accept Language zh CN zh q 8 en US q 6 en q 4 Cache Control max age 8 Connection keep alive Content Length 509 Content Type multipart form data boundary WebKitFormBoundaryAgqh81gXGXALoq8xA Cookie JSESSIONID D1C630B667E1CF39B36B732A67EEB47B Host 192 168 1 2 30380 Origin http 192 168 1 2 3080 Referer http 192 168 1 2 8080 videoweb User Agent Mozilla 5 Windows NT 6 1 AppleWebKit 536 5 KHTML like Gecko Chrome 19 0 1084 52 Safari 536 5 v Request Payload WebKitFormBoundaryAqh8lgXGXALoq8xA Content Disposition form data name title new txt remm WebKitFormBoundaryAqh81gXGXALoq8xA Content Disposition form data name timelength neemen WebKitFormBoundaryAgh81gXGXALoq8xA Content Disposition form data name video filename new phone number txt Content Type text plain Egi WebKitFormBoundaryAqhBlgXGXALoq8xA Content Disposition form data name method reme WebKitFormBoundaryAqh8lgXGXALog8xA Figure 4 14 http request headers Referring to figure 4 14 the custom http request could be written ac cording to the http protocol standards The code implemen
14. ants As mentioned previously the objective of this project is to separate the healthcare person from the patient and the smart phone will take the place of the healthcare person With the powerful mobile synchronization technology of Google Service all the changes of the calendar s events will respond to the user s smart phone at a very fast speed Additionally there it is neccessary for the healthcare person to know about the exercise situation of his her patients Therefore the smart phone application must upload the calories record file to the web server Observer mechanisms of the phone application Calendar Observer add new event send notification Content Provider Figure 3 3 observer mechanisms Figure 3 3 shows that the phone application is running independently and it is unable to read the data from calendar all the time which is a waste of CPU However it is sometimes the case that the changes of the calendar events should respond to the application at a given time Fortunately based on the Android platform an observer mechanism which is similar to a listener could assist the phone Exercise Monitor on E healthcare System X Liang 2012 06 05 application to obtain a timely notification when the content provider changes Referring to figure 3 3 when the calendar events changes the calendar provider will send notifications to the observer who is listening for it The type
15. applications can contribute events to the calendar and manage reminders for an integrated view across multiple calendar providers The app is redesigned to let you manage events more easily Calendars are color coded and you can swipe left or right to change dates and pinch to zoom in or out agendas 5 Based on Google Calendar s synchronization technology the phone s calendar and the server s calendar are always consistent This offers an easy means of maintaining a unified calendar Struts Hibernate Spring There are three open source frameworks which are rather popular in J2EE web development Struts Hibernate and Spring With the integra tion of these three frameworks it is possible to build a robust website which also involves simple maintenance Generally speaking Struts is an open source framework used to de velop web applications using an MVC Model View Controller design pattern based on Servlet JSP and Java Beans The Apache Struts Project offers two major versions of the Struts framework Struts 1 is recognized as the most popular web application framework for Java The 1 x frame work is mature well documented and widely supported Struts 1 is the Exercise Monitor on E healthcare System X Liang 2012 06 05 best choice for teams who value proven solutions to common problems Struts 2 was originally known as WebWork 2 After working independ ently for several years the WebWork and Struts communities joined forces
16. ased on the Android platform Chapter 4 describes the relative designs of cli ent side design and the website design Chapter 5 describes the pro cesses involved in testing the different modules Chapter 6 gives the conclusion about the whole project Contributions As mentioned previously two people are involved in imple menting this theme project The main work of the author is to design the intelligent reminder GPS data collector and healthcare person website while the second person s work is to design the pedometer so as to col lect data for the energy calculation The two parts are finally integrated 3 Exercise Monitor on E healthcare System X Liang 2012 06 05 in order to provide a exercise monitor for the complete e healthcare sys tem In order to improve the appearance of the web page a search was made for attractive and simple web pages online From the Google offi cial site 1 the Cascading Style Sheets css file were downloaded and they were used to become part of the web page Furthermore FullCalen dar 2 is one of the well known calendar jQuery plugins that assists de velopers to quickly build calendar functionality in the foreground With the assistance of FullCalendar it is possible to create a powerful calen dar such as the Google Calendar 2 1 2 2 Exercise Monitor on E healthcare System X Liang 2012 06 05 Theory Mental illness and exercise Walking and running have positive effects on
17. ce implementation 17 4 3 Alarm d s 1193 2555 ae ashes ses neto Ves asd cabs toe Habd efe Ee Maud M ede ci uM EN 18 4 4 Upload tile des totic aiat v Heber tar etri decode 21 4 5 Web client program Cesta 2i uero odores Seren au o Peg uve eub d epp 22 4 5 1 Account Manager uso disc doe hatte counts usd dus ieu 23 4 5 2 Validation before quety este ur esae eese Ere ce Pe oi e sud 25 4 5 3 Calenddtz dae etatis i ned e Se uide tette i p e protinus 26 4 5 4 SVnehrofiTzatigfis oe cot ese ceste te a Ae doctae DU Ld Mei ct RSS 28 4 5 5 File RECEIVE c cists wane chy anntes ete mei Seo aede p xd rese sind engine 29 4 5 6 Consumption DisPplaY sssssessessrssrsressrsrersenrrrsrrrrrsrrrnrr rer rrrr bie ds 29 5 Dij reper C EM C 31 5 1 GPS calories collectOtaso asc ate EO o RN rd CIE dic eee tee 31 52 Ioh ni M 32 5 3 Calendars a E E NEL 33 6 COoncl solis cin eui esen RI ere reses Ad eoa iau estan Rn sn Ser 34 Exercise Monitor on E healthcare System X Liang 2012 06 05 Referentes onion ato sexen css dean ess opas IRI ERARQMNM bi du EE UT stios 35 Appendix A Documentation of own developed program code 36 See the attachment MyWeb US war and CalendarOps_US rar 36 Exercise Monitor on E healthcare System X Liang 2012 06 05 Terminology Abbreviations API Application Programming Interface JSP Java Server Pages XML Extensible Markup Language GPS Global Positioning System MVC Mod
18. el View Controller LAN Local Area Network Mathematical notation cos the trigonometric cosine of an angle sin the trigonometric sine of an angle vi 1 1 Exercise Monitor on E healthcare System X Liang 2012 06 05 Introduction Background and problem motivation In the past mobile phones have only played a role as a call or message transceiver However with the rapid development of the mo bile Internet another popular mobile phone which is called the smart phone could also be used as a reminder a music player or a game play er In relation to medical fields a smart phone could be used as a re minder not only to be a time alarm but to also be more intelligent Based on clinical trials in hospitals it is known that it is an effective measure in curing some mental disease if the patient maintains a daily exercise routine In addition it is also the case that some patients are keen to bring a phone because it is a rather fancy accessory Con sequently a smart phone could take the place of a healthcare person to remind the patients to exercise according to the doctor s advice The aim of this project is to offer the significant advantage of liberating health care personnel from their busy repetitive schedules and the hope to rel evant application for an e healthcare system Nowadays the smart phone has become increasingly popular and the three smart phone platforms available in the market are the iphone android and
19. es the code appear to be simpler Calendar The calendar design is the largest proportion of the whole website The calendar module includes the database design on events and parti cipants the display of the events and participants and the operation of the events Table4 21 doctor table Field Type Null Extra Id int 11 No Pk amp auto increment username varchar 30 No firstname varchar 20 No lastname varchar 20 No 26 Exercise Monitor on E healthcare System X Liang 2012 06 05 Table 4 22 patient_table Field Type Null Extra Id int 11 No auto_increment gmail varchar 30 No firstname varchar 20 No lastname varchar 20 No Table 4 23 d_p_table Field Type Null Extra doctor id int 11 No FK doctor_table id patient id int 11 No FK patient_table id Table 4 24 event_table Field Type Null Default Extra Id int 11 No auto_increment title varchar 255 No startTime datetime No endTime datetime No place varchar 255 Yes NULL content text No remind int 11 No memo text Yes NULL energy int 11 No The form of the event table is merely a sample shown here In the actual development the web had built one table for one patient The namespace of the patient s table consists of the Google account name with the suffix of event because the Google account is unique so the name of table is also unique When visiting the database another framework has been found Hibernate Through the encap
20. ete event Phone built in calendar Web Server upload file Browser Application Figure 4 0 Entire System Phone client program design As mentioned above the phone client program contains several services running in the background Details about all the services are shown in table 4 1 as follows Table 4 1 Several Services GPS Service acts as a calories collector Pedometer Service acts as a calories collector Calendar Service reads event from calendar and sets reminder TextToSpeech Service convents the remind text to a voice 11 4 2 1 Exercise Monitor on E healthcare System X Liang 2012 06 05 GPS service implementation The calories collector determined the reminder s start up time In accordance with a normal life schedule a man may wake up at 8 o clock in the morning and go to sleep at 22 o clock However from 18 o clock to 22 o clock the man was always watching TV Therefore the period from 8 o clock to 18 o clock is the best running time for the calories col lector Furthermore two kinds of collectors have been designed to re cord the energy consumption One being the pedometer collector which is the main part of the second person in the group s work The other is called the GPS collector which actually only works outdoors Although it may be felt that it works indoors on occasions this is not the real GPS data From the po
21. gements and then make adjustments in relation to the change Pedometer service and TextToSpeech service implementation Furthermore little is stated in this case in relation to the Pedomet er Service and TextToSpeech Service implementation as this is the work for the second member of the group The Pedometer Service also acts as a calories collector and it works both indoors and outdoors The TextTo Speech Service could also convert the text to a speech and the Calendar Service would then call this TextToSpeech Speech to say something to remind the user to exercise 17 4 3 Exercise Monitor on E healthcare System X Liang 2012 06 05 Alarm design As mentioned above several features of the module of Calendar Service have been summarized However the vital part of the Calen dar Service is in relation to the design concerning a series of alarms When the Calendar Service reads out a new event the start time is giv en but the question is how to start this alarm on time and how to tell the patient the result of his exercise during the executing time The class of AlarmManager provides access to the system alarm services which allows the developers to schedule their application to be run at some point in the future Hence it is possible to set up this event s reminder in this way The greatest advantage is that registered alarms are retained while the device is asleep and it could also wake the device up With this advan
22. generally valid for a number of cases Concrete and verifiable goals On the patient s side the objective of the project are to respond to the following questions P1 How should the energy collector be imlemented 1 5 1 6 Exercise Monitor on E healthcare System X Liang 2012 06 05 There are two modes to collect the data namely pedometer mode and GPS mode The application could use one or both of them to improve the accuracy of the energy data P2 How will the intelligence of the reminder be shown There are two modes to remind the patient to complete the task The reminder will choose one of them according to historical energy con sumption P3 How will the interaction between healthcare person and the patient be implemented Through the Google Calendar any changes of the calendar would be synchronized to the phone which belongs to the same Google account On the healthcare person s side the objectives for the project are to re spond to the following questions P1 How will the daily energy consumption be shown for the healthcare person Ina moment which has been set to be the upload time the server will receive the energy records file The healthcare person could sign in and see these files Outline Chapter 2 describes the relevant theories including GPS Google Calendar smart phone sensor and a simple introduction to the website Chapter 3 describes the methods used to solve the problems b
23. he program starts the Calendar Service would read out the most recent event from the built in Google Calendar set up a series of intelli gent alarms and respond quickly to the change in the calendar As long as the current event starts it is not allowed to be modified and this ser vice will ignore other change in the calendar After the current event ends this service will read out the most recent event again The content of the event contains the title the start time the end time and the description The standard of calories consumption and the re minder word will be recorded in the field of description By default the description is a type of string but for correct reading the format of the description must appears as shown in the following text lt root gt lt energy gt integer lt energy gt lt description gt text lt description gt lt root gt Base on an Android platform this offers a loader called CursorLoader that queries the ContentResolver and returns a Cursor ContentResolver provides access for applications to the content model Additionally a Cursor is an interface which provides random read write access to the result set returned by a database query How should the CursorLoader be used See its constructor in Figure 4 5 Table 4 6 and Table 4 7 public CursorLoader Context context Uri uri String projection String selection String selectionArgs String sortOrder Figure 4 5 the cons
24. int of mature technology it is possible to utilize GPS and Android s Network Location Provider to ac quire the user location information Many manufacturers have incorpor ated the network location provider into the GPS so that it is possible to obtain the location information even if the GPS is only used indoors How is the GPS Service used to record the calories consumption at a cer tain time See the exhibit in figure 4 2 as follows GPSService t1 t1 interval Latitudel Latitude2 longitudel longitude2 DataCalculator distance speed time calories WriteToFile Figure 4 2 GPS Calculator Exercise Monitor on E healthcare System X Liang 2012 06 05 In Google Maps Javascript API V3 Reference it offers a utility function for computing geodesic distances between two specified loca tions By default this distance is calculated given the default equatorial earth radius of 6378137 meters The earth is approximated as a sphere hence the distance could be off as much as 0 3 especially in the polar extremes 10 This function is required frequently and thus this API must be implemented locally Figure 4 3 Calculate distance between two locations Referring to figure 4 3 the arc length of AB can be calculated us ing Law of Cosines Formula derived as follows A Lat1 Lng1 B Lat2 Lng2 wA Latl wB Lat2 jA Lngl1 jB Lng2 AC ED R sin w
25. istency of the event data File Receiver To receive the file uploaded from the phone Consumption To show the file content according to the date Display Account Manager Each healthcare person with a unique account could sign in to the website through a browser and execute within his her permission This web client does not open to the public as in a forum so that a re gister module is not provided When there is the need to add a new user contact must be made to the website administrator for a new ac count Furthermore the user group is small and the user s information does not often change thus the website chooses an xml file in which to store the user s information The format is as shown in figure 4 16 lt xml version 1 encoding UTF 8 root user lt name gt Mark lt name gt lt passwd gt 123 lt passwd gt lt email gt chinesejie qq com lt email gt lt user gt lt root gt Figure 4 16 users xml 23 Exercise Monitor on E healthcare System X Liang 2012 06 05 It is quite difficult for a non art designer to write attractive web pages In this case it was finally necessary to download UI files of Google s official website in order to enhance the effect of the screen The web page for reference is shown in figure 4 17 below E healthcare System Acc 192 168 1 6 8080 MyWeb login jsp Google Accounts Google has more to offer when you sign in
26. lendar events Details are giv en in the following form 16 4 2 3 Exercise Monitor on E healthcare System X Liang 2012 06 05 Table 4 7 the instances of parameters parameter instance context getApplicationContext uri APIS8 content com android calendar events APIS content calendar events projection new String title dtstart dtend description selection new String calendar id 1 AND dtstart gt selectionArgs String valueOf System currentTimeMillis sortOrder New String dtstart DESC dtend DESC Although the program has recorded the most recent event it is possible to modify the current event as long as the event was not started How can the program respond to the change of the current event For tunately the Android SDK API has provided a design pattern which is similar to the Listener mechanism in JVM As suggested by its name Observer an Observer is the interface to be implemented by ob jects that receive notification of updates on an observable object Fur thermore an observer object should be instantiated which extends the abstract class of ContentObserver To make it work this object must also be registered to the application environment The real effect is that the method of onChange boolean selfChange is called when a change occurs to the cursor that is being observed Inside this method any code can be written to make jud
27. nformation collection use and protection policies and these should be read carefully 1 Only the user can permit a healthcare person to monitor his her movement otherwise this phone application will not be installed in the user s phone 2 After the user agrees to install and run the phone application the phone does not record any location information but only records the calories consumption 2 3 2 4 Exercise Monitor on E healthcare System X Liang 2012 06 05 3 Without the agreement of the user the phone application will not upload any calories record files automatically 4 All the files uploaded to the website will only be visible to the spe cific healthcare person The site will not disclose any personal informa tion about users Introduction Android 4 0 Android 4 0 Ice Cream Sandwich is the latest version of the An droid platform for phones tablets and more It builds on the things people love most about Android easy multitasking rich notifications customizable home screens resizable widgets and deep interactivity and adds powerful new ways of communicating and sharing 5 This new application will be developed based on the Android 4 0 But it should still be able to run on some Android phones whose version is less than Android 4 0 To help organize appointments and events an updated Calen dar app brings together personal work school and social agendas With user permission other
28. o organizations which are using this E healthcare System and the system has only been tested by an internal University basis The web server which is deployed for the healthcare personnel is the most costly but they would be able to sign in to the website in order to give the latest calendar anywhere and at any time which means that the organization must hire a host on the internet to run this project Additionally some related technical staff are required to maintain the normal running of the host For the remainder the deploy ment on the phone client is rather simple and only requires to install the application after the user agrees to be monitored by the relevant health care personnel For the high level and complex design it might be necessary to add the back stage management into the organization s website Thus when the organization adds new accounts to the website it is conveni ent to operate online instead of requiring professional modification in relation to the configuration file of the project Generally speaking the GPS calories collector is most accurate and power saving mode when it works outdoors but if the person is not outdoors then the pedometer calories collector will work instead of the GPS calories collector How ever it requires the user to touch the screen to switch between these two modes An attempt has made to implement an automatic switching mode but it finally failed due to fuzzy concepts on the GPS satelli
29. oid platform Additionally a corresponding website is to be designed so that healthcare personnel are able to sign in in order to deal with the tasks The entire system has been tested in real scenarios at this point only by the author but has still not been used by other organizations The final part of the report involves the conclusions drawn and provides suggestions for further work about the whole project Keywords mobile Internet Android platform electronic healthcare sys tem ii Exercise Monitor on E healthcare System X Liang 2012 06 05 Acknowledgements Many thanks to my tutor Professor Zhang under whose guidance I was able to complete my final theme project Particular thanks must go to her for allowing me to use a smart phone from university which made the development more efficient than it would have been if using an emulator I would also like to offer my deep appreciation to Mr Guo for cooperating with me throughout the whole project and finally enabling me to achieve it iii Exercise Monitor on E healthcare System X Liang 2012 06 05 Table of Contents iure Rm ii Acknowleds ementS 3s ssssossicsss nscsssesss ined eo sosoo stesse ne nepos par sins en epe Ee sensavees iii MOETNIN O1O BY ese PR RE UN vi 1 Introduccion eei ecle inen Dee r rs senere EUN EURO RA so se e Roo U eei MM 1 1 1 Background and problem motivation sss 1 1 2 Veber diris i obs Duet su eme Mta mec th Guan T tess
30. onse Figure 4 12 Struts flow chart Referring to the figure 4 12 it is easy to build a Java page to re ceive the file as shown in figure 4 13 y file upload C 192 168 1 2 8080 videoweb semm size Choose File No file chosen SE Elements Resources QQ Network a Scripts CP Timeine C Profiles Y audits Console v html v head lt meta http equiv Content Type content text html charset UTF 8 gt lt title gt file upload lt title gt lt head gt lt body gt lt form method post action http 192 168 1 2 8080 videoweb video manage do enctype multipart form data file name lt input type text name title lt br gt size lt input type text name timelength lt br gt lt input type file name video gt lt input type hidden name method value save gt lt input type submit value sumbit lt form gt lt body gt lt html gt Figure 4 13 File Form Obviously using the tag of lt input gt in the html could upload the specific file But in this case a file is to be uploaded from the phone s 21 4 5 Exercise Monitor on E healthcare System X Liang 2012 06 05 application not from the phone s browser According to the http1 1 pro tocol it is necessary to create an http request in the phone s application while uploading the file Different fields of http request headers are shown in the following exhibit He
31. or Iterator lt Element gt ite items iterator ite hasNext Element ele ite next return ele getChild gmail getText Figure 4 19 Code of getting specific value Validation before query AOP is the abbreviation of Aspect oriented programming which is a programming paradigm commonly used as a design pattern It aims at improving the modularity by allowing the developers only pay close attention to the programming at one point or the crosscutting structure The design idea of AOP is often used for logging such as the Log4J of the Apache Foundation and the Joss logging of Red Hat Inc Which have both benefited from this idea Based on the idea of aspect programming it id possible to validate all the queries but not to affect the normal structure of the top logical design The AOP could be also thought of as a interceptor when using it in the validation framework Details are shown as follows 25 4 5 3 Exercise Monitor on E healthcare System X Liang 2012 06 05 jsp r 9 Manager data stream gt E Interceptor virtual process DAO DAOImpl DD M data stream Figure 4 20 AOP diagram Spring framework supports the AOP design pattern that has been integ rated with the widely used aspect oriented extension called AspectJ Additionally using annotation to the program mak
32. quired gt 666 0 lt required gt lt actual gt 345 0 lt actual gt lt evaluate gt fail lt evaluate gt lt assignment gt lt root gt When a new event starts the reminder would firstly check whether there is an event with the same start and end time as for yesterday s evaluation report If the historical event has reached the reference stand ard then the reminder will choose the habitual mode Today Event t search the event with ame time in yesterda consumption during the same time of yesterday sum yesterday Event y evaluate success yes actual gt t required yes Default Mode pe Habitual Mode Figure 4 11 when to choose the habitual mode 20 Exercise Monitor on E healthcare System X Liang 2012 06 05 44 Upload file design The module of file upload could be implemented by means of dif ferent web technologies The most commonly used approach is to bene fit from the Apache projects The Apache projects provide three options to realize this function Furthermore Struts 1 is selected as the frame work as shown in the following E t i Controller Dispatch Business Logic i HTTP Servlet Action Request Client amp B Forward rowser struts config xml t t Update View SE Model HTTP JSP E Application State Resp
33. sulation by Hibernate it is possible to ob tain the data such as accessing a class with the assistance of the Hibern ate encapsulation FullCalendar is a jQuery calendar plugin which uses Ajax to ob tain each month s calendar events and can be configured to use their own calendar event source such as obtained from the Google Calendar event In order to realize the function of the events show it is necessary 27 4 5 4 Exercise Monitor on E healthcare System X Liang 2012 06 05 to obtain the data from the local database FullCalendar plugin should be configured to use the correct source through the servlet Firstly a servlet class is created and then it is configured to the web xml This is shown below lt servlet gt lt servlet name gt JSONAction lt servlet name gt lt servlet class gt com liang action JSONAction lt servlet class gt lt servlet gt lt servlet mapping gt lt servlet name gt JSONAction lt servlet name gt lt url pattern gt json lt url pattern gt lt servlet mapping gt Figure 4 25 Servlet configuration Therefore any request using the url address json could visit the servlet class com liang action JSONAction this class will obtain the data from the database and return the data to the request On the other side the JOuery should build a servlet similar to the fol lowing events function start end callback ajax type get url json
34. tage this application code could be made to run at a specific time even if that application is asleep Details are shown in Figure 4 8 Application set up a start alarm SystemAlarm send broadcast StartAlarmReceiver invoke Reminder Figure 4 8 System Alarm Referring to figure 4 8 how is it possible to implement the spe cified reminder when the StartAlarmReceiver starts to work There are two modes to make this reminder become more intelligent One is called default mode when executing the first event there is no previous refer ence thus the application choose the default mode to implement the re minder Details about the default mode are shown as follows 18 Exercise Monitor on E healthcare System X Liang 2012 06 05 Default mode Calories sum kcal 8 00 12 00 tartR eminder 8 00 SecondReminder X 8 00 9 9 00 re sum 4 X 9 00 10 00 J Calories collector Tings Si L0 00 re sum gt xy X 10 1 00 TextTotSpeech Service FourthReminder ResultReminde 12 00 Figure 4 9 Default mode Do nothing Referring to figure 4 9 it can be seen in default mode that the application had built five alarms to evaluate different stages result The whole event has diverged into four stages according to the average in terval During the stage if the calories consumption is less than the re quired cons
35. tation can be found at the Java file of cn itcast utils SocketHttpRequester Web client program design Based on the overall framework of the e healthcare system Google Calendar only plays a role as a transfer server Why is the Google Calendar not operated directly but another web server is built to access it Signing in to the Google s official website and enjoying the Google Calendar service would achieve exactly the same effect How ever it also brings some other problems These problems are list below 1 The doctor could access the patient s personal account which affects the privacy protection 2 The Google Calendar s event editor contains limited fields which affects the expansibility 22 4 5 1 Exercise Monitor on E healthcare System X Liang 2012 06 05 3 The Google Calendar cannot provide some special func tional modules such as receiving the file from the phone and show the energy consumption conclusion for the healthcare persons Considering the above these problems it would be necessary to es tablish an integrated website The architecture of this website consists of six different functional modules Table 4 15 the form of six modules Module Function Account Login logout and offer the parameter of Google Manager account connection Validation A query will be released after the successful before query authentication Calendar To show all the events Synchronization Maintain cons
36. tes data Perhaps this humane setting can be achieved as knowledge in this field is increased For a developer who focuses on business logic the UI design is very abstract and could be ignored From an artistic perspective a great deal was learnt about UI design from the Google website but all the business logic implementations were written by the author 34 Exercise Monitor on E healthcare System X Liang 2012 06 05 References 1 2 3 4 5 6 7 8 9 10 11 Google Accounts https accounts google com ServiceLogin 4 June 2012 FullCalendar Full sized Calendar jOuery Plugin http arshaw com fullcalendar 4 June 2012 NAMI Mental Illness and Exercise http www nami org Content NavieationMenu Hearts and Min ds Exercise Mental Illness and Exercise htm 4 June 2012 The relation of physical activity and exercise to mental health http www ncbi nlm nih gov pmc articles PMC1424736 page 8 14 June 2012 Android Introducing Ice Cream Sandwich http www android com about ice cream sandwic 14 June 2012 Apache Struts http struts apache org 4 June 2012 Hibernate JBoss Community http www hibernate org hibernate 4 June 2012 SpringSource org tp www springsource org features Date 4 June 2012 Obtaining User Location Android Developers http developer android com guide topics location obtaininguse r location html 4 June 2012 Google Maps
37. to your Google Account Sign in Sign in on the right or create an account for free Email Gmail Chat with friends and never miss an important email Password Personalized Search Get more relevant results based on your past searches P Cant access your account Like Google Make Google your homepage Figure 4 17 Home Page Apart from login and logout service the account manager also provides access to the Google Account service All the patients informa tion were stored in an xml file The format of the file is shown in figure 4 18 lt xml version 1 0 encoding UTF 8 gt lt root gt lt account gt lt name gt Service Liang lt name gt lt gmail gt service4liang gmail com lt gmail gt password 020118114 password lt account gt lt root gt Figure 4 18 accounts xml 24 4 5 2 Exercise Monitor on E healthcare System X Liang 2012 06 05 With the advantages of the JDOM parser it is possible to read and write XML data without using the original ecological JOK API which is complex and memory consumptive For example the process to obtain the value of the tag lt gmail gt is similar to that in figure 4 19 public String getValue SAXBuilder builder new SAXBuilder Document doc builder build new FileInputStream xx xml Element root doc getRootElement List lt Element gt items List lt Element gt XPath selectNodes root account f
38. tructor of CursorLoader 15 Exercise Monitor on E healthcare System X Liang 2012 06 05 Table 4 6 User s manual of query context A interface to global information about an application environment get it by using getApplicationContext uri The URI using the content scheme for the content to retrieve projection A list of which columns to return Passing null will return all columns which is inefficient selection A filter declaring which rows to return formatted as an SOL WHERE clause excluding the WHERE itself Passing null will return all rows for the given URI selectionArg You may include s in selection which will be replaced S by the values from selectionArgs in the order that they appear in the selection The values will be bound as String sortOrder You may include s in selection which will be replaced by the values from selectionArgs in the order that they appear in the selection The values will be bound as String Cursor which is positioned before the first entry or null object All the parameters must be provided It is simple to provide the parameter of Context However there is a minor difference between the usages of the SDK version which is greater than API8 The SDK ver sions which are less than API8 use the Uri address of content calendar events to query the events and the other versions use the Uri address of content com android ca
39. uld be introduced in the paper of the second member of the group Upload file upload activity fila name 20120523 xml Figure 5 3 Upload file panel 32 Exercise Monitor on E healthcare System X Liang 2012 06 05 The application only uploads the file after the user agrees The file name is composed of the current date and the file is stored in the SD card Calendar 3 Google Calendar Google Chrome 192 168 1 2 2080 MyWeb_US eventShow jsp You Google senicedliang gmail com 4 SAVE Discard changes Delete Doctor23 2012 05 31 13 20 to 2012 0531 17 20 Event details energy kcal 400 Description It is time to run Figure 5 4 Calendar Event Referring to figure 5 4 a new event was created on the computer browser The application was then run using the phone as shown below so that it is possible to determine that the time and the required calories consumption are the same CalendarOps_US 33 Exercise Monitor on E healthcare System X Liang 2012 06 05 Conclusions The goals of this project have been achieved The e healthcare system has been realized in a clear and complete way Firstly the phone application is able to remind the patient to perform exercise according to the calendar Secondly the system also offers a website for the health care person to operate the calendar and to read the daily exercise report In real scenarios there are still n
40. umption the reminder will invoke the TextToSpeech Service in order for something to be said Another reminder pattern is called ha bitual mode which works depending on yesterday s calories records Details are shown in the following Habitual mode Calories sum kcal 8 00 12 00 SecondReminder 9 00 re sum 4 X 9 00 10 00 Calories collector i Iie aT 0 00 re sum 2 x FourthReminder 1 00 re sum x ResultReminde 12 00 Figure 4 10 Habitual mode TextTotSpeech Service Referring to figure 4 10 the difference associated with the default mode is visible When the calories consumption is less than the required consumption at one stage the reminder is not going to invoke the Text 19 Exercise Monitor on E healthcare System X Liang 2012 06 05 ToSpeech Service but the reminder will continue to compare the con sumption with yesterday s consumption during the same interval Sup posing that the consumption is at the minimum value then the remind er will call the voice There is still a problem which is when to choose the habitual mode re minder By default when the event ends the Calendar Service will write an evaluation report into a file The format of the file has the following appearance lt xml version 1 0 encoding UTF 8 standalone yes gt lt root gt assignment start 1337203140000 end 1337289660000 gt lt re
41. ven time only one collector is running The collector which is running writes the calories consumption records into the files of the SD card during every time period On the other hand if there is an event starting in Google calendar the reminder will invoke the calories calculator to assess the event When developing a location aware application for Android you can utilize GPS and Android s Network Location Provider to acquire the user location Although GPS is most accurate it only works outdoors it quickly consumes battery power and doesn t return the location as quickly as users want 9 This is the reference from the Android Dev Guide but it is not exact in relation to some high quality smart phones For example the Samsung 19520 smart phone uses the technology of AGPS which is the GPS with the net When using AGPS the phone will download the satellites information from the Internet in advance Then the phone will know which four satellites are within the search range thus it is faster and less power is used than for a GPS chip which searches all the satellites which are in the search range 3 2 3 3 Exercise Monitor on E healthcare System X Liang 2012 06 05 Interactions between the participants Google Calendar ynchronization create new events Smart Phone Web Server Figure 3 2 interaction model Figure 3 2 shows how to achieve an information transmission between the particip
Download Pdf Manuals
Related Search
Related Contents
Eaton P2MLP1 rack accessory Bintec-elmeg S560 Panasonic WV-SW158 surveillance camera adhesivo - Construnario.com 新型エレベーターパンフレット② Quick Installation Guide of WLAN Broadband Router 米 To Home Decorators Collection 89763 Instructions / Assembly Manual de instrucciones 取扱説明書 (操作編) R11 , R123 , R12共用 OCREB Online User Guide Copyright © All rights reserved.
Failed to retrieve file