From 13d9ea4c58ee920ce061fc1f68c61c2bd68f9721 Mon Sep 17 00:00:00 2001 From: Nahrain Gtari Date: Sun, 14 Jan 2024 17:33:49 +0100 Subject: [PATCH] Exercise4.jv --- exercises/exercise4.jv | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 exercises/exercise4.jv diff --git a/exercises/exercise4.jv b/exercises/exercise4.jv new file mode 100644 index 0000000000..bffd095ebd --- /dev/null +++ b/exercises/exercise4.jv @@ -0,0 +1,77 @@ +transform CelsiusToFahrenheit +{ + from tempCelsius oftype decimal; + to tempFahrenheit oftype decimal; + + tempFahrenheit: (tempCelsius * 9/5) + 32; +} + +pipeline DeviceDataPipeline{ + block ZipExtractor oftype HttpExtractor{ + url:"https://www.mowesta.com/data/measure/mowesta-dataset-20221107.zip"; + } + block UnzipData oftype ArchiveInterpreter{ + archiveType: "zip"; + } + block CSVFilePicker oftype FilePicker { + path: "/data.csv"; + } + + block DataTextFileInterpreter oftype TextFileInterpreter{ + } + + block DataCSVInterpreter oftype CSVInterpreter{ + delimiter: ';'; + } + + block ColumnDeleter oftype ColumnDeleter { + delete: [column F, column G, column H, column I]; + } + + block ColumnSelector oftype CellRangeSelector { + select: range A1:K*; + } + + block DataTableInterpreter oftype TableInterpreter{ + header: false; + columns: [ + "Geraet" oftype integer, + "Hersteller" oftype text, + "Model" oftype text, + "Monat" oftype integer, + "Temperatur" oftype decimal, + "Batterietemperatur" oftype decimal, + "Geraet aktiv" oftype text, + ]; + } + block TempConverter oftype TableTransformer + { + inputColumns: ["Temperatur"]; + outputColumn: 'Temperatur'; + use: CelsiusToFahrenheit; + } + + block TempBatteryConverter oftype TableTransformer + { + inputColumns: ["Batterietemperatur"]; + outputColumn: 'Batterietemperatur'; + use: CelsiusToFahrenheit; + } + + block DataLoader oftype SQLiteLoader + { + table: "temperatures"; + file: "./temperatures.sqlite"; + } + ZipExtractor + ->UnzipData + ->CSVFilePicker + ->DataTextFileInterpreter + ->DataCSVInterpreter + ->ColumnSelector + ->ColumnDeleter + ->DataTableInterpreter + ->TempConverter + ->TempBatteryConverter + ->DataLoader; + } \ No newline at end of file