<?xml version="1.0" encoding="UTF-8"?>

<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="ValueSet-expand"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p class="res-header-id">
        <b>Generated Narrative: OperationDefinition ValueSet-expand</b>
      </p>
      <a name="ValueSet-expand"> </a>
      <a name="hcValueSet-expand"> </a>
      <p>URL: [base]/ValueSet/$expand</p>
      <p>URL: [base]/ValueSet/[id]/$expand</p>
      <h3>Parameters</h3>
      <table class="grid">
        <tr>
          <td>
            <b>Use</b>
          </td>
          <td>
            <b>Name</b>
          </td>
          <td>
            <b>Scope</b>
          </td>
          <td>
            <b>Cardinality</b>
          </td>
          <td>
            <b>Type</b>
          </td>
          <td>
            <b>Binding</b>
          </td>
          <td>
            <b>Documentation</b>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>url</td>
          <td>type</td>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#uri">uri</a>
          </td>
          <td/>
          <td>
            <div>
              <p>A reference to the canonical URL of 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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>valueSet</td>
          <td>type</td>
          <td>0..1</td>
          <td>
            <a href="valueset.html">ValueSet</a>
          </td>
          <td/>
          <td>
            <div>
              <p>The value set is provided directly as part of the request. Servers may choose not to accept value sets in this fashion</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>valueSetVersion</td>
          <td>type</td>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#string">string</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>context</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#uri">uri</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>contextDirection</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#code">code</a>
          </td>
          <td/>
          <td>
            <div>
              <p>If a context is provided, a context direction may also be provided. Valid values are:</p>

              <ul>

                <li>'incoming': the codes a client can use for PUT/POST operations,  and</li>

                <li>'outgoing', the codes a client might receive from the server.</li>

              </ul>

              <p>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)</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>filter</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#string">string</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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 
                <a href="terminologycapabilities.html">TerminologyCapabilities</a>..expansion.textFilter. Typical usage of this parameter includes functionality like:
              </p>

              <ul>

                <li>using left matching e.g. &quot;acut ast&quot;</li>

                <li>allowing for wild cards such as %, &amp;, ?</li>

                <li>searching on definition, designations and display(s)</li>

                <li>allowing for search conditions (and / or / exclusions)</li>

              </ul>

              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>filterProperty</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#code">code</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Properties to be considered when matching against the filter text in addition to display, definition and designations, etc. The properties must have a string representation, e.g. string, code, or url, though the search is always text based irrespective of the property type.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>date</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#dateTime">dateTime</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>offset</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#integer">integer</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Paging support - where to start if a subset is desired (default = 0). Offset is number of records (not number of pages)</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>count</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#integer">integer</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>includeDesignations</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Controls whether concept designations are to be included or excluded in value set expansions</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>designation</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#string">string</a>
          </td>
          <td/>
          <td>
            <div>
              <p>A 
                <a href="search.html#token">token</a> 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
              </p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>includeDefinition</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Controls whether the value set definition is included or excluded in value set expansions. This includes all elements of the ValueSet, including extensions, with the exception that the 
                <code>id</code> and 
                <code>meta</code> elements would be specific to the expansion, not to the definition value set, and the expansion itself is filled out.
              </p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>activeOnly</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>useSupplement</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>The supplement must be used when performing an expansion. Use of this parameter should result in $expand behaving the same way as if the supplements were included in the value set definition using the 
                <a href="https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-valueset-supplement.html">ValueSet Supplement</a>
              </p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>excludeNested</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Controls whether or not the value set expansion may nest codes or not (i.e. ValueSet.expansion.contains.contains). If excludeNested is set to true, the expansion MUST be flat (no nesting). If excludeNested is set to false (default),  however, nesting is possible but not required</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>excludeNotForUI</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Controls whether or not the value set expansion might include</p>

              <ul>

                <li>codes from the CodeSystem with a notSelectable property set to true as specified in 
                  <a href="codesystem.html#status">status</a> and in 
                  <a href="codesystem-concept-properties.html">Concept Properties</a>
                </li>

                <li>nested contains with no code (see 
                  <a href="valueset-definitions.html#ValueSet.expansion.contains.code">Contains</a>)
                </li>

                <li>nested contains in the ValueSet with 
                  <a href="valueset-definitions.html#ValueSet.expansion.contains.abstract">abstract = true</a>
                </li>

              </ul>

              <p>One purpose of such concepts is helping a user navigate through the list efficiently. If excludeNotForUI is set to true, the concepts as described above will be excluded from the expansion. If excludeNotForUI is set to false (default), all concepts as described above may be part of the expansion. In the FHIR Specification itself, the value set expansions are generated with excludeNotForUI = false, and the expansions used when generating schema / code etc., or performing validation, are all excludeNotForUI = true.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>excludePostCoordinated</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Controls whether or not the value set expansion includes post coordinated codes</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>displayLanguage</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#code">code</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Specifies the language to be used for description in the expansions i.e. the language to be used for ValueSet.expansion.contains.display</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>property</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#string">string</a>
          </td>
          <td/>
          <td>
            <div>
              <p>A request to return a particular property in the expansion. The returned property may include subproperties. May be either a code from the code system definition (convenient) or a the formal URI that refers to the property. Note that property names can clash, so using a URI is recommended. The special value '*' means all properties and their sub-properties known to the server</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>handle-unclosed-expansion</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>If true this asserts that you will correctly handle an unclosed expansion and the returned expansion SHALL include the valueset-unclosed extension if the value set is unclosed.  If handle-unclosed-expansion is set to false the server SHALL return an error if the value set is unclosed.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>exclude-system</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>system-version</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>check-system-version</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>force-system-version</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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 overridden, the version used SHALL explicitly be represented in the expansion parameters</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>default-valueset-version</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Specifies a version to use for a valueset, if the reference to the value set does not specify which version to use. The format is the same as a canonical URL: [system]|[version] - e.g. http://example.org/ValueSet/example|1.0.0. Note that this is similar to the force-system-version parameter but applied to valuesets</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>check-valueset-version</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Edge Case: Specifies a version to use for a valueset. If a reference to 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://example.org/ValueSet/example|1.0.0. Note that this is similar to the force-system-version parameter but applied to valuesets</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>force-valueset-version</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>Edge Case: Specifies a version to use for a valueset. This parameter overrides any specified version in the reference to the value set (and any it depends on). The format is the same as a canonical URL: [system]|[version] - e.g. http://example.org/ValueSet/example|1.0.0. 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 overridden, the version used SHALL explicitly be represented in the expansion parameters. Note that this is similar to the force-system-version parameter but applied to valuesets.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>manifest</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a> (
            <a href="library.html" title="http://hl7.org/fhir/StructureDefinition/Library">Library</a>)
          </td>
          <td/>
          <td>
            <div>
              <p>Specifies an library that provides expansion rules for the operation. The library has an extension expansionParameters that references a contained Parameters resource that contains additional $expand parameters. See the [CRMI specification description of manifests]https://hl7.org/fhir/uv/crmi/STU1/StructureDefinition-crmi-manifestlibrary.html) and 
                <a href="https://hl7.org/fhir/uv/crmi/STU1/artifact-terminology-service.html#expansion-rules">CRMI expansion rules</a> 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.
              </p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>tx-resource</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="resource.html">Resource</a>
          </td>
          <td/>
          <td>
            <div>
              <p>One or more additional resources that are referred to from the value set provided with the $expand or $validate-code invocation. These may be additional value sets or code systems that the client believes will or may be necessary to perform the operation. Resources provided in this fashion are used preferentially to those known to the system, though servers may return an error if these resources are already known to the server (by URL and version) but differ from that information on the server.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>OUT</td>
          <td>return</td>
          <td/>
          <td>1..1</td>
          <td>
            <a href="valueset.html">ValueSet</a>
          </td>
          <td/>
          <td>
            <div>
              <p>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</p>

            </div>
          </td>
        </tr>
      </table>
      <div>
        <p>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.</p>

        <p>When available, ValueSet.status and ValueSet.version from the ValueSet resource instance which contains the definition SHALL be persisted to the ValueSet resource instance which contains the expansion.</p>

        <p>If the expansion is too large (at the discretion of the server), the server MAY return an error (OperationOutcome with code too-costly). 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, or use the count parameter to request a subset of the expansion for limited purposes.</p>

        <p>If a server does not support paging, and doesn't have the capability to return the complete expansion, the server:</p>

        <ul>

          <li>SHALL return an OperationOutcome.issue of too-costly</li>

        </ul>

        <p>If a server does support paging:</p>

        <ul>

          <li>The server SHALL support both the offset and count parameters, and SHOULD provide the total element to indicate the total size of the expansion.</li>

          <li>The client SHALL consider the result a page if no 
            <code>total</code> element is present.
          </li>

        </ul>

        <p>Hierarchical expansions are not subject to paging and servers simply return the entire expansion.</p>

        <p>Different servers may return different results from expanding a value set for the following reasons:</p>

        <ul>

          <li>The underlying code systems are different (e.g. different versions, possibly with different defined behavior)</li>

          <li>The server optimizes filter includes differently, such as sorting by code frequency</li>

          <li>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</li>

        </ul>

        <p>When a server cannot correctly expand a value set because it does not fully understand the code systems (e.g. it has the wrong version, or incomplete definitions) then it SHALL return an error. If the value set is unbounded or incomplete, the extension 
          <a href="https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-valueset-unclosed.html">ValueSet Unclosed</a> can be used to indicate that the expansion is incomplete or unbounded.
        </p>

      </div>
    </div>
  </text>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="5"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="normative"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="vocab"/>
  </extension>
  <url value="http://hl7.org/fhir/OperationDefinition/ValueSet-expand"/>
  <version value="6.0.0-ballot4"/>
  <name value="Expand"/>
  <title value="Value Set Expansion"/>
  <status value="active"/>
  <kind value="operation"/>
  <experimental value="false"/>
  <date value="2026-07-08T21:11:00+00:00"/>
  <publisher value="HL7 International / Terminology Infrastructure"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://hl7.org/fhir"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="fhir@lists.hl7.org"/>
    </telecom>
  </contact>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/Vocab"/>
    </telecom>
  </contact>
  <description value="The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation. &#xA;&#xA;If the operation is not called at the instance level, one of the in parameters url, context or valueSet must be provided.  An expanded value set will be returned, or an OperationOutcome with an error message.&#xA;&#xA;Implementers should note that additional requirements are made on terminology servers that wish to be part of the public HL7 terminology ecosystem in the [FHIR Terminology Ecosystem IG](https://hl7.org/fhir/uv/tx-ecosystem/)."/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
      <display value="World"/>
    </coding>
  </jurisdiction>
  <affectsState value="false"/>
  <code value="expand"/>
  <comment value="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.  &#xA;&#xA;When available, ValueSet.status and ValueSet.version from the ValueSet resource instance which contains the definition SHALL be persisted to the ValueSet resource instance which contains the expansion.   &#xA;&#xA;If the expansion is too large (at the discretion of the server), the server MAY return an error (OperationOutcome with code too-costly). 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, or use the count parameter to request a subset of the expansion for limited purposes.  &#xA;&#xA;If a server does not support paging, and doesn't have the capability to return the complete expansion, the server: &#xA;* SHALL return an OperationOutcome.issue of too-costly &#xA;&#xA;If a server does support paging: &#xA;* The server SHALL support both the offset and count parameters, and SHOULD provide the total element to indicate the total size of the expansion. &#xA;* The client SHALL consider the result a page if no `total` element is present. &#xA;&#xA;Hierarchical expansions are not subject to paging and servers simply return the entire expansion.  &#xA;&#xA;Different servers may return different results from expanding a value set for the following reasons:  &#xA;&#xA;* The underlying code systems are different (e.g. different versions, possibly with different defined behavior) &#xA;* The server optimizes filter includes differently, such as sorting by code frequency &#xA;* 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&#xA;&#xA;When a server cannot correctly expand a value set because it does not fully understand the code systems (e.g. it has the wrong version, or incomplete definitions) then it SHALL return an error. If the value set is unbounded or incomplete, the extension [ValueSet Unclosed](https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-valueset-unclosed.html) can be used to indicate that the expansion is incomplete or unbounded."/>
  <resource value="ValueSet"/>
  <system value="false"/>
  <type value="true"/>
  <instance value="true"/>
  <parameter>
    <name value="url"/>
    <use value="in"/>
    <scope value="type"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="A reference to the canonical URL of 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"/>
    <type value="uri"/>
  </parameter>
  <parameter>
    <name value="valueSet"/>
    <use value="in"/>
    <scope value="type"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="The value set is provided directly as part of the request. Servers may choose not to accept value sets in this fashion"/>
    <type value="ValueSet"/>
  </parameter>
  <parameter>
    <name value="valueSetVersion"/>
    <use value="in"/>
    <scope value="type"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="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."/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="context"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="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"/>
    <type value="uri"/>
  </parameter>
  <parameter>
    <name value="contextDirection"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="If a context is provided, a context direction may also be provided. Valid values are: &#xA;&#xA;* 'incoming': the codes a client can use for PUT/POST operations,  and &#xA;* 'outgoing', the codes a client might receive from the server.&#xA;&#xA;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)"/>
    <type value="code"/>
  </parameter>
  <parameter>
    <name value="filter"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="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](terminologycapabilities.html)..expansion.textFilter. Typical usage of this parameter includes functionality like:&#xA;&#xA;* using left matching e.g. &quot;acut ast&quot;&#xA;* allowing for wild cards such as %, &amp;, ?&#xA;* searching on definition, designations and display(s)&#xA;* allowing for search conditions (and / or / exclusions)&#xA;&#xA;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"/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="filterProperty"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Properties to be considered when matching against the filter text in addition to display, definition and designations, etc. The properties must have a string representation, e.g. string, code, or url, though the search is always text based irrespective of the property type."/>
    <type value="code"/>
  </parameter>
  <parameter>
    <name value="date"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="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."/>
    <type value="dateTime"/>
  </parameter>
  <parameter>
    <name value="offset"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Paging support - where to start if a subset is desired (default = 0). Offset is number of records (not number of pages)"/>
    <type value="integer"/>
  </parameter>
  <parameter>
    <name value="count"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="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"/>
    <type value="integer"/>
  </parameter>
  <parameter>
    <name value="includeDesignations"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Controls whether concept designations are to be included or excluded in value set expansions"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="designation"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="A [token](search.html#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"/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="includeDefinition"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Controls whether the value set definition is included or excluded in value set expansions. This includes all elements of the ValueSet, including extensions, with the exception that the `id` and `meta` elements would be specific to the expansion, not to the definition value set, and the expansion itself is filled out."/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="activeOnly"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="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"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="useSupplement"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="The supplement must be used when performing an expansion. Use of this parameter should result in $expand behaving the same way as if the supplements were included in the value set definition using the [ValueSet Supplement](https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-valueset-supplement.html)"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="excludeNested"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Controls whether or not the value set expansion may nest codes or not (i.e. ValueSet.expansion.contains.contains). If excludeNested is set to true, the expansion MUST be flat (no nesting). If excludeNested is set to false (default),  however, nesting is possible but not required"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="excludeNotForUI"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Controls whether or not the value set expansion might include&#xD;&#xA;&#xD;&#xA;* codes from the CodeSystem with a notSelectable property set to true as specified in [status](codesystem.html#status) and in [Concept Properties](codesystem-concept-properties.html)&#xD;&#xA;* nested contains with no code (see [Contains](valueset-definitions.html#ValueSet.expansion.contains.code))&#xD;&#xA;* nested contains in the ValueSet with [abstract = true](valueset-definitions.html#ValueSet.expansion.contains.abstract)&#xD;&#xA;&#xD;&#xA;One purpose of such concepts is helping a user navigate through the list efficiently. If excludeNotForUI is set to true, the concepts as described above will be excluded from the expansion. If excludeNotForUI is set to false (default), all concepts as described above may be part of the expansion. In the FHIR Specification itself, the value set expansions are generated with excludeNotForUI = false, and the expansions used when generating schema / code etc., or performing validation, are all excludeNotForUI = true."/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="excludePostCoordinated"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Controls whether or not the value set expansion includes post coordinated codes"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="displayLanguage"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Specifies the language to be used for description in the expansions i.e. the language to be used for ValueSet.expansion.contains.display"/>
    <type value="code"/>
  </parameter>
  <parameter>
    <name value="property"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="A request to return a particular property in the expansion. The returned property may include subproperties. May be either a code from the code system definition (convenient) or a the formal URI that refers to the property. Note that property names can clash, so using a URI is recommended. The special value '*' means all properties and their sub-properties known to the server"/>
    <type value="string"/>
  </parameter>
  <parameter>
    <name value="handle-unclosed-expansion"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="If true this asserts that you will correctly handle an unclosed expansion and the returned expansion SHALL include the valueset-unclosed extension if the value set is unclosed.  If handle-unclosed-expansion is set to false the server SHALL return an error if the value set is unclosed."/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="exclude-system"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="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"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="system-version"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="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"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="check-system-version"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="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"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="force-system-version"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="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 overridden, the version used SHALL explicitly be represented in the expansion parameters"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="default-valueset-version"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Specifies a version to use for a valueset, if the reference to the value set does not specify which version to use. The format is the same as a canonical URL: [system]|[version] - e.g. http://example.org/ValueSet/example|1.0.0. Note that this is similar to the force-system-version parameter but applied to valuesets"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="check-valueset-version"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Edge Case: Specifies a version to use for a valueset. If a reference to 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://example.org/ValueSet/example|1.0.0. Note that this is similar to the force-system-version parameter but applied to valuesets"/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="force-valueset-version"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Edge Case: Specifies a version to use for a valueset. This parameter overrides any specified version in the reference to the value set (and any it depends on). The format is the same as a canonical URL: [system]|[version] - e.g. http://example.org/ValueSet/example|1.0.0. 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 overridden, the version used SHALL explicitly be represented in the expansion parameters. Note that this is similar to the force-system-version parameter but applied to valuesets."/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="manifest"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Specifies an library that provides expansion rules for the operation. The library has an extension expansionParameters that references a contained Parameters resource that contains additional $expand parameters. See the [CRMI specification description of manifests]https://hl7.org/fhir/uv/crmi/STU1/StructureDefinition-crmi-manifestlibrary.html) and [CRMI expansion rules](https://hl7.org/fhir/uv/crmi/STU1/artifact-terminology-service.html#expansion-rules) 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."/>
    <type value="canonical"/>
    <targetProfile value="http://hl7.org/fhir/StructureDefinition/Library"/>
  </parameter>
  <parameter>
    <name value="tx-resource"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="One or more additional resources that are referred to from the value set provided with the $expand or $validate-code invocation. These may be additional value sets or code systems that the client believes will or may be necessary to perform the operation. Resources provided in this fashion are used preferentially to those known to the system, though servers may return an error if these resources are already known to the server (by URL and version) but differ from that information on the server."/>
    <type value="Resource"/>
  </parameter>
  <parameter>
    <name value="return"/>
    <use value="out"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="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"/>
    <type value="ValueSet"/>
  </parameter>
</OperationDefinition>