Create CCR XML file programatically to upload to and download from Healthvault RRS feed

  • Question

  • After several days of uploading patient data individually to healthvault I have come to the decision that I can get a better solution by creating a CCR/XML file and uploading to HV. Is there an existing sample to create a CCR/XML from an MS relational DB? I want to do the reverse by downloading XML for each patient to MS DB.?
    Tuesday, January 8, 2013 5:04 PM

All replies

  • Hi Mike,

    Can you please take a look at this thread and see if it helps you get started?


    Tuesday, January 8, 2013 7:04 PM
  • Just so I can understand a bit more, you have a relational DB of health information and you want to get data into HealthVault and feel that transforming it to a CCR is easier than using the native items?  Can you explain what difficulties you are finding that would make transforming to a CCR easier than using the SDK?



    Wednesday, January 9, 2013 3:15 AM
  • The reason for trying to create CCR is to obtain a common standard format and share data, not only HV but other patient data. The problem I ran into yesterday is that HV is all XML so I then looked at using put Things and Get Things as a better solution. What I am trying to accomplish is the ability to get all patient new data and upload in a single file to HV and do the same for downloading to Azure DB. I did have some success with the SDK wrapper that hides the use of putthings and getthings, but in cases where I had a thing, say weight with several values, the item returned a single value. I now have all the type IDs in a DB table on Azure with the associated types and the patient things grouped the same as HV, I can make a connection I just need help in putting together the best approach to achieve my goal. Any samples that worls would help.

    Here is one approach from the Internet:

    ' Save the reading to HealthVault

    Private Sub button1_Click(sender As Object, e As RoutedEventArgs)

                   Dim model As New EmotionalStateModel()

                   model.Mood = DirectCast(c_MoodSlider.Value, Mood)

                   model.Stress = DirectCast(c_StressSlider.Value, Stress)

                   model.Wellbeing = DirectCast(c_WellbeingSlider.Value, Wellbeing)

                   model.[When] = DateTime.Now

                   HealthVaultMethods.PutThings(model, PutThingsCompleted)


    End Sub

    ''' <summary>

    ''' PutThings Method

    ''' </summary>

    ''' <param name="item">The health item to upload</param>

    ''' <param name="responseCallback">Function to resolve callback</param>

    Public Shared Sub PutThings(item As HealthRecordItemModel, responseCallback As EventHandler(Of HealthVaultResponseEventArgs))

                   Dim info As XElement = XElement.Parse(item.GetXml())

                   Dim request As New HealthVaultRequest("PutThings", "2", info, responseCallback)


    End Sub

    Here is a similar approach

    Retrieve Data From HealthVault Querying data

    Retrieving data from HealthVault is done through the GetThings request. The GetThings request performs operations very similar to an SQL select statement:

    1. It has formats which allow you to choose what part of the thing data to retrieve, similar to the select statement in SQL.
    2. It has filters which allow you to specify the criteria for the things to return, similar to the where clause in SQL.
    3. It takes a record ID, which is similar to the from clause in SQL.

    In addition, it allows you to specify multiple query groups in one request, which results in a dataset for each group. It also allows datasets to be paged from the server so as not to overwhelm the caller when the dataset is large.

    Last updated: September 2012

    This topic contains the following sections.

    1. Groups
    2. Query format
    3. Filters
    4. Full and partial things
    5. .NET SDK

    To make a GetThings request, specify the record ID of the health record from which you want to retrieve data. Only one record can be specified in each call, and the user must have already authorized the application with read access to the record. For more inforamtion about the GetThings request, see the Method browser.

    The info section of the method request is then defined using a group containing filters and a format section.

    The response is a collection of datasets, each containing the results for the groups specified in the request. Each group contains the things that matched the filters for that group. The results within each group are ordered by the thing’s effective date.

    The following example request-response XML illustrates how a named group in the request matches a named group in the response:




      <!-- ... -->


        <group name="height things">













      <!-- ... -->


        <group name="height things">


            <!-- ... -->






    In a GetThings request, multiple queries can be specified using groups. This looks like the approach I need How do you program this? How do yo get the resuls from the return . Hope this explain my problem and look forward for a solution.

    Wednesday, January 9, 2013 12:25 PM
  • Victor is correct about using the SDK, I can now dwnload any thing from HV. I still have a problem with uploading. This statment -

    PersonInfo.SelectedRecord.NewItem(height)the error - reference to a non shared member .......Examples:


    Dimvalue AsNewLength(meters)


    Dimheight AsNewHeight(NewHealthServiceDateTime(DateTime.Now), value)





    DimweightInPounds AsInteger= Int32.Parse(190)


    Dimweight AsNewWeight()

            weight.Value.Kilograms = weightInPounds / 2.204

            weight.Value.DisplayValue =

    NewDisplayValue(weightInPounds, "pounds")




    Dimmedication AsNewMedication()

    Wednesday, January 9, 2013 11:05 PM