common module

message

Classes

Alarm(alarm_name, is_active, severity, …)

param alarm_name

AlarmSeverity(value)

An enumeration.

ControlSetting(name, value, min_value, …)

TODO: if enum is hard to use, we may just use a predefined set, e.g.

Error(errnum, err_str, timestamp)

SensorValueNew(name, value, timestamp, …)

SensorValues([timestamp, loop_counter])

param **kwargs

sensor readings, must be in vent.values.SENSOR.keys

class vent.common.message.SensorValueNew(name, value, timestamp, loop_counter)[source]

Bases: object

class vent.common.message.SensorValues(timestamp=None, loop_counter=None, **kwargs)[source]

Bases: object

Parameters

**kwargs – sensor readings, must be in vent.values.SENSOR.keys

Methods

__init__([timestamp, loop_counter])

param **kwargs

sensor readings, must be in vent.values.SENSOR.keys

to_dict()

__init__(timestamp=None, loop_counter=None, **kwargs)[source]
Parameters

**kwargs – sensor readings, must be in vent.values.SENSOR.keys

to_dict()[source]
class vent.common.message.ControlSetting(name, value, min_value, max_value, timestamp)[source]

Bases: object

TODO: if enum is hard to use, we may just use a predefined set, e.g. {‘PIP’, ‘PEEP’, …} :param name: enum belong to ValueName :param value: :param min_value: :param max_value: :param timestamp:

Methods

__init__(name, value, min_value, max_value, …)

TODO: if enum is hard to use, we may just use a predefined set, e.g.

__init__(name, value, min_value, max_value, timestamp)[source]

TODO: if enum is hard to use, we may just use a predefined set, e.g. {‘PIP’, ‘PEEP’, …} :param name: enum belong to ValueName :param value: :param min_value: :param max_value: :param timestamp:

class vent.common.message.AlarmSeverity(value)[source]

Bases: enum.Enum

An enumeration.

Attributes

RED

int([x]) -> integer

ORANGE

int([x]) -> integer

YELLOW

int([x]) -> integer

OFF

int([x]) -> integer

RED = 3
ORANGE = 2
YELLOW = 1
OFF = 0
class vent.common.message.Alarm(alarm_name, is_active, severity, alarm_start_time, alarm_end_time, value=None, message=None)[source]

Bases: object

Parameters
  • alarm_name

  • is_active

  • severity

  • alarm_start_time

  • alarm_end_time

  • value (int, float) – optional - numerical value that generated the alarm

  • message (str) – optional - override default text generated by AlarmManager

Methods

__init__(alarm_name, is_active, severity, …)

param alarm_name

Attributes

id_counter

itertools.count: used to generate unique IDs for each alarm

id_counter = count(0)

used to generate unique IDs for each alarm

Type

itertools.count

__init__(alarm_name, is_active, severity, alarm_start_time, alarm_end_time, value=None, message=None)[source]
Parameters
  • alarm_name

  • is_active

  • severity

  • alarm_start_time

  • alarm_end_time

  • value (int, float) – optional - numerical value that generated the alarm

  • message (str) – optional - override default text generated by AlarmManager

class vent.common.message.Error(errnum, err_str, timestamp)[source]

Bases: object

values

Parameterization of variables and values

Data

CONTROL

Values to control but not monitor.

LIMITS

Values that are dependent on other values:

SENSOR

Values to monitor but not control.

Classes

Value(name, units, abs_range, safe_range, …)

Definition of a value.

ValueName(value)

An enumeration.

class vent.common.values.ValueName(value)[source]

Bases: enum.Enum

An enumeration.

Attributes

PIP

int([x]) -> integer

PIP_TIME

int([x]) -> integer

PEEP

int([x]) -> integer

PEEP_TIME

int([x]) -> integer

BREATHS_PER_MINUTE

int([x]) -> integer

INSPIRATION_TIME_SEC

int([x]) -> integer

IE_RATIO

int([x]) -> integer

FIO2

int([x]) -> integer

TEMP

int([x]) -> integer

HUMIDITY

int([x]) -> integer

VTE

int([x]) -> integer

PRESSURE

int([x]) -> integer

