diff --git a/notebook_example.ipynb b/notebook_example.ipynb index c398e6b..68987ed 100644 --- a/notebook_example.ipynb +++ b/notebook_example.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -24,9 +24,14 @@ "\t\"github.com/evertoncolling/poc-requests-go/pkg/api\"\n", "\t\"github.com/evertoncolling/poc-requests-go/pkg/dto\"\n", "\n", - "\tgrob \"github.com/MetalBlueberry/go-plotly/graph_objects\"\n", - "\t\"github.com/janpfeifer/gonb/gonbui/plotly\"\n", + " \"github.com/janpfeifer/gonb/gonbui/plotly\"\n", + "\tgrob \"github.com/MetalBlueberry/go-plotly/generated/v2.34.0/graph_objects\"\n", + " ptypes \"github.com/MetalBlueberry/go-plotly/pkg/types\"\n", "\t\"github.com/joho/godotenv\"\n", + "\n", + " \"github.com/go-echarts/go-echarts/v2/charts\"\n", + "\t\"github.com/go-echarts/go-echarts/v2/opts\"\n", + "\tgonb_echarts \"github.com/janpfeifer/gonb-echarts\"\n", ")\n", "\n", "// Find a unit by external ID\n", @@ -86,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -114,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -122,7 +127,7 @@ "output_type": "stream", "text": [ "### Testing fetching the Unit catalog\n", - "Unit Count: 318\n" + "Unit Count: 359\n" ] } ], @@ -144,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -152,8 +157,8 @@ "output_type": "stream", "text": [ "### Latest Data Points\n", - "EVE-TI-FORNEBU-01-2 [°C]: &{datapoints:{timestamp:1738092000000 value:3.1}}\n", - "EVE-TI-FORNEBU-01-3 [°C]: &{datapoints:{timestamp:1738092003000 value:3.23}}\n" + "EVE-TI-FORNEBU-01-2 [°C]: &{datapoints:{timestamp:1745317200000 value:7.8}}\n", + "EVE-TI-FORNEBU-01-3 [°C]: &{datapoints:{timestamp:1745316903000 value:8.19}}\n" ] } ], @@ -188,7 +193,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -197,9 +202,9 @@ "text": [ "### Data Points (performance test)\n", "Data Points External ID: EVE-TI-FORNEBU-01-2\n", - "Data Points Unit: temperature:deg_c -> [°C]\n", - "Data Points Count: 82493\n", - "Time taken: 181.524792ms\n" + "Data Points Unit: temperature:deg_c\n", + "Data Points Count: 63554\n", + "Time taken: 177.08775ms\n" ] } ], @@ -218,7 +223,7 @@ "start := time.Now()\n", "dataPoints, err := client.TimeSeries.RetrieveData(\n", "\t&items,\n", - "\tnil, nil, nil, nil, nil, nil, nil,\n", + "\tnil, nil, nil, nil, nil, nil, nil, nil,\n", ")\n", "elapsed := time.Since(start)\n", "if err != nil {\n", @@ -227,14 +232,9 @@ "}\n", "dps := dataPoints.Items[0]\n", "fmt.Println(\"Data Points External ID:\", dps.ExternalId)\n", - "unit, err := findUnitByExternalId(&unitList, dps.UnitExternalId)\n", - "if err != nil {\n", - "\tfmt.Println(\"Error:\", err)\n", - "\treturn\n", - "}\n", - "fmt.Println(\"Data Points Unit:\", dps.UnitExternalId, \" -> [\"+unit.Symbol+\"]\")\n", + "fmt.Println(\"Data Points Unit:\", dps.UnitExternalId)\n", "// not sure if there is a simpler way to get to the data points :)\n", - "switch v := (*dps).DatapointType.(type) {\n", + "switch v := dps.DatapointType.(type) {\n", "case *dto.DataPointListItem_NumericDatapoints:\n", "\tfmt.Println(\"Data Points Count:\", len(v.NumericDatapoints.Datapoints))\n", "case *dto.DataPointListItem_StringDatapoints:\n", @@ -249,7 +249,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -257,13 +257,13 @@ "output_type": "stream", "text": [ "### Data Points (for plotting)\n", - "Time taken: 158.607125ms\n" + "Time taken: 130.323875ms\n" ] }, { "data": { "text/html": [ - "
" + "" ] }, "metadata": {}, @@ -274,14 +274,14 @@ "text/html": [ "