Skip to content

Commit

Permalink
Merge pull request #277 from clanghout/examples
Browse files Browse the repository at this point in the history
Examples
  • Loading branch information
clanghout committed Jul 2, 2015
2 parents 13d809e + a46b6bb commit 10e26fb
Show file tree
Hide file tree
Showing 21 changed files with 282 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/analysis/10_timeMeasured.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def groupByDay : GroupByColumn = NAME timesMeasured
ON admire2txt.date
FROM
COUNT(admire2txt.date) AS number_of_measures;

from(admire2txt)|groupBy(groupByDay)
18 changes: 18 additions & 0 deletions examples/analysis/11_multipleMeasuresEntered.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def joinMult : Join = JOIN timesMeasured WITH
filtered AS multipleMeasures
ON timesMeasured.Chunk = filtered.Date
AND timesMeasured.number > 1;

def joinMultAdmire : Join = JOIN multipleMeasures WITH
admire2txt AS multipleMeasuresSensor
ON multipleMeasures.Chunk = admire2txt.date ;

def comp : Computation = NAME multipleShort
NEW SET COLUMNS
multipleMeasuresSensor.multipleMeasures_Value AS ValueWeb,
multipleMeasuresSensor.admire2txt_Value AS ValueAdmire,
multipleMeasuresSensor.Chunk AS Date,
multipleMeasuresSensor.number AS Number;

join(joinMult) | join(joinMultAdmire) |
from(multipleMeasuresSensor) | computation(comp)
17 changes: 17 additions & 0 deletions examples/analysis/12_countRemeasure.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def measured : Constraint = filteredweb.CustomMeasurementId = 415;
def remeasure : Constraint =
filtered.KreatinineAlgorithmActionId = "1";
def done : Constraint = remeasure.Date = second.Date;
def group : GroupByConstraint = NAME remeasureAmount ON
HAS_CODE("Done") AS Done,
HAS_CODE("NotDone") AS NotDone
FROM COUNT(remeasure.Moment) AS Count;


from(filteredweb) | constraint(measured)|is(second) |
from(filtered) | constraint(remeasure) | is(remeasure) |
from(remeasure, second) | constraint(done) |

is(remeasure, temp) | setCode("Done", remeasure) |
difference(remeasure, temp) | setCode("NotDone", remeasure) |
groupBy(group)
2 changes: 2 additions & 0 deletions examples/analysis/13_updated.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def con : Constraint = filteredweb.CreatedDate BEFORE filteredweb.ModifiedDate;
from(filteredweb)|constraint(con)|is(updated)
19 changes: 19 additions & 0 deletions examples/analysis/14_hospital.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def filterUser : Constraint = "admire56" = websitexlsx.Login;

def con : Constraint =
filteredweb56.KreatinineAlgorithmDayRatingId = "5";

def filter : Constraint =
filteredweb56.KreatinineAlgorithmDayRatingId = "4" OR
filteredweb56.KreatinineAlgorithmDayRatingId = "3";

def hosp : Constraint =
filteredweb56.KreatinineAlgorithmDayRatingId = "4" AND
RELATIVE(temp.Date, filteredweb56.Date, DAYS) = 1;

from(websitexlsx) | constraint(filterUser) |
is(filteredweb56) |
from(filteredweb56) | constraint(con) | is(hosp1) |
from(filteredweb56) | constraint(filter) | is(temp) |
from(filteredweb56, temp) | constraint(hosp)
| is(filteredweb56, hosp2) | union(hosp1, hosp2) | is(hospital)
18 changes: 18 additions & 0 deletions examples/analysis/15_normalPeriod2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def comp : Computation = NAME temp INCLUDE EXISTING SET COLUMNS
MIN(filtered.Date) AS min;

def filter : Constraint =
RELATIVE(temp.min, temp.Date, DAYS) > 21 AND
RELATIVE(temp.min, temp.Date, DAYS) < 64;

def normal : Constraint =
RELATIVE(temp.Date, temp2.Date, DAYS) = 2;
def toOften : Constraint =
RELATIVE(temp.Date, temp2.Date, DAYS) = 1;

from(filtered) | computation(comp) |
from(temp) | constraint(filter) | is(temp) | is(temp2) |
from(temp, temp2) | constraint(normal) | is(temp, normal) |
from(temp, temp2) | constraint(toOften) | is(temp, temp3) |
difference(normal, temp3) | is(normal) |
from(temp) | sort(temp.Date, "ASC") | from(normal) | setCode("normal", temp)
22 changes: 22 additions & 0 deletions examples/analysis/16_normalPeriod3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def comp : Computation = NAME temp INCLUDE EXISTING SET COLUMNS
MIN(filtered.Date) AS min;

