Generating charts in a notebook for the wiki
![Darius679](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar7.png)
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?
Answers
-
Emma Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 52 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-notebook-insight
Then, from within the Application Designer you add the Tile > Download Dashboard (see screenshot).
Hope that helps,
Emma
-
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?
-
Emma Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 52 Dataiker
Good questions!
One way to accomplish what you want is then to:
- Create an Insight in a Notebook
- Save the Insight
- Publish insight to Dashboard
- 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
-
Thanks @Emma
. I did exactly what you said, here with a little more detail for people like me in the future.- 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.
- 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!