@dhis2/analytics 26.2.0-alpha.2 → 26.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/cjs/__demo__/PivotTable.stories.js +69 -29
  2. package/build/cjs/api/analytics/Analytics.js +0 -7
  3. package/build/cjs/api/analytics/AnalyticsBase.js +6 -24
  4. package/build/cjs/api/analytics/AnalyticsRequest.js +10 -33
  5. package/build/cjs/api/analytics/AnalyticsRequestBase.js +1 -3
  6. package/build/cjs/api/analytics/AnalyticsRequestPropertiesMixin.js +0 -19
  7. package/build/cjs/api/analytics/utils.js +2 -23
  8. package/build/cjs/components/Options/VisualizationOptions.js +1 -1
  9. package/build/cjs/components/Options/styles/VisualizationOptions.style.js +8 -1
  10. package/build/cjs/modules/layout/dimension.js +2 -9
  11. package/build/cjs/modules/layout/dimensionCreate.js +0 -3
  12. package/build/cjs/modules/pivotTable/PivotTableEngine.js +119 -57
  13. package/build/es/__demo__/PivotTable.stories.js +69 -29
  14. package/build/es/api/analytics/Analytics.js +0 -7
  15. package/build/es/api/analytics/AnalyticsBase.js +6 -24
  16. package/build/es/api/analytics/AnalyticsRequest.js +10 -33
  17. package/build/es/api/analytics/AnalyticsRequestBase.js +1 -3
  18. package/build/es/api/analytics/AnalyticsRequestPropertiesMixin.js +0 -19
  19. package/build/es/api/analytics/utils.js +1 -20
  20. package/build/es/components/Options/VisualizationOptions.js +2 -2
  21. package/build/es/components/Options/styles/VisualizationOptions.style.js +6 -0
  22. package/build/es/modules/layout/dimension.js +1 -7
  23. package/build/es/modules/layout/dimensionCreate.js +1 -4
  24. package/build/es/modules/pivotTable/PivotTableEngine.js +119 -57
  25. package/package.json +1 -1
  26. package/build/cjs/api/analytics/AnalyticsTrackedEntities.js +0 -31
  27. package/build/es/api/analytics/AnalyticsTrackedEntities.js +0 -24
@@ -27,7 +27,8 @@ const defaultOptions = {
27
27
  showRowSubtotals: false,
28
28
  showColumnSubtotals: false,
29
29
  fixColumnHeaders: false,
30
- fixRowHeaders: false
30
+ fixRowHeaders: false,
31
+ cumulativeValues: false
31
32
  };
