Submit binary or csv file as part of survey?

ODK has the ability to submit images and video. If I have a widget generate
a file how can I have that file sent to Aggregate when the form is
uploaded? I'm looking to send about 16kB of binary data.

If the file is placed in the instance folder (where the captured
images/audio/video are saved), then it will be uploaded to ODK Aggregate.
ODK Aggregate will ignore the file unless its filename is saved in the
form. There may be additional changes required in collect or aggregate to
handle non-image/audio/video attachments within submissions (haven't looked
at this code in a while).

To begin, create a new widget to select the file and copy it into that
directory. This should be straightforward.

Please consider contributing the code back to the project, as others have
requested this feature. All contributed code must be released under the
Apache 2 license with a copyright notice of your choosing.

M
itch

··· On Mon, Jul 1, 2013 at 10:33 PM, Javier Rosa wrote:

ODK has the ability to submit images and video. If I have a widget
generate a file how can I have that file sent to Aggregate when the form is
uploaded? I'm looking to send about 16kB of binary data.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

How would I add the filename into the form so that ODK aggregate would
notice it?

JR

··· On Tue, Jul 2, 2013 at 9:52 AM, Mitch Sundt wrote:

If the file is placed in the instance folder (where the captured
images/audio/video are saved), then it will be uploaded to ODK Aggregate.
ODK Aggregate will ignore the file unless its filename is saved in the
form. There may be additional changes required in collect or aggregate to
handle non-image/audio/video attachments within submissions (haven't looked
at this code in a while).

To begin, create a new widget to select the file and copy it into that
directory. This should be straightforward.

Please consider contributing the code back to the project, as others have
requested this feature. All contributed code must be released under the
Apache 2 license with a copyright notice of your choosing.

M
itch

On Mon, Jul 1, 2013 at 10:33 PM, Javier Rosa javirosa1912@gmail.comwrote:

ODK has the ability to submit images and video. If I have a widget
generate a file how can I have that file sent to Aggregate when the form is
uploaded? I'm looking to send about 16kB of binary data.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/RJwGgpLwILg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

The widget to develop would be a general external file-attachment widget,
the interaction with the external app would be similar to the interactions
with the 'choose image' functionality of the image widget (i.e., copying
the returned file into the instance directory from wherever it
originated). OI File Manager is a free, nice, generic file manager, with a
published choose-file intent that you could leverage for this.

Within the xform, instead of something like this, which is for capturing
images:

<h:body>

this will launch the camera
image widget

</h:body>

This new widget would specify a different mediatype:

<h:body>

this will launch the OI File Manager to pick the file
file widget

</h:body>

And the mediatype here is "file/" or perhaps "application/".
Within ODK Collect, you would change the WidgetFactory to have a new case
similar to the AUDIO_CAPTURE case here:

http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/widgets/WidgetFactory.java?repo=collect#110

The change would be:

case Constants.CONTROL_UPLOAD:
questionWidget = new FileUploadWidget(context, fep);
break;

Where FileUploadWidget is the widget you write, using OI File Manager to
pick the file to attach, using the ImageWidget as an example.

Once you have that written, you can either submit a patch with the changes
or push the changes to a public clone of ODK Collect.

Mitch

··· On Tue, Jul 2, 2013 at 10:13 AM, Javier Rosa wrote:

How would I add the filename into the form so that ODK aggregate would
notice it?

JR

On Tue, Jul 2, 2013 at 9:52 AM, Mitch Sundt mitchellsundt@gmail.comwrote:

If the file is placed in the instance folder (where the captured
images/audio/video are saved), then it will be uploaded to ODK Aggregate.
ODK Aggregate will ignore the file unless its filename is saved in the
form. There may be additional changes required in collect or aggregate to
handle non-image/audio/video attachments within submissions (haven't looked
at this code in a while).

To begin, create a new widget to select the file and copy it into that
directory. This should be straightforward.

Please consider contributing the code back to the project, as others have
requested this feature. All contributed code must be released under the
Apache 2 license with a copyright notice of your choosing.

M
itch

On Mon, Jul 1, 2013 at 10:33 PM, Javier Rosa javirosa1912@gmail.comwrote:

ODK has the ability to submit images and video. If I have a widget
generate a file how can I have that file sent to Aggregate when the form is
uploaded? I'm looking to send about 16kB of binary data.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google
Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/RJwGgpLwILg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com