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

Couple of questions #9

Closed
zfattuhi opened this issue Apr 15, 2021 · 2 comments
Closed

Couple of questions #9

zfattuhi opened this issue Apr 15, 2021 · 2 comments

Comments

@zfattuhi
Copy link

Hi,

Couple of questions:

Q1: I am trying to save blood pressure values (sys/dia) and I am using iOS device, I tried this but it seems the values are not persisted:

   Healthkit.saveQuantitySample(
            HKQuantityTypeIdentifier.bloodPressureSystolic,
            HKUnit.MillimetersOfMercury,
            120, {
            start: new Date()
        }
        );

   Healthkit.saveQuantitySample(
            HKQuantityTypeIdentifier.bloodPressureDiastolic,
            HKUnit.MillimetersOfMercury,
            70, {
            start: new Date()
        }
        );

Q2: I am trying to save the heart rate measurement and I am using this code, but it seems there is a problem in the "Count" unit, I think the code expects "count/min" but it seems the value is not mapped:

 Healthkit.saveQuantitySample(
            HKQuantityTypeIdentifier.heartRate,
            HKUnit.Count,
            68,
            {
                start: new Date(),
                 }
        );

Appreciate any help on this, thanks!

@zfattuhi
Copy link
Author

zfattuhi commented Apr 15, 2021

Actually I found the answer to my questions!

Q1: using the correlation readings :)

 Healthkit.saveCorrelationSample(HKCorrelationTypeIdentifier.bloodPressure, [
            {
                quantityType: HKQuantityTypeIdentifier.bloodPressureSystolic,
                unit: HKUnit.MillimetersOfMercury,
                quantity: 120,
                metadata: {

                }
            },
            {
                quantityType: HKQuantityTypeIdentifier.bloodPressureDiastolic,
                unit: HKUnit.MillimetersOfMercury,
                quantity: 80,
                metadata: {}
            }

        ]);

Q2: Using hertz rate:

        const pulse = 90;
        Healthkit.saveQuantitySample(
            HKQuantityTypeIdentifier.heartRate,
            HKUnit.Hertz,
            pulse / 60,
            {
                start: new Date(),
            }
        );

@zfattuhi
Copy link
Author

Closing as I found all my answers, and thank you for the great library!

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

No branches or pull requests

1 participant