Aidbox Terminology
Aidbox approach to terminologies
15 cells · updated Aug 29, 2022
In Aidbox, all terminology services are built around non-FHIR Concept resource type. Concept resource represents concept element from the CodeSystem resource type. Concept resource behaves like other FHIR resources: you can CRUD & Search it. Concept structure essentially follows the structure of Coding data type with some additional attributes.
ℹ Reasoning behind using concept as a separate resource described in details here.
Create custom terminology
To create a custom terminology you just need to create CodeSystem, Concept and ValueSet resources. This can be done using regular FHIR CRUD API.
PUT /CodeSystem/custom-eye-color
content-type: text/yaml
accept: text/yaml
status: draft
content: not-present
url: http://example.org/CodeSystem/eyes.colorurl: http://example.org/CodeSystem/eyes.color
status: draft
content: not-present
id: custom-eye-color
resourceType: CodeSystem
meta: {lastUpdated: '2022-08-29T10:12:41.347865Z', createdAt: '2022-08-29T10:12:41.347865Z', versionId: '3'}
PUT /Concept/eyes-color-ec-hl
content-type: text/yaml
accept: text/yaml
system: http://example.org/CodeSystem/eyes.color
code: ec-hl
display: Hazel
designation:
display:
ge: Braun
ru: Карийcode: ec-hl
system: http://example.org/CodeSystem/eyes.color
display: Hazel
designation:
display: {ge: Braun, ru: Карий}
id: eyes-color-ec-hl
resourceType: Concept
meta: {lastUpdated: '2021-11-22T15:55:22.887603Z', createdAt: '2021-11-22T15:50:56.498137Z', versionId: '393'}
PUT /ValueSet/eye-color
content-type: text/yaml
accept: text/yaml
description: Eye color
status: draft
compose:
include:
- system: http://example.org/CodeSystem/eyes.color
name: EyeColor
url: http://example.org/ValueSet/eye-colorurl: http://example.org/ValueSet/eye-color
name: EyeColor
status: draft
compose:
include:
- {system: 'http://example.org/CodeSystem/eyes.color'}
description: Eye color
id: eye-color
resourceType: ValueSet
meta: {lastUpdated: '2021-11-22T15:55:49.952985Z', createdAt: '2021-11-22T15:55:49.952985Z', versionId: '396'}
Import existing terminology
Import is not much different than create, the only difference is that Concept resourceType doesn't exist in FHIR and this data is contained inside CodeSystem resources. Aidbox automatically extracts CodeSystem.concept into separate Concept resources when CodeSystem is created via FHIR CRUD. There's also terminology/$import endpoint it works like bulk $load
Posting CodeSystem with included concepts via FHIR CRUD API
As a result, you will get set of Concept resources and CodeSystem resource
POST fhir/CodeSystem
content-type: text/yaml
accept: text/yaml
resourceType: CodeSystem
id: custom-eye-color
status: draft
url: http://code.system/eyes.color
content: example
concept:
- code: ec-bn
display: Brown
- code: ec-be
display: Blue
- code: ec-gn
display: Green
- code: ec-hl
display: Hazel
- code: ec-h
display: Heterochromia
url: http://code.system/eyes.color
status: draft
concept:
- {code: ec-bn, display: Brown}
- {code: ec-be, display: Blue}
- {code: ec-gn, display: Green}
- {code: ec-hl, display: Hazel}
- {code: ec-h, display: Heterochromia}
content: example
id: custom-eye-color
resourceType: CodeSystem
meta:
lastUpdated: '2021-11-23T13:02:56.688627Z'
versionId: '533'
extension:
- {url: 'ex:createdAt', valueInstant: '2021-11-22T15:43:29.705979Z'}
Import eye colors terminology via /terminology/$import endpoint
POST /terminology/$import
content-type: text/yaml
accept: text/yaml
url: https://storage.googleapis.com/aidbox-public/eyecolors.ndjson.gzresult: {Concept: 5, ValueSet: 1, CodeSystem: 1}
Lookup and validation
Lookup can be done in two ways:
- Using regular FHIR Search API on
Conceptresource - Using FHIR Terminology API
$lookupoperation
To validate a code FHIR Terminology API operation $validate-code is supported
FHIR Search API on Concept
GET /fhir/Concept?code=ec
accept: text/yamlresourceType: Bundle
type: searchset
meta: {versionId: '419'}
total: 1
link:
- {relation: first, url: '/fhir/Concept?code=ec&page=1'}
- {relation: self, url: '/fhir/Concept?code=ec&page=1'}
entry:
- resource:
code: ec-hl
system: http://example.org/CodeSystem/eyes.color
display: Hazel
designation:
display: {ge: Braun, ru: Карий}
id: eyes-color-ec-hl
resourceType: Concept
meta: {lastUpdated: '2021-11-22T15:55:22.887603Z', createdAt: '2021-11-22T15:50:56.498137Z', versionId: '393'}
fullUrl: https://publtest.edge.aidbox.app/Concept/eyes-color-ec-hl
link:
- {relation: self, url: 'https://publtest.edge.aidbox.app/Concept/eyes-color-ec-hl'}
GET /CodeSystem/$lookup?system=http://example.org/CodeSystem/eyes.color&code=ec-hl
accept: text/yamlresourceType: Parameters
parameter:
- {name: display, valueString: Hazel}
- name: designation
value:
display: {ge: Braun, ru: Карий}
- {name: name, value: null}
GET /ValueSet/eye-color/$validate-code?code=ec-hl
accept: text/yamlresourceType: Parameters
parameter:
- {name: result, valueBoolean: true}