Discover this year's submissions to the Dataiku Frontrunner Awards and give kudos to your favorite use cases and success stories!READ MORE

Generating charts in a notebook for the wiki

Darius679
Level 2
Generating charts in a notebook for the wiki

I am trying to build a project template. My idea is that a user uploads a data set to a dataiku app, some work is done in the flow using notebooks/recipes, the results are automatically populated into the wiki, and the contents of the wiki are exported in a pdf as a report to the user. 

Is this kind of dynamic wiki action then exporting as a pdf possible? How can I generate a chart in a notebook and then have that chart appear in a wiki? Or even a few lines of a data frame? How can I export the wiki as a pdf in a dataiku app? 

0 Kudos
4 Replies
Emma
Dataiker
Dataiker

Hey @Darius679 ,

That is a great use case for a Dataiku Application! 

However, I'd encourage you to use the App to run some part of the Flow that populates a Dataiku Dashboard instead of a Wiki. Dashboards can contain custom code and charts made in a Notebook and be exported as a PDF. 

Here is how to create insights from Jupyter notebooks on a Dashboard: https://doc.dataiku.com/dss/latest/dashboards/insights/jupyter-notebook.html#publishing-a-jupyter-no...

Then, from within the Application Designer you add the Tile > Download Dashboard (see screenshot). 

Hope that helps, 

Emma 

0 Kudos
Darius679
Level 2
Author

Thanks @Emma. Seems like the dashboard is the way to go instead of the wiki.

I don't see how to make the app actually run the notebook and then publish it to the dashboard.

It seems like I should define a tile in the App Developer to 'Run Scenario' and then the scenario should run the notebook and publish it to the dashboard. When I'm setting up a scenario the only thing that looks relevant is 'export notebook' but this doesn't offer any connection to a dashboard. I've actually set up a scenario to 'export notebook', then manually ran the scenario, Dataiku says it's run successfully... but nothing happens. 

What's the right way to do this?

0 Kudos
Emma
Dataiker
Dataiker

@Darius679 

Good questions! 

One way to accomplish what you want is then to: 

  1. Create an Insight in a Notebook 
  2. Save the Insight 
  3. Publish insight to Dashboard 
  4. Create scenario > Export notebook step > Check “execute notebook” 

Then add the Run Scenario and Download Dashboard tiles to your App. 

More information: 

What is an Insight? It is code that creates a static asset on the Dashboard.  - https://doc.dataiku.com/dss/latest/python-api/static_insights.html 

The "Create Notebook export" in a Scenario step is explained here - https://doc.dataiku.com/dss/latest/scenarios/steps.html - you may need to go to "Code Envs" in the Admin menu and ensure that your code environment has "Build for all Spark on k8s configs" selected. 

Let me know if you have follow up questions. 

Emma

0 Kudos
Darius679
Level 2
Author

Thanks @Emma . I did exactly what you said, here with a little more detail for people like me in the future.

  1. Make your notebook and go to actions in the top right, publish, and choose your dashboard. As Emma says, code environment must have "Build for all Spark on k8s configs" selected or it won't work.
  2. Create scenario > export note book > check 'execute notebook'

I made a toy notebook that prints a random integer, and whenever I manually run the scenario the integer updates. Woohoo!

I still have an issue that might have to do with my file system and not the question above though. If I make an upload file tile, it points to a data set in my flow, but when I build the test instance of my app the tile says 'file not found' and garbles the name of the file with the name of my project. Here's pictures of the upload file tile and what I see in the test instance.  I also made a 'view dashboard' tile and get a 'dashboard doesn't exist' error when I click view dashboard in the test instance. 

Also when I hit run scenario in the test instance and manually go to the  correct dashboard, nothing is there.

Any idea how I can fix this strange error? Thanks for all the help!