@genspectrum/dashboard-components 0.5.4 → 0.5.5

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 (34) hide show
  1. package/custom-elements.json +306 -0
  2. package/dist/dashboard-components.js +394 -263
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +80 -2
  5. package/package.json +1 -1
  6. package/src/preact/aggregatedData/aggregate.tsx +2 -14
  7. package/src/preact/dateRangeSelector/date-range-selector.tsx +2 -14
  8. package/src/preact/locationFilter/location-filter.tsx +2 -7
  9. package/src/preact/mutationComparison/mutation-comparison.tsx +2 -10
  10. package/src/preact/mutations/mutations.tsx +2 -10
  11. package/src/preact/numberSequencesOverTime/__mockData__/oneVariantEG.json +1702 -0
  12. package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsEG.json +1710 -0
  13. package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsJN1.json +1070 -0
  14. package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsXBB.json +506 -0
  15. package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.spec.ts +75 -0
  16. package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +39 -0
  17. package/src/preact/numberSequencesOverTime/number-sequences-over-time-bar-chart.tsx +58 -0
  18. package/src/preact/numberSequencesOverTime/number-sequences-over-time-table.tsx +32 -0
  19. package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +133 -0
  20. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +105 -0
  21. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +11 -20
  22. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +2 -20
  23. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +2 -14
  24. package/src/preact/textInput/text-input.tsx +2 -2
  25. package/src/query/queryAggregatedDataOverTime.ts +78 -0
  26. package/src/query/queryNumberOfSequencesOverTime.spec.ts +195 -0
  27. package/src/query/queryNumberOfSequencesOverTime.ts +33 -0
  28. package/src/query/queryPrevalenceOverTime.ts +10 -86
  29. package/src/utils/sort.ts +9 -0
  30. package/src/utils/temporalTestHelpers.ts +9 -0
  31. package/src/utils/utils.ts +7 -0
  32. package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +232 -0
  33. package/src/web-components/visualization/gs-number-sequences-over-time.tsx +140 -0
  34. package/src/web-components/visualization/index.ts +1 -0
@@ -453,6 +453,77 @@ export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles
453
453
  render(): JSX_2.Element;
454
454
  }
455
455
 
