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/monthly-forecast.md 3,150 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

id: b2d4f6a1-7c9e-4d3a-a2f7-6e1b8c4f5a12 name: Generate monthly sales forecast kind: Forecast cron: 0 0 6 1 * * analysis_window: 730d comparison_periods: [30d, 365d]


Generate accurate monthly sales forecasts to support long-term inventory planning, budgeting, and strategic decision-making.

Forecast should estimate total expected revenue for each of next 12 months 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 monthly 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 24 months using curated.pos_orders.
  1. Aggregate historical revenue by:
  2. month
  3. year
  4. service or fulfillment channel when that split materially improves forecast quality.
  1. Use business_date as primary monthly bucket. Use created_at or created_at_utc only for finer event alignment.
  1. Identify recurring seasonal demand patterns, such as:
  2. high and low sales months
  3. seasonal demand cycles across year
  4. long-term growth or decline trends.
  1. Detect recent anomalies within historical period such as:
  2. unusual spikes or drops in revenue
  3. temporary demand changes caused by promotions or events.
  1. Use curated.pos_order_items only when item or category mix materially explains long-term demand shifts.
  1. Enrich dataset using external signals, including:
  2. national holidays
  3. seasonal demand periods
  4. major local events (sports tournaments, festivals, tourism peaks).
  1. Build baseline monthly forecast for future months based on historical seasonality and long-term trends.
  1. Adjust forecasts based on:
  2. known future holidays
  3. recurring seasonal demand patterns
  4. detected long-term trends.
  1. Produce final monthly revenue forecast for next 12 months.
  1. Output constraints:
  2. return forecast data only
  3. do not include explanations, reasoning, or methodology
  4. output must contain exactly 12 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 12 monthly forecast values for next 12 months.

No explanations or narrative text should be included in output.