{
  "resourceType": "StructureDefinition",
  "id": "fiphr-sd-bloodglucose",
  "meta": {
    "versionId": "2",
    "lastUpdated": "2023-03-02T10:22:22.4520081+00:00"
  },
  "url": "http://phr.kanta.fi/StructureDefinition/fiphr-sd-bloodglucose",
  "version": "1.0.0",
  "name": "FIPHRSDBloodglucose",
  "title": "Finnish PHR Blood Glucose profile",
  "status": "active",
  "experimental": false,
  "description": "Finnish PHR profile for blood glucose measurement.",
  "purpose": "Finnish PHR profile for Observation used in blood glucose measurements. The profile is based on the Finnish PHR observation profile.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://phr.kanta.fi/StructureDefinition/fiphr-sd-vitalsigns",
  "derivation": "constraint",
  "snapshot": {},
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "short": "Finnish PHR Blood Glucose profile",
        "definition": "Finnish PHR profile for Observation used in blood glucose measurements. The profile is based on the Finnish PHR observation profile.",
        "comment": ".",
        "constraint": [
          {
            "key": "PHR-1",
            "severity": "error",
            "human": "Resource SHALL contain code '15074-8' or '14743-9' or '14745-4'",
            "expression": "(code.coding.where(code='15074-8').exists()) or (code.coding.where(code='14743-9').exists()) or (code.coding.where(code='14745-4').exists())"
          },
          {
            "key": "PHR-2",
            "severity": "error",
            "human": "When using code '15074-8' also code '14743-9' SHALL be used",
            "expression": "code.coding.where(code='15074-8').exists() implies code.coding.where(code='14743-9').exists()"
          },
          {
            "key": "PHR-3",
            "severity": "error",
            "human": "When using code '14743-9' also code '15074-8' SHALL be used",
            "expression": "code.coding.where(code='14743-9').exists() implies code.coding.where(code='15074-8').exists()"
          }
        ]
      },
      {
        "id": "Observation.meta",
        "path": "Observation.meta"
      },
      {
        "id": "Observation.meta.profile",
        "path": "Observation.meta.profile"
      },
      {
        "id": "Observation.meta.profile:fiphrProfile",
        "path": "Observation.meta.profile",
        "sliceName": "fiphrProfile",
        "fixedCanonical": "http://phr.kanta.fi/StructureDefinition/fiphr-sd-bloodglucose"
      },
      {
        "id": "Observation.extension",
        "path": "Observation.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 0
      },
      {
        "id": "Observation.extension:hoursAfterMeal",
        "path": "Observation.extension",
        "sliceName": "hoursAfterMeal",
        "short": "Meal context",
        "definition": "Meal context, how many hours after meal measurement is done.",
        "requirements": "Meal context needed for result interpretation.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://phr.kanta.fi/StructureDefinition/fiphr-unsignedint"
            ]
          }
        ]
      },
      {
        "id": "Observation.code.coding",
        "path": "Observation.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "code"
            },
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "short": "Code to be used with CGM readings",
        "definition": "This code SHALL be used with CGM readings.",
        "comment": "This code SHALL be used with CGM readings. Ordering of codings is undefined and SHALL NOT be used to infer meaning.",
        "min": 1,
        "constraint": [
          {
            "key": "PHR-1",
            "severity": "error",
            "human": "When using code '15074-8' or '14743-9' or '14745-4' system http://loinc.org SHALL be used",
            "expression": "(where(code='15074-8').exists()) or (where(code='14743-9').exists()) or (where(code='14745-4').exists()) implies where(system=\"http://loinc.org\").exists()"
          }
        ]
      },
      {
        "id": "Observation.code.coding:GlucoseInBlood",
        "path": "Observation.code.coding",
        "sliceName": "GlucoseInBlood",
        "max": "1"
      },
      {
        "id": "Observation.code.coding:GlucoseInBlood.system",
        "path": "Observation.code.coding.system",
        "min": 1,
        "fixedUri": "http://loinc.org"
      },
      {
        "id": "Observation.code.coding:GlucoseInBlood.code",
        "path": "Observation.code.coding.code",
        "min": 1,
        "fixedCode": "15074-8"
      },
      {
        "id": "Observation.code.coding:GlucoseInBlood.display",
        "path": "Observation.code.coding.display",
        "min": 1
      },
      {
        "id": "Observation.code.coding:GlucoseInCapillaryBloodByGlucometer",
        "path": "Observation.code.coding",
        "sliceName": "GlucoseInCapillaryBloodByGlucometer",
        "max": "1"
      },
      {
        "id": "Observation.code.coding:GlucoseInCapillaryBloodByGlucometer.system",
        "path": "Observation.code.coding.system",
        "min": 1,
        "fixedUri": "http://loinc.org"
      },
      {
        "id": "Observation.code.coding:GlucoseInCapillaryBloodByGlucometer.code",
        "path": "Observation.code.coding.code",
        "min": 1,
        "fixedCode": "14743-9"
      },
      {
        "id": "Observation.code.coding:GlucoseInCapillaryBloodByGlucometer.display",
        "path": "Observation.code.coding.display",
        "min": 1
      },
      {
        "id": "Observation.code.coding:GlucoseInBodyFluid",
        "path": "Observation.code.coding",
        "sliceName": "GlucoseInBodyFluid",
        "max": "1"
      },
      {
        "id": "Observation.code.coding:GlucoseInBodyFluid.system",
        "path": "Observation.code.coding.system",
        "min": 1,
        "fixedUri": "http://loinc.org"
      },
      {
        "id": "Observation.code.coding:GlucoseInBodyFluid.code",
        "path": "Observation.code.coding.code",
        "min": 1,
        "fixedCode": "14745-4"
      },
      {
        "id": "Observation.code.coding:GlucoseInBodyFluid.display",
        "path": "Observation.code.coding.display",
        "min": 1
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Observation.effective[x]:effectiveDateTime",
        "path": "Observation.effective[x]",
        "sliceName": "effectiveDateTime"
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "short": "FinnishPHR: Glucose in blood",
        "definition": "FinnishPHR: Glucose in blood",
        "type": [
          {
            "code": "Quantity"
          }
        ]
      },
      {
        "id": "Observation.value[x].extension",
        "path": "Observation.value[x].extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 0
      },
      {
        "id": "Observation.value[x].extension:alternativeQuantity",
        "path": "Observation.value[x].extension",
        "sliceName": "alternativeQuantity",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://phr.kanta.fi/StructureDefinition/fiphr-ext-pq-translation"
            ]
          }
        ]
      },
      {
        "id": "Observation.value[x].extension:alternativeQuantity.value[x].system",
        "path": "Observation.value[x].extension.value[x].system",
        "fixedUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Observation.value[x].value",
        "path": "Observation.value[x].value",
        "min": 1
      },
      {
        "id": "Observation.value[x].unit",
        "path": "Observation.value[x].unit",
        "min": 1,
        "fixedString": "mmol/l"
      },
      {
        "id": "Observation.value[x].system",
        "path": "Observation.value[x].system",
        "min": 1,
        "fixedUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Observation.value[x].code",
        "path": "Observation.value[x].code",
        "min": 1,
        "fixedCode": "mmol/L"
      },
      {
        "id": "Observation.dataAbsentReason",
        "path": "Observation.dataAbsentReason",
        "definition": "Provides a reason why the expected value in the element Observation.value[x] is missing. \r\nFinnish PHR: Codes 'astext' and 'error' are allowed, no other codes.",
        "comment": "Finnish PHR: Code 'error' SHALL be used when a device has been actively trying to measure the blood glucose but has failed for some reason. Code 'astext' SHALL be used when the measured value cannot be stored using the valueQuantity structure (with the comparator). In this case, the value SHALL be presented in the resource narrative. No other codes are allowed."
      },
      {
        "id": "Observation.dataAbsentReason.coding",
        "path": "Observation.dataAbsentReason.coding",
        "min": 1
      },
      {
        "id": "Observation.dataAbsentReason.coding.code",
        "path": "Observation.dataAbsentReason.coding.code",
        "comment": "Note that FHIR strings may not exceed 1MB in size. \r\nFinnish PHR: Code 'error' SHALL be used when a device has been actively trying to measure the blood glucose but has failed for some reason. Code 'astext' SHALL be used when the measured value cannot be stored using the valueQuantity structure (with the comparator). In this case, the value SHALL be presented in the resource narrative. No other codes are allowed."
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "max": "0"
      }
    ]
  }
}