# 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/ecIrdZnsDkSPypTQNKj0/blobs/mE6IB2X03JBNtajQ84xB/add_property_icon.svg" alt="" data-size="line"> button in the middle area.

![Add New Property Type](https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/pbWB1WsB09f6lP1CCg4e/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 ](https://docs.b2ihealthcare.com/snowray/v3.2/reference/resources/codesystems/custom-code-systems/..#schema)of the property (mandatory)           |
| **Cardinality**   | Defines the [number of elements](https://docs.b2ihealthcare.com/snowray/v3.2/reference/resources/codesystems/custom-code-systems/..#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 can be persisted by clicking the <img src="https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/lz1DoSKnYIVKDm4D7TFB/commit_change_icon.svg" alt="" data-size="line"> button.

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

Existing properties can be edited after clicking the <img src="https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/lbHM41psKbrn8zmg5kyX/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![](https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/et7oaZ64v53265LLSVjD/edit_button.png) 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 ![](https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/lZw2XGsKxw3KqRdZNNK7/add_concept_button.png)button.

![Create Code System Concept Wizard](https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/obXNOmWtYuCVu3iGLxB2/create_concept_wizard.png)

{% 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</td></tr></tbody></table>

After pressing the ![](https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/B1bS65w0OM0F3BQKgihC/create_button.png)button, the new concept will be added to the Code System tree and its editor will automatically open on the right side.

The preferred term of the concept - by default, the one defined during creation -  is indicated with an <img src="https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/0WeVYbdVuZZ7KPK7Qagk/preferred_term_icon.svg" alt="" data-size="line">icon.&#x20;

{% hint style="info" %}
You can specify alternative terms for a concept, and even move the preferred flag to the newly added terms.
{% endhint %}

## Properties

Property types defined in the Code System Schema are automatically displayed in the concept editor. Values can be added to the properties by pressing the <img src="https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/mE6IB2X03JBNtajQ84xB/add_property_icon.svg" alt="" data-size="line"> button.

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

{% hint style="warning" %}
If you restricted the potential number of values of a property, e.g. to`1..1`, the <img src="https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/mE6IB2X03JBNtajQ84xB/add_property_icon.svg" alt="" data-size="line"> button won't appear and you won't be able to add more values to the given property.
{% 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/ecIrdZnsDkSPypTQNKj0/blobs/ePSwld4c8fzQydfcxQbB/code_system_reparent.gif" alt=""><figcaption><p>Code System Concept Reparenting</p></figcaption></figure>

## Issues

{% hint style="info" %}
To access issue management related options, press the ![](https://content.gitbook.com/content/ecIrdZnsDkSPypTQNKj0/blobs/qVavUpZlpLETGMwsmjvM/actions_button.png) button.
{% endhint %}

Users can create issues related to specific Code System concepts using the *Raise an issue* context menu option, while existing issues can be viewed by selecting the *Show issues* action.

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