The life and times of a HealthVault piece of data...

HealthVault has two temporarl views of data.

The first temporal view is fairly obvious. If, for example, you're looking at the Height type, there is a When property that can tell the time at which the height was measured. That allows you to do fun things, like chart the growth of your children over time (as soon as somebody writes that application...)

There's a second view that can provide a snapshot of the HealthVault state at a specific time. Though it's not obvious because you normally see the current view, much like a source code control system, HealthVault allows you to find out what an item's state was at a time in the past.

Or, to put it another way, if you create a data item and then modify it over time, or even delete it, there's a way to figure out the whole lifecycle of that piece of data - when it was created, when it was updated, when it was deleted, and who performed each of those operations. Not to mention what the contents of the item was at each step.

By default, you only see the current state of the data items, but this is controlled by the filter that you use when you query for items. Here are the filter properties that let you do this:

CurrentVersionOnly

This property is true by default. Set it to false to get all the versions back

States

There are two states - Active and Deleted, along with Default (same as Active), and All (either Active or Deleted)

If you want to get all the items, specify All for this property.

Who Changed My Data?

Those two properties are enough to get you all the items when you execute a query. The different snapshots of a single item have the same Key.Id value, but different version stamps.

To find out who made the changes, you need to request the audit information. You do this through another filter property - View.Sections - by adding Audits to that field.

Once you do that, the LastUpdated property on each item that you fetch will now contain a live HealthServiceAudit record, which tells you lots of fun information about the source of the record.