Checking Codes on Write
Checking Codes on Write
A project with the validate-terminology feature checks codes when a resource is written. Only a project's server
operator can turn the feature on: project admins cannot change Project.features.
For each element with a required binding, in the resource's base type and in the profiles it is validated against:
- A
codemust be in the bound value set. - A
Codingmust name itssystem, and its system and code must be in the value set. - A
CodeableConceptmust have at least one coding, with asystem, that is in the value set. Text alone, or codings with no system, are refused.
A write that breaks one is refused with an error that names the value set, at the element's path, except in the filter case below.
Preferred, extensible and example bindings never refuse a write.
A code system the server does not hold
What happens to a code from a code system the server does not have, for example SNOMED CT CA before it is loaded, depends on how the value set includes that system:
| The value set includes the system | A code from it |
|---|---|
Whole, with no concept list and no filter | Accepted: the server cannot tell a valid code from a wrong one |
With a concept list | Checked against the list, as usual |
With a filter, such as a SNOMED CT is-a filter | Refused with CodeSystem <url> not found, without the element's path |
Most SNOMED CT value sets use a concept list or a filter. Load the code systems your profiles bind to, so their codes are checked and filtered value sets work.
A required binding to a value set the server does not have at all refuses every write that uses the element.
Code systems defined by a grammar
Some code systems are a grammar rather than a list, so the server cannot hold all their codes. When a value set includes the whole of one of these, the server checks the code's form:
| Code system | Example values | Used by |
|---|---|---|
MIME types, urn:ietf:bcp:13 | application/pdf, text/plain; charset=utf-8 | every element bound to mimetypes, including Binary.contentType, Attachment.contentType, Subscription.channel.payload and Endpoint.payloadMimeType |
Language tags, urn:ietf:bcp:47 | fr, fr-CA, iu-Cans-CA | no element in base R4 or the pinned Canadian packages; a profile that binds a value set including all of BCP 47 (such as all-languages) with required strength |
The check is of form only: image/x-anything is accepted, pdf is not. Irregular old language tags such as
i-default are refused. A value set that lists or filters codes of these systems is checked against its list.
UCUM units (http://unitsofmeasure.org) are also a grammar, but this check does not cover them. The server's UCUM code
system holds only UCUM's 312 base units (g, L, m, ...). A value set that includes all of UCUM is checked against
that list, so a required binding to it refuses prefixed and compound units such as mg, kg and mmol/L. None of the
pinned Canadian profiles (CA Core+ 1.2.1-dft, PS-CA 2.3.0-ti-ballot, CA:FeX 2.2.0-DFT) binds a unit with required
strength.