Items module

class Item(*, 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, visible: bool = False)[source]

Item model for sending Item meta data 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 (Dict[LabelsKey, List[str]]) – A map of custom classification attributes. Filtering is done on label keys (labels.<key>). LabelsKey is alphanumeric string up to 128 chars.

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

  • visible (bool) – Whether the item should be visible for your entire organization within Clarify or not.

  • annotations (Dict[AnnotationKey, str]) – A key-value store where integrations can store programmatic meta-data about the resource instance. Filtering is done one member fields. AnnotationKey is alphanumeric string up to 128 chars.

Example

>>> from pyclarify import Item

Creating a minimal item.

>>> item = Item(name="My new item")

Creating a item with all attributes set.

>>> item = Item(
...     name="My new item"
...     description="This item is an example."
...     labels={
...         "environment": ["dev", "mocking"],
...         "unit":["cloud"]
...     }
...     engUnit="℃"
...     sampleInterval="PT30S"
...     gapDetection="PT5M"
... )

Creating an enum item.

>>> item = Item(
...     name="My new enum item"
...     description="This enum item is an example."
...     labels={
...         "environment": ["dev", "mocking"],
...         "unit":["cloud"]
...     }
...     valueType="enum"
...     enumValues={
...         "0" : "Wind",
...         "1" : "Rain",
...         "2" : "Cloudy"
...     }
...     sampleInterval="PT30S"
...     gapDetection="PT5M"
... )

Tip

Items are hidden by default. If you want them to be visible you can add the attribute visible and set it to True

>>> item = Item(name="My new item", visible=True)
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]] = {'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'>), 'visible': FieldInfo(annotation=bool, required=False, default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.