How to store ECG data on apple healthkit?











up vote
0
down vote

favorite












I am new to IOS app development. I have been trying to learn how to work with Apple HealthKit API. So far, as an experiment I have managed to build a simple app which could store and retrieve data from the HealthKit such as blood type, heart rate etc (i can furnish the code if anyone needs it-it is already available on the internet). I am able to do this functionality because healthkitStore exposes these typeIdentifiers for the app developers. However, I am a bit lost when I want to create a new typeIdentifier such for storing ECG/EKG on the healthKit? I want to feed ECG/EKG signals into my app and use the HealthKitStore to save these information. Am i missing something?I know I am slow, but i have searched a lot over the internet, but I could not find any specific solutions. Is this not possible? But the whole point of opening the API to the developers is to create new apps with different features.
I have no specific requirement as far as storing and retrieving ECG data is concerned, as i simply want to create a PoC without any constraints but focusing on the functionality.



Will I be wrong If i want to create the above by using



struct HKClinicalTypeIdentifier


and then use Clinical Record type identifier



static let labResultRecord: HKClinicalTypeIdentifier


Is this the correct direction?
Any direction, motivation or criticism is much welcomed.










share|improve this question
























  • Since the watch has an ecg function there must be an apple way to store and use this data without defining your own types. The documentation is worse than Apple's normally lousy standard though.
    – john elemans
    Nov 19 at 18:05










  • So I think the ECG as a TypeIdentifier is currently missing from the HealthKit API. Certainly, looking at the screenshots Apple has provided of the ECG functionality, it looks like it will have its own section in the Health app like Heart Rate, Heart Rate Variability and VO2 Max for example. I suspect that with WatchOS 5.1.2 there will also be a new iOS release change. These will likely have the api calls added. It’s odd though that Apple hasn’t got these changes into the beta first to allow developers to get support in their apps.
    – Simon Edwardes
    Dec 1 at 15:34















up vote
0
down vote

favorite












I am new to IOS app development. I have been trying to learn how to work with Apple HealthKit API. So far, as an experiment I have managed to build a simple app which could store and retrieve data from the HealthKit such as blood type, heart rate etc (i can furnish the code if anyone needs it-it is already available on the internet). I am able to do this functionality because healthkitStore exposes these typeIdentifiers for the app developers. However, I am a bit lost when I want to create a new typeIdentifier such for storing ECG/EKG on the healthKit? I want to feed ECG/EKG signals into my app and use the HealthKitStore to save these information. Am i missing something?I know I am slow, but i have searched a lot over the internet, but I could not find any specific solutions. Is this not possible? But the whole point of opening the API to the developers is to create new apps with different features.
I have no specific requirement as far as storing and retrieving ECG data is concerned, as i simply want to create a PoC without any constraints but focusing on the functionality.



Will I be wrong If i want to create the above by using



struct HKClinicalTypeIdentifier


and then use Clinical Record type identifier



static let labResultRecord: HKClinicalTypeIdentifier


Is this the correct direction?
Any direction, motivation or criticism is much welcomed.










share|improve this question
























  • Since the watch has an ecg function there must be an apple way to store and use this data without defining your own types. The documentation is worse than Apple's normally lousy standard though.
    – john elemans
    Nov 19 at 18:05










  • So I think the ECG as a TypeIdentifier is currently missing from the HealthKit API. Certainly, looking at the screenshots Apple has provided of the ECG functionality, it looks like it will have its own section in the Health app like Heart Rate, Heart Rate Variability and VO2 Max for example. I suspect that with WatchOS 5.1.2 there will also be a new iOS release change. These will likely have the api calls added. It’s odd though that Apple hasn’t got these changes into the beta first to allow developers to get support in their apps.
    – Simon Edwardes
    Dec 1 at 15:34













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am new to IOS app development. I have been trying to learn how to work with Apple HealthKit API. So far, as an experiment I have managed to build a simple app which could store and retrieve data from the HealthKit such as blood type, heart rate etc (i can furnish the code if anyone needs it-it is already available on the internet). I am able to do this functionality because healthkitStore exposes these typeIdentifiers for the app developers. However, I am a bit lost when I want to create a new typeIdentifier such for storing ECG/EKG on the healthKit? I want to feed ECG/EKG signals into my app and use the HealthKitStore to save these information. Am i missing something?I know I am slow, but i have searched a lot over the internet, but I could not find any specific solutions. Is this not possible? But the whole point of opening the API to the developers is to create new apps with different features.
I have no specific requirement as far as storing and retrieving ECG data is concerned, as i simply want to create a PoC without any constraints but focusing on the functionality.



