@genspectrum/dashboard-components 0.6.12 → 0.6.14
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/README.md +29 -0
- package/custom-elements.json +11 -11
- package/dist/dashboard-components.js +8219 -37937
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +11 -11
- package/dist/style.css +5 -25
- package/package.json +7 -6
- package/src/operator/FetchAggregatedOperator.ts +2 -7
- package/src/preact/components/info.tsx +1 -1
- package/src/preact/components/loading-display.tsx +8 -1
- package/src/preact/components/percent-intput.tsx +7 -2
- package/src/preact/components/proportion-selector.tsx +12 -2
- package/src/preact/dateRangeSelector/date-range-selector.tsx +4 -4
- package/src/preact/lineageFilter/lineage-filter.tsx +2 -2
- package/src/preact/locationFilter/location-filter.tsx +2 -2
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_01.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_02.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_03.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_04.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_05.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_06.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_07.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_20_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_21_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_22_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_23_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_24_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_25_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_26_01_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations_total.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_week3_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_week4_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_week5_2024.json +13 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_week6_2024.json +13 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +56 -8
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +4 -2
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +135 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +2 -2
- package/src/preact/textInput/text-input.tsx +2 -2
- package/src/query/queryMutationsOverTime.spec.ts +210 -64
- package/src/query/queryMutationsOverTime.ts +10 -2
- package/src/web-components/input/gs-date-range-selector.tsx +24 -4
- package/src/web-components/input/gs-lineage-filter.tsx +15 -1
- package/src/web-components/input/gs-location-filter.tsx +13 -1
- package/src/web-components/input/gs-mutation-filter.tsx +1 -0
- package/src/web-components/input/gs-text-input.tsx +13 -1
- package/src/web-components/visualization/gs-aggregate.tsx +17 -1
- package/src/web-components/visualization/gs-mutation-comparison.tsx +9 -0
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +271 -0
- package/src/web-components/visualization/gs-mutations-over-time.tsx +7 -0
- package/src/web-components/visualization/gs-mutations.tsx +11 -5
- package/src/web-components/visualization/gs-number-sequences-over-time.tsx +15 -0
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -9
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +26 -8
- package/src/web-components/visualization/gs-relative-growth-advantage.tsx +43 -5
- package/standalone-bundle/dashboard-components.js +30887 -0
- package/standalone-bundle/dashboard-components.js.map +1 -0
|
@@ -15,10 +15,12 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
15
15
|
data.set(new Substitution('someSegment', 'A', 'T', 123), yearMonthDay('2021-01-01'), {
|
|
16
16
|
count: 1,
|
|
17
17
|
proportion: 0.1,
|
|
18
|
+
totalCount: 10,
|
|
18
19
|
});
|
|
19
20
|
data.set(new Substitution('someOtherSegment', 'A', 'T', 123), yearMonthDay('2021-01-01'), {
|
|
20
21
|
count: 2,
|
|
21
22
|
proportion: 0.2,
|
|
23
|
+
totalCount: 10,
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
filterDisplayedSegments(
|
|
@@ -41,10 +43,12 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
41
43
|
data.set(new Substitution('someSegment', 'A', 'T', 123), yearMonthDay('2021-01-01'), {
|
|
42
44
|
count: 1,
|
|
43
45
|
proportion: 0.1,
|
|
46
|
+
totalCount: 10,
|
|
44
47
|
});
|
|
45
48
|
data.set(new Deletion('someOtherSegment', 'A', 123), yearMonthDay('2021-01-01'), {
|
|
46
49
|
count: 2,
|
|
47
50
|
proportion: 0.2,
|
|
51
|
+
totalCount: 10,
|
|
48
52
|
});
|
|
49
53
|
|
|
50
54
|
filterMutationTypes(
|
|
@@ -76,7 +80,13 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
76
80
|
|
|
77
81
|
filterProportion(data, getOverallMutationData(belowFilter), proportionInterval);
|
|
78
82
|
|
|
79
|
-
expect(
|
|
83
|
+
expect(
|
|
84
|
+
data.getAsArray({
|
|
85
|
+
count: 0,
|
|
86
|
+
proportion: 0,
|
|
87
|
+
totalCount: 10,
|
|
88
|
+
}),
|
|
89
|
+
).to.toHaveLength(0);
|
|
80
90
|
});
|
|
81
91
|
|
|
82
92
|
it('should remove mutations where overall proportion is above filter', () => {
|
|
@@ -84,7 +94,13 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
84
94
|
|
|
85
95
|
filterProportion(data, getOverallMutationData(aboveFilter), proportionInterval);
|
|
86
96
|
|
|
87
|
-
expect(
|
|
97
|
+
expect(
|
|
98
|
+
data.getAsArray({
|
|
99
|
+
count: 0,
|
|
100
|
+
proportion: 0,
|
|
101
|
+
totalCount: 10,
|
|
102
|
+
}),
|
|
103
|
+
).to.toHaveLength(0);
|
|
88
104
|
});
|
|
89
105
|
|
|
90
106
|
it('should remove mutations where overall proportion is missing', () => {
|
|
@@ -92,7 +108,13 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
92
108
|
|
|
93
109
|
filterProportion(data, getOverallMutationData(aboveFilter, someOtherMutation), proportionInterval);
|
|
94
110
|
|
|
95
|
-
expect(
|
|
111
|
+
expect(
|
|
112
|
+
data.getAsArray({
|
|
113
|
+
count: 0,
|
|
114
|
+
proportion: 0,
|
|
115
|
+
totalCount: 10,
|
|
116
|
+
}),
|
|
117
|
+
).to.toHaveLength(0);
|
|
96
118
|
});
|
|
97
119
|
|
|
98
120
|
it('should not remove mutation where overall proportion is at lower border of filter', () => {
|
|
@@ -100,7 +122,13 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
100
122
|
|
|
101
123
|
filterProportion(data, getOverallMutationData(inFilter), proportionInterval);
|
|
102
124
|
|
|
103
|
-
expect(
|
|
125
|
+
expect(
|
|
126
|
+
data.getRow(someSubstitution, {
|
|
127
|
+
count: 0,
|
|
128
|
+
proportion: 0,
|
|
129
|
+
totalCount: 10,
|
|
130
|
+
}),
|
|
131
|
+
).to.toHaveLength(2);
|
|
104
132
|
});
|
|
105
133
|
|
|
106
134
|
it('should not remove mutation where overall proportion is within filter', () => {
|
|
@@ -108,7 +136,13 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
108
136
|
|
|
109
137
|
filterProportion(data, getOverallMutationData(inFilter), proportionInterval);
|
|
110
138
|
|
|
111
|
-
expect(
|
|
139
|
+
expect(
|
|
140
|
+
data.getRow(someSubstitution, {
|
|
141
|
+
count: 0,
|
|
142
|
+
proportion: 0,
|
|
143
|
+
totalCount: 10,
|
|
144
|
+
}),
|
|
145
|
+
).to.toHaveLength(2);
|
|
112
146
|
});
|
|
113
147
|
|
|
114
148
|
it('should not remove mutation where overall proportion is at upper border of filter', () => {
|
|
@@ -116,13 +150,27 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
116
150
|
|
|
117
151
|
filterProportion(data, getOverallMutationData(inFilter), proportionInterval);
|
|
118
152
|
|
|
119
|
-
expect(
|
|
153
|
+
expect(
|
|
154
|
+
data.getRow(someSubstitution, {
|
|
155
|
+
count: 0,
|
|
156
|
+
proportion: 0,
|
|
157
|
+
totalCount: 10,
|
|
158
|
+
}),
|
|
159
|
+
).to.toHaveLength(2);
|
|
120
160
|
});
|
|
121
161
|
|
|
122
162
|
function getMutationOverTimeData() {
|
|
123
163
|
const data = new Map2dBase<Substitution | Deletion, Temporal, MutationOverTimeMutationValue>();
|
|
124
|
-
data.set(someSubstitution, yearMonthDay('2021-01-01'), {
|
|
125
|
-
|
|
164
|
+
data.set(someSubstitution, yearMonthDay('2021-01-01'), {
|
|
165
|
+
count: 1,
|
|
166
|
+
proportion: 0.1,
|
|
167
|
+
totalCount: 10,
|
|
168
|
+
});
|
|
169
|
+
data.set(someSubstitution, yearMonthDay('2021-02-02'), {
|
|
170
|
+
count: 99,
|
|
171
|
+
proportion: 0.99,
|
|
172
|
+
totalCount: 10,
|
|
173
|
+
});
|
|
126
174
|
return data;
|
|
127
175
|
}
|
|
128
176
|
|
|
@@ -56,7 +56,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
56
56
|
<MutationCell mutation={mutation} />
|
|
57
57
|
</div>
|
|
58
58
|
{dates.map((date, columnIndex) => {
|
|
59
|
-
const value = data.get(mutation, date) ?? { proportion: 0, count: 0 };
|
|
59
|
+
const value = data.get(mutation, date) ?? { proportion: 0, count: 0, totalCount: 0 };
|
|
60
60
|
const tooltipPosition = getTooltipPosition(
|
|
61
61
|
rowIndex,
|
|
62
62
|
shownMutations.length,
|
|
@@ -136,7 +136,9 @@ const ProportionCell: FunctionComponent<{
|
|
|
136
136
|
<p>({timeIntervalDisplay(date)})</p>
|
|
137
137
|
<p>{mutation.code}</p>
|
|
138
138
|
<p>Proportion: {formatProportion(value.proportion)}</p>
|
|
139
|
-
<p>
|
|
139
|
+
<p>
|
|
140
|
+
Count: {value.count} / {value.totalCount} total
|
|
141
|
+
</p>
|
|
140
142
|
</div>
|
|
141
143
|
);
|
|
142
144
|
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { type Meta, type StoryObj } from '@storybook/preact';
|
|
2
2
|
import { expect, waitFor } from '@storybook/test';
|
|
3
3
|
|
|
4
|
+
import aggregated_01 from './__mockData__/aggregated_2024_01.json';
|
|
5
|
+
import aggregated_02 from './__mockData__/aggregated_2024_02.json';
|
|
6
|
+
import aggregated_03 from './__mockData__/aggregated_2024_03.json';
|
|
7
|
+
import aggregated_04 from './__mockData__/aggregated_2024_04.json';
|
|
8
|
+
import aggregated_05 from './__mockData__/aggregated_2024_05.json';
|
|
9
|
+
import aggregated_06 from './__mockData__/aggregated_2024_06.json';
|
|
10
|
+
import aggregated_07 from './__mockData__/aggregated_2024_07.json';
|
|
4
11
|
import aggregated_date from './__mockData__/aggregated_date.json';
|
|
5
12
|
import aggregated_tooManyMutations from './__mockData__/aggregated_tooManyMutations.json';
|
|
13
|
+
import aggregated_tooManyMutations_total from './__mockData__/aggregated_tooManyMutations_total.json';
|
|
6
14
|
import nucleotideMutation_01 from './__mockData__/nucleotideMutations_2024_01.json';
|
|
7
15
|
import nucleotideMutation_02 from './__mockData__/nucleotideMutations_2024_02.json';
|
|
8
16
|
import nucleotideMutation_03 from './__mockData__/nucleotideMutations_2024_03.json';
|
|
@@ -91,6 +99,118 @@ export const Default: StoryObj<MutationsOverTimeProps> = {
|
|
|
91
99
|
body: aggregated_date,
|
|
92
100
|
},
|
|
93
101
|
},
|
|
102
|
+
{
|
|
103
|
+
matcher: {
|
|
104
|
+
name: 'aggregated_01',
|
|
105
|
+
url: AGGREGATED_ENDPOINT,
|
|
106
|
+
body: {
|
|
107
|
+
dateFrom: '2024-01-01',
|
|
108
|
+
dateTo: '2024-01-31',
|
|
109
|
+
fields: [],
|
|
110
|
+
pangoLineage: 'JN.1*',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
response: {
|
|
114
|
+
status: 200,
|
|
115
|
+
body: aggregated_01,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
matcher: {
|
|
120
|
+
name: 'aggregated_02',
|
|
121
|
+
url: AGGREGATED_ENDPOINT,
|
|
122
|
+
body: {
|
|
123
|
+
dateFrom: '2024-02-01',
|
|
124
|
+
dateTo: '2024-02-29',
|
|
125
|
+
fields: [],
|
|
126
|
+
pangoLineage: 'JN.1*',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
response: {
|
|
130
|
+
status: 200,
|
|
131
|
+
body: aggregated_02,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
matcher: {
|
|
136
|
+
name: 'aggregated_03',
|
|
137
|
+
url: AGGREGATED_ENDPOINT,
|
|
138
|
+
body: {
|
|
139
|
+
dateFrom: '2024-03-01',
|
|
140
|
+
dateTo: '2024-03-31',
|
|
141
|
+
fields: [],
|
|
142
|
+
pangoLineage: 'JN.1*',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
response: {
|
|
146
|
+
status: 200,
|
|
147
|
+
body: aggregated_03,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
matcher: {
|
|
152
|
+
name: 'aggregated_04',
|
|
153
|
+
url: AGGREGATED_ENDPOINT,
|
|
154
|
+
body: {
|
|
155
|
+
dateFrom: '2024-04-01',
|
|
156
|
+
dateTo: '2024-04-30',
|
|
157
|
+
fields: [],
|
|
158
|
+
pangoLineage: 'JN.1*',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
response: {
|
|
162
|
+
status: 200,
|
|
163
|
+
body: aggregated_04,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
matcher: {
|
|
168
|
+
name: 'aggregated_05',
|
|
169
|
+
url: AGGREGATED_ENDPOINT,
|
|
170
|
+
body: {
|
|
171
|
+
dateFrom: '2024-05-01',
|
|
172
|
+
dateTo: '2024-05-31',
|
|
173
|
+
fields: [],
|
|
174
|
+
pangoLineage: 'JN.1*',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
response: {
|
|
178
|
+
status: 200,
|
|
179
|
+
body: aggregated_05,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
matcher: {
|
|
184
|
+
name: 'aggregated_06',
|
|
185
|
+
url: AGGREGATED_ENDPOINT,
|
|
186
|
+
body: {
|
|
187
|
+
dateFrom: '2024-06-01',
|
|
188
|
+
dateTo: '2024-06-30',
|
|
189
|
+
fields: [],
|
|
190
|
+
pangoLineage: 'JN.1*',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
response: {
|
|
194
|
+
status: 200,
|
|
195
|
+
body: aggregated_06,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
matcher: {
|
|
200
|
+
name: 'aggregated_07',
|
|
201
|
+
url: AGGREGATED_ENDPOINT,
|
|
202
|
+
body: {
|
|
203
|
+
dateFrom: '2024-07-01',
|
|
204
|
+
dateTo: '2024-07-31',
|
|
205
|
+
fields: [],
|
|
206
|
+
pangoLineage: 'JN.1*',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
response: {
|
|
210
|
+
status: 200,
|
|
211
|
+
body: aggregated_07,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
94
214
|
{
|
|
95
215
|
matcher: {
|
|
96
216
|
name: 'nucleotideMutations_overall',
|
|
@@ -253,6 +373,21 @@ export const ShowsMessageWhenTooManyMutations: StoryObj<MutationsOverTimeProps>
|
|
|
253
373
|
body: aggregated_tooManyMutations,
|
|
254
374
|
},
|
|
255
375
|
},
|
|
376
|
+
{
|
|
377
|
+
matcher: {
|
|
378
|
+
name: 'aggregated_total',
|
|
379
|
+
url: AGGREGATED_ENDPOINT,
|
|
380
|
+
body: {
|
|
381
|
+
dateFrom: '2023-01-01',
|
|
382
|
+
dateTo: '2023-12-31',
|
|
383
|
+
fields: [],
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
response: {
|
|
387
|
+
status: 200,
|
|
388
|
+
body: aggregated_tooManyMutations_total,
|
|
389
|
+
},
|
|
390
|
+
},
|
|
256
391
|
{
|
|
257
392
|
matcher: {
|
|
258
393
|
name: 'nucleotideMutations',
|
|
@@ -38,8 +38,8 @@ export interface PrevalenceOverTimeProps {
|
|
|
38
38
|
confidenceIntervalMethods: ConfidenceIntervalMethod[];
|
|
39
39
|
lapisDateField: string;
|
|
40
40
|
pageSize: boolean | number;
|
|
41
|
-
yAxisMaxLinear
|
|
42
|
-
yAxisMaxLogarithmic
|
|
41
|
+
yAxisMaxLinear: AxisMax;
|
|
42
|
+
yAxisMaxLogarithmic: AxisMax;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const PrevalenceOverTime: FunctionComponent<PrevalenceOverTimeProps> = (componentProps) => {
|
|
@@ -12,8 +12,8 @@ import { useQuery } from '../useQuery';
|
|
|
12
12
|
|
|
13
13
|
export interface TextInputInnerProps {
|
|
14
14
|
lapisField: string;
|
|
15
|
-
placeholderText
|
|
16
|
-
initialValue
|
|
15
|
+
placeholderText: string;
|
|
16
|
+
initialValue: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface TextInputProps extends TextInputInnerProps {
|