456
+ /**
457
+ * TODO(#330) write docs
458
+ */
459
+ export declare class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
460
+ /**
461
+ * Required.
462
+ * Either a LAPIS filter or an array of LAPIS filters to calculate the prevalence for.
463
+ *
464
+ * The `lapisFilter` will be sent as is to LAPIS to select the data.
465
+ * It must be a valid LAPIS filter object.
466
+ *
467
+ * The `displayName` will be used as the label the prevalence in the views.
468
+ * It should be human-readable.
469
+ *
470
+ */ lapisFilter: {
471
+ lapisFilter: Record<string, string | number | null | boolean>;
472
+ displayName: string;
473
+ } | {
474
+ lapisFilter: Record<string, string | number | null | boolean>;
475
+ displayName: string;
476
+ }[];
477
+ /**
478
+ * Required.
479
+ *
480
+ * The LAPIS field that the data should be aggregated by.
481
+ * The values will be used on the x-axis of the diagram.
482
+ * Must be a field of type `date` in LAPIS.
483
+ */
484
+ lapisDateField: string;
485
+ /**
486
+ * A list of tabs with views that this component should provide.
487
+ */
488
+ views: ('bar' | 'line' | 'table')[];
489
+ /**
490
+ * The headline of the component. Set to an empty string to hide the headline.
491
+ */
492
+ headline: string;
493
+ /**
494
+ * The width of the component.
495
+ *
496
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
497
+ */
498
+ width: string;
499
+ /**
500
+ * The height of the component.
501
+ *
502
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
503
+ */
504
+ height: string;
505
+ /**
506
+ * The granularity of the time axis.
507
+ */
508
+ granularity: 'day' | 'week' | 'month' | 'year';
509
+ /**
510
+ * The number of time steps to use for smoothing the data.
511
+ * `0` means no smoothing.
512
+ * Must be a non-negative integer.
513
+ *
514
+ * For a given time, the shown value is the mean of the neighbouring measured values.
515
+ * The `smoothingWindow` value provides the number of neighbouring values to take into account.
516
+ * The resulting time is computed via `Math.floor(smoothingWindow / 2)`.
517
+ */
518
+ smoothingWindow: number;
519
+ /**
520
+ * The maximum number of rows to display in the table view.
521
+ * Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
522
+ */
523
+ pageSize: boolean | number;
524
+ render(): JSX_2.Element;
525
+ }
526
+
456
527
  declare abstract class PreactLitAdapter extends ReactiveElement {
457
528
  static styles: CSSResult[];
458
529
  /* Excluded from this release type: lapis */
@@ -805,14 +876,14 @@ declare global {
805
876
 
806
877
  declare global {
807
878
  interface HTMLElementTagNameMap {
808
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
879
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
809
880
  }
810
881
  }
811
882
 
812
883
 
813
884
  declare global {
814
885
  interface HTMLElementTagNameMap {
815
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
886
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
816
887
  }
817
888
  }
818
889
 
@@ -824,6 +895,13 @@ declare global {
824
895
  }
825
896
 
826
897
 
898
+ declare global {
899
+ interface HTMLElementTagNameMap {
900
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
901
+ }
902
+ }
903
+
904
+
827
905
  declare global {
828
906
  interface HTMLElementTagNameMap {
829
907
  'gs-date-range-selector': DateRangeSelectorComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -35,15 +35,10 @@ export interface AggregateInnerProps {
35
35
  }
36
36
 
37
37
  export const Aggregate: FunctionComponent<AggregateProps> = ({
38
- views,
39
38
  width,
40
39
  height,
41
40
  headline = 'Mutations',
42
- filter,
43
- fields,
44
- pageSize,
45
- initialSortField,
46
- initialSortDirection,
41
+ ...innerProps
47
42
  }) => {
48
43
  const size = { height, width };
49
44
 
@@ -51,14 +46,7 @@ export const Aggregate: FunctionComponent<AggregateProps> = ({
51
46
  <ErrorBoundary size={size} headline={headline}>
52
47
  <ResizeContainer size={size}>
53
48
  <Headline heading={headline}>
54
- <AggregateInner
55
- fields={fields}
56
- filter={filter}
57
- views={views}
58
- initialSortField={initialSortField}
59
- initialSortDirection={initialSortDirection}
60
- pageSize={pageSize}
61
- />
49
+ <AggregateInner {...innerProps} />
62
50
  </Headline>
63
51
  </ResizeContainer>
64
52
  </ErrorBoundary>
@@ -28,27 +28,15 @@ export interface DateRangeSelectorPropsInner<CustomLabel extends string> {
28
28
  }
29
29
 
30
30
  export const DateRangeSelector = <CustomLabel extends string>({
31
- customSelectOptions,
32
- earliestDate = '1900-01-01',
33
- initialValue,
34
31
  width,
35
- dateColumn,
36
- initialDateFrom,
37
- initialDateTo,
32
+ ...innerProps
38
33
  }: DateRangeSelectorProps<CustomLabel>) => {
39
34
  const size = { width, height: '3rem' };
40
35
 
41
36
  return (
42
37
  <ErrorBoundary size={size}>
43
38
  <div style={{ width }}>
44
- <DateRangeSelectorInner
45
- customSelectOptions={customSelectOptions}
46
- earliestDate={earliestDate}
47
- initialValue={initialValue}
48
- dateColumn={dateColumn}
49
- initialDateFrom={initialDateFrom}
50
- initialDateTo={initialDateTo}
51
- />
39
+ <DateRangeSelectorInner {...innerProps} />
52
40
  </div>
53
41
  </ErrorBoundary>
54
42
  );
@@ -20,18 +20,13 @@ export interface LocationFilterProps extends LocationFilterInnerProps {
20
20
  width: string;
21
21
  }
22
22
 
23
- export const LocationFilter: FunctionComponent<LocationFilterProps> = ({
24
- width,
25
- initialValue,
26
- fields,
27
- placeholderText,
28
- }) => {
23
+ export const LocationFilter: FunctionComponent<LocationFilterProps> = ({ width, ...innerProps }) => {
29
24
  const size = { width, height: '3rem' };
30
25
 
31
26
  return (
32
27
  <ErrorBoundary size={size}>
33
28
  <ResizeContainer size={size}>
34
- <LocationFilterInner initialValue={initialValue} fields={fields} placeholderText={placeholderText} />
29
+ <LocationFilterInner {...innerProps} />
35
30
  </ResizeContainer>
36
31
  </ErrorBoundary>
37
32
  );
@@ -38,13 +38,10 @@ export interface MutationComparisonInnerProps {
38
38
  }
39
39
 
40
40
  export const MutationComparison: FunctionComponent<MutationComparisonProps> = ({
41
- lapisFilters,
42
- sequenceType,
43
- views,
44
41
  width,
45
42
  height,
46
43
  headline = 'Mutation comparison',
47
- pageSize,
44
+ ...innerProps
48
45
  }) => {
49
46
  const size = { height, width };
50
47
 
@@ -52,12 +49,7 @@ export const MutationComparison: FunctionComponent<MutationComparisonProps> = ({
52
49
  <ErrorBoundary size={size} headline={headline}>
53
50
  <ResizeContainer size={size}>
54
51
  <Headline heading={headline}>
55
- <MutationComparisonInner
56
- lapisFilters={lapisFilters}
57
- sequenceType={sequenceType}
58
- views={views}
59
- pageSize={pageSize}
60
- />
52
+ <MutationComparisonInner {...innerProps} />
61
53
  </Headline>
62
54
  </ResizeContainer>
63
55
  </ErrorBoundary>
@@ -45,13 +45,10 @@ export interface MutationsProps extends MutationsInnerProps {
45
45
  }
46
46
 
47
47
  export const Mutations: FunctionComponent<MutationsProps> = ({
48
- lapisFilter,
49
- sequenceType,
50
- views,
51
48
  width,
52
49
  height,
53
50
  headline = 'Mutations',
54
- pageSize,
51
+ ...innerProps
55
52
  }) => {
56
53
  const size = { height, width };
57
54
 
@@ -59,12 +56,7 @@ export const Mutations: FunctionComponent<MutationsProps> = ({
59
56
  <ErrorBoundary size={size} headline={headline}>
60
57
  <ResizeContainer size={size}>
61
58
  <Headline heading={headline}>
62
- <MutationsInner
63
- lapisFilter={lapisFilter}
64
- sequenceType={sequenceType}
65
- views={views}
66
- pageSize={pageSize}
67
- />
59
+ <MutationsInner {...innerProps} />
68
60
  </Headline>
69
61
  </ResizeContainer>
70
62
  </ErrorBoundary>