The CodeSystem resource specifies a set of Concepts included in this code system.
Aidbox assumes a separate creation of the CodeSystem resource and a set of Concepts composing it. This means that the CodeSystem resource describes only the meta information of the code system: URL, name, publisher, etc. Whereas Concept resources describe the content of the code system and are associated with the code system by the Concept.system attribute with the same value as the CodeSystem.url element.
For FHIR conformance, we allow to create the CodeSystem resource with a list of included concepts. If it contains listed Concepts at the moment of saving a CodeSystem, then Aidbox saves submitted Concepts as separate resources. The CodeSystem resource itself is saved without the concept attribute. This method of the CodeSystem creation may be used for small dictionaries (generally, not more than 100 concepts). In the case when your code system is big, Aidbox strongly recommends creating the CodeSystem resource separately and uploading Concepts in parts.
CRUD
Create
CodeSystem resource can be created as a FHIR resource with embedded concepts. This approach is applicable for those cases when your code system contains a small number of concepts, usually no more than 100.
For example, we will create a CodeSystem for eye color containing Brown, Blue, Green, Hazel, Heterochromia coded concepts.
As you can see, the request returns only CodeSystem meta information (url, status, content....), and does not return concept listed in that request. It is because Aidbox divides CodeSystem to CodeSystem body and contained concepts list, and creates all concepts as independent Concept resources.
And if we get Concept with system = http://code.system/eyes.color, we will receive all concepts for this CodeSystem.
GET [base]/CodeSystem?system=http://code.system/eyes.color
Another way to create CodeSystem is a separate creation of the CodeSystem body and Concepts.
For example, let's create a CodeSystem with a custom subset of Units of measurement (aka UCUM). We will compose this CodeSystem from the most common healthcare units of measure.
Code
Descriptive Name
Display
%
Persent
%
/uL
PerMicroLiter
/uL
[iU]/L
InternationalUnitsPerLiter
IU/L
kPa
KiloPascal
kPa
ng/mL
NanoGramsPerMilliLiter
ng/mL
U/L
UnitsPerLiter
U/L
u[iU]/mL
MicroInternationalUnitsPerMilliLiter
uIU/mL
ug/dL
MicroGramsPerDeciLiter
ug/dL
ug/L
MicroGramsPerLiter
ug/L
ug/mL
MicroGramsPerMilliLiter
ug/mL
umol/L
MicroMolesPerLiter
umol/L
For this subset, let's create the CodeSystem resource.
POST [base]/CodeSystem{"resourceType": "CodeSystem","id": "custom-ucum-subset","url": "http://code.system/ucum.subset","status": "active","content": "complete"}
Aidbox does not support updates for the CodeSystem resource.
In the terminology, it is a good practice not to update existing Coded Systems. Aidbox follows this principle. If you need to update any existing CodeSystem resource, you will have to explicitly delete this CodeSystem and re-create it again with your changes.
Delete
On delete CodeSystem, Aidbox deletes CodeSystem resource, and marks each Concept with the deprecated = true.