Hi,
I have wrote this code to update an alergy record:
Query q = new Query(new URL(PROFILE_FEED_PATH +
"ui/"+profileId));
Category myCategory = new Category("Alerts");
myCategory.setScheme("http://schemas.google.com/health/item");
myCategory.setTerm("Abbokinase");
CategoryFilter myCategoryFilter = new CategoryFilter(myCategory);
q.addCategoryFilter(myCategoryFilter);
ProfileFeed myCategoryResultsFeed = service.query(q,
ProfileFeed.class);
if (myCategoryResultsFeed.getEntries().size() > 0) {
ProfileEntry firstMatchEntry =
myCategoryResultsFeed.getEntries().get(0);
String ccrOld =
firstMatchEntry.getContinuityOfCareRecord().getXmlBlob().getBlob();
System.out.println("OLD CCR: "+ccrOld);
ContinuityOfCareRecord ccr = new ContinuityOfCareRecord();
XmlBlob x = new XmlBlob();
x.setBlob(new
String(firstMatchEntry.getContinuityOfCareRecord().getXmlBlob().getBlob()));
ccr.setXmlBlob(x);
firstMatchEntry.setContinuityOfCareRecord(ccr);
System.out.println("NEW CCR:
"+firstMatchEntry.getContinuityOfCareRecord().getXmlBlob().getBlob());
URL editUrl = new URL(firstMatchEntry.getEditLink().getHref());
ProfileEntry updatedEntry = service.update(editUrl,
firstMatchEntry);
System.out.println(updatedEntry.getContinuityOfCareRecord().getXmlBlob().getBlob());
}
The output is;
OLD CCR: <Language/><DateTime><Type/></DateTime><Patient/
><Body><Alerts><Alert><Type><Text>Allergy</Text></
Type><Description><Text>Abbokinase</Text><Code><Value>8437-2</
Value><CodingSystem>FDB</CodingSystem></Code></
Description><Status><Text>ACTIVE</Text></
Status><Source><Actor><ActorID>[EMAIL PROTECTED]</
ActorID><ActorRole><Text>Patient</Text></ActorRole></Actor></
Source><Reaction><Description/><Severity><Text>Severe</Text></
Severity></Reaction></Alert></Alerts></Body>
NEW CCR: <Language/><DateTime><Type/></DateTime><Patient/
><Body><Alerts><Alert><Type><Text>Allergy</Text></
Type><Description><Text>Abbokinase</Text><Code><Value>8437-2</
Value><CodingSystem>FDB</CodingSystem></Code></
Description><Status><Text>ACTIVE</Text></
Status><Source><Actor><ActorID>[EMAIL PROTECTED]</
ActorID><ActorRole><Text>Patient</Text></ActorRole></Actor></
Source><Reaction><Description/><Severity><Text>Severe</Text></
Severity></Reaction></Alert></Alerts></Body>
null
And from the google health web site the corresponding entry gets
vanished.
Here in this code, I have explicitly set the old CCR as the new CCR.
That means I am sending back exactly what google health is sending and
the update code is also adapted from google data api sample's page:
http://code.google.com/apis/gdata/client-java.html#Update_Item
retrievedEntry.setTitle(new PlainTextConstruct("Important meeting"));
URL editUrl = new URL(retrievedEntry.getEditLink().getHref());
EventEntry updatedEntry = myService.update(editUrl, myEntry);
That means the code and data both are taken from google. I double
checked so that there is not typo on my part. But still it is not
working.
So I am not sure what I should do on my part to make this working.
Please help here.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Health Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/googlehealthdevelopers?hl=en
-~----------~----~----~----~------~----~------~--~---