Pull data with photos

Hi everyone,

In odk, data is pulled from a pre-loaded .csv file. Is it possible to pull data with photos?
Thank you.

Best,
Margaret

Hi Margaret,

I'm not sure. What have you tried so far?

Yaw

ยทยทยท On Sun, Apr 9, 2017 at 11:40 PM, wrote: > Hi everyone, > > In odk, data is pulled from a pre-loaded .csv file. Is it possible to pull data with photos? > Thank you. > > Best, > Margaret > > -- > -- > 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/d/optout.

Hi Margaret,

To provide a little more detail...

You should be able to put an image name (e.g., image.jpg) in a row in
a CSV, then use pull-data and calculates to store that name inside a
prompt for an image (try the media::image column). Then if you put the
image.jpg file in the media folder of the form, it should work, but
I've never tried it.

I'll be very interested to see what you find out!

Yaw

ยทยทยท On Tue, Apr 18, 2017 at 5:40 PM, Yaw Anokwa wrote: > Hi Margaret, > > I'm not sure. What have you tried so far? > > Yaw > > On Sun, Apr 9, 2017 at 11:40 PM, wrote: >> Hi everyone, >> >> In odk, data is pulled from a pre-loaded .csv file. Is it possible to pull data with photos? >> Thank you. >> >> Best, >> Margaret >> >> -- >> -- >> 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/d/optout.

Hi Margaret,

If you are looking at a means to organize and analyze the photos, see my
post HERE
https://groups.google.com/forum/#!searchin/opendatakit/lloyd$20banwart$20photo|sort:relevance/opendatakit/IMSmsn1tcyQ/TT06bDIYDqAJ.
Also, google fusion tables can be a great tool.

~Lloyd

ยทยทยท On Wednesday, April 19, 2017 at 3:47:35 AM UTC+3, Yaw Anokwa wrote: > > Hi Margaret, > > To provide a little more detail... > > You should be able to put an image name (e.g., image.jpg) in a row in > a CSV, then use pull-data and calculates to store that name inside a > prompt for an image (try the media::image column). Then if you put the > image.jpg file in the media folder of the form, it should work, but > I've never tried it. > > I'll be very interested to see what you find out! > > Yaw > > On Tue, Apr 18, 2017 at 5:40 PM, Yaw Anokwa <yan...@nafundi.com > wrote: > > Hi Margaret, > > > > I'm not sure. What have you tried so far? > > > > Yaw > > > > On Sun, Apr 9, 2017 at 11:40 PM, <megyk...@gmail.com > wrote: > >> Hi everyone, > >> > >> In odk, data is pulled from a pre-loaded .csv file. Is it possible to > pull data with photos? > >> Thank you. > >> > >> Best, > >> Margaret > >> > >> -- > >> -- > >> Post: opend...@googlegroups.com > >> Unsubscribe: opendatakit...@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...@googlegroups.com . > >> For more options, visit https://groups.google.com/d/optout. >

Hi Yaw,

We tried (I think) what you suggested above, but ran into a couple problems:

  1. We can't attach an image to the form in Central unless it is referenced literally (rather than through a variable) in the XLS (we get an error saying that no such attachment is referenced in the form).
  2. If we fake it by adding a row for a single image in the Excel, uploading the form and attachment, and then uploading a new version of the form with the hard-coded image name changed to use a variable, we see the following error in place of the actual image (the path appears to be correct):

File: /storage/emulated/0/Android/data/foo.bar.collect.android/files/projects/d714..../forms//filename.jpg is missing

(It looks like adding the new form version with a variable in the media::image column erased the unreferenced attachment in Central, as we have to upload again to go back to the hard-coded workflow.)

If you have any additional thoughts on how we could accomplish this it would be much appreciated.

Tobias

@TobiasMcNulty This is a pain point for me as well, I have CSVs that reference many images, so also need to force them into Central. Here's what I do:

  • Add a choice list, eg ref_images to your form, then under the image (and perhaps big-image) column put the filename - I use formulas to build the label / image / big-image values from the name.
  • important : Add a select_one to the form at the very start/end that references this choice list, but has relevance set to false. If you don't do this, the choice list won't end up in the XML and the media won't be required for Central upload. This step may become unnecessary in the future.

Obviously, you will need to keep your internal choice list and required media list in sync.

Are you then trying to use these files as dynamic defaults into an image widget? If so, see my showcase on this, currently it can be done in Collect but not Enketo by prepending filename.ext with jr://images/ and placing this string in the calculation column. I also pull a filtered set of fields from a CSV that have an image and big-image value into a select question in order to show these image(s)

2 Likes

This worked perfectly for us, many thanks for your help!

A key was putting the variable image name ${foo}.jpg into the image column in the survey tab, instead of the media::image column.

@TobiasMcNulty Do you have an example XLSForm that you could share including this fix of using the media:image column instead of the image column?

I'm not sure that its the same application/workflow as what I'm trying to do, but I'm trying to retrieve dynamic media using entities.