---
title: "Model execution with dashboard output"
canonical: "https://onesaitplatform.refined.site/space/DOCT/2220806189/Model%20execution%20with%20dashboard%20output"
format: markdown
---
Notebook  execution can output to some dashboard with a little configuration. This dashboard is the same for any execution but it has “id_ejec” param in order to show data of one particular execution output of the output of the model saved in some ontology.

The first step is to create a notebook with an input identifier per execution that can receive this id_ejec param. For this example, we are going to develop a simple notebook with two parameter, focus on understand the id_ejec parameter:

- id_ejec → mandatory param with identification and ontology output writting. The model service autogenerates this parameter so we only need to use it.
- data → array of json with two fields: name (string) and value (number).

![image](media://c5ef9dd9-b10f-4426-85bd-f85cfaccabd7)

We need an output ontology that connect the output of the notebook with input of the dashboard so we need to create a new ontology with the id_ejec field for execution identification:

![image](media://8dcdbdcf-555e-47ba-8aed-59dccabc3b45)

That ontology will be the data output of the notebook so we create a client for this ontology and start writing the new notebook.

First, we create the input paragraph:

|  |
| --- |
| ```
%python
id_ejec = z.input("id_ejec");
data = z.input("params");
``` |

Second we transform our new data, appending the id_ejec field with the same structure of the ontology instance:

|  |
| --- |
| ```
%python
import json
jsondata = json.loads(json.loads(data)["data"])
arrayoutput = []
for inst in jsondata:
    inst["id_ejec"] = id_ejec
    arrayoutput.append({"dashboardOutput": inst})
data_id_ejec = json.dumps(arrayoutput)
print data_id_ejec
z.z.put("insert",data_id_ejec)
``` |

![image](media://fe9be03d-76d2-440b-a137-ed30deee104b)

Then we only need to initiate the connection and insert the generated data into the ontology.

```
%onesaitplatform
initConnection("client","tokenid")
```

```
%onesaitplatform
insert("dashboardOutput",z.get("insert"))
```

![image](media://12f049b7-2946-4876-baec-9906e0da109b)

The second step is to create the dashboard using this ontology and using this id_ejec like a parameter. So we create a simple pie using data for this id_ejec.

We drag the icon of pie gadget and drop it over the canvas.

![image](media://8f86690a-36c9-4352-bb14-0add2bb427aa)

We select “New Gadget”.

![image](media://d0468cc6-19ed-47f5-8166-b80addf041fc)

We type all the info: a name, the ontology we created before and the query.

![image](media://68a5763e-53c5-4524-8ee7-3b855a36cf20)

Now it’s neccesary to use name as X Axis and value as Y Axis and click in new to create it.

![image](media://06392767-666b-4fb7-8f17-efe7cbbf1811)


With this gadget we can add the new special “id_ejec“ param and link it to this gadget to the same field. So we go to the params menu and we add it.

![image](media://3186a727-28b5-48c4-abea-c2ae1aba7bcf)

![image](media://bc13d534-df1b-4d2b-a6cc-5eab1e49f379)

![image](media://54be9b68-03c5-466a-9fc2-d5b96d8a7ee7)

Finally we save our new dashboard.

![image](media://06bb5a42-462a-4f81-8332-c366909ae5e0)

If we open this dashboard and add the query param “id_ejec“ to the url, we can filter this dashboard with it, showing the gadget for one execution.

After all this, we can create our new model linked with the dashboard. We set a name and a description, and we select our notebook and the first paragraph (the input paragraph).

We need to add the data parameter. For this, id_ejec is implicit.

![image](media://c8c01acf-fade-440d-8e5b-43204822d90f)

On the output source we need to select our dashboard and that’s all.

![image](media://e4c1a497-1c88-4487-a3d4-393703b185a0)

We can execute this model with the API for it and when the execution is finished we can go to the dashboard with the id_ejec parameter (output of execution) as query param and see all the data for that execution.

![image](media://5e85d890-0fd4-4deb-8d42-379bd5b9e28c)

![image](media://2240fedb-0ea1-4f23-a768-1f89a287d40f)

![image](media://044d607f-36f4-4726-bea8-61409d9e59a5)