<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="zib-TimeInterval" />
  <text>
    <status value="empty" />
    <div xmlns="http://www.w3.org/1999/xhtml">No narrative is provided for definitional resources. A human-readable rendering can be found in the implementation guide(s) where this resource is used.</div>
  </text>
  <url value="http://nictiz.nl/fhir/StructureDefinition/zib-TimeInterval" />
  <name value="ZibTimeInterval" />
  <title value="zib TimeInterval" />
  <status value="draft" />
  <publisher value="Nictiz" />
  <contact>
    <name value="Nictiz" />
    <telecom>
      <system value="url" />
      <value value="https://www.nictiz.nl" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="A time interval indicates the time between two moments in time. Interval can be defined by a start time and end time, start time and duration or duration and end time." />
  <purpose value="This Period datatype profile is one of the three StructureDefinitions that can be used to represent the Dutch (partial) [zib ('Zorginformatiebouwsteen', i.e. Health and Care Information Model) TimeInterval v1.0 (2020)](https://zibs.nl/wiki/TimeInterval-v1.0(2020EN)). &#xD;&#xA;&#xD;&#xA;This zib is represented in FHIR by a combination of two datatypes: _Period_ and _Duration_. To support this zib across different FHIR resource types, three related StructureDefinitions are provided:&#xD;&#xA;&#xD;&#xA;* [ext-TimeInterval.Duration](http://nictiz.nl/fhir/StructureDefinition/ext-TimeInterval.Duration): extension to provide the _Duration_ datatype to resource types where no element with this datatype is normally available. This exentions should not be used in isolation, but only via one of the two resources described below!&#xD;&#xA;* [zib-TimeInterval](http://nictiz.nl/fhir/StructureDefinition/zib-TimeInterval) (this profile): profile on the _Period_ datatype that defines mappings to zib TimeInterval and brings in the ext-TimeInterval.Duration extension mentioned above. For resource types that natively support an element of the _Period_ datatype but not of the _Duration_ datatype, this profile should be used.&#xD;&#xA;* [ext-TimeInterval.Period](http://nictiz.nl/fhir/StructureDefinition/ext-TimeInterval.Period): extension to provide the _Period_ datatype plus the _Duration_ extension mentioned above, with mappings to zib TimeInterval. For resource types that support neither elements of datatype _Period_ or _Duration_, this extension should be used. *Note*: In hindsight the name of this extension is confusing, 'ext-TimeInterval' would have been better suited.&#xD;&#xA;* *Note*: when the resource type natively supports elements of datatype _Period_ and _Duration_, the zib should be mapped onto these elements directly." />
  <copyright value="Copyright and related rights waived via CC0, https://creativecommons.org/publicdomain/zero/1.0/. This does not apply to information from third parties, for example a medical terminology system. The implementer alone is responsible for identifying and obtaining any necessary licenses or authorizations to utilize third party IP in connection with the specification or otherwise." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="zib-timeinterval-v1.0-2020EN" />
    <uri value="https://zibs.nl/wiki/TimeInterval-v1.0(2020EN)" />
    <name value="zib TimeInterval-v1.0(2020EN)" />
  </mapping>
  <kind value="complex-type" />
  <abstract value="true" />
  <type value="Period" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Period" />
  <derivation value="constraint" />
  <snapshot>
    <element id="Period">
      <path value="Period" />
      <short value="TimeInterval" />
      <definition value="A time period defined by a start and end date and optionally time." />
      <comment value="A Period specifies a range of time; the context of use will specify whether the entire range applies (e.g. &quot;the patient was an inpatient of the hospital for this time range&quot;) or one value from the range applies (e.g. &quot;give to the patient between these two times&quot;).&#xA;&#xA;Period is not used for a duration (a measure of elapsed time). See [Duration](datatypes.html#Duration)." />
      <alias value="TijdsInterval" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Period" />
        <min value="0" />
        <max value="*" />
      </base>
      <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="per-1" />
        <severity value="error" />
        <human value="If present, start SHALL have a lower value than end" />
        <expression value="start.hasValue().not() or end.hasValue().not() or (start &lt;= end)" />
        <xpath value="not(exists(f:start/@value)) or not(exists(f:end/@value)) or (xs:dateTime(f:start/@value) &lt;= xs:dateTime(f:end/@value))" />
        <source value="http://hl7.org/fhir/StructureDefinition/Period" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="DR" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="IVL&lt;TS&gt;[lowClosed=&quot;true&quot; and highClosed=&quot;true&quot;] or URG&lt;TS&gt;[lowClosed=&quot;true&quot; and highClosed=&quot;true&quot;]" />
      </mapping>
      <mapping>
        <identity value="zib-timeinterval-v1.0-2020EN" />
        <map value="NL-CM:20.3.1" />
        <comment value="TimeInterval" />
      </mapping>
    </element>
    <element id="Period.id">
      <path value="Period.id" />
      <representation value="xmlAttr" />
      <short value="Unique id for inter-element referencing" />
      <definition value="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Element.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type">
          <valueUrl value="string" />
        </extension>
        <code value="http://hl7.org/fhirpath/System.String" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element id="Period.extension">
      <path value="Period.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <description value="Extensions are always sliced by (at least) url" />
        <rules value="open" />
      </slicing>
      <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. 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 can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
      <comment 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>
        <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="ext-1" />
        <severity value="error" />
        <human value="Must have either extensions or value[x], not both" />
        <expression value="extension.exists() != value.exists()" />
        <xpath value="exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])" />
        <source value="http://hl7.org/fhir/StructureDefinition/Extension" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element id="Period.extension:duration">
      <path value="Period.extension" />
      <sliceName value="duration" />
      <short value="Optional Extensions Element" />
      <definition value="Optional Extension Element - found in all resources." />
      <comment 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="1" />
      <base>
        <path value="Element.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-TimeInterval.Duration" />
      </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="ext-1" />
        <severity value="error" />
        <human value="Must have either extensions or value[x], not both" />
        <expression value="extension.exists() != value.exists()" />
        <xpath value="exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])" />
        <source value="http://hl7.org/fhir/StructureDefinition/Extension" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element id="Period.start">
      <path value="Period.start" />
      <short value="startDateTime" />
      <definition value="The start date and time of the interval." />
      <comment value="If the low element is missing, the meaning is that the low boundary is not known." />
      <alias value="startDatumTijd" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Period.start" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="dateTime" />
      </type>
      <condition value="ele-1" />
      <condition value="per-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>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="DR.1" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="./low" />
      </mapping>
      <mapping>
        <identity value="zib-timeinterval-v1.0-2020EN" />
        <map value="NL-CM:20.3.2" />
        <comment value="startDateTime" />
      </mapping>
    </element>
    <element id="Period.end">
      <path value="Period.end" />
      <short value="endDateTime" />
      <definition value="The end date and time of the interval." />
      <comment value="The high value includes any matching date/time. i.e. 2012-02-03T10:00:00 is in a period that has an end value of 2012-02-03." />
      <alias value="eindDatumTijd" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Period.end" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="dateTime" />
      </type>
      <meaningWhenMissing value="If the end of the period is missing, it means that the period is ongoing" />
      <condition value="ele-1" />
      <condition value="per-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>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="DR.2" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="./high" />
      </mapping>
      <mapping>
        <identity value="zib-timeinterval-v1.0-2020EN" />
        <map value="NL-CM:20.3.3" />
        <comment value="endDateTime" />
      </mapping>
    </element>
  </snapshot>
  <differential>
    <element id="Period">
      <path value="Period" />
      <short value="TimeInterval" />
      <alias value="TijdsInterval" />
      <mapping>
        <identity value="zib-timeinterval-v1.0-2020EN" />
        <map value="NL-CM:20.3.1" />
        <comment value="TimeInterval" />
      </mapping>
    </element>
    <element id="Period.extension:duration">
      <path value="Period.extension" />
      <sliceName value="duration" />
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-TimeInterval.Duration" />
      </type>
    </element>
    <element id="Period.start">
      <path value="Period.start" />
      <short value="startDateTime" />
      <definition value="The start date and time of the interval." />
      <alias value="startDatumTijd" />
      <mapping>
        <identity value="zib-timeinterval-v1.0-2020EN" />
        <map value="NL-CM:20.3.2" />
        <comment value="startDateTime" />
      </mapping>
    </element>
    <element id="Period.end">
      <path value="Period.end" />
      <short value="endDateTime" />
      <definition value="The end date and time of the interval." />
      <alias value="eindDatumTijd" />
      <mapping>
        <identity value="zib-timeinterval-v1.0-2020EN" />
        <map value="NL-CM:20.3.3" />
        <comment value="endDateTime" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>