{
  "resourceType": "StructureDefinition",
  "id": "ie-core-pulse-oximetry",
  "url": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-pulse-oximetry",
  "name": "IECorePulseOximetry",
  "title": "IE Core Pulse Oximetry",
  "status": "draft",
  "description": "Records pulse oximetry (SpO2) observations with optional flow rate and concentration components in the Irish healthcare context.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-vital-signs",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "59408-5",
              "system": "http://loinc.org",
              "display": "Oxygen saturation in Arterial blood by Pulse oximetry"
            }
          ]
        }
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "type": [
          {
            "code": "Quantity"
          }
        ]
      },
      {
        "id": "Observation.value[x].value",
        "path": "Observation.value[x].value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.value[x].unit",
        "path": "Observation.value[x].unit",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.value[x].system",
        "path": "Observation.value[x].system",
        "min": 1,
        "patternUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Observation.value[x].code",
        "path": "Observation.value[x].code",
        "min": 1,
        "patternCode": "%"
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Observation.component:flowRate",
        "path": "Observation.component",
        "sliceName": "flowRate",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Observation.component:flowRate.code",
        "path": "Observation.component.code",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "3151-8",
              "system": "http://loinc.org",
              "display": "Inhaled oxygen flow rate"
            }
          ]
        }
      },
      {
        "id": "Observation.component:flowRate.value[x]",
        "path": "Observation.component.value[x]",
        "type": [
          {
            "code": "Quantity"
          }
        ]
      },
      {
        "id": "Observation.component:flowRate.value[x].value",
        "path": "Observation.component.value[x].value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.component:flowRate.value[x].unit",
        "path": "Observation.component.value[x].unit",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.component:flowRate.value[x].system",
        "path": "Observation.component.value[x].system",
        "min": 1,
        "patternUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Observation.component:flowRate.value[x].code",
        "path": "Observation.component.value[x].code",
        "min": 1,
        "patternCode": "L/min"
      },
      {
        "id": "Observation.component:concentration",
        "path": "Observation.component",
        "sliceName": "concentration",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Observation.component:concentration.code",
        "path": "Observation.component.code",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "3150-0",
              "system": "http://loinc.org",
              "display": "Inhaled oxygen concentration"
            }
          ]
        }
      },
      {
        "id": "Observation.component:concentration.value[x]",
        "path": "Observation.component.value[x]",
        "type": [
          {
            "code": "Quantity"
          }
        ]
      },
      {
        "id": "Observation.component:concentration.value[x].value",
        "path": "Observation.component.value[x].value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.component:concentration.value[x].unit",
        "path": "Observation.component.value[x].unit",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.component:concentration.value[x].system",
        "path": "Observation.component.value[x].system",
        "min": 1,
        "patternUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Observation.component:concentration.value[x].code",
        "path": "Observation.component.value[x].code",
        "min": 1,
        "patternCode": "%"
      }
    ]
  }
}