15 Building a template
15.1 What is a template?
A template is a reusable Tercen workflow. It is typically developed when you want to quickly reuse a data analysis workflow with a new dataset.
15.2 General development workflow
The recommended test-driven development workflow is as follows:
Initialise a GitHub repository for your workflow based on a template provided by Tercen
Clone this GitHub repository to your Tercen development instance
Load a minimal dataset that will serve the purpose of unit testing. Be mindful that this dataset and everything that is computed by the workflow will be stored in your repository, hence they should remain small.
Develop your workflow on your example dataset.
Prepare the workflow template.
Push your changes and deploy.
15.3 Detailed workflow
1. Create the Template Repo
Create a new project based on the template repository.
2. Import the repository into Tercen
Create a new project from Github.
3. Create the Template Workflow
Create a standard Tercen workflow. Run the steps as needed.
A finalized workflow might look like the one below.
4. Clone and Rename
Clone the workflow to create the golden standard. Rename it with an unique **_gs** suffix (see naming convention).
Naming Conventions
A Template workflow is compared to its Golden Standard workflows based on a naming convention.
A workflow is considered a Golden Standard if its name ends with **_gs**, where is a set of letter and numbers. For example, Template_gs1, Template_gsA01 and Template_gsAA are all valid Golden Standard names, whereas Template_gs_01 is not.
A Template and a Golden Standard are considered match if they have the same base name, that is, everything before the _gs suffix. For example, Workflow, Workflow_gs01 and Workflow_gs02 refer to a template (Workflow) and its two Golden Standards.
Once cloned, both Template and Golden Standard will be in the same folder. We want to move the Golden Standard workflow to a folder named workflow_tests. To do so, rename the Golden Standard, adding workflow_tests/ before the name and pressing the Ok button.
5. Reset the Template Workflow
Open the Template Workflow (the one without the _gs** suffix), reset and save it.
6. Select which elements to publish
You should now have at least two workflows as part of your project: the template and the gold standard. As we do not want the gold standard to be published in the library, you should make sure the “Publish” check box is unchecked for this workflow.
7. Commit the Changes to Github
Finally, select the Git button.
Then, add any desired commit message, your personal Github token and press Ok.
15.4 Template installation
A template is installed like any Tercen module (operators, apps, templates). Check the Operator Installation Chapter to learn how to proceed.