SlideShare a Scribd company logo
1 of 34
Download to read offline
iPhone, una herramienta mรฉdica
Helen Olhausen y Washington Miranda
ResearchKit
Open Source
Researchers
Users
Physician
Charts
Forms
Pre-built UI
HealthKit
CoreMotion
CareKit
Extensible
CareKit
โ€ข Care Cards
โ€ข Symptom and Measurement Tracker
โ€ข Insights
โ€ข Connect
โ€ข Care Plan Store
Care Card
Symptom and
Measurement
Tracker
Insights
Connect
ResearchKit
โ€ข Informed Consent
โ€ข Surveys and Active Tasks
โ€ข Dashboardโ€จ
โ€จ
Consent
Surveys
Active Tasks
Dashboard
Dashboard
3 Modules
Survey - Consent - Active Tasks
Cada actividad que se pide al usuario realizar se modela como una Task
The โ€œeasyโ€
Consent - Survey
Consent
ORKConsentDocument
โ€ข public var sections: [ORKStepConsentSection]?
โ€ข ORKStepConsentSectionโ€จ
public init(type: ORKConsentSectionType) โ€จ
tiene section types por defecto
Surveys
โ€ข ORKNavigableOrderedTask
โ€ขORKOrderedTask
Surveys
ORKNavigableOrderedTask
โ€ข overrides `stepAfterStep`
- (ORKStep *)stepAfterStep:(ORKStep *)step withResult:(ORKTaskResult *)result
La usamos cuando queremos que nuestro proximo step, dependa del resultado del
step anterior, para esto de๏ฌnimos reglas ORKStepNavigationRule, como por ejemplo:
// if user answers 'No' take it to the end of the survey
let resultSelector = ORKResultSelector(resultIdentifier: "physical_activity_pain")โ€จ
let predicateNonEligibleSurvey = ORKResultPredicate.
predicateForBooleanQuestionResultWithResultSelector(resultSelector,expectedAnswer: false)
โ€จ
let predicateRule = ORKPredicateStepNavigationRule(resultPredicatesAndDestinationStepIdentifiers:
[(predicateNonEligibleSurvey,
summaryStep.identifier)])
โ€จ
physicalActivityTask.setNavigationRule(predicateRule, forTriggerStepIdentifier:"physical_activity_pain")
ORKInstructionStep
ORKQuestionStep
ORKFormStep
Surveys Steps
The โ€œnot so easyโ€
Active Task
Active Tasks
Active Step
โ€ข Interactivo
โ€ข Recolecciรณn de datos usando sensores
Active Step
โ€ข Es donde se realmente se โ€œhace el trabajoโ€
import UIKit
import ResearchKit
class WalkTillStationaryTaskStep: ORKActiveStep {
var maxStationaryDuration : NSTimeInterval!
static func stepViewControllerClass() -> AnyObject {
return WalkTillStationaryTaskStepViewController.self
}
override init(identifier: String) {
super.init(identifier: identifier)
self.shouldShowDefaultTimer = false
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.shouldShowDefaultTimer = false
}
// por defecto si no se define un stepDuration, la actividad comienza como finalizada
func startsFinished() -> Bool {
return false
}
}
Caso Particular
โ€ข Terminar el step cuando el usuario deja de caminar por mas de un minuto
โ€ข Subclass ORKActiveStep
โ€ข Implementar stepViewControllerClass(), este mรฉtodo le dice al task view controller quรฉ Step view controller
instanciar cuando va a presentar este Step
โ€ข Subclass ORKActiveStepViewController
import UIKit
import ResearchKit
import CoreMotion
class WalkTillStationaryTaskStepViewController: ORKActiveStepViewController {
โ€ฆ
override func viewDidLoad() {
super.viewDidLoad()
self.customView = WalkTillStationaryContentView()
โ€ฆ
override func start() {
super.start()
// Start Timers
self.startStationaryTimer()
self.startElapsedTimer()
// Start self recorders
// start tracking user activity
self.startUpdateActivity()
// start pedometer
self.startPedometer()
}
override func suspend() {
super.suspend()
motionActivitiyManager.stopActivityUpdates()
}
โ€ฆ
private func stationaryTimerDidFire() {
// user has been stationary for more than one minute
self.suspend()
self.finish()
}
โ€ฆ
โ€ข Subclass ORKActiveStepCustomView โ€จ
provee la vista custom del view controllerโ€จ
public var customView: UIView?
โ€ข Active step life cycleโ€จ
override start, suspend, resume, ๏ฌnish
โ€ข Data collectionโ€จ
public var recorders: [AnyObject]? (read-only)
โ€จ
Los recorders se generan cuando comienza el step basรกndose en las `recorder
con๏ฌguration` para ese stepโ€จ
var recorderConfigurations = [ORKRecorderConfiguration]()
recorderConfigurations += [ORKPedometerRecorderConfiguration(identifier: "pedometer")]
โ€ข Output directory โ€จ
taskViewController.outputDirectoryโ€จ
โ€ข CoreMotion
var steps = [ORKStep]()
let countdownStep = ORKCountdownStep(identifier: "countdown_step")
countdownStep.stepDuration = 5.0
steps += [countdownStep]
var recorderConfigurations = [ORKRecorderConfiguration]()
recorderConfigurations += [ORKPedometerRecorderConfiguration(identifier: "pedometer")]
let walkingStep = WalkTillStationaryTaskStep(identifier: "walk_step")
walkingStep.title = NSLocalizedString("Continue walking as much as you can", comment: "")
walkingStep.text = NSLocalizedString("Hit the stop button to stop exercise", comment: "")
walkingStep.shouldContinueOnFinish = true
walkingStep.optional = false
steps += [walkingStep]
let task = ORKOrderedTask(identifier: โ€œwalk_stationary_taskโ€, steps: steps)
let taskViewController = ORKTaskViewController(task: activity.task, taskRunUUID: activity.taskUUID)
taskViewController.delegate = self
taskViewController.outputDirectory = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory,
inDomains: .UserDomainMask).first!
self.presentViewController(taskViewController, animated: true, completion: nil)
Declaro el step para ser usado en una Task
Getting Results
extension JoinViewController : ORKTaskViewControllerDelegate {
func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason:
ORKTaskViewControllerFinishReason, error: NSError?) {
if reason == .Completed {
if taskViewController.task?.identifier == "registrationTask" {
self.handleUserRegistration(taskViewController.result)
} else if taskViewController.task?.identifier == "registrationAdditionalTask" {
self.handleUserAdditionalInfo(taskViewController.result)
}
}
self.dismissViewControllerAnimated(true, completion: nil)
}
}
โ€ข Los identi๏ฌcadores รบnicos toman importancia
let joinTask = ORKOrderedTask(identifier: "registrationTask", steps: [
consentStep,
shareStep,
healthDataStep,
registrationStep
]
)
let taskViewController = ORKTaskViewController(task: joinTask, taskRunUUID: nil)
taskViewController.delegate = self
self.presentViewController(taskViewController, animated: true, completion: nil)
Presentando un taskViewController
Delegate
if let results = taskResult.results as? [ORKStepResult] {
for stepResult: ORKStepResult in results {
for result: ORKResult in stepResult.results! {
if let questionResult = result as? ORKQuestionResult {
if let answer = questionResult.answer {
if questionResult.identifier == "ORKRegistrationFormItemEmail" {
// do something
}
}
}
if let questionResult = result as? ORKChoiceQuestionResult {
if questionResult.identifier == ActivitiesListRow.SurgicalHistoryIdentifier.rawValue {
// do something
}
Iterando por identi๏ฌer
Iterando por el tipo de result
HealthKit
import UIKit
import HealthKit
class DailyHealthManager {
static let sharedInstance = DailyHealthManager()
lazy var healthStore: HKHealthStore = HKHealthStore()
// MARK: Healthkit read and write values
let healthDataItemsToRead: Set<HKObjectType> = [
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount)!,
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceWalkingRunning)!,
HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierFlightsClimbed)!
]
let healthDataItemsToWrite: Set<HKSampleType> = [
HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount)!
]
func getHealthAuthorization(completion: (success: Bool, error: NSError?) -> Void) {
// Get authorization to access the data
healthStore.requestAuthorizationToShareTypes(healthDataItemsToWrite, readTypes: healthDataItemsToRead) {
success, error in
completion(success:success, error:error)
}
}
โ€ข Pedir autorizaciรณn para lecura y escritura de datos
private func queryDistance(predicate: NSPredicate?, _ sortDescriptor: NSSortDescriptor) {
let distance = HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceWalkingRunning)!
let sumOption = HKStatisticsOptions.CumulativeSum
healthStore.executeQuery(
HKStatisticsQuery(quantityType: distance,
quantitySamplePredicate: predicate,
options: sumOption) { [unowned self] query, result, error in
if let sumQuantity = result?.sumQuantity() {
// do something
}
}
)
}
โ€ข Queries
We are hiring!
team@decemberlabs.com

More Related Content

What's hot

What's hot (10)

Autosys Complete Guide
Autosys Complete GuideAutosys Complete Guide
Autosys Complete Guide
ย 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
ย 
Testing React hooks with the new act function
Testing React hooks with the new act functionTesting React hooks with the new act function
Testing React hooks with the new act function
ย 
iOS Talks 6: Unit Testing
iOS Talks 6: Unit TestingiOS Talks 6: Unit Testing
iOS Talks 6: Unit Testing
ย 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4
ย 
JS Conf 2018 AU Node.js applications diagnostics under the hood
JS Conf 2018 AU Node.js applications diagnostics under the hoodJS Conf 2018 AU Node.js applications diagnostics under the hood
JS Conf 2018 AU Node.js applications diagnostics under the hood
ย 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
ย 
React 101
React 101React 101
React 101
ย 
Evan Schultz - Angular Camp - ng2-redux
Evan Schultz - Angular Camp - ng2-reduxEvan Schultz - Angular Camp - ng2-redux
Evan Schultz - Angular Camp - ng2-redux
ย 
Ngrx
NgrxNgrx
Ngrx
ย 

Similar to Swift Montevideo Meetup - iPhone, una herramienta medica

[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade ServerlessKatyShimizu
ย 
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade ServerlessKatyShimizu
ย 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC InternalsVitaly Baum
ย 
Build Widgets
Build WidgetsBuild Widgets
Build Widgetsscottw
ย 
Xamarin: Introduction to iOS 8
Xamarin: Introduction to iOS 8Xamarin: Introduction to iOS 8
Xamarin: Introduction to iOS 8Xamarin
ย 
Architecture Components
Architecture ComponentsArchitecture Components
Architecture ComponentsSang Eel Kim
ย 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101Munish Gupta
ย 
Reactive state management with Jetpack Components
Reactive state management with Jetpack ComponentsReactive state management with Jetpack Components
Reactive state management with Jetpack ComponentsGabor Varadi
ย 
BPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveBPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveAlfresco Software
ย 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Patterngoodfriday
ย 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to CeleryIdan Gazit
ย 
What 100M downloads taught us about iOS architectures
What 100M downloads taught us about iOS architecturesWhat 100M downloads taught us about iOS architectures
What 100M downloads taught us about iOS architecturesFrancesco Di Lorenzo
ย 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonfNataliya Patsovska
ย 
Knowing is Understanding: A road trip through Google analytics for Windows Ph...
Knowing is Understanding: A road trip through Google analytics for Windows Ph...Knowing is Understanding: A road trip through Google analytics for Windows Ph...
Knowing is Understanding: A road trip through Google analytics for Windows Ph...blugri software + services BVBA
ย 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsBizTalk360
ย 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for freeBenotCaron
ย 
RxBinding-kotlin
RxBinding-kotlinRxBinding-kotlin
RxBinding-kotlinSatoru Fujiwara
ย 
Activities.pptx
Activities.pptxActivities.pptx
Activities.pptxmahamaalej3
ย 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Paco de la Cruz
ย 

Similar to Swift Montevideo Meetup - iPhone, una herramienta medica (20)

[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless
ย 
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
ย 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC Internals
ย 
Build Widgets
Build WidgetsBuild Widgets
Build Widgets
ย 
French kit2019
French kit2019French kit2019
French kit2019
ย 
Xamarin: Introduction to iOS 8
Xamarin: Introduction to iOS 8Xamarin: Introduction to iOS 8
Xamarin: Introduction to iOS 8
ย 
Architecture Components
Architecture ComponentsArchitecture Components
Architecture Components
ย 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
ย 
Reactive state management with Jetpack Components
Reactive state management with Jetpack ComponentsReactive state management with Jetpack Components
Reactive state management with Jetpack Components
ย 
BPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveBPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep Dive
ย 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
ย 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to Celery
ย 
What 100M downloads taught us about iOS architectures
What 100M downloads taught us about iOS architecturesWhat 100M downloads taught us about iOS architectures
What 100M downloads taught us about iOS architectures
ย 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
ย 
Knowing is Understanding: A road trip through Google analytics for Windows Ph...
Knowing is Understanding: A road trip through Google analytics for Windows Ph...Knowing is Understanding: A road trip through Google analytics for Windows Ph...
Knowing is Understanding: A road trip through Google analytics for Windows Ph...
ย 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
ย 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for free
ย 
RxBinding-kotlin
RxBinding-kotlinRxBinding-kotlin
RxBinding-kotlin
ย 
Activities.pptx
Activities.pptxActivities.pptx
Activities.pptx
ย 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
ย 

Recently uploaded

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
ย 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
ย 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
ย 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
ย 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
ย 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
ย 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
ย 
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night StandCall Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Standamitlee9823
ย 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
ย 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
ย 
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...Call Girls in Nagpur High Profile
ย 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
ย 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
ย 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
ย 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
ย 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
ย 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfEr. Suman Jyoti
ย 

Recently uploaded (20)

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
ย 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ย 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
ย 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
ย 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
ย 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
ย 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
ย 
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night StandCall Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
ย 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
ย 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
ย 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
ย 
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth โŸŸ 6297143586 โŸŸ Call Me For Genuine Se...
ย 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
ย 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ย 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
ย 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
ย 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ย 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
ย 

Swift Montevideo Meetup - iPhone, una herramienta medica

  • 1. iPhone, una herramienta mรฉdica Helen Olhausen y Washington Miranda
  • 3. CareKit โ€ข Care Cards โ€ข Symptom and Measurement Tracker โ€ข Insights โ€ข Connect โ€ข Care Plan Store
  • 8. ResearchKit โ€ข Informed Consent โ€ข Surveys and Active Tasks โ€ข Dashboardโ€จ โ€จ
  • 14. 3 Modules Survey - Consent - Active Tasks
  • 15. Cada actividad que se pide al usuario realizar se modela como una Task
  • 16.
  • 17.
  • 19. Consent ORKConsentDocument โ€ข public var sections: [ORKStepConsentSection]? โ€ข ORKStepConsentSectionโ€จ public init(type: ORKConsentSectionType) โ€จ tiene section types por defecto
  • 21. Surveys ORKNavigableOrderedTask โ€ข overrides `stepAfterStep` - (ORKStep *)stepAfterStep:(ORKStep *)step withResult:(ORKTaskResult *)result La usamos cuando queremos que nuestro proximo step, dependa del resultado del step anterior, para esto de๏ฌnimos reglas ORKStepNavigationRule, como por ejemplo: // if user answers 'No' take it to the end of the survey let resultSelector = ORKResultSelector(resultIdentifier: "physical_activity_pain")โ€จ let predicateNonEligibleSurvey = ORKResultPredicate. predicateForBooleanQuestionResultWithResultSelector(resultSelector,expectedAnswer: false) โ€จ let predicateRule = ORKPredicateStepNavigationRule(resultPredicatesAndDestinationStepIdentifiers: [(predicateNonEligibleSurvey, summaryStep.identifier)]) โ€จ physicalActivityTask.setNavigationRule(predicateRule, forTriggerStepIdentifier:"physical_activity_pain")
  • 23. The โ€œnot so easyโ€ Active Task
  • 24. Active Tasks Active Step โ€ข Interactivo โ€ข Recolecciรณn de datos usando sensores
  • 25. Active Step โ€ข Es donde se realmente se โ€œhace el trabajoโ€
  • 26. import UIKit import ResearchKit class WalkTillStationaryTaskStep: ORKActiveStep { var maxStationaryDuration : NSTimeInterval! static func stepViewControllerClass() -> AnyObject { return WalkTillStationaryTaskStepViewController.self } override init(identifier: String) { super.init(identifier: identifier) self.shouldShowDefaultTimer = false } required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.shouldShowDefaultTimer = false } // por defecto si no se define un stepDuration, la actividad comienza como finalizada func startsFinished() -> Bool { return false } } Caso Particular โ€ข Terminar el step cuando el usuario deja de caminar por mas de un minuto โ€ข Subclass ORKActiveStep โ€ข Implementar stepViewControllerClass(), este mรฉtodo le dice al task view controller quรฉ Step view controller instanciar cuando va a presentar este Step
  • 27. โ€ข Subclass ORKActiveStepViewController import UIKit import ResearchKit import CoreMotion class WalkTillStationaryTaskStepViewController: ORKActiveStepViewController { โ€ฆ override func viewDidLoad() { super.viewDidLoad() self.customView = WalkTillStationaryContentView() โ€ฆ override func start() { super.start() // Start Timers self.startStationaryTimer() self.startElapsedTimer() // Start self recorders // start tracking user activity self.startUpdateActivity() // start pedometer self.startPedometer() } override func suspend() { super.suspend() motionActivitiyManager.stopActivityUpdates() } โ€ฆ private func stationaryTimerDidFire() { // user has been stationary for more than one minute self.suspend() self.finish() } โ€ฆ
  • 28. โ€ข Subclass ORKActiveStepCustomView โ€จ provee la vista custom del view controllerโ€จ public var customView: UIView? โ€ข Active step life cycleโ€จ override start, suspend, resume, ๏ฌnish โ€ข Data collectionโ€จ public var recorders: [AnyObject]? (read-only) โ€จ Los recorders se generan cuando comienza el step basรกndose en las `recorder con๏ฌguration` para ese stepโ€จ var recorderConfigurations = [ORKRecorderConfiguration]() recorderConfigurations += [ORKPedometerRecorderConfiguration(identifier: "pedometer")] โ€ข Output directory โ€จ taskViewController.outputDirectoryโ€จ โ€ข CoreMotion
  • 29. var steps = [ORKStep]() let countdownStep = ORKCountdownStep(identifier: "countdown_step") countdownStep.stepDuration = 5.0 steps += [countdownStep] var recorderConfigurations = [ORKRecorderConfiguration]() recorderConfigurations += [ORKPedometerRecorderConfiguration(identifier: "pedometer")] let walkingStep = WalkTillStationaryTaskStep(identifier: "walk_step") walkingStep.title = NSLocalizedString("Continue walking as much as you can", comment: "") walkingStep.text = NSLocalizedString("Hit the stop button to stop exercise", comment: "") walkingStep.shouldContinueOnFinish = true walkingStep.optional = false steps += [walkingStep] let task = ORKOrderedTask(identifier: โ€œwalk_stationary_taskโ€, steps: steps) let taskViewController = ORKTaskViewController(task: activity.task, taskRunUUID: activity.taskUUID) taskViewController.delegate = self taskViewController.outputDirectory = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first! self.presentViewController(taskViewController, animated: true, completion: nil) Declaro el step para ser usado en una Task
  • 30. Getting Results extension JoinViewController : ORKTaskViewControllerDelegate { func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) { if reason == .Completed { if taskViewController.task?.identifier == "registrationTask" { self.handleUserRegistration(taskViewController.result) } else if taskViewController.task?.identifier == "registrationAdditionalTask" { self.handleUserAdditionalInfo(taskViewController.result) } } self.dismissViewControllerAnimated(true, completion: nil) } } โ€ข Los identi๏ฌcadores รบnicos toman importancia let joinTask = ORKOrderedTask(identifier: "registrationTask", steps: [ consentStep, shareStep, healthDataStep, registrationStep ] ) let taskViewController = ORKTaskViewController(task: joinTask, taskRunUUID: nil) taskViewController.delegate = self self.presentViewController(taskViewController, animated: true, completion: nil) Presentando un taskViewController Delegate
  • 31. if let results = taskResult.results as? [ORKStepResult] { for stepResult: ORKStepResult in results { for result: ORKResult in stepResult.results! { if let questionResult = result as? ORKQuestionResult { if let answer = questionResult.answer { if questionResult.identifier == "ORKRegistrationFormItemEmail" { // do something } } } if let questionResult = result as? ORKChoiceQuestionResult { if questionResult.identifier == ActivitiesListRow.SurgicalHistoryIdentifier.rawValue { // do something } Iterando por identi๏ฌer Iterando por el tipo de result
  • 32. HealthKit import UIKit import HealthKit class DailyHealthManager { static let sharedInstance = DailyHealthManager() lazy var healthStore: HKHealthStore = HKHealthStore() // MARK: Healthkit read and write values let healthDataItemsToRead: Set<HKObjectType> = [ HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount)!, HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceWalkingRunning)!, HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierFlightsClimbed)! ] let healthDataItemsToWrite: Set<HKSampleType> = [ HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierStepCount)! ] func getHealthAuthorization(completion: (success: Bool, error: NSError?) -> Void) { // Get authorization to access the data healthStore.requestAuthorizationToShareTypes(healthDataItemsToWrite, readTypes: healthDataItemsToRead) { success, error in completion(success:success, error:error) } } โ€ข Pedir autorizaciรณn para lecura y escritura de datos
  • 33. private func queryDistance(predicate: NSPredicate?, _ sortDescriptor: NSSortDescriptor) { let distance = HKQuantityType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceWalkingRunning)! let sumOption = HKStatisticsOptions.CumulativeSum healthStore.executeQuery( HKStatisticsQuery(quantityType: distance, quantitySamplePredicate: predicate, options: sumOption) { [unowned self] query, result, error in if let sumQuantity = result?.sumQuantity() { // do something } } ) } โ€ข Queries