Canonical Resource Management Infrastructure Implementation Guide
1.0.0 - STU1

Publication Build: This will be filled in by the publication tooling

## OperationDefinition: Example of a Canonical Version Bindable and Pageable Operation Definition

Draft as of 2019-11-01

URL: [base]/ValueSet/$expand

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

Parameters

Use | Name | Scope | Cardinality | Type | Binding | Documentation
IN | url |  | 0..1 | uri |  | A canonical reference to a value set. 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
IN | 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
IN | valueSetVersion |  | 0..1 | string |  | The identifier that is used to identify a specific version of the value set to be used when generating the expansion. 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. This parameter cannot be used at the same time as includeDraft. If a version identifier is provided, the expansion is performed regardless of the status of the resource.
IN | context |  | 0..1 | uri |  | 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 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
IN | contextDirection |  | 0..1 | code |  | If a context is provided, a context direction may also be provided. Valid values are: 'incoming': the codes a client can use for PUT/POST operations, and 'outgoing', the codes a client might receive from the server. The purpose is to inform the server whether to use the value set associated with the context for reading or writing purposes (note: for most elements, this is the same value set, but there are a few elements where the reading and writing value sets are different)
IN | filter |  | 0..1 | string |  | 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. The server can document the way this parameter works in TerminologyCapabilities..expansion.textFilter. Typical usage of this parameter includes functionality like: using left matching e.g. "acut ast" allowing for wild cards such as %, &, ? searching on definition as well as display(s) allowing for search conditions (and / or / exclusions) Text Search engines such as Lucene or Solr, long with their considerable functionality, might also be used. The optional text search might also be code system specific, and servers might have different implementations for different code systems
IN | date |  | 0..1 | dateTime |  | 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.
IN | offset |  | 0..1 | integer |  | Paging support - where to start if a subset is desired (default = 0). Offset is number of records (not number of pages)
IN | count |  | 0..1 | integer |  | 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. If count = 0, the client is asking how large the expansion is. Servers SHOULD honor this request for hierarchical expansions as well, and simply return the overall count
IN | includeDesignations |  | 0..1 | boolean |  | Controls whether concept designations are to be included or excluded in value set expansions
IN | designation |  | 0..* | string |  | A token that specifies a system+code that is either a use or a language. Designations that match by language or use are included in the expansion. If no designation is specified, it is at the server discretion which designations to return
IN | includeDefinition |  | 0..1 | boolean |  | Controls whether the value set definition is included or excluded in value set expansions
IN | activeOnly |  | 0..1 | boolean |  | Controls whether inactive concepts are included or excluded in value set expansions. Note that if the value set explicitly specifies that inactive codes are included, this parameter can still remove them from a specific expansion, but this parameter cannot include them if the value set excludes them
IN | excludeNested |  | 0..1 | boolean |  | Controls whether or not the value set expansion nests codes or not (i.e. ValueSet.expansion.contains.contains)
IN | excludeNotForUI |  | 0..1 | boolean |  | Controls whether or not the value set expansion is assembled for a user interface use or not. Value sets intended for User Interface might include 'abstract' codes or have nested contains with items with no code or abstract = true, with the sole purpose of helping a user navigate through the list efficiently, where as a value set not generated for UI use might be flat, and only contain the selectable codes in the value set. The exact implications of 'for UI' depend on the code system, and what properties it exposes for a terminology server to use. In the FHIR Specification itself, the value set expansions are generated with excludeNotForUI = false, and the expansions used when generated schema / code etc, or performing validation, are all excludeNotForUI = true.
IN | excludePostCoordinated |  | 0..1 | boolean |  | Controls whether or not the value set expansion includes post coordinated codes
IN | displayLanguage |  | 0..1 | code |  | Specifies the language to be used for description in the expansions i.e. the language to be used for ValueSet.expansion.contains.display
IN | exclude-system |  | 0..* | canonical |  | 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]|[version] - e.g. http://loinc.org|2.56
IN | system-version |  | 0..* | canonical |  | 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]|[version] - e.g. http://loinc.org|2.56
IN | check-system-version |  | 0..* | canonical |  | Edge Case: Specifies a version to use for a system. If a value set specifies a different version, an error is returned instead of the expansion. The format is the same as a canonical URL: [system]|[version] - e.g. http://loinc.org|2.56
IN | force-system-version |  | 0..* | canonical |  | 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). The format is the same as a canonical URL: [system]|[version] - e.g. http://loinc.org|2.56. Note that this has obvious safety issues, in that it may result in a value set expansion giving a different list of codes that is both wrong and unsafe, and implementers should only use this capability reluctantly. It primarily exists to deal with situations where specifications have fallen into decay as time passes. If the value is override, the version used SHALL explicitly be represented in the expansion parameters
IN | manifest |  | 0..1 | canonical |  | Specifies an asset-collection library that provides expansion rules for the operation. See the description of manifest for a complete description of how manifest values are used to provide defaults for expansion parameters. Parameters specified directly in an $expand operation override behaviors specified by the manifest parameter.
IN | expansion |  | 0..1 | uri |  | Specifies an expansion identifier to be used. If the value set has an expansion with that identifier, that expansion is used. This parameter has the same behavior as using the `expansion` search parameter with the canonical url for the value set. If the server performing the expand does not know the expansion identifier, it SHALL return an error. An expansion parameter takes precedence over other parameters that control expansion, since the expansion identifier establishes the expansion to be returned.
IN | includeDraft |  | 0..1 | boolean |  | Indicates that draft versions of the value set should be considered when determining the version of the value set to be used to perform the expand. If one (or more) draft versions exist, the $expand operation should use the latest draft to create the expansion. This parameter cannot be used at the same time as the valueSetVersion parameter. If a draft version does not exist, then the service should use the latest published (status=Active) version.
IN | canonicalVersion |  | 0..* | canonical |  | Specifies a version to use for a canonical resource if the artifact referencing the resource does not already specify a version. The format is the same as a canonical URL: [url]|[version] - e.g. http://loinc.org|2.56 Note that this is a generalization of the `system-version` parameter to the $expand operation to apply to any canonical resource, including code systems.
IN | checkCanonicalVersion |  | 0..* | canonical |  | Edge Case: Specifies a version to use for a canonical resource. If the artifact referencing the resource specifies a different version, an error is returned instead of the package. The format is the same as a canonical URL: [url]|[version] - e.g. http://loinc.org|2.56 Note that this is a generalization of the `check-system-version` parameter to the $expand operation to apply to any canonical resource, including code systems.
IN | forceCanonicalVersion |  | 0..* | canonical |  | Edge Case: Specifies a version to use for a canonical resource. This parameter overrides any specified version in the artifact (and any artifacts it depends on). The format is the same as a canonical URL: [system]|[version] - e.g. http://loinc.org|2.56. Note that this has obvious safety issues, in that it may result in a value set expansion giving a different list of codes that is both wrong and unsafe, and implementers should only use this capability reluctantly. It primarily exists to deal with situations where specifications have fallen into decay as time passes. If the version of a canonical is overriden, the version used SHALL explicitly be represented in the expansion parameters. Note that this is a generalization of the `force-system-version` parameter to the $expand operation to apply to any canonical resource, including code systems.
OUT | return |  | 1..1 | ValueSet |  | The result of the expansion. Servers generating expansions SHOULD ensure that all the parameters that affect the contents of the expansion are recorded in the ValueSet.expansion.parameter list