########################################################################### # # 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 # ############################################################################ import os AUT_NAME = "denaliSquish" COMMON_PATH = os.environ['HOME']+"/Projects" COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} #standby mode GOODMORNING_START_TIME_SEC = 0 GOODEVENING_START_TIME_SEC = 43200 BLOOD_PRIMING_TEXT = "Blood Priming" SALINE_UNIT = "mL" BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" #main treatment screen VITALS_TITLE = "VITALS" OUT_OF_RANGE_COLOR = "#c53b33" IN_RANGE_COLOR = "#fcfcfc" SYSTOLIC_LOWER_LIMIT = 60 SYSTOLIC_UPPER_LIMIT = 250 DIASTOLIC_LOWER_LIMIT = 40 DIASTOLIC_UPPER_LIMIT = 200 HEART_RATE_LOWER_LIMIT = 40 HEART_RATE_UPPER_LIMIT = 180 HEART_RATE_TITLE = "Heart Rate" BLOOD_PRESSURE_TITLE = "Blood Pressure" BLOOD_PRESSURE_UNIT = "mmHg" HEART_RATE_UNIT = "BPM" KEYBOARD_SWITCH = ["ABC", "&123"] 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____AVAILABLE_1", # 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 } NUM_OF_REQUEST_REJECT_REASONS = 43 #create custom treatment PATIENT_ID = "demopatientid" TREATMENT_TITLE = "Create a Custom Treatment" HEPARIN_TYPE = "UFH 1,000 IU/mL" ACID_CONCENTRATE = ["Fres. Naturalyte", "08-1251-1", "08-2251-0", "08-3251-9"] BICARBONATE_CONCENTRATE = "Fres. Centrisol" DIALYZER_TYPE = ["BB Diacap Pro 13H", "BB Diacap Pro 16H", "BB Diacap Pro 19H", "F Optiflux F160NRe", "F Optiflux F180NRe"] CONFIRM_TREATMENT_TITLE = "Confirm Treatment" PRESCRIPTION_TITLE = "PRESCRIPTION" OPERATING_PARAMETERS_TITLE = "OPERATING PARAMETERS" COLOR_CODES = {"Aqua": "#81ffff", "Blue": "#017dea", "Blue 2": "#1090d5", "Green": "#29fd2d", "Grey": "#d3d3d3", "Lavender": "#db98f5", "Light Blue": "#acd7f1", "Light Teal": "#29f1da","Lime": "#b7fc36", "Magenta":"#fd28fd", "Orange": "#f2721c", "Peach":"#f1979a", "Red": "#c53b33", "Rose":"#fc178d", "Slate blue":"#7f7ffa", "Violet": "#6435c9", "White": "#ffffff", "Yellow": "#fcfc4d"} CURRENT_COLOR = '#000000' COMPLETE_COLOR= '#4290ec' ENABLED_COLOR = '#fcfcfc' INCOMPLETE_COLOR = '#607a91' PATIENT_ID_TEXT = "Patient ID" PATIENT_ID = "demopatientid" BLOOD_FLOW_RATE = "Blood Flow Rate" DIALYSATE_FLOW_RATE = "Dialysate Flow Rate" DURATION = "Duration" HEPARIN_DISPENSING_RATE = "Heparin Dispensing Rate" HEPARIN_BOLUS_VOLUME = "Heparin Bolus Volume" HEPARIN_STOP_TIME = "Heparin Stop Time" SALINE_BOLUS_VOLUME = "Saline Bolus Volume" HEPARIN_TYPE_TITLE = "Heparin Type" SALINE_BOLUS_TITLE = "Saline Bolus" ACID_CONCENTRATE_TITLE = "Acid Concentrate" BICARBONATE_CONCENTRATE_TITLE = "Bicarbonate Concentrate" DIALYZER_TYPE_TITLE = "Dialyzer Type" DIALYSATE_TEMPERATURE = "Dialysate Temperature" BLOOD_PRESSURE_MEASUREMENT_INTERVAL = "Blood Pressure Measurement Interval" RINSEBACK_FLOW_RATE = "Rinseback Flow Rate" CREATE_TREATMENT_PARAMETERS = ["Blood Flow Rate", "Dialysate Flow Rate", "Duration","Heparin Dispensing Rate", "Heparin Bolus Volume","Heparin Stop Time", "Saline Bolus", "Dialysate Temperature", "Blood Pressure Measurement Interval", "Rinseback Flow Rate"] TREATMENT_UNHIGHLIGHTED_COLOR = "#000000" TREATMENT_HIGHLIGHTED_COLOR = "#135088" OFF_TEXT = "OFF" BACK_TEXT = "BACK" CONTINUE_TEXT = "CONTINUE" PRESCRIPTION_DETAILS = { "Blood Flow Rate": "mL/min", "Dialysate Flow Rate": "mL/min", "Duration": "min", "Heparin Dispensing Rate": "mL/hr", "Heparin Bolus Volume": "mL", "Heparin Stop Time": "min", "Saline Bolus Volume": "mL", "Dialysate Temperature": "°C", "Arterial Pressure Limit Low": "mmHg", "Arterial Pressure Limit High": "mmHg","Blood Pressure Measure Interval":"min", "Rinseback Rate" : "mL/min", "Venous Pressure Limit High": "mmHg", "Venous Pressure Limit Low": "mmHg" } OPERATIONAL_PARAMETERS = {"Heparin Type": HEPARIN_TYPE, "Acid Concentrate": "Fres. Naturalyte", "Bicarbonate Concentrate": BICARBONATE_CONCENTRATE, "Dialyzer Type": "BB Diacap Pro 16H"} #create custom treatment HIGHER_VALUE_OF_BLOOD_FLOW_RATE = 500 LOWER_VALUE_OF_BLOOD_FLOW_RATE = 100 STEP_VALUE_OF_BLOOD_FLOW_RATE = 25 BUFFER_LOW_AND_HIGH_LIMITS = 30 ARTERIAL_VALUE_0 = 0 ARTERIAL_VALUE_NEGATIVE_300 = -300 ARTERIAL_VALUE_NEGATIVE_20 = -20 ARTERIAL_VALUE_NEGATIVE_270 = -270 VENOUS_VALUE_600 = 600 VENOUS_VALUE_20 = 20 VENOUS_VALUE_50 = 50 VENOUS_VALUE_570 = 570 POSITIVE_BUFFER = 10 NEGATIVE_BUFFER = -10 #dictionary consist of custom treatment values CREATE_CUSTOM_TREATMENT = { "Blood Flow Rate": 250, "Dialysate Flow Rate": 400, "Duration": 270, "Heparin Dispensing Rate": 0.5, "Heparin Bolus Volume": 1, "Heparin Stop Time": 100, "Saline Bolus Volume": 200, "Dialysate Temperature": 37, "Blood Pressure Measurement Interval": 40, "Rinseback Flow Rate": 100, "Arterial Pressure Limit Low" : -30, "Arterial Pressure Limit High" : 0, "Blood Pressure Measure Interval" : 40, "Rinseback Rate" : 100, "Venous Pressure Limit High" : 590, "Venous Pressure Limit Low": 560 } #dictionary consist of slider values of treatment parameters CREATE_TREATMENT_PARAMETER_RANGE = { "Blood Flow Rate": [100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475, 500], "Dialysate Flow Rate": [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600], "Duration": [60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 240, 255, 270, 285, 300, 315, 330, 345, 360, 375, 390, 405, 420, 435, 450, 465, 480], "Heparin Dispensing Rate": [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 0], "Heparin Bolus Volume": [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 0], "Heparin Stop Time": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 0], "Saline Bolus Volume": [100, 200, 300], "Dialysate Temperature": [35.0, 35.5, 36.0, 36.5, 37.0], "Blood Pressure Measurement Interval": [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 0], "Rinseback Flow Rate": [50, 75, 100, 125, 150], } #dictionary consist of slider minimum value, slider buffer value, width buffer of slider CREATE_TREATMENT_SLIDER_VALUES = { "blood_flow_rate" : [100, 25, 46], "dialysate_flow_rate" : [100, 50, 75], "duration" : [60, 15, 26.6], "heparin_dispensing_rate" : [0, 0.1, 75], "heparin_bolus_volume" : [0, 0.1, 37], "heparin_stop_time" : [0, 10, 15.9], "saline_bolus" : [100, 100, 375], "dialysate_temperature" : [35, 0.5, 187.5], "arterial_pressure_limit_high" : [20, 10, 11.931], "blood_pressure_measurement_interval" : [0, 5, 62], "rinseback_flow_rate" : [50, 25, 187], } # pretreatment_patient_connection SYSTOLIC_PRESSSURE_120 = 120 SYSTOLIC_PRESSSURE_113 = 113 SYSTOLIC_PRESSSURE_150 = 150 SYSTOLIC_PRESSSURE_175 = 175 SYSTOLIC_PRESSSURE_200 = 200 SYSTOLIC_PRESSSURE_200 = 200 SYSTOLIC_PRESSSURE_251 = 251 SYSTOLIC_PRESSSURE_59 = 59 SYSTOLIC_PRESSSURE_15 = 15 DIASTOLIC_PRESSSURE_25 = 25 DIASTOLIC_PRESSSURE_39 = 39 DIASTOLIC_PRESSSURE_74 = 74 DIASTOLIC_PRESSSURE_80 = 80 DIASTOLIC_PRESSSURE_85 = 85 DIASTOLIC_PRESSSURE_60 = 60 DIASTOLIC_PRESSSURE_150 = 150 DIASTOLIC_PRESSSURE_200 = 200 DIASTOLIC_PRESSSURE_201 = 201 HEART_RATE_VAL_39 = 39 HEART_RATE_VAL_60 = 60 HEART_RATE_VAL_70 = 70 HEART_RATE_VAL_85 = 85 HEART_RATE_VAL_100 = 100 HEART_RATE_VAL_101 = 101 HEART_RATE_VAL_110 = 110 HEART_RATE_VAL_181 = 181 HEART_RATE_VAL_200 = 200 SYSTOLIC_LOWER_LIMIT = 60 SYSTOLIC_UPPER_LIMIT = 250 DIASTOLIC_LOWER_LIMIT = 40 DIASTOLIC_UPPER_LIMIT = 200 HEART_RATE_LOWER_LIMIT = 40 HEART_RATE_UPPER_LIMIT = 180 # pretreatment_patient_connection DIASTOLIC_TEXT = "diastolic" SYSTOLIC_TEXT = "systolic" OUT_OF_RANGE_COLOR = "#c53b33" IN_RANGE_COLOR = "#fcfcfc" HEART_RATE_TITLE = "Heart Rate" BLOOD_PRESSURE_TITLE = "Blood Pressure" BLOOD_PRESSURE_UNIT = "mmHg" HEART_RATE_UNIT = "BPM" PATIENT_CONNECTION_TEXT = "Patient Connection" UF_VOLUME_TEXT = "Ultrafiltration Volume (L)" UF_TITLE_TEXT = "Ultrafiltration Setup" BP_HR_TEXT = "BP/HR" SKIP_TEXT = "SKIP" TUTORIAL_TEXT = { 0 : "Wash your hands and establish vascular access per your clinic's instructions.", 1 : "Pinch arterial clamp and venous clamp on located on the cartridge patient lines.", 2 : "Remove arterial and venous shunt.", 3 : "Connect arterial and venous cartridge lines to your patient access lines." } PRE_TREATMENT_SCREENS = ["Create" , "Sample" , "Consumables" , "Disposables" , "Prime" , "Ultrafiltration" , "BP/HR" , "Connection" , "Start"]