From 97f73e51079255480a774cdb36423d746f701a54 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 28 Apr 2021 11:14:43 -0400 Subject: [PATCH] notes on old update prior year baseline approach --- build/merge_actuals_exec.sql | 4 ++-- build/merge_actuals_pool.sql | 4 ++-- build/merge_actuals_prep.sql | 6 +++--- build/readme.md | 7 +++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/build/merge_actuals_exec.sql b/build/merge_actuals_exec.sql index f263fae..891d662 100644 --- a/build/merge_actuals_exec.sql +++ b/build/merge_actuals_exec.sql @@ -1,3 +1,3 @@ -DELETE FROM rlarp.osmf_dev WHERE odate < '2020-06-01'; -INSERT INTO rlarp.osmf_dev SELECT * FROM rlarp.osmfs_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 < '2021-05-01'; diff --git a/build/merge_actuals_pool.sql b/build/merge_actuals_pool.sql index d57a96b..a37b194 100644 --- a/build/merge_actuals_pool.sql +++ b/build/merge_actuals_pool.sql @@ -1,6 +1,6 @@ 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 WITH @@ -135,7 +135,7 @@ FROM LEFT OUTER JOIN rlarp.itemm i ON i.item = o.part WHERE - odate < '2020-06-01'; + odate < '2021-05-01'; SELECT diff --git a/build/merge_actuals_prep.sql b/build/merge_actuals_prep.sql index dbc4343..a15580f 100644 --- a/build/merge_actuals_prep.sql +++ b/build/merge_actuals_prep.sql @@ -145,11 +145,11 @@ gld AS ( WHERE ( --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 (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 o.fspr BETWEEN '2001' AND '2012' + OR o.fspr BETWEEN '2101' AND '2111' ) AND fs_line = '41010' AND calc_status <> 'CANCELED' diff --git a/build/readme.md b/build/readme.md index 9a4193d..3e3a2f9 100644 --- a/build/readme.md +++ b/build/readme.md @@ -11,3 +11,10 @@ Build A New Forecast * 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 * 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`