Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor Healthkit fixes #1765

Open
wants to merge 84 commits into
base: dev
Choose a base branch
from
Open

Capacitor Healthkit fixes #1765

wants to merge 84 commits into from

Conversation

mpgxvii
Copy link
Member

@mpgxvii mpgxvii commented Mar 8, 2024

  • Store only poll times/offsets in cache rather than the complete healthkit data (since this is in the phone already)
  • This prevents storing and fetching of large amounts of data from storage (since we can pull this directly from HealthKit)
  • Currently supported datatypes:
export enum HealthkitDataType {
  STEP_COUNT = 'stepCount',
  FLIGHTS_CLIMBED = 'flightsClimbed',
  DISTANCE_WALKING_RUNNING = 'distanceWalkingRunning',
  DISTANCE_CYCLING = 'distanceCycling',
  ACTIVE_ENERGY_BURNED = 'activeEnergyBurned',
  BASAL_ENERGY_BURNED = 'basalEnergyBurned',
  HEART_RATE = 'heartRate',
  APPLE_EXERCISE_TIME = 'appleExerciseTime',
  BLOOD_GLUCOSE = 'bloodGlucose',
  SLEEP_ANALYSIS = 'sleepAnalysis',
  WEIGHT = 'weight',
  WORKOUT_TYPE = 'workoutType'
}
  • Also refactors sending of data to kafka: now converts to kafka object and sends for every object that gets converted, rather than waiting for all kafka objects to complete conversion/processing
  • Updated onResume to only refresh screen when on home page

@mpgxvii mpgxvii marked this pull request as ready for review March 18, 2024 19:15
Base automatically changed from update-deps to dev March 18, 2024 19:40
@mpgxvii mpgxvii marked this pull request as draft April 19, 2024 10:22
Copy link
Member

@yatharthranjan yatharthranjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @mpgxvii. I can confirm the performance is much better now and It can handle multiple years of high-frequency wearable data.

Please find some comments below.

src/app/core/services/kafka/cache.service.ts Outdated Show resolved Hide resolved
src/app/core/services/kafka/kafka.service.ts Show resolved Hide resolved
health_time: any

notSupported = false
READ_PERMISSIONS = DefaultHealthkitPermissions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make this configurable per project using remote config too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I've updated it so that the permissions requested depend on the field names (or in this case the healthkit data types).

src/app/pages/questions/services/questions.service.ts Outdated Show resolved Hide resolved
BLOOD_PRESSURE_SYSTOLIC = 'blooPressureSystolic',
BLOOD_PRESSURE_DIASTOLIC = 'bloodPressureDiastolic',
RESTING_HEART_RATE = 'restingHeartRate',
RESPIRATORY_RATE = 'respiratoryRate'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would be good to add documentation (either readme or wiki) on how to add new data types as and when they are supported by the capacitor plugin.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, updated here: 9c15e7f

src/assets/data/defaultConfig.ts Outdated Show resolved Hide resolved
@mpgxvii mpgxvii requested a review from yatharthranjan January 9, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants