changeover
changeover ¤
ChangeoverEvents ¤
ChangeoverEvents(
dataframe: DataFrame,
*,
event_uuid: str = "prod:changeover",
time_column: str = "systime"
)
Bases: Base
Production: Changeover
Detect product/recipe changes and compute changeover windows without requiring a dedicated 'first good' signal.
Methods: - detect_changeover: point events when product/recipe changes. - changeover_window: derive an end time via fixed window or 'stable_band' metrics. - changeover_quality_metrics: per-product changeover counts and time between changeovers.
detect_changeover ¤
detect_changeover(
product_uuid: str,
*,
value_column: str = "value_string",
min_hold: str = "0s",
include_initial: bool = True
) -> pd.DataFrame
Emit point events when the product/recipe changes value.
Uses a hold check: the new product must persist for at least min_hold until the next change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_uuid
|
str
|
UUID of the product/recipe signal. |
required |
value_column
|
str
|
Column containing the product value. |
'value_string'
|
min_hold
|
str
|
Minimum time the new product must persist to count. |
'0s'
|
include_initial
|
bool
|
When True (default) the first reading is emitted
as a changeover event, marking the product active at the start
of the data. A changeover strictly requires a prior, different
value, so pass |
True
|
changeover_window ¤
changeover_window(
product_uuid: str,
*,
value_column: str = "value_string",
start_time: Timestamp | None = None,
until: str = "fixed_window",
config: dict[str, Any] | None = None,
fallback: dict[str, Any] | None = None
) -> pd.DataFrame
Compute changeover windows per product change with enhanced configurability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_uuid
|
str
|
UUID of the product/recipe signal. |
required |
value_column
|
str
|
Column containing the product value. |
'value_string'
|
start_time
|
Timestamp | None
|
Only changes at or after this timestamp are used. None uses all changes. |
None
|
until
|
str
|
How each window's end is found:
Any other value, or a stable band that is never reached, uses
|
'fixed_window'
|
config
|
dict[str, Any] | None
|
Method settings. Keys: None means an empty dict. |
None
|
fallback
|
dict[str, Any] | None
|
Used when the window end cannot be determined:
|
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds (float |
DataFrame
|
seconds, end - start), uuid, source_uuid, is_delta, method, |
DataFrame
|
completed. |
changeover_quality_metrics ¤
changeover_quality_metrics(
product_uuid: str, *, value_column: str = "value_string"
) -> pd.DataFrame
Per-product changeover frequency: how often, and how far apart.
For each product, counts the changeovers to that product and
summarizes the time between consecutive ones. Changeover durations
are not measured here (a product-signal change is a point, not an
interval); use :meth:changeover_window for when the process is
stable again after a changeover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_uuid
|
str
|
UUID of the product/recipe signal. |
required |
value_column
|
str
|
Column containing the product value. |
'value_string'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with one row per product: product, changeover_count, |
DataFrame
|
avg_time_between_seconds, min_time_between_seconds, |
DataFrame
|
max_time_between_seconds, std_time_between_seconds (time between |
DataFrame
|
consecutive changeovers to that product; None with fewer than |
DataFrame
|
two). Empty when there are fewer than two changeovers. |