# TASK 1.1: Migrate prep-time and order-surge

## Summary

Migrate the `prep-time` and `order-surge` monitor specs from `kdsdev.orders` to `curated.orders`.

These monitors are the lowest-risk migration group because they primarily use order-level fields.

## Dependencies

- Redshift Foundation curated mapping
- Single-Store Redshift Runtime Read Path complete

## Files to Modify

### 1. `backend/Kds.Ai.Data/MonitorSpecs/prep-time.md`

Replace source-shaped table/field descriptions and analysis steps with the `curated.orders` contract.

### 2. `backend/Kds.Ai.Data/MonitorSpecs/order-surge.md`

Replace source-shaped table/field descriptions and analysis steps with the `curated.orders` contract.

## Required Behavior

### `prep-time`

Target table:

- `curated.orders`

Required curated columns:

- `created_at`
- `is_completed`
- `preparation_time_seconds`
- `item_count`
- `order_type`
- `destination`

Migration rules:

- replace `kdsdev.orders` with `curated.orders`,
- replace `done = 1` with `is_completed = true`,
- replace `preparation_time` with `preparation_time_seconds`,
- replace `create_time` with `created_at`,
- replace `items_count` with `item_count`,
- remove `store_guid`,
- remove `is_deleted`,
- preserve the 20 completed-order sample-size rule,
- preserve deviation and severity thresholds.

### `order-surge`

Target table:

- `curated.orders`

Required curated columns:

- `created_at`
- `item_count`
- `order_type`
- `destination`
- `pos_terminal`
- `is_priority`
- `preparation_time_seconds`

Migration rules:

- replace `kdsdev.orders` with `curated.orders`,
- use `created_at` for 15-minute buckets,
- replace `items_count` with `item_count`,
- remove `store_guid`,
- remove `is_deleted`,
- preserve 15-order baseline-window rule,
- preserve sustained 3+ consecutive window requirement,
- use `preparation_time_seconds` for kitchen-impact checks.

## Acceptance Criteria

- [ ] `prep-time.md` references `curated.orders`
- [ ] `prep-time.md` does not reference `kdsdev`
- [ ] `prep-time.md` does not require `store_guid` or `is_deleted`
- [ ] `prep-time.md` uses `created_at`, `is_completed`, `preparation_time_seconds`, and `item_count`
- [ ] `order-surge.md` references `curated.orders`
- [ ] `order-surge.md` does not reference `kdsdev`
- [ ] `order-surge.md` does not require `store_guid` or `is_deleted`
- [ ] `order-surge.md` uses `created_at`, `item_count`, and curated order dimensions
- [ ] Existing thresholds and severity guidance are preserved
- [ ] No runtime code is changed in this task

## Notes

- Keep frontmatter unchanged unless there is a concrete reason.
- Do not add new curated columns.
- Do not edit unrelated monitor specs in this task.
