DSTU2 QA Preview

This page is part of the FHIR Specification (v1.0.0: DSTU 2 Ballot 3). 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 R3 R2

6.21.18 Resource ValueSet - Operations

This resource has 3 operations associated with it:

$expandValue Set Expansion
$lookupConcept Look Up
$validate-codeValue Set based Validation

For more information about operations, including how they are invoked, see Operations.

6.21.18.1 Value Set Expansion

The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation. If the operation is not called at the instance level, one of the in parameters identifier, context or valueset must be provided. An expanded value set will be returned, or an OperationOutcome with an error message.

Formal Definition (as a OperationDefinition).

URL: [base]/ValueSet/$expand

URL: [base]/ValueSet/[id]/$expand

In Parameters:
NameCardinalityTypeBindingProfileDocumentation
identifier0..1uri

A logical value set identifier (i.e. ValueSet.identifier). 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

valueSet0..1ValueSet

The value set is provided directly as part of the request. Servers may choose not to accept value sets in this fashion

context0..1uri

The context of the value set, so that the server can resolve this to a value set to expand. 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 useable if the terminology server also has access to the profile registry that the server is using, but can be used to delegate the mapping from an application context to a binding to run-time

filter0..1string

A text filter that is applied to restrict the codes that are returned (this is useful in a UI context). The interpretation of this is delegated to the server in order to allow to determine the most optimal search approach for the context

profile0..1uri

A reference to an external definition that provides additional control information about how the expansion is performed. At this time, there is no agreed format or funtionality for the target of this URI. The VSAC Documentation provides one example of the use of this parameter. Implementers using this element will need to agree on an appropriate mechanism for use within their interoperability community. Known uses for profile include: * whether to return the value set content logical definition with the expansion * whether to include inactive concepts

date0..1dateTime

The date for which the expansion should be generated. if a date is provided, it means that the server should use the value set / code system definitions as they were on the given date, or return an error if this is not possible. Normally, the date is the current conditions (which is the default value) but under some circumstances, systems need to generate an expansion as it would have been 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.

offset0..1integer

Paging support - where to start if a subset is desired (default = 0)

count0..1integer

Paging support - how many codes in a a partial view. Paging only applies to flat expansions - servers ignore paging if the expansion is not flat. If count = 0, the client is asking how large the expansion is. Servers SHOULD honour this request for heirarchical expansions as well, and simply return the overall count

Out Parameters:
NameCardinalityTypeBindingProfileDocumentation
return1..1ValueSet

The result of the expansion

Note: as this the only out parameter, it is a resource, and it has the name 'return', the result of this operation is returned directly as a resource

The value set expansion returned by this query should be treated as a transient result that will change over time (whether it does or not depends on how the value set is specified), so applications should repeat the operation each time the value set is used. Clients can work through large flat expansions in a set of pages (partial views of the full expansion) instead of just getting the full expansion in a single exchange by using offset and count parameters. Servers are not obliged to support paging, but if they do so, SHALL support both the offset and count parameters. Heirarchical expansions are not subject to paging, and servers simply return the entire expansion. Different servers may return different results from expanding a value set for the following reasons: * The underlying code systems are different (e.g. different versions, possibly with different defined behaviour) * The server optimises filter includes differently, such as sorting by code frequency * Servers introduce arbitrary groups to assist a user to navigate the lists based either on extensions in the definition, or additional knowledge available to the server

6.21.18.1.1 Examples

Expanding a value set that is already registered on the server as "23", with a text filter of "abdo" (Request):

GET [base]/ValueSet/23/$expand?filter=abdo

Expanding a value set that is specififed by the client (using JSON) (Request):

POST [base]/ValueSet/23/$expand
[other headers]

{
  "resourceType" : "Parameters",
  "parameter" : [
     {
     "name" : "valueSet",
     "resource" : {
       "resourceType" : "ValueSet",
     [value set details]
     }
   }
  ]
}

Response:

HTTP/1.1 200 OK
[other headers]

<ValueSet xmlns="http://hl7.org/fhir">
  <!-- the server SHOULD populate the id with a newly created UUID
    so clients can easily track a particular expansion  -->
  <id value="43770626-f685-4ba8-8d66-fb63e674c467"/>
  <!-- no need for meta, though it is allowed for security labels, profiles -->

  <!-- other value set details -->
  <expansion>
    <!-- when expanded -->
    <timestamp value="20141203T08:50:00+11:00"/>
  <contains>
    <!-- expansion contents -->
  </contains>
  </expansion>
</ValueSet>

 

6.21.18.2 Concept Look Up

Given a code/system, or a Coding, get additional details about the concept

Formal Definition (as a OperationDefinition).

URL: [base]/ValueSet/$lookup

In Parameters:
NameCardinalityTypeBindingProfileDocumentation
code0..1code

