common module

message

Classes

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)

SensorValues([timestamp, loop_counter, …])

param timestamp

from time.time(). must be passed explicitly or as an entry in vals

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

Bases: object

Parameters
  • timestamp (float) – from time.time(). must be passed explicitly or as an entry in vals

  • loop_counter (int) – number of control_module loops. must be passed explicitly or as an entry in vals

  • breath_count (int) – number of breaths taken. must be passed explicitly or as an entry in vals

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

Methods

__init__([timestamp, loop_counter, …])

param timestamp

from time.time(). must be passed explicitly or as an entry in vals

to_dict()

Attributes

additional_values

Built-in immutable sequence.

additional_values = ('timestamp', 'loop_counter', 'breath_count')
__init__(timestamp=None, loop_counter=None, breath_count=None, vals=None, **kwargs)[source]
Parameters
  • timestamp (float) – from time.time(). must be passed explicitly or as an entry in vals

  • loop_counter (int) – number of control_module loops. must be passed explicitly or as an entry in vals

  • breath_count (int) – number of breaths taken. must be passed explicitly or as an entry in vals

  • **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.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

An enumeration.

class vent.common.values.ValueName[source]

Bases: enum.Enum

An enumeration.

Attributes

BREATHS_PER_MINUTE

int([x]) -> integer

FIO2

int([x]) -> integer

HUMIDITY

int([x]) -> integer

IE_RATIO

int([x]) -> integer

INSPIRATION_TIME_SEC

int([x]) -> integer

PEEP

int([x]) -> integer

PEEP_TIME

int([x]) -> integer

PIP

int([x]) -> integer

PIP_TIME

int([x]) -> integer

PRESSURE

int([x]) -> integer

TEMP

int([x]) -> integer

VTE

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, control: bool, sensor: bool, 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

control

decimals

default

name

safe_range

sensor

__init__(name: str, units: str, abs_range: tuple, safe_range: tuple, decimals: int, control: bool, sensor: bool, 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
property control
property sensor
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.PIP: 1>, <vent.common.values.Value object>), (<ValueName.INSPIRATION_TIME_SEC: 6>, <vent.common.values.Value object>), (<ValueName.PEEP: 3>, <vent.common.values.Value object>), (<ValueName.BREATHS_PER_MINUTE: 5>, <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.