Static insights

In DSS code recipes and notebooks, you can create static insights: data files that are created by code and that can be rendered on the dashboard.

This capability can notably be used to embed in one click charts created using:

You can also use it for embedding in the dashboard any kind of content (image, HTML, …)

dataiku.insights.save_data(id, payload, content_type, label=None, project_key=None, encoding=None)

Saves data as a DSS static insight that can be exposed on the dashboard

Parameters
  • id (str) – Unique identifier of the insight within the project. If an insight with the same identifier already exists, it will be replaced

  • payload – bytes-oriented data, or Base64 string

  • content_type – the MIME type of the data in payload (example: text/html or image/png)

  • label (str) – Optional display label for the insight. If None, the id will be used as label

  • project_key (str) – Project key in which the insight must be saved. If None, the contextual (current) project is used

  • encoding (str) – If the payload was a Base64 string, this must be “base64”. Else, this must be None

dataiku.insights.save_figure(id, figure=None, label=None, project_key=None)

Saves a matplotlib or seaborn figure as a DSS static insight that can be exposed on the dashboard

Parameters
  • id (str) – Unique identifier of the insight within the project. If an insight with the same identifier already exists, it will be replaced

  • figure – a matplotlib or seaborn figure object. If None, the latest processed figure will be used

  • label (str) – Optional display label for the insight. If None, the id will be used as label

  • project_key (str) – Project key in which the insight must be saved. If None, the contextual (current) project is used

dataiku.insights.save_bokeh(id, bokeh_obj, label=None, project_key=None)

Saves a Bokeh object as a DSS static insight that can be exposed on the dashboard A static HTML export of the provided Bokeh object is done

Parameters
  • id (str) – Unique identifier of the insight within the project. If an insight with the same identifier already exists, it will be replaced

  • bokeh_obj – a Bokeh object

  • label (str) – Optional display label for the insight. If None, the id will be used as label

  • project_key (str) – Project key in which the insight must be saved. If None, the contextual (current) project is used

dataiku.insights.save_plotly(id, figure, label=None, project_key=None)

Saves a Plot.ly figure as a DSS static insight that can be exposed on the dashboard A static HTML export of the provided Plot.ly object is done

Parameters
  • id (str) – Unique identifier of the insight within the project. If an insight with the same identifier already exists, it will be replaced

  • figure – a Plot.ly figure

  • label (str) – Optional display label for the insight. If None, the id will be used as label

  • project_key (str) – Project key in which the insight must be saved. If None, the contextual (current) project is used

dataiku.insights.save_ggplot(id, gg, label=None, width=None, height=None, dpi=None, project_key=None)

Saves a ggplot object as a DSS static insight that can be exposed on the dashboard

Parameters
  • id (str) – Unique identifier of the insight within the project. If an insight with the same identifier already exists, it will be replaced

  • gg – a ggplot object

  • label (str) – Optional display label for the insight. If None, the id will be used as label

  • width (int) – Width of the image export

  • height (int) – Height of the image export

  • dpi (int) – Resolution in dots per inch of the image export

  • project_key (str) – Project key in which the insight must be saved. If None, the contextual (current) project is used