Moved and added data for graphs etc. for org dashboard

This commit is contained in:
Finn 2019-07-12 13:39:37 +01:00
parent 13021934e3
commit e625dc8ffe
6 changed files with 242 additions and 2 deletions

View file

@ -44,6 +44,7 @@ __PACKAGE__->add_columns(
size => 255,
is_nullable => 1,
},
# Stores codes based on https://www.ons.gov.uk/methodology/classificationsandstandards/ukstandardindustrialclassificationofeconomicactivities/uksic2007
sector => {
data_type => 'varchar',
size => 1,

View file

@ -17,7 +17,8 @@ SELECT "value",
"seller_id",
DATE_TRUNC('hour', "purchase_time") AS "quantised_hours",
DATE_TRUNC('day', "purchase_time") AS "quantised_days",
DATE_TRUNC('week', "purchase_time") AS "quantised_weeks"
DATE_TRUNC('week', "purchase_time") AS "quantised_weeks",
DATE_TRUNC('month', "purchase_time") AS "quantised_months"
FROM "transactions"
/);

View file

@ -15,9 +15,11 @@ SELECT "value",
"purchase_time",
"buyer_id",
"seller_id",
"sector",
DATETIME(STRFTIME('%Y-%m-%d %H:00:00',"purchase_time")) AS "quantised_hours",
DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time")) AS "quantised_days",
DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time",'weekday 0','-6 days')) AS "quantised_weeks"
DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time",'weekday 0','-6 days')) AS "quantised_weeks",
DATETIME(STRFTIME('%Y-%m-00 00:00:00',"purchase_time")) AS "quantised_months"
FROM "transactions"
/);