locked
HealthVault Blood Glucose Reading Upload Problem RRS feed

  • Question

  • Hi,

    I'm currently developing a Windows based application which will upload Blood Glucose Measurements from a database to HealthVault, this is purely to test the code which will go into a service for running on a server.  The main problem I have is that I can't upload anything to HealthVault as I get a WildcatStatusException (details for this are below).  I can add Patients to my app and Healthvault to the cows come home.  But whenever I use the Guids in the same way as the Contoso Health example I get this exception.  I cannot for the life of me figure out what is wrong.  Could some one point me in the right direction, please?

    The ApplicationId was created using the HealthVault Application Manager and was uploaded to the development site.  I've added an offline rule to allow all access to the Blood Glucose records. The PersonId was the id passed to HealthVault when using Create on the PatientConnection and RecordId was generated at the same time.  The ErrorCode is given as "InvalidPersonOrGroup" which is frustrating as the Guids used has not changed.

    All help and guidance will be greatly appreciated.

    Thanks,
    Graham

    The code is as follows:

    public void UploadBloodGlucose(int value, DateTime dateValue, Guid personId, Guid recordId)
            {
                Guid bgGuid = BloodGlucose.TypeId;

                BloodGlucose bgNew = new BloodGlucose(new HealthServiceDateTime(dateValue), new BloodGlucoseMeasurement((double)value), new CodableValue("plasma"));

                HealthRecordAccessor accessor = new HealthRecordAccessor(HealthVaultConnectionManager.CreateConnection(_applicationId, personId), recordId);

                accessor.NewItem(bgNew);
            }

    The Exception details are:

    "   at Microsoft.Health.EasyWebRequest.WaitForCompletion()\r\n   at Microsoft.Health.EasyWebRequest.Fetch(Uri url)\r\n   at Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler)\r\n   at Microsoft.Health.HealthServiceRequest.ExecuteInternal()\r\n   at Microsoft.Health.Web.OfflineWebApplicationConnection.ExecuteRequestWithRetry(HealthServiceRequest request)\r\n   at Microsoft.Health.HealthServiceRequest.Execute()\r\n   at Microsoft.Health.HealthRecordAccessor.NewItems(IList`1 items)\r\n   at Microsoft.Health.HealthRecordAccessor.NewItem(HealthRecordItem item)\r\n   at Microsoft.Health.Samples.PatientConnect.ContosoHealth.HealthVaultAdapter.PushHealthVaultItemTypes.UploadBloodGlucose(Int32 value, DateTime dateValue, Guid personId, Guid recordId) in C:\\Examples\\Contoso Health Single physician Practice\\Components\\PushHealthVaultItemTypes.cs:line 105\r\n   at SampleTesterEXE.ServiceOutboundCalls.UploadBGResults(Patient registeredPatient, PushHealthVaultItemTypes outbound) in C:\\Examples\\Contoso Health Single physician Practice\\SampleTesterEXE\\ServiceOutboundCalls.cs:line 52\r\n   at SampleTesterEXE.ServiceOutboundCalls.CallOutboundMethods() in C:\\Examples\\Contoso Health Single physician Practice\\SampleTesterEXE\\ServiceOutboundCalls.cs:line 30\r\n   at SampleTesterEXE.Form1.button1_Click(Object sender, EventArgs e) in C:\\Examples\\Contoso Health Single physician Practice\\SampleTesterEXE\\Form1.cs:line 21\r\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n   at System.Windows.Forms.Button.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(Form mainForm)\r\n   at SampleTesterEXE.Program.Main() in C:\\Examples\\Contoso Health Single physician Practice\\SampleTesterEXE\\Program.cs:line 18\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"
    Tuesday, September 1, 2009 2:43 PM

Answers

  • Graham,

    You mentioned that

    "The PersonId was the id passed to HealthVault when using Create on the PatientConnection and RecordId was generated at the same time."

    That is not right.  The personId you use should be what the following call returns  (after the user enters the code in HealthVault and approves the connection). 

    PatientConnection.GetValidatedConnections(offlineConnection)

    The applicationSpecificPersonId what you pass to the Create function is just a key so that your application can understand which patient authorized the application as returned by PatientConnection.GetValidatedConnections

    You may also want to check out the D2C sample at

    http://healthvaultsimpled2c.codeplex.com/

    HTH 


     


    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    • Edited by Rajesh CKR Tuesday, September 1, 2009 8:35 PM rephrased
    • Marked as answer by GrahamSDouglas Wednesday, September 2, 2009 7:55 AM
    Tuesday, September 1, 2009 8:34 PM

All replies

  • Hi,

    Can you please specify your application ID so that we can verify the application configuration details?

    Thanks and Regards,
    Anish R.
    Tuesday, September 1, 2009 4:01 PM
  • Graham,

    You mentioned that

    "The PersonId was the id passed to HealthVault when using Create on the PatientConnection and RecordId was generated at the same time."

    That is not right.  The personId you use should be what the following call returns  (after the user enters the code in HealthVault and approves the connection). 

    PatientConnection.GetValidatedConnections(offlineConnection)

    The applicationSpecificPersonId what you pass to the Create function is just a key so that your application can understand which patient authorized the application as returned by PatientConnection.GetValidatedConnections

    You may also want to check out the D2C sample at

    http://healthvaultsimpled2c.codeplex.com/

    HTH 


     


    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    • Edited by Rajesh CKR Tuesday, September 1, 2009 8:35 PM rephrased
    • Marked as answer by GrahamSDouglas Wednesday, September 2, 2009 7:55 AM
    Tuesday, September 1, 2009 8:34 PM
  • Hi Rajesh,

    I knew there was a step I was missing, I just hadn't figured out where it was.  I added the GetValidatedConnections code and it works perfectly now.  Your help is much appreciated as I was quickly heading toward the head banging on desk stage! :-)

    Thanks,
    Graham
    Wednesday, September 2, 2009 7:55 AM