{
"cells": [
{
"cell_type": "markdown",
"id": "094757fb-c86b-4581-8510-d1bb7b4408db",
"metadata": {},
"source": [
"## Making a CHADA/MODA workflow diagram with plantuml and mochada_kit"
]
},
{
"cell_type": "markdown",
"id": "3e03d06f-946f-46ff-8f99-0cf69b80d1ec",
"metadata": {},
"source": [
"This example shows how to make a CHADA and/or MODA workflow diagram using [plantuml](https://plantuml.com/) and `mochada_kit`."
]
},
{
"cell_type": "markdown",
"id": "70e0d976-8a8e-4218-9d2c-d6fce35996bb",
"metadata": {},
"source": [
"#### 1. Basic plantuml activity diagrams"
]
},
{
"cell_type": "markdown",
"id": "1ee1b1e5-30ac-44cb-9da2-c99e28cc73b5",
"metadata": {},
"source": [
"CHADA/MODA workflow diagrams are made using [plantuml activity diagrams](https://plantuml.com/activity-diagram-beta). The basic syntax is as follows: we start with a `@startuml` and then have one or more activity elements, whose name is defined between a colon and a semicolon: `:name;`. If there is more than one activity element, they will be joined using a vertical arrow running from top to bottom. The code ends with `@enduml`."
]
},
{
"cell_type": "markdown",
"id": "8af8d284-4238-4663-a311-c327cf0a99cc",
"metadata": {},
"source": [
"For example, this code:\n",
"\n",
"```java\n",
"@startuml\n",
":activity 1;\n",
":activity 2;\n",
"@enduml\n",
"```\n",
"\n",
"would result in a diagram where the element called `activity 1` is at the top and is joined to the other element, called `activity 2`, by a vertical arrow."
]
},
{
"cell_type": "markdown",
"id": "366c6e6a-6778-4829-9001-f65f2b1f4513",
"metadata": {},
"source": [
"
\n",
"\n",
"#### 2. Applying a theme"
]
},
{
"cell_type": "markdown",
"id": "750dcb25-8b98-47d8-88a2-c7b20f671fa2",
"metadata": {},
"source": [
"The code above would result in a diagram in which all the text and lines are black and all areas are white. \n",
"\n",
"Using a theme helps us to\n",
"\n",
"- apply parameters to the entire diagram\n",
"- apply different styles to different elements.\n",
"\n",
"More information on themes in general is provided [here](https://plantuml.com/theme)\n",
"\n",
"In `mochada_kit` bespoke themes for CHADA and MODA diagrams have been developed and are located in the directory `mochada_kit/themes`. To apply a theme to a plantuml diagram we need to add a line to the code above giving the name of the theme to be applied and the location of the folder where the themes reside. For example, to apply the theme `MOCHADA-CWA`, we write:\n",
"\n",
"```java\n",
"@startuml\n",
"!theme MOCHADA-CWA from ../../themes\n",
":activity 1;\n",
":activity 2;\n",
"@enduml\n",
"```\n",
"\n",
"If you look in `mochada_kit/themes`, you will see that all the themes have this naming convention `puml-theme-*.puml`, where the * represents the name of the theme. In the line of code starting with `!theme` we only need the part of the theme name given by the * (without the starting `puml-theme-`and ending `.puml`). We then need to write `from` and give the location of the themes folder. If we want to store the plantuml code in `mochada_kit/gallery/puml_code` the relative location of the `mochada_kit/themes` folder is `../../themes`. "
]
},
{
"cell_type": "markdown",
"id": "fc1f917f-626c-430a-9e80-d4220b89d929",
"metadata": {},
"source": [
"