Add, Update and Delete data via CCR format

Jul 22, 2011 at 3:40 AM

Our app is retrieving data from Health Vault via CCR format. We are thinking of implementing the add, update and delete via the same CCR format. Does the Java API support all operations (add, update and delete) via CCR format? Do you have some examples?

Thanks in advance,

May

Coordinator
Jul 22, 2011 at 7:45 AM
Edited Jul 22, 2011 at 8:35 AM

Hi May,

Can you format CCRs already?  If so, you just need to format the XML for the PutThings/RemoveThings requests.  The Jaxb portion doesn't help when dealing with CCRs but if can drop down a level to the raw sdk easily enough:

String ccr = getCCR();

Request request = new Request();

request.setOfflineUserId("75ac2c6c-c90e-4f7e-b74d-bb7e81787beb");
request.setRecordId("8c390004-3d41-4f5c-8f24-4841651579d6");
request.setMethodName("PutThings");

String info = String.format("<info><thing><type-id>1e1ccbfc-a55d-4d91-8940-fa2fbf73c195</type-id>" +     
                                               “<data-xml>%s</data-xml></thing></info>",  ccr); request.setInfo(info); SimpleRequestTemplate requestTemplate = new SimpleRequestTemplate(ConnectionFactory.getConnection()); requestTemplate.makeRequest(request);
Jul 25, 2011 at 5:07 AM
Edited Jul 25, 2011 at 4:44 PM

Thanks Rob.

It does not appear that we could do an update on CCR. See the conversation below. Any ideas on why by design making the thing type immutable on CCR updates? Does the Java JDK have transformers like the .NET side so that we can convert a CCR to the native health vault data types for updating?

http://social.msdn.microsoft.com/Forums/eu/healthvault/thread/e65d0467-14e8-4af8-b9fd-e8d8d739dbcc

Thanks again,

May

Coordinator
Jul 27, 2011 at 4:31 AM
Edited Jul 27, 2011 at 7:47 AM

HealthVault has XSLTs for transforming Thing types into a variety of formats.  You can query for transforms using the GetThingType method (there is a unit test which calls GetThingType).  If you ask for ThingTypeSectionSpec.TRANSFORMS, you get the name of the available transforms.  If you ask for ThingTypeSectionSpec.TRANSFORMSOURCE you get the actual XSLT. 

The transform for converting CCR to healthvault datatypes can be retrieved by querying for the CCR ThingType (1E1CCBFC-A55D-4D91-8940-FA2FBF73C195) and looking for the transform named "tohv".  These transforms contain C# code, however, so they can only be run on machines with access to the CLR.

If you want to get a collection of Things from HealthVault in a ccr, you can let HealthVault do the heavy lifting and use request.setFinalXsl("toccr");

CCR was made immutable to satisfy many of the clinical data providers who didn't want their data to be editable.  HealthVault will extract Thing types out of the CCR and those are editable.

--Rob