> 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/v3.0/reference/resources/valuesets/authoring.md).

# Authoring

{% hint style="info" %}
To enter editing mode and access functionalities related to authoring, click on the![](https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/ZCeraGm0DKHGlK9U36bP/edit_button.png) 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://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/5hVDhOQ9SNiHNF9kKixy/value_set_add_new_clause.gif)

{% 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 as contextual information (light gray).
{% endhint %}

{% hint style="info" %}
If you select a concept from the terminology tree, the clause that involves the concept will be highlighted in the clause list.
{% endhint %}

![Highlight Clauses](https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/ybU1bVAbqz1aYAJPio1I/value_set_highlight_clauses.gif)

For more information about the different ways to add clauses to a Value Set, visit the following pages:

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

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

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

{% content-ref url="/pages/-MiVgFdm5songIp0ykd\_" %}
[Import clauses from text file](/snowray/v3.0/reference/resources/valuesets/authoring/import.md)
{% endcontent-ref %}

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

{% content-ref url="/pages/-MiW\_4LxOgXb-GawJKg-" %}
[Merge](/snowray/v3.0/reference/resources/valuesets/authoring/merge.md)
{% endcontent-ref %}

## Edit Clause

Hovering over an existing clause reveals the <img src="https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/Z0fE64LR1wKxCzRYSGWg/edit_icon.svg" alt="" data-size="line"> icon, which enables editing the selected clause. Changes can be persisted by clicking on the <img src="https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/IGLbNHgxmEUqpGFKcWIN/green_checkmark_icon.svg" alt="" data-size="line"> sign.

![Edit a Value Set Clause](https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/ksoMlomuJaTeV33alQPj/value_set_edit_clause.gif)

{% hint style="info" %}
Hovering over a clause also reveals the <img src="https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/lLZGiiJ7BWty7ccTp3U9/pin_icon.svg" alt="" data-size="line"> icon, which enables pinning the selected clause to the top of the list.&#x20;
{% endhint %}

For more information about additional editing actions, visit the following pages:

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

{% content-ref url="/pages/VaE5xVe1kGNruXue7CLI" %}
[ECL syntax error](/snowray/v3.0/reference/resources/valuesets/authoring/ecl-syntax-error.md)
{% endcontent-ref %}

{% content-ref url="/pages/sLrczPW0XXyZQJGrkH4N" %}
[Inactive content](/snowray/v3.0/reference/resources/valuesets/authoring/inactive-content.md)
{% endcontent-ref %}

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

## 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/v3.0/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/v3.0/reference/resources/valuesets.md#editing). Press the ![](https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/eU3dJl2CnNlkt00GkfjD/actions_button.png) button in the upper right corner and select the *Optimize* context menu option.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/phIwDNAYNCUcoCoc92q8/value_set_optimize.png" alt=""><figcaption><p>Value Set Optimize Plan</p></figcaption></figure>

{% hint style="info" %}
To confirm the proposed plan, press the <img src="https://content.gitbook.com/content/ckoNppM37m1A9KBre9xY/blobs/SciksRtW02KWl0bSPZP9/accept_button.png" alt="" data-size="original"> button.
{% endhint %}
