@genspectrum/dashboard-components 1.12.0 → 1.13.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 (57) hide show
  1. package/README.md +0 -7
  2. package/custom-elements.json +6 -25
  3. package/dist/components.d.ts +30 -36
  4. package/dist/components.js +943 -757
  5. package/dist/components.js.map +1 -1
  6. package/dist/util.d.ts +46 -30
  7. package/package.json +1 -5
  8. package/src/lapisApi/lapisApi.ts +21 -1
  9. package/src/lapisApi/lapisTypes.ts +36 -0
  10. package/src/preact/components/annotated-mutation.tsx +2 -2
  11. package/src/preact/{mutationsOverTime/mutations-over-time-grid.tsx → components/features-over-time-grid.tsx} +45 -52
  12. package/src/preact/genomeViewer/genome-data-viewer.tsx +2 -2
  13. package/src/preact/mutationsOverTime/MutationOverTimeData.ts +6 -4
  14. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay/aminoAcidMutations.json +5482 -0
  15. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay/aminoAcidMutationsOverTime.json +5496 -0
  16. package/src/preact/mutationsOverTime/__mockData__/byWeek/mutationsOverTime.json +7100 -0
  17. package/src/preact/mutationsOverTime/__mockData__/byWeek/nucleotideMutations.json +10122 -0
  18. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mutationsOverTime.json +12646 -0
  19. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/nucleotideMutations.json +12632 -0
  20. package/src/preact/mutationsOverTime/__mockData__/request1800s/mutationsOverTime.json +16 -0
  21. package/src/preact/mutationsOverTime/__mockData__/request1800s/nucleotideMutations.json +11 -0
  22. package/src/preact/mutationsOverTime/__mockData__/withDisplayMutations/mutationsOverTime.json +52 -0
  23. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +3 -3
  24. package/src/preact/mutationsOverTime/mutations-over-time-grid-tooltip.tsx +3 -6
  25. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +199 -12
  26. package/src/preact/mutationsOverTime/mutations-over-time.tsx +30 -35
  27. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +30 -3
  28. package/src/query/queryDatesInDataset.ts +89 -0
  29. package/src/query/queryMutationsOverTime.spec.ts +526 -548
  30. package/src/query/queryMutationsOverTime.ts +21 -232
  31. package/src/query/queryQueriesOverTime.spec.ts +432 -0
  32. package/src/query/queryQueriesOverTime.ts +125 -0
  33. package/src/utilEntrypoint.ts +3 -1
  34. package/src/utils/mutations.spec.ts +6 -0
  35. package/src/utils/mutations.ts +1 -1
  36. package/src/utils/temporalClass.ts +4 -0
  37. package/src/web-components/visualization/gs-mutations-over-time.spec-d.ts +0 -3
  38. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +283 -17
  39. package/src/web-components/visualization/gs-mutations-over-time.tsx +0 -9
  40. package/standalone-bundle/dashboard-components.js +8935 -8781
  41. package/standalone-bundle/dashboard-components.js.map +1 -1
  42. package/dist/assets/mutationOverTimeWorker-f8Kp0S6V.js.map +0 -1
  43. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +0 -47170
  44. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +0 -54026
  45. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +0 -108385
  46. package/src/preact/mutationsOverTime/__mockData__/mockConversion.ts +0 -54
  47. package/src/preact/mutationsOverTime/__mockData__/noDataWhenNoMutationsAreInFilter.ts +0 -23
  48. package/src/preact/mutationsOverTime/__mockData__/noDataWhenThereAreNoDatesInFilter.ts +0 -23
  49. package/src/preact/mutationsOverTime/__mockData__/showsMessageWhenTooManyMutations.ts +0 -65527
  50. package/src/preact/mutationsOverTime/__mockData__/withDisplayMutations.ts +0 -352
  51. package/src/preact/mutationsOverTime/__mockData__/withGaps.ts +0 -298
  52. package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +0 -33
  53. package/src/preact/mutationsOverTime/mutationOverTimeWorker.ts +0 -29
  54. package/src/preact/webWorkers/useWebWorker.ts +0 -74
  55. package/src/preact/webWorkers/workerFunction.ts +0 -30
  56. package/src/query/queryMutationsOverTimeNewEndpoint.spec.ts +0 -988
  57. package/standalone-bundle/assets/mutationOverTimeWorker-AhhjjklP.js.map +0 -1
