Accessing images on PowerBI

1. What is the problem? Be very detailed.
The developed form uses the images to track progress on the construction of schools/aid posts, etc. We are using ODK Collect v1.27.2, ODK Central v.08. The uploaded images on Odata feed as image the name. What is the URL of the images uploaded to ODK Central (v.08)? The objective is to display the images on a Microsoft PowerBI dashboard.

2. What app or server are you using and on what device and operating system? Include version numbers.

ODK Collect v1.27.2, on the latest android, ODK Central v.08 on Windows 10

3. What you have you tried to fix the problem?

Thinking where to start.

1 Like

The URL you're looking for is documented at https://odkcentral.docs.apiary.io/#reference/forms-and-submissions/'-attachments/downloading-an-attachment:

<your-server>/v1/projects/<projectId>/forms/<xmlFormId>/submissions/<instanceId>/attachments/<filename>

The server, project ID and form ID should all be the same if you're using a single form. The instance ID and filename will come from each row in your dataset. Hopefully this gives you enough info to get started! Consider sharing a quick screenshot or description of your dashboard when you have it up and running -- there's always a lot of interest in how people make sense of their media attachments in analysis.

Many thanks, Helene! Tried the URL you provided and it resulted in the browser automatically downloading the image. This is very helpful, but on PowerBI it will not allow displaying the image itself. Is there a chance to alter the URL so that it displays in the browser? This will allow displaying photographed images to also appear on the dashboard.

1 Like

Sadly I recently learned that PowerBI does not send authentication credentials when fetching images so this is currently not possible directly from Central (docs: "make sure security credentials aren't required to access the image file").

I think adding anonymous access to images in Central is probably our best bet for this. There's a feature thread at Can we hotlink ODK Central media files?.

In the mean time, I worked with a project that needed to do this and we ended up mirroring all media files on a public server using the attachments API and a periodic task.

1 Like

Dear @LN
I followed your advice to build the link. It looks like this:
https://central.bdrp.pk/v1/projects/2/forms/CBFS_WOS_DEMO_Formation_Form_v01/submissions/uuid:10a2a193-af41-4475-b866-6f1g18av7x9c84/3_25_51.jpg

However it gives the following error {"message":"Could not find the resource you were looking for.","code":404.1}

Can you kindly guide?

@Syed_Muhammad_Qadeer The URL @LN suggested has /attachments. Yours doesn't. Also, it's very unlikely the image name is 3_25_51.jpg. Collect uses datetime stamps for file names. It'd look something as 1634586857285.jpg.

1 Like

Yes, Thank you @yanokwa . You are right. I retired after adding /attachments and now it works as expected.
Thank you very much for your time.
BTW, is there any updated solution to display images in PowerBI directly?

Not at the moment. We know it's an important feature and would like to eventually add it to Central.

I am using ReDash to load up the images but it throws the error, the attachments API mentioned by @LN is not clickable. Is there a way where i can set up a cronjob to download media files with some kind of static token?

I will also be needing the image access for GIS label so adding the feature could be better.

Hi @LN,
Apologies for responding in a thread that's already solved. If this needs to be split into a different thread, then please do. However, I was looking into images in Power BI, and came across this post - and seems I'm trying to do something very similar. I feel like I've followed all the possible advice, and am getting stuck.

I was wondering, when you said you mirrored all media files onto a public server - apologies I'm not very aware of how this happens - but want to try something similar. I'm thinking of using an AWS S3 bucket (that sounds like I know what I'm talking about - but I really don't, just learning about the world of AWS & S3). And hosting images there, and then making the links to the images publicly accessible.

However, I don't know:

  1. is this like something you did? Am I looking at the right kind of public server? Or would you choose a different server?
  2. I don't know how to 'mirror' - is this simply through the API that you access and duplicate the images on your public server?

If any advice at all, I'd be really grateful!
Thank you,
Janna

1 Like

You'll need to the download the files from Central and upload them somewhere you can link to publicly.

For the download, you can use the Central API or manually download the images from the Central UI. S3 is a reasonable place to upload the images. But you could also likely use Dropbox, Github Pages, some web server, etc.

2 Likes

@yanokwa this is helpful. Thanks for pointing me in the right direction!

1 Like