1 of 105

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!

2 of 105

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!

3 of 105

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 🎬

4 of 105

In-Person Today!! Yay!!

Tuesday 05:30p-07:00p

CCSR Rm 4107

Thursday 05:20p-07:00p

CCSR Rm 4205

5 of 105

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!

6 of 105

Assignment 4 (Beta Release)

Look at link in syllabus!

  1. Add new feature
  2. Add visualization for study progress
  3. Define a secure set of rules for Firebase
  4. Contact card

Due 2/24/22 (Thursday)

7 of 105

More on HealthKit

Santiago Gutierrez

CardinalKit Co-Founder

Today

8 of 105

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

9 of 105

HealthKit is a store of health and fitness data.

CardinalKit

any iOS app

Google

Cloud Healthcare API

10 of 105

11 of 105

21st Century Cures Act

Final Rule (March 2020)

  • Rules to prevent INFORMATION BLOCKING
  • FHIR standard based APIs for patients to receive health information by 2021
  • All data elements need to be exposed via API by 2021!
  • Huge opportunity for third party developers
  • Patients become stewards of their own health records!

12 of 105

accessing data in HealthKit

use one of three available methods

  1. Direct Access
  2. Queries
  3. Long-Running Queries

13 of 105

HealthKit Sample

Small playground that you can use to try out different HealthKit queries.

Available via

https://github.com/cs342/HealthKit-Sample

14 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access

used for profile information that is rarely updated.

15 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries

everything else with entries over time is queried — from step count, to health records. Returns a snapshot.

16 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries
  • Long-Running Queries

similar to a query, but with the option to receive a callback when more similar data becomes available.

17 of 105

Getting Authorization from HealthKit

18 of 105

Getting Authorization from HealthKit

19 of 105

HealthKit Data Types

20 of 105

HealthKit Data Types

21 of 105

Getting Authorization from HealthKit

22 of 105

Getting Authorization from HealthKit

23 of 105

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

24 of 105

Getting Authorization from HealthKit

25 of 105

Getting Authorization from HealthKit

26 of 105

Getting Authorization from HealthKit

27 of 105

28 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries
  • Long-Running Queries

29 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries
  • Long-Running Queries

30 of 105

accessing data from HK

(1) direct access

31 of 105

accessing data from HK

(1) direct access

32 of 105

accessing data from HK

(1) direct access

33 of 105

accessing data from HK

(1) direct access

34 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries
  • Long-Running Queries

35 of 105

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!

36 of 105

accessing data from HK

using sample queries

37 of 105

accessing data from HK

using sample queries

38 of 105

accessing data from HK

using sample queries

39 of 105

accessing data from HK

using sample queries

40 of 105

accessing data from HK

using sample queries

41 of 105

42 of 105

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!

43 of 105

accessing data from HK

using anchor queries

44 of 105

accessing data from HK

using anchor queries

45 of 105

accessing data from HK

using anchor queries

46 of 105

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!

47 of 105

accessing data from HK

using stats queries

48 of 105

accessing data from HK

using stats queries

49 of 105

accessing data from HK

using stats queries

50 of 105

accessing data from HK

using stats queries

51 of 105

accessing data from HK

(2) using queries

Activity Query

Move, exercise, and stand data. Three rings.

Document Query

Useful to find health records!

52 of 105

accessing data from HK

using activity queries

53 of 105

accessing data from HK

using activity queries

54 of 105

55 of 105

accessing data from HK

(2) using queries

Document Query

Useful to find health records!

56 of 105

accessing data from HK

health records 🏥

57 of 105

accessing data from HK

health records 🏥

58 of 105

accessing data from HK

health records 🏥

59 of 105

accessing data from HK

health records 🏥

60 of 105

accessing data from HK

health records 🏥

61 of 105

accessing data from HK

health records 🏥

62 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries
  • Long-Running Queries

63 of 105

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.

64 of 105

accessing data from HK

(3) long queries

Observer Query

Notifies when samples change

65 of 105

accessing data from HK

using sample queries

66 of 105

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

67 of 105

accessing data from HK

background delivery

68 of 105

phone wakes up

activity detected

iOS �App

launches and (quietly) runs observer queries

69 of 105

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.

70 of 105

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.

71 of 105

accessing data from HK

using anchor queries

72 of 105

accessing data from HK

(3) long queries

Statistics Collection Query

Multiple statistic queries over time

Activity Query

Move, exercise, and stand data. Three rings.

73 of 105

accessing data from HK

(3) long queries

Statistics Collection Query

Multiple statistic queries over time

74 of 105

accessing data from HK

(3) long queries

Activity Query

Move, exercise, and stand data. Three rings.

75 of 105

accessing data in HealthKit

use one of three available methods

  • Direct Access
  • Queries
  • Long-Running Queries

76 of 105

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

77 of 105

pedometer, accelerometer; gyro; etc

Sensors

iPhone AND Apple Watch

78 of 105

Sensors & CoreMotion examples

79 of 105

80 of 105

81 of 105

82 of 105

Compress resulting files (into .zip):

https://github.com/marmelroy/Zip

(or can send to the iPhone if on Apple Watch)

Data Processing Tips

83 of 105

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.

84 of 105

85 of 105

BigQuery

86 of 105

Using BigQuery

87 of 105

Using BigQuery

88 of 105

89 of 105

Using BigQuery

90 of 105

Using BigQuery

91 of 105

Using BigQuery

92 of 105

Data Studio

Unlock the power of your data with interactive dashboards

93 of 105

94 of 105

95 of 105

If we have time…

  • Let’s explore some examples of other ResearchKit applications!

cs342-aut1920.slack.com

Don’t forget to record lecture 🎬

96 of 105

97 of 105

98 of 105

99 of 105

100 of 105

101 of 105

102 of 105

103 of 105

104 of 105

105 of 105