@genspectrum/dashboard-components 0.5.4 → 0.5.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.
- package/custom-elements.json +322 -0
- package/dist/dashboard-components.js +436 -263
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +78 -0
- package/package.json +1 -1
- package/src/preact/aggregatedData/aggregate.tsx +2 -14
- package/src/preact/dateRangeSelector/date-range-selector.tsx +2 -14
- package/src/preact/locationFilter/location-filter.tsx +2 -7
- package/src/preact/mutationComparison/mutation-comparison.tsx +2 -10
- package/src/preact/mutations/mutations.tsx +2 -10
- package/src/preact/numberSequencesOverTime/__mockData__/oneVariantEG.json +1702 -0
- package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsEG.json +1710 -0
- package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsJN1.json +1070 -0
- package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsXBB.json +506 -0
- package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.spec.ts +75 -0
- package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +39 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-bar-chart.tsx +58 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-line-chart.tsx +59 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-table.tsx +32 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +133 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +106 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +11 -20
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +2 -20
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +2 -14
- package/src/preact/textInput/text-input.tsx +2 -2
- package/src/query/queryAggregatedDataOverTime.ts +78 -0
- package/src/query/queryNumberOfSequencesOverTime.spec.ts +195 -0
- package/src/query/queryNumberOfSequencesOverTime.ts +33 -0
- package/src/query/queryPrevalenceOverTime.ts +10 -86
- package/src/utils/sort.ts +9 -0
- package/src/utils/temporalTestHelpers.ts +9 -0
- package/src/utils/utils.ts +7 -0
- package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +243 -0
- package/src/web-components/visualization/gs-number-sequences-over-time.tsx +140 -0
- package/src/web-components/visualization/index.ts +1 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
NumberSequencesOverTime,
|
|
5
|
+
type NumberSequencesOverTimeProps,
|
|
6
|
+
} from '../../preact/numberSequencesOverTime/number-sequences-over-time';
|
|
7
|
+
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
8
|
+
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* TODO(#330) write docs
|
|
12
|
+
*/
|
|
13
|
+
@customElement('gs-number-sequences-over-time')
|
|
14
|
+
export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
|
|
15
|
+
// prettier-ignore
|
|
16
|
+
// The multiline union type must not start with `|` because it looks weird in the Storybook docs
|
|
17
|
+
/**
|
|
18
|
+
* Required.
|
|
19
|
+
* Either a LAPIS filter or an array of LAPIS filters to calculate the prevalence for.
|
|
20
|
+
*
|
|
21
|
+
* The `lapisFilter` will be sent as is to LAPIS to select the data.
|
|
22
|
+
* It must be a valid LAPIS filter object.
|
|
23
|
+
*
|
|
24
|
+
* The `displayName` will be used as the label the prevalence in the views.
|
|
25
|
+
* It should be human-readable.
|
|
26
|
+
*
|
|
27
|
+
*/ @property({type: Object})
|
|
28
|
+
lapisFilter:
|
|
29
|
+
{
|
|
30
|
+
lapisFilter: Record<string, string | number | null | boolean>;
|
|
31
|
+
displayName: string;
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
lapisFilter: Record<string, string | number | null | boolean>;
|
|
35
|
+
displayName: string;
|
|
36
|
+
}[]= { displayName: '', lapisFilter: {} };
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Required.
|
|
40
|
+
*
|
|
41
|
+
* The LAPIS field that the data should be aggregated by.
|
|
42
|
+
* The values will be used on the x-axis of the diagram.
|
|
43
|
+
* Must be a field of type `date` in LAPIS.
|
|
44
|
+
*/
|
|
45
|
+
@property({ type: String })
|
|
46
|
+
lapisDateField: string = 'date';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A list of tabs with views that this component should provide.
|
|
50
|
+
*/
|
|
51
|
+
@property({ type: Array })
|
|
52
|
+
views: ('bar' | 'line' | 'table')[] = ['bar', 'line', 'table'];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The headline of the component. Set to an empty string to hide the headline.
|
|
56
|
+
*/
|
|
57
|
+
@property({ type: String })
|
|
58
|
+
headline: string = 'Number of sequences of time';
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The width of the component.
|
|
62
|
+
*
|
|
63
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
64
|
+
*/
|
|
65
|
+
@property({ type: String })
|
|
66
|
+
width: string = '100%';
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The height of the component.
|
|
70
|
+
*
|
|
71
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
72
|
+
*/
|
|
73
|
+
@property({ type: String })
|
|
74
|
+
height: string = '700px';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The granularity of the time axis.
|
|
78
|
+
*/
|
|
79
|
+
@property({ type: String })
|
|
80
|
+
granularity: 'day' | 'week' | 'month' | 'year' = 'day';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The number of time steps to use for smoothing the data.
|
|
84
|
+
* `0` means no smoothing.
|
|
85
|
+
* Must be a non-negative integer.
|
|
86
|
+
*
|
|
87
|
+
* For a given time, the shown value is the mean of the neighbouring measured values.
|
|
88
|
+
* The `smoothingWindow` value provides the number of neighbouring values to take into account.
|
|
89
|
+
* The resulting time is computed via `Math.floor(smoothingWindow / 2)`.
|
|
90
|
+
*/
|
|
91
|
+
@property({ type: Number })
|
|
92
|
+
smoothingWindow: number = 0;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The maximum number of rows to display in the table view.
|
|
96
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
97
|
+
*/
|
|
98
|
+
@property({ type: Object })
|
|
99
|
+
pageSize: boolean | number = false;
|
|
100
|
+
|
|
101
|
+
override render() {
|
|
102
|
+
return (
|
|
103
|
+
<NumberSequencesOverTime
|
|
104
|
+
lapisFilter={this.lapisFilter}
|
|
105
|
+
lapisDateField={this.lapisDateField}
|
|
106
|
+
views={this.views}
|
|
107
|
+
headline={this.headline}
|
|
108
|
+
width={this.width}
|
|
109
|
+
height={this.height}
|
|
110
|
+
granularity={this.granularity}
|
|
111
|
+
smoothingWindow={this.smoothingWindow}
|
|
112
|
+
pageSize={this.pageSize}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare global {
|
|
119
|
+
interface HTMLElementTagNameMap {
|
|
120
|
+
'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
125
|
+
type LapisFilterMatches = Expect<
|
|
126
|
+
Equals<typeof NumberSequencesOverTimeComponent.prototype.lapisFilter, NumberSequencesOverTimeProps['lapisFilter']>
|
|
127
|
+
>;
|
|
128
|
+
type ViewsMatches = Expect<
|
|
129
|
+
Equals<typeof NumberSequencesOverTimeComponent.prototype.views, NumberSequencesOverTimeProps['views']>
|
|
130
|
+
>;
|
|
131
|
+
type GranularityMatches = Expect<
|
|
132
|
+
Equals<typeof NumberSequencesOverTimeComponent.prototype.granularity, NumberSequencesOverTimeProps['granularity']>
|
|
133
|
+
>;
|
|
134
|
+
type SmoothingWindowMatches = Expect<
|
|
135
|
+
Equals<
|
|
136
|
+
typeof NumberSequencesOverTimeComponent.prototype.smoothingWindow,
|
|
137
|
+
NumberSequencesOverTimeProps['smoothingWindow']
|
|
138
|
+
>
|
|
139
|
+
>;
|
|
140
|
+
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
@@ -3,3 +3,4 @@ export { MutationsComponent } from './gs-mutations';
|
|
|
3
3
|
export { PrevalenceOverTimeComponent } from './gs-prevalence-over-time';
|
|
4
4
|
export { RelativeGrowthAdvantageComponent } from './gs-relative-growth-advantage';
|
|
5
5
|
export { AggregateComponent } from './gs-aggregate';
|
|
6
|
+
export { NumberSequencesOverTimeComponent } from './gs-number-sequences-over-time';
|