32
33
  const defaultVisualizationProps = {
33
34
  fontSize: _pivotTableConstants.FONT_SIZE_OPTION_NORMAL,
@@ -182,6 +183,9 @@ class PivotTableEngine {
182
183
  _defineProperty(this, "data", []);
183
184
  _defineProperty(this, "rowMap", []);
184
185
  _defineProperty(this, "columnMap", []);
186
+ _defineProperty(this, "accumulators", {
187
+ rows: {}
188
+ });
185
189
  this.visualization = Object.assign({}, defaultVisualizationProps, visualization);
186
190
  this.legendSets = (legendSets || []).reduce((sets, set) => {
187
191
  sets[set.id] = set;
@@ -201,7 +205,8 @@ class PivotTableEngine {
201
205
  subtitle: visualization.hideSubtitle ? undefined : visualization.subtitle,
202
206
  // turn on fixed headers only when there are dimensions
203
207
  fixColumnHeaders: this.dimensionLookup.columns.length ? visualization.fixColumnHeaders : false,
204
- fixRowHeaders: this.dimensionLookup.rows.length ? visualization.fixRowHeaders : false
208
+ fixRowHeaders: this.dimensionLookup.rows.length ? visualization.fixRowHeaders : false,
209
+ cumulativeValues: visualization.cumulativeValues
205
210
  };
206
211
  this.adaptiveClippingController = new _AdaptiveClippingController.AdaptiveClippingController(this);
207
212
  const doColumnSubtotals = this.options.showColumnSubtotals && this.dimensionLookup.rows.length > 1;
@@ -225,51 +230,68 @@ class PivotTableEngine {
225
230
  row,
226
231
  column
227
232
  });
233
+ const valueType = (dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || _valueTypes.VALUE_TYPE_TEXT;
228
234
  const headers = [...this.getRawRowHeader(row), ...this.getRawColumnHeader(column)];
229
235
  const peId = (_headers$find = headers.find(header => (header === null || header === void 0 ? void 0 : header.dimensionItemType) === _dataTypes.DIMENSION_TYPE_PERIOD)) === null || _headers$find === void 0 ? void 0 : _headers$find.uid;
230
236
  const ouId = (_headers$find2 = headers.find(header => (header === null || header === void 0 ? void 0 : header.dimensionItemType) === _dataTypes.DIMENSION_TYPE_ORGANISATION_UNIT)) === null || _headers$find2 === void 0 ? void 0 : _headers$find2.uid;
231
- if (!this.data[row] || !this.data[row][column]) {
232
- return {
233
- cellType,
234
- empty: true,
235
- ouId,
236
- peId
237
- };
238
- }
239
- const dataRow = this.data[row][column];
240
- let rawValue = cellType === _pivotTableConstants.CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
241
- let renderedValue = rawValue;
242
- const valueType = (dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || _valueTypes.VALUE_TYPE_TEXT;
243
- if (valueType === _valueTypes.VALUE_TYPE_NUMBER) {
244
- rawValue = (0, _parseValue.parseValue)(rawValue);
245
- switch (this.visualization.numberType) {
246
- case _pivotTableConstants.NUMBER_TYPE_ROW_PERCENTAGE:
247
- renderedValue = rawValue / this.percentageTotals[row].value;
248
- break;
249
- case _pivotTableConstants.NUMBER_TYPE_COLUMN_PERCENTAGE:
250
- renderedValue = rawValue / this.percentageTotals[column].value;
251
- break;
252
- default:
253
- break;
254
- }
255
- }
256
- renderedValue = (0, _renderValue.renderValue)(renderedValue, valueType, this.visualization);
257
- return {
237
+ const rawCell = {
258
238
  cellType,
259
- empty: false,
260
239
  valueType,
261
- rawValue,
262
- renderedValue,
263
- dxDimension,
264
240
  ouId,
265
241
  peId
266
242
  };
243
+ if (!this.data[row] || !this.data[row][column]) {
244
+ rawCell.empty = true;
245
+ } else {
246
+ const dataRow = this.data[row][column];
247
+ let rawValue = cellType === _pivotTableConstants.CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
248
+ let renderedValue = rawValue;
249
+ if (valueType === _valueTypes.VALUE_TYPE_NUMBER) {
250
+ rawValue = (0, _parseValue.parseValue)(rawValue);
251
+ switch (this.visualization.numberType) {
252
+ case _pivotTableConstants.NUMBER_TYPE_ROW_PERCENTAGE:
253
+ renderedValue = rawValue / this.percentageTotals[row].value;
254
+ break;
255
+ case _pivotTableConstants.NUMBER_TYPE_COLUMN_PERCENTAGE:
256
+ renderedValue = rawValue / this.percentageTotals[column].value;
257
+ break;
258
+ default:
259
+ break;
260
+ }
261
+ }
262
+ renderedValue = (0, _renderValue.renderValue)(renderedValue, valueType, this.visualization);
263
+ rawCell.dxDimension = dxDimension;
264
+ rawCell.empty = false;
265
+ rawCell.rawValue = rawValue;
266
+ rawCell.renderedValue = renderedValue;
267
+ }
268
+ if (this.options.cumulativeValues) {
269
+ const cumulativeValue = this.getCumulative({
270
+ row,
271
+ column
272
+ });
273
+ if (cumulativeValue !== undefined && cumulativeValue !== null) {
274
+ // force to NUMBER for accumulated values
275
+ rawCell.valueType = valueType === undefined || valueType === null ? _valueTypes.VALUE_TYPE_NUMBER : valueType;
276
+ rawCell.empty = false;
277
+ rawCell.rawValue = cumulativeValue;
278
+ rawCell.renderedValue = (0, _renderValue.renderValue)(cumulativeValue, valueType, this.visualization);
279
+ }
280
+ }
281
+ return rawCell;
267
282
  }
268
- get(_ref4) {
283
+ getCumulative(_ref4) {
269
284
  let {
270
285
  row,
271
286
  column
272
287
  } = _ref4;
288
+ return this.accumulators.rows[row][column];
289
+ }
290
+ get(_ref5) {
291
+ let {
292
+ row,
293
+ column
294
+ } = _ref5;
273
295
  const mappedRow = this.rowMap[row],
274
296
  mappedColumn = this.columnMap[column];
275
297
  if (!mappedRow && mappedRow !== 0 || !mappedColumn && mappedColumn !== 0) {
@@ -280,11 +302,11 @@ class PivotTableEngine {
280
302
  column: mappedColumn
281
303
  });
282
304
  }
283
- getRawCellType(_ref5) {
305
+ getRawCellType(_ref6) {
284
306
  let {
285
307
  row,
286
308
  column
287
- } = _ref5;
309
+ } = _ref6;
288
310
  const isRowTotal = this.doRowTotals && column === this.dataWidth - 1;
289
311
  const isColumnTotal = this.doColumnTotals && row === this.dataHeight - 1;
290
312
  if (isRowTotal || isColumnTotal) {
@@ -297,11 +319,11 @@ class PivotTableEngine {
297
319
  }
298
320
  return _pivotTableConstants.CELL_TYPE_VALUE;
299
321
  }
300
- getCellType(_ref6) {
322
+ getCellType(_ref7) {
301
323
  let {
302
324
  row,
303
325
  column
304
- } = _ref6;
326
+ } = _ref7;
305
327
  row = this.rowMap[row];
306
328
  column = this.columnMap[column];
307
329
  return this.getRawCellType({
@@ -331,29 +353,26 @@ class PivotTableEngine {
331
353
  return _d2I18n.default.t(this.dimensionLookup.rows[rowLevel].meta.name);
332
354
  }
333
355
  }
334
- getCellDxDimension(_ref7) {
356
+ getCellDxDimension(_ref8) {
335
357
  let {
336
358
  row,
337
359
  column
338
- } = _ref7;
360
+ } = _ref8;
339
361
  return this.getRawCellDxDimension({
340
362
  row: this.rowMap[row],
341
363
  column: this.columnMap[column]
342
364
  });
343
365
  }
344
- getRawCellDxDimension(_ref8) {
366
+ getRawCellDxDimension(_ref9) {
345
367
  let {
346
368
  row,
347
369
  column
348
- } = _ref8;
370
+ } = _ref9;
349
371
  if (!this.data[row]) {
350
372
  return undefined;
351
373
  }
352
374
  const cellValue = this.data[row][column];
353
- if (!cellValue) {
354
- return undefined;
355
- }
356
- if (!Array.isArray(cellValue)) {
375
+ if (cellValue && !Array.isArray(cellValue)) {
357
376
  // This is a total cell
358
377
  return {
359
378
  valueType: cellValue.valueType,
@@ -380,6 +399,11 @@ class PivotTableEngine {
380
399
  };
381
400
  }
382
401
 
402
+ // Empty cell
403
+ // The cell still needs to get the valueType to render correctly 0 and cumulative values
404
+ //
405
+ // OR
406
+ //
383
407
  // Data is in Filter
384
408
  // TODO : This assumes the server ignores text types, we should confirm this is the case
385
409
  return {
@@ -391,7 +415,7 @@ class PivotTableEngine {
391
415
  return !this.data[row] || this.data[row].length === 0;
392
416
  }
393
417
  columnIsEmpty(column) {
394
- return !this.adaptiveClippingController.columns.sizes[column];
418
+ return !this.rowMap.some(row => this.data[row][column]);
395
419
  }
396
420
  getRawColumnHeader(column) {
397
421
  if (this.doRowTotals && column === this.dataWidth - 1) {
@@ -437,12 +461,12 @@ class PivotTableEngine {
437
461
  getRowHeader(row) {
438
462
  return this.getRawRowHeader(this.rowMap[row]);
439
463
  }
440
- getDependantTotalCells(_ref9) {
464
+ getDependantTotalCells(_ref10) {
441
465
  var _this$dimensionLookup, _this$dimensionLookup2;
442
466
  let {
443
467
  row,
444
468
  column
445
- } = _ref9;
469
+ } = _ref10;
446
470
  const rowSubtotalSize = ((_this$dimensionLookup = this.dimensionLookup.columns[0]) === null || _this$dimensionLookup === void 0 ? void 0 : _this$dimensionLookup.size) + 1;
447
471
  const rowSubtotal = rowSubtotalSize && this.doRowSubtotals && {
448
472
  row,
@@ -617,11 +641,11 @@ class PivotTableEngine {
617
641
  }
618
642
  }
619
643
  }
620
- finalizeTotal(_ref10) {
644
+ finalizeTotal(_ref11) {
621
645
  let {
622
646
  row,
623
647
  column
624
- } = _ref10;
648
+ } = _ref11;
625
649
  if (!this.data[row]) {
626
650
  return;
627
651
  }
@@ -717,6 +741,40 @@ class PivotTableEngine {
717
741
  resetColumnMap() {
718
742
  this.columnMap = this.options.hideEmptyColumns ? (0, _times.default)(this.dataWidth, n => n).filter(idx => !this.columnIsEmpty(idx)) : (0, _times.default)(this.dataWidth, n => n);
719
743
  }
744
+ resetAccumulators() {
745
+ if (this.options.cumulativeValues) {
746
+ this.rowMap.forEach(row => {
747
+ this.accumulators.rows[row] = {};
748
+ this.columnMap.reduce((acc, column) => {
749
+ const cellType = this.getRawCellType({
750
+ row,
751
+ column
752
+ });
753
+ const dxDimension = this.getRawCellDxDimension({
754
+ row,
755
+ column
756
+ });
757
+ const valueType = (dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || _valueTypes.VALUE_TYPE_TEXT;
758
+
759
+ // only accumulate numeric values
760
+ // accumulating text values does not make sense
761
+ if (valueType === _valueTypes.VALUE_TYPE_NUMBER) {
762
+ if (this.data[row] && this.data[row][column]) {
763
+ const dataRow = this.data[row][column];
764
+ const rawValue = cellType === _pivotTableConstants.CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
765
+ acc += (0, _parseValue.parseValue)(rawValue);
766
+ }
767
+ this.accumulators.rows[row][column] = acc;
768
+ }
769
+ return acc;
770
+ }, 0);
771
+ });
772
+ } else {
773
+ this.accumulators = {
774
+ rows: {}
775
+ };
776
+ }
777
+ }
720
778
  get cellPadding() {
721
779
  switch (this.visualization.displayDensity) {
722
780
  case _pivotTableConstants.DISPLAY_DENSITY_OPTION_COMPACT:
@@ -787,14 +845,18 @@ class PivotTableEngine {
787
845
  }
788
846
  });
789
847
  this.finalizeTotals();
790
- this.rawData.rows.forEach(dataRow => {
791
- const pos = lookup(dataRow, this.dimensionLookup, this);
792
- if (pos) {
793
- this.adaptiveClippingController.add(pos, this.getRaw(pos).renderedValue);
794
- }
795
- });
796
848
  this.resetRowMap();
797
849
  this.resetColumnMap();
850
+ this.resetAccumulators();
851
+ this.rowMap.forEach(row => {
852
+ this.columnMap.forEach(column => {
853
+ const pos = {
854
+ row,
855
+ column
856
+ };
857
+ this.adaptiveClippingController.add(pos, this.getRaw(pos).renderedValue);
858
+ });
859
+ });
798
860
  this.height = this.rowMap.length;
799
861
  this.width = this.columnMap.length;
800
862
  this.adaptiveClippingController.finalize();
@@ -825,14 +825,15 @@ storiesOf('PivotTable', module).add('empty columns (weekly) - shown', (_, _ref35
825
825
  visualization: visualization
826
826
  }));
827
827
  });
828
- storiesOf('PivotTable', module).add('empty columns (weekly) - hidden', (_, _ref36) => {
828
+ storiesOf('PivotTable', module).add('cumulative + empty columns (weekly) - shown', (_, _ref36) => {
829
829
  let {
830
830
  pivotTableOptions
831
831
  } = _ref36;
832
832
  const visualization = {
833
833
  ...weeklyColumnsVisualization,
834
834
  ...pivotTableOptions,
835
- hideEmptyColumns: true
835
+ hideEmptyColumns: false,
836
+ cumulativeValues: true
836
837
  };
837
838
  return /*#__PURE__*/React.createElement("div", {
838
839
  style: {
@@ -844,10 +845,49 @@ storiesOf('PivotTable', module).add('empty columns (weekly) - hidden', (_, _ref3
844
845
  visualization: visualization
845
846
  }));
846
847
  });
847
- storiesOf('PivotTable', module).add('empty columns + assigned cats (shown)', (_, _ref37) => {
848
+ storiesOf('PivotTable', module).add('empty columns (weekly) - hidden', (_, _ref37) => {
848
849
  let {
849
850
  pivotTableOptions
850
851
  } = _ref37;
852
+ const visualization = {
853
+ ...weeklyColumnsVisualization,
854
+ ...pivotTableOptions,
855
+ hideEmptyColumns: true
856
+ };
857
+ return /*#__PURE__*/React.createElement("div", {
858
+ style: {
859
+ width: 800,
860
+ height: 600
861
+ }
862
+ }, /*#__PURE__*/React.createElement(PivotTable, {
863
+ data: weeklyColumnsData,
864
+ visualization: visualization
865
+ }));
866
+ });
867
+ storiesOf('PivotTable', module).add('cumulative + empty columns (weekly) - hidden', (_, _ref38) => {
868
+ let {
869
+ pivotTableOptions
870
+ } = _ref38;
871
+ const visualization = {
872
+ ...weeklyColumnsVisualization,
873
+ ...pivotTableOptions,
874
+ hideEmptyColumns: true,
875
+ cumulativeValues: true
876
+ };
877
+ return /*#__PURE__*/React.createElement("div", {
878
+ style: {
879
+ width: 800,
880
+ height: 600
881
+ }
882
+ }, /*#__PURE__*/React.createElement(PivotTable, {
883
+ data: weeklyColumnsData,
884
+ visualization: visualization
885
+ }));
886
+ });
887
+ storiesOf('PivotTable', module).add('empty columns + assigned cats (shown)', (_, _ref39) => {
888
+ let {
889
+ pivotTableOptions
890
+ } = _ref39;
851
891
  const visualization = {
852
892
  ...emptyColumnsVisualization,
853
893
  ...visualizationReset,
@@ -864,10 +904,10 @@ storiesOf('PivotTable', module).add('empty columns + assigned cats (shown)', (_,
864
904
  visualization: visualization
865
905
  }));
866
906
  });
867
- storiesOf('PivotTable', module).add('empty columns + assigned cats (hidden)', (_, _ref38) => {
907
+ storiesOf('PivotTable', module).add('empty columns + assigned cats (hidden)', (_, _ref40) => {
868
908
  let {
869
909
  pivotTableOptions
870
- } = _ref38;
910
+ } = _ref40;
871
911
  const visualization = {
872
912
  ...emptyColumnsVisualization,
873
913
  ...visualizationReset,
@@ -884,10 +924,10 @@ storiesOf('PivotTable', module).add('empty columns + assigned cats (hidden)', (_
884
924
  visualization: visualization
885
925
  }));
886
926
  });
887
- storiesOf('PivotTable', module).add('legend - fixed (light fill)', (_, _ref39) => {
927
+ storiesOf('PivotTable', module).add('legend - fixed (light fill)', (_, _ref41) => {
888
928
  let {
889
929
  pivotTableOptions
890
- } = _ref39;
930
+ } = _ref41;
891
931
  const visualization = {
892
932
  ...targetVisualization,
893
933
  ...visualizationReset,
@@ -912,10 +952,10 @@ storiesOf('PivotTable', module).add('legend - fixed (light fill)', (_, _ref39) =
912
952
  legendSets: [underAbove100LegendSet]
913
953
  }));
914
954
  });
915
- storiesOf('PivotTable', module).add('legend - fixed (dark fill)', (_, _ref40) => {
955
+ storiesOf('PivotTable', module).add('legend - fixed (dark fill)', (_, _ref42) => {
916
956
  let {
917
957
  pivotTableOptions
918
- } = _ref40;
958
+ } = _ref42;
919
959
  const visualization = {
920
960
  ...targetVisualization,
921
961
  ...visualizationReset,
@@ -941,10 +981,10 @@ storiesOf('PivotTable', module).add('legend - fixed (dark fill)', (_, _ref40) =>
941
981
  legendSets: [legendSet]
942
982
  }));
943
983
  });
944
- storiesOf('PivotTable', module).add('legend - fixed (text)', (_, _ref41) => {
984
+ storiesOf('PivotTable', module).add('legend - fixed (text)', (_, _ref43) => {
945
985
  let {
946
986
  pivotTableOptions
947
- } = _ref41;
987
+ } = _ref43;
948
988
  const visualization = {
949
989
  ...targetVisualization,
950
990
  ...visualizationReset,
@@ -965,10 +1005,10 @@ storiesOf('PivotTable', module).add('legend - fixed (text)', (_, _ref41) => {
965
1005
  legendSets: [underAbove100LegendSet]
966
1006
  }));
967
1007
  });
968
- storiesOf('PivotTable', module).add('legend - fixed (% row)', (_, _ref42) => {
1008
+ storiesOf('PivotTable', module).add('legend - fixed (% row)', (_, _ref44) => {
969
1009
  let {
970
1010
  pivotTableOptions
971
- } = _ref42;
1011
+ } = _ref44;
972
1012
  const visualization = {
973
1013
  ...targetVisualization,
974
1014
  ...visualizationReset,
@@ -992,10 +1032,10 @@ storiesOf('PivotTable', module).add('legend - fixed (% row)', (_, _ref42) => {
992
1032
  legendSets: [underAbove100LegendSet]
993
1033
  }));
994
1034
  });
995
- storiesOf('PivotTable', module).add('legend - by data item', (_, _ref43) => {
1035
+ storiesOf('PivotTable', module).add('legend - by data item', (_, _ref45) => {
996
1036
  let {
997
1037
  pivotTableOptions
998
- } = _ref43;
1038
+ } = _ref45;
999
1039
  const visualization = {
1000
1040
  ...targetVisualization,
1001
1041
  ...visualizationReset,
@@ -1023,10 +1063,10 @@ storiesOf('PivotTable', module).add('legend - by data item', (_, _ref43) => {
1023
1063
  legendSets: [underAbove100LegendSet, customLegendSet]
1024
1064
  }));
1025
1065
  });
1026
- storiesOf('PivotTable', module).add('hierarchy - none', (_, _ref44) => {
1066
+ storiesOf('PivotTable', module).add('hierarchy - none', (_, _ref46) => {
1027
1067
  let {
1028
1068
  pivotTableOptions
1029
- } = _ref44;
1069
+ } = _ref46;
1030
1070
  const visualization = {
1031
1071
  ...hierarchyVisualization,
1032
1072
  ...visualizationReset,
@@ -1047,10 +1087,10 @@ storiesOf('PivotTable', module).add('hierarchy - none', (_, _ref44) => {
1047
1087
  visualization: visualization
1048
1088
  }));
1049
1089
  });
1050
- storiesOf('PivotTable', module).add('hierarchy - rows', (_, _ref45) => {
1090
+ storiesOf('PivotTable', module).add('hierarchy - rows', (_, _ref47) => {
1051
1091
  let {
1052
1092
  pivotTableOptions
1053
- } = _ref45;
1093
+ } = _ref47;
1054
1094
  const visualization = {
1055
1095
  ...hierarchyVisualization,
1056
1096
  ...visualizationReset,
@@ -1070,10 +1110,10 @@ storiesOf('PivotTable', module).add('hierarchy - rows', (_, _ref45) => {
1070
1110
  visualization: visualization
1071
1111
  }));
1072
1112
  });
1073
- storiesOf('PivotTable', module).add('hierarchy - columns', (_, _ref46) => {
1113
+ storiesOf('PivotTable', module).add('hierarchy - columns', (_, _ref48) => {
1074
1114
  let {
1075
1115
  pivotTableOptions
1076
- } = _ref46;
1116
+ } = _ref48;
1077
1117
  const visualization = {
1078
1118
  ...hierarchyVisualization,
1079
1119
  ...visualizationReset,
@@ -1095,10 +1135,10 @@ storiesOf('PivotTable', module).add('hierarchy - columns', (_, _ref46) => {
1095
1135
  visualization: visualization
1096
1136
  }));
1097
1137
  });
1098
- storiesOf('PivotTable', module).add('narrative', (_, _ref47) => {
1138
+ storiesOf('PivotTable', module).add('narrative', (_, _ref49) => {
1099
1139
  let {
1100
1140
  pivotTableOptions
1101
- } = _ref47;
1141
+ } = _ref49;
1102
1142
  const visualization = {
1103
1143
  ...narrativeVisualization,
1104
1144
  ...visualizationReset,
@@ -1116,10 +1156,10 @@ storiesOf('PivotTable', module).add('narrative', (_, _ref47) => {
1116
1156
  visualization: visualization
1117
1157
  }));
1118
1158
  });
1119
- storiesOf('PivotTable', module).add('narrative - data as filter', (_, _ref48) => {
1159
+ storiesOf('PivotTable', module).add('narrative - data as filter', (_, _ref50) => {
1120
1160
  let {
1121
1161
  pivotTableOptions
1122
- } = _ref48;
1162
+ } = _ref50;
1123
1163
  const visualization = {
1124
1164
  ...narrativeVisualization,
1125
1165
  ...visualizationReset,
@@ -1143,10 +1183,10 @@ storiesOf('PivotTable', module).add('narrative - data as filter', (_, _ref48) =>
1143
1183
  visualization: visualization
1144
1184
  }));
1145
1185
  });
1146
- storiesOf('PivotTable', module).add('DEGS', (_, _ref49) => {
1186
+ storiesOf('PivotTable', module).add('DEGS', (_, _ref51) => {
1147
1187
  let {
1148
1188
  pivotTableOptions
1149
- } = _ref49;
1189
+ } = _ref51;
1150
1190
  const visualization = {
1151
1191
  ...degsVisualization,
1152
1192
  ...visualizationReset,
@@ -1162,10 +1202,10 @@ storiesOf('PivotTable', module).add('DEGS', (_, _ref49) => {
1162
1202
  visualization: visualization
1163
1203
  }));
1164
1204
  });
1165
- storiesOf('PivotTable', module).add('Truncated header cell', (_, _ref50) => {
1205
+ storiesOf('PivotTable', module).add('Truncated header cell', (_, _ref52) => {
1166
1206
  let {
1167
1207
  pivotTableOptions
1168
- } = _ref50;
1208
+ } = _ref52;
1169
1209
  const widths = [250, 200, 500];
1170
1210
  const [width, setWidth] = useState(250);
1171
1211
  const toggleWidth = () => setWidth(currentWidth => {
@@ -6,15 +6,12 @@ import AnalyticsEnrollments from './AnalyticsEnrollments.js';
6
6
  import AnalyticsEvents from './AnalyticsEvents.js';
7
7
  import AnalyticsRequest from './AnalyticsRequest.js';
8
8
  import AnalyticsResponse from './AnalyticsResponse.js';
9
- import AnalyticsTrackedEntities from './AnalyticsTrackedEntities.js';
10
9
 
11
10
  /**
12
11
  * @description
13
12
  * Analytics class used to request analytics data from Web API.
14
13
  *
15
14
  * @requires analytics.AnalyticsAggregate
16
- * @requires analytics.AnalyticsTrackedEntities
17
- * @requires analytics.AnalyticsEnrollments
18
15
  * @requires analytics.AnalyticsEvents
19
16
  * @requires analytics.AnalyticsRequest
20
17
  * @requires analytics.AnalyticsResponse
@@ -34,7 +31,6 @@ import AnalyticsTrackedEntities from './AnalyticsTrackedEntities.js';
34
31
  class Analytics {
35
32
  /**
36
33
  * @param {!module:analytics.AnalyticsAggregate} analyticsAggregate The AnalyticsAggregate instance
37
- * @param {!module:analytics.AnalyticsTrackedEntities} analyticsTrackedEntities The AnalyticsTrackedEntities instance
38
34
  * @param {!module:analytics.AnalyticsEnrollments} analyticsEnrollments The AnalyticsEnrollments instance
39
35
  * @param {!module:analytics.AnalyticsEvents} analyticsEvents The AnalyticsEvents instance
40
36
  * @param {!module:analytics.AnalyticsRequest} analyticsRequest The AnalyticsRequest class
@@ -43,14 +39,12 @@ class Analytics {
43
39
  constructor(_ref) {
44
40
  let {
45
41
  aggregate,
46
- trackedEntities,
47
42
  enrollments,
48
43
  events,
49
44
  request,
50
45
  response
51
46
  } = _ref;
52
47
  this.aggregate = aggregate;
53
- this.trackedEntities = trackedEntities;
54
48
  this.enrollments = enrollments;
55
49
  this.events = events;
56
50
  this.request = request;
@@ -73,7 +67,6 @@ class Analytics {
73
67
  if (!Analytics.getAnalytics.analytics) {
74
68
  Analytics.getAnalytics.analytics = new Analytics({
75
69
  aggregate: new AnalyticsAggregate(dataEngine),
76
- trackedEntities: new AnalyticsTrackedEntities(dataEngine),
77
70
  enrollments: new AnalyticsEnrollments(dataEngine),
78
71
  events: new AnalyticsEvents(dataEngine),
79
72
  request: AnalyticsRequest,
@@ -1,19 +1,13 @@
1
1
  import sortBy from 'lodash/sortBy';
2
2
  import AnalyticsRequest from './AnalyticsRequest.js';
3
- import { formatRequestPath } from './utils.js';
4
3
  const analyticsQuery = {
5
4
  resource: 'analytics',
6
5
  id: _ref => {
7
6
  let {
8
7
  path,
9
- program,
10
- trackedEntityType
8
+ program
11
9
  } = _ref;
12
- return formatRequestPath({
13
- path,
14
- program,
15
- trackedEntityType
16
- });
10
+ return [path, program].filter(Boolean).join('/');
17
11
  },
18
12
  params: _ref2 => {
19
13
  let {
@@ -33,14 +27,9 @@ const analyticsDataQuery = {
33
27
  id: _ref3 => {
34
28
  let {
35
29
  path,
36
- program,
37
- trackedEntityType
30
+ program
38
31
  } = _ref3;
39
- return formatRequestPath({
40
- path,
41
- program,
42
- trackedEntityType
43
- });
32
+ return [path, program].filter(Boolean).join('/');
44
33
  },
45
34
  params: _ref4 => {
46
35
  let {
@@ -62,14 +51,9 @@ const analyticsMetaDataQuery = {
62
51
  id: _ref5 => {
63
52
  let {
64
53
  path,
65
- program,
66
- trackedEntityType
54
+ program
67
55
  } = _ref5;
68
- return formatRequestPath({
69
- path,
70
- program,
71
- trackedEntityType
72
- });
56
+ return [path, program].filter(Boolean).join('/');
73
57
  },
74
58
  params: _ref6 => {
75
59
  let {
@@ -161,7 +145,6 @@ class AnalyticsBase {
161
145
  variables: {
162
146
  path: req.path,
163
147
  program: req.program,
164
- trackedEntityType: req.trackedEntityType,
165
148
  dimensions: generateDimensionStrings(req.dimensions),
166
149
  filters: generateDimensionStrings(req.filters),
167
150
  parameters: req.parameters,
@@ -204,7 +187,6 @@ class AnalyticsBase {
204
187
  variables: {
205
188
  path: req.path,
206
189
  program: req.program,
207
- trackedEntityType: req.trackedEntityType,
208
190
  dimensions: generateDimensionStrings(req.dimensions, options),
209
191
  filters: generateDimensionStrings(req.filters, options),
210
192
  parameters: req.parameters