In the Python client, it's a little messy at the moment since all the CCR data isn't recognized (and parsed into an ExtensionElement). You can do something like the following:
// TODO: fetch AuthSub/OAuth token service = gdata.service.GDataService(service='health') feed = service.GetFeed(uri='https://www.google.com/h9/feeds/profile/ default?digest=true') ccr = feed.entry[0].FindExtensions('ContinuityOfCareRecord', 'urn:astm- org:CCR')[0] #print ccr.ToString() prints the entire CCR for the profile try: meds = ccr.FindChildren('Body')[0].FindChildren('Medications') [0].FindChildren('Medication') print 'Listing medications:' for med in meds: print med.FindChildren('Product')[0].FindChildren('ProductName') [0].FindChildren('Text')[0].text except: print 'No medications found in profile' Hope that helps, Eric On Nov 13, 10:09 am, Kwame <[EMAIL PROTECTED]> wrote: > Hi Eric, > I'm really anxiously awaiting the python GData library for Health, and > the examples are OK, but I would be grateful for a little extra help. > From the Java 1.5 examples, one can load a feed and iterate over it > like so: > > Query query = new Query(new URL("https://www.google.com/health/feeds/ > profile/default")); > query.addCustomParameter(new Query.CustomParameter("digest", "true")); > > try { > Feed result = healthService.getFeed(query, Feed.class); > > // We used the digest=true parameter, so there should only > // be a single Atom entry that contains all of the CCR data in > profile. > for (Entry entry : result.getEntries()) { > System.out.println(entry.getXmlBlob().getBlob()); > } > > } > > can you please give a simple example in Python. I've tried to do this > but its not working quite well. > > On Nov 3, 2:49 am, "Eric (Google)" <[EMAIL PROTECTED]> wrote: > > > On Nov 2, 9:29 pm, petem <[EMAIL PROTECTED]> wrote: > > > > On Nov 2, 7:18 am, "Eric (Google)" <[EMAIL PROTECTED]> wrote: > > > > > ... Until then, > > > > it's realatively straightforward to use the Atom and service > > > > base classes to connect to Health. > > > > > Here's a great Google App Engine sample that may > > > > help:http://code.google.com/p/googlehealthsamples/source/browse/#svn/trunk... > > > > Eric, thanks for the reference you gave but it hasn't helped me. If I > > > can couch a specific question then your answer might get me > > > started .... > > > > I'm trying to create ./examples/health/health_example.py, along the > > > lines of the other API samples. It uses ClientLogin/ProgramaticLogin. > > > The next step is to implement a GetHealthProfileListFeed(), and > > > therein I expect to call HealthProfileListFeedFromString(). The impl > > > of this latter > > > function requires definition and use of a HealthProfileListFeed class, > > > subclassed from AtomBase, for which I need a _namespace and an _tag. > > > I cannot find where to find the namespace and tag and similar detail > > > amongst the docs. > > > The profile/list feed is a basic atom feed. All of it's tags/ > > elementsfall under the atom ns. > > Seehttp://code.google.com/apis/health/reference.html#ClientLoginProfileL... > > > > Perhaps a few notes on subclassing the AtomBase class suitably for > > > parsing the CCR items? > > > For the profile/default feeds, CCR data is attached at the end of > > each > > atom <entry> as an xml blob. It falls under <ContinuityOfCareRecord > > xmlns="urn:astm-org:CCR"> > > > Seehttp://code.google.com/apis/health/developers_guide_protocol.html#Get... > > for the structure of the profile feed. > > > Thepythonclient does a decent job of interpreting the CCR as an > > extension element, > > putting it in a different namespace. Here's some quick code: > > > import gdata > > import gdata.service > > import atom > > service = gdata.service.GDataService(email='[EMAIL PROTECTED]', > > password='paSSword', service='health') > > service.ProgrammaticLogin() > > feed = service.Get(uri='https://www.google.com/health/feeds/profile/ > > list') > > > ...not sure if any of this helps. > > > Eric > > > > Once I get past that, I guess I'm referring to the CCR docs to get > > > atom detail for ClientLogin profile feed items? > > > > Thanks if you can help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
