iot-app-kit icon indicating copy to clipboard operation
iot-app-kit copied to clipboard

@iot-app-kit/source-iotsitewise tries to aggregate string data using AVERAGE

Open NorbertNader opened this issue 2 years ago • 1 comments

Describe the bug When requesting aggregated data and panning an error is thrown to the console and datapoints are missing.

To Reproduce Steps to reproduce the behavior:

  1. Go to testing ground and add a line chart with a query for a string property
            <iot-line-chart
              widgetId="line-chart"
              viewport={{ duration: '10m' }}
              queries={[
                this.query.timeSeriesData({
                  assets: [
                    {
                      assetId: DEMO_ASSET,
                      properties: [
                        {
                          propertyId: DEMO_STRING_PROPERTY,
                        },
                      ],
                    },
                    {
                      assetId: DEMO_ASSET,
                      properties: [
                        {
                          propertyId: DEMO_PROPERTY,
                        },
                      ],
                    },
                    {
                      assetId: DEMO_ASSET2,
                      properties: [
                        {
                          propertyId: DEMO_PROPERTY,
                        },
                      ],
                    },
                    {
                      assetId: DEMO_ASSET3,
                      properties: [
                        {
                          propertyId: DEMO_PROPERTY,
                        },
                      ],
                    },
                    {
                      assetId: DEMO_ASSET4,
                      properties: [
                        {
                          propertyId: DEMO_PROPERTY,
                        },
                      ],
                    },
                  ],
                }),
              ]}
            />
  1. Zoom in on the line chart
  2. Errors are thrown as shown in the recording and screenshots

Expected behavior String data is should not be aggregated and always be raw.

Screenshots

https://user-images.githubusercontent.com/6397726/193126694-e36e5038-5b48-4374-bd87-77d6ef53d2b6.mov

Screen Shot 2022-09-29 at 12 38 00 PM

NorbertNader avatar Sep 29 '22 19:09 NorbertNader

String data can be aggregated (as COUNT) but we don't currently have great support for string data in time-series charts. This is because [1] in most cases it doesn't make sense to display the string data (e.g. as a series on a line chart) and [2] we don't currently have support for specifying different aggregation types in source-iotsitewise.

I think displaying an error for an unsupported use-case makes sense, although I do agree that there could be a better user experience when specifying asset properties that have data types that aren't supported by certain charts. Short term, this could take the form of better documentation and more descriptive error messages. Long term, we could add some form of asset type discovery and adjust behaviour accordingly (e.g. automatically select COUNT aggregation for string asset properties).

boweihan avatar Oct 06 '22 18:10 boweihan