quixio / quix-streams

Quix Streams - A library for data streaming and Python Stream Processing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add scalar state type

tomas-quix opened this issue · comments

Is your feature request related to a problem? Please describe.
Add support for this in state helpers:

def on_dataframe_received_handler(stream_consumer: qx.StreamConsumer, data: qx.TimeseriesData):

    stream_state = stream_consumer.get_scalar_state("total_rpm", int, lambda x: 0) # default value for state name.

    for row in data.timestamps:

        rpm = row.parameters["EngineRPM"].numeric_value

        stream_state += rpm

        row.add_value("total_rpm", stream_state)