forge-oee

command
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package main demonstrates the forge package for signed, governed KPI computation.

This example shows the three composable layers of go-codex:

  • Layer 1: Validated domain models — codex.Codec[T] with Refine constraints.
  • Layer 2 (not shown here): API endpoints — api/rest or api/events builders.
  • Layer 3: KPI pipelines — forge.Function[In,Out] with governance + computation graph.

The domain is Overall Equipment Efficiency (OEE), a standard manufacturing KPI:

OEE = Availability × Performance × Quality

Availability measures uptime: how much of the planned production time was running. Performance measures speed: how close to the ideal cycle time the equipment ran. Quality measures correctness: the fraction of units produced without defects.

The example demonstrates:

  1. Domain codecs with validate.RangeFloat constraints.
  2. forge.MeasuredCodec for attaching provenance to values crossing system boundaries.
  3. Minimal pipeline definition — only name + version + codecs + compute fn.
  4. Governed pipeline definition — same but with FunctionOpt governance metadata.
  5. Single-input functions: gradeCalc, availabilityOnlyOEE.
  6. Multi-input functions via struct codecs (codex.Struct): availabilityCalc, performanceCalc.
  7. Sum-type composition: OEEIn assembles validated Availability+Performance+Quality outputs.
  8. Cross-input validation: codec-level RefineFunc (preferred) and WithRefinement (pipeline-level).
  9. forge.Compose: chaining Function[A,B] + Function[B,Out] → Function[A,Out].

10. Structured errors (forge.InputError, RefinementError, ApplyError) via errors.As. 11. stats.PipelineObserver injected via Registry.WithObserver for Apply telemetry. 12. forge.Registry + render/pipeline YAML spec output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL