Field

class utils.Field(dtype: str, name: str, unit: str)

Bases: object

DATA_TYPES_NUMERIC

list – List of acceptable numeric data types

DATA_TYPES_ALPHANUMERIC

list – List of acceptable alphanumeric (string) data types

DATA_TYPES_BOOLEAN

list – List of acceptable boolean data types

DATA_TYPES

List of all acceptable data types

id

str – Uniquie field identifier e.g. float_light_level_lux

dtype

str – Type of data being added

name

str – The name of the field

unit

str – The unit of messurement

Attributes Summary

DATA_TYPES
DATA_TYPES_ALPHANUMERIC
DATA_TYPES_BOOLEAN
DATA_TYPES_NUMERIC
id
is_boolean
is_numeric
is_string

Methods Summary

as_dict() Get representation as dictionary.
fromDict(dictionary) Create Field() from dictionary.
fromString(field_string) Create Field() from string e.

Attributes Documentation

DATA_TYPES = ['float', 'int', 'string', 'str', 'bool', 'boolean']
DATA_TYPES_ALPHANUMERIC = ['string', 'str']
DATA_TYPES_BOOLEAN = ['bool', 'boolean']
DATA_TYPES_NUMERIC = ['float', 'int']
id
is_boolean
is_numeric
is_string

Methods Documentation

as_dict()

Get representation as dictionary.

Returns:Dictionary of core field values i.e. dtype, name, unit, value, is_numeric, is_boolean and is_string.
Return type:dict
classmethod fromDict(dictionary: dict)

Create Field() from dictionary.

Parameters:dictionary – A dictionary containing keys: dtype, name and unit.
classmethod fromString(field_string)

Create Field() from string e.g. float_light_level_lux.