jamelkenya.com

Mastering Health Data Extraction on Your iPhone Effortlessly

Written on

Chapter 1: Understanding the Health App

The Health app on your iPhone is a robust tool packed with features, making it challenging to locate specific information amid the vast amount of data it collects. With Apple’s commitment to enhancing health tracking, the situation can become even more overwhelming.

Fortunately, there is a straightforward and cost-free method to navigate this complexity. By utilizing Shortcuts, you can extract specific health data from your iPhone and even automate the process for convenience.

In this guide, I'll demonstrate how to:

  • Extract step counts from your Apple Watch and iPhone.
  • Import the data into Numbers for analysis.
  • Utilize a pivot table to visualize your findings.

The simplicity of this shortcut lies in its design: a single action retrieves the data, and a loop converts it into CSV format. This process is entirely free for iPhone users.

What We Will Retrieve

Health information is exclusively accessible on your iPhone; shortcut actions for fetching this data are not available on iPads. For this demonstration, I will extract step counts recorded by both my Apple Watch and iPhone.

The data fields we will focus on include:

  • Source: The device that collected the data.
  • Start Date: When the data collection began.
  • Stop Date: When the data collection ended.
  • Duration: The time span of the activity.
  • Units: The measurement units used.
  • Values: The actual data point.

Creating the Shortcut

To create and run this Shortcut, follow these steps on your iPhone:

Shortcut to retrieve health information
  1. In the Shortcuts app, type "health" in the search bar. Select the "Find All Health Samples" action and adjust the type to "Steps," adding a filter for your preferred start date.
  2. Next, incorporate a "Repeat with each item" action, which should automatically include "Health Samples."
  3. Within the loop, add a Text action. Tap the Text field, select "Select Variable," and choose "Repeat Item," then repeat for each required field, separating them with commas.
  4. After the loop, add another Text action, selecting "Repeat Results."
  5. Finally, insert a Quick Look action to use the share menu for copying the retrieved data to your clipboard.

Note: While you can extract data for a range of dates, this may slow down the retrieval process. The first run of the shortcut may take longer, but subsequent attempts will be quicker.

Importing Your Data into Numbers

Once you've run the shortcut, there will be a brief pause before the Quick Look window appears. Use the share menu to copy the CSV text.

What’s next? Open Numbers (available for free on iPhone, iPad, and Mac), select a blank template, click on cell B2, and paste the data.

Raw data in Numbers

Organize the data by labeling the columns and removing column A. Adjust the column widths for a tidy appearance.

Tidied up data in Numbers

Check your Health app for the step count corresponding to your selected day. You might notice that the total in the Steps column is approximately double what the Health app displays.

Understanding Your Data

In my case, the steps data originates from two devices: my Apple Watch and iPhone. It’s essential to differentiate the sources. A pivot table can simplify this analysis.

Let’s walk through the steps to create one. You can also download my Numbers spreadsheet for reference.

  1. Tap any cell in the table and select the green “Cell” button.
  2. A menu will appear; choose “Create Pivot Table.”
  3. Navigate to the newly created pivot table worksheet. Tap the icon next to the paintbrush.
  4. Move the Source field information to the columns section of the pivot table.
  5. Place the Start Date in the rows section and the Value in the values section.

Look at the results in columns B and C; the figures should now align more closely with what you observed in the Health app. It appears that the app processes data from various sources differently.

Final Thoughts

You now have the ability to extract and analyze health data that is meaningful to you, with the option to automate the process. No longer will you need to wait for Apple to release a new iOS version for updates.

While it's understandable why Apple might obscure raw health data—given its collection from diverse sources using varying parameters—this complexity reflects the reality that determining accurate health information can be challenging.

The uncertainty it creates is something Apple addresses through machine learning, though it doesn't completely resolve it. Consulting a medical professional before relying solely on this data for health decisions is always advisable.

Explore more of my articles on Apple Shortcuts:

Apple Shortcuts

This video discusses over 25 hidden features and tips for Apple Health that can enhance your health tracking experience.

Learn how to export heart data from Apple Health to CSV and visualize graphs of heart rate ranges and averages for better insights.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Embrace Change: A Lesson from Sitcom Wisdom

Discover how a Seinfeld episode inspires transformative life changes through the concept of doing the opposite.

Embracing Authenticity: Why I Choose Not to Use Botox

Exploring the societal pressures around cosmetic procedures and the importance of embracing natural beauty.

# Understanding NoSQL Injection: Risks and Mitigation Strategies

A comprehensive overview of NoSQL injection attacks, their risks, and prevention strategies to secure applications against vulnerabilities.

# Understanding the Real Reasons Behind Your Lack of Motivation

Explore the misconceptions surrounding motivation and find out why it often eludes you. Discover practical insights for lasting change.

# Lessons from School: What We Should Leave Behind

Reflecting on outdated lessons from school that don’t apply in real life and emphasizing the importance of continuous learning.

# Biden: A Good President, But Not Good Enough for Today's Challenges

Joe Biden may be a decent leader, but America needs visionary leadership to tackle today’s unprecedented challenges.

Understanding Cortisol: The Balance Between Stress and Health

Explore cortisol's dual role in health, the importance of balance, and tips for managing stress effectively.

The Future of Angular and Wiz: A Unified Development Vision

Explore the merging of Angular and Wiz for improved web app development, focusing on performance and user experience.