mrdwab / koboloadeR

KoBo Toolbox offers a convenient way to collect data using web and mobile forms. This package facilitates the retrieval of data entered using these tools using the KoBo Toolbox API (v1).
11 stars 44 forks source link

get labels in the export #6

Open Edouard-Legoupil opened 8 years ago

Edouard-Legoupil commented 8 years ago

Coudl be great to get the labels in the exported data set

see: https://github.com/kobotoolbox/kobocat/issues/101

One option there might be to get the form definition in order to get the lablel (see some tentative approach here: https://github.com/unhcr-iraq/protection-monitoring/blob/gh-pages/code/1-loaddata.R#L38:L70

mrdwab commented 8 years ago

@Edouard-Legoupil I think this should be possible.... The biggest challenge would be parsing some of the more deeply nested forms. Do you know any examples of public datasets that might have features like skip questions so that I can run some tests? Otherwise I might meet need to create a couple of sample projects to work off of....

mrdwab commented 8 years ago

@Edouard-Legoupil I've come up with something that works well with exactly half of my datasets ;-)

At this point, it seems like my best options would be to work with a function that takes a local data file (say a CSV) and an XLSForm file and applies the labels. For some reason, I'm not having consistent results in loading the XLSForm off the server. See this question I've raised at the KoBo support site.

If you have any ideas, let me know.

Edouard-Legoupil commented 8 years ago

@mrdwab Hi,

Would you share / commit what you have already? -- I understand that the issue is for form that were created using the form builder. As I am usually not using it , it should work fine.

Thanks, Edouard

Edouard-Legoupil commented 8 years ago

oups -- got it: https://gist.github.com/mrdwab/28c13a0537044aeb5dc0 Thanks!