Write a custom zen profile
Since the 2405 release, using Aidbox in FHIRSchema mode is recommended, which is incompatible with zen or Entity/Attribute options.
Note: you can not use Attributes and zen profiles on the same resource at the same time
Validation modes supported with zen schemas
Zen schemas are used by Aidbox for validating resources e.g. in FHIR CRUD API. Such zen schemas must be tagged with either zen.fhir/base-schema
or zen.fhir/profile-schema
. Additionally, they must have :zen.fhir/type
and :zen.fhir/profileUri
keys specified.
zen.fhir/base-schema
zen.fhir/base-schema
Schemas tagged with zen.fhir/base-schema
are used to validate every resource of a specified type. When loaded into Aidbox they will be used in place of the default JSON schemas.
zen.fhir/profile-schema
zen.fhir/profile-schema
Schemas tagged with zen.fhir/profile-schema
are used to validate resources that mention their :zen.fhir/profileUri
in the meta.profile
attribute.
Those schemas must be tagged with zen.fhir/profile-schema
, describe data structure in the Aidbox format, and conform to the following schema:
zen.fhir/profile-schema
, by virtue of being a zen.fhir/nested-schema
, must also conform to the following schema:
Description of various schema keys
key | description | |
---|---|---|
zen.fhir/type | required | Used to find schema by matching against |
zen.fhir/profileUri | required | Used to find schema by matching against |
fhir/flags | optional | A set of keywords derived from FHIR ElementDefinition boolean attributes: isModifier ( |
fhir/extensionUri | optional | Used in Aidbox->FHIR format transformations to create |
fhir/polymorphic | optional | Used in Aidbox->FHIR format transformations to detect whether the element is a choice type |
zen.fhir/reference | optional | Used to specify resource types that can be referenced |
zen.fhir/reference.refers | optional | set of symbols referring to other |
zen.fhir/value-set.symbol | optional | symbol referring to |
zen.fhir/value-set.strength | optional | keyword specifying strength of binding |
Examples
:zen.fhir/reference
:zen.fhir/reference
Patient.managingOrganization
is a reference to an Organiazation
resource:
zen.fhir/value-set
zen.fhir/value-set
To enable value-set validation in zen concept resources with valueset
attribute populated must be loaded into Aidbox.
:zen.fhir/value-set
key must be a symbol tagged with zen.fhir/value-set
zen.fhir/value-set
symbol definition must contain :uri
and :fhir/code-systems
attributes
:uri
is a ValueSet.url
, which must be mentioned in a Concept.valueset.*
:fhir/code-systems
:fhir/url
is a CodeSystem.url
, which must be a value of Concept.system
:zen.fhir/content
can have a value :bundled
, this means that a CodeSystem
content is accessible as Aidbox Concept
resources. Other option is :not-present
, Aidbox will skip validation of such concept assuming that the CodeSystem
content is not loaded into Aidbox
:slicing
:slicing
:slicing
allows to validate a part of some array with a zen-schema. Such part is called a slice.
:slicing
allows to reproduce FHIR profiling Slicing operation
Before applying :schema
to a slice zen needs to determine elements of the array this slice consists of, this logic is described using :filter
key.
:filter
must specify an :engine
. Currently there're two engines available :zen
and :match
:zen
engine matches elements against specified zen schema
:match
engine is a pattern matching DSL:
primitive (e.g. string or a number): constant, i.e. literal match of a value
{}
: objects validated with this match must contain and conform to every key from this pattern#{}
: at least one element of an array must conform each element of this pattern
From example below: :match {:code "29463-7", :system "http://loinc.org"}
means that elements with specified code and systems will be considered as a part of the slice.
:schema
is a zen schema which will be applied to a slice.
Following example describes that in the code.coding
array there is a slice called BodyWeightCode
consisting of exactly one element with code
="29463-7"
and system
="http://loinc.org"
:
Slicing on Organization.identifier
constraining max one element in both NPI and CLIA slices:
Last updated