Placed Orders
PlacedOrdersComponent writes one row for each order we placed, with the consolidated inventory
record the order became. Reporting assets join on it to find the vehicles we ordered. See
Matching an order to an inventory record
and ADR-003.
Which orders are included
An attempt placed an order when all of these hold on its attempt-outcomes event:
successis true.run_modeisEXECUTEorSTAGE.order_numberororder_referenceis set.
Each daily partition includes the orders placed on or before the partition date.
An order can be placed more than once. Mercedes, for example, modifies the same purchase order again
in a later run. The asset keeps one row per order, from its latest placement by run_timestamp and
then published_at. The earlier placements stay in the attempt_outcomes table.
Each order's dealer_code resolves to dealer_id through consolidated dealers. A code with no
dealer raises.
How an order is resolved
Each OEM configures foreign_keys, an ordered list of ForeignKeyJoinSpec against the inventory
entity, with target: inventory_id. The syntax of on is the one consolidation uses. An order is
resolved by the first spec whose key finds an inventory record in that day's partition.
A key with a null field resolves nothing. When a key finds more than one record, the order is
unresolved with unresolved_reason set to ambiguous, and later specs do not try it. An order
that no spec resolves has unresolved_reason set to no_record.
An order that we placed without an order number, such as a staged Audi order, takes the
order_number of the inventory record it resolves to.
Resolution reads only the inventory partition for the same date. It does not depend on the asset's earlier partitions.
Most OEMs resolve an order with one spec on [order_number]. An OEM whose staged orders have no
order_number, such as Audi, adds a second spec on [dealer_id, order_reference].
An order is identified by the event fields of the first spec in foreign_keys whose fields are all
set. An Audi order is identified by its order_number once it is submitted, and by dealer_id and
order_reference while it is staged.
Asset checks
unresolved_orders reports the count of no_record orders, the total, their rate, and the
configured unresolved_rate_threshold. It passes when the rate is at or below the threshold.
Two groups of orders are left out of both the count and the total:
- Orders whose dealer has no OMS inventory capture after the day the order was placed. The dealer's
latest capture is the latest date in
capture_columnacross the dealer's inventory records. The date of a capture depends on when the dealer's OMS data was last collected, not on the order's age. - Orders placed more than
history_daysdays before the partition date, whose vehicle may have left consolidated inventory.
history_days must equal the history_days of the OEM's consolidated inventory source groups.
ambiguous_orders reports the count of ambiguous orders.
shared_inventory_orders reports the count of inventory records that are the resolved record of
more than one order.
All three checks are non-blocking.