The code that is to be validated. If a code is provided, a system must be provided

system0..1uri

The system for the code that is to be validated

version0..1string

The version of the system, if one was provided in the source data

coding0..1Coding

A coding to look up

date0..1dateTime

The date for which the information should be returned. Normally, this is the current conditions (which is the default value) but under some circumstances, systems need to acccess this information as it would have been 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.

Out Parameters:
NameCardinalityTypeBindingProfileDocumentation
name1..1string

A display name for the code system

version0..1string

The version that these details are based on

display1..1string

The preferred display for this concept

abstract0..1boolean

Whether this code is an abstract concept

designation0..*

Additional representations for this concept

designation.language0..1code

The language this designation is defined for

designation.use0..1Coding

A code that details how this designation would be used

designation.value1..1string

The text value for this designation

Note that the $lookup operation is more than just a value set search - the server finds the concept, and gathers the return information from the value set and the underlying code system definitions.

6.21.18.2.1 Examples

Looking up a code/system (Request):

GET [base]/ValueSet/$lookup?system=http://loinc.org&code=1963-8

Lookup using a Coding (Request):

POST [base]/ValueSet/$lookup
[other headers]

<Parameters xmlns="http://hl7.org/fhir">
  <parameter>
    <name value="coding"/>
  <valueCoding>
    <system value="http://loinc.org"/>
    <code value="1963-8"/>
  </valueCoding>
  </parameter>
</Parameters>

Response:

HTTP/1.1 200 OK
[other headers]

{
  "resourceType" : "Parameters",
  "parameter" : [
    {
    "name" : "name",
    "valueString" : "LOINC"
  },
  {
    "name" : "version",
    "valueString" : "2.48"
  },
  {
    "name" : "designation",
    "valueString" : "Bicarbonate [Moles/volume] in Serum"
  },
  {
    "name" : "abstract",
    "valueString" : "false"
  },
  {
      "name" : "designation",
    "part" : [
    {
      "name" : "value",
      "valueString" : "Bicarbonate [Moles/volume] in Serum "
    }
    ]
  }
  ]
}

 

6.21.18.3 Value Set based Validation

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 "identifier" or "valueset" must be provided. One (and only one) of the in parameters (code, coding, codeableConcept) must be provided. The operation returns a result (true / false), an error message, and the recommended display for the code

Formal Definition (as a OperationDefinition).

URL: [base]/ValueSet/$validate-code

URL: [base]/ValueSet/[id]/$validate-code

In Parameters:
NameCardinalityTypeBindingProfileDocumentation
identifier0..1uri

A logical value set id (i.e. ValueSet.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

context0..1uri

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 useable if the terminology server also has access to the profile registry that the server is using, but can be used to delegate the mapping from an application context to a binding to run-time

valueSet0..1ValueSet

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

code0..1code

The code that is to be validated. If a code is provided, a system must be provided

system0..1uri

The system for the code that is to be validated

version0..1string

The version of the system, if one was provided in the source data

display0..1string

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 in an extension in the outcome. Whether displays are case sensitive is code system dependent

coding0..1Coding

A coding to validate

codeableConcept0..1CodeableConcept

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

date0..1dateTime

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.

abstract0..1boolean

if true, then an abstract code is allowed to be used in the context of the code that is being validated. Typically, abstract codes are allowed to be used in value set specifications (e.g. any code that is subsumed by an abstract code). If false (which is the default value), then only concrete codes as defined by the value set are allowed

Out Parameters:
NameCardinalityTypeBindingProfileDocumentation
result1..1boolean

True if the concept details supplied are valid

message0..1string

Error details, if result = false. If this is provided when result = true, the message carries hints and warnings

display0..1string

A valid display for the concept if the system wishes to display this to a user

6.21.18.3.1 Examples

Simple validation of a code/system against a known value set (Request):

GET [base]/ValueSet/23/$validate-code?system=http://loinc.org&code=1963-8&display=test

Validate a CodeableConcept against a client specified value set (Request):

POST [base]/ValueSet/$validate-code
[other headers]

{
  "ResourceType" : "Parameters",
  "parameter" : [
    {
    "name" : "coding",
    "valueCodeableConcept" : {
      "coding" : {
        "system" : "http://loinc.org",
          "code" : "1963-8",
      "display" : "test"
      }
    }
  },
  {
    "name" : "valueSet",
    "resource": {
      "resourceType" : "ValueSet",
    [etc]
    }
  }
  ]
}

Test whether a Snomed Concept 399211009 (History of myocardial infarction) is subsumed by 22298006 (Myocardial infarction) (Request):


GET [base]/ValueSet/$validate-code?system=http://snomed.info/sct&code=399211009&identifier=http://snomed.info/sct?fhir_vs%3Disa/22298006

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"
  }
  ]
}