> 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/reference/resources/codesystems/custom-code-systems/authoring.md).

# Authoring

The authoring process of Custom Code Systems can flow on two different levels: [schema](#schema) and [concept](#concept).

## Schema

New property definitions can be added to the Code System on the ***Schema*** tab, after clicking on the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/0U01jyRzGP8O6KWdDqSO/add_property_icon.svg" alt="" data-size="line"> button in the middle area.

![Add New Property Type](https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/ugUAROXiybTXUyrOu7LG/code_system_schema_add_property.gif)

The following attributes can be specified for a property definition:

| Attribute         | Description                                                                                                          |
| ----------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Name**          | Unique name of the property (mandatory)                                                                              |
| **Type**          | [Type ](/snowray/reference/resources/codesystems/custom-code-systems.md#schema)of the property (mandatory)           |
| **Cardinality**   | Defines the [number of elements](/snowray/reference/resources/codesystems/custom-code-systems.md#schema) (mandatory) |
| **Default value** | Initial value of the property                                                                                        |
| **Description**   | Captures the purpose of the property                                                                                 |

{% hint style="info" %}
Once you added a property definition you can customize it by clicking in the text fields and entering an attribute value, or selecting one from the drop-down.
{% endhint %}

Changes to the property definition can be persisted by clicking the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/s4wJjAo1p7PHLbgskqwW/commit_change_icon.svg" alt="" data-size="line"> button.

{% hint style="info" %}
Different property types are indicated with different colors and icons.
{% endhint %}

Existing property definitions can be edited after clicking the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/TKODr0bzFMpwHl2U75uE/edit_icon.svg" alt="" data-size="line">button.&#x20;

## Concept

{% hint style="info" %}
To enter editing mode and access functionalities related to authoring, click on the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/YL5TiFQCv7fGMb6a814g/edit_button.png" alt="" data-size="line"> button in the upper right corner of the selected Code System's content page.
{% endhint %}

New concepts can be added to the Code System on the ***Content*** tab, after clicking on the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/wJxDCJ6PwHMRzo6e68m4/add_concept_button.png" alt="" data-size="line">button.

<img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/hLJOHi0rAO0onbBmZ5OG/create_concept_wizard.png" alt="Create Code System Concept Wizard" width="375">

{% hint style="info" %}
The concept selected in the tree at the time of creation will be considered the parent concept. If no concept is selected, the new concept will be placed in the root of the Code System, i.e. not under another concept. The selected parent can be modified either in the creation wizard or even after creation, through [reparenting](#concept-reparenting).
{% endhint %}

<table data-full-width="false"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Term</strong></td><td>The name of the new concept (mandatory)</td></tr><tr><td><strong>Code</strong></td><td>The identifier of the new concept. If you leave this field empty, the system will automatically generate an ID for your Concept</td></tr><tr><td><strong>Parent</strong></td><td>The concept under which the new concept will be created<br><em><strong>Note</strong></em>: Additional parent properties can be defined after the concept is created</td></tr></tbody></table>

After pressing the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/YOwddn8uObO6jT8YBtwj/create_button.png" alt="" data-size="line"> button, the new concept will be added to the Code System tree and its editor will automatically open on the right side.

By default, the term defined during creation becomes the preferred term of the concept.

Additional descriptions can be specified using the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/9CQf8xte7VkhcRHLOyP3/new_description_button.png" alt="" data-size="line"> button.

{% hint style="info" %}
You can also change the description type, and even add descriptions in other languages.
{% endhint %}

{% hint style="info" %}
If you specify a new preferred term for a concept in a given language, the existing one will be switched to a synonym.
{% endhint %}

## Properties

New properties conforming to the schema can be added using the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/0qzOtmfiKL1nKcrbqKYf/new_property_button.png" alt="" data-size="line"> button.

<figure><img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/S0iGiThPKEePEMpdqNm9/code_system_new_property_wizard.png" alt="" width="375"><figcaption><p>New Code System Property Wizard</p></figcaption></figure>

{% hint style="info" %}
If you specify a default value in the Schema, the property will automatically be populated with it in the wizard.
{% endhint %}

{% hint style="warning" %}
If you restrict the potential number of values of a property, e.g. to`1..1`, it will be greyed out in the dropdown in case the cardinality is already reached.
{% endhint %}

## Concept reparenting

The parent of a concept is specified during concept creation but it is also possible to modify the parent concept after the creation process.

{% hint style="info" %}
Being mandatory for all concepts, the parent of a concept is considered a special property that is not maintained in the schema.
{% endhint %}

Clicking in the value field of the parent property offers a drop-down with the available concepts of the given Code System.

{% hint style="info" %}
You can either browse the drop-down list or start typing in the value field to restrict the results, and then select the new parent.
{% endhint %}

Once the changes are accepted, the tree is updated and the concept is relocated under the new parent's node.

<figure><img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/bfYNcwpZVW6rpxhGYFJb/code_system_reparent.gif" alt=""><figcaption><p>Code System Concept Reparenting</p></figcaption></figure>

{% hint style="info" %}
It is also possible to define multiple parents for a concept, enabling the creation of more complex hierarchies.
{% endhint %}

## Issues

Users can create issues related to specific Code System concepts using the <img src="https://content.gitbook.com/content/qCGAqlIn2vgCXJQadBh7/blobs/psIRIAk21n8kmuTHaUC8/raise_an_issue_icon.svg" alt="" data-size="line"> button, while existing issues can be viewed in the ***Issues*** tab.

{% hint style="info" %}
Want to find out more about issues? Visit the [Issue management](/snowray/reference/issue-management.md) page for more information.
{% endhint %}
