Skip to content

Commit

Permalink
Merge pull request #172 from hello/ksg
Browse files Browse the repository at this point in the history
additional stats for dust, save sleep-score to dynamoDB after it has been computed in timeline view
  • Loading branch information
kingshyg committed Oct 22, 2014
2 parents ff56dc3 + 2a3f352 commit b937d63
Show file tree
Hide file tree
Showing 15 changed files with 818 additions and 410 deletions.
11 changes: 11 additions & 0 deletions sql/sensors/device_sensors/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ CREATE TABLE device_sensors_master (
ambient_light_peakiness INTEGER,
ambient_humidity INTEGER,
ambient_air_quality INTEGER,
ambient_air_quality_raw INTEGER, -- raw counts
ambient_dust_variance INTEGER, -- raw counts
ambient_dust_min INTEGER, -- raw counts
ambient_dust_max INTEGER, -- raw counts
ts TIMESTAMP,
local_utc_ts TIMESTAMP,
offset_millis INTEGER
Expand All @@ -78,6 +82,13 @@ ALTER TABLE device_sensors_master ALTER COLUMN ambient_light SET DATA TYPE INTEG
ALTER TABLE device_sensors_master ALTER COLUMN ambient_humidity SET DATA TYPE INTEGER;
ALTER TABLE device_sensors_master ALTER COLUMN ambient_air_quality SET DATA TYPE INTEGER;

-- additional dust stats (10/22/2014)
ALTER TABLE device_sensors_master ADD COLUMN ambient_air_quality_raw INTEGER DEFAULT 0; -- save raw counts
ALTER TABLE device_sensors_master ADD COLUMN ambient_dust_variance INTEGER DEFAULT 0;
ALTER TABLE device_sensors_master ADD COLUMN ambient_dust_min INTEGER DEFAULT 0;
ALTER TABLE device_sensors_master ADD COLUMN ambient_dust_max INTEGER DEFAULT 0;


-- Trigger function for master insert
CREATE OR REPLACE FUNCTION device_sensors_master_insert_function() RETURNS TRIGGER LANGUAGE plpgsql AS
$BODY$
Expand Down
Loading

0 comments on commit b937d63

Please sign in to comment.