Signals module
- class Signal(*, name: str, description: str = '', labels: Dict[str, List[str]] = {}, sourceType: SourceTypeSignal = SourceTypeSignal.measurement, valueType: TypeSignal = TypeSignal.numeric, engUnit: str = '', enumValues: Dict[str, str] = {}, sampleInterval: timedelta | None = None, gapDetection: timedelta | None = None, annotations: Dict[str, str] | None = None)[source]
Model for sending Signal metadata to Clarify.
- Parameters:
name (string(len:1-128)) – A human-readable name for the resource.
description (string(len:0-1000)) – A free-form description of the resource.
labels (Labels) – A map of custom classification attributes. Filtering is done on label keys (labels.<key>).
sourceType (string(enum)) – Classification of the data source. The value must be “aggregate”, “measurement” or “prediction”.
valueType (string(enum)) – How to interpret time-series data points. The value must be “enum” or “numeric”.
engUnit (string) – Engineering unit for time-series data in numeric representations.
enumValues (map(string => string(len:1-128))) – Map of numeric values to display text in enum representations. The key must represent an integer in range 0-9999.
sampleInterval (Fixed Duration, null) – The expected distance between data points.
gapDetection (Fixed Duration, null) – The maximum distance between two data-points before considering it to be a gap.
annotations (Annotations) – A key-value store where integrations can store programmatic meta-data about the resource instance. Filtering is done on member fields.
Example
>>> from pyclarify import Signal
Creating a signal a minimal signal.
>>> signal = Signal(name="My new signal")
Creating a signal with all attributes set.
>>> signal = Signal( ... name="My new signal" ... description="This signal is an example." ... labels={ ... "environment": ["dev", "mocking"], ... "unit":["cloud"] ... } ... engUnit="℃" ... sampleInterval="PT30S" ... gapDetection="PT5M" ... )
Creating an enum signal.
>>> signal = Signal( ... name="My new enum signal" ... description="This enum signal is an example." ... labels={ ... "environment": ["dev", "mocking"], ... "unit":["cloud"] ... } ... valueType="enum" ... enumValues={ ... "0" : "Wind", ... "1" : "Rain", ... "2" : "Cloudy" ... } ... sampleInterval="PT30S" ... gapDetection="PT5M" ... )
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'json_encoders': {<class 'datetime.timedelta'>: <function timedelta_isoformat>}}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'annotations': FieldInfo(annotation=Union[Dict[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z0-9-_/]{1,128}$')])], str], NoneType], required=False), 'description': FieldInfo(annotation=str, required=False, default=''), 'engUnit': FieldInfo(annotation=str, required=False, default=''), 'enumValues': FieldInfo(annotation=Dict[str, str], required=False, default={}), 'gapDetection': FieldInfo(annotation=Union[timedelta, NoneType], required=False), 'labels': FieldInfo(annotation=Dict[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z0-9-_/]{1,128}$')])], List[str]], required=False, default={}), 'name': FieldInfo(annotation=str, required=True), 'sampleInterval': FieldInfo(annotation=Union[timedelta, NoneType], required=False), 'sourceType': FieldInfo(annotation=SourceTypeSignal, required=False, default=<SourceTypeSignal.measurement: 'measurement'>), 'valueType': FieldInfo(annotation=TypeSignal, required=False, default=<TypeSignal.numeric: 'numeric'>)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.