How It Works
The core logic that replaces the manual guesswork, from algorithm to pipeline.
Reorder Algorithm
This is the core logic that replaces the manual guesswork.
For each ingredient tracked in the system:
1. Read current stock from Inventory
2. Read the critical level threshold
3. If current_stock < critical_level:
qty_to_order = critical_level - current_stock
Round up to nearest whole unit
Tag with supplier name
4. Group all items by supplier
5. Save to PendingOrders for review
The critical levels are configurable per ingredient, so a high-turnover item like chicken breast might have a threshold of 20kg while a specialty spice sits at 500g.
Order Output
Orders are grouped by supplier and staged for review.
GFS Order
Chicken Breast (ID: 1042) — Current: 3.2kg — Min: 20kg — Order: 17kg
Heavy Cream (ID: 2088) — Current: 1L — Min: 8L — Order: 7L
CANAM Order
Wagyu Strip (ID: C-401) — Current: 0kg — Min: 4kg — Order: 4kg
Sales-to-Inventory Pipeline
The flow that closes the loop between what was sold and what needs to be restocked.
POS Export (Excel)
Givex Parser
Extracts: item_id, qty, net_sales
Recipe Lookup
Maps each sold dish to its ingredient list
Unit Conversion
e.g. 1 plate = 250g chicken
Inventory Deduction
Subtracts consumed quantities from stock
Updated Inventory
Ready for reorder comparison
The parser system was designed to be extensible — adding a new POS system (Square, Toast) means writing a single parser file that implements the same interface. The rest of the pipeline stays unchanged.