<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="dexcom-egvs" />
  <url value="http://nictiz.nl/fhir/StructureDefinition/vitalsign-bloodglucose" />
  <version value="1.0" />
  <name value="EGVS" />
  <title value="EGVS" />
  <status value="active" />
  <publisher value="Nictiz" />
  <contact>
    <name value="Anay" />
    <telecom>
      <system value="email" />
      <value value="info@nictiz.nl" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="This profile represents a single blood glucose self measurement based on the seven-point scale (SMBG)." />
  <copyright value="CC0" />
  <fhirVersion value="3.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="http://nictiz.nl/fhir/StructureDefinition/zib-LaboratoryTestResult-Observation" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation">
      <path value="Observation" />
    </element>
    <element id="Observation.extension">
      <path value="Observation.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <constraint>
        <key value="bg-1" />
        <severity value="error" />
        <human value="Observation.code SHALL have at least one coding based on LOINC" />
        <expression value="coding.where(system = 'http://loinc.org').exists()" />
        <xpath value="f:coding[f:system/@value = 'http://loinc.org']" />
      </constraint>
    </element>
    <element id="Observation.code.coding">
      <path value="Observation.code.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="code" />
        </discriminator>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Observation.component:egvs">
      <path value="Observation.component" />
      <sliceName value="egvs" />
      <definition value="array of egv values" />
    </element>
    <element id="Observation.component.egvs.trend:trend">
      <path value="Observation.component.egvs" />
      <sliceName value="trend" />
      <definition value="Shows the trend of glucose values" />
      <max value="1" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="Observation.component.egvs.component:systemTime">
      <path value="Observation.component.egvs" />
      <sliceName value="systemTime" />
      <definition value="Shows the system time and date" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element id="Observation.component.egvs.component:displayTime">
      <path value="Observation.component.egvs" />
      <sliceName value="displayTime" />
      <definition value="Shows list of egvs" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element id="Observation.component.egvs.component:realtimeVlaue">
      <path value="Observation.component.egvs" />
      <sliceName value="realtimeVlaue" />
      <definition value="Shows the system time and date" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element id="Observation.component.egvs.status:status">
      <path value="Observation.component.egvs" />
      <sliceName value="readingstatus" />
      <definition value="status of the current reading" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element id="Observation.component.egvs.component:smoothedValue">
      <path value="Observation.component.egvs" />
      <sliceName value="smoothedValue" />
      <definition value="Estimated glucose value presented retrospectively on receiving device after smoothing; G6 devices only" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element id="Observation.component.egvs.component:trendRate">
      <path value="Observation.component.egvs" />
      <sliceName value="trendRate" />
      <definition value="Rate at which glucose value is moving up or down" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
  </differential>
</StructureDefinition>