Compare commits

...

2 Commits

Author SHA1 Message Date
993a476bea expand core targets and populate 2025-08-26 16:31:57 -04:00
59a28591bd example with detaillevel key 2025-08-26 16:31:31 -04:00
2 changed files with 78 additions and 51 deletions

View File

@ -14,3 +14,28 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON pricequote.target_prices TO PUBLIC;
DROP TABLE IF EXISTS import.core_target;
CREATE TABLE import.core_target AS (SELECT * FROM pricequote.core_target);
WITH
expand AS (
SELECT
c.compset,
c.stlc,
c.floor,
b.ds,
b.chan,
b.tier,
b.vol,
b.val,
b.price,
json_pretty(to_json(b.math)) math
FROM
pricequote.core_target c
LEFT JOIN LATERAL pricequote.build_pricing_path_base (options||jsonb_build_object('entity','Anchor','attr',c.stlc,'val',c.floor,'func','Price')) b ON b.lastflag
)
-- select count(*) from expand
INSERT INTO
pricequote.target_prices_base
SELECT
*
FROM
expand

View File

@ -1,73 +1,75 @@
{
"details": [
{
"label": "Model Inputs",
"label": "History",
"detailLevel": 10,
"details": [
{
"label": "Base Cost",
"value": 1.22446,
"type": "currency"
}
]
},
{
"label": "Peer Target",
"details": [
{
"label": "Peer Median Margin",
"value": 36.873,
"type": "percent",
"note": "DIR|102 - HANGING POTS|110 - INJECTION|Tier 2"
}
]
},
{
"label": "Target Support",
"detailLevel": 1,
"details": [
{
"label": "Tier 1 Truckload",
"value": 80,
"label": "Last Quote",
"detailLevel": 10,
"value": 0.1012,
"type": "currency",
"note": "reviewed floor price"
},
{
"label": "Warehouse",
"value": 1.2,
"type": "percent"
"note": "XNS0T1G3G18B096 | Ord# 1008338 | 2025-06-12 | Qty 19,200"
}
]
},
{
"label": "Factor Adjustment",
"label": "List",
"detailLevel": 10,
"details": [
{
"label": "Package UOM",
"value": -0.01,
"type": "percent"
"label": "Code: GUAU",
"detailLevel": 10,
"value": 0.11,
"type": "currency",
"note": "List Min Qty: 9,600"
}
]
},
{
"label": "Target Calculation",
"detailLevel": 10,
"details": [
{
"label": "XNS0T1G3",
"detailLevel": 10,
"value": 0.08,
"type": "currency",
"note": "Base Floor"
},
{
"label": "# of Pallets",
"value": 0.02,
"type": "percent",
"note": "0.03"
"label": "Channel:WHS",
"detailLevel": 10,
"value": 0.2,
"type": "Percent",
"note": "Premium"
},
{
"label": "Urgency",
"value": 0.03,
"type": "percent",
"note": "Top Priority"
"label": "Volume:1-8",
"detailLevel": 10,
"value": 0.1,
"type": "Percent",
"note": "Premium"
},
{
"label": "State Adder/Subtractor",
"value": -0.02,
"type": "percent",
"note": "OH"
},
"label": "Target",
"detailLevel": 10,
"value": 0.1056,
"type": "currency",
"note": "Total"
}
]
},
{
"label": "Guidance",
"detailLevel": 10,
"details": [
{
"label": "Branding",
"value": 0,
"type": "currency"
"label": "Price",
"detailLevel": 10,
"value": 0.1012,
"type": "currency",
"note": "Using target price, capped to not exceed last price"
}
]
}