Will I be wrong If i want to create the above by using



struct HKClinicalTypeIdentifier


and then use Clinical Record type identifier



static let labResultRecord: HKClinicalTypeIdentifier


Is this the correct direction?
Any direction, motivation or criticism is much welcomed.










share|improve this question















I am new to IOS app development. I have been trying to learn how to work with Apple HealthKit API. So far, as an experiment I have managed to build a simple app which could store and retrieve data from the HealthKit such as blood type, heart rate etc (i can furnish the code if anyone needs it-it is already available on the internet). I am able to do this functionality because healthkitStore exposes these typeIdentifiers for the app developers. However, I am a bit lost when I want to create a new typeIdentifier such for storing ECG/EKG on the healthKit? I want to feed ECG/EKG signals into my app and use the HealthKitStore to save these information. Am i missing something?I know I am slow, but i have searched a lot over the internet, but I could not find any specific solutions. Is this not possible? But the whole point of opening the API to the developers is to create new apps with different features.
I have no specific requirement as far as storing and retrieving ECG data is concerned, as i simply want to create a PoC without any constraints but focusing on the functionality.



Will I be wrong If i want to create the above by using



struct HKClinicalTypeIdentifier


and then use Clinical Record type identifier



static let labResultRecord: HKClinicalTypeIdentifier


Is this the correct direction?
Any direction, motivation or criticism is much welcomed.







ios swift3 health-kit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 14:18

























asked Nov 19 at 14:02









codeheadache

96




96












  • Since the watch has an ecg function there must be an apple way to store and use this data without defining your own types. The documentation is worse than Apple's normally lousy standard though.
    – john elemans
    Nov 19 at 18:05










  • So I think the ECG as a TypeIdentifier is currently missing from the HealthKit API. Certainly, looking at the screenshots Apple has provided of the ECG functionality, it looks like it will have its own section in the Health app like Heart Rate, Heart Rate Variability and VO2 Max for example. I suspect that with WatchOS 5.1.2 there will also be a new iOS release change. These will likely have the api calls added. It’s odd though that Apple hasn’t got these changes into the beta first to allow developers to get support in their apps.
    – Simon Edwardes
    Dec 1 at 15:34


















  • Since the watch has an ecg function there must be an apple way to store and use this data without defining your own types. The documentation is worse than Apple's normally lousy standard though.
    – john elemans
    Nov 19 at 18:05










  • So I think the ECG as a TypeIdentifier is currently missing from the HealthKit API. Certainly, looking at the screenshots Apple has provided of the ECG functionality, it looks like it will have its own section in the Health app like Heart Rate, Heart Rate Variability and VO2 Max for example. I suspect that with WatchOS 5.1.2 there will also be a new iOS release change. These will likely have the api calls added. It’s odd though that Apple hasn’t got these changes into the beta first to allow developers to get support in their apps.
    – Simon Edwardes
    Dec 1 at 15:34
















Since the watch has an ecg function there must be an apple way to store and use this data without defining your own types. The documentation is worse than Apple's normally lousy standard though.
– john elemans
Nov 19 at 18:05




Since the watch has an ecg function there must be an apple way to store and use this data without defining your own types. The documentation is worse than Apple's normally lousy standard though.
– john elemans
Nov 19 at 18:05












So I think the ECG as a TypeIdentifier is currently missing from the HealthKit API. Certainly, looking at the screenshots Apple has provided of the ECG functionality, it looks like it will have its own section in the Health app like Heart Rate, Heart Rate Variability and VO2 Max for example. I suspect that with WatchOS 5.1.2 there will also be a new iOS release change. These will likely have the api calls added. It’s odd though that Apple hasn’t got these changes into the beta first to allow developers to get support in their apps.
– Simon Edwardes
Dec 1 at 15:34




