A topic came up yesterday in the forums, and I thought it was of general interest.

HealthVault is different from a lot of information systems - at least the ones I've worked with - in that there is a break between the concept of "user" - the person who authenticates into the application - and "record" - the thing that holds information about specific individual.

This is to support two scenarios.

The first one is for parents, who want to track the health information of their children. They can create a separate record (that they have access to) for the child.

The second one is when an adult is managing the health of another adult - that adult can be granted access to another adult's record.

If you are writing an application, this is something that you need to deal with. If I'm using an application and then I come back to it after I've gotten access to another record, I need to provide the following:

  1. A way to authorize the application to access the new record. This is done through the shell and a redirect, similar to how normal authorization is done.
  2. Some UI to allow the user to switch between records.

For an example of how to do this, take a look at the HealthAndFitness application.

The existence of multiple records explains why you need to use PersonInfo.SelectedRecord to access the data - it belongs to the current record, not to the current user.

That's the overview. The specific point that came up yesterday was around the ids for users and records. An application can access PersonInfo.PersonId and SelectedRecord.Id, and use those to uniquely identify that user and record.

But, to make it harder to correlate information between applications, the same person using two separate applications is going to have two different values of PersonInfo.PersonId and SelectedRecord.Id, and, in fact, the record ID will change if the application is de-authorized and then re-authorized.

So, you may need to keep this in mind if you are doing anything with those IDs...