########################################################################### # # Copyright (c) 2021-2024 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 ui_defs.py # # @author (last) Vy # @date (last) 10-Oct-2023 # @author (original) Peter Lucia # @date (original) 06-Apr-2021 # ############################################################################ from . import RequestRejectReasons class EResponse: Rejected = 0 Accepted = 1 class GuiActionType: Unknown = 0 PowerOff = 1 KeepAlive = 7 BloodFlow = 5 DialysateInletFlow = 8 DialysateOutletFlow = 11 TreatmentTime = 13 PowerOffBroadcast = 14 AlarmStatus = 2 AlarmTriggered = 3 AlarmCleared = 4 PressureOcclusion = 9 DGDrainPumpData = 36 DGHeatersData = 44 LoadCellReadings = 12 DGPressuresData = 32 TemperatureSensors = 45 CanBUSFaultCount = 2457 HDDebugText = 0xFFF1 DGDebugText = 0xFFF2 AdjustBloodDialysateReq = 23 AdjustBloodDialysateRsp = 24 AdjustDurationReq = 22 AdjustDurationRsp = 27 AdjustUltrafiltrationStateReq = 16 AdjustUltrafiltrationStateRsp = 65 AdjustUltrafiltrationEditReq = 17 AdjustUltrafiltrationEditRsp = 19 AdjustUltrafiltrationConfirmReq = 21 AdjustUltrafiltrationConfirmRsp = 46 AdjustPressuresLimitsReq = 70 AdjustPressuresLimitsRsp = 71 TreatmentRanges = 26 String = 65279 Acknow = 65535 # Generic Acknowledgment is not a unique message ID and # inherits its Id from the actual message. Zero is a placeholder AcknowGeneric = 0 class GuiActionTypeLength: TREATMENT_LOG_LENGTH = 33 class TXStates: # Sub Mode TREATMENT_START_STATE = 0 # Start treatment - initialize treatment and go to blood prime state TREATMENT_BLOOD_PRIME_STATE = 1 # Prime blood-side of dialyzer with gradual ramp for 1 min. TREATMENT_DIALYSIS_STATE = 2 # Perform dialysis. TREATMENT_STOP_STATE = 3 # Treatment stopped. All pumps off. Dializer bypassed TREATMENT_RINSEBACK_STATE = 4 # Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating TREATMENT_RECIRC_STATE = 5 # Recirculate saline and dialysate while patient disconnected TREATMENT_END_STATE = 6 # Dialysis has ended # Saline states SALINE_BOLUS_STATE_IDLE = 0 # No saline bolus delivery is in progress SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP = 1 # Wait for pumps to stop before starting bolus SALINE_BOLUS_STATE_IN_PROGRESS = 2 # A saline bolus delivery is in progress SALINE_BOLUS_STATE_MAX_DELIVERED = 3 # Maximum saline bolus volume reached # UF states UF_PAUSED_STATE = 0 # Paused state of the ultrafiltration state machine UF_RUNNING_STATE = 1 # Running state of the ultrafiltration state machine # Heparin states HEPARIN_STATE_OFF = 0 # No heparin delivery is in progress HEPARIN_STATE_PAUSED = 1 # Heparin delivery paused HEPARIN_STATE_INITIAL_BOLUS = 2 # Initial heparin bolus delivery in progress HEPARIN_STATE_DISPENSING = 3 # Gradual heparin dispensing in progress HEPARIN_STATE_COMPLETED = 4 # Heparin delivery stopped due to the set stop time before treatment end HEPARIN_STATE_EMPTY = 5 # Heparin Syringe empty # Rinseback states RINSEBACK_STOP_INIT_STATE = 0 # Start state (stopped) of the rinseback sub-mode state machine RINSEBACK_RUN_STATE = 1 # Rinseback running state of the rinseback sub-mode state machine RINSEBACK_PAUSED_STATE = 2 # Rinseback paused state of the rinseback sub-mode state machine RINSEBACK_STOP_STATE = 3 # Rinseback stopped (done) state of the rinseback sub-mode state machine RINSEBACK_RUN_ADDITIONAL_STATE = 4 # Additional rinseback volume (10 mL) state # Recirculate TREATMENT_RECIRC_RECIRC_STATE = 0 # Re-circulate state of the treatment re-circulate sub-mode state machine TREATMENT_RECIRC_STOPPED_STATE = 1 # Stopped state of the treatment re-circulate sub-mode state machine # Blood Prime BLOOD_PRIME_RAMP_STATE = 0 # Ramp state of the blood prime sub-mode state machine # Treatment End TREATMENT_END_WAIT_FOR_RINSEBACK_STATE = 0 # Wait for rinseback state of the treatment end sub-mode state machine TREATMENT_END_PAUSED_STATE = 1 # Paused state of the treatment end sub-mode state machine # Treatment Stop TREATMENT_STOP_RECIRC_STATE = 0 # Dialysate re-circulation state TREATMENT_STOP_NO_RECIRC_STATE = 1 # No dialysate re-circulation state class TreatmentParameterRejections: def __init__(self): self.param_request_valid = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_blood_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_dialysate_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_duration = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_heparin_stop_time = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_saline_bolus = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_acid_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_bicarbonate_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_dialyzer_type = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_blood_pressure_measure_interval = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_rinseback_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_arterial_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_arterial_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_venous_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_venous_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_heparin_dispensing_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_heparin_bolus_volume = RequestRejectReasons.REQUEST_REJECT_REASON_NONE self.param_dialysate_temp = RequestRejectReasons.REQUEST_REJECT_REASON_NONE def set_all_valid(self): """ Sets all parameters as valid @return: None """ for attr in dir(self): if not callable(getattr(self, attr)) and attr.startswith("param_"): self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NONE def set_all_invalid(self): """ Sets all treatment parameters to be invalid @return: None """ for attr in dir(self): if not callable(getattr(self, attr)) and attr.startswith("param_"): self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE