<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="set-context-output-parameters" />
  <text>
    <status value="additional" />
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p>Referenced within the <code>$set-context</code> OperationDefinition in the <a href="https://hl7.org/fhir/r4/operationdefinition-definitions.html#OperationDefinition.outputProfile">OperationDefinition.outputProfile</a> element, this profile provides additional constraints on the <a href="https://hl7.org/fhir/r4/Parameters.html">Parameters</a> resource returned in the response to an invocation of the operation. While the <a href="https://hl7.org/fhir/r4/OperationDefinition.html">OperationDefinition</a> resource typically allows for sufficient rule definition, FHIR R4 imposes a limitation: <code>Rule: A targetProfile can only be specified for parameters of type Reference or Canonical</code> (i.e., resource-typed parameters cannot be profiled using the <a href="https://hl7.org/fhir/r4/operationdefinition-definitions.html#OperationDefinition.parameter.targetProfile">OperationDefinition.parameter.targetProfile</a> element). This limitation was addressed in FHIR R5 to accommodate such use cases, but for FHIR R4, the SetContextOutputParameters profile ensures that the <code>resourcesResponse</code> Bundle parameter in the response for <code>$set-context</code> is restricted to Bundles conforming to the SetContextTransactionResponseBundle profile.</p>
    </div>
  </text>
  <url value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-output-parameters" />
  <name value="SetContextOutputParameters" />
  <status value="draft" />
  <description value="A profile capturing more nuanced rules for the output Parameters resource returned by the $set-context operation that cannot be captured within the OperationDefinition itself." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Parameters" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Parameters" />
  <derivation value="constraint" />
  <differential>
    <element id="Parameters.parameter">
      <path value="Parameters.parameter" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="name" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Parameters.parameter:launchID">
      <path value="Parameters.parameter" />
      <sliceName value="launchID" />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="Parameters.parameter:launchID.name">
      <path value="Parameters.parameter.name" />
      <fixedString value="launchID" />
    </element>
    <element id="Parameters.parameter:launchID.value[x]">
      <path value="Parameters.parameter.value[x]" />
      <min value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="Parameters.parameter:launchID.resource">
      <path value="Parameters.parameter.resource" />
      <max value="0" />
    </element>
    <element id="Parameters.parameter:launchID.part">
      <path value="Parameters.parameter.part" />
      <max value="0" />
    </element>
    <element id="Parameters.parameter:outcome">
      <path value="Parameters.parameter" />
      <sliceName value="outcome" />
      <min value="1" />
      <max value="*" />
    </element>
    <element id="Parameters.parameter:outcome.name">
      <path value="Parameters.parameter.name" />
      <fixedString value="outcome" />
    </element>
    <element id="Parameters.parameter:outcome.value[x]">
      <path value="Parameters.parameter.value[x]" />
      <max value="0" />
    </element>
    <element id="Parameters.parameter:outcome.resource">
      <path value="Parameters.parameter.resource" />
      <type>
        <code value="OperationOutcome" />
      </type>
    </element>
    <element id="Parameters.parameter:outcome.part">
      <path value="Parameters.parameter.part" />
      <max value="0" />
    </element>
    <element id="Parameters.parameter:resourcesResponse">
      <path value="Parameters.parameter" />
      <sliceName value="resourcesResponse" />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="Parameters.parameter:resourcesResponse.name">
      <path value="Parameters.parameter.name" />
      <fixedString value="resourcesResponse" />
    </element>
    <element id="Parameters.parameter:resourcesResponse.value[x]">
      <path value="Parameters.parameter.value[x]" />
      <max value="0" />
    </element>
    <element id="Parameters.parameter:resourcesResponse.resource">
      <path value="Parameters.parameter.resource" />
      <min value="1" />
      <type>
        <code value="Bundle" />
        <profile value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-transaction-response-bundle" />
      </type>
    </element>
    <element id="Parameters.parameter:resourcesResponse.part">
      <path value="Parameters.parameter.part" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>