forked from jvalue/made-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56c31a8
commit 0777b1a
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
pipeline DataPipeline { | ||
|
||
// define pipeline | ||
EntryStep | ||
-> ZipArchiveInterpreter | ||
-> SelectDataFile | ||
-> TextFileInterpreter | ||
-> DataCSVInterpreter | ||
-> InitSelect | ||
-> columDel | ||
-> TableTransformer | ||
-> OutputLoader | ||
; | ||
|
||
//define datasource | ||
block EntryStep oftype HttpExtractor { | ||
url: "https://www.mowesta.com/data/measure/mowesta-dataset-20221107.zip"; | ||
} | ||
|
||
block ZipArchiveInterpreter oftype ArchiveInterpreter { | ||
archiveType: "zip"; | ||
} | ||
|
||
//define TrainsTextFileInterpreter | ||
block SelectDataFile oftype FilePicker { | ||
path: "/data.csv"; | ||
} | ||
|
||
block TextFileInterpreter oftype TextFileInterpreter { | ||
|
||
} | ||
|
||
//define TrainsCSVInterpreter to read in CSV correctly | ||
block DataCSVInterpreter oftype CSVInterpreter { | ||
delimiter: ";"; | ||
} | ||
|
||
//define StatusColumnDeleterto delete the "Status" column | ||
block InitSelect oftype CellRangeSelector { | ||
select: range A1:K*; | ||
} | ||
|
||
block columDel oftype ColumnDeleter { | ||
delete: [column F, column G, column H, column I]; | ||
} | ||
|
||
|
||
|
||
//define TrainsTableInterpreter to set datatypes accordingly | ||
block TableTransformer oftype TableInterpreter { | ||
header: true; | ||
columns: [ | ||
"Geraet" oftype integer, | ||
"Hersteller" oftype text, | ||
"Model" oftype text, | ||
"Monat" oftype monatType, | ||
"Temperatur" oftype temperaturTypeC, | ||
"Batterietemperatur" oftype temperaturTypeC, | ||
"Geraet aktiv" oftype boolean | ||
]; | ||
} | ||
|
||
transform celsiusToFahrenheit{ | ||
from cel oftype temperaturTypeC; | ||
to fahr oftype decimal; | ||
|
||
fahr: (cel *9/5)+32; | ||
} | ||
|
||
block CToFTransformer oftype TableTransformer{ | ||
inputColumns: ['Temperatur']; | ||
outputColumn: 'temperature'; | ||
use: celsiusToFahrenheit; | ||
} | ||
|
||
//define TrainsLoader to save data to SQLite DB | ||
block OutputLoader oftype SQLiteLoader { | ||
table: "temperatures"; | ||
file: "./temperatures.sqlite"; | ||
} | ||
|
||
//define Verkehr datatype to ensure allowed values | ||
valuetype monatType oftype integer { | ||
constraints: [ monatConstraint ]; | ||
} | ||
|
||
//Only allow specified values | ||
constraint monatConstraint oftype RangeConstraint { | ||
lowerBound: 1; | ||
upperBound: 12; | ||
} | ||
|
||
//define LB datatype to ensure Coordinate consistency | ||
valuetype temperaturTypeC oftype decimal { | ||
constraints: [ temperatureConstraintC ]; | ||
} | ||
|
||
//Only allow values >= −273,15 (abs. zero) | ||
constraint temperatureConstraintC on decimal: | ||
value >= -273.15; | ||
} |
Binary file not shown.