QRealTime icon indicating copy to clipboard operation
QRealTime copied to clipboard

Import media filenames not just URLs from Kobo (and maybe Central)

Open walking-the-talk opened this issue 3 years ago • 1 comments

What's the issue? When importing data from Kobotoolbox any media files (notably images) are represented as URLs in the field of that name. This is good for working online when the server can 'deliver' that content, but if I want to transfer the media files offline I have no easy way of identifying them to view locally (e.g. using the identify tool and using the 'attachment' type in the attributes form). I have also found that images are not always fully rendered, possibly due to bandwidth, so this doesn't work quite as intended (not your problem!).

Looking at the QRT panel I see that the server exposes the URLs in different formats for download '_attachments': [{'mimetype': 'image/jpeg', 'download_small_url': [URL] 'download_url': [URL]' as well as the 'raw' data for the field (e.g. 'Photo1': '1597837187890.jpg')

So I assume that QRT is extracting the string from 'download_url' and inserting it into the 'Photo1' field in the QGIS layer.

What would I like? At the time of import (or possibly sync, for existing layers), it would be good to create a 'duplicate' field with the media filename (as stored on the server and downloaded in zip - see example above for 'Photo1'). This would allow me to use this field as type 'attachment' with a relative path to display media in the attribute form if I have downloaded it from the server to a local folder. For anyone working solely online this will be a redundant field, but if at any time the user wants to use the media attachment, it is immediately available. I would suggest a suffix to the field e.g. _media so that a layer with Photo1 would also import Photo1_media. A prefix would also be easy to work with (e.g. media_Photo1). This would also avoid any backwards compatibility issues of overwriting previously imported rows / layers with filenames instead of URLs

Work around? So at the moment I think an calculator expression to extract the filename from the 'end' of the URL into a new field might work or I need to download a csv from the server, join on the UUID field with the QRT layer to allow me to insert that field - but then I've done the hard work manually and QRT doesn't take me forwards :-) Particularly tedious if the dataset is accumulating so the operation would need to be repeated.

Many thanks for your plugin - I hope this is a useful suggestion.

walking-the-talk avatar Sep 18 '20 14:09 walking-the-talk