Events

oee events

Events are time-stamped records of what happens at stations and machines. All event types share the same table (oee_machine_events) with type-specific columns. Events are not machine-specific — they can belong to stations, machines, or both.

Event Types

There are three event types, each with distinct ownership and behavior rules:

AspectDowntimeIncidentsJobs
Belongs toMultiple machines and/or stationsMultiple machines and/or stationsOne station at a time
Simultaneous resourcesN/AN/AMultiple machines + people contribute time
Cross-station trackingN/AN/AVia job_number
CompletingResolving the eventResolving the eventFinishing at this station

1. Job (event_type = 'job')

Production run events at a Station. A job belongs to one station at a time — it cannot span multiple stations simultaneously. However, multiple machines and people contribute hours towards the same job at that station. Hours are cumulative: 3 people x 2 hours = 6 person-hours.

Completing a job means finishing it at the current station. Tracking a job across stations is done by job_number — see Job Number Tracking below.

Extended by oee_batch_details table with:

  • batch_number, work_order
  • target_quantity, good_parts, scrap_parts, total_parts
  • status: running, completed, aborted
  • abort_reason_id, scrap_reason_id

See OEE Job for full details.

2. Downtime (event_type = 'downtime')

Periods where a station or machine is not producing. A single downtime event can be linked to multiple machines and/or stations simultaneously — for example, a power outage affecting several machines and the stations they belong to.

Uses:

  • downtime_reason_id (FK to oee_downtime_reasons)

The downtime type (planned/unplanned/idle) is inherited from the parent group. See Downtime Reason.

3. Incident (event_type = 'incident')

Notable occurrences logged against stations or machines. A single incident can be linked to multiple machines and/or stations simultaneously — for example, a quality issue affecting multiple machines across stations.

Uses:

  • incident_reason_id (FK to oee_incident_reasons)
  • troubleshooting_started_at/by — Investigation tracking
  • troubleshooting_notes
  • resolved_at/by — Resolution tracking
  • resolution_notes

See Incident Reason for the taxonomy.

Job Number Tracking

The job_number (stored as batch_number in oee_batch_details) is how work is tracked as it moves through a process flow. Jobs with the same job_number at different stations represent the same work moving through the system.

  • A job exists at one station at a time — it is created, worked on, and completed at that station
  • When the same work moves to the next station, a new job event is created there with the same job_number
  • Querying all jobs with a given job_number across stations reveals the full journey of that work through the site

Database Table: oee_machine_events

ColumnTypeDescription
idUUID (PK)Auto-generated
organization_idVARCHAR(50)Org ownership
site_idUUID (FK)References Site
machine_idUUID (FK)Which Machine (nullable for station-only events)
event_typeVARCHAR(20)'job', 'downtime', or 'incident'
job_idUUID (FK, nullable)Direct link to a job (ops_jobs)
start_tsTIMESTAMPTZEvent start time
end_tsTIMESTAMPTZEvent end time (NULL = active/running)
duration_minutesDECIMAL(10,2)Calculated duration
notesTEXTFree-text notes
is_archivedBOOLEANSoft-delete flag
created_by / completed_byVARCHAR(50)Who created/closed the event

Multi-Resource Events

The oee_machine_event_machines junction table allows a single event to be associated with multiple machines and/or stations. For downtime and incident events, this enables recording that multiple resources are affected simultaneously.

Status Derivation

Event status is derived from timestamps, not stored as a separate field:

  • Active/Running: end_ts IS NULL
  • Completed/Closed: end_ts IS NOT NULL

Key Indexes

  • (machine_id, start_ts DESC) — timeline queries
  • machine_id WHERE end_ts IS NULL — active events
  • event_type — type-specific filtering
  • job_id — cross-referencing with OPS jobs

Codebase Paths

  • Table: database/sql_scripts/tables/oee_machine_events.sql
  • Batch details: database/sql_scripts/tables/oee_batch_details.sql
  • Multi-resource junction: database/sql_scripts/tables/oee_machine_event_machines.sql

History

This page was previously titled “Machine Events” when events were modeled as machine-centric.

See Also