Поделиться через


Making a healthy application with HealthVault

I have done some projects in the past utilizing Microsoft HealthVault (https://healthvault.co.uk/), which officially is defined as:

“a health application platform, a set of platform services and a catalyst for creating an application ecosystem that enables consumers to collect, store and share health information online.” - https://msdn.microsoft.com/en-gb/healthvault/default

From a developer’s point of view, it’s a great starting point for creating a health based application without being a medical expert yourself.  (Personally I couldn’t tell my Diastolic measurements from my Peak Expiratory Flow).

In the past I worked on HealthVault when it was only available in the US (https://healthvault.com), though now it is in the UK I hope to ease a few pains I found myself massaging within this post.

A good starting point is to install the SDK and create a new application in the tool when the installation completes.  This is also found in c:\Program Files (x86)\Microsoft HealthVault\SDK\Tools\ApplicationManager.exe

ApplicationManager

Clicking on the Create New Application button will prompt you to create a new project, and then add the certificate it generates to the Local Machine\Personal certificate store.  You can view this certificate by running the ComputerCertificates.msc management plugin (or the Local Machine Certificate snapin to mmc).

The next step is to deploy your certificate created here to HealthVault so that we can start using it.  If you wish to use the UK version close the application and modify ApplicationManager.exe.config within the same directory as the application from:

 <appSettings>  
  
       <add key="DropOffUrl" value="https://config.healthvault-ppe.com/RegisterNewApplicationDropoff.aspx" /> 
  
   <add key="TurnOnUpload" value="true" />
  
 </appSettings>

pointing to the american DropOffUrl over to:

 <appSettings>  
  
        <add key="DropOffUrl" value="https://config.healthvault-ppe.co.uk/RegisterNewApplicationDropoff.aspx" /> 
  
    <add key="TurnOnUpload" value="true" />
  
 </appSettings>

which will mean that when you right click to deploy your cert onto HealthVault, it will go to the uk portal (.co.uk) instead of the US portal (.com) though the link at the bottom of the application to the Configuration Center (https://config.healthvault-ppe.co.uk/) will still point to the American site (https://config.healthvault-ppe.com) which will not allow you to run if you are not in the US. 

Thanks to Madan kamuju for this tip in his post.

Another point to remember here is that this is a development system and not the live system (as indicated by the –ppe on the URLs).

So now we can upload our certificate to HealthVault to start us developing against HealthVault.

ApplicationManager1

Running your application now created should show you the standard messages, and allow you to login to HeatlhVault using your Live Id.  Though I found that some of the samples (the OfflineAccess example as one in c:\Program Files (x86)\Microsoft HealthVault\SDK\DotNet\WebSamples) still had an issue when I changed the ApplicationId inside the Web.Config file to by my application ID for debugging purposes (Note here I also changed the ShellUrl and HealthServiceUrl to be the .co.uk versions from the .com).

I found that within the HealthVault configuration for my application:

Configuration

there were “Online” and “Offline” rules for the application:

Configuration1

By some searching I found that I did not have access rights to write the data I wanted to modify using my application.

Using the portal it is possible to change the access rights the application has, here for debugging purposes I have enabled everything:

 Configuration2

When I login to the application (OfflineAccess) using my live account, I am prompted to enable the application to use my HealthVault details.  Allowing access to this then makes it possible to read and write to HealthVault for my user.

One headscratcher I did have was that I enabled all these settings (as above) but it did not seem to take effect immediately, leading me to believe that it had not affected anything.  After searching the MSDN forums I found that this can take up to 30 minutes to take effect, though this is not guaranteed as the following time a change I made applied almost immediately.

I hope you all have fun writing your health application.