ts-shape¤
Why ts-shape?¤
-
DataFrame-First
Every operation accepts and returns Pandas DataFrames. No proprietary formats, no lock-in — plug into any notebook or dashboard.
-
Modular Design
Use only what you need. Loaders, transforms, features, and event detectors are fully decoupled.
-
Multi-Source Loading
Load from Parquet, S3, Azure Blob, or TimescaleDB with a unified interface. Enrich with JSON metadata.
-
Manufacturing-Ready
OEE, SPC, cycle times, downtime tracking, shift reports — built-in modules for real production use cases.
From Signals to Insights¤
from ts_shape.loader.timeseries.parquet_loader import ParquetLoader
uuids = ["machine-state", "part-counter", "temperature"]
df = ParquetLoader.load_by_uuids("data/", uuids, "2024-01-01", "2024-01-31")
from ts_shape.transform.filter.numeric_filter import NumericFilter
clean = NumericFilter.filter_value_in_range(df, "value_double", 0, 500)
from ts_shape.features.stats.numeric_stats import NumericStatistics
stats = NumericStatistics(clean, "value_double")
print(f"Mean: {stats.mean():.2f} Std: {stats.std():.2f}")
from ts_shape.events.production.machine_state import MachineStateEvents
mse = MachineStateEvents(df, run_state_uuid="machine-state")
intervals = mse.detect_run_idle(min_duration="30s")
Architecture¤
flowchart LR
subgraph Input
A1[Parquet]
A2[S3 / Azure]
A3[TimescaleDB]
end
A1 --> L[Load & Enrich]
A2 --> L
A3 --> L
L --> T[Transform & Filter]
T --> F[Features & Statistics]
F --> E[Event Detection]
E --> O[Production KPIs & Reports]
End-to-End Pipelines¤
Each pipeline starts with an Azure connection, a UUID list, and a time range — and produces actionable KPIs.
-
Machine state + counters + rejects into daily Availability, Performance, Quality, and OEE by shift.
4 UUIDs
-
Cycle triggers + part numbers into statistics, slow-cycle detection, and golden-cycle comparison.
3 UUIDs
-
Machine state + reason codes into Pareto analysis, shift downtime, and availability trends.
2 UUIDs
-
Measurements + tolerances into outlier detection, SPC rule checks, and Cp/Cpk capability trending.
1+ UUIDs
-
Setpoint + actual + state signals into setpoint adherence, startup detection, and stability scores.
3 UUIDs
Core Modules¤
Loaders¤
- Parquet — Local and remote files
- S3 Proxy — S3-compatible storage
- Azure Blob — Container layouts
- TimescaleDB — SQL timeseries
- Metadata JSON — Context enrichment
Transforms¤
- Numeric Filter — Range, threshold
- String Filter — Pattern matching
- DateTime Filter — Time ranges
- Boolean Filter — Flag filtering
- Calculator — Derived columns
- Harmonization — Multi-signal alignment
Features¤
- Numeric Stats — min, max, mean, std
- Time Stats — Coverage, gaps
- String Stats — Value counts
- Cycles — Extraction & processing
Events¤
- Quality & SPC — Outliers, control charts, Cp/Cpk
- Production — Machine states, downtime, changeovers
- OEE — Availability, performance, quality
- Traceability — Part tracking across stations
- Engineering — Setpoints, startup, steady-state
- Maintenance — Degradation, failure prediction
Data Model¤
ts-shape uses a simple long-format schema. Use only the columns you need.
| Column | Type | Description |
|---|---|---|
uuid |
string | Signal identifier |
systime |
datetime | Timestamp |
value_double |
float | Numeric values |
value_integer |
int | Integer values |
value_string |
string | String values |
value_bool |
bool | Boolean values |
-
Concept
Architecture and design principles.
-
Guides
Topic-focused guides from data acquisition to shift reports.
-
Pipelines
End-to-end workflows from Azure to production KPIs.
-
API Reference
Complete auto-generated API documentation.
-
Examples
Runnable examples for every module category.
-
GitHub
Source code, issues, and contributions.
MIT License — Built for the timeseries community