Extracting CCR File for iphone OS

26 views
Skip to first unread message

Ash Kin

unread,
Nov 2, 2009, 3:58:47 PM11/2/09
to Google Data APIs Objective-C Client Library Discussion
Hi,

I am trying to develop google health for my iphone. I have GData
classes library and the code from google health which is working for
Mac OS.

I am trying that code to work for my iphone OS. I could do the login
and the profile, but I want the content of the CCR, I want to read
that file and extract only medication tag from that file.

Greg Robbins

unread,
Nov 2, 2009, 4:18:35 PM11/2/09
to gdata-objec...@googlegroups.com
The CCR is available by invoking continuityOfCareRecord on a health profile entry, as shown in HealthSampleWindowController.m.

Given a GDataContinuityOfCareRecord object, you can convert it to a GDataXML tree by calling XMLElement, then use the GDataXML APIs (which are similar to Apple's NSXML APIs on Mac) to parse the contents of the CCR XML blob.

Because the CCR blob is plain XML and not structured as Atom or Google Data API data, the library does not attempt to parse the contents. You have to get at the CCR contents manually using the GDataXML APIs.

Ash Kin

unread,
Nov 2, 2009, 4:27:46 PM11/2/09
to gdata-objec...@googlegroups.com
Hi Greg,
 
Thanks for replying.
 
I invoked CCR by invoking continuityOfCareRecord on a health profile entry.
If you can show me the sample code on how to use GDataXML, will be very helpful..
 
Thanks & Regards,
Ash

Greg Robbins

unread,
Nov 2, 2009, 4:35:04 PM11/2/09
to gdata-objec...@googlegroups.com
There is no sample code for using GDataXML. Look at the interfaces in GDataXMLNode.h and see Apple's documentation for the NSXMLNode/NSXMLELement class, which is essentially similar.

Ash Kin

unread,
Nov 3, 2009, 11:49:05 AM11/3/09
to gdata-objec...@googlegroups.com
Thanks for replying greg. I am using GDataXML now. Now my question is that how to traverse NSXML/GDataXML subtree.
Ex: I found the "Body"  (a child node) in my XML, now making Body a root, I like to traverse a tree again.
 
What should I do for that?
 
Thanks,
Ash

Greg Robbins

unread,
Nov 3, 2009, 4:28:45 PM11/3/09
to gdata-objec...@googlegroups.com
Typically, you'll just use the -children and -childAtIndex: methods to traverse the tree, or nodesForXPath:namespaces:error: to traverse large sections at once.

There are not many methods in GDataXMLNode, and most of them are documented in Apple's NSXML documentation. Browse that, and use http://codesearch.google.com to find examples online.

Ash Kin

unread,
Nov 3, 2009, 7:14:33 PM11/3/09
to gdata-objec...@googlegroups.com
Hi Greg,
 
I really appreciate your responces. I have one question regarding profile entry. In our code we write as firstEntry so when I run the code, it gives me only one medication, I want all the medications for that user or for that profile. Am getting only one.
 
What can be the solution for that?
 
Thanks & Regards,
Ash

Greg Robbins

unread,
Nov 3, 2009, 7:18:23 PM11/3/09
to gdata-objec...@googlegroups.com
Are you seeing all entries returned for the user in the Health sample app on the Mac?

Ash Kin

unread,
Nov 3, 2009, 7:21:01 PM11/3/09
to gdata-objec...@googlegroups.com
Yes.

Ash Kin

unread,
Nov 3, 2009, 7:28:41 PM11/3/09
to gdata-objec...@googlegroups.com
Hi, Graig,

Let me explain you the actual issue. 

Currently I am getting one CCR subset for one medication or one condition. Same as the MAC example logic. Is it possible to get one complete CCR with all medication and conditions ? I read documentation and found we can user digest=true/false for the same. 
And I am also trying to build the query.. I will keep you posted with updates.

Thanks,
Ash

Greg Robbins

unread,
Nov 3, 2009, 8:36:09 PM11/3/09
to gdata-objec...@googlegroups.com
I'm not familiar with the details of the Health API.

Try checking the Health API docs and reading posts in the Health API discussion group,

http://groups.google.com/group/googlehealthdevelopers/

If you post in that discussion group, use the Objective-C library's HTTP logging features to get the text of the request URLs and XML responses, as most developers in the Health API group have never used the Objective-C API.

petem

unread,
Nov 3, 2009, 11:38:21 PM11/3/09
to Google Data APIs Objective-C Client Library Discussion
Well at least one person uses the GData API for Google Health. I think
you're asking two questions
a) can you fetch medication and conditions together?
Ans: I'm not sure you can but it doesn't matter it's probably not what
you should be doing. The GH jargon is "categories". You should fetch
them separately. Yes you can modify the request URL with digest etc as
suggested. Check the GData API for the "GDataQueryGoogleHealth" and
"GDataCategoryFilter" classes for example.

