Evaluate module
- class Calculation(*, formula: str, alias: str)[source]
Bases:
BaseModel
Model for creating a calculation to be used in evaluate endpoint.
- Parameters:
formula (str) – The formula to be applied. Current legal calculations are found here.
alias (string) – A short alias to use in formulas as well as in the data frame results.
Example
>>> from pyclarify import Calculation
Creating a calculation assuming we have items with aliases “i1” and “i2”.
>>> calculation = Calculation( ... formula="i1 + i2" ... alias="c1" ... )
Creating a calculation using other calculations.
>>> calc1 = Calculation( ... formula="i1 + i2" ... alias="c1" ... ) >>> calc2 = Calculation( ... formula="c1**2 + i1" ... alias="c1" ... )
- alias: str
- formula: str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'alias': FieldInfo(annotation=str, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z_][A-Za-z0-9_]{0,27}$')]), 'formula': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class ItemAggregation(*, id: str, aggregation: DataAggregation, state: int | None = None, lead: int | None = None, lag: int | None = None, alias: str)[source]
Bases:
BaseModel
Model for creating item aggregations to be used in evaluate endpoint.
- Parameters:
id (ResourceID) – The ID of the item to be aggregated.
aggregation (str) – The aggregation type to be done. Current legal aggregations are found here.
state (int[0:9999]) – The integer denoting the state to be used in the aggregation. Only necessary when using state based aggregation.
lead (int[-1000:1000]) – Shift buckets backwards by N.
lag (int[-1000:1000]) – Shift buckets forwards by N.
alias (string) – A short alias to use in formulas as well as in the data frame results.
Example
>>> from pyclarify import ItemAggregation
Creating a signal a minimal item aggregation.
>>> item_aggregation = ItemAggregation( ... id="cbpmaq6rpn52969vfl0g", ... aggregation="avg", ... alias="i2" ... )
Creating a item aggregation with all attributes set.
>>> item_aggregation = ItemAggregation( ... id="cbpmaq6rpn52969vfl00", ... aggregation="max", ... state=1, ... lead=1, ... lag=1, ... alias="i1" ... )
- aggregation: DataAggregation
- alias: str
- id: str
- lag: int | None
- lead: int | None
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'aggregation': FieldInfo(annotation=DataAggregation, required=True), 'alias': FieldInfo(annotation=str, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[A-Za-z_][A-Za-z0-9_]{0,27}$')]), 'id': FieldInfo(annotation=str, required=True, metadata=[_PydanticGeneralMetadata(pattern='^[a-v0-9]{20}$')]), 'lag': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=-1000), Le(le=1000)])], NoneType], required=False), 'lead': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=-1000), Le(le=1000)])], NoneType], required=False), 'state': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0), Lt(lt=10000)])], NoneType], required=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.
- state: int | None