Skip to content

Instantly share code, notes, and snippets.

View slawo-ch's full-sized avatar

Slawomir Chodnicki slawo-ch

  • Twineworks GmbH
  • Berlin, Germany
View GitHub Profile
Arrival_Time,Creation_Time,x,y,z
1427705168489,1427706985924713823,0.117874146,-0.3671875,9.740707
1427705168493,1427706985929718706,0.16548157,-0.38861084,9.668106
1427705168498,1427706985934815141,0.11906433,-0.37075806,9.796646
...
Index,Arrival_Time,Creation_Time,x,y,z
0,1398347018273,1398347018273,-0.053403,0.072655,9.721135,
10,1398347018283,1398347018283,-0.042298,0.050684,9.717558,
20,1398347018293,1398347018293,-0.047864,0.061659,9.717514,
...
Index,Arrival_Time,Creation_Time,x,y,z
0,1425034685889,339190177.1666667,0.0010474632263183592,-0.05132569808959961,-9.836577520751952
1,1425034685895,339199878.1666667,0.0056862289428710935,-0.051475335693359374,-9.84061773605347
2,1425034685897,339209575.1666667,0.0013467384338378906,-0.053719899749755856,-9.853336932373047
...
CREATE TABLE still (
still_id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
sample_index BIGINT,
orientation varchar(20),
model varchar(200),
device varchar(200),
arrival_time NUMERIC(32,12),
sensor_time NUMERIC(32,12),
creation_time NUMERIC(32,12),
x NUMERIC(32,20),
select orientation, device, x, y, z from still where device = 'LG-Nexus4' limit 10
orientation|device |x |y |z |
-----------|---------|----------------------|-----------------------|-----------------------|
onback |LG-Nexus4|0.11567688000000000000|-0.11888122600000000000|10.01687600000000000000|
onback |LG-Nexus4|0.13233948000000000000|-0.12007141000000000000|10.02282700000000000000|
onback |LG-Nexus4|0.14900208000000000000|-0.17124939000000000000|10.11804200000000000000|
onback |LG-Nexus4|0.16209412000000000000|-0.12959290000000000000|10.09185800000000000000|
onback |LG-Nexus4|0.18232727000000000000|-0.09507751500000000000|10.07519500000000000000|
onback |LG-Nexus4|0.19660950000000000000|-0.13673401000000000000|10.05734300000000000000|
DROP TABLE IF EXISTS still
CREATE TABLE still (
still_id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
sample_index BIGINT,
orientation varchar(20),
model varchar(200),
device varchar(200),
arrival_time NUMERIC(32,12),
sensor_time NUMERIC(32,12),
select
device, orientation, count(*)
from still
where device like 'LG%'
group by
device, orientation
order by
device, orientation
device |orientation|count |
select
device, orientation, AVG(x) as avg_x, AVG(y) as avg_y, AVG(z) as avg_z
from
still
where
device like 'LG%'
and orientation = 'onback'
group by
device, orientation
Index,Arrival_Time,Creation_Time,x,y,z,User,Model,Device,gt
0,1424696633908,1424696631913248572,-5.958191,0.6880646,8.135345,a,nexus4,nexus4_1,stand
1,1424696633909,1424696631918283972,-5.95224,0.6702118,8.136536,a,nexus4,nexus4_1,stand
2,1424696633918,1424696631923288855,-5.9950867,0.6535491999999999,8.204376,a,nexus4,nexus4_1,stand
3,1424696633919,1424696631928385290,-5.9427185,0.6761626999999999,8.128204,a,nexus4,nexus4_1,stand
...
CREATE TABLE activity (
activity_id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
device_type VARCHAR(10),
sensor VARCHAR(20),
sample_index BIGINT,
arrival_time BIGINT,
creation_time BIGINT,
x NUMERIC(32,20),
y NUMERIC(32,20),
z NUMERIC(32,20),