Skip to content

Commit

Permalink
added exercise 4
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasseema authored Jan 24, 2024
1 parent d2b3485 commit 9de90fb
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions exercises/exercise4.jv
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
pipeline MowestaPipeline {

block MowestaExtractor oftype HttpExtractor {
url: "https://www.mowesta.com/data/measure/mowesta-dataset-20221107.zip";
}

block ZipArchiveInterpreter oftype ArchiveInterpreter {
archiveType: "zip";
}

block MowestaDataFilePicker oftype FilePicker {
path: "/data.csv";
}

block MowestaInterpreter oftype TextFileInterpreter{
}

block MowestaCSVInterpreter oftype CSVInterpreter {
delimiter: ";";
}

block RenameTemperaturCellWriter oftype CellWriter {
at: cell E1;
write: ["Temperatur"];
}

block RenameTemperaturBatteryCellWriter oftype CellWriter {
at: cell J1;
write: ["Batterietemperatur"];
}

block MowestaTableInterpreter oftype TableInterpreter {
header: true;
columns: [
"Geraet" oftype ValidGeraetNumber,
"Hersteller" oftype text,
"Model" oftype text,
"Monat" oftype integer,
"Temperatur" oftype decimal,
"Batterietemperatur" oftype decimal,
"Geraet aktiv" oftype text,
];
}

transform CelsiusToFahrenheit {
from Celsius oftype decimal;
to Fahrenheit oftype decimal;
Fahrenheit: (Celsius * 9/5) + 32;
}

block CelsiusToFahrenheitTransformer oftype TableTransformer {
inputColumns: ['Temperatur'];
outputColumn: 'Temperatur';
use: CelsiusToFahrenheit;
}

block CelsiusToFahrenheitBatteryTransformer oftype TableTransformer {
inputColumns: ['Batterietemperatur'];
outputColumn: 'Batterietemperatur';
use: CelsiusToFahrenheit;
}

constraint ValidGeraetNumberRange on decimal:
value > 0;


valuetype ValidGeraetNumber oftype integer {
constraints: [ ValidGeraetNumberRange ];
}

block MowestaLoader oftype SQLiteLoader {
table: "temperatures";
file: "./temperatures.sqlite";
}

MowestaExtractor
-> ZipArchiveInterpreter
-> MowestaDataFilePicker
-> MowestaInterpreter
-> MowestaCSVInterpreter
-> RenameTemperaturCellWriter
-> RenameTemperaturBatteryCellWriter
-> MowestaTableInterpreter
-> CelsiusToFahrenheitTransformer
-> CelsiusToFahrenheitBatteryTransformer
-> MowestaLoader;

}

0 comments on commit 9de90fb

Please sign in to comment.