# Process Map

## Corporate Current-State Breakpoints

User-provided: The current corporate recipe collection/menu builder does not adequately carry work through the following chain:

```mermaid
flowchart LR
    A[Corporate Recipe Collection] -. missing mass / volume and hotel-pan conversion .-> B[Scaling]
    B -. missing sub-recipe rollups .-> C[Ingredient Demand]
    C -. weak tie-in .-> D[Menu Forecast]
    D -. weak tie-in .-> E[Production Record]
    E -. missing accuracy analysis .-> F[Forecast Learning]
    C -. missing automated ordering forecast .-> G[Ordering]
```

## Future-State Prototype Operating Loop

```mermaid
flowchart LR
    A[Recipe and Base-Food Authoring] --> B[Workflow Review]
    B --> C[Live Culinary Items]
    C --> D[Menu Builder]
    D --> E[Forecasting]
    E --> F[Production Record]
    F --> G[Posted Production Facts]
    E --> H[Inventory Availability]
    C --> I[Inventory Catalog Bridge]
    I --> J[Catalog Review and Substitutes]
    J --> K[Invoice Staging]
    K --> L[Sub-Location Placement]
    L --> H
    G --> M[Future Analytics]
    H --> M
```

## Process 1: Recipe and Base-Food Lifecycle in the Prototype

| Step | Actor | Trigger | System Behavior | Output | Evidence Quality |
| --- | --- | --- | --- | --- | --- |
| 1 | Standard user or workflow staff | Create recipe or base food | Stores `item` row and recipe components when applicable. | Draft/submitted item record | Observed |
| 2 | Reviewer | Item appears in reviewer portal | Reviewer can advance, return to submitter, or reject. | Reviewed, submitted, or rejected item | Observed |
| 3 | Dietitian | Reviewed item is approved for nutrition analysis | Dietitian can mark analyzed, send back, or reject. | Analyzed or returned item | Observed |
| 4 | Reviewer/admin | Analyzed recipe is ready for live use | Go-live requires recipe mass and volume yield data. | Live culinary item | Observed |
| 5 | User | Search or browse | Live item search supports exact, prefix, substring, pagination, and fuzzy fallback. | Item selection for recipes, menus, inventory | Observed |

Evidence: `src/services/workflow_service.py`, `src/services/recipe_service.py`, `src/services/item_service.py`, `src/queries/item_search.py`, `docs/agent_context/recipe_collection.md`.

Business purpose: establish recipe truth with enough measurement authority to support future-state scaling and rollups that the corporate current state lacks.

## Process 2: Menu Planning to Forecasting in the Prototype

| Step | Actor | Trigger | System Behavior | Output | Evidence Quality |
| --- | --- | --- | --- | --- | --- |
| 1 | Menu planner | Create menu | System creates dated menu cycle with weeks, service days, meal periods, concepts, and slots. | Menu shell with slots | Observed |
| 2 | Menu planner | Assign items | Live recipes/base foods are assigned to menu slots. | Ordered slot assignments | Observed |
| 3 | Menu planner | Copy/paste/clear | User copies or clears cells, days, weeks, or concept groups. | Reused menu pattern | Observed |
| 4 | Manager | Open forecast | Forecast grid shows assignments by service context. | Forecast work surface | Observed |
| 5 | Manager | Enter yield/case/portion targets | Service stores forecast display quantity, effective calculated quantity, batch splits, and case pack data. | Production summary rollup | Observed |

Evidence: `src/services/menu_service.py`, `src/services/menu_forecast_service.py`, `src/queries/menu_forecast.py`, `docs/agent_context/menu_builder.md`.

Business purpose: connect menus to production-facing forecast quantities instead of leaving menus as static planning artifacts.

## Process 3: Production Record and Accuracy Feedback in the Prototype

| Step | Actor | Trigger | System Behavior | Output | Evidence Quality |
| --- | --- | --- | --- | --- | --- |
| 1 | Production manager | Open production record for service day | System snapshots forecast summary rows into a production record. | Production record draft | Observed |
| 2 | Floor operator | Enter actuals and variance | Service stores actual quantity, formula text, leftover/shortage, reason, and notes. | Recorded production line | Observed |
| 3 | Manager | Post record | Posting requires recorded lines and locks reviewable facts. | Posted record | Observed |
| 4 | Manager or analyst | Review history | History supports filters, rollups, variance occurrences, and item trends. | Operational reporting | Observed |
| 5 | Downstream consumer | Request posted facts | API exposes `production_record.posted_facts.v1`. | Versioned downstream fact contract | Observed |

Evidence: `src/services/production_record_service.py`, `src/app.py`, `tests/test_production_record_service.py`, `docs/agent_context/menu_builder.md`.

Business purpose: close the gap between forecast and actual production by preserving production facts and variance for later analysis.

## Process 4: Inventory, Ordering Forecast, Catalog, Invoice, and Placement in the Prototype

| Step | Actor | Trigger | System Behavior | Output | Evidence Quality |
| --- | --- | --- | --- | --- | --- |
| 1 | Inventory user | Configure locations | User creates root and sub-storage locations. | Location hierarchy | Observed |
| 2 | Inventory user | Stage invoice or dev invoice | System creates vendor invoice and line rows. | Staged invoice lines | Observed |
| 3 | Inventory user | Review unmatched lines | User links invoice line to live base-food item and optional substitute. | Catalog match or substitute | Observed |
| 4 | Inventory user | Place invoice line | System seeds count row in grouped sub-location using invoice quantity/unit. | Live count row | Observed |
| 5 | Manager | Review dashboard/planning | System rolls current on hand and compares next needs, using ordering preferences when available. | Current-on-hand and planning rows | Observed |

Evidence: `src/services/inventory_service.py`, `src/services/inventory_bridge_service.py`, `src/services/inventory_invoice_service.py`, `src/services/inventory_usage_service.py`, `docs/agent_context/inventory.md`.

Business purpose: turn menu/recipe demand and live inventory into ordering signals, with vendor/catalog data becoming the bridge to future purchasing and cost analysis.

## Handoffs and Control Points

- Corporate current state to prototype: missing conversion, rollup, forecast, ordering, and accuracy capabilities define the prototype value case. Evidence quality: User-provided.
- Recipe Collection to Menu Builder: only live items should be assigned to menus. Evidence quality: Observed.
- Forecasting to Production Record: production records snapshot forecast summaries rather than directly editing forecasts. Evidence quality: Observed.
- Production Record to Inventory/Analytics: posted facts are the stable downstream contract; drafts are operational memory. Evidence quality: Observed.
- Recipe Collection to Inventory: Recipe item identity remains culinary; inventory owns catalog and vendor-facing identity. Evidence quality: Observed.
- Invoice staging to count placement: placement is operational and not an accounting post. Evidence quality: Observed.

## BA Alignment

- Activity areas: Elicit and collaborate; analyze requirements and define design options; evaluate solution.
- Techniques used: Process modeling, interface analysis, document analysis, business process analysis.
