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:

  • product_id (UUID, NOT NULL, FK to ops_products) — every batch must reference a product. See Product Hierarchy.
  • 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.

Operators can log downtime from the My Shifts downtime panel against the selected station. The reason list is filtered by the selected station when a Downtime Reason is configured for specific stations. Reasons with no station availability list remain available at every station on the site. If planned and unplanned versions share the same reason code and name, the logging modal displays one reason row and stores the selected planned or unplanned reason ID based on the row toggle.

The My Shifts downtime panel station list uses the selected My Shifts date range. Each station row summarizes matching downtime events by total count, planned count, unplanned count, active count, and unknown reason type count; stations with no matching events show a no-downtime state.

Downtime events may still be linked to additional affected machines or stations through the event-equipment junction. Active downtime counts are calculated from the event’s primary station and linked affected resources.

Downtime records keep one notes history across the event lifecycle:

  • notes stores the initial context captured when downtime is logged
  • troubleshooting_notes stores investigation details added while troubleshooting or resolving
  • resolution_notes stores the required closeout summary when the downtime is resolved

The event details view and station downtime panel display these note types together as the event’s notes history. The resolve workflow keeps the same notes history together, allows the initial notes and troubleshooting notes to be updated, and requires the resolution notes field as the closeout record.

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_equipment 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. Station downtime views include events where the station is either the primary event equipment or one of the linked affected stations.

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