# Workflow Analysis

## Workflow States

### Item Workflow

| State | Meaning | Entry | Exit | Evidence Quality |
| --- | --- | --- | --- | --- |
| submitted | Item is ready for reviewer intake or returned to submitter. | Item creation or return actions. | Reviewed, rejected, or resubmitted. | Observed |
| reviewed | Reviewer has completed first review. | Reviewer/admin action. | Approved, submitted, or rejected. | Observed |
| approved | Ready for dietitian analysis. | Reviewer/admin approval. | Analyzed, reviewed, or rejected. | Observed |
| analyzed | Dietitian completed analysis. | Dietitian/admin action. | Live or rejected. | Observed |
| live | Item can be used downstream. | Reviewer/admin go-live. | No current non-admin retirement path identified. | Observed |
| rejected | Item was rejected. | Reviewer/dietitian/admin rejection. | Admin may view; reactivation path not clearly documented. | Observed/Unknown |

Evidence: `src/config/statuses.py`, `src/services/workflow_service.py`, `tests/test_workflow.py`.

### Menu / Forecast / Production States

- Observed: Menu status values are `draft`, `active`, and `archived`, but implementation evidence is stronger around menu creation/editing/deletion and slot operations than around status transitions.
- Observed: Forecasts are stored per menu assignment and can preserve values through slot assignment updates.
- Observed: Production records have draft/current operating state and a posted/locked state; posted facts exclude drafts.
- Inferred: Menu status lifecycle may need more explicit business definition before production rollout.

### Inventory / Invoice States

- Observed: Inventory locations and count rows use active/inactive behavior.
- Observed: Inventory matches can be active, review needed, rejected, or inactive.
- Observed: Catalog substitutes can be active, review needed, or inactive.
- Observed: Vendor invoices can be staged, reviewed, or voided; invoice lines can be matched, unmatched, review needed, or ignored.
- Inferred: Invoice `reviewed` and `voided` states need user-facing transition definitions beyond current staging/review operations.

## Cross-Workflow Failure Paths

| Failure / Alternate Path | Current Behavior | Evidence Quality | Business Impact |
| --- | --- | --- | --- |
| Recipe lacks required data | Validation blocks creation/update or go-live. | Observed | Protects downstream menu/forecast/inventory quality. |
| Unsupported unit conversion | Scaling/usage services return structured warnings instead of silent conversion. | Observed | Prevents false production or inventory quantities. |
| Non-live item assigned to menu | Service rejects assignment. | Observed | Keeps menus production-ready. |
| Forecast not set | Production summary can warn or render unforecasted base-food lines. | Observed | Preserves production visibility while highlighting incomplete planning. |
| Production line not recorded | Posting requires recorded lines. | Observed | Reduces accidental posted facts. |
| Inventory needs cannot convert | Planning shows conversion review rows. | Observed | Keeps questionable shortages from becoming automatic orders. |
| Invoice line unmatched | Review surface allows manual linking and placement. | Observed | Moves matching into operator review instead of silent ingestion. |

## BA Alignment

- Activity areas: Analyze requirements and define design options; evaluate solution.
- Techniques used: Workflow analysis, state modeling, exception analysis, document analysis.
