Spensara Spensara Knowledge Base & Documentation Repository

Repository Docs & Knowledge Base

Consolidated Spensara documentation repository (722 Markdown & architecture documents in ../repository)
Built Word Documents (.docx): Spensara Overview (.docx) Capability Assessment (.docx) Brink POS Ingestion Analysis (.docx) The Borg Ingestion Architecture (.docx)

Branches (328)

Branch-specific documentation across extract-raw-xml, feature-fleet-import, kds_cdc_improvments, life-cycle, and tenat-admin.
branches/kds_cdc_improvments/monitor-specs/backend/Kds.Ai.Data/MonitorSpecs/weekly-forecast.md 3,248 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

id: 7a4c1e52-b9f2-4a7f-8e21-5c2b0e4d91b3 name: Generate weekly sales forecast kind: Forecast cron: 0 0 6 * * 1 analysis_window: 90d comparison_periods: [7d, 28d]


Generate accurate weekly sales forecasts to support inventory planning, staffing allocation, and operational decision-making.

Forecast should estimate total expected revenue for each of next 4 weeks using historical order data and relevant external signals.

Output must contain forecast data only, without explanations or descriptions of methodology.

Known Tables & Columns

curated.pos_orders

  • created_at (timestamp) - local order timestamp
  • created_at_utc (timestamp) - UTC timestamp when normalization is needed
  • business_date (date) - business trading date for weekly bucketing
  • total (decimal) - order revenue
  • destination (varchar) - destination or fulfillment context
  • service_channel (varchar) - service-channel grouping when populated
  • fulfillment_channel (varchar) - fulfillment grouping when populated

curated.pos_order_items (optional enrichment)

  • order_id (varchar) - join key to curated.pos_orders.order_id
  • item_id (integer) - menu item identifier
  • quantity (integer) - sold quantity
  • unit_price (decimal) - observed sold unit price
  • category_name (varchar) - sold item category when populated

Analysis Approach

  1. Extract historical orders from last 90 days using curated.pos_orders.
  1. Aggregate historical revenue by:
  2. business week
  3. week number
  4. service or fulfillment channel when that split materially improves forecast quality.
  1. Use business_date as primary weekly bucket. Use created_at or created_at_utc only when finer event alignment is needed.
  1. Identify recurring demand patterns such as:
  2. typical weekly revenue cycles
  3. peak and slow weeks
  4. trends over recent weeks.
  1. Detect recent anomalies within last 90 days such as:
  2. sudden spikes or drops in revenue
  3. temporary demand caused by promotions or events.
  1. Use curated.pos_order_items only when item or category mix materially explains weekly demand changes.
  1. Enrich dataset using external signals, including:
  2. holidays and public events
  3. local events (sports games, festivals)
  4. expected weather conditions.
  1. Retrieve current conditions and short-term forecast using get_weather_forecast to determine whether demand may deviate from historical baselines.
  1. Build baseline weekly forecast for upcoming weeks based on historical patterns and recent trends.
  1. Adjust forecast based on:
  2. upcoming holidays
  3. forecasted weather conditions
  4. detected short-term trends or anomalies.
  1. Produce final weekly revenue forecast for next 4 weeks.
  1. Output constraints:
  2. return forecast data only
  3. do not include explanations, reasoning, or methodology
  4. output must contain exactly 4 forecast entries.
  1. Minimize database usage:
  2. prefer aggregated summaries
  3. avoid requesting more than 3 queries unless necessary.

Output Format

Return structured list containing 4 weekly forecast values for next 4 weeks.

No explanations or narrative text should be included in output.