b) About parsing (how to) you can work as Greg suggested with the
GDataXML API, XPath-like functionality especially - see the header
files, or with straight NSXMLParser and take the classic parser
approach - a Google search will yield good examples of its use.

Hope that gets you moving.

On Nov 4, 11:28 am, Ash Kin <ashki...@gmail.com> wrote:
> Hi, Graig,
>
> Let me explain you the actual issue.
>
> Currently I am getting one CCR subset for one medication or one condition.
> Same as the MAC example logic. Is it possible to get one complete CCR with
> all medication and conditions ? I read documentation and found we can user
> digest=true/false for the same.
> And I am also trying to build the query.. I will keep you posted with
> updates.
>
> Thanks,
> Ash
>
>
>
> On Tue, Nov 3, 2009 at 7:21 PM, Ash Kin <ashki...@gmail.com> wrote:
> > Yes.
>
> > On Tue, Nov 3, 2009 at 7:18 PM, Greg Robbins <grobb...@google.com> wrote:
>
> >> Are you seeing all entries returned for the user in the Health sample app
> >> on the Mac?- Hide quoted text -
>
> - Show quoted text -

Ash Kin

unread,
Nov 4, 2009, 9:48:39 PM11/4/09
to gdata-objec...@googlegroups.com

Hi Petem,
 
Thanks a lot for replying. I could get the data and as you said I am not combining medications and conditions.
I have another question :
 
As I am new to this programming, please do not mind if my questions are very basic.
 
I just wanted to know why and how to use core data for my application? and if you can provide any example for that.
 
Thanks&Regards,
Ash

Peter J. MASON

unread,
Nov 4, 2009, 11:57:06 PM11/4/09
to gdata-objec...@googlegroups.com

Having gathered your data you need to manage it somehow, which means it needs to live somewhere and also be available for your preferred access. Core data is only newly available for iPhone, so I won’t pretend to be an expert at it.

 

Before Core Data became available an  NSDictionary may have normally been used. There are pros and cons – others might elaborate? If you need to persist your data then Core Data may certainly be your best choice. A really good reason to use Core Data is that is forces you to get your data model together properly.

 

In practice I think you’ll develop using some starter example that comes close to your own app. There are examples of UITableView-based apps available, which will show how to use either data management method, with editing and without editing. Personally, I think the hardest part is to properly use the UITableViewDataSource and UITableViewDelegate protocols in building your first Phone app, especially if editing is required.

 

If you do the obvious Google search for “core data iphone example” then you’ll get useful examples, and if you’re in the Apple developers’ program then there’s plenty of help there. There’s not a lot of use of me sharing code snippets. The big picture is what you need to know.

 

I’m not sure I’ve helped alot here, but be comfortable in choosing to use Core Data – the data modelling is useful in itself.

Ash Kin

unread,
Nov 5, 2009, 6:30:44 PM11/5/09
to gdata-objec...@googlegroups.com
Hi,
 
I really appreciate your prompt responses. I could figure out how to use digest and I could get all the data in a single file.
Thanks a lot.
 
Ash

On Tue, Nov 3, 2009 at 11:38 PM, petem <mr.ridd...@gmail.com> wrote:

Ash Kin

unread,
Nov 6, 2009, 12:29:33 PM11/6/09
to gdata-objec...@googlegroups.com
Hi all,
 
Does anybody know how to create graph on iphone. I have my medical test results. I want to plot a graph against date and value.
Any help and example would be really useful.
 
Thanks&Regards,
Ash

Saggau

unread,
Nov 6, 2009, 12:47:27 PM11/6/09
to gdata-objec...@googlegroups.com
Core plot at google code. 

Sent from my iPhone

Saggau

unread,
Nov 6, 2009, 12:47:47 PM11/6/09
to gdata-objec...@googlegroups.com, gdata-objec...@googlegroups.com
Core plot at google code

Sent from my iPhone

Ash Kin

unread,
Nov 6, 2009, 2:25:36 PM11/6/09
to gdata-objec...@googlegroups.com
Can  you tell me or provide me the simple example on how to use core plot? I searchen on the net, found examples were uisng mercurial. Does that work for the iPhone?
 
Thanks & Regards,
Ash

Ash Kin

unread,
Nov 6, 2009, 3:02:26 PM11/6/09
to gdata-objec...@googlegroups.com
 
I got this link and it says me to download mercurial and then to run the command
 
starting with hg:// 
 
i do not know where and how to run that? and mercurial, files are .py so how it will work with my iphone OS?
 
Any help will really be helpful
 
Thanks&Regards,
Ash

On Fri, Nov 6, 2009 at 12:47 PM, Saggau <sag...@gmail.com> wrote:

Greg Robbins

unread,
Nov 6, 2009, 3:26:34 PM11/6/09
to gdata-objec...@googlegroups.com
Some appropriate sites for general iPhone programming questions are http://iphonedevsdk.com/ and http://stackoverflow.com/

Please avoid using this discussion group for iPhone and Mac development questions unrelated to Google's APIs and the client library.


Ash Kin

unread,
Nov 7, 2009, 12:22:00 PM11/7/09
to gdata-objec...@googlegroups.com
I am using google API for health that is why I was posting the questions. Previously I got replies for my question on core data so I was encoraged to ask regarding core plot.
 
Anyways, will take carre next time.
 
Thanks,
Ash

Ash Kin

unread,
Nov 9, 2009, 1:19:55 PM11/9/09
to gdata-objec...@googlegroups.com
Hi Petem,
 
Do you know classes any google API which I can use to send the updated CCR back to google.
Like, I have retrieved CCR from google health API, now I can update it and want to send the updated on to google. What are the classes or methods available in google API to do that?
 
Thanks,
Ash

On Wed, Nov 4, 2009 at 11:57 PM, Peter J. MASON <mr.ridd...@gmail.com> wrote:

Ash Kin

unread,
Nov 9, 2009, 1:53:38 PM11/9/09
to gdata-objec...@googlegroups.com
Does anyone know how to send update CCR back to the google. Like we retrieve the data from google, how can we send data back to the google. What are the classes and methods available for that?
 
Thanks,
Ash

Greg Robbins

unread,
Nov 9, 2009, 2:00:15 PM11/9/09
to gdata-objec...@googlegroups.com
The service class method fetchEntryByInsertingEntry: adds a new entry, and fetchEntryByUpdatingEntry: replaces an entry.

See GDataServiceGoogle.h for the various methods used to modify data.

Though the example application for Health does not currently support modifying data, the example apps for most of the other services do, so take a look at those applications to see how to use the various service class methods to add, modify, and delete entries.

Ash Kin

unread,
Nov 10, 2009, 3:55:31 PM11/10/09
to gdata-objec...@googlegroups.com
Hi Greg,
 
Thanks a lot. I am trying to do that but my problem is how to write a CCR, whether all the fields should be included or part of CCR also can be updated??
 
And how to generate the CCRDocumentObjectID, I paste your code regarding inserting value where you have hard coded CCRDocumentObject ID value.
 
Your help is apprerciated.
 
Thanks,
Ash

Peter J. MASON

unread,
Nov 10, 2009, 4:06:25 PM11/10/09
to gdata-objec...@googlegroups.com

Once again this is out of band for this group, but the CCR Reference at http://code.google.com/apis/health/ccrg_reference.html in its discussion of each element, indicates which are mandatory. The choice of ObjectID is entirely up to the CCR generator, but that’s in the doc too J

 

From: gdata-objec...@googlegroups.com [mailto:gdata-objec...@googlegroups.com] On Behalf Of Ash Kin
Sent: Wednesday, 11 November 2009 7:56 AM
To: gdata-objec...@googlegroups.com
Subject: Re: Extracting CCR File for iphone OS

 

Hi Greg,

Ash Kin

unread,
Nov 10, 2009, 8:54:24 PM11/10/09
to gdata-objec...@googlegroups.com
I got that. Thanks.

Ash Kin

unread,
Nov 11, 2009, 12:47:23 PM11/11/09
to gdata-objec...@googlegroups.com
Hi Greg,
 
I was able to insert new entry in Google Health. Now I am trying to update or delete the data from CCR. My question is that how do I get the objectID of the CCR I just saved. I think ObjectID will be unique which can be used to update or delete the records from CCR.
 
Thanks,
Ash

Ash Kin