def filter : Constraint = temp2.week > 9 AND temp2.week < 19;

def normalCount : Constraint = measures3.Count = 2;

def normal : Constraint = temp3.Chunk = temp2.week;

def week : Computation = NAME temp2 INCLUDE EXISTING SET COLUMNS
((RELATIVE(temp.min, temp.Date, DAYS)) -
((RELATIVE(temp.min, temp.Date, DAYS)) % 7)) / 7 AS week;

def groupBy : GroupByColumn = NAME measures3 ON temp2.week
FROM COUNT(measures3.week) AS Count;

from(filtered) | computation(comp) |
from(temp) | computation(week) | computation(filter) | is(temp2) |
groupBy(groupBy) | constraint(normalCount) | is(temp3) |
from(temp2, temp3) | constraint(normal) | is(temp2, normal3) |
difference(temp2, normal3) | is(notNormal3)

10 changes: 10 additions & 0 deletions examples/analysis/1_filter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def filterUser : Constraint = "admire2" = websitexlsx.Login;

def con : Constraint = filteredweb.CustomMeasurementId = 346;


from(websitexlsx) | constraint(filterUser) |
is(filteredweb) |

from(filteredweb)|
constraint(con)|is(filtered)
5 changes: 5 additions & 0 deletions examples/analysis/2_addDateTime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def comp : Computation = NAME sensor
INCLUDE EXISTING SET COLUMNS
COMBINE(admire2txt.date, admire2txt.time) AS datetime;

from(admire2txt)|computation(comp)
8 changes: 8 additions & 0 deletions examples/analysis/3_filterSensor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def comp : Computation = NAME sensorred
NEW SET COLUMNS
sensor.Value AS Value,
sensor.date AS Date,
sensor.time AS Time,
sensor.datetime AS DateTime;

from(sensor)|computation(comp)
6 changes: 6 additions & 0 deletions examples/analysis/4_timeMeasue1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def groupByDay : GroupByColumn = NAME measureMoment
ON filteredweb.Moment
FROM
COUNT(filteredweb.Moment) AS number_of_measures;

from(filteredweb)|groupBy(groupByDay)
12 changes: 12 additions & 0 deletions examples/analysis/5_timeMeasue2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def group : GroupByConstraint = NAME measureMoment2 ON
admire2txt.time BEFORE #06:00# AS early,
admire2txt.time AFTER #06:00# AND admire2txt.time BEFORE #07:00# AS six,
admire2txt.time AFTER #07:00# AND admire2txt.time BEFORE #08:00# AS seven,
admire2txt.time AFTER #08:00# AND admire2txt.time BEFORE #09:00# AS eight,
admire2txt.time AFTER #09:00# AND admire2txt.time BEFORE #10:00# AS nine,
admire2txt.time AFTER #10:00# AND admire2txt.time BEFORE #11:00# AS ten,
admire2txt.time AFTER #11:00# AND admire2txt.time BEFORE #12:00# AS eleven,
admire2txt.time AFTER #12:00# AS late
FROM COUNT(admire2txt.time) AS count;

