Skip to main content
Version: 0.0.98

ts_shape.events.production.flow_metrics

Flow metrics and Little's Law analysis for production lines.

Treats a process as a queue between an entry signal and an exit signal and derives the classic flow metrics an industrial engineer relies on:

  • work in process (WIP) over time, time-weighted,
  • throughput (units out per window),
  • lead time (FIFO-matched entry -> exit),
  • a flow summary tying them together via Little's Law (WIP = throughput x lead_time) plus Process Cycle Efficiency.

Entry and exit are boolean signals; each rising edge is one unit.

Classes
NameDescription
FlowMetricsEventsWIP, throughput, lead time and Little's Law metrics for a process.

FlowMetricsEvents​

classsource
FlowMetricsEvents(
dataframe: pd.DataFrame,
entry_uuid: str,
exit_uuid: str,
*,
event_uuid: str = "prod:flow_metrics",
value_column: str = "value_bool",
time_column: str = "systime"
) -> None

Bases: Base

WIP, throughput, lead time and Little's Law metrics for a process.

Example usage::

flow = FlowMetricsEvents(df, entry_uuid="u_in", exit_uuid="u_out")
flow.wip_over_time(window="1h")
flow.throughput(window="1h")
flow.lead_time()
flow.flow_summary(value_add_seconds=120, window="1h")
Functions
NameDescription
wip_over_timeTime-weighted work-in-process per window.
throughputUnits completed (exit rising edges) per window.
lead_timeFIFO-matched lead time per unit (entry -> exit).
flow_summaryCombined flow metrics with a Little's Law consistency check.
Parameters
NameTypeDescriptionDefault
dataframeDataFrameInput DataFrame with timeseries data.required
entry_uuidstrUUID of the boolean unit-entry signal.required
exit_uuidstrUUID of the boolean unit-exit signal.required
event_uuidstrUUID to tag derived events with.'prod:flow_metrics'
value_columnstrColumn holding the boolean trigger.'value_bool'
time_columnstrName of the timestamp column.'systime'

wip_over_time​

methodsource
wip_over_time(window: str = '1h') -> pd.DataFrame

Time-weighted work-in-process per window.

Parameters
NameTypeDescriptionDefault
windowstrResample window (e.g. "1h").'1h'
Returns
TypeDescription
DataFrameSummary-shape DataFrame with columns: start, end, duration_seconds,
DataFramewip_mean, wip_max, wip_min.

throughput​

methodsource
throughput(window: str = '1h') -> pd.DataFrame

Units completed (exit rising edges) per window.

Parameters
NameTypeDescriptionDefault
windowstrResample window.'1h'
Returns
TypeDescription
DataFrameSummary-shape DataFrame with columns: start, end, duration_seconds,
DataFrameunits_out, throughput_per_hour.

lead_time​

methodsource
lead_time() -> pd.DataFrame

FIFO-matched lead time per unit (entry -> exit).

The nth entry is matched to the nth exit (first-in-first-out).

Returns
TypeDescription
DataFramePoint-shape DataFrame with columns: systime (exit time), uuid,
DataFramesource_uuid, lead_time_seconds, unit_index.

flow_summary​

methodsource
flow_summary(
*, value_add_seconds: Number | None = None, window: str = "1h"
) -> pd.DataFrame

Combined flow metrics with a Little's Law consistency check.

Little's Law lead time = WIP / throughput. consistency_factor is the measured FIFO lead time divided by that prediction (≈ 1 for a stable, FIFO process). Process Cycle Efficiency = value-add time / lead time.

Parameters
NameTypeDescriptionDefault
value_add_secondsNumber | NoneValue-add (touch) time per unit, for PCE. Seconds number or offset string; omit to skip the PCE column.None
windowstrResample window.'1h'
Returns
TypeDescription
DataFrameSummary-shape DataFrame with columns: start, end, duration_seconds,
DataFramewip_mean, throughput_per_hour, lead_time_mean_seconds,
DataFramelittles_law_lead_time_seconds, consistency_ratio,
DataFrameconsistency_factor, and process_cycle_efficiency_pct when
DataFramevalue_add_seconds is given.
DataFrameCanonical twin columns: consistency_factor (after
DataFrameconsistency_ratio, which is not a 0-1 fraction); it holds the
DataFramesame values as the deprecated column right before it, which is
DataFrameremoved in the next major release.