@genspectrum/dashboard-components 0.1.4 → 0.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 (65) hide show
  1. package/custom-elements.json +1021 -804
  2. package/dist/dashboard-components.js +647 -218
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +336 -126
  5. package/dist/style.css +214 -36
  6. package/package.json +4 -4
  7. package/src/preact/aggregatedData/aggregate.stories.tsx +2 -0
  8. package/src/preact/aggregatedData/aggregate.tsx +33 -28
  9. package/src/preact/components/error-boundary.stories.tsx +62 -0
  10. package/src/preact/components/error-boundary.tsx +31 -0
  11. package/src/preact/components/error-display.stories.tsx +24 -3
  12. package/src/preact/components/error-display.tsx +14 -1
  13. package/src/preact/components/headline.stories.tsx +19 -1
  14. package/src/preact/components/headline.tsx +9 -1
  15. package/src/preact/components/info.stories.tsx +24 -3
  16. package/src/preact/components/info.tsx +49 -5
  17. package/src/preact/components/loading-display.stories.tsx +6 -6
  18. package/src/preact/components/loading-display.tsx +1 -1
  19. package/src/preact/components/no-data-display.tsx +5 -1
  20. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +17 -0
  21. package/src/preact/dateRangeSelector/date-range-selector.tsx +43 -15
  22. package/src/preact/locationFilter/location-filter.stories.tsx +23 -6
  23. package/src/preact/locationFilter/location-filter.tsx +29 -18
  24. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +3 -0
  25. package/src/preact/mutationComparison/mutation-comparison.tsx +31 -27
  26. package/src/preact/mutationFilter/mutation-filter.stories.tsx +17 -2
  27. package/src/preact/mutationFilter/mutation-filter.tsx +26 -8
  28. package/src/preact/mutations/mutations.stories.tsx +3 -0
  29. package/src/preact/mutations/mutations.tsx +32 -26
  30. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +4 -0
  31. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +57 -31
  32. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +3 -0
  33. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +89 -32
  34. package/src/preact/textInput/text-input.tsx +26 -3
  35. package/src/web-components/app.stories.ts +1 -2
  36. package/src/web-components/app.ts +4 -2
  37. package/src/web-components/index.ts +1 -1
  38. package/src/web-components/input/{date-range-selector-component.stories.ts → gs-date-range-selector.stories.ts} +35 -3
  39. package/src/web-components/input/gs-date-range-selector.tsx +110 -0
  40. package/src/web-components/input/{location-filter-component.stories.ts → gs-location-filter.stories.ts} +29 -4
  41. package/src/web-components/input/{location-filter-component.tsx → gs-location-filter.tsx} +12 -1
  42. package/src/web-components/input/{mutation-filter-component.stories.ts → gs-mutation-filter.stories.ts} +30 -4
  43. package/src/web-components/input/gs-mutation-filter.tsx +114 -0
  44. package/src/web-components/input/{text-input-component.stories.ts → gs-text-input.stories.ts} +42 -3
  45. package/src/web-components/input/gs-text-input.tsx +73 -0
  46. package/src/web-components/input/index.ts +4 -4
  47. package/src/web-components/visualization/data_visualization_statistical_analysis.mdx +26 -0
  48. package/src/web-components/{display/aggregate-component.stories.ts → visualization/gs-aggregate.stories.ts} +8 -6
  49. package/src/web-components/{display/aggregate-component.tsx → visualization/gs-aggregate.tsx} +16 -2
  50. package/src/web-components/{display/mutation-comparison-component.stories.ts → visualization/gs-mutation-comparison.stories.ts} +11 -9
  51. package/src/web-components/{display/mutation-comparison-component.tsx → visualization/gs-mutation-comparison.tsx} +8 -1
  52. package/src/web-components/{display/mutations-component.stories.ts → visualization/gs-mutations.stories.ts} +30 -11
  53. package/src/web-components/visualization/gs-mutations.tsx +94 -0
  54. package/src/web-components/{display/prevalence-over-time-component.stories.ts → visualization/gs-prevalence-over-time.stories.ts} +24 -1
  55. package/src/web-components/visualization/gs-prevalence-over-time.tsx +148 -0
  56. package/src/web-components/{display/relative-growth-advantage-component.stories.ts → visualization/gs-relative-growth-advantage.stories.ts} +21 -1
  57. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +100 -0
  58. package/src/web-components/visualization/index.ts +5 -0
  59. package/src/web-components/display/index.ts +0 -5
  60. package/src/web-components/display/mutations-component.tsx +0 -40
  61. package/src/web-components/display/prevalence-over-time-component.tsx +0 -58
  62. package/src/web-components/display/relative-growth-advantage-component.tsx +0 -49
  63. package/src/web-components/input/date-range-selector-component.tsx +0 -46
  64. package/src/web-components/input/mutation-filter-component.tsx +0 -35
  65. package/src/web-components/input/text-input-component.tsx +0 -39
