@genspectrum/dashboard-components 0.6.4 → 0.6.6

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 (31) hide show
  1. package/custom-elements.json +36 -4
  2. package/dist/dashboard-components.js +181 -55
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +13 -7
  5. package/dist/style.css +53 -2
  6. package/package.json +1 -1
  7. package/src/constants.ts +1 -0
  8. package/src/preact/components/tooltip.stories.tsx +12 -2
  9. package/src/preact/components/tooltip.tsx +37 -13
  10. package/src/preact/mutationsOverTime/__mockData__/aggregated_byDay.json +38 -0
  11. package/src/preact/mutationsOverTime/__mockData__/aggregated_byWeek.json +122 -0
  12. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations.json +1470 -0
  13. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json +6778 -0
  14. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json +7129 -0
  15. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json +4681 -0
  16. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json +10738 -0
  17. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json +11710 -0
  18. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json +11557 -0
  19. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json +8596 -0
  20. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_tooManyMutations.json +16453 -0
  21. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json +8812 -0
  22. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json +9730 -0
  23. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json +9865 -0
  24. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json +11314 -0
  25. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +62 -43
  26. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +62 -8
  27. package/src/preact/mutationsOverTime/mutations-over-time.tsx +32 -8
  28. package/src/utils/temporal.spec.ts +3 -4
  29. package/src/utils/temporal.ts +9 -4
  30. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +254 -2
  31. package/src/web-components/visualization/gs-mutations-over-time.tsx +11 -5
@@ -4,8 +4,22 @@ import { html } from 'lit';
4
4
  import './gs-mutations-over-time';
5
5
  import '../app';
6
6
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
7
- import { AGGREGATED_ENDPOINT, LAPIS_URL, NUCLEOTIDE_MUTATIONS_ENDPOINT } from '../../constants';
7
+ import {
8
+ AGGREGATED_ENDPOINT,
9
+ AMINO_ACID_MUTATIONS_ENDPOINT,
10
+ LAPIS_URL,
11
+ NUCLEOTIDE_MUTATIONS_ENDPOINT,
12
+ } from '../../constants';
13
+ import aggregated_byDay from '../../preact/mutationsOverTime/__mockData__/aggregated_byDay.json';
14
+ import aggregated_byWeek from '../../preact/mutationsOverTime/__mockData__/aggregated_byWeek.json';
8
15
  import aggregated_date from '../../preact/mutationsOverTime/__mockData__/aggregated_date.json';
16
+ import aminoAcidMutations_20_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json';
17
+ import aminoAcidMutations_21_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json';
18
+ import aminoAcidMutations_22_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json';
19
+ import aminoAcidMutations_23_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json';
20
+ import aminoAcidMutations_24_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json';
21
+ import aminoAcidMutations_25_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json';
22
+ import aminoAcidMutations_26_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json';
9
23
  import nucleotideMutation_01 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_01.json';
10
24
  import nucleotideMutation_02 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_02.json';
11
25
  import nucleotideMutation_03 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_03.json';
@@ -13,6 +27,10 @@ import nucleotideMutation_04 from '../../preact/mutationsOverTime/__mockData__/n
13
27
  import nucleotideMutation_05 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_05.json';
14
28
  import nucleotideMutation_06 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_06.json';
15
29
  import nucleotideMutation_07 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_07.json';
30
+ import nucleotideMutation_week3 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json';
31
+ import nucleotideMutation_week4 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json';
32
+ import nucleotideMutation_week5 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json';
33
+ import nucleotideMutation_week6 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json';
16
34
  import { type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
17
35
 
18
36
  const codeExample = String.raw`
@@ -85,7 +103,7 @@ const Template: StoryObj<Required<MutationsOverTimeProps>> = {
85
103
  `,
86
104
  };
87
105
 