unread,
Nov 12, 2009, 11:25:09 AM11/12/09
to gdata-objec...@googlegroups.com
I would really appreciate if someone can give me the idea regarding update/deletion in google health API.. I just need the unique key on which I will do the operation and how to get the value of it?
 
Thanks,
Ash


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Data APIs Objective-C Client Library Discussion" group.
To post to this group, send email to gdata-objec...@googlegroups.com
To unsubscribe from this group, send email to gdata-objectivec-...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gdata-objectivec-client?hl=en
-~----------~----~----~----~------~----~------~--~---


Greg Robbins

unread,
Nov 12, 2009, 8:49:46 PM11/12/09
to gdata-objec...@googlegroups.com
I don't know what "objectID" or "unique key" you're referring to.

Modifying and deleting is done with the fetchEntryByUpdatingEntry: and deleteEntry: service class methods, and they update or delete entire entries, not portions of entries. There are many examples in the library sample code of using those methods.

The CCR is one opaque element inside of a Health API entry; there are no operations on portions of CCRs. You need to modify the entire CCR XML yourself using the GDataXML APIs, then update the entry.

Ash Kin

unread,
Nov 12, 2009, 9:01:14 PM11/12/09
to gdata-objec...@googlegroups.com
Greg,
 
I really appreciate your help. You mean to say that If I want to delete or update any portion of CCR, I have to regenerate the entire new CCR once again with those updates and I can change any portion of CCR.
 
That means those operations are done on entire XML.
 
Could you please send me the link of thos examples using those methods in objective C.
 
Thanks once again,
Ash

--

You received this message because you are subscribed to the Google Groups "Google Data APIs Objective-C Client Library Discussion" group.
To post to this group, send email to gdata-objec...@googlegroups.com.
To unsubscribe from this group, send email to gdata-objectivec-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gdata-objectivec-client?hl=.

Greg Robbins

unread,
Nov 12, 2009, 9:07:09 PM11/12/09
to gdata-objec...@googlegroups.com
There are no examples in the library of modifying CCRs. You can look at the sample applications for other services in the library to see how to use the fetchEntryByUpdatingEntry: and deleteEntry: methods, but you'll have to figure out yourself how to modify the CCR XML using the GDataXML APIs.

Ash Kin

unread,
Nov 12, 2009, 9:24:24 PM11/12/09
to gdata-objec...@googlegroups.com
Thanks Greg,
 
Send me the link, which has examples of other services. I will definitely figure it out. You are a great help.
 
Thanks,
Ash

On Thu, Nov 12, 2009 at 9:07 PM, Greg Robbins <grob...@google.com> wrote:
There are no examples in the library of modifying CCRs. You can look at the sample applications for other services in the library to see how to use the fetchEntryByUpdatingEntry: and deleteEntry: methods, but you'll have to figure out yourself how to modify the CCR XML using the GDataXML APIs.

Greg Robbins

unread,
Nov 12, 2009, 9:28:44 PM11/12/09
to gdata-objec...@googlegroups.com
If you download the Google Data APIs Objective-C Client Library, you will find the example applications in the Examples folder. All of the relevant code is in the WindowController source file of each example app.


Peter J. MASON

unread,
Nov 12, 2009, 9:32:23 PM11/12/09
to gdata-objec...@googlegroups.com

Ash: The GDATA API that this group deals with, doesn’t know about a CCR. It is “blob” data as far it’s concerned. You’ll need to process that “blob” yourself using whatever you can find to work with the particular “blob” that is the CCR. Once you have your prepared the “blob” then GDATA has facilities for sending, deleting etc after picking the correct data feeds. As said, there are examples of sending, receiving “blobs” amongst the sample apps.

 

From: Ash Kin [mailto:ashk...@gmail.com]
Sent: Friday, 13 November 2009 1:24 PM
To: gdata-objec...@googlegroups.com
Subject: Re: Extracting CCR File for iphone OS

 

Thanks Greg,

Ash Kin

unread,
Nov 12, 2009, 9:42:26 PM11/12/09
to gdata-objec...@googlegroups.com
Hi Peter,
 
I understand what you are saying. That's why I am asking about the facilities for deleting and updating, nothing else.  I have seen similar kinds of questions in this group. I was just wondering whether we can update the portion of XML, Is GDATA providing any kind of facility (class/method) for that, now I got answer for that. Once again thanks for all your help..
 
Guidance of this group keeps me going :)
 
Thanks,
Ash

Reply all
Reply to author
Forward
0 new messages