notes on old update prior year baseline approach

This commit is contained in:
Paul Trowbridge 2021-04-28 11:14:43 -04:00
parent 78a9658e80
commit 97f73e5107
4 changed files with 14 additions and 7 deletions

View File

@ -1,3 +1,3 @@
DELETE FROM rlarp.osmf_dev WHERE odate < '2020-06-01'; DELETE FROM rlarp.osmf_dev WHERE odate < '2021-05-01';
INSERT INTO rlarp.osmf_dev SELECT * FROM rlarp.osmfs_dev WHERE odate < '2020-06-01'; INSERT INTO rlarp.osmf_dev SELECT * FROM rlarp.osmfs_dev WHERE odate < '2021-05-01';

View File

@ -1,6 +1,6 @@
BEGIN; BEGIN;
DELETE FROM rlarp.osm_pool WHERE order_date < '2020-06-01'; DELETE FROM rlarp.osm_pool WHERE order_date < '2021-05-01';
INSERT INTO rlarp.osm_pool INSERT INTO rlarp.osm_pool
WITH WITH
@ -135,7 +135,7 @@ FROM
LEFT OUTER JOIN rlarp.itemm i ON LEFT OUTER JOIN rlarp.itemm i ON
i.item = o.part i.item = o.part
WHERE WHERE
odate < '2020-06-01'; odate < '2021-05-01';
SELECT SELECT

View File

@ -145,11 +145,11 @@ gld AS (
WHERE WHERE
( (
--base period orders booked.... --base period orders booked....
o.odate <@ daterange('2019-06-01','2020-06-01') o.odate <@ daterange('2020-06-01','2021-05-01','[)')
--...or any open orders currently booked before cutoff.... --...or any open orders currently booked before cutoff....
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-06-01') OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2021-05-01')
--...or anything that shipped in that period --...or anything that shipped in that period
OR o.fspr BETWEEN '2001' AND '2012' OR o.fspr BETWEEN '2101' AND '2111'
) )
AND fs_line = '41010' AND fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'

View File

@ -11,3 +11,10 @@ Build A New Forecast
* build the pool for the more limited UI data set: build_pool.sql * build the pool for the more limited UI data set: build_pool.sql
* copy the pool to osmfs_dev from inclusion in the osm_stack and reporting: convert_pool_all.sql * copy the pool to osmfs_dev from inclusion in the osm_stack and reporting: convert_pool_all.sql
* refresh osm_stack_refresh() to integrate into reporting * refresh osm_stack_refresh() to integrate into reporting
Integrate Actuals
------------------------------------------------------------------------------------------------------------------
* `merge_actuals_prep` -> push a fresh baseline into a temp table
* `merge_actuals_exec` -> take the baseline and push it into `osmf`
* `merge_actuals_exec` -> manualls splice in `osmf` into `pool`