CGM flags
This section describes how each flag coming from Confidence has to be handled in FHIR
In Confidence the flags are denoted by integers. There can be 0 or more flags associated with each CGM value. In order to retain the enumeration from Confidence in case they need to restore data, the flags are received and stored in the extension Observation. ext - flags (http://roche.com/fhir/rdc/StructureDefinition/flags). If there are more than one flags set for a CGM value we will get a sum of the 2 integers. Below is the enumeration for flags in Confidence.
- LO = 1
- HI = 2
- TempHI = 4
- TempLO = 8
- DeviceFault = 16
- BatteryEmpty = 32
- SensorMalfunction = 64
- CalibrationRequired = 128
- RateOfChangeMin = 256
- RateOfChangeMax = 512
- InvalidValue = 1024
- TypeIncorrectForDevice = 2048
- DeviceSpecificAlert = 4096
- CalibrationNotAllowed = 8192
- CalibrationRecommended = 16384
- SessionStopped = 32768
- SensorRateDecreaseExceeded = 65536
- SensorRateIncreaseExceeded = 131072
For example, if LO (1), BatteryEmpty (32) and RateOfChangeMin (256) is set then in the flags extension we will get 1 + 32 + 256 = 289.
In FHIR however, we have a different way of managing these flags. If its an error/warning from the device we have a separate EWM Observation. The facade needs to therefore create the relevant resources additionally before ingesting to FHIRSTACK. The facade needs to convert the flag value to binary and decipher the flags set based on that.
When restoring data back to Confidence, the facade needs to ignore these EWM observations and send back only the extension containing the enumerations from Confidence. Important - even the reference to the EWM observation in the CGM observation needs to be removed before sharing the reduced FHIR back with Confidence
Note : The codes used in EWM Observation created via Facade for the CGM Flags can be referenced from HERE
| CGM flag from confidence | Handling in FHIR |
|---|---|
| LO = 1 | dataAbsentReason coding of the CGM Observation has to be made NINF in the expanded FHIR. (this is due to already existing modelling for similar use-cases in other applications). Note that the "text" remains NaN which needs to be sent back as is to Confidence in case of restore |
| HI = 2 | dataAbsentReason of the CGM Observation has to be made PINF in the expanded FHIR. (this is due to already existing modelling for similar use-cases in other applications). Note that the "text" remains NaN which needs to be sent back as is to Confidence in case of restore |
| TempHI = 4 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| TempLO = 8 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| DeviceFault = 16 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| BatteryEmpty = 32 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| SensorMalfunction = 64 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| CalibrationRequired = 128 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| RateOfChangeMin = 256 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| RateOfChangeMax = 512 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| InvalidValue = 1024 | We already have the dataAbsentReason as NaN in case of invalid value, so no need of any additional handling |
| TypeIncorrectForDevice = 2048 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| DeviceSpecificAlert = 4096 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| CalibrationNotAllowed = 8192 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| CalibrationRecommended = 16384 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| SessionStopped = 32768 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| SensorRateDecreaseExceeded = 65536 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
| SensorRateIncreaseExceeded = 131072 | EWM observation referenced in the CGM Observation (while restoring back to confidence the link to the EWM Observation has to be removed in the reduced FHIR) |
LO = 1 (below sensor range)
Update the dataAbsentReason in CGM Observation of the expanded FHIR from NaN to NINF (note that the system and display also change).
When restoring back to confidence change back to "NaN" with teh relevant system.
"dataAbsentReason": { "coding": [ { "system": "http://hl7.org/fhir/v3/NullFlavor", "code": "NINF", "display": "negative infinity" } ], "text": "NaN" },
HI = 2 (above sensor range)
Update the dataAbsentReason in CGM Observation of the expanded FHIR from NaN to PINF (note that the system and display also change).
When restoring back to confidence change back to "NaN" with teh relevant system.
"dataAbsentReason": { "coding": [ { "system": "http://hl7.org/fhir/v3/NullFlavor", "code": "PINF", "display": "positive infinity" } ], "text": "NaN" },
TempHI = 4 (sensor temperature high)
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member).
{
"resourceType": "Observation",
"id": "1e6f0b94-1519-4f95-b50c-758fa3d4ac89",
"meta": {
"profile": [
"http://roche.com/fhir/rdc/StructureDefinition/observation-EWM"
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "EWM",
"display": "Error, Warning, Maintenance, Status"
}
]
}
],
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING",
"display": "Warning"
}
]
},
"subject": {
"reference": "Device/0053cfd5-a427-4691-8690-b4d956c6e698" //link to device resource of Confidence app. this is a mandatory element in our current profile hence necessary
},
"effectiveDateTime": "2020-08-04T15:15:16Z", //same as the related CGM observation effectiveDateTime
"performer": [
{
"reference": "Patient/2P0tI8p-SF9-6850"
}
],
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING_52",
"display": "Sensor temperature too high"
}
]
},
"device": {
"reference": "DeviceMetric/0053cfd5-a427-4691-8690-b4d956c6e658" //link to deviceMetric of relevant CGM sensor deviceComponent
},
"extension": [
{
"url": "http://roche.com/fhir/rdc/StructureDefinition/provenance-channel",
"valueString": "<channel-name>" //To be added by facade - fill channel data
},
{
"url": "http://roche.com/fhir/rdc/StructureDefinition/provenance-source",
"valueString": "<source-name>" //To be added by facade - fill source data
},
{
"url": "http://roche.com/fhir/rdc/StructureDefinition/patient-timezone"",
"valueString": "+02:00" //retain value from reduced FHIR
}
]
}
TempLO = 8 (sensor temperature low)
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING",
"display": "Warning"
}
]
},
....
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING_51",
"display": "Sensor temperature too low"
}
]
},
...
]
}
DeviceFault = 16
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR",
"display": "Error"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR_30",
"display": "Device fault"
}
]
},
...
}
BatteryEmpty = 32
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR",
"display": "Error"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR_2",
"display": "Battery empty"
}
]
},
....
}
SensorMalfunction = 64
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR",
"display": "Error"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"ERROR_24",
"display": "Sensor error"
}
]
},
...
}
CalibrationRequired = 128
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING",
"display": "Warning"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"WARNING_49",
"display": "Calibration Required"
}
]
},
...
}
RateOfChangeMin = 256 (TBC - whether a warning)
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING",
"display": "Warning"
}
]
},
....
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"WARNING_57",
"display": "Minimum rate of change"
}
]
},
...
}
RateOfChangeMax = 512 (TBC - whether a warning)
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "WARNING",
"display": "Warning"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"WARNING_58",
"display": "Maximum rate of change"
}
]
},
...
}
TypeIncorrectForDevice = 2048
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR",
"display": "Error"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"ERROR_41",
"display": "Type Incorrect For Device"
}
]
},
...
}
DeviceSpecificAlert = 4096
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "ERROR",
"display": "Error"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"ERROR_42",
"display": "Device Specific Alert"
}
]
},
...
}
CalibrationNotAllowed = 8192
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "MAINTENANCE",
"display": "Maintenance"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"MAINTENANCE_38",
"display": "Calibration Not Allowed"
}
]
},
...
}
CalibrationRecommended = 16384
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "MAINTENANCE",
"display": "Maintenance"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"MAINTENANCE_35",
"display": "Calibration recommended"
}
]
},
...
}
SessionStopped = 32768
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "MAINTENANCE",
"display": "Maintenance"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"MAINTENANCE_39",
"display": "Session Stopped"
}
]
},
...
}
SensorRateDecreaseExceeded = 65536
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "MAINTENANCE",
"display": "Maintenance"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"MAINTENANCE_40",
"display": "Sensor Rate Decrease Exceeded"
}
]
},
...
}
SensorRateIncreaseExceeded = 131072
Create new EWM observation and link it in the CGM Observation through Observation.related (has-member). Only the valueCodeableConcept is elaborated below. The other details of the EWM observation are same as the first sample.
{
"resourceType": "Observation",
"code": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code": "MAINTENANCE",
"display": "Maintenance"
}
]
},
...
"valueCodeableConcept": {
"coding": [
{
"system": "http://roche.com/fhir/rdc/cs",
"code":"MAINTENANCE_41",
"display": "Sensor Rate Increase Exceeded"
}
]
},
...
}