Prifina for Developers
  • Docs
  • Getting Data
  • Support
  • Slack
  • Blog
  • Prifina.com

Artificial iOS Healthkit Data for Software Development

12/19/2022

 
In this post, we are going deeper into the Dynamic Data project, looking at the iOS Healthkit dynamic data (library available here on GitHub and at NPM). Opening the library, you’ll see there are nine types of data objects: HKActivitySummary, HKAudiogramSample, HKCharacteristic, HKClinicalRecord, HKElectrocardiogram, HKWorkoutConfiguration, HKWorkoutSession, HKWorkoutRoute, and HKWorkouts.
Learn more about dynamic data generators and the benefits of artificial data in software development.
Picture

About the data source

Apple's HealthKit is a framework that allows developers to create health and fitness apps for the iPhone and iPad. It provides a set of data objects that can be used to represent various types of health and fitness data, including information about a person's physical activity, sleep patterns, nutrition, and medical history.

HealthKit gathers data from a wide range of sources, including sensors in Apple devices, such as the accelerometer and gyroscope, as well as third-party apps and devices that are compatible with HealthKit. For example, a person might use a fitness tracker to track their workouts and sync the data with HealthKit or a sleep tracking app to monitor their sleep patterns and sync the data with HealthKit.

The Apple Health app is a pre-installed app on Apple devices. It integrates with the HealthKit framework, which allows it to gather data from a wide range of sources, including sensors in Apple devices, such as the accelerometer and gyroscope, as well as third-party apps and devices that are compatible with HealthKit.

Overall, HealthKit is designed to provide a centralized repository for a person's health and fitness data, allowing them to track their progress and make informed decisions about their health and wellness.

Approach used

Apple provides developer documentation of the Healthkit framework. By inspecting the vital data, several JSON objects were constructed that are then stored in an NPM package. The index file of the package imports these data objects and exports them in a collection called “Data”. These mockup files make up the ios-health-data package.
HKActivitySummary
HKAudiogramSample
HKCharacteristics
HKClinicalRecord
HKElectrocardiogram
HKWorkout
HKWorkoutConfiguration
HKWorkoutRoute
HKWorkoutSession
Models Generated With JSON Crack
The ios-health-mockups package imports the files above and goes through each attribute generating artificial (new) data using proprietary functions, such as those found in the utils package.

For example, with the HKActivitySummary object:
Static HKActivitySummary Object

    
Artifical HKActivitySummary Object

    

Use case ideas

  • Health tracking app: An app that uses the ActivitySummary, Characteristic, and Workout data objects to track a person's daily activity levels, sleep patterns, and workouts. This app could provide personalized recommendations for improving health and fitness, such as suggesting specific workouts or setting daily activity goals.
  • Medical diagnostic app: An app that uses the HKClinicalRecord and HKElectrocardiogram data objects to store and track a person's medical history and test results. Healthcare providers could use this app to monitor a person's health over time and make treatment decisions.
  • Hearing loss tracking app: An app that uses the HKAudiogramSample data object to track a person's hearing ability over time. This app could be used to recommend seeking a diagnosis for hearing loss and monitor changes in hearing ability.
  • Workout tracking app: An app that uses the HKWorkoutConfiguration, HKWorkoutSession, and WorkoutRoute data objects to track a person's workouts, including the type of activity, duration, intensity, and route taken. This app could be used to monitor a person's progress and set fitness goals.
  • Nutrition tracking app: An app that uses the ActivitySummary data object to track a person's daily activity levels and the HKClinicalRecord data object to track their dietary intake. This app could provide personalized recommendations for improving nutrition and achieving fitness goals.
  • Data Visualization Apps, etc.

