Dispatch time windows for inspections and events (hard/soft)
Objective
- Let staff define job-level time windows on inspections and charge-based events (e.g. agent promised 1–4 PM).
- Use windows as constraints for slot scoring, swap suggestions, and optimize runs — hard vs soft per job/event.
- Support optimize-within-window: per-job windows plus run-level scope (e.g. optimize 9 AM–12 PM on a selected day) so only work in that band is included in an optimize run.
Background
- Scheduling today uses a single point in time:
inspection.datetime/event.datetime+endtime— no arrival window fields ininspectionSchema.tsoreventSchema.ts. - Dispatch planning requires time-window preservation when swapping or optimizing.
- Soft windows are required: some charge events may move outside window when optimizing if marked soft (with warning).
- Distinct from action-flow
sendWindowand ATT-810 property/sqft slot rules. - Events have
locked; inspections have_lockedInspectorIds— pinned exact time may align with zero-width hard window or separate immovable flag (decision needed).
Product decisions
- Per job/event: optional window start/end (company timezone).
- Per job/event: hard (cannot place outside window) or soft (prefer inside; allow outside with warning on accept).
- No window = flexible (current behavior).
- Run-level optimize window in v1: user can scope an optimize run to a time band (e.g. 9:00 AM–12:00 PM) in addition to per-job windows — only jobs/events intersecting that band are in scope for that run.
- Duration rule (decision needed): start in window vs entire duration must fit in window.
Scope
Backend
- Extend
inspectionSchema.tsandeventSchema.tswith window fields + hard/soft mode. - Integrate with
batchSlotOptimizingAlgo.ts/schedule.tsoptimal-slots (hard = filter, soft = penalty or post-check warning). - Optimize endpoints (ATT-813, ATT-1822) and swap suggest (ATT-760) must read window + run-level scope.
Frontend
- Workorder + dispatch UI to set windows and hard/soft.
- Optimize flow: run-level time band picker (e.g. 9–12) + preview flags soft-window violations.
Acceptance criteria
- [ ] Optional time window + hard/soft on inspection and charge event.
- [ ] Hard window: slots/optimize do not propose times outside window.
- [ ] Soft window: outside-window proposals allowed with explicit warning before accept.
- [ ] Run-level optimize 9–12 (or any band) limits which jobs/events an optimize run considers.
- [ ] Company timezone used for boundaries.
References
attik-backend/src/models/inspectionSchema.tsattik-backend/src/models/eventSchema.tsattik-backend/src/routes/schedule.tsattik-backend/src/util/functions/schedule/batchSlotOptimizingAlgo.tsattik-frontend/src/app/tools/dispatch/
Status: Planned
Log in to comment and vote
No comments yet
Be the first to share your thoughts.