Introduction to HealthVault Development #7 – Data provenance


After our application is “in the wild” for a while, we receive some strange reports from our users.

Some of the weight data being displayed appears to be suspect, and after investigation we find out that some of our users are also running an application named WeightOptimizer.

Download and set up the Weight Optimizer application now, “optimize” one weight, and delete another. Run WeightTracker and look at the results.

Now we’re going to figure out what to do in response to what is happening.


One of the big values of HealthVault is that data can come from many different sources, and in general applications should use all data that is present in the record. However, some applications may want to determine the provenance of a specific piece of data, and that’s what this post is about…


What we need to do is modify our application so that we fetch the source of the data, and then use that information to decide what we are going to do with it.  The information we want is in the Audits section, so we modify our fetching code to the following:

HealthRecordFilter filter = new HealthRecordFilter(Weight.TypeId);
filter.View.Sections |= HealthRecordItemSections.Audits;


The information about the current state of the object is in the LastUpdated property, which is of type HealthServiceAudit. There is lots of interesting information here, but we’re going to concentrate on identifying a specific application. We’ll just add a column to the table to show the application name. Here’s our display code:

AddHeaderCells(c_tableWeight, "Date", "Weight", "BMI", "App Name", "&nbsp;");
foreach (Weight weight in weights)
    double bmi = weight.Value.Kilograms / (height.Value.Meters * height.Value.Meters);
    string bmiString = String.Format("{0:F2}", bmi);

    string appName = weight.LastUpdated.ApplicationName;

    AddCellsToTable(c_tableWeight, weight.When.ToString(),
                    weight.Value.DisplayValue.ToString(), bmiString, appName);
    AddLinkToEditPage(c_tableWeight, weight.Key.Id);

A real application would likely want to implement a more sophisticated scheme. It might look at the audit information, and use the application id to put the information into classes such as the following:

  • Data the application wrote itself

  • Data from a list of applications tracked by this application

  • Device data that was uploaded through HealthVault Connection Center

  • Data from all other applications

The classification would then be used to control application behavior.

In addition to the information contained in the Audit fields, the HealthVault platform also supports signing individual data items with a digital signature that can later be used to help establish provenance. I hope to discuss digital signatures more in a future post.

Next Time

Next time we’ll add exercise tracking to WeightTracker.

Comments (5)

  1. After we’ve released our application, some of our users complained that they accidentally entered an

  2. Lee says:

    Eric, I think you might mean "provenance" rather than "providence"? Or perhaps I’m nutty.


  3. Thanks, Lee – you are correct.

  4. Welcome to the tutorial. In this tutorial, we will develop a HealthVault application from scratch. My

Skip to main content