350 likes | 375 Views
The Design and Implementation of a Mobile Health Application with Apple watch for Seniors. ( Myhealth ). Master Thesis Defense Arij Alfaidi UCCS. I ntroduction. With the increase of elderly population, the demand on senior healthcare has been increased. Introduction.
E N D
The Design and Implementation of a Mobile Health Application with Apple watch for Seniors.(Myhealth) Master Thesis Defense ArijAlfaidi UCCS
Introduction • With the increase of elderly population, the demand on senior healthcare has been increased. MyHealth / Arij Alfaidi
Introduction • Health insurance expense limited seniors from staying at hospitals for a long time. Apps can used in daily life to improve health are need. • Developers have been focused on creating apps for monitoring many essential health functions. MyHealth / Arij Alfaidi
Background • Apple Watch was released 2015 and contains sensors for heart rate and activities monitoring. • Healthkit is an open source software for collecting/storing/ sharing/querying health data generated by app, performing statistical analysis. • Help developers develop different health applications • With data types supporting personal profiles, heart-rate, medicine. • There are critical needs for mobile health applications. MyHealth / Arij Alfaidi
Related Work [Diva2013]"The use of personal digital assistants in clinical decision making by health care professionals: a systematic review." Health informatics journal • Their result was in case of emergency sometimes the patient did not have the time to call for help and what if can we develop application that can sense that the patient needs help. [Guar2015] Guardian News (2015). Apple Watch has designs on health industry – but is it good for doctors? The Guardian News. • How Apple watch sensors designed and how the watch is related to Health application. The conclusion was promising that the Apple watch future will make a difference in mobile healthcare industry. [Kise2011]. "25 ways to use your smartphone. Physicians share their favorite uses and apps.” • Smartphone made the users more aware of the disease and their effects on the patients. MyHealth / Arij Alfaidi
Related Work [ONei2013]. "Applying surgical apps: Smartphone and tablet apps prove useful in clinical practice. • Study on senior people it shows that these application make the patient more aware of their health issues and they became more careful with their health. [Ozda2012] "The smartphone in medicine: a review of current and potential use among physicians and students. • They made 60 studies, on the impact of using smartphones on health area. How can we used of the phone feature such as Wi-Fi, GPS. there is a difference [Yoo2013] "The meaning of information technology (IT) mobile devices to me, the infectious disease physician." Infection & chemotherapy • They studied why we should focus on seniors because they have more health issues and the population of elderly people in increase yearly. MyHealth / Arij Alfaidi
My Health HKHealthStore MyHealth System Architecture and Operations MyHealth / Arij Alfaidi
MyHealth Functions • Reads the heart rate and when it is above or under certain level it alert Emergency contacts. • User can enter his emergency contact information and the app will save it. • Remind the user of his Medicine. MyHealth / Arij Alfaidi
MyHealth Functions • Remind the user to move and do some activity. • Track and record user movement. • Count steps. • If the user did not move for a certain time, notify the emergency contacts. • Save the heart rate measurements and send it by email to the doctor MyHealth / Arij Alfaidi
MyHealth Design • Simple • Direct • Easy to use • Two tabs • one for medicine • One for Emergency contacts • Notification shows on Iphone And Watch. MyHealth / Arij Alfaidi
MyHealthOperations • User – iPhone interaction MyHealth / Arij Alfaidi
Heart rate MonitoringMedicine Reminder on the Watch MyHealth / Arij Alfaidi
Implementation Development Platform and Software • MacBook Pro with El Capitan Operating System. • Apple Developer account • IDE: Xcode 7.3 • Programming Language: Swift 2.2 Deploying Devices: • iPhone 6 with IOS 9.1 • HealthKitas a project capabilities. • Appple Watch OS2.1 and WatchKit as a project target. MyHealth / Arij Alfaidi
HealthKit Framework • Apple release Healthkit with iOS 8 in 2014. • Healthkit can help Share and retrieve these data: Calories Burned, Sleep, Blood sugar, Cholesterol, Medications, Nutrition, Heart Rate, Weight, and Fitness. • You have to take the user approval before you can have an access to healthkit. • Classes : • HKObject: is the superclass of all HealthKit sample types. • Each object has the Following properties: • UUID. A unique identifier for that particular entry. • Metadata. A dictionary containing additional information about the entry. • Source Revision. The source of the sample. The source can be a device that directly saves data into HealthKit, or an app. • Device. The hardware device that generated the data stored in this sample. MyHealth / Arij Alfaidi
To decide which function to use Xcode gives a declaration for each function and how to use it. By command click on the class name. MyHealth / Arij Alfaidi
HeartRate related Code guardHKHealthStore.isHealthDataAvailable() == true else { headerLbl.setText("not available") return} guardletqHKType= HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeartRate) else { displayNotAllowed() return} letshareType= Set(arrayLiteral: qHKType) letTypesData= Set(arrayLiteral: qHKType) healthStore.requestAuthorizationToShareTypes(typeToShare, readTypes: TypesData) { (success, error) -> Voidin if success == false { self.displayNotAllowed() }else{ self.healthStore.saveObject(qHKType, withCompletion: completion)) } } MyHealth / Arij Alfaidi
Watch Connectivity Framework • import WatchConnectivity • Import two way communications between iOS app and a watchkit extension on a paired apple watch. • Apps use this framework to pass files and data back and forth. • Classes • WCSession: The WCSession class facilitates communication between a WatchKit extension and its companion iOS app. • Protocols • WCSessionDelegate: defines methods for responding to messages sent by a WCSession object. MyHealth / Arij Alfaidi
if(WCSession.isSupported()) { session = WCSession.defaultSession() session.delegate = self session.activateSession() } letmessage = ["heartRateValue" : value,"heartRateTime" : NSDate()] self.session.sendMessage (message, replyHandler: { ( response ) in }, errorHandler : { ( error ) in NSLog ( "Error sendingmessage:% @ " , error ) self.session.sendMessage (["heartRate" : value],replyHandler : { ( response ) in }, errorHandler : { ( error ) in NSLog ( "Error sendingmessage:% @ " , error ) } ) Sending heart rate values from Watch to IPhone MyHealth / Arij Alfaidi
Make the Emergency Call when Heart rate is not well funcsession(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void) { if callBool == false{ if message.indexForKey("heartRate") != nil { // the key exists in the dictionary print("adsdasdas") letvalue = message["heartRate"] as? NSInteger dispatch_async(dispatch_get_main_queue()) { if value! > 60 || value! < 50{ self.callBool = true self.makeAnEmergencyCall() } } } } MyHealth / Arij Alfaidi
Core Motion Framework • import CoreMotion • It let’s the application receive motion data from device hardware and process that data. • Classes • CMMotionManager: A CMMotionManager object is the gateway to the motion services provided by iOS. • CMPedometer: Use a CMPedometer object to fetch pedestrian-related data. • CMStepCounter: The CMStepCounter class provides access to the number of steps the user has taken with the device. MyHealth / Arij Alfaidi
Device MotionUpdate Code motionManager.startDeviceMotionUpdatesToQueue(NSOperationQueue.currentQueue()!, withHandler:{ deviceManager, errorin ifCMPedometer.isStepCountingAvailable(){ self.pedoMeter.startPedometerUpdatesFromDate(NSDate(), withHandler: { data, errorin guard let data = data else{ return} dispatch_async(dispatch_get_main_queue(), { () -> Voidin if(error== nil){ self.timer.invalidate() print("Number of steps = \(data.numberOfSteps)") // let steps : NSNumber = data.numberOfSteps letstrConvert = String(steps) leterrorAlert= UIAlertView(title: "YouareRunningorwalkingnow", message:strConvert, delegate: self, cancelButtonTitle: "OK") errorAlert.show() letsecondController= SecondViewController() secondController.activateExcercise() self.motionManager.stopDeviceMotionUpdates() }else{self.showAlertMessageOnCrossingHeartRate()} MyHealth / Arij Alfaidi
functimerEmergencyCall() { ++counter \\ Swift 3 counter +=1 if counter == 10{ self.timer.invalidate() makeAnEmergencyCall() } } funcmakeAnEmergencyCall(){ varnumber : String = self.defaults.objectForKey("phoneTF") as! String number = number.stringByReplacingOccurrencesOfString( "\\D", withString: "", options: .RegularExpressionSearch, range: number.startIndex..<number.endIndex) { leturl:NSURL = NSURL(string: "tel://"+number)! UIApplication.sharedApplication().openURL(url)}} Emergency Call MyHealth / Arij Alfaidi
Calling when the user not moving funccallRunningNotification(){ if(CMMotionActivityManager.isActivityAvailable()) self.activityManager.startActivityUpdatesToQueue(NSOperationQueue.currentQueue()!, withHandler: { (data:CMMotionActivity?) -> Voidin if ((data?.walking) == true || (data?.running) == true) { print("walking"); self.timer.invalidate()} else{ print("not walking"); dispatch_async(dispatch_get_main_queue(), { () -> Voidin leterrorAlert = UIAlertView(title: "YoushouldbeRunningorwalking.", message: "", delegate: self, cancelButtonTitle: "OK") errorAlert.show() self.timer= NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "timerEmergencyCall", userInfo: nil, repeats: true) self.activityManager.stopActivityUpdates() })} MyHealth / Arij Alfaidi
funcscheduleReminderforMedicine(item: TodoMedicineItem) { let notify = UILocalNotification() notify.alertBody = "Medicine Intake\"\(item.title)\" Is Overdue" notify.alertAction= "open" notify.fireDate= NSDate().dateByAddingTimeInterval(30 * 60) notify.soundName = UILocalNotificationDefaultSoundName// play default sound notify.userInfo = ["title": item.title, "UUID": item.UUID] notify.category = "MEDS_CATEGORY" UIApplication.sharedApplication().scheduleLocalNotification(notify) } Reminder in 30 minutes MyHealth / Arij Alfaidi
Measuring Performance • Using Instruments app inside Xcode • With Instruments, you can gather data about performance areas such as your app’s memory usage, disk activity, network activity, and graphics operations. • From Product tap > Profile. • It will run the Instrument App that can show the performance ,threads and any problem of your running App. MyHealth / Arij Alfaidi
Performance The application needs 1.5 MB of memory used. MyHealth / Arij Alfaidi
Performance • It take about • 1% to 2% used of • CPU. MyHealth / Arij Alfaidi
Testing. • Testing the app in simulators first. • It is difference than testing on actual devices. • On simulators you can not call, text, email. • You can test each task individually. • On actual devices it’s reality you can use all the phone functionality calling, texting.. Etc • You have to set the notification timer correctly to don’t allow overlap. MyHealth / Arij Alfaidi
Lessons Learnt • Building my application based on Apple’s new software and products. New/large api/frameworks to learn. • New IDE Xcode 7.3 to learn. • Language Dramatic changes from Switch 1.2 to Swift 2.2. • Xcode 7.3 has a bug on app group so I change it to Use WCSession. • Research kit is written in Objective-C MyHealth / Arij Alfaidi
Future Directions • If we can translate the low heart rate curve to ECG form To let the doctor diagnose and detect potential heart rate attack. • Remind the user of their medication by scanning the bar code and ensure they are the right ones. • Track the user move to make sure he is doing his exercises the right way. • Using CareKit which is a new kit will be released by the end of April to improve developing Health Apps. MyHealth / Arij Alfaidi
Conclusion • I have developed a mobile health applications called MyHealth to monitoring heart rate and activities of seniors and send alerts if needed. • New Xcode 7.3 and Swift 2.2 help with the development and ensure the quality and reliability of the app developed but the learning curve is steep. • Apple watch sensors with Healthkit can make it possible to create health app. • Developing Health application is not easy specially in critical area cause its related to human lives. • The requirements for mobile health applications will change with the change of people health issues. MyHealth / Arij Alfaidi
References • [Diva2013]Divall, Pip, Janette Camosso-Stefinovic, and Richard Baker. "The use of personal digital assistants in clinical decision making by health care professionals: a systematic review." Health informatics journal 19.1 (2013): 16-2 • [Guar2015], Guardian News (2015). Apple Watch has designs on health industry – but is it good for doctors? The Guardian News. Retrieved from <http://www.theguardian.com/technology/2014/sep/10/apple-watch-health-app-iphone-smartwatch> • [Kise2011] Kiser, Kim. "25 ways to use your smartphone. Physicians share their favorite uses and apps." Minn Med 94.4 (2011): 22-9. • [Onei2013] O’Neill, K. M., et al. "Applying surgical apps: Smartphone and tablet apps prove useful in clinical practice." Bull Am CollSurg 98.11 (2013): 10-18. • [Ozda2012]Ozdalga, Errol, Ark Ozdalga, and Neera Ahuja. "The smartphone in medicine: a review of current and potential use among physicians and students." Journal of medical Internet research 14.5 (2012). • [Yoo2013] Yoo, Jin-Hong. "The meaning of information technology (IT) mobile devices to me, the infectious disease physician." Infection & chemotherapy 45.2 (2013): 244-251. MyHealth / Arij Alfaidi
References • GreatCall] http://www.greatcall.com/lp/is-mobile-healthcare-the-future-infographic.aspx • Appledeveloper]https://developer.apple.com/ • [Tom2014] Tom Harrington “Sharing data between iOS apps and app extensions” (2014) • http://www.atomicbird.com/blog/sharing-with-app-extensions • [Miller2014] Jen A. Miller “The Future of mHealth Goes Well Beyond Fitness Apps” (2014) • http://www.cio.com/article/2855047/healthcare/the-future-of-mhealth-goes-well-beyond-fitness-apps.html • JOVVH2014 Jennifer M. Ortman, Victoria A. Velkoff, and Howard Hogan “ An Aging Nation: The older population in the United States.” May 2014. MyHealth / Arij Alfaidi
Demo MyHealth / Arij Alfaidi
Questions ? MyHealth / Arij Alfaidi