@dhis2/analytics 24.10.1 → 25.1.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.
- package/CHANGELOG.md +19 -0
- package/build/cjs/__demo__/CalculationModal.stories.js +448 -0
- package/build/cjs/api/analytics/AnalyticsRequest.js +12 -1
- package/build/cjs/api/dimensions.js +1 -1
- package/build/cjs/api/expression.js +67 -0
- package/build/cjs/assets/DimensionItemIcons/CalculationIcon.js +25 -0
- package/build/cjs/assets/FormulaIcon.js +40 -0
- package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +448 -0
- package/build/cjs/components/DataDimension/Calculation/DataElementOption.js +78 -0
- package/build/cjs/components/DataDimension/Calculation/DataElementSelector.js +309 -0
- package/build/cjs/components/DataDimension/Calculation/DndContext.js +213 -0
- package/build/cjs/components/DataDimension/Calculation/DragHandleIcon.js +23 -0
- package/build/cjs/components/DataDimension/Calculation/DraggingItem.js +58 -0
- package/build/cjs/components/DataDimension/Calculation/DropZone.js +58 -0
- package/build/cjs/components/DataDimension/Calculation/FormulaField.js +121 -0
- package/build/cjs/components/DataDimension/Calculation/FormulaItem.js +232 -0
- package/build/cjs/components/DataDimension/Calculation/MathOperatorSelector.js +58 -0
- package/build/cjs/components/DataDimension/Calculation/Operator.js +81 -0
- package/build/cjs/components/DataDimension/Calculation/styles/CalculationModal.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/DataElementOption.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/DataElementSelector.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/DraggingItem.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/DropZone.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/FormulaField.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/FormulaItem.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/MathOperatorSelector.style.js +13 -0
- package/build/cjs/components/DataDimension/Calculation/styles/Operator.style.js +13 -0
- package/build/cjs/components/DataDimension/DataDimension.js +22 -6
- package/build/cjs/components/DataDimension/DataTypeSelector.js +5 -3
- package/build/cjs/components/DataDimension/ItemSelector.js +111 -73
- package/build/cjs/components/LegendKey/LegendKey.js +1 -1
- package/build/cjs/components/TransferOption.js +13 -4
- package/build/cjs/components/styles/DimensionSelector.style.js +2 -2
- package/build/cjs/components/styles/TransferOption.style.js +2 -2
- package/build/cjs/index.js +6 -0
- package/build/cjs/locales/en/translations.json +32 -7
- package/build/cjs/modules/__tests__/expressions.spec.js +139 -0
- package/build/cjs/modules/__tests__/hash.spec.js +92 -0
- package/build/cjs/modules/__tests__/parseExpression.spec.js +46 -0
- package/build/cjs/modules/dataTypes.js +8 -1
- package/build/cjs/modules/dimensionListItem.js +82 -0
- package/build/cjs/modules/expressions.js +164 -0
- package/build/cjs/modules/hash.js +28 -0
- package/build/cjs/visualizations/config/generators/dhis/singleValue.js +112 -58
- package/build/es/__demo__/CalculationModal.stories.js +440 -0
- package/build/es/api/analytics/AnalyticsRequest.js +11 -1
- package/build/es/api/dimensions.js +1 -1
- package/build/es/api/expression.js +57 -0
- package/build/es/assets/DimensionItemIcons/CalculationIcon.js +13 -0
- package/build/es/assets/FormulaIcon.js +30 -0
- package/build/es/components/DataDimension/Calculation/CalculationModal.js +419 -0
- package/build/es/components/DataDimension/Calculation/DataElementOption.js +61 -0
- package/build/es/components/DataDimension/Calculation/DataElementSelector.js +283 -0
- package/build/es/components/DataDimension/Calculation/DndContext.js +194 -0
- package/build/es/components/DataDimension/Calculation/DragHandleIcon.js +11 -0
- package/build/es/components/DataDimension/Calculation/DraggingItem.js +40 -0
- package/build/es/components/DataDimension/Calculation/DropZone.js +43 -0
- package/build/es/components/DataDimension/Calculation/FormulaField.js +98 -0
- package/build/es/components/DataDimension/Calculation/FormulaItem.js +207 -0
- package/build/es/components/DataDimension/Calculation/MathOperatorSelector.js +42 -0
- package/build/es/components/DataDimension/Calculation/Operator.js +64 -0
- package/build/es/components/DataDimension/Calculation/styles/CalculationModal.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/DataElementOption.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/DataElementSelector.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/DraggingItem.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/DropZone.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/FormulaField.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/FormulaItem.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/MathOperatorSelector.style.js +4 -0
- package/build/es/components/DataDimension/Calculation/styles/Operator.style.js +4 -0
- package/build/es/components/DataDimension/DataDimension.js +21 -6
- package/build/es/components/DataDimension/DataTypeSelector.js +6 -4
- package/build/es/components/DataDimension/ItemSelector.js +111 -73
- package/build/es/components/LegendKey/LegendKey.js +1 -1
- package/build/es/components/TransferOption.js +14 -5
- package/build/es/components/styles/DimensionSelector.style.js +2 -2
- package/build/es/components/styles/TransferOption.style.js +2 -2
- package/build/es/index.js +1 -1
- package/build/es/locales/en/translations.json +32 -7
- package/build/es/modules/__tests__/expressions.spec.js +136 -0
- package/build/es/modules/__tests__/hash.spec.js +88 -0
- package/build/es/modules/__tests__/parseExpression.spec.js +43 -0
- package/build/es/modules/dataTypes.js +6 -0
- package/build/es/modules/dimensionListItem.js +61 -0
- package/build/es/modules/expressions.js +131 -0
- package/build/es/modules/hash.js +12 -0
- package/build/es/visualizations/config/generators/dhis/singleValue.js +112 -58
- package/package.json +6 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { CustomDataProvider } from '@dhis2/app-runtime';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import CalculationModal from '../components/DataDimension/Calculation/CalculationModal.js';
|
|
5
|
+
const DATA_ELEMENTS = {
|
|
6
|
+
pager: {
|
|
7
|
+
page: 1,
|
|
8
|
+
total: 622,
|
|
9
|
+
pageSize: 50,
|
|
10
|
+
nextPage: 'http://localhost:8080/api/39/dataElements?page=2&filter=domainType%3Aeq%3AAGGREGATE&paging=true&fields=dimensionItem%7Erename%28id%29%2CdisplayName%7Erename%28name%29%2CdimensionItemType&order=displayName%3Aasc',
|
|
11
|
+
pageCount: 13
|
|
12
|
+
},
|
|
13
|
+
dataElements: [{
|
|
14
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
15
|
+
id: 'fbfJHSPpUQD',
|
|
16
|
+
name: 'ANC 1st visit'
|
|
17
|
+
}, {
|
|
18
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
19
|
+
id: 'cYeuwXTCPkU',
|
|
20
|
+
name: 'ANC 2nd visit'
|
|
21
|
+
}, {
|
|
22
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
23
|
+
id: 'Jtf34kNZhzP',
|
|
24
|
+
name: 'ANC 3rd visit'
|
|
25
|
+
}, {
|
|
26
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
27
|
+
id: 'hfdmMSPBgLG',
|
|
28
|
+
name: 'ANC 4th or more visits'
|
|
29
|
+
}, {
|
|
30
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
31
|
+
id: 'FHD3wiSM7Sn',
|
|
32
|
+
name: 'ARI treated with antibiotics (pneumonia) follow-up'
|
|
33
|
+
}, {
|
|
34
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
35
|
+
id: 'oLfWYAJhZb2',
|
|
36
|
+
name: 'ARI treated without antibiotics (cough) referrals'
|
|
37
|
+
}, {
|
|
38
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
39
|
+
id: 'GMd99K8gVut',
|
|
40
|
+
name: 'ART No clients who stopped TRT due to TRT failure'
|
|
41
|
+
}, {
|
|
42
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
43
|
+
id: 'wfKKFhBn0Q0',
|
|
44
|
+
name: 'ART No clients who stopped TRT due to adverse clinical status/event'
|
|
45
|
+
}, {
|
|
46
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
47
|
+
id: 'aIJZ2d2QgVV',
|
|
48
|
+
name: 'ART defaulters'
|
|
49
|
+
}, {
|
|
50
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
51
|
+
id: 'BOSZApCrBni',
|
|
52
|
+
name: 'ART enrollment stage 1'
|
|
53
|
+
}, {
|
|
54
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
55
|
+
id: 'dGdeotKpRed',
|
|
56
|
+
name: 'ART enrollment stage 2'
|
|
57
|
+
}, {
|
|
58
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
59
|
+
id: 'LVaUdM3CERi',
|
|
60
|
+
name: 'ART entry point: No old patients'
|
|
61
|
+
}, {
|
|
62
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
63
|
+
id: 'M62VHgYT2n0',
|
|
64
|
+
name: 'Acute Flaccid Paralysis (AFP) referrals'
|
|
65
|
+
}, {
|
|
66
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
67
|
+
id: 'uF1DLnZNlWe',
|
|
68
|
+
name: 'Additional notes related to facility'
|
|
69
|
+
}, {
|
|
70
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
71
|
+
id: 'jmWyJFtE7Af',
|
|
72
|
+
name: 'Anaemia follow-up'
|
|
73
|
+
}, {
|
|
74
|
+
dimensionItemType: 'DATA_ELEMENT',
|
|
75
|
+
id: 'HLPuaFB7Frw',
|
|
76
|
+
name: 'Anaemia new'
|
|
77
|
+
}]
|
|
78
|
+
};
|
|
79
|
+
const DATA_ELEMENT_OPERANDS = {
|
|
80
|
+
pager: {
|
|
81
|
+
page: 1,
|
|
82
|
+
pageCount: 43,
|
|
83
|
+
total: 2122,
|
|
84
|
+
pageSize: 50,
|
|
85
|
+
nextPage: 'https://debug.dhis2.org/dev/api/dataElementOperands.json?page=2'
|
|
86
|
+
},
|
|
87
|
+
dataElementOperands: [{
|
|
88
|
+
dimensionItemType: 'DATA_ELEMENT_OPERAND',
|
|
89
|
+
id: 'fbfJHSPpUQD.pq2XI5kz2BY',
|
|
90
|
+
name: 'ANC 1st visit Fixed'
|
|
91
|
+
}, {
|
|
92
|
+
dimensionItemType: 'DATA_ELEMENT_OPERAND',
|
|
93
|
+
id: 'fbfJHSPpUQD.PT59n8BQbqM',
|
|
94
|
+
name: 'ANC 1st visit Outreach'
|
|
95
|
+
}]
|
|
96
|
+
};
|
|
97
|
+
const DATA_ELEMENT_GROUPS = {
|
|
98
|
+
dataElementGroups: [{
|
|
99
|
+
id: 'qfxEYY9xAl6',
|
|
100
|
+
name: 'ANC'
|
|
101
|
+
}, {
|
|
102
|
+
id: 'yhg8oYU9ekY',
|
|
103
|
+
name: 'ARI Treated Without Antibiotics (Cough)'
|
|
104
|
+
}, {
|
|
105
|
+
id: 'M2cth8EmrlT',
|
|
106
|
+
name: 'ARI treated with antibiotics (Pneumonia)'
|
|
107
|
+
}, {
|
|
108
|
+
id: 'k1M0nuodfhN',
|
|
109
|
+
name: 'ART'
|
|
110
|
+
}, {
|
|
111
|
+
id: 'bdiyMm9qZl5',
|
|
112
|
+
name: 'ART enrollment'
|
|
113
|
+
}, {
|
|
114
|
+
id: 's8FiXqB2DhB',
|
|
115
|
+
name: 'ART entry points'
|
|
116
|
+
}, {
|
|
117
|
+
id: 'TcxHxMlYzpv',
|
|
118
|
+
name: 'ART pediatric 1st line'
|
|
119
|
+
}, {
|
|
120
|
+
id: 'vxIWSNeEcf7',
|
|
121
|
+
name: 'ART staging'
|
|
122
|
+
}, {
|
|
123
|
+
id: 'zz1lNBgRKWU',
|
|
124
|
+
name: 'ART treatment'
|
|
125
|
+
}, {
|
|
126
|
+
id: 'oDkJh5Ddh7d',
|
|
127
|
+
name: 'Acute Flaccid Paralysis (AFP) '
|
|
128
|
+
}, {
|
|
129
|
+
id: 'GBHN1a1Jddh',
|
|
130
|
+
name: 'All Others'
|
|
131
|
+
}, {
|
|
132
|
+
id: 'KmwPVkjp7yl',
|
|
133
|
+
name: 'Anaemia'
|
|
134
|
+
}, {
|
|
135
|
+
id: 'oGktdmYkRNo',
|
|
136
|
+
name: 'Burns'
|
|
137
|
+
}, {
|
|
138
|
+
id: 'KUSvwZQsMSN',
|
|
139
|
+
name: 'Cholera'
|
|
140
|
+
}, {
|
|
141
|
+
id: 'Euvh58hLl61',
|
|
142
|
+
name: 'Clinical Malnutrition'
|
|
143
|
+
}, {
|
|
144
|
+
id: 'Svac1cNQhRS',
|
|
145
|
+
name: 'Commodities'
|
|
146
|
+
}, {
|
|
147
|
+
id: 'KJKWrWBcJdf',
|
|
148
|
+
name: 'Commodities Child Health'
|
|
149
|
+
}, {
|
|
150
|
+
id: 'idD1wcvBISQ',
|
|
151
|
+
name: 'Commodities Maternal Health'
|
|
152
|
+
}, {
|
|
153
|
+
id: 'rioWDAi1S7z',
|
|
154
|
+
name: 'Commodities Newborn Health'
|
|
155
|
+
}, {
|
|
156
|
+
id: 'IyIa0h8CbCZ',
|
|
157
|
+
name: 'Commodities Reproductive Health'
|
|
158
|
+
}, {
|
|
159
|
+
id: 'PfJGQacYpjn',
|
|
160
|
+
name: 'Deaths'
|
|
161
|
+
}, {
|
|
162
|
+
id: 't5W0AAqvK5b',
|
|
163
|
+
name: 'Delivery'
|
|
164
|
+
}, {
|
|
165
|
+
id: 'mcjC3qZgIkO',
|
|
166
|
+
name: 'Diarrhoea With Blood (Dysentery)'
|
|
167
|
+
}, {
|
|
168
|
+
id: 'RSFc8ADyKTw',
|
|
169
|
+
name: 'Diarrhoea With Severe Dehydration'
|
|
170
|
+
}, {
|
|
171
|
+
id: 'kE8lP5t0b5R',
|
|
172
|
+
name: 'Diarrhoea Without Severe Dehydration'
|
|
173
|
+
}, {
|
|
174
|
+
id: 'qiF051Ue9Ei',
|
|
175
|
+
name: 'Emergency Response'
|
|
176
|
+
}, {
|
|
177
|
+
id: 'GbSz3TobZcc',
|
|
178
|
+
name: 'Expenditures'
|
|
179
|
+
}, {
|
|
180
|
+
id: 'lLKpwhjd1dM',
|
|
181
|
+
name: 'Eye Infection'
|
|
182
|
+
}, {
|
|
183
|
+
id: 'Sp1jJqzsiOi',
|
|
184
|
+
name: 'Facility infrastructure'
|
|
185
|
+
}, {
|
|
186
|
+
id: 'g50BzGAsrvu',
|
|
187
|
+
name: 'Follow-up'
|
|
188
|
+
}, {
|
|
189
|
+
id: 'URmi41e0SFH',
|
|
190
|
+
name: 'HIV Care'
|
|
191
|
+
}, {
|
|
192
|
+
id: 'ID4BbhF7Eli',
|
|
193
|
+
name: 'HIV Peadriatics'
|
|
194
|
+
}, {
|
|
195
|
+
id: 'HKU7L73im5r',
|
|
196
|
+
name: 'HIV/AIDS'
|
|
197
|
+
}, {
|
|
198
|
+
id: 'jWgEsdH87Jk',
|
|
199
|
+
name: 'Hypertension'
|
|
200
|
+
}, {
|
|
201
|
+
id: 'nb3rBNvVHtp',
|
|
202
|
+
name: 'ICS Children'
|
|
203
|
+
}, {
|
|
204
|
+
id: 'dMyLpSQn6hu',
|
|
205
|
+
name: 'ICS mother'
|
|
206
|
+
}, {
|
|
207
|
+
id: 'b3gDdvmrSFc',
|
|
208
|
+
name: 'IDSR'
|
|
209
|
+
}, {
|
|
210
|
+
id: 'h9cuJOkOwY2',
|
|
211
|
+
name: 'Immunization'
|
|
212
|
+
}, {
|
|
213
|
+
id: 'OP4dLqk0JTH',
|
|
214
|
+
name: 'Inpatient morbidity/mortality aggregates'
|
|
215
|
+
}, {
|
|
216
|
+
id: 'SriP0jBXMr6',
|
|
217
|
+
name: 'Lassa Fever'
|
|
218
|
+
}, {
|
|
219
|
+
id: 'U0uJG4kydwE',
|
|
220
|
+
name: 'Leprosy'
|
|
221
|
+
}, {
|
|
222
|
+
id: 'eeQCyjnMyGY',
|
|
223
|
+
name: 'Low birth'
|
|
224
|
+
}, {
|
|
225
|
+
id: 'LEet4tb49IP',
|
|
226
|
+
name: 'MNCH Aggregates'
|
|
227
|
+
}, {
|
|
228
|
+
id: 'TzwKbcw1nUK',
|
|
229
|
+
name: 'Malaria'
|
|
230
|
+
}, {
|
|
231
|
+
id: 'qk2KOBMX4Mf',
|
|
232
|
+
name: 'Measles'
|
|
233
|
+
}, {
|
|
234
|
+
id: 'lnLbEej0gwe',
|
|
235
|
+
name: 'Meningitis / Severe Bacterial Infection'
|
|
236
|
+
}, {
|
|
237
|
+
id: 'SLsJy3zqUbD',
|
|
238
|
+
name: 'Morbidity'
|
|
239
|
+
}, {
|
|
240
|
+
id: 'QAc5FhbeFwl',
|
|
241
|
+
name: 'Mortality'
|
|
242
|
+
}, {
|
|
243
|
+
id: 'rPGfUFYbcfJ',
|
|
244
|
+
name: 'Mortality < 5 years'
|
|
245
|
+
}, {
|
|
246
|
+
id: 'KU0wDurtWDM',
|
|
247
|
+
name: 'Mortality Narrative'
|
|
248
|
+
}, {
|
|
249
|
+
id: 'UAEhIWpoQFN',
|
|
250
|
+
name: 'Neonatal Tetanus'
|
|
251
|
+
}, {
|
|
252
|
+
id: 'weRMUzBs8T7',
|
|
253
|
+
name: 'New cases'
|
|
254
|
+
}, {
|
|
255
|
+
id: 'XGSHYf5uOlJ',
|
|
256
|
+
name: 'New on ART'
|
|
257
|
+
}, {
|
|
258
|
+
id: 'u1ilfnoYafG',
|
|
259
|
+
name: 'Nutrition'
|
|
260
|
+
}, {
|
|
261
|
+
id: 'HDdnX6XqxIn',
|
|
262
|
+
name: 'Onchocerciasis'
|
|
263
|
+
}, {
|
|
264
|
+
id: 'JZ3usxLEcc9',
|
|
265
|
+
name: 'Otitis Media'
|
|
266
|
+
}, {
|
|
267
|
+
id: 'WS3MniopkOQ',
|
|
268
|
+
name: 'PMTCT'
|
|
269
|
+
}, {
|
|
270
|
+
id: 'e5NGCRQR8Yo',
|
|
271
|
+
name: 'PMTCT ANC'
|
|
272
|
+
}, {
|
|
273
|
+
id: 'bXpe2ByvlFR',
|
|
274
|
+
name: 'PMTCT Maternity/Delivery'
|
|
275
|
+
}, {
|
|
276
|
+
id: 'sGLusXgmaOT',
|
|
277
|
+
name: 'PMTCT Postnatal'
|
|
278
|
+
}, {
|
|
279
|
+
id: 'sP7jTt3YGBb',
|
|
280
|
+
name: 'Population Estimates'
|
|
281
|
+
}, {
|
|
282
|
+
id: 'ubJrVb4v5xy',
|
|
283
|
+
name: 'Postnatal'
|
|
284
|
+
}, {
|
|
285
|
+
id: 'qkrZMU4Y2h5',
|
|
286
|
+
name: 'Pregnancy complications and deaths'
|
|
287
|
+
}, {
|
|
288
|
+
id: 'ZPtRFVLY40u',
|
|
289
|
+
name: 'Pregnancy-related (PHUF5)'
|
|
290
|
+
}, {
|
|
291
|
+
id: 'AiytigJkHP6',
|
|
292
|
+
name: 'Prev month on ART'
|
|
293
|
+
}, {
|
|
294
|
+
id: 'UWaMbg9h7vF',
|
|
295
|
+
name: 'Referrals'
|
|
296
|
+
}, {
|
|
297
|
+
id: 'OJxi4vkcTBS',
|
|
298
|
+
name: 'Reproductive health'
|
|
299
|
+
}, {
|
|
300
|
+
id: 'xNrDrDbJgnm',
|
|
301
|
+
name: 'STI - Genital Discharge'
|
|
302
|
+
}, {
|
|
303
|
+
id: 'UmyRWILcoed',
|
|
304
|
+
name: 'STI - Genital Ulcer'
|
|
305
|
+
}, {
|
|
306
|
+
id: 'LqG1FnAUhyb',
|
|
307
|
+
name: 'Schistosomiasis'
|
|
308
|
+
}, {
|
|
309
|
+
id: 'rwG73cCi66Z',
|
|
310
|
+
name: 'Shift from ART reg.'
|
|
311
|
+
}, {
|
|
312
|
+
id: 'rgTZ4mKjZza',
|
|
313
|
+
name: 'Shift to ART reg.'
|
|
314
|
+
}, {
|
|
315
|
+
id: 'VCoSeRRVS1n',
|
|
316
|
+
name: 'Skin Infection'
|
|
317
|
+
}, {
|
|
318
|
+
id: 'rVEe5QNBgDX',
|
|
319
|
+
name: 'Staffing'
|
|
320
|
+
}, {
|
|
321
|
+
id: 'pxWhf42tCIs',
|
|
322
|
+
name: 'Stock PHU'
|
|
323
|
+
}, {
|
|
324
|
+
id: 'OnAQ2lsilN9',
|
|
325
|
+
name: 'TB'
|
|
326
|
+
}, {
|
|
327
|
+
id: 'LgtuBcNaMB3',
|
|
328
|
+
name: 'Tetanus'
|
|
329
|
+
}, {
|
|
330
|
+
id: 'yHtsPZqpAxm',
|
|
331
|
+
name: 'Tuberculosis'
|
|
332
|
+
}, {
|
|
333
|
+
id: 'dUK38PhdUdV',
|
|
334
|
+
name: 'Typhoid Fever'
|
|
335
|
+
}, {
|
|
336
|
+
id: 'U9wcARyKSzx',
|
|
337
|
+
name: 'VCCT'
|
|
338
|
+
}, {
|
|
339
|
+
id: 'LzDaTmQYWcj',
|
|
340
|
+
name: 'Worm Infestation'
|
|
341
|
+
}, {
|
|
342
|
+
id: 'IUZ0GidX0jh',
|
|
343
|
+
name: 'Wounds/Trauma'
|
|
344
|
+
}, {
|
|
345
|
+
id: 'zmWJAEjfv59',
|
|
346
|
+
name: 'Yaws'
|
|
347
|
+
}, {
|
|
348
|
+
id: 'HAraPb0v7ex',
|
|
349
|
+
name: 'Yellow Fever'
|
|
350
|
+
}]
|
|
351
|
+
};
|
|
352
|
+
const calculation = {
|
|
353
|
+
id: 'calculationid',
|
|
354
|
+
name: 'My calculation',
|
|
355
|
+
expression: '#{fbfJHSPpUQD}/10*#{hfdmMSPBgLG}'
|
|
356
|
+
};
|
|
357
|
+
const calculationWithOperand = {
|
|
358
|
+
id: 'calcid2',
|
|
359
|
+
name: 'Calculation with operand',
|
|
360
|
+
expression: '#{cYeuwXTCPkU}*10-#{fbfJHSPpUQD.pq2XI5kz2BY}'
|
|
361
|
+
};
|
|
362
|
+
storiesOf('CalculationModal', module).add('Default', () => {
|
|
363
|
+
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
364
|
+
data: {
|
|
365
|
+
dataElements: DATA_ELEMENTS,
|
|
366
|
+
dataElementGroups: DATA_ELEMENT_GROUPS,
|
|
367
|
+
dataElementOperands: DATA_ELEMENT_OPERANDS
|
|
368
|
+
}
|
|
369
|
+
}, /*#__PURE__*/React.createElement(CalculationModal, {
|
|
370
|
+
displayNameProp: "name",
|
|
371
|
+
onClose: Function.prototype,
|
|
372
|
+
onDelete: Function.prototype,
|
|
373
|
+
onSave: Function.prototype
|
|
374
|
+
}));
|
|
375
|
+
}).add('With calculation', () => {
|
|
376
|
+
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
377
|
+
data: {
|
|
378
|
+
dataElements: DATA_ELEMENTS,
|
|
379
|
+
dataElementGroups: DATA_ELEMENT_GROUPS,
|
|
380
|
+
dataElementOperands: DATA_ELEMENT_OPERANDS
|
|
381
|
+
}
|
|
382
|
+
}, /*#__PURE__*/React.createElement(CalculationModal, {
|
|
383
|
+
calculation: calculation,
|
|
384
|
+
displayNameProp: "name",
|
|
385
|
+
onClose: Function.prototype,
|
|
386
|
+
onDelete: Function.prototype,
|
|
387
|
+
onSave: Function.prototype
|
|
388
|
+
}));
|
|
389
|
+
}).add('With calculation containing operand', () => {
|
|
390
|
+
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
391
|
+
data: {
|
|
392
|
+
dataElements: DATA_ELEMENTS,
|
|
393
|
+
dataElementGroups: DATA_ELEMENT_GROUPS,
|
|
394
|
+
dataElementOperands: DATA_ELEMENT_OPERANDS
|
|
395
|
+
}
|
|
396
|
+
}, /*#__PURE__*/React.createElement(CalculationModal, {
|
|
397
|
+
calculation: calculationWithOperand,
|
|
398
|
+
displayNameProp: "name",
|
|
399
|
+
onClose: Function.prototype,
|
|
400
|
+
onDelete: Function.prototype,
|
|
401
|
+
onSave: Function.prototype
|
|
402
|
+
}));
|
|
403
|
+
}).add('No available data', () => {
|
|
404
|
+
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
405
|
+
data: {
|
|
406
|
+
dataElements: {
|
|
407
|
+
pager: {
|
|
408
|
+
page: 1,
|
|
409
|
+
total: 0,
|
|
410
|
+
pageSize: 50,
|
|
411
|
+
pageCount: 1
|
|
412
|
+
},
|
|
413
|
+
dataElements: []
|
|
414
|
+
},
|
|
415
|
+
dataElementGroups: {
|
|
416
|
+
pager: {
|
|
417
|
+
page: 1,
|
|
418
|
+
total: 0,
|
|
419
|
+
pageSize: 50,
|
|
420
|
+
pageCount: 1
|
|
421
|
+
},
|
|
422
|
+
dataElementGroups: []
|
|
423
|
+
},
|
|
424
|
+
dataElementOperands: {
|
|
425
|
+
pager: {
|
|
426
|
+
page: 1,
|
|
427
|
+
total: 0,
|
|
428
|
+
pageSize: 50,
|
|
429
|
+
pageCount: 1
|
|
430
|
+
},
|
|
431
|
+
dataElementOperands: []
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}, /*#__PURE__*/React.createElement(CalculationModal, {
|
|
435
|
+
displayNameProp: "name",
|
|
436
|
+
onClose: Function.prototype,
|
|
437
|
+
onDelete: Function.prototype,
|
|
438
|
+
onSave: Function.prototype
|
|
439
|
+
}));
|
|
440
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getExpressionHashFromVisualization } from '../../modules/hash.js';
|
|
1
2
|
import { getFixedDimensions } from '../../modules/predefinedDimensions.js';
|
|
2
3
|
import AnalyticsRequestBase from './AnalyticsRequestBase.js';
|
|
3
4
|
import AnalyticsRequestDimensionsMixin from './AnalyticsRequestDimensionsMixin.js';
|
|
@@ -98,7 +99,16 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
|
|
|
98
99
|
request = request.addFilter(filterString, (_f$items2 = f.items) === null || _f$items2 === void 0 ? void 0 : _f$items2.map(item => item.id));
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
});
|
|
102
|
+
}); // add cache param for expression dimension items
|
|
103
|
+
|
|
104
|
+
const expressionHash = getExpressionHashFromVisualization(visualization);
|
|
105
|
+
|
|
106
|
+
if (expressionHash) {
|
|
107
|
+
request.withParameters({
|
|
108
|
+
edi_cache: expressionHash
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
102
112
|
return request;
|
|
103
113
|
}
|
|
104
114
|
|
|
@@ -64,7 +64,7 @@ export const dataItemsQuery = {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return objectClean({
|
|
67
|
-
fields: "id,".concat(nameProp, "~rename(name),dimensionItemType"),
|
|
67
|
+
fields: "id,".concat(nameProp, "~rename(name),dimensionItemType,expression"),
|
|
68
68
|
order: "".concat(nameProp, ":asc"),
|
|
69
69
|
filter: filters,
|
|
70
70
|
paging: true,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const validateExpressionMutation = {
|
|
2
|
+
type: 'create',
|
|
3
|
+
resource: 'indicators/expression/description',
|
|
4
|
+
data: _ref => {
|
|
5
|
+
let {
|
|
6
|
+
expression
|
|
7
|
+
} = _ref;
|
|
8
|
+
return expression;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const createCalculationMutation = {
|
|
12
|
+
type: 'create',
|
|
13
|
+
resource: 'expressionDimensionItems',
|
|
14
|
+
data: _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
name,
|
|
17
|
+
expression
|
|
18
|
+
} = _ref2;
|
|
19
|
+
return {
|
|
20
|
+
name,
|
|
21
|
+
shortName: name,
|
|
22
|
+
expression
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const updateCalculationMutation = {
|
|
27
|
+
type: 'update',
|
|
28
|
+
resource: 'expressionDimensionItems',
|
|
29
|
+
partial: true,
|
|
30
|
+
id: _ref3 => {
|
|
31
|
+
let {
|
|
32
|
+
id
|
|
33
|
+
} = _ref3;
|
|
34
|
+
return id;
|
|
35
|
+
},
|
|
36
|
+
data: _ref4 => {
|
|
37
|
+
let {
|
|
38
|
+
name,
|
|
39
|
+
expression
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return {
|
|
42
|
+
name,
|
|
43
|
+
shortName: name,
|
|
44
|
+
expression
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export const deleteCalculationMutation = {
|
|
49
|
+
type: 'delete',
|
|
50
|
+
resource: 'expressionDimensionItems',
|
|
51
|
+
id: _ref5 => {
|
|
52
|
+
let {
|
|
53
|
+
id
|
|
54
|
+
} = _ref5;
|
|
55
|
+
return id;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default /*#__PURE__*/React.createElement("svg", {
|
|
3
|
+
height: "16",
|
|
4
|
+
viewBox: "0 0 16 16",
|
|
5
|
+
width: "16",
|
|
6
|
+
fill: "none",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
9
|
+
fillRule: "evenodd",
|
|
10
|
+
clipRule: "evenodd",
|
|
11
|
+
d: "M7 4H5V2H4V4H2V5H4V7H5V5H7V4ZM7 9.5H2V10.5H7V9.5ZM2 12H7V13H2V12ZM14 4H9V5H14V4ZM14 9.205L12.205 11L14 12.795L13.295 13.5L11.5 11.705L9.705 13.5L9 12.795L10.795 11L9 9.205L9.705 8.5L11.5 10.295L13.295 8.5L14 9.205Z",
|
|
12
|
+
fill: "#404B5A"
|
|
13
|
+
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const FormulaIcon = () => {
|
|
4
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
5
|
+
width: "32",
|
|
6
|
+
height: "32",
|
|
7
|
+
viewBox: "0 0 32 32",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
11
|
+
clipPath: "url(#clip0_927_2130)"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
13
|
+
width: "32",
|
|
14
|
+
height: "32",
|
|
15
|
+
fill: "white"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
clipRule: "evenodd",
|
|
19
|
+
d: "M14 8H10V4H8V8H4V10H8V14H10V10H14V8ZM14 19H4V21H14V19ZM4 24H14V26H4V24ZM28 8H18V10H28V8ZM28 18.41L24.41 22L28 25.59L26.59 27L23 23.41L19.41 27L18 25.59L21.59 22L18 18.41L19.41 17L23 20.59L26.59 17L28 18.41Z",
|
|
20
|
+
fill: "#A0ADBA"
|
|
21
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
22
|
+
id: "clip0_927_2130"
|
|
23
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
24
|
+
width: "32",
|
|
25
|
+
height: "32",
|
|
26
|
+
fill: "white"
|
|
27
|
+
}))));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default FormulaIcon;
|