{
  "resourceType": "StructureDefinition",
  "meta": {
    "lastUpdated": "2017-12-08T10:24:29.234+00:00"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "oo"
    }
  ],
  "url": "http://pchalliance.org/phdfhir/StructureDefinition/PhdCodedEnumerationObservation",
  "name": "PhdCodedEnumerationObservation",
  "status": "draft",
  "date": "2017-06-02T18:29:52.39367+00:00",
  "description": "Base StructureDefinition for Observation Resource representing measurement data coming from a medical device where the measurement itself is an enumerated code.",
  "fhirVersion": "3.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://pchalliance.org/phdfhir/StructureDefinition/PhdBaseObservation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "definition": "The PhdCodedEnumerationObservation reports PHD measurements that contain a Enum-Observed-Value-Simple-OID attribute.",
        "comment": "This type of measurement is used when the Personal Health Device reports a measurement as an IEEE 11073 10101 code. An example would be the most recent meal context associated with a glucose measurement such as 'breakfast', 'fasting', 'snack', etc. The list of codes for these meal options is finite."
      },
      {
        "id": "Observation.meta",
        "path": "Observation.meta",
        "min": 1
      },
      {
        "id": "Observation.meta.profile",
        "path": "Observation.meta.profile",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "PhdCodedEnumerationObservation"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Observation.meta.profile:phdProfile",
        "path": "Observation.meta.profile",
        "sliceName": "phdProfile",
        "min": 1,
        "max": "1",
        "fixedUri": "PhdCodedEnumerationObservation"
      },
      {
        "id": "Observation.identifier",
        "path": "Observation.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "value"
            }
          ],
          "ordered": true,
          "rules": "open"
        }
      },
      {
        "id": "Observation.identifier:conditionalCreateIdentifier",
        "path": "Observation.identifier",
        "sliceName": "conditionalCreateIdentifier",
        "short": "Unique identifier of this measurment for a given patient and device",
        "definition": "An identifier created from a combination of the measurement parameters like sensor time stamp, type code, enumeration OID code, patient and device identifiers, and selected elements of any facet component elements.",
        "comment": "This value is used in the conditional create to prevent data duplication. PHDs will often re-send already sent data for a variety of reasons. This element is required unless the metric measurement contains no time stamp or is a measurement containing a time stamp that is real time. By real time the time stamp reported by the PHD must be later than the current time reported by the PHD before any measurements are received. Temporarily stored data from IEEE 11073 20601 devices, which are required to delete the data after sending, can also be considered real time. Temporarily stored data from Bluetooth Low Energy Health devices may be resent so these cannot be considered as real time.",
        "requirements": "Allows observations to be distinguished in a selective enough manner to prevent resource duplication.",
        "max": "1"
      },
      {
        "id": "Observation.identifier:conditionalCreateIdentifier.value",
        "path": "Observation.identifier.value",
        "min": 1
      },
      {
        "id": "Observation.status",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint",
            "valueString": "default: final"
          }
        ],
        "path": "Observation.status",
        "comment": "The value shall be set to 'final' unless a Measurement-Status attribute or Enum-Observed-Value attribute, representing an OID, status field indicates that the measurement is preliminary. In that case this field shall be set to 'preliminary'"
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "comment": "For Enumeration OID measurements, none will fall into the category of vital signs so a LOINC encoding is never necessary in this profile."
      },
      {
        "id": "Observation.code.coding:11073Type",
        "path": "Observation.code.coding",
        "sliceName": "11073Type",
        "comment": "For 11073-20601 metric enumeration measurements, this code is obtained from one or more of the Type, Metric-Id, Enum-Observed-Value.metric, and Metric-Id-Partition attributes. The algorithm to get the 16-bit partition and 16-bit term code is as follows:\r\n\r\n1. The partition and term code are obtained from the Type attribute.\r\n2. If there is a Metric-Id attribute the term code comes from this attribute.\r\n3. If there is a Enum-Observed-Value attribute the term code comes from this attribute.\r\n4. If the term code is NOT from the Type attribute, and there is a Metric-Id-Partition attribute, the partition comes from this attribute.\r\n5. The 32-bit 11073-10101 code value is given by partition * 2 **16 + term code.\r\n\r\nIt is this value that is placed in the code.coding.code element for this 11073Type slice"
      },
      {
        "id": "Observation.value[x]:valueCodeableConcept",
        "path": "Observation.valueCodeableConcept",
        "sliceName": "valueCodeableConcept",
        "definition": "The information determined as a result of making the observation, if the information is a code.",
        "min": 1,
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "Observation.value[x]:valueCodeableConcept.coding",
        "path": "Observation.valueCodeableConcept.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "ordered": true,
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Observation.value[x]:valueCodeableConcept.coding:11073Value",
        "path": "Observation.valueCodeableConcept.coding",
        "sliceName": "11073Value",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Observation.valueCodeableConcept.coding:11073Value.system",
        "path": "Observation.valueCodeableConcept.coding.system",
        "min": 1,
        "fixedUri": "urn:iso:std:iso:11073:10101"
      },
      {
        "id": "Observation.valueCodeableConcept.coding:11073Value.code",
        "path": "Observation.valueCodeableConcept.coding.code",
        "min": 1
      },
      {
        "id": "Observation.dataAbsentReason",
        "path": "Observation.dataAbsentReason",
        "definition": "Provides a reason why the expected value in the element Observation.valueCodeableConcept is missing. This would be an error condition indicated by the Measurement-Status attribute.",
        "comment": "The current values in the http://hl7.org/fhir/data-absent-reason system do not provide the same detailed set of options reported in the Measurement-Status. In those cases one uses the generic 'error' code if the error is 'fatal'. The measurementStatusComponent can be used to report more specific information."
      },
      {
        "id": "Observation.dataAbsentReason.coding.system",
        "path": "Observation.dataAbsentReason.coding.system",
        "min": 1
      },
      {
        "id": "Observation.dataAbsentReason.coding.code",
        "path": "Observation.dataAbsentReason.coding.code",
        "min": 1
      }
    ]
  }
}