Skip to content

feat(mes): Week 3 — OEE calculator service#141

Open
Mikecranesync wants to merge 1 commit into
mainfrom
feat/mes-week3-oee-calculator
Open

feat(mes): Week 3 — OEE calculator service#141
Mikecranesync wants to merge 1 commit into
mainfrom
feat/mes-week3-oee-calculator

Conversation

@Mikecranesync
Copy link
Copy Markdown
Owner

Summary

  • Adds compute_oee() pure function: Availability × Performance × Quality, all values clamped [0,1] and rounded to 4 decimal places (PRD-MES-CORE.md §10 AC#3, AC#5)
  • 60-second tick loop per line: ItemCount delta from HR100, run_time from machine_states, ideal_cycle_sec from active work order (defaults 1.0)
  • 30-tick consecutive low-OEE alert at < 60% threshold
  • 4 new REST endpoints: GET /api/mes/lines/{id}/oee, /oee/history, /oee/summary, /kpis
  • oee_calculator background task wired into FastAPI lifespan alongside state_poller
  • 16 new tests, zero regressions — full suite 48/48

Test plan

  • pytest tests/test_oee.py -v — 16/16 pass (OEE math, alert logic, constants)
  • pytest tests/ -v — 48/48 pass (no regressions against Week 1+2)
  • All acceptance criteria AC#3 (OEE ± 0.01) and AC#5 (TEEP reported) verified numerically

Closes

Closes MIRA#321

🤖 Generated with Claude Code

Adds OEE computation engine, 60-second tick loop, fleet endpoints:
- compute_oee() pure function: A×P×Q with clamp/rounding (PRD §10 AC#3, AC#5)
- 30-tick alert at OEE < 60% per line (OEE_ALERT_TICKS=30)
- ItemCount delta tracking from HR100 (cumulative register)
- run_time_in_window() SQL: sums RUNNING seconds in last tick window
- 4 new endpoints: /oee, /oee/history, /oee/summary, /kpis
- oee_calculator background task wired into FastAPI lifespan
- 16 new tests, zero regressions (48/48 suite)

Closes MIRA#321

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant