1. What is the problem? Be very detailed.
I am currently using the image feature in ODK collect to take a picture of different participant's details participant. During the project, I will have to take these images for over 2,000 people, using different devices and across multiple days. For each participant I calculate a unique ID using once(uuid())
When using ODK Briefcase to export the data, for each device, all the images collected go into a media folder and are saved with a random name. Is there any calculation option or option in the settings that would allow me to save the images with the name that corresponds to the participant's unique ID calculated?
Thank you for your response, I will vote for it now.
How do people deal with this issue usually? Do you know? I have just tested the xls form again and the images I have captured today are saved with the same name as the ones captured yesterday. This of course creates a problem of data management when combining the data across days. DO you know how people usually target this issue?
If you use ODK Collect, the filename is based on a timestamp. If you use a modern version of Enketo (e.g. the one shipped with Central), that should also add a timestamp suffix. What combination of tools and versions are you using that lead to this outcome?
That means when a photo is saved for example in ODK Collect its name is generated based on the current timestamp. So if you took a picture at this particular moment Fri Apr 16 2021 09:10:39 the name should be like 1618564239462 (date converted to milliseconds). You can decode it using https://currentmillis.com/
That means those names should be unique so what you said:
seems impossible. Are you sure it works like that?
thank you for your explanation. I think you are right, going back to my exported data, I have seen that the data was overwriten. My mistake, sorry! Thank you again for the explanation.
To provide a little extra context, the filenames are assigned this way to (nearly) guarantee unique filenames even in offline operation. It’s technically possible for two data collectors to capture an image at the same millisecond but very unlikely. On the other hand, unless random uuids are used, it’s more likely that form data is duplicated across data collectors leading to filename conflicts for images.
Can you tell us more about what you want to do with the images? For example, are you ingesting them into another system that expects meaningful filenames? As @Grzesiek2010, you currently would need to script the rename.
My only concern is that a picture is taken at the same exact millisecond between two devices but as you mentioned this is highly unlikely. And if it happens we will be able to match the very low number of images for which it happens by hand.
I have had this challenge before and I got a work around where I used a combination of Excel and a batch file on windows to organize the media files. I was able to have the media files organised per survey into a folder.
Exactly. The alternative would be to make the filename longer to make collisions even less likely. At some point filename length can become a barrier so it's a tradeoff.
Thanks for sharing your experience, @Stephen_Wanjau! This reminds me of something I've done which is to add a column in Excel to compute a clickable file path from the filename column. That column would use an expression like =HYPERLINK(CONCAT("/path/to/image/dir", C2)).