CS342/MED253 Building for Digital Health
Lecture 8A (02/22): Data Collection with HealthKit
Vishnu Ravi
Surabhi Mundada
Varun Shenoy
Oliver Aalami
Winter 2022
cardinalkit.slack.com
Welcome!
What’s new in Digital Health?
Medicare Advantage? Why the growth?
Zero to no premium for patients!
Narrow network
Administered by commercial insurance company
Primary care gatekeeper
CMS pays ~1000/mo to
Insurance company makes ~1,600
Per patient profit (2x employer
Sponsored health insurance)
High adoption of digital health!
Overview for today
- Announcements
- Revisiting HealthKit. How can we use it?
- Quick overview on sensor data
- Data processing tips
cardinalkit.slack.com
Don’t forget to record lecture 🎬
In-Person Today!! Yay!!
Assignment #2 (Jan 27th)
Set up a CardinalKit App with a
Firebase Backend.
Assignment #1: Getting Started (Jan 18th)
Install Xcode & join our GitHub
ResearchKit
Firebase
Assignment #4: Beta App code review (Feb 22nd)
Assignment #3: Midterm Presentation (Feb 10th)
Alpha App demo
Assignment #5: Final Presentation (Mar 10th)
MVP App code review + demo
Due 2/24!
Assignment 4 (Beta Release)
Look at link in syllabus!
Due 2/24/22 (Thursday)
More on HealthKit
Santiago Gutierrez
CardinalKit Co-Founder
Today
HealthKit is a store of health and fitness data.
pedometer, accelerometer; gyro; etc
Sensors
Hardware
e.g. sleep tracking
Apps
CardinalKit
any iOS app
iPhone AND Apple Watch
HealthKit is a store of health and fitness data.
CardinalKit
any iOS app
Cloud Healthcare API
21st Century Cures Act
Final Rule (March 2020)
accessing data in HealthKit
use one of three available methods
HealthKit Sample
Small playground that you can use to try out different HealthKit queries.
Available via
https://github.com/cs342/HealthKit-Sample
accessing data in HealthKit
use one of three available methods
used for profile information that is rarely updated.
accessing data in HealthKit
use one of three available methods
everything else with entries over time is queried — from step count, to health records. Returns a snapshot.
accessing data in HealthKit
use one of three available methods
similar to a query, but with the option to receive a callback when more similar data becomes available.
Getting Authorization from HealthKit
Getting Authorization from HealthKit
HealthKit Data Types
HealthKit Data Types
Getting Authorization from HealthKit
Getting Authorization from HealthKit
HealthKit is a store of health and fitness data.
pedometer, accelerometer, gyro, etc
Sensors
Ext. Wearables
e.g. sleep tracking
Apps
CardinalKit
any iOS app
Getting Authorization from HealthKit
Getting Authorization from HealthKit
Getting Authorization from HealthKit
accessing data in HealthKit
use one of three available methods
accessing data in HealthKit
use one of three available methods
accessing data from HK
(1) direct access
accessing data from HK
(1) direct access
accessing data from HK
(1) direct access
accessing data from HK
(1) direct access
accessing data in HealthKit
use one of three available methods
accessing data from HK
(2) using queries
Sample Query
General-purpose. You will be using these most!
Anchored Query
Only return new/modified elements.
Statistics Query
Quickly find the sum, min, max, or avg of a data set.
Activity Query
Move, exercise, and stand data. Three rings.
Document Query
Useful to find health records!
accessing data from HK
using sample queries
accessing data from HK
using sample queries
accessing data from HK
using sample queries
accessing data from HK
using sample queries
accessing data from HK
using sample queries
accessing data from HK
(2) using queries
Anchored Query
Only return new/modified elements.
Statistics Query
Quickly find the sum, min, max, or avg of a data set.
Activity Query
Move, exercise, and stand data. Three rings.
Document Query
Useful to find health records!
accessing data from HK
using anchor queries
accessing data from HK
using anchor queries
accessing data from HK
using anchor queries
accessing data from HK
(2) using queries
Statistics Query
Quickly find the sum, min, max, or avg of a data set.
Activity Query
Move, exercise, and stand data. Three rings.
Document Query
Useful to find health records!
accessing data from HK
using stats queries
accessing data from HK
using stats queries
accessing data from HK
using stats queries
accessing data from HK
using stats queries
accessing data from HK
(2) using queries
Activity Query
Move, exercise, and stand data. Three rings.
Document Query
Useful to find health records!
accessing data from HK
using activity queries
accessing data from HK
using activity queries
accessing data from HK
(2) using queries
Document Query
Useful to find health records!
accessing data from HK
health records 🏥
accessing data from HK
health records 🏥
accessing data from HK
health records 🏥
accessing data from HK
health records 🏥
accessing data from HK
health records 🏥
accessing data from HK
health records 🏥
accessing data in HealthKit
use one of three available methods
accessing data from HK
(3) long queries
Observer Query
Notifies when samples change
Anchored Query
Only return new/modified elements.
Statistics Collection Query
Multiple statistic queries over time
Activity Query
Move, exercise, and stand data. Three rings.
accessing data from HK
(3) long queries
Observer Query
Notifies when samples change
accessing data from HK
using sample queries
patient monitoring w/ HealthKit
we can respond to some changes in the health store live as they occur
Observer queries can run 100% in the background
i.e. passively without user interaction with the application
accessing data from HK
background delivery
phone wakes up
activity detected
iOS �App
launches and (quietly) runs observer queries
accessing data from HK
(3) long queries
Anchored Query
Only return new/modified elements.
Statistics Collection Query
Multiple statistic queries over time
Activity Query
Move, exercise, and stand data. Three rings.
accessing data from HK
(3) long queries
Anchored Query
Only return new/modified elements.
Statistics Collection Query
Multiple statistic queries over time
Activity Query
Move, exercise, and stand data. Three rings.
accessing data from HK
using anchor queries
accessing data from HK
(3) long queries
Statistics Collection Query
Multiple statistic queries over time
Activity Query
Move, exercise, and stand data. Three rings.
accessing data from HK
(3) long queries
Statistics Collection Query
Multiple statistic queries over time
accessing data from HK
(3) long queries
Activity Query
Move, exercise, and stand data. Three rings.
accessing data in HealthKit
use one of three available methods
HealthKit is a store of health and fitness data.
pedometer, accelerometer; gyro; etc
Sensors
Hardware
e.g. sleep tracking
Apps
CardinalKit
any iOS app
iPhone AND Apple Watch
pedometer, accelerometer; gyro; etc
Sensors
iPhone AND Apple Watch
Sensors & CoreMotion examples
Convert data in-memory to data on-disk:
https://github.com/silverfoxlabs/csv-export-swift
https://github.com/vigneshuvi/SwiftCSVExport
(or can send to the iPhone if on Apple Watch)
Data Processing Tips
Data Processing Tips
In both iOS + Watch, use a WCSession to send information from/to.
On the watch, design around limited storage and limited connectivity.
BigQuery
Using BigQuery
Using BigQuery
Using BigQuery
Using BigQuery
Using BigQuery
Data Studio
Unlock the power of your data with interactive dashboards
If we have time…
cs342-aut1920.slack.com
Don’t forget to record lecture 🎬