This chapter explores recipes in DataChat using the "Titanic Dataset". For this example, we'll perform an analysis on ticket fares.
To begin, let's open a new session:
- Open DataChat and from the homepage, launch a new session.
- Load the "Titanic Dataset" CSV file into our session.
Wrangle and Plot
Let's clean our data by removing unneeded columns. Click Column > Drop from the sidebar and select "PassengerId" and "Ticket".
The new dataset titanic v2 appears in the dataset panel, and doesn't include the dropped columns.
Let's compute the average ticket cost based on a passenger's class. Click Dataset > Compute in the sidebar and select "average" for the aggregate, "Fare" for the column, "AvFare" for the new column name, and "Pclass" for columns to group by. Click Submit.
When we use the
Computeskill on a dataset, DataChat appends the original dataset name with "_Compute". The new dataset, "titanic_Compute v1", contains the computed values and appears in the dataset panel.
Let's make the current dataset "titanic v2", by clicking on it in the dataset panel.
Let's create a chart to compare "Age" and "Fare". Click Plot in the sidebar to open the Chart Builder. Select "Bar Chart" for the chart type, "Age" for the x-axis, and "Fare" for the y-axis.
The bar chart is created and appears under the visualization panel.
Save Session as a Recipe
Let's save this session as a recipe. Click Save in the sidebar, select Recipe, enter the recipe name "Titanic_Fare_Analysis", and select Yes to overwrite any existing recipes with the same name. Click Submit.
The recipe is displayed as an interactive flow chart that displays the steps required for the plot.
Click the X in the top-right corner to return to the session and then return to the homepage by clicking the DataChat logo in the top left corner.
The unnamed session and the recipe appear in the Recent section. We can also click Recipes in the sidebar to see all of our recipes.
Edit a Recipe
Let's edit our recipe. Select "Titanic_Fare_Analysis", then click the Edit Recipe button from the menu to open the Recipe Editor.
The Editor shows each step used within your session, with exception of a few, and allows you to add, remove, or edit your steps.
Let's add an additional computation to show the number of records where Fare is greater than $75. From the Editor, we'll click on the third line,
Compute the average Fare for each Pclass and call the computed columns AvFare, then click Enter to create a new line beneath it. Then, we can enter
Compute the count of records where Fare is greater than 75.
The edited recipe needs to be tested to ensure it's valid. Click Restart > Continuous in the sidebar. The entire recipe is run, and the results of each step appear in the Recipe Editor replay panel.
The green check to the left of the recipe name indicates that the edited recipe replayed successfully.
Share a Recipe
Now that we've edited the recipe, let's share it with another user in our organization. From the homepage, right-click on the recipe "Titanic_Fare_Analysis" in the Recent section and click Share to open the Share form. Enter the name of a user in your organization, select whether the user should be a Viewer or an Editor, and click Save.
Schedule a Recipe to Replay
Let's schedule this recipe to replay on the "titanic" dataset each Monday morning. We can do this by returning to the homepage, then opening our original session.
From here, we can open the GEL input field in the lower right corner and enter:
Schedule the recipe replay for Titanic_Fare_Analysis on Mondays at 8:00 EST
Now, every Monday at 8:00 EST, the recipe
Titanic_Fare_Analysis will automatically replay.
If we want to stop replaying the recipe every Monday we can use the
Delete skill by entering:
Delete the scheduled recipe replay for Titanic_Fare_Analysis on Mondays at 8:00 EST