Batches
Create production batches and track every block from creation through completion.
Batches
A batch is a production run — a named group of blocks created at the same time from the same recipe. When you create a batch, Sporeline generates individual block records for each bag you plan to fill. From that point on, every block is tracked independently through its lifecycle.
You must have at least one recipe before you can create a batch.
Batch List
Navigate to /batches to see all batches for your farm, ordered by creation date. Click any batch row to open its detail page.
Creating a Batch
Go to /batches/new or click Create Batch on the Dashboard.
Required Fields
- Batch Name — a unique human-readable name for this run, for example
BT-2026-001 - Block Type —
Substrate BlockorGrain Spawn - Recipe — select from your existing recipes; the chosen recipe’s species and strain are displayed for confirmation
- Number of Blocks — how many blocks to create (between 1 and 500)
Optional Fields
- Notes — free-text notes for this batch
- Input Lots — one or more lot records linking raw material inputs to this batch for traceability (see below)
Block Creation Mode
Choose how blocks are created and labeled:
| Mode | Behavior |
|---|---|
| Instant (default) | All block records are created immediately when you submit the form |
| Print-First | Block IDs are reserved and labels are printed before physical bags are filled; blocks are registered as you apply each label |
| Scan-First | Scan existing pre-printed labels to register blocks one at a time |
For Print-First and Scan-First modes, you are redirected to the Register Blocks page (/batches/{id}/register) immediately after batch creation.
Input Lots
Input lots link raw material purchases to a batch for traceability purposes. Each lot has three fields:
- Material — the input name (for example,
Oak Sawdust,Wheat Bran,Grain Spawn) - Lot ID — your supplier’s lot or batch number
- Supplier — optional supplier name
Input lot data is stored on the batch record and is used by the traceability system to link finished blocks back to source materials.
When a recipe is selected, a Supplier Suggestion Card may appear showing preferred suppliers for relevant material categories (Substrate, Spawn, Bags, Supplements).
Batch Detail
Open any batch at /batches/{id} to see its full detail page.
KPI Summary
Four metric cards appear at the top:
| Card | Value |
|---|---|
| Planned Blocks | The block count entered at creation |
| Actual Blocks | The number of block records currently associated with this batch |
| Total Yield | Sum of total_yield_g across all blocks in the batch |
| Created By | The user who created the batch |
Registration Progress
For Print-First or Scan-First batches, a registration progress bar shows how many blocks have been registered out of the planned count. A Register Blocks button links to the registration page. The bar turns green when all blocks are registered.
Batch Details Card
Shows Notes and the list of Input Lots as badges. Only visible if notes or lots were recorded.
Stage Overview
A compact grid of stage badges with counts shows how many blocks in this batch are at each lifecycle stage. This is a quick way to see overall batch progress — for example, how many blocks are still incubating versus already fruiting.
Blocks Table
All blocks belonging to this batch are listed in a table with columns for Block ID, Stage, Location, and Yield (g). Select individual blocks using the checkboxes.
When one or more blocks are selected, a Print Selected button appears in the page header to generate labels for just those blocks.
Label Printing from a Batch
Three label actions are available from the batch detail page header:
- Print All — generates PDF labels for all blocks in this batch and opens them in a new tab
- Add All to Queue — adds all block labels to the print queue for deferred printing
- Print Selected — generates labels for only the checked blocks (visible when rows are selected)
Editing a Batch
Navigate to /batches/{id}/edit to update the Batch Name, Notes, or Input Lots for an existing batch. Recipe and block count cannot be changed after creation.
Batch-to-Block Relationship
Every block record stores a batch_id reference. The blocks handler queries a GSI (Global Secondary Index) on T#{tenant_id}#BATCH#{batch_id} to efficiently retrieve all blocks for a batch without scanning the full table. This means batch size has no impact on query performance.
Permissions
| Action | Minimum Role |
|---|---|
| View batches | Viewer |
| Create batch | Manager |
| Update batch | Manager |
| Register blocks (Print-First / Scan-First) | Worker |
| Generate labels | Worker |
Related Pages
- Blocks — view and manage the individual blocks in a batch
- Recipes — a recipe is required before creating a batch
- Scan — register Scan-First blocks using the camera scanner
- Traceability — trace finished blocks back to input lots