update readme
This commit is contained in:
parent
d35bc49f6f
commit
80bcb23170
@ -1,13 +1,12 @@
|
|||||||
pre-requisites
|
pre-requisites
|
||||||
* setup postgres db with a username and password and database
|
* setup postgres db with a username and password and database
|
||||||
* add this to .bashrc to quickly invoke command line connection `export PGD="psql -U ptrowbridge -d ubm -p 5433 -h 192.168.1.110"`
|
|
||||||
|
|
||||||
setup
|
setup
|
||||||
* `$PG -f setup_sql/schema.sql` setup the application tables
|
* `setup_sql/schema.sql` setup the application tables
|
||||||
* create a table of data to forecast
|
* create a table of data to forecast
|
||||||
* `$PG -f setup_sql/target_info.sql` to populate the meta table (edit table name)
|
* `setup_sql/target_info.sql` to populate the meta table (edit table name)
|
||||||
* fill out the `target_meta` table
|
* fill out the `target_meta` table
|
||||||
* `$PG -f setup_sql/build_maste_tables.sql` to create master data tables from forecast data
|
* `setup_sql/build_maste_tables.sql` to create master data tables from forecast data
|
||||||
* `./routes/baseline/generate_route_sql.sh` to create the baseline sql used by the /baseline route
|
* `./routes/baseline/generate_route_sql.sh` to create the baseline sql used by the /baseline route
|
||||||
|
|
||||||
| schema | tname | cname | opos | func | fkey | fcol | dtype | appcol | pretty |
|
| schema | tname | cname | opos | func | fkey | fcol | dtype | appcol | pretty |
|
||||||
|
@ -11,6 +11,7 @@ SELECT
|
|||||||
,o."Category"
|
,o."Category"
|
||||||
,o."Party"
|
,o."Party"
|
||||||
,o."Reason"
|
,o."Reason"
|
||||||
|
,o.app_units
|
||||||
,'app_forecast_name' "version"
|
,'app_forecast_name' "version"
|
||||||
,'actuals' iter
|
,'actuals' iter
|
||||||
,null::bigint app_logid
|
,null::bigint app_logid
|
||||||
@ -21,7 +22,7 @@ WHERE
|
|||||||
--base period orders booked....
|
--base period orders booked....
|
||||||
"Trans. Date" BETWEEN 'app_baseline_from_date'::date AND 'app_baseline_to_date'::date
|
"Trans. Date" BETWEEN 'app_baseline_from_date'::date AND 'app_baseline_to_date'::date
|
||||||
--...or any open orders currently booked before cutoff....
|
--...or any open orders currently booked before cutoff....
|
||||||
OR ("Category" IN (app_openstatus_code) and "Trans. Date" <= 'app_openorder_cutoff'::date)
|
OR ("Description" IN (app_openstatus_code) and "Trans. Date" <= 'app_openorder_cutoff'::date)
|
||||||
--...or anything that shipped in that period
|
--...or anything that shipped in that period
|
||||||
OR ("Post Date" BETWEEN 'app_baseline_from_date'::date AND 'app_baseline_to_date'::date)
|
OR ("Post Date" BETWEEN 'app_baseline_from_date'::date AND 'app_baseline_to_date'::date)
|
||||||
)
|
)
|
||||||
@ -37,15 +38,16 @@ SELECT
|
|||||||
,o."Category"
|
,o."Category"
|
||||||
,o."Party"
|
,o."Party"
|
||||||
,o."Reason"
|
,o."Reason"
|
||||||
|
,o.app_units
|
||||||
,'app_forecast_name' "version"
|
,'app_forecast_name' "version"
|
||||||
,'plug' iter
|
,'plug' iter
|
||||||
,null::bigint app_logid
|
,null::bigint app_logid
|
||||||
FROM
|
FROM
|
||||||
tpsv.dcard o
|
tpsv.dcard o
|
||||||
LEFT OUTER JOIN fc.perd tdate ON
|
|
||||||
(o."Trans. Date" + interval '1 year' )::date <@ tdate.drange
|
|
||||||
LEFT OUTER JOIN fc.perd pdate ON
|
LEFT OUTER JOIN fc.perd pdate ON
|
||||||
(o."Post Date" + interval '1 year' )::date <@ pdate.drange
|
(o."Post Date" + interval '1 year' )::date <@ pdate.drange
|
||||||
|
LEFT OUTER JOIN fc.perd tdate ON
|
||||||
|
(o."Trans. Date" + interval '1 year' )::date <@ tdate.drange
|
||||||
WHERE
|
WHERE
|
||||||
"Trans. Date" BETWEEN 'app_plug_fromdate'::date AND 'app_plug_todate'::date
|
"Trans. Date" BETWEEN 'app_plug_fromdate'::date AND 'app_plug_todate'::date
|
||||||
--be sure to pre-exclude unwanted items, like canceled orders, non-gross sales, and short-ships
|
--be sure to pre-exclude unwanted items, like canceled orders, non-gross sales, and short-ships
|
||||||
@ -61,15 +63,16 @@ SELECT
|
|||||||
,o."Category"
|
,o."Category"
|
||||||
,o."Party"
|
,o."Party"
|
||||||
,o."Reason"
|
,o."Reason"
|
||||||
|
,o.app_units
|
||||||
,'app_forecast_name' "version"
|
,'app_forecast_name' "version"
|
||||||
,'baseline' iter
|
,'baseline' iter
|
||||||
,null::bigint app_logid
|
,null::bigint app_logid
|
||||||
FROM
|
FROM
|
||||||
baseline o
|
baseline o
|
||||||
LEFT OUTER JOIN fc.perd tdate ON
|
|
||||||
(o."Trans. Date" + interval '1 year' )::date <@ tdate.drange
|
|
||||||
LEFT OUTER JOIN fc.perd pdate ON
|
LEFT OUTER JOIN fc.perd pdate ON
|
||||||
(o."Post Date" + interval '1 year' )::date <@ pdate.drange
|
(o."Post Date" + interval '1 year' )::date <@ pdate.drange
|
||||||
|
LEFT OUTER JOIN fc.perd tdate ON
|
||||||
|
(o."Trans. Date" + interval '1 year' )::date <@ tdate.drange
|
||||||
)
|
)
|
||||||
,ins AS (
|
,ins AS (
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
|
Loading…
Reference in New Issue
Block a user