<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="POWER2DM-KADISFingerprintOrder" />
  <meta>
    <versionId value="1" />
    <lastUpdated value="2017-03-14T11:39:26.889+00:00" />
  </meta>
  <url value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-KADISFingerprintOrder" />
  <version value="0.1" />
  <name value="POWER2DM-KADISFingerprintOrder" />
  <display value="POWER2DM-KADISFingerprintOrder" />
  <status value="draft" />
  <publisher value="SRDC Corp." />
  <date value="2016-11-30T00:00:00+03:00" />
  <description value="Profiling to represent the order for KADIS Fingerprint identification (order from SMSS to KADIS) " />
  <kind value="resource" />
  <constrainedType value="Order" />
  <abstract value="false" />
  <base value="http://hl7.org/fhir/StructureDefinition/Order" />
  <snapshot>
    <element>
      <path value="Order" />
      <short value="A request to perform an action" />
      <definition value="A request to perform an action." />
      <alias value="Request" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Resource" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Order" />
      </type>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()" />
        </extension>
        <key value="dom-4" />
        <severity value="error" />
        <human value="If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated" />
        <xpath value="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="contained.where(('#'+id in %resource.descendants().reference).not()).empty()" />
        </extension>
        <key value="dom-3" />
        <severity value="error" />
        <human value="If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource" />
        <xpath value="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="contained.contained.empty()" />
        </extension>
        <key value="dom-2" />
        <severity value="error" />
        <human value="If the resource is contained in another resource, it SHALL NOT contain nested Resources" />
        <xpath value="not(parent::f:contained and f:contained)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="contained.text.empty()" />
        </extension>
        <key value="dom-1" />
        <severity value="error" />
        <human value="If the resource is contained in another resource, it SHALL NOT contain any narrative" />
        <xpath value="not(parent::f:contained and f:text)" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="Entity. Role, or Act" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="ControlAct[classCode=ACTN, moodCode=RQO]" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="workflow.order" />
      </mapping>
    </element>
    <element>
      <path value="Order.id" />
      <short value="Logical id of this artifact" />
      <definition value="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes." />
      <comments value="The only time that a resource does not have an id is when it is being submitted to the server using a create operation. Bundles always have an id, though it is usually a generated UUID." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="id" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.meta" />
      <short value="Metadata about the resource" />
      <definition value="The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.meta" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Meta" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.implicitRules" />
      <short value="A set of rules under which this content was created" />
      <definition value="A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content." />
      <comments value="Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element as much as possible." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.implicitRules" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="uri" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isModifier value="true" />
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.language" />
      <short value="Language of the resource content" />
      <definition value="The base language in which the resource is written." />
      <comments value="Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute)." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.language" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <binding>
        <strength value="required" />
        <description value="A human language." />
        <valueSetUri value="http://tools.ietf.org/html/bcp47" />
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.text" />
      <short value="Text summary of the resource, for human interpretation" />
      <definition value="A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it &quot;clinically safe&quot; for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." />
      <comments value="Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative." />
      <alias value="narrative" />
      <alias value="html" />
      <alias value="xhtml" />
      <alias value="display" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="DomainResource.text" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Narrative" />
      </type>
      <condition value="ele-1" />
      <condition value="dom-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="Act.text?" />
      </mapping>
    </element>
    <element>
      <path value="Order.contained" />
      <short value="Contained, inline Resources" />
      <definition value="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." />
      <comments value="This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again." />
      <alias value="inline resources" />
      <alias value="anonymous resources" />
      <alias value="contained resources" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.contained" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Resource" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value="Entity. Role, or Act" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.extension" />
      <short value="Additional Content defined by implementations" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
      <comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.modifierExtension" />
      <short value="Extensions that cannot be ignored" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
      <comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.modifierExtension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isModifier value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.identifier" />
      <short value="Identifiers assigned to this order by the orderer or by the receiver" />
      <definition value="Identifiers assigned to this order by the orderer or by the receiver." />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Order.identifier" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Identifier" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="CX / EI (occasionally, more often EI maps to a resource id or a URL)" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="II - see see identifier pattern at http://wiki.hl7.org/index.php?title=Common_Design_Patterns#Identifier_Pattern for relevant discussion. The Identifier class is a little looser than the v3 type II because it allows URIs as well as registered OIDs or GUIDs.  Also maps to Role[classCode=IDENT]" />
      </mapping>
      <mapping>
        <identity value="servd" />
        <map value="Identifier" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".id" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="id" />
      </mapping>
    </element>
    <element>
      <path value="Order.date" />
      <short value="When the order was made" />
      <definition value="When the order was made." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Order.date" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="dateTime" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="ORC-9" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=AUT].time" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="when.done" />
      </mapping>
    </element>
    <element>
      <path value="Order.subject" />
      <short value="Patient this order is about" />
      <definition value="Patient this order is about." />
      <comments value="May be left blank if the request reference identifies the patient, or if the request is not associated with a patient." />
      <alias value="Patient" />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Order.subject" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-Patient" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))" />
        </extension>
        <key value="ref-1" />
        <severity value="error" />
        <human value="SHALL have a local reference if the resource is provided inline" />
        <xpath value="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="The target of a resource reference is a RIM entry point (Act, Role, or Entity)" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="PID-3" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=SBJ].role[classCode=PAT]" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="who.focus" />
      </mapping>
    </element>
    <element>
      <path value="Order.source" />
      <short value="Who initiated the order" />
      <definition value="Who initiated the order." />
      <alias value="Author" />
      <alias value="Practitioner" />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Order.source" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-Practitioner" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))" />
        </extension>
        <key value="ref-1" />
        <severity value="error" />
        <human value="SHALL have a local reference if the resource is provided inline" />
        <xpath value="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="The target of a resource reference is a RIM entry point (Act, Role, or Entity)" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="ORC-12 / OBR-16 / RXO-14 / RXE-13 / PRT-5 (PRT-4-Participation='OP')" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=AUT].role" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="who.cause" />
      </mapping>
    </element>
    <element>
      <path value="Order.target" />
      <short value="Who is intended to fulfill the order" />
      <definition value="Who is intended to fulfill the order." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Order.target" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Reference" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-Organization" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))" />
        </extension>
        <key value="ref-1" />
        <severity value="error" />
        <human value="SHALL have a local reference if the resource is provided inline" />
        <xpath value="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="The target of a resource reference is a RIM entry point (Act, Role, or Entity)" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="Unclear: MSH-5 / IPC-7 / BPO-8 / RXO-32 / RXE-40 / RXD-30 / RXG-11 / RXG-27 / PRT-8 (PRT-4-participation in { 'AP', 'DP', 'PO', 'RT' })" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=PFM].role" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="who.actor" />
      </mapping>
    </element>
    <element>
      <path value="Order.reason[x]" />
      <short value="Text - why the order was made" />
      <definition value="Text - why the order was made." />
      <comments value="Not all terminology uses fit this general pattern. In some cases, models should not use CodeableConcept and use Coding directly and provide their own structure for managing text, codings, translations and the relationship between elements and pre- and post-coordination." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Order.reason[x]" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="Reference" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="example" />
        <description value="Indicates the reason for seeking fulfillment of the order." />
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="CE/CNE/CWE" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="CD" />
      </mapping>
      <mapping>
        <identity value="orim" />
        <map value="fhir:CodeableConcept rdfs:subClassOf dt:CD" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="ORC-16.2 / OBR-31.2 / BPO-13.2-BP / RXO-20.2 / RXE-27.2 / RXD-21.2 / RXG-22.2 / RXA-19.2" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".reasonCode or .outboundRelationship[typeCode=RSON].target" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="why" />
      </mapping>
    </element>
    <element>
      <path value="Order.when" />
      <short value="When order should be fulfilled" />
      <definition value="When order should be fulfilled." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Order.when" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="code.empty() or schedule.empty()" />
        </extension>
        <key value="ord-1" />
        <severity value="error" />
        <human value="Provide a code or a schedule, but not both" />
        <xpath value="exists(f:code) != exists(f:schedule)" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="TQ1, TQ2" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".effectiveTime" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.id" />
      <short value="xml:id (or equivalent in JSON)" />
      <definition value="unique id for the element within a resource (for internal references)." />
      <comments value="RFC 4122" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Element.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="id" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.extension" />
      <short value="Additional Content defined by implementations" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
      <comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Element.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.modifierExtension" />
      <short value="Extensions that cannot be ignored" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
      <comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <alias value="modifiers" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="BackboneElement.modifierExtension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isModifier value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.code" />
      <short value="Code specifies when request should be done. The code may simply be a priority code" />
      <definition value="Code specifies when request should be done. The code may simply be a priority code." />
      <comments value="This is usually a local code agreed in the context of the ordering workflow." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Order.when.code" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="CodeableConcept" />
      </type>
      <condition value="ele-1" />
      <condition value="ord-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="example" />
        <description value="When a requested action should be performed  (e.g. STAT, daily, evenings, etc.)." />
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="CE/CNE/CWE" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="CD" />
      </mapping>
      <mapping>
        <identity value="orim" />
        <map value="fhir:CodeableConcept rdfs:subClassOf dt:CD" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="GTS is a coded value" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule" />
      <short value="A formal schedule" />
      <definition value="A formal schedule." />
      <comments value="A timing schedule can be either a list of events - intervals on which the event occurs, or a single event with repeating criteria or just repeating criteria with no actual event.  When both event and a repeating specification are provided, the list of events should be understood as an interpretation of the information in the repeat structure." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Order.when.schedule" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Timing" />
      </type>
      <condition value="ele-1" />
      <condition value="ord-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="N/A" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="QSET&lt;TS&gt; (GTS)" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="GTS is a complex schedule" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="when.planned" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.id" />
      <short value="xml:id (or equivalent in JSON)" />
      <definition value="unique id for the element within a resource (for internal references)." />
      <comments value="RFC 4122" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Element.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="id" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.extension" />
      <short value="Additional Content defined by implementations" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
      <comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Element.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.event" />
      <short value="When the event occurs" />
      <definition value="Identifies specific times when the event occurs." />
      <requirements value="In an MAR, for instance, you need to take a general specification, and turn it into a precise specification." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Timing.event" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="dateTime" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="QLIST&lt;TS&gt;" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat" />
      <short value="When the event is to occur" />
      <definition value="A set of rules that describe when the event should occur." />
      <requirements value="Many timing schedules are determined by regular repetitions." />
      <min value="0" />
      <max value="0" />
      <base>
        <path value="Timing.repeat" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Element" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="period.exists() implies period &gt;= 0" />
        </extension>
        <key value="tim-5" />
        <severity value="error" />
        <human value="period SHALL be a non-negative value" />
        <xpath value="@value &gt;= 0 or not(@value)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="periodMax.empty() or period" />
        </extension>
        <key value="tim-6" />
        <severity value="error" />
        <human value="If there's a periodMax, there must be a period" />
        <xpath value="not(exists(f:periodMax)) or exists(f:period)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="durationMax.empty() or duration" />
        </extension>
        <key value="tim-7" />
        <severity value="error" />
        <human value="If there's a durationMax, there must be a duration" />
        <xpath value="not(exists(f:durationMax)) or exists(f:duration)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="duration.empty() or durationUnits" />
        </extension>
        <key value="tim-1" />
        <severity value="error" />
        <human value="if there's a duration, there needs to be duration units" />
        <xpath value="not(exists(f:duration)) or exists(f:durationUnits)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="period.empty() or periodUnits" />
        </extension>
        <key value="tim-2" />
        <severity value="error" />
        <human value="if there's a period, there needs to be period units" />
        <xpath value="not(exists(f:period)) or exists(f:periodUnits)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="((period or frequency) and when).not()" />
        </extension>
        <key value="tim-3" />
        <severity value="error" />
        <human value="Either frequency or when can exist, not both" />
        <xpath value="not((f:period or f:frequency) and f:when)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="duration.exists() implies duration &gt;= 0" />
        </extension>
        <key value="tim-4" />
        <severity value="error" />
        <human value="duration SHALL be a non-negative value" />
        <xpath value="@value &gt;= 0 or not(@value)" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="Implies PIVL or EIVL" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.id" />
      <short value="xml:id (or equivalent in JSON)" />
      <definition value="unique id for the element within a resource (for internal references)." />
      <comments value="RFC 4122" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Element.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="id" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.extension" />
      <short value="Additional Content defined by implementations" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
      <comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Element.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.bounds[x]" />
      <name value="Duration" />
      <short value="Length/Range of lengths, or (Start and/or end) limits" />
      <definition value="Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule." />
      <comments 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="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.bounds[x]" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Quantity" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Duration" />
      </type>
      <type>
        <code value="Range" />
      </type>
      <type>
        <code value="Period" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="code.empty() or system" />
        </extension>
        <key value="qty-3" />
        <severity value="error" />
        <human value="If a code for the unit is present, the system SHALL also be present" />
        <xpath value="not(exists(f:code)) or exists(f:system)" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="(code or value.empty()) and (system.empty() or system = %ucum)" />
        </extension>
        <key value="drt-1" />
        <severity value="error" />
        <human value="There SHALL be a code if there is a value and it SHALL be an expression of time.  If system is present, it SHALL be UCUM." />
        <xpath value="(f:code or not(f:value)) and (not(exists(f:system)) or f:system/@value='http://unitsofmeasure.org')" />
      </constraint>
      <isModifier value="false" />
      <isSummary value="true" />
      <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>
      <mapping>
        <identity value="rim" />
        <map value="IVL(TS) used in a QSI" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.count" />
      <short value="Number of times to repeat" />
      <definition value="A total count of the desired number of repetitions." />
      <comments value="If you have both bounds and count, then this should be understood as within the bounds period, until count times happens." />
      <requirements value="Repetitions may be limited by end time or total occurrences." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.count" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="integer" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.count" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.duration" />
      <short value="How long when it happens" />
      <definition value="How long this thing happens for when it happens." />
      <comments value="For some events the duration is part of the definition of the event (e.g. IV infusions, where the duration is implicit in the specified quantity and rate). For others, it's part of the timing specification (e.g. exercise)." />
      <requirements value="Some activities are not instantaneous and need to be maintained for a period of time." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.duration" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="decimal" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase / EIVL.offset" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.durationMax" />
      <short value="How long when it happens (Max)" />
      <definition value="The upper limit of how long this thing happens for when it happens." />
      <comments value="For some events the duration is part of the definition of the event (e.g. IV infusions, where the duration is implicit in the specified quantity and rate). For others, it's part of the timing specification (e.g. exercise)." />
      <requirements value="Some activities are not instantaneous and need to be maintained for a period of time." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.durationMax" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="decimal" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase / EIVL.offset" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.durationUnits" />
      <short value="s | min | h | d | wk | mo | a - unit of time (UCUM)" />
      <definition value="The units of time for the duration, in UCUM units." />
      <comments value="Note that FHIR strings may not exceed 1MB in size" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.durationUnits" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="required" />
        <description value="A unit of time (units from UCUM)." />
        <valueSetReference>
          <reference value="http://hl7.org/fhir/ValueSet/units-of-time" />
        </valueSetReference>
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase.unit" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.frequency" />
      <short value="Event occurs frequency times per period" />
      <definition value="The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided)." />
      <comments value="32 bit number; for values larger than this, use decimal" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.frequency" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="integer" />
      </type>
      <defaultValueInteger value="1" />
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase / EIVL.offset" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.frequencyMax" />
      <short value="Event occurs up to frequencyMax times per period" />
      <definition value="If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range." />
      <comments value="32 bit number; for values larger than this, use decimal" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.frequencyMax" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="integer" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.period" />
      <short value="Event occurs frequency times per period" />
      <definition value="Indicates the duration of time over which repetitions are to occur; e.g. to express &quot;3 times per day&quot;, 3 would be the frequency and &quot;1 day&quot; would be the period." />
      <comments value="Do not use a IEEE type floating point type, instead use something that works like a true decimal, with inbuilt precision (e.g. Java BigInteger)" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.period" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="decimal" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.periodMax" />
      <short value="Upper limit of period (3-4 hours)" />
      <definition value="If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as &quot;do this once every 3-5 days." />
      <comments value="Do not use a IEEE type floating point type, instead use something that works like a true decimal, with inbuilt precision (e.g. Java BigInteger)" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.periodMax" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="decimal" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.periodUnits" />
      <short value="s | min | h | d | wk | mo | a - unit of time (UCUM)" />
      <definition value="The units of time for the period in UCUM units." />
      <comments value="Note that FHIR strings may not exceed 1MB in size" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.periodUnits" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="required" />
        <description value="A unit of time (units from UCUM)." />
        <valueSetReference>
          <reference value="http://hl7.org/fhir/ValueSet/units-of-time" />
        </valueSetReference>
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PIVL.phase.unit" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.repeat.when" />
      <short value="Regular life events the event is tied to" />
      <definition value="A real world event that the occurrence of the event should be tied to." />
      <comments value="Note that FHIR strings may not exceed 1MB in size" />
      <requirements value="Timings are frequently determined by occurrences such as waking, eating and sleep." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Timing.repeat.when" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="required" />
        <description value="Real world event that the relating to the schedule." />
        <valueSetReference>
          <reference value="http://hl7.org/fhir/ValueSet/event-timing" />
        </valueSetReference>
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="EIVL.event" />
      </mapping>
    </element>
    <element>
      <path value="Order.when.schedule.code" />
      <short value="QD | QOD | Q4H | Q6H | BID | TID | QID | AM | PM +" />
      <definition value="A code for the timing pattern. Some codes such as BID are ubiquitous, but many institutions define their own additional codes." />
      <comments value="A repeat should always be defined except for the common codes BID, TID, QID, AM and PM, which all systems are required to understand." />
      <min value="0" />
      <max value="0" />
      <base>
        <path value="Timing.code" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="CodeableConcept" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="preferred" />
        <description value="Code for a known / defined timing pattern." />
        <valueSetReference>
          <reference value="http://hl7.org/fhir/ValueSet/timing-abbreviation" />
        </valueSetReference>
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="CE/CNE/CWE" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="CD" />
      </mapping>
      <mapping>
        <identity value="orim" />
        <map value="fhir:CodeableConcept rdfs:subClassOf dt:CD" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="QSC.code" />
      </mapping>
    </element>
    <element>
      <path value="Order.detail" />
      <short value="What action is being ordered" />
      <definition value="What action is being ordered." />
      <min value="1" />
      <max value="*" />
      <base>
        <path value="Order.detail" />
        <min value="1" />
        <max value="*" />
      </base>
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-KADISBaselineDataset" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="*" />
        </extension>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
          <valueString value="reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))" />
        </extension>
        <key value="ref-1" />
        <severity value="error" />
        <human value="SHALL have a local reference if the resource is provided inline" />
        <xpath value="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="The target of a resource reference is a RIM entry point (Act, Role, or Entity)" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=SUBJ].target" />
      </mapping>
    </element>
  </snapshot>
  <differential>
    <element>
      <path value="Order" />
      <type>
        <code value="Order" />
      </type>
    </element>
    <element>
      <path value="Order.date" />
      <min value="1" />
    </element>
    <element>
      <path value="Order.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-Patient" />
      </type>
    </element>
    <element>
      <path value="Order.source" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-Practitioner" />
      </type>
    </element>
    <element>
      <path value="Order.target" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-Organization" />
      </type>
    </element>
    <element>
      <path value="Order.when" />
      <min value="1" />
    </element>
    <element>
      <path value="Order.when.schedule" />
      <min value="1" />
    </element>
    <element>
      <path value="Order.when.schedule.event" />
      <min value="1" />
      <max value="1" />
    </element>
    <element>
      <path value="Order.when.schedule.repeat" />
      <max value="0" />
    </element>
    <element>
      <path value="Order.when.schedule.code" />
      <max value="0" />
    </element>
    <element>
      <path value="Order.detail" />
      <type>
        <code value="Reference" />
        <profile value="http://www.power2dm.eu/pds/StructureDefinition/POWER2DM-KADISBaselineDataset" />
      </type>
    </element>
  </differential>
</StructureDefinition>