Entity-based time-series processing framework for Python
Project description
TimeSeriesFlow
Entity-based time-series processing for Python, plus AdaptiveForecast for profile-driven model architecture selection.
Write one function per entity (sensor_id, device_id, customer_id, ...). The framework handles grouping, retries, checkpointing, progress, memory tracking, and logging.
| Package | Role |
|---|---|
| timeseriesflow | Per-entity processing, EntityRunner, CLI (tsflow), checkpoints |
| adaptiveforecast | Series profiling and forecasting architecture recommendations |
What is AdaptiveForecast?
AdaptiveForecast answers one question before you train anything:
Given this time series, which forecasting approach is worth trying first?
It profiles volatility, trend, seasonality, gaps, spikes, and data quality, then returns ranked recommendations (moving_average, exponential_smoothing, lstm, ...). Rules are deterministic, not LLM-based.
| Situation | How it helps |
|---|---|
| Many sensors or devices | Pick a model family per entity, not one global default |
| Mixed data quality | ValidationGate flags series too short or noisy to forecast |
| Team handoffs | reason fields explain each recommendation |
| With TimeSeriesFlow | Profile inside @entity_flow (combined workflow) |
It does not train models or produce forecasts. It recommends architecture recipes only.
Install
v0.2.0 from PyPI:
pip install timeseriesflow
Pin a release or install from git:
pip install timeseriesflow==0.2.0
pip install git+https://github.com/baban9/timeseriesflow.git@v0.2.0
Development install:
git clone https://github.com/baban9/timeseriesflow.git
cd timeseriesflow
pip install -e ".[dev]"
Requires Python 3.10+.
Quick start
Recommended API: @entity_flow for logic, EntityRunner or tsflow run for production.
import pandas as pd
from timeseriesflow import EntityContext, entity_flow
df = pd.DataFrame(
{
"sensor_id": ["S1", "S1", "S1", "S2", "S2", "S2"],
"timestamp": pd.date_range("2024-01-01", periods=6, freq="h", tz="UTC"),
"value": [1.0, 2.0, 3.0, 10.0, 11.0, 12.0],
}
)
@entity_flow(entity_key="sensor_id", time_key="timestamp")
def process_sensor(df: pd.DataFrame, ctx: EntityContext) -> dict[str, object]:
return {
"sensor_id": ctx.entity_id,
"rows": len(df),
"mean_value": float(df["value"].mean()),
}
result = process_sensor.run(df)
print(f"succeeded={result.succeeded} failed={result.failed}")
print(result.outputs)
Expected output:
succeeded=2 failed=0
[{'sensor_id': 'S1', 'rows': 3, 'mean_value': 2.0}, {'sensor_id': 'S2', 'rows': 3, 'mean_value': 11.0}]
CLI
tsflow run examples/basic_pipeline.py
tsflow validate examples/basic_pipeline.py
tsflow info
tsflow checkpoint-status --checkpoint-dir ./checkpoints
AdaptiveForecast
from adaptiveforecast import ProfileAwareArchitectureSelection
result = ProfileAwareArchitectureSelection(
time_column="timestamp",
value_column="value",
max_models=3,
).select(df)
print(result.best_model)
print(result.recommendation.to_dict())
Examples
python examples/advise_and_process.py # TimeSeriesFlow + AdaptiveForecast
python examples/adaptiveforecast_profile.py # profiling only
python examples/architecture_selection.py # full selection workflow
Legacy API:
Flow+FlowConfigstill works. New projects should use@entity_flow. Deprecation warning planned for v0.2.
Features
TimeSeriesFlow: entity grouping, retries, JSONL checkpoints, Rich progress, memory tracking, CSVSource / ParquetSource, tsflow CLI.
AdaptiveForecast: series profiling, validation gate, seven recipes (naive through cnn_lstm), explainable ModelAdvisor rules.
Documentation
| Topic | Link |
|---|---|
| Golden path (recommended) | docs/golden_path.md |
| Combined TS + AdaptiveForecast | docs/combined_workflow.md |
| AdaptiveForecast intro | docs/adaptiveforecast.md |
| Sparse time series | docs/sparse_series.md |
| Architecture selection | docs/architecture_selection.md |
| Getting started | docs/getting_started.md |
| EntityRunner | docs/runner.md |
| CLI | docs/cli.md |
| Public API | docs/api.md |
| Changelog | CHANGELOG.md |
Development
pytest
ruff check src tests examples
mypy src
Contributing
main is protected. Open a pull request with review; do not push directly to main.
git checkout -b feat/my-change
git push -u origin feat/my-change
gh pr create --fill
See CONTRIBUTING.md and branch protection guide.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timeseriesflow-0.2.0.tar.gz.
File metadata
- Download URL: timeseriesflow-0.2.0.tar.gz
- Upload date:
- Size: 69.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da2f667db7dd38dd8f34a29f46070989aeff6a0bf89bcca9a0ad22f58d193d69
|
|
| MD5 |
1906f8c7e439f22d393d30a105626eab
|
|
| BLAKE2b-256 |
ad10828728493d70aefdcb5604b6b5e03de14721f05b8fcf4f7b9b78463bb064
|
Provenance
The following attestation bundles were made for timeseriesflow-0.2.0.tar.gz:
Publisher:
publish.yml on baban9/timeseriesflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
timeseriesflow-0.2.0.tar.gz -
Subject digest:
da2f667db7dd38dd8f34a29f46070989aeff6a0bf89bcca9a0ad22f58d193d69 - Sigstore transparency entry: 1790602151
- Sigstore integration time:
-
Permalink:
baban9/timeseriesflow@8e2ab54a59bd38d952795704c321cc34ceca519f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/baban9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e2ab54a59bd38d952795704c321cc34ceca519f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file timeseriesflow-0.2.0-py3-none-any.whl.
File metadata
- Download URL: timeseriesflow-0.2.0-py3-none-any.whl
- Upload date:
- Size: 48.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f685219af493fc7db994b5d08539a924529e9ebab16dc8dc438235b118f81bd6
|
|
| MD5 |
b0eaed53cca504cfc8edddfbc991aa0e
|
|
| BLAKE2b-256 |
f08c24d14fa51d11929f2d13169db2a405769b49f462e31b7ac96cbb6ebac456
|
Provenance
The following attestation bundles were made for timeseriesflow-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on baban9/timeseriesflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
timeseriesflow-0.2.0-py3-none-any.whl -
Subject digest:
f685219af493fc7db994b5d08539a924529e9ebab16dc8dc438235b118f81bd6 - Sigstore transparency entry: 1790602224
- Sigstore integration time:
-
Permalink:
baban9/timeseriesflow@8e2ab54a59bd38d952795704c321cc34ceca519f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/baban9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e2ab54a59bd38d952795704c321cc34ceca519f -
Trigger Event:
workflow_dispatch
-
Statement type: