# -*- coding: utf-8 -*- ########################################################################### # # Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file utils.py # # @author (last) Joseph varghese # @date (last) 18-Jan-2022 # ############################################################################ ALARM_ID_AND_ALARM_MESSAGES = { 0: "Indication for when no alarms is a possible situation", 1: "Call service to schedule a repair.", 2: "Call service to schedule a repair.", 3: "Call service to schedule a repair.", 4: "Call service to schedule a repair.", 5: "Call service to schedule a repair.", 6: "Call service to schedule a repair.", 7: "Call service to schedule a repair.", 8: "Call service to schedule a repair.", 9: "Call service to schedule a repair." , 10: "Call service to schedule a repair.", 11: "Alarm ID available for use.", 12: "Call service to schedule a repair.", 13: "Call service to schedule a repair.", 14: "HD blood flow invalid calibration.", 15: "HD dialysate flow invalid calibration.", 16: "Call service to schedule a repair.", 17: "Call service to schedule a repair.", 18: "Call service to schedule a repair.", 19: "Call service to schedule a repair.", 20: "Call service to schedule a repair.", 21: "Call service to schedule a repair.", 22: "Call service to schedule a repair.", 23: "Call service to schedule a repair.", 24: "Call service to schedule a repair.", 25: "Call service to schedule a repair.", 26: "Call service to schedule a repair.", 27: "HD blood flow invalid calibration record.", 28: "HD dialyzer flow invalid calibration record.", 29: "Call service to schedule a repair.", 30: "Call service to schedule a repair.", 31: "Call service to schedule a repair.", 32: "Call service to schedule a repair.", 33: "Call service to schedule a repair.", 34: "Call service to schedule a repair.", 35: "Call service to schedule a repair.", 36: "Call service to schedule a repair.", 37: "Call service to schedule a repair.", 38: "Call service to schedule a repair.", 39: "Call service to schedule a repair.", 40: "Call service to schedule a repair.", 41: "Call service to schedule a repair.", 42: "Call service to schedule a repair.", 43: "Call service to schedule a repair.", 44: "Call service to schedule a repair.", 45: "Call service to schedule a repair.", 46: "Call service to schedule a repair.", 47: "Call service to schedule a repair.", 48: "Call service to schedule a repair.", 49: "Call service to schedule a repair.", 50: "Call service to schedule a repair.", 51: "Call service to schedule a repair.", 52: "Call service to schedule a repair.", 53: "Call service to schedule a repair.", 54: "Call service to schedule a repair.", 55: "Call service to schedule a repair.", 56: "Call service to schedule a repair.", 57: "Call service to schedule a repair.", 58: "Call service to schedule a repair.", 59: "Call service to schedule a repair.", 60: "Call service to schedule a repair.", 61: "Call service to schedule a repair.", 62: "Call service to schedule a repair.", 63: "Call service to schedule a repair.", 64: "Call service to schedule a repair.", 65: "Call service to schedule a repair.", 66: "HD blood leak sensor set point set failure.", 67: "Call service to schedule a repair.", 68: "Dialysate has recirculated for too long.", 69: "HD blood leak sensor invalid calibration record.", 70: "Call service to schedule a repair." , 71: "Call service to schedule a repair.", 72: "HD blood flow meter status check self-test failure alarm.", 73: "HD dialysate flow meter status check self-test failure alarm.", 74: "Call service to schedule a repair.", 75: "Call service to schedule a repair.", 76: "Call service to schedule a repair.", 77: "Call service to schedule a repair.", 78: "Call service to schedule a repair.", 79: "Call service to schedule a repair.", 80: "Call service to schedule a repair.", 81: "Call service to schedule a repair.", 82: "Call service to schedule a repair.", 83: "Call service to schedule a repair.", 84: "Call service to schedule a repair.", 85: "Call service to schedule a repair.", 86: "Call service to schedule a repair.", 87: "DG heating invalid calibration record.", 88: "DG concentrate pumps hall sensor out of range.", 89: "Call service to schedule a repair.", 90: "DG load cells FPGA read error.", 91: "Call service to schedule a repair.", 92: "DG conductivity sensor bad status.", 93: "DG outlet primary conductivity out of range.", 94: "DG pressure out of range.", 95: "DG watchdog expired.", 96: "Inlet water temperature in high range.", 97: "Fill conductivity out of range.", 98: "Call service to schedule a repair.", 99: "Call service to schedule a repair.", 100: "Call service to schedule a repair.", 101: "Call service to schedule a repair.", 102: "DG heat disinfect temperature gradient out of range.", 103: "Call service to schedule a repair.", 104: "Call service to schedule a repair.", 105: "Call service to schedule a repair.", 106: "DG dialysate flow sensor invalid calibration record.", 107: "Call service to schedule a repair.", 108: "Call service to schedule a repair.", 109: "Call service to schedule a repair.", 110: "Call service to schedule a repair.", 111: "Call service to schedule a repair.", 112: "Call service to schedule a repair.", 113: "HD blood leak zero command fault.", 114: "Call service to schedule a repair.", 115: "Call service to schedule a repair.", 116: "Call service to schedule a repair.", 117: "Call service to schedule a repair.", 118: "Call service to schedule a repair.", 119: "Call service to schedule a repair.", 120: "Call service to schedule a repair.", 121: "Call service to schedule a repair.", 122: "Call service to schedule a repair.", 123: "Call service to schedule a repair.", 124: "Blood has sat too long in the blood tubing set. No rinseback allowed.", 125: "Blood has sat too long in the blood tubing set. Treatment must end.", 126: "A blood leak has been detected. Treatment must end.", 127: "Venous pressure is low. Check to be sure your blue venous connections are secure and that your venous access is intact." , 128: "Venous air bubble detected. Check for air bubbles in the venous line. If bubbles are present, tap the tubing to move the bubbles up to the air trap. If bubbles cannot be removed, treatment must end.", 129: "Venous air bubble detected. Check for air bubbles in the venous line. If bubbles are present, tap the tubing to move the bubbles up to the air trap. If bubbles cannot be removed, treatment must end.", 130: "Venous pressure is high. Check to be sure your blue venous connections are secure and that there are no kinks or clots in the tubing.", 131: "Arterial pressure is low. Check to be sure your red arterial connections are secure and that there are no kinks or clots in the tubing.", 132: "Arterial pressure is low. Check to be sure your red arterial connections are secure and that your venous access is intact.", 133: "Fluid leak detected in Dialysate Generation", 134: "Fluid leak detected in Hemodialysis Delivery device. Clean up the spill before continuing." , 135: "Excessive movement detected with Hemodialysis Delivery device. Confirm the device is stationary and level before continuing.", 136: "Excessive movement detected with Dialysis Generation device. Confirm the device is stationary and level before continuing.", 137: "Excessive tilt detected with Hemodialysis Delivery device. Confirm the device is stationary and level before continuing.", 138: "Excessive tilt detected with Dialysis Generation device. Confirm the device is stationary and level before continuing.", 139: "Power has been lost. Check all electrical connections. The display and CPU will run off of the battery until power returns.", 140: "Communication failure with Dialysis Generator. Ensure all cords are securely connected.", 141: "Failure to fill the Air Trap. Check the air trap vent line and the transducer protector. If the transducer protector is wet, replace it.", 142: "Occlusion detected after the blood pump. Check for clots or kinks around the dialyzer and in the venous line.", 143: "Call service to schedule a repair.", 144: "DG RO flow sensor invalid calibration record.", 145: "Dialysate conductivity is out of range. Check the acid dialysate concentrates and make sure the correct concentrate is connected.", 146: "DG RTC or timer accuracy failure.", 147: "Call service to schedule a repair.", 148: "Inlet water temperature is high. Check the incoming water for issues with cold water supply.", 149: "Inlet water temperature is low. Check the incoming water for issues with hot water supply.", 150: "Inlet water conductivity is high. Check the incoming water for issues.", 151: "Inlet water conductivity is low. Check the incoming water for issues.", 152: "Inlet water pressure is low. Check the incoming water supply.", 153: "HD prime completed high priority alarm.", 154: "Communication has been lost. Ensure all cords are securely connected.", 155: "Alarm ID available for use.", 156: "Alarm ID available for use.", 157: "DG chemical disinfect prime acid line timeout.", 158: "Inlet water temperature is in the low range.", 159: "Dialysate pump failure. Check there are no kinks in the dialysate tubing.", 160: "Blood pump failure. Check the pump rotor for secure connection.", 161: "DG comm too many bad CRCs.", 162: "DG FPGA clock speed check failure.", 163: "Ultrafiltration error.", 164: "Ultrafiltration error.", 165: "Maximum Rinseback time exceeded. Rinseback must end.", 166: "Maximum Recirculation time exceeded. Treatment must end.", 167: "Hemodialysis Delivery device door open.", 168: "Dialysate recirculation error.", 169: "Call service to schedule a repair.", 170: "Heparin syringe empty. Option to resume treatment without heparin.", 171: "Heparin pump occlusion detected. Check heparin line is unclamped and there are no kinks in the heparin line.", 172: "Not enough heparin is available for treatment. Check if syringe pump is touching syringe plunger. If syringe pump is touching syringe plunger, end treatment. If syringe pump is not touching syringe plunger, reload syringe with enough heparin.", 173: "HD RTC configuration error.", 174: "HD RTC or timer accuracy failure.", 175: "Blood pump eailure. Check the pump rotor for secure connection.", 176: "HD active reservoir is full during treatment and DG not ready to switch reservoirs.", 177: "Call service to schedule a repair.", 178: "HD communication timeout.", 179: "Call service to schedule a repair.", 180: "Call service to schedule a repair.", 181: "Call service to schedule a repair.", 182: "Call service to schedule a repair.", 183: "Call service to schedule a repair.", 184: "Call service to schedule a repair.", 185: "Fan failure. Check that the fans inlets are not blocked or obstructed.", 186: "Call service to schedule a repair.", 187: "Call service to schedule a repair.", 188: "Call service to schedule a repair.", 189: "Call service to schedule a repair.", 190: "Call service to schedule a repair.", 191: "Call service to schedule a repair.", 192: "Call service to schedule a repair.", 193: "Alarm available for use.", 194: "Call service to schedule a repair.", 195: "Call service to schedule a repair.", 196: "Call service to schedule a repair.", 197: "Call service to schedule a repair.", 198: "Call service to schedule a repair.", 199: "Dialysate flow too low while trimmer heater is on.", 200: "Call service to schedule a repair.", 201: "Inlet water quality is bad.", 202: "Inlet water quality is bad.", 203: "Call service to schedule a repair.", 204: "Call service to schedule a repair.", 205: "Call service to schedule a repair.", 206: "Call service to schedule a repair.", 207: "Call service to schedule a repair.", 208: "Call service to schedule a repair.", 209: "Call service to schedule a repair.", 210: "Battery pack error.", 211: "Maximum time for blood stoppage has been exceeded.", 212: "Maximum time for blood stoppage has been exceeded.", 213: "HD prime completed medium priority alarm.", 214: "Inability to deliver saline bolus. Check for kinks or clamped lines in the saline line.", 215: "Unable to complete Rinseback. Check for kinks or clamped blood lines.", 216: "Treatment has ended", 217: "Blood prime error. Check for kinks or clamped blood lines.", 218: "Heparin syringe not detected.", 219: "Heparin syringe removed.", 220: "Battery pack error.", 221: "Saline back appears empty. Please check saline bag and line and replace if saline bag is empty.", 222: "Dialysate temperature high.", 223: "Dialysate temperature low.", 224: "Treatment paused.", 225: "Treatment has ended", 226: "Prime of the bloodlines is complete.", 227: "Maximum time for blood prime has been exceeded.", 228: "Priming failure. Check blood and dialysate lines for clamps and kinks.", 229: "Priming failure. Check blood and dialysate lines for clamps and kinks.", 230: "Priming failure. Check blood and dialysate lines for clamps and kinks.", 231: "Self Test Failure. Please ensure the disposable cartridge is completely installed and the handle moved to the down position.", 232: "Self Test Failure. Please ensure the disposable cartridge is completely installed and the handle moved to the down position. Check for closed clamps or kinks in the tubing.", 233: "Battery pack error.", 234: "Communication failure. Ensure all cords are securely connected.", 235: "Rinseback has been completed.", 236: "New cartridge needs to be installed.", 237: "HD prime saline dialyzer time out alarm.", 238: "Cartridge not loaded or loaded improperly. Check that a cartridge is properly installed.", 239: "Cartridge not unloaded, or unloaded improperly. Check that the cartridge has been removed.", 240: "Dialysate conductivity out of range. Check the bicarbonate dialysate concentrates and make sure the correct concentrate is connected.", 241: "Call service to schedule a repair.", 242: "Call service to schedule a repair.", 243: "Call service to schedule a repair.", 244: "Call service to schedule a repair.", 245: "Call service to schedule a repair.", 246: "Call service to schedule a repair.", 247: "Call service to schedule a repair.", 248: "Call service to schedule a repair.", 249: "Call service to schedule a repair.", 250: "Call service to schedule a repair.", 251: "Call service to schedule a repair.", 252: "Call service to schedule a repair.", 253: "Call service to schedule a repair.", 254: "Call service to schedule a repair.", 255: "Call service to schedule a repair.", 256: "HD and DG software builds are not compatible.", 257: "Call service to schedule a repair.", 258: "HD FPGA power out timeout.", 259: "Call service to schedule a repair.", 260: "UI POST Application Integrity (Sha256Sum) failure.", 261: "UI POST CANBus failure.", 262: "UI POST Display failure.", 263: "UI POST Touch failure.", 264: "UI POST SD-Card failure.", 265: "UI POST RTC failure.", 266: "UI POST WiFi failure.", 267: "UI POST Bluetooth failure.", 268: "UI POST Ethernet failure.", 269: "UI POST Sound failure.", 270: "Call service to schedule a repair.", 271: "Call service to schedule a repair.", 272: "Fan failure. Check that the fans inlets are not blocked or obstructed.", 273: "Call service to schedule a repair.", 274: "Call service to schedule a repair.", 275: "Call service to schedule a repair.", 276: "Call service to schedule a repair.", 277: "Call service to schedule a repair.", 278: "Ultrafiltration error.", 279: "DG dialysate drain time out.", 280: "Call service to schedule a repair.", 281: "Acid concentrate low. Replace acid concentrate bottle.", 282: "Bicarbonate concentrate low. Replace bicarbonate concentrate bottle.", 283: "Call service to schedule a repair.", 284: "DG load cells primary/back up drift out of range.", 285: "Dialysate recirculation error.", 286: "Rinseback complete.", 287: "Call service to schedule a repair.", 288: "Call service to schedule a repair.", 289: "Check dialysate/concentrate caps.", 290: "DG flow too low while heater is on.", 291: "Total number of alarms." } ALARM_PRIORITIES = {1: "LOW", 2: "MEDIUM", 3: "HIGH"} ALARM_LIST_TITLE = "Alarm list" REJECTION_REASON = { 0: "No Active Alarm List", 1: "REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE", # Request is not allowed in the current operating mode 2: "REQUEST_REJECT_REASON_TIMEOUT_WAITING_FOR_USER_CONFIRM", # Validated request was not confirmed by user in reasonable time 3: "REQUEST_REJECT_REASON_NOT_IN_TREATMENT_MODE", # Request is not allowed if not in treatment mode 4: "REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE", # Request is not allowed in current treatment state 5: "REQUEST_REJECT_REASON_TREATMENT_TOO_CLOSE_TO_FINISHED", # Request is not allowed so near end of treatment 6: "REQUEST_REJECT_REASON_TREATMENT_TIME_OUT_OF_RANGE", # Treatment duration is out of range 7: "REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_CURRENT", # Treatment time change is less than currently elapsed treatment time 8: "REQUEST_REJECT_REASON_BLOOD_FLOW_OUT_OF_RANGE", # Blood flow is out of range 9: "REQUEST_REJECT_REASON_DIAL_FLOW_OUT_OF_RANGE", # Dialysate flow is out of range 10: "REQUEST_REJECT_REASON_DIAL_VOLUME_OUT_OF_RANGE", # Dialysate flow rate or treatment duration causes dialysate volume to exceed limit 11: "REQUEST_REJECT_REASON_UF_VOLUME_OUT_OF_RANGE", # Ultrafiltration volume is out of range 12: "REQUEST_REJECT_REASON_UF_RATE_OUT_OF_RANGE", # Ultrafiltration rate is out of range 13: "REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_MINIMUM", # Treatment time change is less than minimum treatment time 14: "REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS", # Ultrafiltration is not currently in progress 15: "REQUEST_REJECT_REASON_UF_NOT_PAUSED", # Ultrafiltration is not currently paused 16: "REQUEST_REJECT_REASON_SALINE_BOLUS_IN_PROGRESS", # A saline bolus is in progress 17: "REQUEST_REJECT_REASON_PARAM_OUT_OF_RANGE", # A treatment parameter is out of range 18: "REQUEST_REJECT_REASON_HEPARIN_PRESTOP_EXCEEDS_DURATION", # The Heparin pre-stop setting is greater than the treatment duration 19: "REQUEST_REJECT_REASON_ARTERIAL_PRESSURE_LOW_VS_HIGH", # Arterial pressure low and high alarm limits are not inconsistent 20: "REQUEST_REJECT_REASON_VENOUS_PRESSURE_LOW_VS_HIGH", # Venous pressure low and high alarm limits are inconsistent 21: "REQUEST_REJECT_REASON_SALINE_MAX_VOLUME_REACHED", # Saline bolus volume maximum has been reached - no more saline allowed 22: "REQUEST_REJECT_REASON_SALINE_BOLUS_NOT_IN_PROGRESS", # A saline bolus is not in progress 23: "REQUEST_REJECT_REASON_ACTION_DISABLED_IN_CURRENT_STATE", # Requested user action is disabled in current state 24: "REQUEST_REJECT_REASON_ALARM_IS_ACTIVE", # Requested user action not allowed while alarm is active 25: "REQUEST_REJECT_REASON_INVALID_COMMAND", # Requested user action invalid 26: "REQUEST_REJECT_REASON_TREATMENT_IS_COMPLETED", # The treatment has been completed 27: "REQUEST_REJECT_REASON_ADDL_RINSEBACK_MAX_VOLUME_REACHED", # Rinseback additional volume maximum has been reached - no more additional rinsebacks allowed 28: "REQUEST_REJECT_REASON_UF_VOLUME_NOT_SET", # Ultrafiltration volume is not set yet 29: "REQUEST_REJECT_REASON_NO_PATIENT_CONNECTION_CONFIRM", # The user has not confirmed patient connection 30: "REQUEST_REJECT_REASON_HEPARIN_PAUSE_INVALID_IN_THIS_STATE", # Heparin cannot be paused if not currently deliverying Heparin 31: "REQUEST_REJECT_REASON_HEPARIN_NOT_PAUSED", # Heparin cannot be resumed if not paused 32: "REQUEST_REJECT_REASON_DG_COMM_LOST", # Treatment cannot initiate if DG comm is lost 33: "REQUEST_REJECT_REASON_DRAIN_NOT_COMPLETE", # Post-treatment reservoirs drain not complete 34: "REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE", # Treatment cannot initiate if DG is not in standby idle state 35: "REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT", # Request message not formatted properly 36: "REQUEST_REJECT_REASON_INVALID_DATE_OR_TIME", # Given date/time is invalid 37: "REQUEST_REJECT_REASON_", # Not used - available for use 38: "REQUEST_REJECT_REASON_BATTERY_IS_NOT_CHARGED", # Battery does not have enough charge to start treatment 39: "REQUEST_REJECT_REASON_RINSEBACK_NOT_COMPLETED", # Cannot move on to recirculate without completing full rinseback. 40: "REQUEST_REJECT_REASON_RESERVOIR_ONE_IS_NOT_READY", # Reservoir one fill is not complete 41: "REQUEST_REJECT_REASON_PUMP_TRACK_NOT_CLOSED", # Pump track is not ready / closed 42: "REQUEST_REJECT_REASON_DOOR_NOT_CLOSED", # Door is not closed 43: "REQUEST_REJECT_REASON_SYRINGE_NOT_PRESENT", # Syringe is not present 44: "REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN", # Dialysate cap open 45: "REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN", #Concentrate cap open 46: "NUM_OF_REQUEST_REJECT_REASONS" # Number of settings change reject codes } UNDEFINED_ALARM_ID_MSG = "ALARM_ID_UNDEFINED" ALARM_TITLE = "Alarm" ALARM_PRIORITY_OPTIONS = { 0 : 'ALARM_PRIORITY_NONE' , 1 : 'ALARM_PRIORITY_LOW' , 2 : 'ALARM_PRIORITY_MEDIUM', 3 : 'ALARM_PRIORITY_HIGH', }