Accessing Data through HelloWorld SDK RRS feed

  • Question

  • I have entered some data (Medications, Problems etc) using the HealthAndFitness SDK but having some problem while accessing it through the HelloWorld SDK. Whne I do the following 


    Code Snippet
    <Problem> problems = GetValues<Problem>(Problem.TypeId);



    I get two problems back but don't see any Diagnosis - why ? Access Control Issue ? but I have already granted access to HealthAndFitness SDK .


    Also the following code does not return any medications (although I have entered some medications using the HealthAndFitness UI)


    Code Snippet
    List<Medication> medications = GetValues<Medication>(Medication.TypeId);


    Any help will be appreciated


    Sunday, May 4, 2008 5:31 AM



    I'm not sure what you're asking WRT the Problem type.


    I generally find that it's easiest to just write code that puts in the data that I want to have in the record.

    Monday, May 5, 2008 6:33 PM

All replies

  • Well, it's either in the code to upload the data to healthvault, or the code that queries for the data.


    If you go to the shell page at:


    https://account.healthvault-ppe.com (note that it's https...)


    You can go to "Health Details", and then look at the data that is stored there. That's how I usually approach things.


    If you are still having issues, can you post the code that you're using to upload the data?



    Monday, May 5, 2008 4:52 PM
  • Hello,


    The first problem I see is that the Health and Fitness application does not store "Medication" type. it stores "Daily Medication Usage" type. That is why you are not getting any medications back. Try switching it over to the Daily Medication Usage Type and see if that works.




    Code Snippet
    <DailyMedicationUsage> medications = GetValues<DailyMedicationUsage>(DailyMedicationUsage.TypeId);







    Monday, May 5, 2008 5:01 PM
  • Hi Eric,


    Thanks for the reply and yes, I used the link https://account.healthvault-ppe.com to enter the data .


    The following call returns two problems

    List<Problem> problems = GetValues<Problem>(Problem.TypeId);


    And in Debug mode, CommonData.Note shows the problem description that I have entered using the shell page and CommonData.Source shows "onepageFitness"


    TypeName shows "Medical Problem"


    Any ideas ?



    Monday, May 5, 2008 6:22 PM
  • Hi Edan


    Thanks for the suggestion but no luck - it still does not return any results .

    Monday, May 5, 2008 6:23 PM
  • Ok, the reason you are not seeing any results after switching over to the correct data type is that there seems to a problem with the sharing perimssions with the hello world SDK.


    go to the Hello World permissions page:




    you will see that "Daily Medication Usage" is missing from the permission list. I can not answer you why the permission is missing, however, that is the reason you are not seeing the medication usage.


    I have ran into the same problem myself. It seems to be a bug, can MSFT confirm this?


    Monday, May 5, 2008 6:32 PM

    I'm not sure what you're asking WRT the Problem type.


    I generally find that it's easiest to just write code that puts in the data that I want to have in the record.

    Monday, May 5, 2008 6:33 PM
  • Thanks Eric - that helped.


    So I first tried to add the DailyMedicationUsage as shown below - it asked me to approve access, and then it added the record .


    Code Snippet

    private void AddDailyMedicationUsage()


    Microsoft.Health.ItemTypes.DailyMedicationUsage m = new DailyMedicationUsage();

    m.DosesConsumed = 2;

    m.DrugName = new CodableValue ("Tylenol");

    m.UsageSchedule = new CodableValue("2");

    m.DrugForm = new CodableValue("Drug Form");

    m.IntendedDoses = 2;

    m.PurposeOfUse = new CodableValue("Headache");







    Then when I tried to get the DailyMedicationUsage , I could see the one I added using the above code as well as the other two that I added earlier using the HealthandFitness SDK


    Code Snippet

    private void GetDailyMedicationUsage()


    List<DailyMedicationUsage> medications = GetValues<DailyMedicationUsage>(DailyMedicationUsage.TypeId);

    . . .

    . . .





    Also wanted to thank for the awesome support for this cool service .

    Monday, May 5, 2008 10:23 PM
  • Eric,


    I had the same problem above, in that I created DailyMedicationUsage data in the Health and Fitness SDK and tried to read it in HelloWorld SDK. Initially the permission for "DailyMedicationUsage" was missing from the HelloWorld SDK. Ever since Health Cloud added some data to the DailyMedicationUsage type from the HelloWorld SDK it has now appeared and allowed me to access the data as well.


    My Assumption is this:


    You will only have permission to data types that your application has written to in the past?


    I have an application that needs to access Medication information that was entered in from other applications but does not always need to write to Medication information.


    How can I get permssions added to an application without writing to that data type first?






    Monday, May 5, 2008 10:56 PM
  • It's actually one of your Microsoft friends playing a trick on you.


    I took a look at the permissions of HelloWorld, and since they were wrong, we went ahead and updated them. I intended to come back and update this so you'd know what I did, but got pulled off on something else.


    So, sorry about that.


    To be clear, authorization has nothing to do with whether you've written a type before. It just looked that way because of some coincidental timing.



    Monday, May 5, 2008 11:43 PM
  • Eric,


    Thanks for clearing that up, it actually did cross my mind that you may have fixed the permissions at the same time and it looked coincidental...


    Can you explain how permission inheritance works? If I create a brand new application, does that application automatically gain permissions to all types? What if new types are added after my application is created, will my application inherit those new types? I just want to know so I can manage this issue in the future.





    Monday, May 5, 2008 11:55 PM
  • On the production environment, the set of types that you can access (and what parts of CRUD you can do on each) are set on a per-application basis.


    Basically, as part of the go-live review, we look through what data types you have request access to - and the reasons you are giving for access to each - and validate that against what your application is doing overall. I think of it as an additive process - starting with no types and adding in those that are needed by the application. We can modify the list of types that an application is allowed to access after the application has gone live, but that still goes through a review on our side, and will require the user to re-authorize the application.


    The developer servers work the same if you have your own app-id.


    There's a PB3 feature we just released known as "optional auth", where you can partition the types you request into base ones (authed by the user on first use) and optional ones (normally authed later). This allows you to "turn on" more types by explicitly asking the user for access to the additional types, and this would be a good way to support new types without forcing a full re-auth for everybody who uses the app. I wrote a blog post on optional auth a while back.

    Tuesday, May 6, 2008 12:04 AM