A Python client for the StreamStory API, providing easy access to stream processing and anomaly detection capabilities.
Clone the repository and install in development mode:
git clone git@github.com:E3-JSI/StreamStoryPyClient.git
cd StreamStoryPyClient
uv venv
uv syncUsing pip:
pip install streamstoryUsing uv:
uv add streamstoryfrom streamstory import StreamStory
from streamstory.entities import BuildModelRequest, DataSource, Config, Attribute, Operation
# Initialize client
client = StreamStory(api_url="https://your-api-url.com", api_key="your-api-key")# Get all models
models = client.get_models()
for model in models:
print(f"Model: {model.name}, UUID: {model.uuid}")
# Get specific model by UUID
model = client.get_model_by_uuid("model-uuid-here")# Create data source
data_source = DataSource(
format="csv",
fieldSep=",",
data="your,csv,data,here"
)
# Define attributes
attributes = [
Attribute(name="value", type="numeric", subType="continuous"),
Attribute(name="timestamp", type="time", subType="timestamp")
]
# Define operations
operations = [
Operation(
op="mean",
inAttr="value",
outAttr="value_mean",
windowUnit="minutes",
windowSize=5
)
]
# Create configuration
config = Config(
numInitialStates=12,
numHistogramBuckets=10,
attributes=attributes,
ops=operations
)
# Build model request
request = BuildModelRequest(
name="My Model",
description="Description of the model",
dataset="dataset_name",
public=False,
dataSource=data_source,
config=config
)
# Build the model
model_info = client.build_model(request)client.delete_model_by_uuid("model-uuid-here")Check the examples/ directory for complete working examples showing how to:
- Load and process datasets
- Configure experiments using YAML files
- Build models with different configurations
- Handle time series data
- Python >= 3.10
- requests >= 2.32.3
- pandas >= 2.2.2
- numpy >= 1.26.4
- python-dotenv >= 1.0.1
- dacite >= 1.8.1
- pydantic >= 2.8.2
StreamStoryPyClient is distributed under the MIT License. See LICENSE for more information.
StreamStoryPyClient is developed by the Department for Artificial Intelligence at the Jozef Stefan Institute, and other contributors.
The project has received funding from the European Union's Horizon Europe innovation programme under Grant Agreement No 101092639 (FAME).