recipe_phase_adherence
recipe_phase_adherence ¤
Recipe-phase adherence: check each batch phase against a spec.
Batch processes execute a sequence of named phases (heat-up, hold, cool-down, ...). Each phase has a development-defined spec: an expected duration window, a hold-value window, a maximum ramp rate, sometimes a peak ceiling. This detector iterates the phase intervals in a batch and emits one event per phase carrying pass/fail plus which criterion failed.
The spec format is intentionally a plain dict so it can be authored by a
process engineer (or loaded from YAML/JSON) without inventing a new
schema class -- see :meth:evaluate for the recognized keys.
RecipePhaseAdherenceEvents ¤
RecipePhaseAdherenceEvents(
dataframe: DataFrame,
phase_uuid: str,
value_uuid: str,
spec: dict[str, dict[str, Any]],
*,
event_uuid: str = "dev:recipe_phase_adherence",
value_column: str = "value_double",
time_column: str = "systime"
)
Bases: Base
Evaluate batch recipe phases against a declarative spec.
The spec is a mapping {phase_name: criteria_dict}. Recognized
criteria keys (all optional) per phase:
duration_seconds--(min, max)seconds.duration_sis the deprecated spelling of the same criterion: it still works, with aDeprecationWarning, until the next major release (giving both for one phase raisesValueError);criteria_failednames the key the spec used.hold_value--(min, max)for the mean value during the phase.ramp_rate_max-- maximum absolute slope (value-units per second) computed from the first to the last sample.peak_value--(min, max)for the phase max.trough_value--(min, max)for the phase min.
Missing criteria are not checked. A phase whose name is absent from
the spec is reported with pass=True and an empty
criteria_failed list (the phase was observed but not constrained).
evaluate ¤
evaluate(
*,
interval_end: str = "next_change",
data_end: Timestamp | None = None
) -> pd.DataFrame
Evaluate every observed phase interval against the spec.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interval_end
|
str
|
How each phase interval is closed.
|
'next_change'
|
data_end
|
Timestamp | None
|
Optional bound for the final phase when
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame
|
Interval-shape DataFrame, one row per phase occurrence, |
|
columns |
DataFrame
|
|
DataFrame
|
|
|
DataFrame
|
|
|
DataFrame
|
|