On this page

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 code must be in the bound value set.
  • A Coding must name its system, and its system and code must be in the value set.
  • A CodeableConcept must have at least one coding, with a system, 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 systemA code from it
Whole, with no concept list and no filterAccepted: the server cannot tell a valid code from a wrong one
With a concept listChecked against the list, as usual
With a filter, such as a SNOMED CT is-a filterRefused 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 systemExample valuesUsed by
MIME types, urn:ietf:bcp:13application/pdf, text/plain; charset=utf-8every element bound to mimetypes, including Binary.contentType, Attachment.contentType, Subscription.channel.payload and Endpoint.payloadMimeType
Language tags, urn:ietf:bcp:47fr, fr-CA, iu-Cans-CAno 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.