ValueSet Expansion

Overview

$expand operation expand given ValueSet in to set of concepts. For more information, see the official documentation FHIR Terminology ValueSet Expansion​

Api

1
GET/POST URL: [base]/ValueSet/$expand
Copied!
1
GET/POST URL: [base]/ValueSet/[id]/$expand
Copied!
Example for expand default AdministrativeGender ValueSet. List of default ValueSets.​
1
GET [base]/ValueSet/administrative-gender/$expand
Copied!

Parameters

Parameter
Type
Status
Example
url
​uri​
supported
​url​
valueSet
​ValueSet​
supported
​valueSet​
context
​uri​
not supported
-
filter
​string​
supported
​filter​
profile
​uri​
not supported
-
date
​dateTime​
not supported
-
offset
​integer​
supported
​offset​
count
​integer​
supported
​count​
includeDesignations
​boolean​
not supported
-
includeDefinition
​boolean​
not supported
-
activeOnly
​boolean​
supported
​activeOnly​
excludeNested
​boolean​
not supported
-
excludeNotForUI
​boolean​
not supported
-
excludePostCoordinated
​boolean​
not supported
-
displayLanguage
​code​
not supported
-
limitedExpansion
​boolean​
not supported
-

url

A canonical url for a value set.
Request
Response
1
GET [base]/ValueSet/$expand?url=http://hl7.org/fhir/ValueSet/administrative-gender
Copied!
Or
1
POST [base]/ValueSet/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- {name: url, valueUri: 'http://hl7.org/fhir/ValueSet/administrative-gender'}
Copied!
1
id: administrative-gender
2
resourceType: ValueSet
3
url: http://hl7.org/fhir/ValueSet/administrative-gender
4
description: The gender of a person used for administrative purposes.
5
compose:
6
include:
7
- {system: 'http://hl7.org/fhir/administrative-gender'}
8
name: AdministrativeGender
9
expansion:
10
timestamp: '2018-09-25T16:24:55Z'
11
identifier: http://hl7.org/fhir/ValueSet/administrative-gender
12
contains:
13
- {code: male, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Male, definition: Male}
14
- {code: female, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Female, definition: Female}
15
- {code: other, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Other, definition: Other}
16
- {code: unknown, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Unknown, definition: Unknown}
17
......
Copied!

valueSet

The value set is provided directly as a part of the request.
Request
Response
1
POST [base]/ValueSet/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- name: valueSet
7
resource:
8
resourceType: ValueSet
9
url: http://custom/administrative-gender
10
compose:
11
include:
12
- valueSet: ['http://hl7.org/fhir/ValueSet/administrative-gender']
Copied!
1
resourceType: ValueSet
2
url: http://custom/administrative-gender
3
compose:
4
include:
5
- valueSet: ['http://hl7.org/fhir/ValueSet/administrative-gender']
6
expansion:
7
timestamp: '2018-09-26T08:51:30Z'
8
identifier: http://custom/administrative-gender
9
contains:
10
- {code: male, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Male, definition: Male}
11
- {code: female, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Female, definition: Female}
12
- {code: other, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Other, definition: Other}
13
- {code: unknown, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Unknown, definition: Unknown}
Copied!

filter

A text filter that is applied to restrict the codes
Request
Response
1
GET [base]/ValueSet/administrative-gender/$expand?filter=male
Copied!
Or
1
POST [base]/ValueSet/administrative-gender/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- {name: filter, valueString: male}
Copied!
1
id: administrative-gender
2
resourceType: ValueSet
3
url: http://hl7.org/fhir/ValueSet/administrative-gender
4
description: The gender of a person used for administrative purposes.
5
compose:
6
include:
7
- {system: 'http://hl7.org/fhir/administrative-gender'}
8
name: AdministrativeGender
9
expansion:
10
timestamp: '2018-09-25T16:24:55Z'
11
identifier: http://hl7.org/fhir/ValueSet/administrative-gender
12
contains:
13
- {code: male, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Male, definition: Male}
14
- {code: female, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Female, definition: Female}
15
......
Copied!

offset

Paging support - where to start if a subset is desired (default = 0).
Request
Response
1
GET [base]/ValueSet/administrative-gender/$expand?offset=2
Copied!
Or
1
POST [base]/ValueSet/administrative-gender/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- {name: offset, valueInteger: 2}
Copied!
1
id: administrative-gender
2
resourceType: ValueSet
3
url: http://hl7.org/fhir/ValueSet/administrative-gender
4
description: The gender of a person used for administrative purposes.
5
compose:
6
include:
7
- {system: 'http://hl7.org/fhir/administrative-gender'}
8
name: AdministrativeGender
9
expansion:
10
timestamp: '2018-09-25T16:24:55Z'
11
identifier: http://hl7.org/fhir/ValueSet/administrative-gender
12
contains:
13
- {code: other, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Other, definition: Other}
14
- {code: unknown, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Unknown, definition: Unknown}
15
......
Copied!

count

Paging support - how many codes should be provided in a partial page view.
Request
Response
1
GET [base]/ValueSet/administrative-gender/$expand?count=1
Copied!
Or
1
POST [base]/ValueSet/administrative-gender/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- {name: count, valueInteger: 1}
Copied!
1
id: administrative-gender
2
resourceType: ValueSet
3
url: http://hl7.org/fhir/ValueSet/administrative-gender
4
description: The gender of a person used for administrative purposes.
5
compose:
6
include:
7
- {system: 'http://hl7.org/fhir/administrative-gender'}
8
name: AdministrativeGender
9
expansion:
10
timestamp: '2018-09-25T16:24:55Z'
11
identifier: http://hl7.org/fhir/ValueSet/administrative-gender
12
contains:
13
- {code: male, module: fhir-3.3.0, system: 'http://hl7.org/fhir/administrative-gender', display: Male, definition: Male}
14
......
Copied!

activeOnly

Controls whether inactive concepts are included or excluded in value set expansions.
For example, we create a testing ValueSet with one current active concept and one deprecated concept provided directly as a part of the request.
Get all concepts
Request
Response
1
POST [base]/ValueSet/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- {name: activeOnly, valueBoolean: false}
7
- name: valueSet
8
resource:
9
resourceType: ValueSet
10
url: http://custom/testing
11
compose:
12
include:
13
- system: http://testing
14
concept:
15
- {code: active}
16
- {code: inactive, deprecated: true}
Copied!
1
resourceType: ValueSet
2
url: http://custom/testing
3
compose:
4
include:
5
- system: http://testing
6
concept:
7
- {code: active}
8
- {code: inactive, deprecated: true}
9
expansion:
10
timestamp: '2018-09-26T09:19:03Z'
11
identifier: http://custom/testing
12
contains:
13
- {code: active, system: 'http://testing'}
14
- {code: inactive, system: 'http://testing', deprecated: true}
Copied!
Get only active concepts
Request
Response
Get only active concepts
1
POST [base]/ValueSet/$expand
2
content-type: text/yaml
3
​
4
resourceType: Parameters
5
parameter:
6
- {name: activeOnly, valueBoolean: true}
7
- name: valueSet
8
resource:
9
resourceType: ValueSet
10
url: http://custom/testing
11
compose:
12
include:
13
- system: http://testing
14
concept:
15
- {code: active}
16
- {code: inactive, deprecated: true}
Copied!
1
resourceType: ValueSet
2
url: http://custom/testing
3
compose:
4
include:
5
- system: http://testing
6
concept:
7
- {code: active}
8
- {code: inactive, deprecated: true}
9
expansion:
10
timestamp: '2018-09-26T09:19:03Z'
11
identifier: http://custom/testing
12
contains:
13
- {code: active, system: 'http://testing'}
Copied!