from(admire2txt)|groupBy(group)
5 changes: 5 additions & 0 deletions examples/analysis/6_dayOfWeek.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def groupBy : GroupByColumn = NAME everyDay ON
((RELATIVE(admire2txt.date,#2015-06-21#, DAYS)) % 7)
FROM COUNT(admire2txt.date) AS count;

from(admire2txt)|groupBy(groupBy)
18 changes: 18 additions & 0 deletions examples/analysis/7_enterMoment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def group : GroupByConstraint = NAME enterMoment ON
TO_TIME(filteredweb.CreatedDate) BEFORE #06:00# AS early,
TO_TIME(filteredweb.CreatedDate) AFTER #06:00#
AND TO_TIME(filteredweb.CreatedDate) BEFORE #07:00# AS six,
TO_TIME(filteredweb.CreatedDate) AFTER #07:00#
AND TO_TIME(filteredweb.CreatedDate) BEFORE #08:00# AS seven,
TO_TIME(filteredweb.CreatedDate) AFTER #08:00#
AND TO_TIME(filteredweb.CreatedDate) BEFORE #09:00# AS eight,
TO_TIME(filteredweb.CreatedDate) AFTER #09:00#
AND TO_TIME(filteredweb.CreatedDate) BEFORE #10:00# AS nine,
TO_TIME(filteredweb.CreatedDate) AFTER #10:00#
AND TO_TIME(filteredweb.CreatedDate) BEFORE #11:00# AS ten,
TO_TIME(filteredweb.CreatedDate) AFTER #11:00#
AND TO_TIME(filteredweb.CreatedDate) BEFORE #12:00# AS eleven,
TO_TIME(filteredweb.CreatedDate) AFTER #12:00# AS late
FROM COUNT(filteredweb.Moment) AS count;

from(filteredweb)|groupBy(group)
5 changes: 5 additions & 0 deletions examples/analysis/8_enterDay.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def groupBy : GroupByColumn = NAME enterDay ON
((RELATIVE(TO_DATE(filteredweb.CreatedDate),#2015-06-21#, DAYS)) % 7)
FROM COUNT(filteredweb.Moment) AS count;

from(filteredweb)|groupBy(groupBy)
15 changes: 15 additions & 0 deletions examples/analysis/9_difference.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def joinDif : Join = JOIN admire2txt WITH filtered AS difference
ON admire2txt.date = filtered.Date
AND NOT(admire2txt.Value = filtered.Value);

def comp : Computation = NAME joinDifReduced
NEW SET COLUMNS
difference.date AS Date,
difference.admire2txt_Value AS SensorValue,
difference.filtered_Value AS WebValue,
(difference.filtered_Value - difference.admire2txt_Value)
AS dif;


join(joinDif)|from(difference)|computation(comp)

6 changes: 6 additions & 0 deletions examples/analysis/join.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def join : Join = JOIN sensorred WITH filtered AS joined
ON sensorred.Date = filtered.Date,
FROM sensorred.Date AND filtered.Date;

join(join)

10 changes: 10 additions & 0 deletions examples/analysis/temp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def measured : Constraint = filteredweb.CustomMeasurementId = 415;
def remeasure : Constraint =
filtered.KreatinineAlgorithmActionId = "1";
def done : Constraint = remeasure.Date = second.Date;

from(filteredweb) | constraint(measured)|is(second) |
from(filtered) | constraint(remeasure) | is(remeasure) |
from(remeasure, second) | constraint(done) |
is(remeasure, temp) | setCode("Done", remeasure) |
difference(remeasure, temp) | setCode("NotDone", remeasure)
10 changes: 10 additions & 0 deletions examples/analysis/temp2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def comp : Computation = NAME temp INCLUDE EXISTING SET COLUMNS
MIN(filtered.Date) AS min;


def week : Computation = NAME temp2 INCLUDE EXISTING SET COLUMNS
RELATIVE(temp.min, temp.Date, DAYS) AS week;

from(filtered) | computation(comp) |
from(temp) | computation(week)

Binary file added examples/examples.odt
Binary file not shown.
70 changes: 70 additions & 0 deletions examples/sensorAndWebsite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<input>
<file name="website.xlsx">
<path>/home/jens/session/input</path>
<type>xlsx</type>
<data>
<start>1</start>
<end>0</end>
</data>
<columns firstrowheader="true">
<column format="" type="int"/>
<column format="" type="int"/>
<column format="" type="string"/>
<column format="exceldate" type="date"/>
<column format="" type="int"/>
<column format="" type="int"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="" type="string"/>
<column format="exceldate" type="datetime"/>
<column format="" type="string"/>
<column format="exceldate" type="datetime"/>
<column format="" type="int"/>
<column format="" type="int"/>
<column format="" type="string"/>
<column format="" type="int"/>
<column format="" type="string"/>
<column format="" type="string"/>
</columns>
</file>
<file delimiter="," name="admire2.txt">
<path>/home/jens/session/input/measured creatinine</path>
<metadata format="" name="name" type="string" value="admire2"/>
<type>plaintext</type>
<data>
<start>7</start>
<end>2</end>
</data>
<columns firstrowheader="false">
<column format="" type="string">Type</column>
<column format="" type="int">Value</column>
<column format="" type="string">unit</column>
<column format="" type="string">ignore</column>
<column format="yyMMdd" type="date">date</column>
<column format="HHmm" type="time">time</column>
</columns>
</file>
<file delimiter="," name="ADMIRE_13.txt">
<path>/home/jens/session/input/measured creatinine</path>
<metadata name="name" type="string"/>
<type>plaintext</type>
<data>
<start>7</start>
<end>2</end>
</data>
<columns firstrowheader="false">
<column format="" type="string">Type</column>
<column format="" type="int">Value</column>
<column format="" type="string">unit</column>
<column format="" type="string">ignore</column>
<column format="yyMMdd" type="date">date</column>
<column format="HHmm" type="time">time</column>
</columns>
</file>
</input>

0 comments on commit 10e26fb

Please sign in to comment.