


image::https://specifications.openehr.org/images/openEHR_logo_RGB.svg["openEHR logo",align="center"]

# Task Planning Visual Modelling Language (TP-VML)



## Acknowledgements

### Primary Author

* Thomas Beale, Ars Semantica (UK); openEHR Foundation Management Board.

### Contributors

This specification benefited from formal and informal input from the openEHR and wider health informatics community. The openEHR Foundation would like to recognise the following people for their contributions.

* Borut Fabjan, Program Manager, Marand, Slovenia
* Matija Kejžar, Marand, Slovenia
* Eugeny Leonov, Solit Clouds, Moscow, Russia
* Bjørn Næss, DIPS, Norway

### Support

The work reported in this specification has been funded by the following organisations:

* City of Moscow, Russia
* DIPS, Norway
* Marand d.o.o., Slovenia
* Ars Semantica, UK

### Trademarks

* 'openEHR' is a trademark of the openEHR Foundation.
* 'OMG' is a trademark of the Object Management Group.


# Preface

## Purpose

This document describes a visual modelling language for the openEHR Task Planning Model, known as TP-VML. This is designed to enable visually efficient visual representations of Task Plans to be authored with appropriately configured tools.

The intended audience includes:

* Task Plan and workflow authors;
* Tool vendors.

## Related Documents

Prerequisite documents for reading this document include:

* The {openehr_task_planning}[openEHR Task Planning Model^];

## Status

This specification is in the PAUSED state.

Known omissions or questions are indicated in the text with a 'to be determined' paragraph, as follows:
*TBD*: (example To Be Determined paragraph)

## Feedback

Feedback may be provided on the https://discourse.openehr.org/c/specifications/task-planning-gdl[process specifications forum^].

Issues may be raised on the https://specifications.openehr.org/components/{component}/open_issues[specifications Problem Report tracker^].

To see changes made due to previously reported issues, see the https://specifications.openehr.org/components/{component}/history[{component} component Change Request tracker^].

## Conformance

Conformance of a data or software artifact to an openEHR Reference Model specification is determined by a formal test of that artifact against the relevant openEHR Implementation Technology Specification(s) (ITSs), such as an IDL interface or an XML-schema. Since ITSs are formal, automated derivations from the Reference Model, ITS conformance indicates RM conformance.


# Overview

## Draw.io Tool mode

The following files can be downloaded and then imported into draw.io as libraries to provide a working palette for TP-VML diagrams.

* [TP_VML plans]({doc_name}/draw.io-lib/TP_VML_plans.xml)
* [TP_VML groups]({doc_name}/draw.io-lib/TP_VML_groups.xml)
* [TP_VML tasks]({doc_name}/draw.io-lib/TP_VML_tasks.xml)
* [TP_VML events]({doc_name}/draw.io-lib/TP_VML_events.xml)

# Elements

The elements of TP-VML are based directly on the openEHR Task Planning formal specification, and can be used to construct exectuable Plans.

## Composites

The TP-VML elements in this section are composite structures that contain primitive elements.

### Plans

TP-VML icons for `WORK_PLAN` and `TASK_PLAN` are used ({openehr_task_planning}#_plan_structure[TP plan structure^]), enabling some of the relevant meta-data to be visualised.

.Plans
image::{doc_name}/diagrams/TP-VML-plans.svg[id=tp_vml_plans, align="center"]

### Task Groups

Task Group icons and their conditional structure derivatives use two visual elements to indicate the extent of the ({openehr_task_planning}#_task_group_structure[container structure^]) they represent from the TP model.

Since Tasks and other Task Groups within any Task Group are included by ordered containment (i.e. 'list' semantics) rather than chaining, contained items are shown connected with dashed arrows, indicating the implied ordered.

.Task groups
image::{doc_name}/diagrams/TP-VML-task_groups.svg[id=tp_vml_task_groups, align="center"]

### Conditional Structures

{openehr_tp_vml}#_conditional_structures_2[TP conditional structures] follow the same structural logic as Task Groups, with the addition of various specific meta-data as per the specificaion.

.Conditional structures - CONDITION_GROUP
image::{doc_name}/diagrams/TP-VML-conditionals_condition.svg[id=tp_vml_conditionals_condition, align="center"]

.Conditional structures - DECISION_GROUP
image::{doc_name}/diagrams/TP-VML-conditionals_decision.svg[id=tp_vml_conditionals_decision, align="center"]

.Conditional structures - EVENT_GROUP
image::{doc_name}/diagrams/TP-VML-conditionals_event.svg[id=tp_vml_conditionals_event, align="center"]

## Primitives

The TP-VML elements in this section are atomic primitives that are used within various levels of containment structure, including Task Groups, the various kinds of conditional structure, Task Plans and Work Plans.

### Tasks

TP-VML Tasks correspond to formal types of the form `TASK<T>` ({openehr_task_planning}#_definition_model[TP main model^]; {openehr_task_planning}#_task_actions[TP Task Action types^]), whose concrete forms are: `PERFORMABLE_TASK<DEFINED_ACTION>`, `PERFORMABLE_TASK<SUB_PLAN>`, `DISPATCHABLE_TASK<HAND_OFF>`, `DISPATCHABLE_TASK<SYSTEM_REQUEST>`, `DISPATCHABLE_TASK<EXTERNAL_REQUEST>`.

Performable Tasks may have one or more associated `_capture_datasets_`. Dispatchable Tasks may have an associated callback wait state (`CALLBACK_WAIT`).

.Tasks
image::{doc_name}/diagrams/TP-VML-tasks.svg[id=tp_vml_tasks, align="center"]

### Task Repeats

A Task, or more usually a Task Group may have a repeat specification (`TASK_REPEAT`) associted with it ({openehr_task_planning}#_repetition[TP Repetitions^]). Various forms are possible. This is diagrammed as follows.

.Task (group) repeat
image::{doc_name}/diagrams/TP-VML-task_repeat.svg[id=tp_vml_task_repeat, align="center"]

### Events

TP-VML Events are defined in the {openehr_tp_vml}#_events[Events section in the TP specification] and can be visually represented in three forms:

* _full form_: with icon and named attributes from the TP model;
* _short form_: with icon and implicit attributes from the TP model;
* _informal_: via an icon, with no further specification of details.

Events are specified as triggers for the wait states `TASK_WAIT`, `TIMER_WAIT` and `CALLBACK_WAIT`.

.Events
image::{doc_name}/diagrams/TP-VML-events.svg[id=tp_vml_events, align="center"]

# Patterns

## Synchronisation of Parallel Paths

The following example shows two parallel activity paths, where the completion of one (lab results arriving) causes the termination of the other (medication).

.Parallel synchronisation
image::{doc_name}/diagrams/EX-parallel_sync.svg[id=parallel_sync, align="center"]


:sectnums!:
