Product Hierarchy

ops product hierarchy

The product data model follows a two-level hierarchy within each Site:

graph TD
    Site["Site (oee_sites)"] --> PF["Product Families (ops_product_families)"]
    PF --> P["Products (ops_products)"]
    P -.->|used by| Job["OPS Jobs (ops_jobs)"]
    P -->|oee_batch_details.product_id| Batch["Batches (oee_batch_details)"]
    P --> EPS["Equipment Product Standards (oee_product_equipment_config)"]

Level 1: Product Families

Product Families are simple grouping directories:

  • family_code + family_name — identification
  • description — optional description
  • sort_order — display ordering

Product families carry no production data. They exist purely to organize products.

Scope: Per-site. Each family code is unique within a site.

Level 2: Products

Products are specific items within a family and carry all production parameters:

  • product_code + product_name — identification
  • standard_hours NUMERIC(10,2) — target hours per unit, drives efficiency calculations
  • default_quantity INTEGER — default job size
  • target_scrap_rate NUMERIC(5,2) — acceptable scrap percentage
  • unit_value NUMERIC(12,2) — sale value per unit
  • is_active — can be deactivated without deletion

Scope: Per-family. Each product code is unique within its family.

Standard Hours

The standard_hours field on ops_products drives the Efficiency Calculation:

Efficiency = standard_hours / actual_hours x 100%

If standard_hours is NULL or 0, no efficiency calculation is possible for that product.

Per-Equipment Standard Hours

Products can also have per-equipment overrides for standard_hours and target_scrap_rate via the oee_product_equipment_config table. See Equipment Product Standards for details. This relationship is currently at the equipment level and will migrate to the station level in a future release.

Per-Station Standard Hours

The ops_station_product_standards table allows defining different standard hours for the same product family at different stations:

ColumnTypeDescription
product_family_idUUID (FK)Which Product Family
station_idUUID (FK)Which Station
cycle_timeNUMERICExpected cycle time at this station
scrap_rateNUMERICExpected scrap rate at this station
standard_hoursNUMERICStation-specific standard hours

Unique constraint: (product_family_id, station_id)

Relationship to Jobs

When posting a job, the operator selects a Product (which implicitly selects its family). The job stores both product_id and product_family_id. The product’s standard_hours drives efficiency calculations, and default_quantity pre-fills the quantity field.

Management UI

Products and families are managed via the Product Families tab in the OEE Settings modal (gear icon on the OEE dashboard, /oee/stations). This is not a standalone navigation page — it lives inside the settings modal.

The tab uses a master-detail layout:

  • Left panel: List of product families for the selected site
  • Right panel: Family detail (name, code, description) at the top, with a list of products below
  • Products display as expandable cards with inline editing for all production fields

Relationship to Batches

Every batch requires a product. When an operator starts a batch via the Process Flow or production line UI:

  • The product dropdown lists active products for the site (required field)
  • The product’s default_quantity pre-fills the target_quantity field on the batch; the operator can override it
  • Product information (code and name) appears in:
    • Batch History page
    • Event Log table
    • Process Flow batch badges
    • Production Line equipment cards
    • CSV exports (product_name, product_code columns)

See Batches for the full batch lifecycle.

Codebase Paths

  • Product Families table: database/sql_scripts/tables/ops_product_families.sql
  • Products table: database/sql_scripts/tables/ops_products.sql
  • Station standards: database/sql_scripts/tables/ops_station_product_standards.sql
  • Product functions: database/sql_scripts/functions/ops/ops_product_functions.sql
  • Family functions: database/sql_scripts/functions/ops/ops_product_family_functions.sql

See Also