runloopable / platform /model /topics /amazon_orders.yml
fsanyoto's picture
Deploy AIOS web (React glide grid + FastAPI slice)
816fa8a verified
Raw History Blame Contribute Delete
2.96 kB
# Amazon's order-head mirror and its independent Sales summary share the tenant-bound file.
# Runtime reads require an explicit runtime, unrestricted caller and matching summary interval.
# Field keys are snake_case Amazon report headers (amazon_store._snake), the same keys the grid shows.
key: amazon_orders
semantic:
approved: [amazon_order_id, purchase_date, last_updated_date, order_status, sku, asin, quantity, item_price, currency]
date_field: purchase_date
scope: "Distinct Amazon order ids in this tenant seller's connected marketplace and complete UTC purchase-date window. Exclude order_status Cancelled and Canceled. Both dates must match the completed Amazon Sales summary interval. This is not the Odoo wholesale or GIFTWARE scope."
measure:
key: amazon_order_count
source: amazon_orders
validate: amazon_sales_order_count
purposes:
amazon_order_id: "The Amazon order number. One row per order, so count rows for an order count."
purchase_date: "When the buyer placed the order, ISO 8601 text in UTC. Use it for orders by day, week or month."
order_status: "Pending, Unshipped, Shipped or Cancelled. Exclude both Cancelled and Canceled from order counts and sales."
item_price: "The first line's price for its quantity. Use Amazon order items for whole order sales."
synonyms:
amazon_order_id: [order number, order id, Amazon order]
purchase_date: [order date, purchase date, ordered on]
order_status: [status]
choices:
order_status: [Pending, Unshipped, Shipped, Cancelled]
label: "Amazon orders"
entity: amazon.order
grid: ut_amzn_orders
subject: "amazon:order"
grain: "one row per Amazon order (document grain)"
store:
source: amazon_sp
table: amzn_orders
alias: o
date_col: o.purchase_date
scope_sql: "lower(COALESCE(o.order_status, '')) NOT IN ('cancelled', 'canceled')"
dims:
purchase_date: {col: "CAST(CAST(o.purchase_date AS TIMESTAMPTZ) AT TIME ZONE 'UTC' AS DATE)", type: date}
fields:
- key: amazon_order_id
label: "Amazon order id"
type: text
kind: data
- key: purchase_date
label: "Purchase date"
type: date
kind: data
- key: last_updated_date
label: "Last updated date"
type: date
kind: data
- key: order_status
label: "Order status"
type: text
kind: data
- key: sku
label: "Sku"
type: text
kind: data
- key: asin
label: "Asin"
type: text
kind: data
- key: quantity
label: "Quantity"
type: int
kind: data
- key: item_price
label: "Item price"
type: currency
kind: data
- key: currency
label: "Currency"
type: text
kind: data
ai_context: >
Amazon orders at document grain. For how many orders arrived per day, count rows grouped by the
UTC day of purchase_date and exclude order_status Cancelled and Canceled. The order count must
reconcile to Amazon Sales for the same full interval. For units or sales use Amazon order items.