Skip to main content
Version: Next

ts_shape.events.production.operator_performance

Operator/team performance tracking.

Compare production output and quality across operators:

  • Production by operator
  • Operator efficiency vs targets
  • Quality by operator
  • Operator ranking/comparison
Classes
NameDescription
OperatorPerformanceEventsTrack and compare operator performance.

OperatorPerformanceEvents​

classsource
OperatorPerformanceEvents(
dataframe: pd.DataFrame,
*,
time_column: str = "systime",
shift_definitions: dict[str, tuple[str, str]] | None = None
) -> None

Bases: Base

Track and compare operator performance.

Each UUID represents one signal:

  • operator_uuid: operator or team identifier signal
  • counter_uuid: production counter signal
  • ok_uuid / nok_uuid: OK/NOK part counters (optional, for quality)

Merge keys: [operator] for operator-level, [date, shift] for shift-level.

Pipeline example::

ops = OperatorPerformanceEvents(df)
by_op = ops.production_by_operator('operator_id', 'part_counter')
# → standalone KPI report
quality = ops.quality_by_operator('operator_id', 'good_parts', 'bad_parts')
# → merge with QualityEvents outputs on [date, shift]
Example usage

tracker = OperatorPerformanceEvents(df)

Parts per operator

prod = tracker.production_by_operator( operator_uuid='operator_id', counter_uuid='part_counter', )

Efficiency vs target

eff = tracker.operator_efficiency( operator_uuid='operator_id', counter_uuid='part_counter', target_per_shift=500, )

Functions
NameDescription
production_by_operatorParts produced per operator.
operator_efficiencyOperator efficiency vs a per-shift target.
quality_by_operatorQuality metrics (First Pass Yield) per operator.
operator_comparisonRanked operator performance comparison.
Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format timeseries frame (one row per sample, uuid identifies the signal).required
time_columnstrTimestamp column.'systime'
shift_definitionsdict[str, tuple[str, str]] | NoneMapping of shift name to (start, end) "HH:MM" times. None (default) uses three shifts: 06:00-14:00, 14:00-22:00, 22:00-06:00.None

production_by_operator​

methodsource
production_by_operator(
operator_uuid: str,
counter_uuid: str,
*,
value_column_operator: str = "value_string",
value_column_counter: str = "value_integer",
handle_resets: bool = True,
production_day: bool = True
) -> pd.DataFrame

Parts produced per operator.

Parameters
NameTypeDescriptionDefault
operator_uuidstrUUID for operator/team identifier signal.required
counter_uuidstrUUID for production counter signal.required
value_column_operatorstrColumn containing operator names.'value_string'
value_column_counterstrColumn containing counter values.'value_integer'
handle_resetsboolWhen True (default), treat a decreasing counter as a reset and count the production accumulated after the reset instead of losing it. The increments are computed once over the whole signal and booked to the (operator, date, shift) of the reading that reports them, so the operators add up to the signal total and nothing is lost at a shift or operator change. The result gains a resets column with the number of resets observed across the operator's shifts. When False, each shift uses max(0, last - first) and a shift containing a reset reports too little (often 0).True
production_dayboolWhen True, an overnight shift's post-midnight readings are attributed to the shift's start date, so a night shift counts as one worked shift. Default True; False groups by raw calendar date. Only affects overnight schedules.True
Returns
TypeDescription
DataFrameDataFrame with columns:
DataFrame- operator, total_produced, shifts_worked, avg_per_shift
DataFrame- resets: Number of counter resets across the operator's shifts (only when handle_resets=True)

operator_efficiency​

methodsource
operator_efficiency(
operator_uuid: str,
counter_uuid: str,
target_per_shift: int,
*,
value_column_operator: str = "value_string",
value_column_counter: str = "value_integer"
) -> pd.DataFrame

Operator efficiency vs a per-shift target.

Parameters
NameTypeDescriptionDefault
operator_uuidstrUUID for operator/team identifier signal.required
counter_uuidstrUUID for production counter signal.required
target_per_shiftintTarget production quantity per shift.required
value_column_operatorstrColumn containing operator names.'value_string'
value_column_counterstrColumn containing counter values.'value_integer'
Returns
TypeDescription
DataFrameDataFrame with columns:
DataFrame- operator, total_produced, target, efficiency_pct

quality_by_operator​

methodsource
quality_by_operator(
operator_uuid: str,
ok_uuid: str,
nok_uuid: str,
*,
value_column_operator: str = "value_string",
value_column_counter: str = "value_integer",
handle_resets: bool = True
) -> pd.DataFrame

Quality metrics (First Pass Yield) per operator.

Parameters
NameTypeDescriptionDefault
operator_uuidstrUUID for operator/team identifier signal.required
ok_uuidstrUUID for good parts counter.required
nok_uuidstrUUID of the NOK part counter.required
value_column_operatorstrColumn containing operator names.'value_string'
value_column_counterstrColumn containing counter values.'value_integer'
handle_resetsboolWhen True (default), treat a decreasing counter as a reset and count the OK/NOK parts accumulated after the reset, for both the OK and NOK counters. Because the counts are taken over the whole range, a single reset otherwise wipes out an operator's entire tally. The result gains a resets column with the number of resets observed across the operator's OK and NOK counters. The increments are computed once over each whole signal and booked to the operator of the reading that reports them, so the operators add up to the signal totals (also when operators alternate). When False, both counters use max(0, last - first) per operator and a reset is lost.True
Returns
TypeDescription
DataFrameDataFrame with columns:
DataFrame- operator, ok_count, nok_count, first_pass_yield_pct
DataFrame- resets: Number of counter resets across the operator's OK and NOK counters (only when handle_resets=True)

operator_comparison​

methodsource
operator_comparison(
operator_uuid: str,
counter_uuid: str,
*,
value_column_operator: str = "value_string",
value_column_counter: str = "value_integer"
) -> pd.DataFrame

Ranked operator performance comparison.

Parameters
NameTypeDescriptionDefault
operator_uuidstrUUID for operator/team identifier signal.required
counter_uuidstrUUID for production counter signal.required
value_column_operatorstrColumn containing operator names.'value_string'
value_column_counterstrColumn containing counter values.'value_integer'
Returns
TypeDescription
DataFrameDataFrame with columns:
DataFrame- operator, total_produced, rank, pct_of_best
DataFrameCanonical twin columns: share_of_best_pct (after pct_of_best); each holds
DataFramethe same values as the deprecated column right before it, which is removed
DataFramein the next major release.