Discover how you can take your app's health monitoring to the next level with motion data. Meet Walking Steadiness for iPhone and the six-minute-walk metric for Apple Watch: Walking Steadiness can help your app interpret someone's quality of walking and risk of falling, while the six-minute-walk metric — along with the HealthKit estimate recalibration API — can track changes to walking endurance following acute events like surgery. We'll show you how you can support these metrics and help provide actionable health data to people who use your app, helping improve patient care and clinical trials, especially as more services must be delivered remotely.
♪ Bass music playing ♪ ♪ Irida Mance: Hello and welcome to WWDC.
I'm Irida, a scientist on the Apple software team, and I will be joined by Sohum, a Motion engineer.
Today, we'll introduce two brand-new features that will enable you to better understand walking endurance and quality.
Walking is a vital sign.
The way an individual walks is highly informative of their overall health and well-being.
It can be used to track recovery from an injury, assess risk of falling, monitor the aging process, and even predict mortality.
At WWDC2020, we introduced a suite of mobility metrics that provide a powerful insight into your walking patterns throughout the day.
You can learn all about them in last year's session, "Beyond counting steps".
Today we're excited to share an update to one of these metrics: the Six-Minute Walk metric, available for Apple Watch.
Through a new recalibration API, the metric will enable you to better capture acute changes in health.
In addition, we're going to talk about a brand-new metric: the Walking Steadiness feature, available for iPhone.
What do these two metrics have in common? They're both great ways to track important aspects of walking and can provide continuous and objective measures for monitoring improvements or catching early warning signs.
But they capture different things.
The Six-Minute Walk metric estimates how far you can walk in six minutes and is a measure of your walking capacity and endurance.
Walking steadiness captures the quality of your walking and is designed to make it easy for you to assess an individual's risk of falling based on their mobility.
Whether you are tracking these metrics week over week -- to measure changes in response to treatment -- or year over year -- to monitor natural aging trends -- both metrics can provide a unique window into an individual's health.
We'll start by diving deeper into the Six-Minute Walk distance metric.
The in-clinic Six-Minute Walk test is a staple for clinicians in many fields to assess cardiovascular and musculoskeletal health.
The metric captures walking endurance for low-capacity individuals.
It can help identify which individuals have a lower endurance relative to others their age and height, which is often indicative of poor health outcomes.
This year, using a new recalibration API, the Six-Minute Walk metric is also a great way to track changes to walking capacity following an intervention -- such as a surgery -- or an acute events, like an injury.
Let's run through a scenario where recalibrating the Six-Minute Walk metric will be useful.
Imagine that we have a patient, Jamie, who just had knee surgery.
We know that Jamie could barely walk after surgery, but we only see a small dip in their Six-Minute Walk estimate.
Let's look into what may be causing this.
To build an accurate estimate of an individual's capacity, the Six-Minute Walk distance estimate looks at activity and motion data across a historical measurement window.
For example, this is the measurement window used for this estimate.
To see how far back an estimate looked, you can use a brand-new metadata field, which will tell you the beginning of the data window used.
We can see that our example estimate used data from way before the surgery.
What we can do now is recalibrate our estimates to use data only postsurgery.
With this recalibration, our estimates now capture Jamie's true dip in mobility immediately following the surgery, which allows for a way more accurate pre- and postsurgery comparison.
Now, Sohum can show us how to use these new features in your app.
Sohum Thakkar: Thank you, Irida! The recalibration API lets you use your knowledge of Jamie's surgery date to improve their Six-Minute Walk distance estimates.
If know you want to recalibrate, you can use the brand-new recalibrateEstimates method in HKHealthStore.
This new method has a few requirements.
The first thing you need is a SampleType that can be recalibrated.
You can check if a type can be recalibrated with the .allowsRecalibration ForEstimates property.
As of iOS 15, sixMinuteWalkType is the only sampleType that can be recalibrated.
The second thing you need is a new entitlement.
You can add this entitlement to your Xcode project yourself.
And lastly, your app will need authorization for both reading and sharing the SampleType.
To prompt the user to grant your app authorization, simply create a set with just the Six-Minute Walk distance type, and then pass it in to healthStore. requestAuthorization.
And with those requirements out of the way, let's recalibrate.
Just use HKHealthStore's recalibrateEstimates method and pass in the date of surgery.
Since this affects the patient's health data, a prompt will pop up on screen asking them to allow the recalibration.
And that's it! For the next few estimates, you'll see the recalibration date reflected in the Measurement Start Date in the Health App and in the EarliestDateUsed ForEstimate metadata that will come with every HealthKit sample.
A few things to consider: First, this method does not affect estimates that are already present in HealthKit at the time of use, so it's important to recalibrate as soon as possible after a surgery.
Secondly, after recalibration, it could take up to 14 days to rebuild enough activity history to make a confident estimate.
And thirdly, the effect is temporary.
Once the recalibration date is far enough in the past, the estimates will once again start using their normal measurement window.
You might be tempted to recalibrate every fall or every surgery you learn about, but these often don't result in reduced mobility or fitness.
There's a trade-off.
In general, a longer data window will result in more accurate estimates but will be less responsive to acute changes.
In Jamie's case, we know their surgery will cause a substantial change to their mobility and fitness, and we'd like to monitor that change closely.
If they're not recovering well, we can reach out and provide support.
This new recalibration API extends the capabilities of Apple's Six-Minute Walk distance metric to a whole new use case of tracking recovery from injury or surgery.
We hope you'll find it useful in better monitoring your patient's health and improving outcomes.
Now I'd like to pass it off to Irida to tell you about a brand-new metric, Walking Steadiness, which measures a different dimension of your walking.
Irida: Thanks, Sohum.
In addition to being able to track how much or how far an individual is able to walk, it's also important to monitor the quality of that movement.
With iOS 15, we've built upon our foundational understanding of walking quality and extended it through a new metric, the Apple Walking Steadiness metric.
The metric is designed for you to better understand your overall walking quality and can help assess your risk of falling due to a mobility limitation in the next 12 months.
Your quality of walking is impacted by many factors, including your muscular strength, your physical endurance, your balance, or external factors like injuries or surgeries, all of which can alter your risk of falling.
The Apple Walking Steadiness metric provides a unified way to track the mobility components that contribute to fall risk.
The feature consists of three elements.
First, we provide a score that can be used to continuously monitor changes in walking steadiness over time.
A new score will be saved to HealthKit weekly, and it will represent the user's steadiness for that week.
The score provides you the greatest level of detail; the higher the score, the better your walking quality, and the lower your predicted risk of falling because of a mobility limitation.
Second, to give a better idea of what the steadiness scores mean, we've categorized them into three classifications: OK, Low, and Very Low.
These classifications provide you a simpler way of identifying who is at the highest risk of falling.
Lastly, after individuals onboard onto the Walking Steadiness feature in the Health app, we have enabled a notification.
The notification will alert individuals whenever their steadiness has dropped to the Low or Very Low category, or if they've remained at those categories for several months.
Now you may be wondering, What does steadiness look like for typical healthy individuals throughout their life? Let's see what the Walking Steadiness metric could look like for two folks.
For this individual, their walking quality decreases as they age.
This is fairly typical.
We've all seen that our elderly relatives may not walk as well as us.
But we also know there are behavioral factors that contribute to steadiness.
For example, an individual that is able to maintain a high level of fitness is likely to preserve a higher quality of walking as they age.
But we also know that age or better fitness are not the only factors that impact walking steadiness.
Acute events like an ankle injury can drastically change walking quality and lead to heightened fall risk.
So anyone can bounce between steadiness categories throughout their life.
And as I mentioned, the steadiness classification helps you understand the significance of these changes.
Let's dive a little deeper into what individuals with these classification levels may look like.
An OK classification will be your healthy, confident walker.
They generally will not have any difficulty going about their day and doing many of the tasks that challenge their strength and coordination.
Their scores will be high, and their risk of falling due to a mobility-related health issue is low.
A low-classification individual will have more compromised mobility.
They may be generally OK; but in more challenging situations -- say a difficult hike -- they may need to take more precautions to prevent from falling.
They might not have fallen yet, but this early awareness will be useful.
Lastly, a Very Low classification is indicative of someone that has noticeably compromised steadiness.
Based on their mobility, this individual would be at high risk of falling.
Again, they might not have fallen yet, but their mobility is compromised, and they should take the necessary measures to avoid situations where falls are more likely to happen or, if possible, to improve their strength and balance through exercise.
That's what this metric is capable of.
Now you might ask, What is required to get a Walking Steadiness estimate? Actually, not much.
the metric is optimized to measure steadiness while individuals are carrying their iPhone in some of the most common locations, for example, a pant pocket, a jacket pocket, even a purse held closely; all will work as long as the device is held tightly to the center of your body.
Now back to Sohum to walk us through how to leverage the Walking Steadiness metric in your apps.
Thanks, Irida for that introduction to Walking Steadiness.
Let's put it to use.
Imagine you're building an app for a physical therapy clinic.
One of the toughest challenges in physical therapy and rehabilitation is tracking progress.
And now that most visits are virtual, and telehealth is gaining popularity, it can be even tougher.
Let's say your app's purpose is to keep patients up to date and identify those at higher risk of falling and those who are declining in steadiness.
That's an incredibly difficult thing to measure, but Walking Steadiness can help.
As Irida mentioned, Walking Steadiness has three elements: the score, the classification, and the notification.
We'll see how each can be integrated into your app for physical therapy patients...
starting with the score.
Let's say you want to display a patient's most recent steadiness score.
Let's see how to do that.
The score is a HealthKit quantityType with the name appleWalkingSteadiness.
Since it's an Apple-defined metric, it's read-only.
Its unit in HealthKit is percent, and it ranges from zero to one.
And it's written weekly, although estimates may be delayed if there isn't enough data to compute an estimate.
To kick us off, let's grab an authorization.
We'll construct a set with the appleWalkingSteadiness type.
Then, we'll call requestAuthorization.
To get the most recent steadiness score, we'll construct a SampleQuery with a limit of one, sorted by end date.
If there is a returned sample, we'll grab the value with percent units and update our status in the app.
This is what it'll look like.
The score is great for tracking trends, but is sometimes kind of hard to interpret on its own.
What does 45 mean? The classification might be the more appropriate level of granularity for most people.
Let's use it to add context.
The classification comes in the form of a brand-new HealthKit enum: HKAppleWalkingSteadiness Classification.
The enum can take the values .ok, .low, and .veryLow.
Starting from our previous code to grab the most recent score, it only takes a single line to convert a score to a classification.
The classification enum has a convenience constructor that will translate a score to the appropriate classification.
And we'll display the classification along with the score.
There! That's far more interpretable.
Now we can tell this individual is in the Low classification and may be at increased risk of falling.
OK, so now let's tackle the patient-monitoring portion of this app.
We'd like to be able to identify and reach out to patients who are at high risk of falling.
The Walking Steadiness notification is great for this.
You can register to be notified when a patient receives a steadiness notification and reach out to them for a check-in.
The notification arrives in HealthKit as a CategoryType sample, and it's called "appleWalkingSteadinessEvent" in HealthKit.
It's also a read-only type.
There are four types of steadinessEvents.
.initialLow and .initialVeryLow are triggered about a month after the individual drops into the Low or Very Low classifications.
After this initial notification, .repeatLow or .repeatVeryLow events will remind the individual about once every three months if they stay at the same classification.
You can read more about the notification types in the developer documentation in the links associated with this session.
To read the notifications, we'll need another authorization.
This time, we'll construct a set with only the type appleWalkingSteadinessEvent and pass it in to the requestAuthorization method.
Let's watch for notifications.
Here we're creating an HKObserverQuery that will execute a handler every time a steadiness event is saved to HealthKit, meaning the user got a notification.
In this handler, we'll prompt the user for a checkup.
We'll also allow HealthKit to deliver the event to us in the background to ensure we can respond to the notification within a day.
When we execute the query, our app will begin listening for notifications.
And every time the user receives a notification, we could trigger a prompt to schedule a virtual checkup with the clinic.
Great! Now you can reach out to patients at increased fall risk.
But there are other users a physical therapy clinic might be interested in.
Here's an example of a patient who showed great progress at first but is now declining in steadiness.
They wouldn't have received a Walking Steadiness notification because they aren't yet at a higher-fall-risk classification.
But a physical therapy clinic might be concerned about trends like this.
Are the exercises appropriate? Are they causing damage? Is the patient just not keeping up? We'd like to schedule a follow-up, so let's design our own notification criteria.
Here are the patient's steadiness scores over time.
The plan is to query six weeks of steadiness scores and calculate the best-fit slope.
We'll do this every week, and if a patient's steadiness is declining more than, say, five points per week on average, we should try to schedule a check-in.
Let's create a predicate to query in the past six weeks and execute an HKSampleQuery for the appleWalkingSteadiness QuantityType.
In the callback, we'll pass the results off to a detectTrends function.
Now, all we need to do is calculate the best-fit slope, using a custom function we have defined, and check if it's less than -5, meaning steadiness is declining at a rate of over five points per week.
And if it is, we can prompt the user for a checkup, just like before.
So now when we detect their steadiness is declining, they will receive a prompt! So that's how to use all three elements of Walking Steadiness and how to design your own simple notification criteria.
It's never been so easy to perform passive mobility monitoring.
But let's not get ahead of ourselves.
All of this is dependent on the patient getting Walking Steadiness scores.
Here are four best practices to make sure they don't miss a single sample.
First off, users will only get steadiness if they have their height set in the Health app.
Weight and age are highly recommended.
So first things first, let's prompt them for those.
We recommend writing updated samples directly, via the HealthKit API.
Secondly, we recommend prompting the user to turn on Apple's Walking Steadiness notifications.
They can do this from the Health app in the Mobility room.
Third, as Irida mentioned, for the vast majority of patients, keeping their phone in their pocket while they go about their everyday activities is enough to get steadiness scores.
Let's just encourage them to take their phone with them while they're walking around.
To check if they're meeting the walking criteria, we can check if they're receiving walking speed estimates in HealthKit.
Two weeks with consistent Walking Speed samples is a good indicator they're carrying their device enough.
As a reminder, walking speed requires an iPhone 8 or above, and is measured when the phone is held tightly to the center of the body while walking over flat ground.
A quick glance in the Health app, or a quick HealthKit query, can tell us if we need to prompt them to walk with their phone more.
So there you have it! You have all the tools you need to build the next-generation physical therapy app that can keep track of your patient's walking quality without any dedicated equipment or assessments.
Now, over to Irida to talk about the many other amazing ways you can use Walking Steadiness for health monitoring.
Irida: Thanks, Sohum.
We just saw how Walking Steadiness can make a huge difference to virtual care for physical therapy, and it can do so much more.
Consider using Walking Steadiness if you want to build an app that helps families check up on an aging grandparent, or perhaps you can help patients with neurological diseases like multiple sclerosis monitor disease progression.
You could even use it to recommend workouts and hikes that are more tailored to an individual's fall risk.
Walking Steadiness and the new capabilities for Six-Minute Walk built on top of a rich ecosystem for using motion sensing to monitor heath.
Given the strong ties between mobility, cardiovascular and respiratory functioning, we encourage you to explore how metrics related to cardiovascular health on the Apple Watch -- and mobility for the iPhone -- can be used for rehabilitation or prehabilitation applications, to best prepare patients for successful surgery.
Or consider how Walking Steadiness, the mobility metrics, and our Movement Disorder API can be combined to monitor the complicated motor symptoms of Parkinson's Disease.
The combination of these metrics can unlock a truly powerful experience for your apps.
To wrap up, we want to provide some best practices when collecting this data.
First, though walking is something we don't often think a lot about, as we've just seen, it carries a powerful health signal.
As with any health information, make sure that your data collection has strong privacy and security safeguards.
Any data you take outside of HealthKit should at the very least be key-coded and encrypted.
Next, you should be transparent about the information you are collecting and why.
Anytime you request to read a certain HealthKit type, we'll prompt the user to approve its use.
But beyond this basic measure, it's our joint responsibility to collect only the most meaningful data and to be transparent on how that data will be used.
For example, for Six-Minute Walk estimates, our users should understand when the recalibration is appropriate and how it helps their care.
For the Walking Steadiness metric, the requirements to get an estimate should be clearly communicated.
Working with domain experts, like physicians or physical therapists, will ensure that you collect the most meaningful data from these metrics.
Lastly, your customer should have control of their data.
In HealthKit, an individual can tap Show All Data and delete any and all samples collected from them.
If you take data outside of HealthKit, your customer should have an easy way to view and delete, turn off data collection, or have other means to exercise control over what is collected from them.
Whether you are using Walking Steadiness to measure quality of movement, the Six-Minute Walk metric to assess recovery from injury, or any other health metric, following these guidelines will protect our customers' data and promote user trust.
A commitment to these principles is essential when handling any health data.
OK, that's a wrap for us.
We want to thank you for watching and being part of WWDC21.
We cannot wait to see what you build next.
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.