88
- export const Default: StoryObj<Required<MutationsOverTimeProps>> = {
106
+ export const ByMonth: StoryObj<Required<MutationsOverTimeProps>> = {
89
107
  ...Template,
90
108
  parameters: {
91
109
  fetchMock: {
@@ -223,3 +241,237 @@ export const Default: StoryObj<Required<MutationsOverTimeProps>> = {
223
241
  },
224
242
  },
225
243
  };
244
+
245
+ export const ByWeek: StoryObj<Required<MutationsOverTimeProps>> = {
246
+ ...Template,
247
+ args: {
248
+ ...Template.args,
249
+ lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-02-11' },
250
+ granularity: 'week',
251
+ },
252
+ parameters: {
253
+ fetchMock: {
254
+ mocks: [
255
+ {
256
+ matcher: {
257
+ name: 'aggregated_dates',
258
+ url: AGGREGATED_ENDPOINT,
259
+ body: {
260
+ dateFrom: '2024-01-15',
261
+ dateTo: '2024-02-11',
262
+ fields: ['date'],
263
+ pangoLineage: 'JN.1*',
264
+ },
265
+ },
266
+ response: {
267
+ status: 200,
268
+ body: aggregated_byWeek,
269
+ },
270
+ },
271
+ {
272
+ matcher: {
273
+ name: 'nucleotideMutation_week3',
274
+ url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
275
+ body: {
276
+ pangoLineage: 'JN.1*',
277
+ dateFrom: '2024-01-15',
278
+ dateTo: '2024-01-21',
279
+ minProportion: 0.001,
280
+ },
281
+ },
282
+ response: {
283
+ status: 200,
284
+ body: nucleotideMutation_week3,
285
+ },
286
+ },
287
+ {
288
+ matcher: {
289
+ name: 'nucleotideMutation_week4',
290
+ url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
291
+ body: {
292
+ pangoLineage: 'JN.1*',
293
+ dateFrom: '2024-01-22',
294
+ dateTo: '2024-01-28',
295
+ minProportion: 0.001,
296
+ },
297
+ },
298
+ response: {
299
+ status: 200,
300
+ body: nucleotideMutation_week4,
301
+ },
302
+ },
303
+ {
304
+ matcher: {
305
+ name: 'nucleotideMutation_week5',
306
+ url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
307
+ body: {
308
+ pangoLineage: 'JN.1*',
309
+ dateFrom: '2024-01-29',
310
+ dateTo: '2024-02-04',
311
+ minProportion: 0.001,
312
+ },
313
+ },
314
+ response: {
315
+ status: 200,
316
+ body: nucleotideMutation_week5,
317
+ },
318
+ },
319
+ {
320
+ matcher: {
321
+ name: 'nucleotideMutation_week6',
322
+ url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
323
+ body: {
324
+ pangoLineage: 'JN.1*',
325
+ dateFrom: '2024-02-05',
326
+ dateTo: '2024-02-11',
327
+ minProportion: 0.001,
328
+ },
329
+ },
330
+ response: {
331
+ status: 200,
332
+ body: nucleotideMutation_week6,
333
+ },
334
+ },
335
+ ],
336
+ },
337
+ },
338
+ };
339
+
340
+ export const AminoAcidMutationsByDay: StoryObj<Required<MutationsOverTimeProps>> = {
341
+ ...Template,
342
+ args: {
343
+ ...Template.args,
344
+ lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-20', dateTo: '2024-01-26' },
345
+ granularity: 'day',
346
+ sequenceType: 'amino acid',
347
+ },
348
+ parameters: {
349
+ fetchMock: {
350
+ mocks: [
351
+ {
352
+ matcher: {
353
+ name: 'aggregated_byDay',
354
+ url: AGGREGATED_ENDPOINT,
355
+ body: { pangoLineage: 'JN.1*', dateFrom: '2024-01-20', dateTo: '2024-01-26', fields: ['date'] },
356
+ },
357
+ response: {
358
+ status: 200,
359
+ body: aggregated_byDay,
360
+ },
361
+ },
362
+ {
363
+ matcher: {
364
+ name: 'aminoAcidMutations_20_01_2024',
365
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
366
+ body: {
367
+ pangoLineage: 'JN.1*',
368
+ dateFrom: '2024-01-20',
369
+ dateTo: '2024-01-20',
370
+ minProportion: 0.001,
371
+ },
372
+ },
373
+ response: {
374
+ status: 200,
375
+ body: aminoAcidMutations_20_01_2024,
376
+ },
377
+ },
378
+ {
379
+ matcher: {
380
+ name: 'aminoAcidMutations_21_01_2024',
381
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
382
+ body: {
383
+ pangoLineage: 'JN.1*',
384
+ dateFrom: '2024-01-21',
385
+ dateTo: '2024-01-21',
386
+ minProportion: 0.001,
387
+ },
388
+ },
389
+ response: {
390
+ status: 200,
391
+ body: aminoAcidMutations_21_01_2024,
392
+ },
393
+ },
394
+ {
395
+ matcher: {
396
+ name: 'aminoAcidMutations_22_01_2024',
397
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
398
+ body: {
399
+ pangoLineage: 'JN.1*',
400
+ dateFrom: '2024-01-22',
401
+ dateTo: '2024-01-22',
402
+ minProportion: 0.001,
403
+ },
404
+ },
405
+ response: {
406
+ status: 200,
407
+ body: aminoAcidMutations_22_01_2024,
408
+ },
409
+ },
410
+ {
411
+ matcher: {
412
+ name: 'aminoAcidMutations_23_01_2024',
413
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
414
+ body: {
415
+ pangoLineage: 'JN.1*',
416
+ dateFrom: '2024-01-23',
417
+ dateTo: '2024-01-23',
418
+ minProportion: 0.001,
419
+ },
420
+ },
421
+ response: {
422
+ status: 200,
423
+ body: aminoAcidMutations_23_01_2024,
424
+ },
425
+ },
426
+ {
427
+ matcher: {
428
+ name: 'aminoAcidMutations_24_01_2024',
429
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
430
+ body: {
431
+ pangoLineage: 'JN.1*',
432
+ dateFrom: '2024-01-24',
433
+ dateTo: '2024-01-24',
434
+ minProportion: 0.001,
435
+ },
436
+ },
437
+ response: {
438
+ status: 200,
439
+ body: aminoAcidMutations_24_01_2024,
440
+ },
441
+ },
442
+ {
443
+ matcher: {
444
+ name: 'aminoAcidMutations_25_01_2024',
445
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
446
+ body: {
447
+ pangoLineage: 'JN.1*',
448
+ dateFrom: '2024-01-25',
449
+ dateTo: '2024-01-25',
450
+ minProportion: 0.001,
451
+ },
452
+ },
453
+ response: {
454
+ status: 200,
455
+ body: aminoAcidMutations_25_01_2024,
456
+ },
457
+ },
458
+ {
459
+ matcher: {
460
+ name: 'aminoAcidMutations_26_01_2024',
461
+ url: AMINO_ACID_MUTATIONS_ENDPOINT,
462
+ body: {
463
+ pangoLineage: 'JN.1*',
464
+ dateFrom: '2024-01-26',
465
+ dateTo: '2024-01-26',
466
+ minProportion: 0.001,
467
+ },
468
+ },
469
+ response: {
470
+ status: 200,
471
+ body: aminoAcidMutations_26_01_2024,
472
+ },
473
+ },
474
+ ],
475
+ },
476
+ },
477
+ };
@@ -17,11 +17,17 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
17
17
  *
18
18
  * The grid view shows the proportion for each mutation over date ranges.
19
19
  *
20
- * The grid will show at max 100 rows and 200 columns for browser performance reasons.
21
- * More data might make the browser unresponsive.
22
- * If the numbers are exceeded, an error message will be shown.
23
- * In both cases, the `lapisFilter` should be narrowed down to reduce the number of mutations or date ranges.
24
- * The number of date ranges can also be reduced by selecting a larger granularity (months instead of weeks).
20
+ * The grid limits the number of rows columns for browser performance reasons.
21
+ * Too much data might make the browser unresponsive.
22
+ *
23
+ * The number of columns is limited to 200.
24
+ * If this number are exceeded, an error message will be shown.
25
+ * It is your responsibility to make sure that this does not happen.
26
+ * Depending on the selected date range in the `lapisFilter`, you can adapt the granularity accordingly
27
+ * (e.g. use months instead of days).
28
+ *
29
+ * The number of rows is limited to 100.
30
+ * If there are more, the component will only show 100 mutations and notify the user.
25
31
  */
26
32
  @customElement('gs-mutations-over-time')
27
33
  export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {