> For the complete documentation index, see [llms.txt](https://docs.b2ihealthcare.com/snowray/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.b2ihealthcare.com/snowray/v2.9/reference/resources/valuesets/authoring.md).

# Authoring

{% hint style="info" %}
To enter editing mode and access functionalities related to authoring, click on the![](https://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2F2wHhA9q77dE3osbwR9nc%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://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2FySgpyLlqDuaxXUTpDjNy%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://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2FTxqKlfQGDt9j50dSiqdR%2Fvalue_set_highlight_clauses.gif?alt=media\&token=c3693878-c8bd-4bb9-9afa-d5ae60a03eee)

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

{% content-ref url="/pages/-MgLfhQklrGXDUBU-004" %}
[Drag and Drop](/snowray/v2.9/reference/resources/valuesets/authoring/dnd.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MgLcrL7T31wDCvCbEiN" %}
[Basic Clause Editor](/snowray/v2.9/reference/resources/valuesets/authoring/editor.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MgLd0nRrl6iBdiA5LTA" %}
[Paste from clipboard](/snowray/v2.9/reference/resources/valuesets/authoring/copypaste.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MiVgFdm5songIp0ykd\_" %}
[Import Simple Type Reference Set](/snowray/v2.9/reference/resources/valuesets/authoring/import.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MgLdC16HOL6LocZ896N" %}
[Advanced Clause Editor](/snowray/v2.9/reference/resources/valuesets/authoring/advancededitor.md)
{% endcontent-ref %}

{% content-ref url="/pages/eYtjBuzCQD8gopcNqyz4" %}
[Update Operators](/snowray/v2.9/reference/resources/valuesets/authoring/update-operators.md)
{% endcontent-ref %}

{% content-ref url="/pages/FZjnRUrcuCZpD9Az6lmc" %}
[Revert](/snowray/v2.9/reference/resources/valuesets/authoring/revert.md)
{% endcontent-ref %}

## Edit Clause

Hovering over an existing clause reveals the <img src="https://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2FBxKjrKQLjJC659ChEXpj%2Fedit_icon.svg?alt=media&amp;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://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2FSqV7bMLQXkZ1fLUUtmFI%2Fgreen_checkmark_icon.svg?alt=media&amp;token=329f3138-2ddc-4fdb-8ce1-339fe6cb8a6c" alt="" data-size="line"> sign.

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

{% hint style="info" %}
Hovering over a clause also reveals the <img src="https://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2F2G5wFeqnxqJowL9gZGaE%2Fpin_icon.svg?alt=media&amp;token=eb5c6ed5-f15d-43c7-930f-64c6b0cefe6d" alt="" data-size="line"> icon, which enables pinning the selected clause to the top of the list.&#x20;
{% endhint %}

## 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](/snowray/v2.9/reference/resources/codesystems.md#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](/snowray/v2.9/reference/resources/valuesets.md#editing). Press the ![](https://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2F47Eju6SR5jR2SCgjTrrF%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://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2FZ8LnywKOCej8r6kZSbBH%2Fvalue_set_optimize.png?alt=media&amp;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://848337088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNfVt73uJmV35VTVsq2mk%2Fuploads%2FEWX3OYoL2Ww2T0Be5wFk%2Faccept_button.png?alt=media&amp;token=0d2ceed2-5034-4daf-8b7f-7bfcfbcd8575" alt="" data-size="original"> button.
{% endhint %}