Explore entirely new use cases

  • HKActivitySummary: This data object could be used to represent a summary of a person's physical activity over a given period, such as the number of steps taken or the amount of distance traveled. This information could be used to track a person's daily activity levels or to monitor their progress towards fitness goals.
  • HKAudiogramSample: This data object could be used to represent the results of an audiogram, which is a test that measures a person's hearing ability. This information could be used to recommend seeking a diagnosis for hearing loss or to track changes in hearing over time.
  • HKCharacteristic: This data object could be used to represent characteristics of a person, such as their biological sex, blood type, or date of birth. This information could be used to tailor health and fitness recommendations to an individual.
  • HKClinicalRecord: This data object could be used to represent clinical records, such as medical history or lab results. Healthcare providers could use this information to make treatment decisions or monitor a person's health.
  • HKElectrocardiogram: This data object could be used to represent an electrocardiogram (ECG), which is a test that measures the electrical activity of the heart. This information could be used to recommend seeking a diagnosis for heart conditions or to monitor heart health.
  • HKWorkoutConfiguration: This data object could be used to represent the configuration of a workout, such as the type of activity, the duration, and the intensity. This information could be used to track a person's workouts and monitor their progress.
  • HKWorkoutSession: This data object could be used to represent a workout session, including information about the start and end times, the type of activity, and the calories burned. This information could be used to track a person's workouts and to monitor their progress.
  • HKWorkoutRoute: This data object could be used to represent a route taken during a workout, including the distance traveled and the elevation changes. This information could be used to track a person's workouts and to monitor their progress.
  • HKWorkouts: ​This data object could be used to represent a collection of workouts, including information about the type of activity, duration, and intensity. This information could be used to track a person's workouts and monitor their progress.

Ideas to combine with some other data sources

  • Health Tracking Applications
    • Health and productivity tracker: An app that uses data from the Calendar API to track a person's daily schedule and HealthKit data to track their physical activity and sleep patterns. This app could provide insights into how a person's daily habits and routines impact their health and productivity.
    • Health and fitness tracking app with entertainment recommendations: An app that uses HealthKit data to track a person's physical activity and sleep patterns and recommends movies, TV shows, or video games based on their interests and activity levels.
    • Personal finance and health tracker: An app that uses financial data to track a person's spending habits and HealthKit data to track their physical activity and sleep patterns. This app could provide insights into how a person's spending habits and daily routines impact their health and financial well-being.
    • Weather and health tracker: An app that uses weather data to track local conditions and HealthKit data to track a person's physical activity and sleep patterns. This app could provide insights into how weather conditions impact a person's health and suggest activities or workouts based on the weather.
    • Nutrition and exercise planner: An app that uses data from the Calendar API to schedule meals and workouts and HealthKit data to track a person's nutrition and fitness progress.

  • Stress Monitoring Applications:
    • Stress management app: An app that uses data from the Calendar API to track a person's daily schedule and HealthKit data to track their stress levels. This app could provide personalized recommendations for reducing stress and improving overall well-being.
    • Stress management app with entertainment options: An app that uses HealthKit data to track a person's stress levels, and recommends movies, TV shows, or video games to watch or play to help reduce stress.
    • Stress management app with financial tracking: An app that uses HealthKit data to track a person's stress levels, and uses financial data to track expenses and identify potential sources of stress.

  • Travel
    • Health and wellness planner with travel recommendations: An app that uses data from the Calendar API to schedule appointments with healthcare providers and HealthKit data to track a person's health and wellness goals, and uses travel data to recommend destinations and activities based on a person's interests and physical abilities.
    • Fitness and travel planner: An app that uses data from the Calendar API to schedule workouts and HealthKit data to track progress, and uses travel data to recommend destinations and activities based on a person's fitness level and goals.

  • Other
    • Exercise scheduling app: An app that uses data from the Calendar API to schedule workouts based on a person's availability and HealthKit data to track their progress and set fitness goals.
    • Health and wellness planner: An app that uses data from the Calendar API to schedule appointments with healthcare providers and HealthKit data to track a person's health and wellness goals.

Open-source data library

We welcome contributions and forks to this data set, and look forward to seeing what developers build in our Liberty. Equality. Data. Slack channel.

Considerations for next version/improvements

  • 'Samples' and 'Queries' Implementation is not fully implemented therefore data such as weight, height, etc cannot be fetched.
    • A greater understanding of Swift and iOS by the developer may be needed.
  • Greater Reliance on Utils Package
  • Ensuring that all data is sensible and new/faked data is actually returned
Join our Slack community; Liberty. Equality. Data. to brainstorm and collaborate with other app developers, designers, and our team.

Comments are closed.

    Categories

    All
    23andme
    Ancestry
    Apple
    Dynamic Data
    Fitbit
    Google
    Ios
    Movesense
    Open Source
    Oura
    Peloton
    Polar
    Runkeeper
    Sensor BNO055
    Spotify
    Strava
    Twitch
    Uber
    Use Case
    Veri
    Whoop
    Withings

    RSS Feed

© 2023 PRIFINA INC. ​
Terms of Service
Privacy Policy
About Prifina
  • Docs
  • Getting Data
  • Support
  • Slack
  • Blog
  • Prifina.com