Index: leahi_dialin/common/td_defs.py =================================================================== diff -u -r4d2710b034b98dcae6da6260b751e5968c05ad3b -r99005b6f96d49ad13fa01a44889579c386dc803a --- leahi_dialin/common/td_defs.py (.../td_defs.py) (revision 4d2710b034b98dcae6da6260b751e5968c05ad3b) +++ leahi_dialin/common/td_defs.py (.../td_defs.py) (revision 99005b6f96d49ad13fa01a44889579c386dc803a) @@ -14,9 +14,13 @@ # ############################################################################ +# Module import from enum import unique -from ..utils.enums import DialinEnum +# Project import +from leahi_dialin.common.dd_defs import DDInstitutionalRecordBasicFields +from leahi_dialin.common.generic_defs import DataTypes, RecordsBaseEnum +from leahi_dialin.utils.enums import DialinEnum # ================================================== Enum Creators: Operations Lvl 1 ================================================== @@ -1009,6 +1013,7 @@ 'NUM_OF_AIR_PUMP_ATTRIBUTES': [], } + class TDAirPumpStates(DialinEnum): AIR_PUMP_STATE_INIT = 0 # Air Pump Initialize state AIR_PUMP_STATE_OFF = 1 # Air Pump Off state @@ -1172,15 +1177,29 @@ # Syringe pump operations @unique -class SyringePumpOperations(DialinEnum): - SYRINGE_PUMP_OP_STOP = 0 # Stop syringe pump - SYRINGE_PUMP_OP_RETRACT = 1 # Retract syringe pump - SYRINGE_PUMP_OP_SEEK = 2 # Seek plunger - SYRINGE_PUMP_OP_PRIME = 3 # Prime Heparin line - SYRINGE_PUMP_OP_BOLUS = 4 # Deliver Heparin bolus of set volume over 5 minutes - SYRINGE_PUMP_OP_CONTINUOUS = 5 # Continuous dispense of Heparin at set rate - SYRINGE_PUMP_OP_PRELOAD = 6 # Preload syringe pump +class TDSyringePumpStates(DialinEnum): + STOP = 0 # Stop syringe pump + RETRACT = 1 # Retract syringe pump + SEEK = 2 # Seek plunger + PRIME = 3 # Prime Heparin line + BOLUS = 4 # Deliver Heparin bolus of set volume over 5 minutes + CONTINUOUS = 5 # Continuous dispense of Heparin at set rate + PRELOAD = 6 # Preload syringe pump + NUM_OF_SYRINGE_PUMP_STATES = 7 # Number of Syringe pump States +TDSyringePumpStates._str_list = { + # Official Name : Accepted strings + 'STOP': [], + 'RETRACT': [], + 'SEEK': [], + 'PRIME': [], + 'BOLUS': [], + 'CONTINUOUS': [], + 'PRELOAD': [], + 'NUM_OF_SYRINGE_PUMP_STATES': [], +} + + @unique class TDValvePositions(DialinEnum): NOT_IN_POSITION = 0 # Valve not in Position @@ -1320,3 +1339,109 @@ 'HEPATITIS_B_NEGATIVE': ['negative'], 'NUM_OF_HEPATITIS_B_STATUS': [], } + + +# ================================================== Enum Creators: Record Sub Fields ================================================== + + + +# ================================================== Enum Creators: Record Fields ================================================== +@unique +class TDSystemRecordFields(RecordsBaseEnum): + TOP_LEVEL_PN = (0, DataTypes.U08, 10) # Top level part number + TOP_LEVEL_SN = (1, DataTypes.U08, 20) # Top level serial number + MFG_LOCATION = (2, DataTypes.U08) # Manufacturing Location + MFG_DATE = (3, DataTypes.U32) # Manufacturing Date + NUM_OF_SYSTEM_RECORD_FIELDS = (4, DataTypes.NONE) # Number of System Record Fields + +TDSystemRecordFields._str_list = { + # Official Name : Accepted strings + 'TOP_LEVEL_PN': ['pn', 'part number'], + 'TOP_LEVEL_SN': ['sn', 'serial number'], + 'MFG_LOCATION': ['location', 'manufacturing location'], + 'MFG_DATE': ['date', 'manufacturing date'], + 'NUM_OF_SYSTEM_RECORD_FIELDS': [], +} + + +@unique +class TDServiceRecordFields(RecordsBaseEnum): + SERVICE_LOC = (0, DataTypes.U08) # DD service location + LAST_SERVICE_EPOCH_DATE = (1, DataTypes.U32) # DD last service date in epoch + SERVICE_INTERVAL_SECONDS = (2, DataTypes.U32) # DD service interval in seconds + LAST_RESET_TIME_EPOCH = (3, DataTypes.U32) # Last time the record was reset in epoch + NUM_OF_SERVICE_RECORD_FIELDS = (4, DataTypes.NONE) # Number of Service Record Fields + +TDServiceRecordFields._str_list = { + # Official Name : Accepted strings + 'SERVICE_LOC': [], + 'LAST_SERVICE_EPOCH_DATE': [], + 'SERVICE_INTERVAL_SECONDS': [], + 'LAST_RESET_TIME_EPOCH': [], + 'NUM_OF_SERVICE_RECORD_FIELDS': [], +} + + +def get_calibration_record_fields() -> RecordsBaseEnum: + # Creating the enum members list + i = 0 + members = {} + members[f'NUM_OF_CALIBRATION_RECORD_FIELDS'] = (i, DataTypes.NONE) + + # Enum creation + TDCalibrationRecordFields = RecordsBaseEnum('TDCalibrationRecordFields', members,) + + # Setting the _str_list values for the enum + TDCalibrationRecordFields._str_list = {} + for member in members: + TDCalibrationRecordFields._str_list[member] = [] + + return TDCalibrationRecordFields + + +@unique +class TDInstitutionalRecordBasicFields(RecordsBaseEnum): + CALIBRATION_TIME = (0, DataTypes.U32) # Calibration time in epoch. + NUM_OF_INSTITUTIONAL_RECORD_BASIC_FIELDS = (1, DataTypes.NONE) # Number of Institutional Record Basic Fields + +TDInstitutionalRecordBasicFields._str_list = { + # Official Name : Accepted strings + 'CALIBRATION_TIME': [], + 'NUM_OF_INSTITUTIONAL_RECORD_BASIC_FIELDS': [], +} + + +@unique +class TDInstitutionalRecordAdvancedFields(RecordsBaseEnum): + CALIBRATION_TIME = (0, DataTypes.U32) # Calibration time in epoch. + NUM_OF_INSTITUTIONAL_RECORD_ADVANCED_FIELDS = (1, DataTypes.NONE) # Number of Institutional Record Advanced Fields + +TDInstitutionalRecordAdvancedFields._str_list = { + # Official Name : Accepted strings + 'CALIBRATION_TIME': [], + 'NUM_OF_INSTITUTIONAL_RECORD_ADVANCED_FIELDS': [], +} + + +@unique +class TDInstitutionalRecordAdditionalFields(RecordsBaseEnum): + CALIBRATION_TIME = (0, DataTypes.U32) # Calibration time in epoch. + NUM_OF_INSTITUTIONAL_RECORD_ADDITIONAL_FIELDS = (1, DataTypes.NONE) # Number of Institutional Record Additional Fields + +TDInstitutionalRecordAdditionalFields._str_list = { + # Official Name : Accepted strings + 'CALIBRATION_TIME': [], + 'NUM_OF_INSTITUTIONAL_RECORD_ADDITIONAL_FIELDS': [], +} + + +@unique +class TDUsageInformationRecordFields(RecordsBaseEnum): + LAST_RESET_TIME_EPOCH = (0, DataTypes.U32) # Last time the record was reset in epoch. + NUM_OF_USAGE_INFO_RECORD_FIELDS = (1, DataTypes.NONE) # Number of Usage Information Record Fields + +TDUsageInformationRecordFields._str_list = { + # Official Name : Accepted strings + 'LAST_RESET_TIME_EPOCH': [], + 'NUM_OF_USAGE_INFO_RECORD_FIELDS': [], +}