Batch Metrics Dashboard
The Batch Metrics Dashboard gives production and quality managers an at-a-glance view of how batches are flowing through your facility — how many were released, how long they took, how much yield, where they got stuck, and what's currently in progress.
Where to find it: Production → Batch Dashboard (or visit /batches/dashboard directly).
Quick start
- Pick a date range using the preset buttons (This week, This month, This quarter, This year) or set a custom range with the From and To date pickers.
- Choose your bucket (Weekly / Monthly / Quarterly / Yearly) — this controls the granularity of the trend chart.
- Optionally narrow the view by Type (FG vs WIP).
- Tick Compare to previous to overlay the previous equivalent period for delta analysis.
- Use the Refresh button (top-right) at any time to re-pull live data.
The grid at the bottom updates with every filter change. Use the Excel Export button to download the visible batches as a spreadsheet.
Page layout
┌────────────────────────────────────────────────────────────────────┐ │ Header: title + Refresh │ ├────────────────────────────────────────────────────────────────────┤ │ Filter bar: date range, bucket, type, compare-to-previous │ ├────────────────────────────────────────────────────────────────────┤ │ KPI strip (8 cards): cycle times, yield, on-hold, reworks, NCs │ ├────────────────────────────────────────────────────────────────────┤ │ Trend chart: released count + avg cycle time over the period │ ├────────────────────────────────────────────────────────────────────┤ │ Top products | Cycle time + yield distribution │ ├────────────────────────────────────────────────────────────────────┤ │ Active batches by status | On-hold leaderboard │ ├────────────────────────────────────────────────────────────────────┤ │ Batches grid: per-batch detail, Excel export │ └────────────────────────────────────────────────────────────────────┘
Filter bar
| Control | What it does |
|---|---|
| This week / month / quarter / year | One-click date range presets. Each preset also auto-selects a sensible bucket (weekly bucket for week/month, monthly bucket for quarter/year). |
| Custom | Lets you set arbitrary From and To dates without altering the bucket. |
| From / To | Manual ISO date input. Selecting a date here switches the preset to Custom. |
| Bucket | Granularity for the trend chart only — Weekly / Monthly / Quarterly / Yearly. KPIs and the per-batch grid are not affected. |
| Type | Limit the dashboard to FG (Finished Goods), WIP (Work In Progress), or both. |
| Compare to previous | When ticked, KPI cards show a Δ (% change) below each value, and the trend chart overlays the previous period as a dashed line. The "previous period" is the immediately preceding window of the same length. |
Note: The Active batches by status panel is always live (current state of the system) and ignores the date range and Type filter.
KPI strip
The top strip is eight cards. Cards 2–4 (the cycle-time KPIs) are highlighted with a thin orange rule because they're the headline operational metrics.
| Card | What it measures |
|---|---|
| Batches Released | Number of batches that finished release in the period. |
| Avg Full Cycle | Average time from batch creation → first release. Includes any pre-production wait time (creation to first ingredient touch). Use this for total lifecycle. |
| Avg Making → Release | Average time from the first ingredient being entered → first release. This excludes pre-production wait and is the closest proxy for "actual production duration". |
| Avg Ingredient Entry | Average time spent entering ingredients (first ingredient modified → last ingredient modified). Useful for spotting batches where operators stretched ingredient entry across long periods. |
| Avg Yield | Average qty_out / qty_in percentage, UOM-adjusted to the product's base UOM. |
| Total On-Hold Time | Sum of all on-hold time across batches in the period (computed from :onhold activity log entries). |
| Reworks | Total rework events on batches in the period. |
| Non-Conformances | Total non-conformance records on batches in the period. |
When Compare to previous is ticked, each card also shows a delta:
- Green ↑ — value moved in the favourable direction (more released, less cycle time, etc.).
- Red ↓ — value moved in the unfavourable direction.
- Grey — no meaningful change (within ±0.5%).
- "—" — previous period had a value of 0 (no baseline to compare).
Trend chart
A dual-axis chart by period:
- Bars (left axis) — number of batches released per bucket.
- Line (right axis) — average cycle time in hours per bucket.
- Dashed lines — previous-period overlay when Compare to previous is on.
Hover any bar or point for an exact value tooltip. Pan horizontally with click-and-drag.
Top products
Horizontal bar chart of the top 20 products by released-batch count for the period. Each bar's tooltip also shows the product's average yield.
Use this to spot which products are running most often and whether high-volume products are also high-yield.
Distribution
Two histograms side-by-side:
- Cycle time — bucketed at <1d / 1-2d / 2-3d / 3-7d / >7d. Lets you see the spread, not just the average.
- Yield % — bucketed at <70% / 70-80% / 80-90% / 90-95% / 95-100% / >100%.
Useful when the average looks fine but you want to know whether there's a tail of slow or low-yield outliers.
Active batches by status
A live count of every active batch on the system right now, broken down by status:
- Making / Processing / Packing — batches in active production
- Pending — batches waiting for the next step
- Partially Released — batches with some quantities released, others still pending
- On Hold — batches blocked (most actionable — these are the ones to investigate)
- Rework — batches in rework
This panel is always current state; it ignores date filters.
On-hold leaderboard
The 10 longest-on-hold batches in the selected period. Each row links to the batch detail screen — click a batch number to jump in and investigate.
Time is shown in days/hours and coloured amber to draw the eye. Use this to identify batches that have been stuck the longest and need intervention.
Batches grid (per-batch detail)
Every batch matching your filters, one row each. Sortable, filterable, and Excel-exportable.
| Column | What it shows |
|---|---|
| Batch # | Internal batch number. |
| Type | FG or WIP. |
| Status | Current AASM state (Released, Making, On Hold, etc.). |
| Created | When the batch record was created. |
| Released | First release timestamp. |
| Complete cycle | Created → first release. Total elapsed time. |
| Created → 1st ingredient | Created → first ingredient modified. The pre-production wait. |
| Ingredient entry | First → last ingredient modified. Time spent actively entering ingredients. |
| Last ingredient → 1st release | Last ingredient modified → first release. Time between finishing ingredients and the first release event. |
| 1st → full release | First → last release timestamp. Only shown when at least one batch in the result set has multiple releases. |
| On hold | Total time on hold for that batch. |
| Yield % | Final yield percentage. |
| Qty in / Qty out | Volumes in the product's base UOM. |
| Reworks / NCs | Counts on the batch. |
| Ingredients / Forms | Counts on the batch. |
Excel export
Click Excel Export in the toolbar above the grid. The current filtered view is downloaded as batch-metrics-YYYYMMDD-HHMM.xlsx. PDF export is intentionally not supported — use Excel and your spreadsheet tool's print/export.
How the data is calculated
Each batch has a corresponding row in the batch_metrics_summaries table, written automatically every time a batch's status changes. The job that populates this table is idempotent: it recomputes from current data on every run, so the row always reflects the latest reality of that batch.
| Metric source | How it's calculated |
|---|---|
| Batch creation timestamps | batch.created_at |
| First/last ingredient modified | min/max of batch_ingredients.updated_at |
| First/last released_at (FG batches) | min/max of batch_quantities.released_at (for BQs that have actually been released to inventory) |
| First/last released_at (WIP batches) | batch.released_at (both fields are the same for WIP) |
| Cycle metrics | Differences between the timestamp columns above, anchored on first release |
| Yield | batch.yield_percentage (calculated by Batch model on save) |
| On-hold total | Sum of :onhold → not-:onhold gaps in activity_logs. If currently on hold, the gap from the last on-hold entry to "now" is included. |
When does data refresh?
Any batch status transition triggers a background job that updates the metrics row within seconds. Refreshing the page picks up the latest.
Stale data?
If a number looks wrong, click Refresh in the page header. If it persists, check the summary_computed_at column on that batch's metrics row to see when it was last recomputed.
Common workflows
"How long is production really taking right now?"
- Set range to This month, bucket Weekly.
- Read Avg Making → Release (this strips pre-production wait).
- Look at the trend chart's line series — is it climbing?
"Are we slower this month than last month?"
- Set range to This month.
- Tick Compare to previous.
- Read deltas on Avg Full Cycle and Avg Making → Release in the KPI strip.
- The dashed line on the trend chart shows last month's pattern overlaid on this month's bars.
"Which products are dragging us down?"
- Set range to This quarter.
- Open Top products chart — tooltips show yield per product.
- Cross-reference with the Yield % histogram in the Distribution section to see if there's a low-yield tail.
"Where is work stuck right now?"
- Look at Active batches by status — counts in On Hold and Rework are the leading indicators of trouble.
- Click into the On-hold leaderboard to see which specific batches have been stuck longest, then click a batch number to drill in.
"I need this for an auditor."
- Set the period.
- Click Excel Export in the grid toolbar.
- Spreadsheet contains every batch with all timing, yield, and quality columns for the period.
Permissions
The dashboard requires the same permission as viewing batches. If you can see the Batches list, you can see the dashboard.
Glossary
- BQ / Batch Quantity — an output line on a batch (FG batches can have multiple BQs; each represents an inventory release).
- Cycle time — elapsed time between two milestones in a batch's lifecycle.
- FG (Finished Goods) — batches that produce inventory releases.
- First release — the timestamp of the earliest BQ release for FG, or for WIP. Used as the cycle-end anchor everywhere on this dashboard.
- WIP (Work In Progress) — intermediate batches consumed by other batches downstream.
- Yield % —
qty_out / qty_in × 100, UOM-adjusted to the product's base unit.