Operation $expand on ValueSet
This operation returns actual list of codes that can be used for data entry or validation.
Endpoints
[fhir_base]/ValueSet/$expand
[fhir_base]/ValueSet/[id]/$expand
Query parameters
| Query parameter | Type | Status | Description | 
|---|---|---|---|
| url | uri | supported | A canonical reference to a value set. | 
| valueSet | valueSet | supported | The value set is provided directly as part of the request. | 
| valueSetVersion | string | supported | The identifier that is used to identify a specific version of the value set to be used when generating the expansion. | 
| context | uri | supported | The context of the value set, so that the server can resolve this to a value set to expand | 
| contextDirection | code | unsupported | If a context is provided, a context direction may also be provided. Valid values are: 
 | 
| filter | string | supported | A text filter that is applied to restrict the codes that are returned. Uses regexp as a value | 
| date | dateTime | unsupported | The date for which the expansion should be generated. | 
| offset | integer | supported | Paging support - where to start if a subset is desired (default = 0). Offset is number of records (not number of pages) | 
| count | integer | supported | Paging support - how many codes should be provided in a partial page view. Paging only applies to flat expansions - servers ignore paging if the expansion is not flat. | 
| includeDesignations | boolean | supported | Controls whether concept designations are to be included or excluded in value set expansions | 
| designation | string | unsupported | A token that specifies a system+code that is either a use or a language. | 
| includeDefinition | boolean | unsupported | Controls whether the value set definition is included or excluded in value set expansions | 
| activeOnly | boolean | supported | Controls whether inactive concepts are included or excluded in value set expansions. | 
| excludeNested | boolean | supported | Controls whether or not the value set expansion nests codes or not (i.e. ValueSet.expansion.contains.contains) | 
| excludeNotForUI | boolean | unsupported | Controls whether or not the value set expansion is assembled for a user interface use or not. | 
| excludePostCoordinated | boolean | unsupported | Controls whether or not the value set expansion includes post coordinated codes | 
| displayLanguage | code | unsupported | Specifies the language to be used for description in the expansions i.e. the language to be used for ValueSet.expansion.contains.display | 
| exclude-system | canonical | unsupported | Code system, or a particular version of a code system to be excluded from the value set expansion. The format is the same as a canonical URL: [system] | 
| system-version | canonical | unsupported | Specifies a version to use for a system, if the value set does not specify which one to use. The format is the same as a canonical URL: [system] | 
| check-system-version | canonical | unsupported | Edge Case: Specifies a version to use for a system. | 
| force-system-version | canonical | unsupported | Edge Case: Specifies a version to use for a system. This parameter overrides any specified version in the value set (and any it depends on). | 
When using "context" parameter, note that in case of a slicing, StructureDefinition can have multiple elements with the same path. In this case specify unique element id instead. For example, context=http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient%23Patient.identifier:memberid.use
Example
Example - use of $expand
{
    "id": "observation-category",
    "url": "http://hl7.org/fhir/ValueSet/observation-category",
    "version": "4.0.1",
    "compose": {
        "include": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category"
            }
        ]
    },
    "expansion": {
        "timestamp": "2022-09-22T15:01:59.337+00:00",
        "total": 9,
        "contains": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "social-history",
                "display": "Social History"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "vital-signs",
                "display": "Vital Signs"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "imaging",
                "display": "Imaging"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "laboratory",
                "display": "Laboratory"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "procedure",
                "display": "Procedure"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "survey",
                "display": "Survey"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "exam",
                "display": "Exam"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "therapy",
                "display": "Therapy"
            },
            {
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "version": "4.0.1",
                "code": "activity",
                "display": "Activity"
            }
        ],
        "parameter": []
    },
    "resourceType": "ValueSet"
}
Try operation $expand with our Kodjin FHIR Server Postman Collection