PIP = 1
PIP_TIME = 2
PEEP = 3
PEEP_TIME = 4
BREATHS_PER_MINUTE = 5
INSPIRATION_TIME_SEC = 6
IE_RATIO = 7
FIO2 = 8
TEMP = 9
HUMIDITY = 10
VTE = 11
PRESSURE = 12
class vent.common.values.Value(name: str, units: str, abs_range: tuple, safe_range: tuple, decimals: int, default: (<class 'int'>, <class 'float'>) = None)[source]

Bases: object

Definition of a value.

Used by the GUI and control module to set defaults.

Parameters
  • name (str) – Human-readable name of the value

  • units (str) – Human-readable description of units

  • abs_range (tuple) – tuple of ints or floats setting the logical limit of the value, eg. a percent between 0 and 100, (0, 100)

  • safe_range (tuple) –

    tuple of ints or floats setting the safe ranges of the value,

    note:

    this is not the same thing as the user-set alarm values,
    though the user-set alarm values are initialized as ``safe_range``.
    

  • decimals (int) – the number of decimals of precision used when displaying the value

Methods

__init__(name, units, abs_range, safe_range, …)

Definition of a value.

to_dict()

Attributes

abs_range

decimals

default

name

safe_range

__init__(name: str, units: str, abs_range: tuple, safe_range: tuple, decimals: int, default: (<class 'int'>, <class 'float'>) = None)[source]

Definition of a value.

Used by the GUI and control module to set defaults.

Parameters
  • name (str) – Human-readable name of the value

  • units (str) – Human-readable description of units

  • abs_range (tuple) – tuple of ints or floats setting the logical limit of the value, eg. a percent between 0 and 100, (0, 100)

  • safe_range (tuple) –

    tuple of ints or floats setting the safe ranges of the value,

    note:

    this is not the same thing as the user-set alarm values,
    though the user-set alarm values are initialized as ``safe_range``.
    

  • decimals (int) – the number of decimals of precision used when displaying the value

property name
property abs_range
property safe_range
property decimals
property default
to_dict()[source]
vent.common.values.SENSOR = OrderedDict([(<ValueName.FIO2: 8>, <vent.common.values.Value object>), (<ValueName.TEMP: 9>, <vent.common.values.Value object>), (<ValueName.HUMIDITY: 10>, <vent.common.values.Value object>), (<ValueName.VTE: 11>, <vent.common.values.Value object>), (<ValueName.PRESSURE: 12>, <vent.common.values.Value object>), (<ValueName.IE_RATIO: 7>, <vent.common.values.Value object>)])

Values to monitor but not control.

Used to set alarms for out-of-bounds sensor values. These should be sent from the control module and not computed.:

{
    'name' (str):  Human readable name,
    'units' (str): units string, (like degrees or %),
    'abs_range' (tuple): absolute possible range of values,
    'safe_range' (tuple): range outside of which a warning will be raised,
    'decimals' (int): The number of decimals of precision this number should be displayed with
}
vent.common.values.CONTROL = OrderedDict([(<ValueName.PIP: 1>, <vent.common.values.Value object>), (<ValueName.PIP_TIME: 2>, <vent.common.values.Value object>), (<ValueName.INSPIRATION_TIME_SEC: 6>, <vent.common.values.Value object>), (<ValueName.PEEP: 3>, <vent.common.values.Value object>), (<ValueName.PEEP_TIME: 4>, <vent.common.values.Value object>), (<ValueName.BREATHS_PER_MINUTE: 5>, <vent.common.values.Value object>)])

Values to control but not monitor.

Sent to control module to control operation of ventilator.:

{
    'name' (str):  Human readable name,
    'units' (str): units string, (like degrees or %),
    'abs_range' (tuple): absolute possible range of values,
    'safe_range' (tuple): range outside of which a warning will be raised,
    'default' (int, float): the default value of the parameter,
    'decimals' (int): The number of decimals of precision this number should be displayed with
}
vent.common.values.LIMITS = {}

Values that are dependent on other values:

{
    "dependent_value": (
        ['value_1', 'value_2'],
        callable_returning_boolean
    }
}

Where the first argument in the tuple is a list of the values that will be given as argument to the callable_returning_boolean which will return whether (True) or not (False) a value is allowed.