@@ -0,0 +1,94 @@
1
+ import { customElement, property } from 'lit/decorators.js';
2
+
3
+ import { Mutations, type View } from '../../preact/mutations/mutations';
4
+ import { type LapisFilter, type SequenceType } from '../../types';
5
+ import type { Equals, Expect } from '../../utils/typeAssertions';
6
+ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
7
+
8
+ /**
9
+ * This component displays mutations (substitutions, deletions and insertions) for a given variant.
10
+ *
11
+ * ## Views
12
+ *
13
+ * ### Table View
14
+ *
15
+ * The table view shows all substitutions and deletions for the given variant.
16
+ * It shows the type (substitution or deletion), the total count of the mutation
17
+ * and the proportion of the mutation in the variant.
18
+ * The proportion is relative to the total number of sequences matching
19
+ * the specified sequence filters with non-ambiguous reads at that position.
20
+ *
21
+ * The proportion interval filter can be used to filter the displayed mutations on client side.
22
+ *
23
+ * ### Grid View
24
+ *
25
+ * The grid view shows the proportion of each sequence symbol (nucleotide or amino acid) for each position that has a mutation.
26
+ * Only positions with at least one mutation in the selected proportion interval are shown.
27
+ *
28
+ * ### Insertions View
29
+ *
30
+ * The insertions view shows the count of all insertions for the given variant.
31
+ *
32
+ */
33
+ @customElement('gs-mutations')
34
+ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
35
+ /**
36
+ * The `variant` will be sent as is to LAPIS to filter the mutation data.
37
+ * It must be a valid LAPIS filter object.
38
+ */
39
+ @property({ type: Object })
40
+ variant: Record<string, string | number | null | boolean> = {};
41
+
42
+ /**
43
+ * The type of the sequence for which the mutations should be shown.
44
+ */
45
+ @property({ type: String })
46
+ sequenceType: 'nucleotide' | 'amino acid' = 'nucleotide';
47
+
48
+ /**
49
+ * A list of tabs with views that this component should provide.
50
+ */
51
+ @property({ type: Array })
52
+ views: ('table' | 'grid' | 'insertions')[] = ['table', 'grid'];
53
+
54
+ /**
55
+ * The size of the component.
56
+ *
57
+ * If not set, the component will take the full width of its container with height 700px.
58
+ *
59
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
60
+ * If the unit is %, the size will be relative to the container of the component.
61
+ */
62
+ @property({ type: Object })
63
+ size: { width?: string; height?: string } | undefined = undefined;
64
+
65
+ /**
66
+ * The headline of the component. Set to an empty string to hide the headline.
67
+ */
68
+ @property({ type: String })
69
+ headline: string | undefined = 'Mutations';
70
+
71
+ override render() {
72
+ return (
73
+ <Mutations
74
+ variant={this.variant}
75
+ sequenceType={this.sequenceType}
76
+ views={this.views}
77
+ size={this.size}
78
+ headline={this.headline}
79
+ />
80
+ );
81
+ }
82
+ }
83
+
84
+ declare global {
85
+ interface HTMLElementTagNameMap {
86
+ 'gs-mutations-component': MutationsComponent;
87
+ }
88
+ }
89
+
90
+ /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
91
+ type VariantsMatches = Expect<Equals<typeof MutationsComponent.prototype.variant, LapisFilter>>;
92
+ type SequenceTypeMatches = Expect<Equals<typeof MutationsComponent.prototype.sequenceType, SequenceType>>;
93
+ type ViewsMatches = Expect<Equals<typeof MutationsComponent.prototype.views, View[]>>;
94
+ /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -3,7 +3,8 @@ import type { Meta, StoryObj } from '@storybook/web-components';
3
3
  import { html } from 'lit';
4
4
 
5
5
  import '../app';
6
- import './prevalence-over-time-component';
6
+ import './gs-prevalence-over-time';
7
+ import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
7
8
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
8
9
  import denominator from '../../preact/prevalenceOverTime/__mockData__/denominator.json';
9
10
  import denominatorOneVariant from '../../preact/prevalenceOverTime/__mockData__/denominatorOneVariant.json';
@@ -13,6 +14,16 @@ import numeratorOneVariant from '../../preact/prevalenceOverTime/__mockData__/nu
13
14
  import { type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
14
15
  import { withinShadowRoot } from '../withinShadowRoot.story';
15
16
 
17
+ const codeExample = String.raw`
18
+ <gs-prevalence-over-time
19
+ numerator='[{ "displayName": "EG", "country": "USA", "pangoLineage": "EG*" }, { "displayName": "JN.1", "country": "USA", "pangoLineage": "JN.1*" }]'
20
+ denominator='{ "country": "USA", "displayName": "All" }'
21
+ granularity="month"
22
+ smoothingWindow="0"
23
+ views='["bar", "line", "bubble", "table"]'
24
+ confidenceIntervalMethods='["wilson"]'
25
+ ></gs-prevalence-over-time>`;
26
+
16
27
  const meta: Meta<PrevalenceOverTimeProps> = {
17
28
  title: 'Visualization/Prevalence over time',
18
29
  component: 'gs-prevalence-over-time',
@@ -33,7 +44,16 @@ const meta: Meta<PrevalenceOverTimeProps> = {
33
44
  control: { type: 'check' },
34
45
  },
35
46
  size: [{ control: 'object' }],
47
+ headline: { control: 'text' },
36
48
  },
49
+ parameters: withComponentDocs({
50
+ componentDocs: {
51
+ opensShadowDom: true,
52
+ expectsChildren: false,
53
+ codeExample,
54
+ },
55
+ }),
56
+ tags: ['autodocs'],
37
57
  };
38
58
 
39
59
  export default meta;
