# Code Systems

## Methodology

Each Code System in Snow Owl is managed in a *repository* where every state change of an artifact is stored as a *revision* to provide a full change history over time.  When the changes to the Code System reach a particular state to be marked, the *revision* can be distinguished by a *tag* through a process called *versioning*.

![Historical revisions and a version tag](https://snowowl.atlassian.net/wiki/download/attachments/1665597441/image2021-3-18_8-44-6.png?version=1\&modificationDate=1616057048207\&cacheVersion=1\&api=v2)

Commonly used Code Systems are frequently extended by the national health authorities even if very little is specified by the group maintaining the particular terminology on how to manage national or local extensions. Snow Owl provides a common mechanism for extension management where work performed on a particular extension is isolated from other extensions or the Code System being extended. Extension content is stored on a *branch* that is forked from a particular version of the Code System to be extended.  The extension branch has access to all of the content that is stored on its parent branch up to the point of the fork. Note, that extensions to a Code System are also registered as a Code System hence a repository can maintain more than one Code System.&#x20;

![Extension code system based on Version1 of the base code system](https://snowowl.atlassian.net/wiki/download/attachments/1665597441/image2021-3-18_8-55-46.png?version=1\&modificationDate=1616057748137\&cacheVersion=1\&api=v2)

Using this approach, multiple extensions can be maintained even if these extensions depend on different versions of the base Code System. The figure below depicts a scenario where *Extension1* is extending *Version1* of the base Code System while *Extension2* extending *Version2* of the same base Code System.

![Multiple extensions on different versions of the base Code System](https://snowowl.atlassian.net/wiki/download/attachments/1665597441/image2021-3-18_9-8-18.png?version=1\&modificationDate=1616058500898\&cacheVersion=1\&api=v2)

As Code System extensions are organized into hierarchies, a dependency chain can be expressed between Code Systems where the *dependency* Code System is the Code System being extended, whereas the *extension* Code System is a Code System that extends the code system in question. As an example, the dependency chain for the above depicted scenario would look like this:

* Base
  * *Extensions*
    * Extension1
    * Extension2
  * Versions
    * Version1
    * Version1
* Extension1<br>
  * *Dependencies*
    * Base - Version1
  * *Versions*
    * Ext1 version1
* Extension2
  * *Dependencies*
    * Base - Version2
  * *Versions*
    * *Ext2 version1*
