<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="medication-supplyQuantity" />
  <url value="http://hl7.org/fhir/StructureDefinition/medication-supplyQuantity" />
  <version value="4.0" />
  <name value="medication-supplyQuantity" />
  <title value="Supply Quantity" />
  <status value="draft" />
  <publisher value="Orion Health" />
  <description value="Indicates the supply quantity of a medication" />
  <purpose value="This extension indicates the supply quantity of a medication and is used on resource types that would not normally have a supply quantity but the data provider has knowledge of this information" />
  <fhirVersion value="4.0" />
  <kind value="complex-type" />
  <abstract value="false" />
  <type value="Extension" />
  <snapshot>
    <element id="Extension">
      <path value="Extension" />
      <max value="1" />
      <base>
        <path value="Extension" />
        <max value="1" />
      </base>
    </element>
    <element id="Extension.url">
      <path value="Extension.url" />
      <base>
        <path value="Extension.url" />
      </base>
      <fixedUri value="http://hl7.org/fhir/StructureDefinition/medication-supplyQuantity" />
    </element>
    <element id="Extension.value[x]">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="normative" />
      </extension>
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version">
        <valueCode value="4.0.0" />
      </extension>
      <path value="Extension.value[x]" />
      <short value="Indicates the supply quantity of a medication" />
      <definition value="Set the supply quantity value" />
      <comment value="The context of use may frequently define what kind of quantity this is and therefore what kind of units can be used. The context of use may also restrict the values for the comparator." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Extension.value[x]" />
        <min value="1" />
        <max value="1" />
      </base>
      <type>
        <code value="Quantity" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <constraint>
        <key value="qty-3" />
        <severity value="error" />
        <human value="If a code for the unit is present, the system SHALL also be present" />
        <expression value="code.empty() or system.exists()" />
        <xpath value="not(exists(f:code)) or exists(f:system)" />
        <source value="http://hl7.org/fhir/StructureDefinition/Quantity" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="SN (see also Range) or CQ" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PQ, IVL&lt;PQ&gt;, MO, CO, depending on the values" />
      </mapping>
    </element>
  </snapshot>
  <differential>
    <element id="Extension">
      <path value="Extension" />
      <max value="1" />
    </element>
    <element id="Extension.url">
      <path value="Extension.url" />
      <fixedUri value="http://hl7.org/fhir/StructureDefinition/medication-supplyQuantity" />
    </element>
    <element id="Extension.value[x]">
      <path value="Extension.value[x]" />
      <short value="Indicates the supply quantity of a medication" />
      <definition value="Set the supply quantity value" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
  </differential>
</StructureDefinition>