# Authoring

{% hint style="info" %}
To enter editing mode and access functionalities related to authoring, click on the![](https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FihjwFKFMU4MOfnBGIl1M%2Fedit_button.png?alt=media) button in the upper right corner of the selected Value Set's content page.
{% endhint %}

## Add a New Clause

New clauses can be added by constructing a query expression supported by the domain Code System after clicking on the area surrounded by an intermittent line under the *Inclusions* and *Exclusions* sections.

{% hint style="info" %}
Most of the terminologies support Expression Constraint Language to a certain extent, e.g. selecting a hierarchy via < or << or filter by attribute refinements. If such support is not available for the given Code System, then single ID inclusions/exclusions can be created forming an extensional Value Set at the end.
{% endhint %}

![Create a New Clause](https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FWVowr8FfmC3XgC9uVTlR%2Fvalue_set_add_new_clause.gif?alt=media\&token=15a815b0-0742-4237-b6b7-0f551504cb17)

{% hint style="info" %}
While authoring, clauses highlight parts of the hierarchy with colors. These help identify which part of the hierarchy is included (green and/or normal gray), excluded (red), suggested (purple), or just displayed (light gray) for contextual information.

If selecting a concept from the terminology tree the clause that involves the concept will be highlighted.
{% endhint %}

![Highlight Clauses](https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FQetVr0GBzRlWQjMapEfv%2Fvalue_set_highlight_clauses.gif?alt=media\&token=07f53d26-0ed7-42e2-9e0c-2538b8eaeba3)

There are different ways to add clauses to a Value Set. For more information visit the following pages:

{% content-ref url="authoring/dnd" %}
[dnd](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/dnd)
{% endcontent-ref %}

{% content-ref url="authoring/editor" %}
[editor](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/editor)
{% endcontent-ref %}

{% content-ref url="authoring/copypaste" %}
[copypaste](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/copypaste)
{% endcontent-ref %}

{% content-ref url="authoring/import" %}
[import](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/import)
{% endcontent-ref %}

{% content-ref url="authoring/advancededitor" %}
[advancededitor](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/advancededitor)
{% endcontent-ref %}

{% content-ref url="authoring/update-operators" %}
[update-operators](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/update-operators)
{% endcontent-ref %}

{% content-ref url="authoring/revert" %}
[revert](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/authoring/revert)
{% endcontent-ref %}

## Edit Clause

Hovering over an existing clause reveals the <img src="https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FouKgZjN3P1fgP13Wmi1C%2Fedit_icon.svg?alt=media&#x26;token=f9740489-fa8f-4c5a-8854-e15389311a7b" alt="" data-size="line"> icon, which enables editing the selected clause. Changes can be persisted by clicking on the <img src="https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2F0wHHleebPKm4ZFFDCPve%2Fgreen_checkmark_icon.svg?alt=media&#x26;token=329f3138-2ddc-4fdb-8ce1-339fe6cb8a6c" alt="" data-size="line"> sign.

![Edit a Value Set Clause](https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FyxoYTRg5SDc0gesbfXkm%2Fvalue_set_edit_clause.gif?alt=media\&token=8639cd35-60f2-4edd-b612-493aafb730a0)

## Optimize

As part of the authoring process, users also have the option to optimize their Value Sets. This feature simplifies Value Sets by replacing individual members with [ECL ](https://confluence.ihtsdotools.org/display/DOCECL)expressions. For example, if all the children of a [concept](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/codesystems#concepts) are added, it will reduce the clauses to a single clause using the following format: `< parentId | FSN |`.

{% hint style="info" %}
To use this option, navigate to the specific Value Set and start [editing](https://docs.b2ihealthcare.com/snowray/v2.7-1/reference/resources/valuesets/..#editing). Press the ![](https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FDJzyZ81oZiYv25FzSo7Y%2Factions_button.png?alt=media\&token=701561e3-1b9c-44d2-a960-99e9d2ad23f0) button in the upper right corner and select the *Optimize* context menu option.
{% endhint %}

<figure><img src="https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FhrSz1Xd9cLgonWDfGRHU%2Fvalue_set_optimize.png?alt=media&#x26;token=4ef6416d-0358-4285-b4fd-7a629229d434" alt=""><figcaption><p>Value Set Optimize Plan</p></figcaption></figure>

{% hint style="info" %}
To confirm the proposed plan, press the <img src="https://3018946113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9Z6LrS9GBAMjvmJDmoPN%2Fuploads%2FOEjFewvPTSiK3Xeu8sid%2Faccept_button.png?alt=media&#x26;token=0d2ceed2-5034-4daf-8b7f-7bfcfbcd8575" alt="" data-size="original"> button.
{% endhint %}
