Export forms data: Getting GPS data from older times

Hi all –

– my app started in late 2015, and we were collecting GPS data in our forms.

– I recall that sometime in the past couple years, commcare changed the way that gps data was handled in the forms data.

– I want to be able to access gps data from the earlier days and the recent days.

– I am actually doing this so I know what fields to tell my developer to grab out of the his API forms data downloading.

– When I do normal commcare forms exports, the field called form.lcn is showing lots of data for the recent era… buy when I look back to 2015 data, that field just shows ‘—’.

– Can you tell me what fields my developer should use to access allthe gps data (both old era and new era, if they are separate)?

– An extra question. If the developer wants to use the api grab just the latitude and longitude in two separate fields, without having to split apart the unified field, are there fields for those individually?

thanks!
eric

Hey Eric,

In answer to:

Can you tell me what fields my developer should use to access allthe gps data (both old era and new era, if they are separate)?

If it’s true that the way that GPS data is encoded in forms has changed (I don’t know for sure if that’s so but it’s definitely possible), then there isn’t going to be a single syntax you can use to extract the data from the old and new forms. What you’ll have to do is look at one of your forms that has the old structure, and use that to determine what the correct XPath syntax would be to access the gps data in the older forms. Your developer will then need to implement logic where you try both methods on any given form, and use the results from whichever one works/is non-empty.

In answer to:

If the developer wants to use the api grab just the latitude and longitude in two separate fields, without having to split apart the unified field, are there fields for those individually?

I believe that the location data in a form is recorded just as that single field, but you can double check to be sure. What you’re able to extract from a form is whatever is encoded in the XForm and nothing more or less, so you can tell this for sure by looking at 1 of your completed forms and seeing the fields it contains.