{
  "resourceType": "StructureDefinition",
  "meta": {
    "lastUpdated": "2017-12-14T09:24:35.475+00:00"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "oo"
    }
  ],
  "url": "http://pchalliance.org/phdfhir/StructureDefinition/PhdBitsEnumerationObservation",
  "name": "PhdBitsEnumerationObservation",
  "status": "draft",
  "date": "2017-06-02T18:29:52.39367+00:00",
  "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 PhdBitsEnumerationObservation reports PHD measurements that contain a Enum-Observed-Value-Simple-Bit-Str or Enum-Observed-Value-Basic-Bit-Str attribute.",
        "comment": "This type of measurement is used when the Personal Health Device reports a measurement as an IEEE 11073 10101 BITs value. This measurement is a complex representation where each bit means something. In many cases only certain bits are defined and it is generally true that the significant case is when the bit has been set. Given that measurement could result in up to 32 component entries (one for each bit) only set bits are required to be reported. Some specializations have used this measurement type when they should have used IEEE 10101 codes."
      },
      {
        "id": "Observation.meta",
        "path": "Observation.meta",
        "min": 1
      },
      {
        "id": "Observation.meta.profile",
        "path": "Observation.meta.profile",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "PhdBitsEnumerationObservation"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Observation.meta.profile:phdProfile",
        "path": "Observation.meta.profile",
        "sliceName": "phdProfile",
        "min": 1,
        "max": "1",
        "fixedUri": "PhdBitsEnumerationObservation"
      },
      {
        "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 BITs integer, 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 a BITs value, 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 BITs 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]",
        "path": "Observation.value[x]",
        "comment": "The values are reported in Observation.component elements.",
        "max": "0"
      },
      {
        "id": "Observation.dataAbsentReason",
        "path": "Observation.dataAbsentReason",
        "definition": "Provides a reason why there are Observation.component elements reporting the BITs values present. This would be due to 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
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "slicing": {
          "ordered": true,
          "rules": "open"
        }
      },
      {
        "id": "Observation.component:bitsComponent",
        "path": "Observation.component",
        "sliceName": "bitsComponent",
        "short": "BITs setting entry components",
        "definition": "Each bitsComponent contains one of the bits settings as code from the BITs measurement. These entries are NOT present if a Measurement-Status attribute indicates an error.",
        "comment": "A BITs measurement is a measurement where each BIT means something, such as a device status where many status situations may be reported.",
        "requirements": "Handles a measurement that may be represented by several different settings."
      },
      {
        "id": "Observation.component:bitsComponent.code.coding",
        "path": "Observation.component.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Observation.component:bitsComponent.code.coding:ASN1Type",
        "path": "Observation.component.code.coding",
        "sliceName": "ASN1Type",
        "short": "The ANS1 BITs code for the measurement",
        "comment": "For BITs measurements, this code is an alpha-numeric string created from the code reported in the Observation.code.coding:11073Type.code followed by a dot (.) followed by the MDER bit being reported. For example, the CGM Device status measurement code is 8418060. If the value reported in the BITs field is 0001 1000 0000 0000 the MDER bits set are bits 3 and 4. Note that MDER bit 0 is the HIGH order bit. Bit 3 means 'sensor malfunction' and bit 4 means 'device specific alert'. THis measurement would require two component elements and one would be 8418060.3 and the other would be 8418060.4. Note these are alphas-numeric strings and not decimal numbers. If one took the code 8418060.3 and looked it up in the ASN1 Bits vocabulary one would find it meant 'sensor malfunctioned'.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Observation.component:bitsComponent.code.coding:ASN1Type.system",
        "path": "Observation.component.code.coding.system",
        "comment": "This value is a placeholder until the correct reference URL is registered.",
        "min": 1,
        "fixedUri": "http://hl7.org/fhir/IEEE.ASN1"
      },
      {
        "id": "Observation.component:bitsComponent.code.coding:ASN1Type.code",
        "path": "Observation.component.code.coding.code",
        "definition": "A symbol in syntax defined by the IEEE ASN1 system.",
        "min": 1
      },
      {
        "id": "Observation.component:bitsComponent.value[x]:valueCodeableConcept",
        "path": "Observation.component.valueCodeableConcept",
        "sliceName": "valueCodeableConcept",
        "definition": "The information determined as a result of making the observation, if the information is a code.",
        "comment": "If the application wishes to report an unsupported setting, this element is absent and the dataAbsentReason is used to report the condition.",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "Observation.component:bitsComponentComponent.value[x]:valueCodeableConcept.coding",
        "path": "Observation.component.valueCodeableConcept.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "ordered": true,
          "rules": "open"
        }
      },
      {
        "id": "Observation.component:bitsComponentComponent.value[x]:valueCodeableConcept.coding:v2BinaryValue",
        "path": "Observation.component.valueCodeableConcept.coding",
        "sliceName": "v2BinaryValue",
        "min": 1
      },
      {
        "id": "Observation.component:bitsComponentComponent.value[x]:valueCodeableConcept.coding:v2BinaryValue.system",
        "path": "Observation.component.valueCodeableConcept.coding.system",
        "min": 1,
        "fixedUri": "http://hl7.org/fhir/v2/0136"
      },
      {
        "id": "Observation.component:bitsComponentComponent.value[x]:valueCodeableConcept.coding:v2BinaryValue.code",
        "path": "Observation.component.valueCodeableConcept.coding.code",
        "definition": "If the bit is set this code is 'Y' and 'N' if the bit is cleared. Only set bits are required to be reported. If the bit is unsupported, the dataAbsentReason code \"unsupported' is used. Unsupported bits are optional to report.",
        "min": 1
      },
      {
        "id": "Observation.component:bitsComponent.dataAbsentReason",
        "path": "Observation.component.dataAbsentReason",
        "definition": "Provides a reason why the expected value in the element Observation.component.value[x] is missing. In this profile for this component that happens if the PHD does not support this bit and the uploader wishes to report that situation."
      },
      {
        "id": "Observation.component:bitsComponent.dataAbsentReason.coding",
        "path": "Observation.component.dataAbsentReason.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Observation.component:bitsComponent.dataAbsentReason.coding.system",
        "path": "Observation.component.dataAbsentReason.coding.system",
        "min": 1
      },
      {
        "id": "Observation.component:bitsComponent.dataAbsentReason.coding.code",
        "path": "Observation.component.dataAbsentReason.coding.code",
        "definition": "Indicates the bit is not supported by the device",
        "min": 1,
        "fixedCode": "unsupported"
      }
    ]
  }
}