@@ -1,352 +0,0 @@
1
- import { type MutationOverTimeMockData } from './mockConversion';
2
-
3
- export const withDisplayMutations: MutationOverTimeMockData = {
4
- query: {
5
- lapisFilter: {
6
- pangoLineage: 'JN.1*',
7
- dateFrom: '2024-01-15',
8
- dateTo: '2024-07-10',
9
- },
10
- sequenceType: 'nucleotide',
11
- granularity: 'month',
12
- lapisDateField: 'date',
13
- lapis: 'https://lapis.cov-spectrum.org/open/v2',
14
- displayMutations: ['A19722G', 'G21641T', 'T21653-'],
15
- useNewEndpoint: false,
16
- },
17
- response: {
18
- overallMutationData: [
19
- {
20
- type: 'substitution',
21
- mutation: {
22
- valueAtReference: 'A',
23
- substitutionValue: 'G',
24
- position: 19722,
25
- type: 'substitution',
26
- code: 'A19722G',
27
- },
28
- count: 10234,
29
- proportion: 0.09900453714363107,
30
- },
31
- {
32
- type: 'substitution',
33
- mutation: {
34
- valueAtReference: 'G',
35
- substitutionValue: 'T',
36
- position: 21641,
37
- type: 'substitution',
38
- code: 'G21641T',
39
- },
40
- count: 4485,
41
- proportion: 0.05001951709139575,
42
- },
43
- {
44
- type: 'deletion',
45
- mutation: {
46
- valueAtReference: 'T',
47
- position: 21653,
48
- type: 'deletion',
49
- code: 'T21653-',
50
- },
51
- count: 17169,
52
- proportion: 0.16814713976514833,
53
- },
54
- ],
55
- mutationOverTimeSerializedAsArray: {
56
- data: [
57
- [
58
- 'A19722G',
59
- [
60
- [
61
- '2024-01',
62
- {
63
- type: 'belowThreshold',
64
- totalCount: 26387,
65
- },
66
- ],
67
- [
68
- '2024-02',
69
- {
70
- type: 'belowThreshold',
71
- totalCount: 17340,
72
- },
73
- ],
74
- [
75
- '2024-03',
76
- {
77
- type: 'value',
78
- count: 36,
79
- proportion: 0.0043859649122807015,
80
- totalCount: 8236,
81
- },
82
- ],
83
- [
84
- '2024-04',
85
- {
86
- type: 'value',
87
- count: 194,
88
- proportion: 0.030082183284230114,
89
- totalCount: 6488,
90
- },
91
- ],
92
- [
93
- '2024-05',
94
- {
95
- type: 'value',
96
- count: 759,
97
- proportion: 0.08675277174534232,
98
- totalCount: 8799,
99
- },
100
- ],
101
- [
102
- '2024-06',
103
- {
104
- type: 'value',
105
- count: 2921,
106
- proportion: 0.19071559153826065,
107
- totalCount: 15400,
108
- },
109
- ],
110
- [
111
- '2024-07',
112
- {
113
- type: 'value',
114
- count: 6318,
115
- proportion: 0.2995448511283899,
116
- totalCount: 21234,
117
- },
118
- ],
119
- ],
120
- ],
121
- [
122
- 'G21641T',
123
- [
124
- [
125
- '2024-01',
126
- {
127
- type: 'value',
128
- count: 1625,
129
- proportion: 0.07085858806087297,
130
- totalCount: 26387,
131
- },
132
- ],
133
- [
134
- '2024-02',
135
- {
136
- type: 'value',
137
- count: 419,
138
- proportion: 0.027931471235250985,
139
- totalCount: 17340,
140
- },
141
- ],
142
- [
143
- '2024-03',
144
- {
145
- type: 'value',
146
- count: 228,
147
- proportion: 0.03451930355791068,
148
- totalCount: 8236,
149
- },
150
- ],
151
- [
152
- '2024-04',
153
- {
154
- type: 'value',
155
- count: 545,
156
- proportion: 0.10551790900290416,
157
- totalCount: 6488,
158
- },
159
- ],
160
- [
161
- '2024-05',
162
- {
163
- type: 'value',
164
- count: 666,
165
- proportion: 0.09498003422703936,
166
- totalCount: 8799,
167
- },
168
- ],
169
- [
170
- '2024-06',
171
- {
172
- type: 'value',
173
- count: 732,
174
- proportion: 0.05598470363288719,
175
- totalCount: 15400,
176
- },
177
- ],
178
- [
179
- '2024-07',
180
- {
181
- type: 'value',
182
- count: 270,
183
- proportion: 0.013585589212035825,
184
- totalCount: 21234,
185
- },
186
- ],
187
- ],
188
- ],
189
- [
190
- 'T21653-',
191
- [
192
- [
193
- '2024-01',
194
- {
195
- type: 'belowThreshold',
196
- totalCount: 26387,
197
- },
198
- ],
199
- [
200
- '2024-02',
201
- {
202
- type: 'belowThreshold',
203
- totalCount: 17340,
204
- },
205
- ],
206
- [
207
- '2024-03',
208
- {
209
- type: 'value',
210
- count: 40,
211
- proportion: 0.004921259842519685,
212
- totalCount: 8236,
213
- },
214
- ],
215
- [
216
- '2024-04',
217
- {
218
- type: 'value',
219
- count: 228,
220
- proportion: 0.03576470588235294,
221
- totalCount: 6488,
222
- },
223
- ],
224
- [
225
- '2024-05',
226
- {
227
- type: 'value',
228
- count: 1304,
229
- proportion: 0.151504589287789,
230
- totalCount: 8799,
231
- },
232
- ],
233
- [
234
- '2024-06',
235
- {
236
- type: 'value',
237
- count: 4744,
238
- proportion: 0.31656212464967304,
239
- totalCount: 15400,
240
- },
241
- ],
242
- [
243
- '2024-07',
244
- {
245
- type: 'value',
246
- count: 10815,
247
- proportion: 0.5221610660486674,
248
- totalCount: 21234,
249
- },
250
- ],
251
- ],
252
- ],
253
- ],
254
- keysFirstAxis: [
255
- [
256
- 'A19722G',
257
- {
258
- type: 'substitution',
259
- code: 'A19722G',
260
- position: 19722,
261
- valueAtReference: 'A',
262
- substitutionValue: 'G',
263
- },
264
- ],
265
- [
266
- 'G21641T',
267
- {
268
- type: 'substitution',
269
- code: 'G21641T',
270
- position: 21641,
271
- valueAtReference: 'G',
272
- substitutionValue: 'T',
273
- },
274
- ],
275
- [
276
- 'T21653-',
277
- {
278
- type: 'deletion',
279
- code: 'T21653-',
280
- position: 21653,
281
- valueAtReference: 'T',
282
- },
283
- ],
284
- ],
285
- keysSecondAxis: [
286
- [
287
- '2024-01',
288
- {
289
- type: 'YearMonth',
290
- yearNumber: 2024,
291
- monthNumber: 1,
292
- dateString: '2024-01',
293
- },
294
- ],
295
- [
296
- '2024-02',
297
- {
298
- type: 'YearMonth',
299
- yearNumber: 2024,
300
- monthNumber: 2,
301
- dateString: '2024-02',
302
- },
303
- ],
304
- [
305
- '2024-03',
306
- {
307
- type: 'YearMonth',
308
- yearNumber: 2024,
309
- monthNumber: 3,
310
- dateString: '2024-03',
311
- },
312
- ],
313
- [
314
- '2024-04',
315
- {
316
- type: 'YearMonth',
317
- yearNumber: 2024,
318
- monthNumber: 4,
319
- dateString: '2024-04',
320
- },
321
- ],
322
- [
323
- '2024-05',
324
- {
325
- type: 'YearMonth',
326
- yearNumber: 2024,
327
- monthNumber: 5,
328
- dateString: '2024-05',
329
- },
330
- ],
331
- [
332
- '2024-06',
333
- {
334
- type: 'YearMonth',
335
- yearNumber: 2024,
336
- monthNumber: 6,
337
- dateString: '2024-06',
338
- },
339
- ],
340
- [
341
- '2024-07',
342
- {
343
- type: 'YearMonth',
344
- yearNumber: 2024,
345
- monthNumber: 7,
346
- dateString: '2024-07',
347
- },
348
- ],
349
- ],
350
- },
351
- },
352
- };
@@ -1,298 +0,0 @@
1
- import { type MutationOverTimeMockData } from './mockConversion';
2
-
3
- export const withGaps: MutationOverTimeMockData = {
4
- query: {
5
- lapisFilter: {
6
- pangoLineage: 'JN.1*',
7
- dateFrom: '2024-01-15',
8
- dateTo: '2024-07-10',
9
- },
10
- sequenceType: 'nucleotide',
11
- granularity: 'month',
12
- lapisDateField: 'date',
13
- lapis: 'https://lapis.cov-spectrum.org/open/v2',
14
- displayMutations: ['A19722G', 'G21641T', 'T21652-'],
15
- useNewEndpoint: false,
16
- },
17
- response: {
18
- overallMutationData: [
19
- {
20
- type: 'substitution',
21
- mutation: {
22
- valueAtReference: 'A',
23
- substitutionValue: 'G',
24
- position: 19722,
25
- type: 'substitution',
26
- code: 'A19722G',
27
- },
28
- count: 10234,
29
- proportion: 0.09900453714363107,
30
- },
31
- {
32
- type: 'substitution',
33
- mutation: {
34
- valueAtReference: 'G',
35
- substitutionValue: 'T',
36
- position: 21641,
37
- type: 'substitution',
38
- code: 'G21641T',
39
- },
40
- count: 4485,
41
- proportion: 0.05001951709139575,
42
- },
43
- {
44
- type: 'deletion',
45
- mutation: {
46
- valueAtReference: 'T',
47
- position: 21652,
48
- type: 'deletion',
49
- code: 'T21652-',
50
- },
51
- count: 17169,
52
- proportion: 0.16814713976514833,
53
- },
54
- ],
55
- mutationOverTimeSerializedAsArray: {
56
- data: [
57
- [
58
- 'A19722G',
59
- [
60
- [
61
- '2024-01',
62
- {
63
- type: 'belowThreshold',
64
- totalCount: 26387,
65
- },
66
- ],
67
- [
68
- '2024-02',
69
- {
70
- type: 'belowThreshold',
71
- totalCount: 17340,
72
- },
73
- ],
74
- [
75
- '2024-03',
76
- {
77
- type: 'value',
78
- count: 36,
79
- proportion: 0.0043859649122807015,
80
- totalCount: 8236,
81
- },
82
- ],
83
- [
84
- '2024-05',
85
- {
86
- type: 'value',
87
- count: 759,
88
- proportion: 0.08675277174534232,
89
- totalCount: 8799,
90
- },
91
- ],
92
- [
93
- '2024-07',
94
- {
95
- type: 'value',
96
- count: 6318,
97
- proportion: 0.2995448511283899,
98
- totalCount: 21234,
99
- },
100
- ],
101
- ],
102
- ],
103
- [
104
- 'G21641T',
105
- [
106
- [
107
- '2024-01',
108
- {
109
- type: 'value',
110
- count: 1625,
111
- proportion: 0.07085858806087297,
112
- totalCount: 26387,
113
- },
114
- ],
115
- [
116
- '2024-02',
117
- {
118
- type: 'value',
119
- count: 419,
120
- proportion: 0.027931471235250985,
121
- totalCount: 17340,
122
- },
123
- ],
124
- [
125
- '2024-03',
126
- {
127
- type: 'value',
128
- count: 228,
129
- proportion: 0.03451930355791068,
130
- totalCount: 8236,
131
- },
132
- ],
133
- [
134
- '2024-05',
135
- {
136
- type: 'value',
137
- count: 666,
138
- proportion: 0.09498003422703936,
139
- totalCount: 8799,
140
- },
141
- ],
142
- [
143
- '2024-07',
144
- {
145
- type: 'value',
146
- count: 270,
147
- proportion: 0.013585589212035825,
148
- totalCount: 21234,
149
- },
150
- ],
151
- ],
152
- ],
153
- [
154
- 'T21652-',
155
- [
156
- [
157
- '2024-01',
158
- {
159
- type: 'belowThreshold',
160
- totalCount: 26387,
161
- },
162
- ],
163
- [
164
- '2024-02',
165
- {
166
- type: 'belowThreshold',
167
- totalCount: 17340,
168
- },
169
- ],
170
- [
171
- '2024-03',
172
- {
173
- type: 'value',
174
- count: 40,
175
- proportion: 0.004921259842519685,
176
- totalCount: 8236,
177
- },
178
- ],
179
- [
180
- '2024-05',
181
- {
182
- type: 'value',
183
- count: 1304,
184
- proportion: 0.151504589287789,
185
- totalCount: 8799,
186
- },
187
- ],
188
- [
189
- '2024-07',
190
- {
191
- type: 'value',
192
- count: 10815,
193
- proportion: 0.5221610660486674,
194
- totalCount: 21234,
195
- },
196
- ],
197
- ],
198
- ],
199
- ],
200
- keysFirstAxis: [
201
- [
202
- 'A19722G',
203
- {
204
- type: 'substitution',
205
- code: 'A19722G',
206
- position: 19722,
207
- valueAtReference: 'A',
208
- substitutionValue: 'G',
209
- },
210
- ],
211
- [
212
- 'G21641T',
213
- {
214
- type: 'substitution',
215
- code: 'G21641T',
216
- position: 21641,
217
- valueAtReference: 'G',
218
- substitutionValue: 'T',
219
- },
220
- ],
221
- [
222
- 'T21652-',
223
- {
224
- type: 'deletion',
225
- code: 'T21652-',
226
- position: 21652,
227
- valueAtReference: 'T',
228
- },
229
- ],
230
- ],
231
- keysSecondAxis: [
232
- [
233
- '2024-01',
234
- {
235
- type: 'YearMonth',
236
- yearNumber: 2024,
237
- monthNumber: 1,
238
- dateString: '2024-01',
239
- },
240
- ],
241
- [
242
- '2024-02',
243
- {
244
- type: 'YearMonth',
245
- yearNumber: 2024,
246
- monthNumber: 2,
247
- dateString: '2024-02',
248
- },
249
- ],
250
- [
251
- '2024-03',
252
- {
253
- type: 'YearMonth',
254
- yearNumber: 2024,
255
- monthNumber: 3,
256
- dateString: '2024-03',
257
- },
258
- ],
259
- [
260
- '2024-04',
261
- {
262
- type: 'YearMonth',
263
- yearNumber: 2024,
264
- monthNumber: 4,
265
- dateString: '2024-04',
266
- },
267
- ],
268
- [
269
- '2024-05',
270
- {
271
- type: 'YearMonth',
272
- yearNumber: 2024,
273
- monthNumber: 5,
274
- dateString: '2024-05',
275
- },
276
- ],
277
- [
278
- '2024-06',
279
- {
280
- type: 'YearMonth',
281
- yearNumber: 2024,
282
- monthNumber: 6,
283
- dateString: '2024-06',
284
- },
285
- ],
286
- [
287
- '2024-07',
288
- {
289
- type: 'YearMonth',
290
- yearNumber: 2024,
291
- monthNumber: 7,
292
- dateString: '2024-07',
293
- },
294
- ],
295
- ],
296
- },
297
- },
298
- };
@@ -1,33 +0,0 @@
1
- import { aminoAcidMutationsByDay } from './__mockData__/aminoAcidMutationsByDay';
2
- import { getMutationOverTimeWorkerFunction, type MutationOverTimeWorkerResponse } from './mutationOverTimeWorker';
3
- import { type MutationOverTimeQuery } from '../../query/queryMutationsOverTime';
4
- import { workerFunction } from '../webWorkers/workerFunction';
5
- import { byWeek } from './__mockData__/byWeek';
6
- import { defaultMockData } from './__mockData__/defaultMockData';
7
- import { getMutationOverTimeMock } from './__mockData__/mockConversion';
8
- import { noDataWhenNoMutationsAreInFilter } from './__mockData__/noDataWhenNoMutationsAreInFilter';
9
- import { showsMessageWhenTooManyMutations } from './__mockData__/showsMessageWhenTooManyMutations';
10
- import { withDisplayMutations } from './__mockData__/withDisplayMutations';
11
- import { withGaps } from './__mockData__/withGaps';
12
-
13
- const mockQueries: { query: MutationOverTimeQuery; response: MutationOverTimeWorkerResponse }[] = [
14
- getMutationOverTimeMock(defaultMockData),
15
- getMutationOverTimeMock(showsMessageWhenTooManyMutations),
16
- getMutationOverTimeMock(byWeek),
17
- getMutationOverTimeMock(withDisplayMutations),
18
- getMutationOverTimeMock(aminoAcidMutationsByDay),
19
- getMutationOverTimeMock(noDataWhenNoMutationsAreInFilter),
20
- getMutationOverTimeMock(withGaps),
21
- ];
22
-
23
- self.onmessage = async function (event: MessageEvent<MutationOverTimeQuery>) {
24
- await workerFunction(async () => {
25
- const query = mockQueries.find((mockQuery) => JSON.stringify(mockQuery.query) === JSON.stringify(event.data));
26
-
27
- if (query !== undefined) {
28
- return query.response;
29
- }
30
-
31
- return await getMutationOverTimeWorkerFunction(event);
32
- });
33
- };