<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="shr-core-GeneralizedDateTime-extension" />
  <text>
    <status value="generated" />
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p>
        <b>SHR GeneralizedDateTime Extension</b>
      </p>
      <p>A point in time, specified qualitatively or quantitatively.</p>
    </div>
  </text>
  <url value="http://standardhealthrecord.org/fhir/StructureDefinition/shr-core-GeneralizedDateTime-extension" />
  <identifier>
    <system value="http://standardhealthrecord.org" />
    <value value="shr.core.GeneralizedDateTime" />
  </identifier>
  <version value="0.0.1" />
  <name value="SHR GeneralizedDateTime Extension" />
  <title value="SHR GeneralizedDateTime Extension" />
  <status value="draft" />
  <date value="2017-12-20" />
  <publisher value="The MITRE Corporation: Standard Health Record Collaborative" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://standardhealthrecord.org" />
    </telecom>
  </contact>
  <description value="A point in time, specified qualitatively or quantitatively." />
  <fhirVersion value="3.0.1" />
  <kind value="complex-type" />
  <abstract value="false" />
  <contextType value="resource" />
  <context value="*" />
  <type value="Extension" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" />
  <derivation value="constraint" />
  <differential>
    <element id="Extension:generalizeddatetime">
      <path value="Extension" />
      <short value="SHR GeneralizedDateTime Extension" />
      <definition value="A point in time, specified qualitatively or quantitatively." />
      <min value="0" />
      <max value="*" />
      <constraint>
        <key value="choice-1" />
        <severity value="error" />
        <human value="shr-core-GeneralizedDateTime-extension SHALL have either extension('datetime') or extension('timeperiod') or extension('qualitativedatetime')" />
        <expression value="( extension('datetime').url | extension('timeperiod').url | extension('qualitativedatetime').url ).distinct().count() == 1" />
      </constraint>
    </element>
    <element id="Extension:generalizeddatetime.extension:datetime">
      <path value="Extension.extension" />
      <sliceName value="datetime" />
      <definition value="A point in time, specified qualitatively or quantitatively." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://standardhealthrecord.org/fhir/StructureDefinition/primitive-dateTime-extension" />
      </type>
    </element>
    <element id="Extension:generalizeddatetime.extension:timeperiod">
      <path value="Extension.extension" />
      <sliceName value="timeperiod" />
      <definition value="A period of time defined by a start and end time, date, or year. If the start element is missing, the start of the period is not known. If the end element is missing, it means that the period is ongoing, or the start may be in the past, and the end date in the future, which means that period is expected/planned to end at the specified time. The end value includes any matching date/time. For example, the period 2011-05-23 to 2011-05-27 includes all the times from the start of the 23rd May through to the end of the 27th of May." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://standardhealthrecord.org/fhir/StructureDefinition/shr-core-TimePeriod-extension" />
      </type>
    </element>
    <element id="Extension:generalizeddatetime.extension:qualitativedatetime">
      <path value="Extension.extension" />
      <sliceName value="qualitativedatetime" />
      <definition value="A point in time, described qualitatively." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://standardhealthrecord.org/fhir/StructureDefinition/shr-core-QualitativeDateTime-extension" />
      </type>
    </element>
    <element id="Extension:generalizeddatetime.url">
      <path value="Extension.url" />
      <type>
        <code value="uri" />
      </type>
      <fixedUri value="http://standardhealthrecord.org/fhir/StructureDefinition/shr-core-GeneralizedDateTime-extension" />
    </element>
    <element id="Extension:generalizeddatetime.value[x]">
      <path value="Extension.value[x]" />
      <min value="0" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>