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
| Name | Description |
|---|---|
OperatorPerformanceEvents | Track and compare operator performance. |
OperatorPerformanceEvents
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
| Name | Description |
|---|---|
production_by_operator | Parts produced per operator. |
operator_efficiency | Operator efficiency vs a per-shift target. |
quality_by_operator | Quality metrics (First Pass Yield) per operator. |
operator_comparison | Ranked operator performance comparison. |
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
time_column | str | Timestamp column. | 'systime' |
shift_definitions | dict[str, tuple[str, str]] | None | Mapping 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
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
| Name | Type | Description | Default |
|---|---|---|---|
operator_uuid | str | UUID for operator/team identifier signal. | required |
counter_uuid | str | UUID for production counter signal. | required |
value_column_operator | str | Column containing operator names. | 'value_string' |
value_column_counter | str | Column containing counter values. | 'value_integer' |
handle_resets | bool | When 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_day | bool | When 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
| Type | Description |
|---|---|
DataFrame | DataFrame 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
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
| Name | Type | Description | Default |
|---|---|---|---|
operator_uuid | str | UUID for operator/team identifier signal. | required |
counter_uuid | str | UUID for production counter signal. | required |
target_per_shift | int | Target production quantity per shift. | required |
value_column_operator | str | Column containing operator names. | 'value_string' |
value_column_counter | str | Column containing counter values. | 'value_integer' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: |
DataFrame | - operator, total_produced, target, efficiency_pct |
quality_by_operator
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
| Name | Type | Description | Default |
|---|---|---|---|
operator_uuid | str | UUID for operator/team identifier signal. | required |
ok_uuid | str | UUID for good parts counter. | required |
nok_uuid | str | UUID of the NOK part counter. | required |
value_column_operator | str | Column containing operator names. | 'value_string' |
value_column_counter | str | Column containing counter values. | 'value_integer' |
handle_resets | bool | When 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
| Type | Description |
|---|---|
DataFrame | DataFrame 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
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
| Name | Type | Description | Default |
|---|---|---|---|
operator_uuid | str | UUID for operator/team identifier signal. | required |
counter_uuid | str | UUID for production counter signal. | required |
value_column_operator | str | Column containing operator names. | 'value_string' |
value_column_counter | str | Column containing counter values. | 'value_integer' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: |
DataFrame | - operator, total_produced, rank, pct_of_best |
DataFrame | Canonical twin columns: share_of_best_pct (after pct_of_best); each holds |
DataFrame | the same values as the deprecated column right before it, which is removed |
DataFrame | in the next major release. |