So I think the ECG as a TypeIdentifier is currently missing from the HealthKit API. Certainly, looking at the screenshots Apple has provided of the ECG functionality, it looks like it will have its own section in the Health app like Heart Rate, Heart Rate Variability and VO2 Max for example. I suspect that with WatchOS 5.1.2 there will also be a new iOS release change. These will likely have the api calls added. It’s odd though that Apple hasn’t got these changes into the beta first to allow developers to get support in their apps.
– Simon Edwardes
Dec 1 at 15:34












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










I found an alternate solution to the above issue. I am writing this so that if anyone has similar issue can take a similar approach if needed.
Basically at the time of writing this thread, there are no ECG typeIdentifier available for developers to use. However, the way around it is to create a HKQauntiySample object and pass the ECG values as metadata. But the only issue that i am facing with such an approach is to do with the rate at which the live/historical ECG can be saved into the healthkit.



The sampling frequency for the ECG e.g is 200 Hz. I am not able to store the data with subsecond timestamp. It can only provide upto seconds of timestamp. Also, it seems, the maximum rate at which data can be stored using the above object is as low as 160Hz. Maybe this is a limitation of the interface, healtkitstore etc. I dont know. Hope this closes the issue.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376307%2fhow-to-store-ecg-data-on-apple-healthkit%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    I found an alternate solution to the above issue. I am writing this so that if anyone has similar issue can take a similar approach if needed.
    Basically at the time of writing this thread, there are no ECG typeIdentifier available for developers to use. However, the way around it is to create a HKQauntiySample object and pass the ECG values as metadata. But the only issue that i am facing with such an approach is to do with the rate at which the live/historical ECG can be saved into the healthkit.



    The sampling frequency for the ECG e.g is 200 Hz. I am not able to store the data with subsecond timestamp. It can only provide upto seconds of timestamp. Also, it seems, the maximum rate at which data can be stored using the above object is as low as 160Hz. Maybe this is a limitation of the interface, healtkitstore etc. I dont know. Hope this closes the issue.






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      I found an alternate solution to the above issue. I am writing this so that if anyone has similar issue can take a similar approach if needed.
      Basically at the time of writing this thread, there are no ECG typeIdentifier available for developers to use. However, the way around it is to create a HKQauntiySample object and pass the ECG values as metadata. But the only issue that i am facing with such an approach is to do with the rate at which the live/historical ECG can be saved into the healthkit.



      The sampling frequency for the ECG e.g is 200 Hz. I am not able to store the data with subsecond timestamp. It can only provide upto seconds of timestamp. Also, it seems, the maximum rate at which data can be stored using the above object is as low as 160Hz. Maybe this is a limitation of the interface, healtkitstore etc. I dont know. Hope this closes the issue.






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I found an alternate solution to the above issue. I am writing this so that if anyone has similar issue can take a similar approach if needed.
        Basically at the time of writing this thread, there are no ECG typeIdentifier available for developers to use. However, the way around it is to create a HKQauntiySample object and pass the ECG values as metadata. But the only issue that i am facing with such an approach is to do with the rate at which the live/historical ECG can be saved into the healthkit.



        The sampling frequency for the ECG e.g is 200 Hz. I am not able to store the data with subsecond timestamp. It can only provide upto seconds of timestamp. Also, it seems, the maximum rate at which data can be stored using the above object is as low as 160Hz. Maybe this is a limitation of the interface, healtkitstore etc. I dont know. Hope this closes the issue.






        share|improve this answer












        I found an alternate solution to the above issue. I am writing this so that if anyone has similar issue can take a similar approach if needed.
        Basically at the time of writing this thread, there are no ECG typeIdentifier available for developers to use. However, the way around it is to create a HKQauntiySample object and pass the ECG values as metadata. But the only issue that i am facing with such an approach is to do with the rate at which the live/historical ECG can be saved into the healthkit.



        The sampling frequency for the ECG e.g is 200 Hz. I am not able to store the data with subsecond timestamp. It can only provide upto seconds of timestamp. Also, it seems, the maximum rate at which data can be stored using the above object is as low as 160Hz. Maybe this is a limitation of the interface, healtkitstore etc. I dont know. Hope this closes the issue.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 at 9:28









        codeheadache

        96




        96






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376307%2fhow-to-store-ecg-data-on-apple-healthkit%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?