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 recognised 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}. Recognised
criteria keys (all optional) per phase:
duration_s--(min, max)seconds.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() -> pd.DataFrame
Evaluate every observed phase interval against the spec.
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame
|
Interval-shape DataFrame, one row per phase occurrence, |
|
columns |
DataFrame
|
|
DataFrame
|
|
|
DataFrame
|
|
|
DataFrame
|
|