@@ -49,6 +69,7 @@ const Template: StoryObj<PrevalenceOverTimeProps> = {
49
69
  .views=${args.views}
50
70
  .confidenceIntervalMethods=${args.confidenceIntervalMethods}
51
71
  .size=${args.size}
72
+ .headline=${args.headline}
52
73
  ></gs-prevalence-over-time>
53
74
  </gs-app>
54
75
  `,
@@ -67,6 +88,7 @@ export const TwoVariants: StoryObj<PrevalenceOverTimeProps> = {
67
88
  views: ['bar', 'line', 'bubble', 'table'],
68
89
  confidenceIntervalMethods: ['wilson'],
69
90
  size: { width: '100%', height: '700px' },
91
+ headline: 'Prevalence over time',
70
92
  },
71
93
  parameters: {
72
94
  fetchMock: {
@@ -133,6 +155,7 @@ export const OneVariant: StoryObj<PrevalenceOverTimeProps> = {
133
155
  views: ['bar', 'line', 'bubble', 'table'],
134
156
  confidenceIntervalMethods: ['wilson'],
135
157
  size: { width: '100%', height: '700px' },
158
+ headline: 'Prevalence over time',
136
159
  },
137
160
  parameters: {
138
161
  fetchMock: {
@@ -0,0 +1,148 @@
1
+ import { customElement, property } from 'lit/decorators.js';
2
+
3
+ import PrevalenceOverTime, { type View } from '../../preact/prevalenceOverTime/prevalence-over-time';
4
+ import { type ConfidenceIntervalMethod } from '../../preact/shared/charts/confideceInterval';
5
+ import { type NamedLapisFilter, type TemporalGranularity } from '../../types';
6
+ import { type Equals, type Expect } from '../../utils/typeAssertions';
7
+ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
8
+
9
+ /**
10
+ * This component displays the prevalence over time of one or more variants.
11
+ * The prevalence is calculated as the ratio of the number of cases of each variant given as `numerator`
12
+ * to the number of cases of the variant given as `denominator`.
13
+ *
14
+ * In the chart views,
15
+ * - the user can select whether to display a confidence interval (not available in the bubble chart).
16
+ * The confidence interval is calculated using [Wilson score interval](https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval),
17
+ * with a confidence level of 95%.
18
+ * - the x-axis shows time steps in the selected `granularity`.
19
+ * - the user can select the y-axis scale (linear, logistic, logit).
20
+ *
21
+ * ## Views
22
+ *
23
+ * ### Bar View
24
+ *
25
+ * Displays the prevalence over time as a bar chart.
26
+ * Shows a bar for each variant in the `numerator` on every time step.
27
+ *
28
+ * ### Line View
29
+ *
30
+ * Displays the prevalence over time as a line chart.
31
+ * Each data point is connected for better visibility.
32
+ * Shows a line for each variant in the `numerator`.
33
+ *
34
+ * ### Bubble View
35
+ *
36
+ * Displays the prevalence over time as a bubble chart.
37
+ * The size of the bubbles represents the number of cases of the `denominator` variant.
38
+ * The height of the bubbles represents the prevalence of the `numerator` variants.
39
+ *
40
+ * ### Table View
41
+ *
42
+ * Displays the prevalence over time as a table with one row per time point.
43
+ */
44
+ @customElement('gs-prevalence-over-time')
45
+ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
46
+ // prettier-ignore
47
+ // The multiline union type must not start with `|` because it looks weird in the Storybook docs
48
+ /**
49
+ * Either a single variant or an array of variants to compare.
50
+ * This must be a valid LAPIS filter object with an additional `displayName` property
51
+ * which will be used as the label for the variant in the views,
52
+ * or an array of such objects.
53
+ */
54
+ @property({ type: Object })
55
+ numerator:
56
+ (Record<string, string | number | null | boolean> & { displayName: string })
57
+ | (Record<string, string | number | null | boolean> & {
58
+ displayName: string;
59
+ })[] = { displayName: '' };
60
+
61
+ /**
62
+ * The variant that the variants in `numerator` are compared to.
63
+ */
64
+ @property({ type: Object })
65
+ denominator: Record<string, string | number | null | boolean> & { displayName: string } = { displayName: '' };
66
+
67
+ /**
68
+ * The granularity of the time axis.
69
+ */
70
+ @property({ type: String })
71
+ granularity: 'day' | 'week' | 'month' | 'year' = 'day';
72
+
73
+ /**
74
+ * The number of time steps to use for smoothing the data.
75
+ * `0` means no smoothing.
76
+ * Must be a non-negative integer.
77
+ *
78
+ * For a given time, the shown value is the mean of the neighbouring measured values.
79
+ * The `smoothingWindow` value provides the number of neighbouring values to take into account.
80
+ * The resulting time is computed via `Math.floor(smoothingWindow / 2)`.
81
+ */
82
+ @property({ type: Number })
83
+ smoothingWindow: number = 0;
84
+
85
+ /**
86
+ * A list of tabs with views that this component should provide.
87
+ */
88
+ @property({ type: Array })
89
+ views: ('bar' | 'line' | 'bubble' | 'table')[] = ['bar', 'line', 'bubble', 'table'];
90
+
91
+ /**
92
+ * A list of methods to calculate the confidence interval.
93
+ * The option `none` is always available and disables confidence intervals.
94
+ * Pass an empty array to disable the confidence interval selector.
95
+ */
96
+ @property({ type: Array })
97
+ confidenceIntervalMethods: ('wilson' | 'none')[] = ['wilson'];
98
+
99
+ /**
100
+ * The headline of the component. Set to an empty string to hide the headline.
101
+ */
102
+ @property({ type: String })
103
+ headline: string | undefined = 'Prevalence over time';
104
+
105
+ /**
106
+ * The size of the component.
107
+ *
108
+ * If not set, the component will take the full width of its container with height 700px.
109
+ *
110
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
111
+ * If the unit is %, the size will be relative to the container of the component.
112
+ */
113
+ @property({ type: Object })
114
+ size: { width?: string; height?: string } | undefined = undefined;
115
+
116
+ override render() {
117
+ return (
118
+ <PrevalenceOverTime
119
+ numerator={this.numerator}
120
+ denominator={this.denominator}
121
+ granularity={this.granularity}
122
+ smoothingWindow={this.smoothingWindow}
123
+ views={this.views}
124
+ confidenceIntervalMethods={this.confidenceIntervalMethods}
125
+ size={this.size}
126
+ headline={this.headline}
127
+ />
128
+ );
129
+ }
130
+ }
131
+
132
+ declare global {
133
+ interface HTMLElementTagNameMap {
134
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
135
+ }
136
+ }
137
+
138
+ /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
139
+ type NumeratorMatches = Expect<
140
+ Equals<typeof PrevalenceOverTimeComponent.prototype.numerator, NamedLapisFilter | NamedLapisFilter[]>
141
+ >;
142
+ type DenominatorMatches = Expect<Equals<typeof PrevalenceOverTimeComponent.prototype.denominator, NamedLapisFilter>>;
143
+ type GranularityMatches = Expect<Equals<typeof PrevalenceOverTimeComponent.prototype.granularity, TemporalGranularity>>;
144
+ type ViewsMatches = Expect<Equals<typeof PrevalenceOverTimeComponent.prototype.views, View[]>>;
145
+ type ConfidenceIntervalMethodsMatches = Expect<
146
+ Equals<typeof PrevalenceOverTimeComponent.prototype.confidenceIntervalMethods, ConfidenceIntervalMethod[]>
147
+ >;
148
+ /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -1,13 +1,22 @@
1
1
  import type { Meta, StoryObj } from '@storybook/web-components';
2
2
  import { html } from 'lit';
3
3
 
4
- import './relative-growth-advantage-component';
4
+ import './gs-relative-growth-advantage';
5
5
  import '../app';
6
+ import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
6
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
7
8
  import denominator from '../../preact/relativeGrowthAdvantage/__mockData__/denominator.json';
8
9
  import numerator from '../../preact/relativeGrowthAdvantage/__mockData__/numerator.json';
9
10
  import { type RelativeGrowthAdvantageProps } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
10
11
 
12
+ const codeExample = String.raw`
13
+ <gs-relative-growth-advantage
14
+ numerator='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateFrom": "2020-12-01" }'
15
+ denominator='{ "country": "Switzerland", "dateFrom": "2020-12-01" }'
16
+ generationTime="7"
17
+ views='["line"]'
18
+ ></gs-relative-growth-advantage>`;
19
+
11
20
  const meta: Meta<RelativeGrowthAdvantageProps> = {
12
21
  title: 'Visualization/Relative growth advantage',
13
22
  component: 'gs-relative-growth-advantage',
@@ -20,7 +29,16 @@ const meta: Meta<RelativeGrowthAdvantageProps> = {
20
29
  control: { type: 'check' },
21
30
  },
22
31
  size: [{ control: 'object' }],
32
+ headline: { control: 'text' },
23
33
  },
34
+ parameters: withComponentDocs({
35
+ componentDocs: {
36
+ opensShadowDom: true,
37
+ expectsChildren: false,
38
+ codeExample,
39
+ },
40
+ }),
41
+ tags: ['autodocs'],
24
42
  };
25
43
 
26
44
  export default meta;
@@ -34,6 +52,7 @@ const Template: StoryObj<RelativeGrowthAdvantageProps> = {
34
52
  .generationTime=${args.generationTime}
35
53
  .views=${args.views}
36
54
  .size=${args.size}
55
+ .headline=${args.headline}
37
56
  ></gs-relative-growth-advantage>
38
57
  </gs-app>
39
58
  `,
@@ -47,6 +66,7 @@ export const Default: StoryObj<RelativeGrowthAdvantageProps> = {
47
66
  generationTime: 7,
48
67
  views: ['line'],
49
68
  size: { width: '100%', height: '700px' },
69
+ headline: 'Relative growth advantage',
50
70
  },
51
71
  parameters: {
52
72
  fetchMock: {
@@ -0,0 +1,100 @@
1
+ import { customElement, property } from 'lit/decorators.js';
2
+
3
+ import { RelativeGrowthAdvantage, type View } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
4
+ import type { LapisFilter } from '../../types';
5
+ import { type Equals, type Expect } from '../../utils/typeAssertions';
6
+ import { PreactLitAdapter } from '../PreactLitAdapter';
7
+
8
+ /**
9
+ * We assume a discrete time model, where new infections happen exactly every `generationTime` days.
10
+ * This is what we call a "generation".
11
+ *
12
+ * This component estimates the relative growth advantage of a variant by performing a logistic regression.
13
+ * Based on the inferred logistic growth rate, we derive the relative growth advantage (per generation).
14
+ *
15
+ * For details on the scientific method, see:
16
+ * Chen, Chaoran, et al. "Quantification of the spread of SARS-CoV-2 variant B.1.1.7 in Switzerland." Epidemics (2021);
17
+ * doi: [10.1016/j.epidem.2021.100480](https://doi.org/10.1016/j.epidem.2021.100480)
18
+ *
19
+ * This component fetches aggregated data from LAPIS.
20
+ * Then the data is sent to `https://cov-spectrum.org/api/v2/computed/model/chen2021Fitness`
21
+ * which performs the logistic regression and calculates the relative growth advantage.
22
+ *
23
+ * ## Views
24
+ *
25
+ * ### Line View
26
+ *
27
+ * The line view shows the relative growth advantage over time in a line chart.
28
+ * The dots in the plot show the proportions of the focal variant (`numerator`) to the `denominator` variant
29
+ * for every day as observed in the data.
30
+ * The line shows a logistic curve fitted to the data points, including a 95% confidence interval.
31
+ */
32
+ @customElement('gs-relative-growth-advantage')
33
+ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
34
+ /**
35
+ * The LAPIS filter for the focal variant.
36
+ */
37
+ @property({ type: Object })
38
+ numerator: Record<string, string | number | null | boolean> = {};
39
+
40
+ /**
41
+ * The LAPIS filter for the variant that the focal variant (`numerator`) should be compared to.
42
+ */
43
+ @property({ type: Object })
44
+ denominator: Record<string, string | number | null | boolean> = {};
45
+
46
+ /**
47
+ * The generation time represents the number of days over which the variant's relative growth advantage is measured.
48
+ * For example, if we set a generation time of 7 days, then we estimate the growth advantage per week.
49
+ */
50
+ @property({ type: Number })
51
+ generationTime: number = 7;
52
+
53
+ /**
54
+ * A list of tabs with views that this component should provide.
55
+ */
56
+ @property({ type: Array })
57
+ views: 'line'[] = ['line'];
58
+
59
+ /**
60
+ * The headline of the component. Set to an empty string to hide the headline.
61
+ */
62
+ @property({ type: String })
63
+ headline: string | undefined = 'Relative growth advantage';
64
+
65
+ /**
66
+ * The size of the component.
67
+ *
68
+ * If not set, the component will take the full width of its container with height 700px.
69
+ *
70
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
71
+ * If the unit is %, the size will be relative to the container of the component.
72
+ */
73
+ @property({ type: Object })
74
+ size: { width?: string; height?: string } | undefined = undefined;
75
+
76
+ override render() {
77
+ return (
78
+ <RelativeGrowthAdvantage
79
+ numerator={this.numerator}
80
+ denominator={this.denominator}
81
+ generationTime={this.generationTime}
82
+ views={this.views}
83
+ size={this.size}
84
+ headline={this.headline}
85
+ />
86
+ );
87
+ }
88
+ }
89
+
90
+ declare global {
91
+ interface HTMLElementTagNameMap {
92
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
93
+ }
94
+ }
95
+
96
+ /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
97
+ type NumeratorMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.numerator, LapisFilter>>;
98
+ type DenominatorMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.denominator, LapisFilter>>;
99
+ type ViewsMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.views, View[]>>;
100
+ /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -0,0 +1,5 @@
1
+ export { MutationComparisonComponent } from './gs-mutation-comparison';
2
+ export { MutationsComponent } from './gs-mutations';
3
+ export { PrevalenceOverTimeComponent } from './gs-prevalence-over-time';
4
+ export { RelativeGrowthAdvantageComponent } from './gs-relative-growth-advantage';
5
+ export { AggregateComponent } from './gs-aggregate';
@@ -1,5 +0,0 @@
1
- export { MutationComparisonComponent } from './mutation-comparison-component';
2
- export { MutationsComponent } from './mutations-component';
3
- export { PrevalenceOverTimeComponent } from './prevalence-over-time-component';
4
- export { RelativeGrowthAdvantageComponent } from './relative-growth-advantage-component';
5
- export { AggregateComponent } from './aggregate-component';
@@ -1,40 +0,0 @@
1
- import { customElement, property } from 'lit/decorators.js';
2
-
3
- import { Mutations, type View } from '../../preact/mutations/mutations';
4
- import { type LapisFilter, type SequenceType } from '../../types';
5
- import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
6
-
7
- @customElement('gs-mutations-component')
8
- export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
9
- @property({ type: Object })
10
- variant: LapisFilter = { displayName: '' };
11
-
12
- @property({ type: String })
13
- sequenceType: SequenceType = 'nucleotide';
14
-
15
- @property({ type: Array })
16
- views: View[] = ['table', 'grid'];
17
-
18
- /**
19
- * The size of the component.
20
- *
21
- * If not set, the component will take the full width of its container with height 700px.
22
- *
23
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
24
- * If the unit is %, the size will be relative to the container of the component.
25
- */
26
- @property({ type: Object })
27
- size: { width?: string; height?: string } | undefined = undefined;
28
-
29
- override render() {
30
- return (
31
- <Mutations variant={this.variant} sequenceType={this.sequenceType} views={this.views} size={this.size} />
32
- );
33
- }
34
- }
35
-
36
- declare global {
37
- interface HTMLElementTagNameMap {
38
- 'gs-mutations-component': MutationsComponent;
39
- }
40
- }
@@ -1,58 +0,0 @@
1
- import { customElement, property } from 'lit/decorators.js';
2
-
3
- import PrevalenceOverTime, { type View } from '../../preact/prevalenceOverTime/prevalence-over-time';
4
- import { type ConfidenceIntervalMethod } from '../../preact/shared/charts/confideceInterval';
5
- import { type NamedLapisFilter, type TemporalGranularity } from '../../types';
6
- import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
7
-
8
- @customElement('gs-prevalence-over-time')
9
- export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
10
- @property({ type: Object })
11
- numerator: NamedLapisFilter | NamedLapisFilter[] = { displayName: '' };
12
-
13
- @property({ type: Object })
14
- denominator: NamedLapisFilter = { displayName: '' };
15
-
16
- @property({ type: String })
17
- granularity: TemporalGranularity = 'day';
18
-
19
- @property({ type: Number })
20
- smoothingWindow: number = 0;
21
-
22
- @property({ type: Array })
23
- views: View[] = ['bar', 'line', 'bubble', 'table'];
24
-
25
- @property({ type: Array })
26
- confidenceIntervalMethods: ConfidenceIntervalMethod[] = ['wilson'];
27
-
28
- /**
29
- * The size of the component.
30
- *
31
- * If not set, the component will take the full width of its container with height 700px.
32
- *
33
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
34
- * If the unit is %, the size will be relative to the container of the component.
35
- */
36
- @property({ type: Object })
37
- size: { width?: string; height?: string } | undefined = undefined;
38
-
39
- override render() {
40
- return (
41
- <PrevalenceOverTime
42
- numerator={this.numerator}
43
- denominator={this.denominator}
44
- granularity={this.granularity}
45
- smoothingWindow={this.smoothingWindow}
46
- views={this.views}
47
- confidenceIntervalMethods={this.confidenceIntervalMethods}
48
- size={this.size}
49
- />
50
- );
51
- }
52
- }
53
-
54
- declare global {
55
- interface HTMLElementTagNameMap {
56
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
57
- }
58
- }
@@ -1,49 +0,0 @@
1
- import { customElement, property } from 'lit/decorators.js';
2
-
3
- import { RelativeGrowthAdvantage, type View } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
4
- import type { LapisFilter } from '../../types';
5
- import { PreactLitAdapter } from '../PreactLitAdapter';
6
-
7
- @customElement('gs-relative-growth-advantage')
8
- export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
9
- @property({ type: Object })
10
- numerator: LapisFilter = {};
11
-
12
- @property({ type: Object })
13
- denominator: LapisFilter = {};
14
-
15
- @property({ type: Number })
16
- generationTime: number = 7;
17
-
18
- @property({ type: Array })
19
- views: View[] = ['line'];
20
-
21
- /**
22
- * The size of the component.
23
- *
24
- * If not set, the component will take the full width of its container with height 700px.
25
- *
26
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
27
- * If the unit is %, the size will be relative to the container of the component.
28
- */
29
- @property({ type: Object })
30
- size: { width?: string; height?: string } | undefined = undefined;
31
-
32
- override render() {
33
- return (
34
- <RelativeGrowthAdvantage
35
- numerator={this.numerator}
36
- denominator={this.denominator}
37
- generationTime={this.generationTime}
38
- views={this.views}
39
- size={this.size}
40
- />
41
- );
42
- }
43
- }
44
-
45
- declare global {
46
- interface HTMLElementTagNameMap {
47
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
48
- }
49
- }
@@ -1,46 +0,0 @@
1
- import { customElement, property } from 'lit/decorators.js';
2
-
3
- import {
4
- type CustomSelectOption,
5
- DateRangeSelector,
6
- type PresetOptionValues,
7
- } from '../../preact/dateRangeSelector/date-range-selector';
8
- import { PreactLitAdapter } from '../PreactLitAdapter';
9
-
10
- /**
11
- * @fires {CustomEvent<{ dateFrom: string; dateTo: string; }>} gs-date-range-changed - When the date range has changed
12
- */
13
- @customElement('gs-date-range-selector')
14
- export class DateRangeSelectorComponent<CustomLabel extends string> extends PreactLitAdapter {
15
- @property({ type: Array })
16
- customSelectOptions: CustomSelectOption<CustomLabel>[] = [];
17
-
18
- @property({ type: String })
19
- earliestDate: string | undefined = '1900-01-01';
20
-
21
- @property()
22
- initialValue: PresetOptionValues | CustomLabel | string | undefined = '';
23
-
24
- override render() {
25
- return (
26
- <DateRangeSelector
27
- customSelectOptions={this.customSelectOptions}
28
- earliestDate={this.earliestDate}
29
- initialValue={this.initialValue}
30
- />
31
- );
32
- }
33
- }
34
-
35
- declare global {
36
- interface HTMLElementTagNameMap {
37
- 'gs-date-range-selector': DateRangeSelectorComponent<string>;
38
- }
39
-
40
- interface HTMLElementEventMap {
41
- 'gs-date-range-changed': CustomEvent<{
42
- dateFrom: string;
43
- dateTo: string;
44
- }>;
45
- }
46
- }