This page is part of the FHIR Specification (v5.0.0-ballot: FHIR R5 Ballot Preview). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4
Vocabulary Work Group | Maturity Level: N | Normative | Compartments: N/A |
Validate that a coded value is in the set of codes allowed by a value set.
If the operation is not called at the instance level, one of the in parameters url, context or valueSet must be provided. One (and only one) of the in parameters code, coding, or codeableConcept must be provided. The operation returns a result (true / false), an error message, and the recommended display for the code. When validating a code or a coding, then the code, system and version output parameters SHOULD be populated when possible. When a validating a CodeableConcept, then the codeableConcept output parameter SHOULD be populated when possible.
The canonical URL for this operation definition is
http://hl7.org/fhir/OperationDefinition/ValueSet-validate-code
Formal Definition (as a OperationDefinition).
URL: [base]/ValueSet/$validate-code
URL: [base]/ValueSet/[id]/$validate-code
This is an idempotent operation
In Parameters: | |||||
Name | Cardinality | Type | Binding | Profile | Documentation |
url | 0..1 | uri | Value set Canonical URL. The server must know the value set (e.g. it is defined explicitly in the server's value sets, or it is defined implicitly by some code system known to the server | ||
context | 0..1 | uri | The context of the value set, so that the server can resolve this to a value set to validate against. The recommended format for this URI is [Structure Definition URL]#[name or path into structure definition] e.g. http://hl7.org/fhir/StructureDefinition/observation-hspc-height-hspcheight#Observation.interpretation. Other forms may be used but are not defined. This form is only usable if the terminology server also has access to the conformance registry that the server is using, but can be used to delegate the mapping from an application context to a binding at run-time | ||
valueSet | 0..1 | ValueSet | The value set is provided directly as part of the request. Servers may choose not to accept value sets in this fashion. This parameter is used when the client wants the server to expand a value set that is not stored on the server | ||
valueSetVersion | 0..1 | string | The identifier that is used to identify a specific version of the value set to be used when validating the code. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. | ||
code | 0..1 | code | The code that is to be validated. If a code is provided, a system or a context must be provided (if a context is provided, then the server SHALL ensure that the code is not ambiguous without a system) | ||
system | 0..1 | uri | The system for the code that is to be validated | ||
systemVersion | 0..1 | string | The version of the system, if one was provided in the source data | ||
display | 0..1 | string | The display associated with the code, if provided. If a display is provided a code must be provided. If no display is provided, the server cannot validate the display value, but may choose to return a recommended display name using the display parameter in the outcome. Whether displays are case sensitive is code system dependent | ||
coding | 0..1 | Coding | A coding to validate | ||
codeableConcept | 0..1 | CodeableConcept | A full codeableConcept to validate. The server returns true if one of the coding values is in the value set, and may also validate that the codings are not in conflict with each other if more than one is present | ||
date | 0..1 | dateTime | The date for which the validation should be checked. Normally, this is the current conditions (which is the default values) but under some circumstances, systems need to validate that a correct code was used at some point in the past. A typical example of this would be where code selection is constrained to the set of codes that were available when the patient was treated, not when the record is being edited. Note that which date is appropriate is a matter for implementation policy. | ||
abstract | 0..1 | boolean | If this parameter has a value of true or the parametter is ommitted, the client is stating that the validation is being performed in a context where a concept designated as 'abstract' is appropriate/allowed to be used, and the server should regard abstract codes as valid. If this parameter is false, abstract codes are not considered to be valid. Note that. 'abstract' is a property defined by many HL7 code systems that indicates that the concept is a logical grouping concept that is not intended to be used as a 'concrete' concept to in an actual patient/care/process record. This language is borrowed from object-orientated theory where 'abstract' entities are never instantiated. However in the general record and terminology eco-system, there are many contexts where it is appropriate to use these codes e.g. as decision making criterion, or when editing value sets themselves. This parameter allows a client to indicate to the server that it is working in such a context. | ||
displayLanguage | 0..1 | code | Specifies the language to be used for description when validating the display property | ||
useSupplement | 0..* | canonical | The supplement must be used when validating the code. Use of this parameter should result in $validate-code behaving the same way as if the supplements were included in the value set definition using the supplement extension | ||
Out Parameters: | |||||
Name | Cardinality | Type | Binding | Profile | Documentation |
result | 1..1 | boolean | True if the concept details supplied are valid | ||
message | 0..1 | string | Error details, if result = false. If this is provided when result = true, the message carries hints and warnings | ||
display | 0..1 | string | A valid display for the concept if the system wishes to display this to a user | ||
code | 0..1 | code | The code that was validated | ||
system | 0..1 | uri | The system for the code that was validated | ||
version | 0..1 | string | The version of the system of the code that was validated | ||
codeableConcept | 0..1 | CodeableConcept | A codeableConcept containing codings for all the validated codes | ||
issues | 0..1 | OperationOutcome | List of itemised issues with paths constrained to simple FHIRPath. Examples are CodeableConcept, CodeableConcept.coding[0], CodeableConcept.coding[1].display, or Coding.display |
Note: the correct behaviour of validation with regard to language for Coding.display items is currently undefined, and further development and testing may lead to specific requirements or recommendations in subsequent releases
Request: Simple validation of a code/system against a known value set
GET [base]/ValueSet/23/$validate-code?system=http://loinc.org&code=1963-8&display=test
Request: Validate a CodeableConcept against a client specified value set
POST [base]/ValueSet/$validate-code [other headers] { "resourceType" : "Parameters", "parameter" : [ { "name" : "codeableConcept", "valueCodeableConcept" : { "coding" : { "system" : "http://loinc.org", "code" : "1963-8", "display" : "test" } } }, { "name" : "valueSet", "resource": { "resourceType" : "ValueSet", [etc] } } ] }
Response:
HTTP/1.1 200 OK [other headers] { "resourceType" : "Parameters", "parameter" : [ { "name" : "result", "valueBoolean" : "false" }, { "name" : "message", "valueString" : "The display \"test\" is incorrect" }, { "name" : "display", "valueString" : "Bicarbonate [Moles/volume] in Serum" } ] }
For more information about operations, including how they are invoked, see Operations.