Can I create a custom visualization in the dashboard from third party API

I want to find out if I can create a custom visualization from a third party API as dashboard item.

For instance I will fetch the data from an external REST API and create a custom visualization to display in the dashboard. I saw that I can add the following dashboard items Visualizations, Maps, Event Reports, Event Charts, Reports, Resources, Apps, Text box, Messages. But I don’t know if any of them can accommodate creating a custom visualization aid that fetch data from a third party API.

1 Like

Hi @jetisco4u

This sounds more like a custom app. It is possible to add links to resources into the DHIS2 Dashboard; however, the visualizations, maps, and other illustrations need to be from a DHIS2 App. If you are able to create a custom DHIS2 web app which will load the visualizations from third party API, I think you might then be able to achieve the desired result, but as you anticipated, it’s not possible directly.

If this is a common use case or of great importance and will be helpful to the community, we can also create a feature request. :pray:

Thank you!

I want to create a custom visualization app from a third party API but I was thinking it will be possible to display it in the dashboard. But from your statement it appears users can only access it from the app management menu.

I believe it is also possible to create an app that acts as a dashboard widget, which you can then add to a dashboard as you would another visualization item (chart, table, etc). Here are some examples on the App Hub.
I tag @Rene if there are additional developer resources for this type of custom app.

1 Like

Big thanks I will look into this

I have created some pivot table and data table custom apps already from third party API but we can only access them as an APP. I will like to know how the app widget works whether it is possible to add the app to the dashboard as widget. I want to replicate my existing visual dashboard as a widget.

Hi @jetisco4u, we do not have a lot of up-to-date documentation for building dashboard widgets, but yes, you can rebuild your app as a dashboard widget, and then you would be able to insert it in a dashboard (you might want to install one of those dashboard widgets on a test instance like play/dev and then try adding them as a dashboard item to see the general idea of dashboard widgets).

Unfortunately, you would need to make some changes in the set up and building a dashboard widget is not currently supported with the DHIS2 app platform. We are working on building out our architecture so that it will be easier to access DHIS2 apps as plugins within other apps (e.g. in the dashboard app), but that is something we’re currently working with and it won’t be available for at least a few months.

If you want to rebuild the app as dashboard widget, you might want to look at the skeleton that the DHIS2 design lab created for building these as part of some student projects a couple of years ago: GitHub - dhis2designlab/dashboard-app-skeleton: This repository can be used as a foundation to create DHIS2 dashboard apps.. I have not checked the repo, and it might be a bit out-of-date, but it might be something to look at as an idea to the configuration you need to make the app into a dashboard widget.

If you have other questions, let us know!

Thanks @tzemp I checked out the app skeleton and it is just a boilerplate. I think it is the same thing the app platform boilerplate also do so I will go with the app platform. But it doesn’t offer any additional configuration idea. But I will build on my experience and see what I can come up with.

Hi @jetisco4u. Definitely try out what you think will work for you. You might run into a couple of challenges if using the app platform to build a dashboard widget, for example:

  • the manifest that you use to upload your app needs to have "appType": "DASHBOARD_WIDGET" which won’t be the case when you build via the app platform
  • the app platform will inject your app into a shell which wraps the app with the headerbar (also various providers, error boundary, etc.,) (I assume you will not want the header bar to appear within your widget)

But it could still be a good starting point for figuring out what you need/want to include when building your widget.

Sorry that we don’t have a more ready-to-go solution at the moment, but we hope to make building these easier in the future.

Let us know how it goes.

You are right about this and I didn’t think about it for the widget. The visual tool app I built with the app platform already present this challenge that is why I was looking at the widget option. I will explore the old approach with the skeleton and see what comes out of it.