SCENARIOS / SC-007 / ONLINE SHOPPING
SC-007 Commerce Pipeline

Online Shopping

Order fulfilment against live warehouse stock — confirmations, shipments and returns.

Async Event FSM
PENDING CONF FULFIL TRANSIT DELIV ORDER WAREHOUSE STOCK SHIPMENT RETURNS
SC-007 / SCHEMATICCommerce Pipeline
Clock Tick or event
Update Asynchronous
Catalog 5 products, inline or JSONL
Routing First-match-wins
Tables 5
OVERVIEW

A warehouse-backed order pipeline. An order moves pending → confirmed → fulfilled → in transit → delivered while messaging a regional warehouse that tracks per-product stock as field families, reserves units, dispatches a shipment, and branches first-match-wins on availability. Cancellations and returns run the protocol in reverse. The scenario ships in three forms — a tick clock, an event clock, and a file-backed catalog variant.

A rich relational graph for analytics: customers, orders, line items, shipments and warehouses all resolve through foreign keys, and stock moves are conserved end-to-end. Demonstrates request/response messaging, field families (per-product counters) and the engine's two clock models over one unchanged domain.

TRAITS
Async
Independent, event-driven timelines
Event
Continuous event-sourced time
FSM
Entities are finite-state machines
SCHEMA

Linked tables with guaranteed referential integrity.

TABLECOLUMNSDESCRIPTION
order ID, region, product, order_value, order_total, customer_id, warehouse_id, current_state One row per order: region, product, value, and references to the customer and fulfilling warehouse.
customer ID, region, order_count, current_state One row per customer: region and lifetime order count.
line_item ID, product, quantity, line_value, order_id, current_state Order line items: product, quantity, value and parent order.
shipment ID, order_id, warehouse_id, current_state Shipments dispatched by a warehouse against an order.
warehouse ID, region, fulfilled_orders, orders_processing_today, stock_available[0..4], stock_reserved[0..4], current_state One row per warehouse: region, throughput counters and per-product available/reserved stock families.
LIVE API

Generated REST endpoints. Also exposed as MCP tools.

POST /scenarios/online-shopping/experiments Seed a new world (an experiment)
POST /scenarios/online-shopping/experiments/{eid}/run Advance N turns, or request an event
GET /scenarios/online-shopping/experiments/{eid}/entities/order Query orders by state or product
GET /scenarios/online-shopping/experiments/{eid}/events Append-only event log
GET /scenarios/online-shopping/experiments/{eid}/dataset Download the exported dataset
SEMANTIC LAYER

OSI-compatible definition, emitted with the dataset.

# online-shopping.osi.yaml — emitted automatically
semantic_model:
  name: "online-shopping"
  source: "duckdb://online-shopping.db"
  entities:
    - name: order
      primary_key: id
  dimensions:
    - name: state
      type: categorical
    - name: t
      type: time
  measures:
    - name: row_count
      agg: count
    - name: active
      agg: sum
      filter: "state = 'ACTIVE'"