@genspectrum/dashboard-components 0.1.1 → 0.1.3
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 +1 -1
- package/custom-elements.json +151 -1
- package/dist/dashboard-components.js +164 -62
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +63 -23
- package/package.json +1 -1
- package/src/lapisApi/lapisApi.ts +1 -1
- package/src/preact/aggregatedData/__mockData__/aggregated.json +585 -0
- package/src/preact/aggregatedData/aggregate-table.tsx +32 -0
- package/src/preact/aggregatedData/aggregate.stories.tsx +53 -0
- package/src/preact/aggregatedData/aggregate.tsx +98 -0
- package/src/query/queryAggregateData.spec.ts +32 -0
- package/src/query/queryAggregateData.ts +25 -0
- package/src/web-components/display/aggregate-component.mdx +25 -0
- package/src/web-components/display/aggregate-component.stories.ts +63 -0
- package/src/web-components/display/aggregate-component.tsx +51 -0
- package/src/web-components/display/index.ts +1 -0
- package/src/web-components/input/location-filter-component.stories.ts +2 -4
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ data of a specific instance of [LAPIS](https://github.com/GenSpectrum/LAPIS).
|
|
|
7
7
|
|
|
8
8
|
Documentation of the components is available in the deployed [Storybook](https://genspectrum.github.io/dashboards/).
|
|
9
9
|
|
|
10
|
-
We also provide examples of how to use the components in the [examples](
|
|
10
|
+
We also provide examples of how to use the components in the [examples](https://github.com/GenSpectrum/dashboards/tree/main/examples) folder.
|
|
11
11
|
|
|
12
12
|
### npm
|
|
13
13
|
|
package/custom-elements.json
CHANGED
|
@@ -128,6 +128,148 @@
|
|
|
128
128
|
}
|
|
129
129
|
]
|
|
130
130
|
},
|
|
131
|
+
{
|
|
132
|
+
"kind": "javascript-module",
|
|
133
|
+
"path": "src/web-components/display/aggregate-component.mdx",
|
|
134
|
+
"declarations": [],
|
|
135
|
+
"exports": []
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"kind": "javascript-module",
|
|
139
|
+
"path": "src/web-components/display/aggregate-component.stories.ts",
|
|
140
|
+
"declarations": [
|
|
141
|
+
{
|
|
142
|
+
"kind": "variable",
|
|
143
|
+
"name": "meta",
|
|
144
|
+
"type": {
|
|
145
|
+
"text": "Meta<AggregateProps>"
|
|
146
|
+
},
|
|
147
|
+
"default": "{\n title: 'Visualization/Aggregate',\n component: 'gs-aggregate-component',\n argTypes: {\n fields: [{ control: 'object' }],\n views: {\n options: ['table'],\n control: { type: 'check' },\n },\n },\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: {\n name: 'aggregatedData',\n url: AGGREGATED_ENDPOINT,\n body: {\n fields: ['division', 'host'],\n country: 'USA',\n },\n },\n response: {\n status: 200,\n body: aggregatedData,\n },\n },\n ],\n },\n },\n}"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"kind": "variable",
|
|
151
|
+
"name": "Table",
|
|
152
|
+
"type": {
|
|
153
|
+
"text": "StoryObj<AggregateProps>"
|
|
154
|
+
},
|
|
155
|
+
"default": "{\n render: (args) => html`\n <div class=\"w-11/12 h-11/12\">\n <gs-app lapis=\"${LAPIS_URL}\">\n <gs-aggregate-component\n .fields=${args.fields}\n .filter=${args.filter}\n .views=${args.views}\n ></gs-aggregate-component>\n </gs-app>\n </div>\n `,\n args: {\n fields: ['division', 'host'],\n views: ['table'],\n filter: {\n country: 'USA',\n },\n },\n}"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"exports": [
|
|
159
|
+
{
|
|
160
|
+
"kind": "js",
|
|
161
|
+
"name": "default",
|
|
162
|
+
"declaration": {
|
|
163
|
+
"name": "meta",
|
|
164
|
+
"module": "src/web-components/display/aggregate-component.stories.ts"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "js",
|
|
169
|
+
"name": "Table",
|
|
170
|
+
"declaration": {
|
|
171
|
+
"name": "Table",
|
|
172
|
+
"module": "src/web-components/display/aggregate-component.stories.ts"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"kind": "javascript-module",
|
|
179
|
+
"path": "src/web-components/display/aggregate-component.tsx",
|
|
180
|
+
"declarations": [
|
|
181
|
+
{
|
|
182
|
+
"kind": "class",
|
|
183
|
+
"description": "## Tag\n\n`gs-aggregate-component`\n\n## Context\n\nThis component displays aggregated data, which can provide an overview of the underlying data.\n\nIt expects a list of fields to aggregate by and a filter to apply to the data.",
|
|
184
|
+
"name": "AggregateComponent",
|
|
185
|
+
"members": [
|
|
186
|
+
{
|
|
187
|
+
"kind": "field",
|
|
188
|
+
"name": "fields",
|
|
189
|
+
"type": {
|
|
190
|
+
"text": "string[]"
|
|
191
|
+
},
|
|
192
|
+
"default": "[]",
|
|
193
|
+
"description": "The fields to aggregate by.",
|
|
194
|
+
"attribute": "fields"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"kind": "field",
|
|
198
|
+
"name": "views",
|
|
199
|
+
"type": {
|
|
200
|
+
"text": "View[]"
|
|
201
|
+
},
|
|
202
|
+
"default": "['table']",
|
|
203
|
+
"description": "The views are used to display the aggregated data.\nIn the table view, the data is presented in a table format where each field is a column,\nalong with the aggregated value and its proportion.\nThe proportion represents the ratio of the aggregated value to the total count of the data\n(considering the applied filter).",
|
|
204
|
+
"attribute": "views"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"kind": "field",
|
|
208
|
+
"name": "filter",
|
|
209
|
+
"type": {
|
|
210
|
+
"text": "LapisFilter"
|
|
211
|
+
},
|
|
212
|
+
"default": "{}",
|
|
213
|
+
"description": "The filter to apply to the data.",
|
|
214
|
+
"attribute": "filter"
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"attributes": [
|
|
218
|
+
{
|
|
219
|
+
"name": "fields",
|
|
220
|
+
"type": {
|
|
221
|
+
"text": "string[]"
|
|
222
|
+
},
|
|
223
|
+
"default": "[]",
|
|
224
|
+
"description": "The fields to aggregate by.",
|
|
225
|
+
"fieldName": "fields"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "views",
|
|
229
|
+
"type": {
|
|
230
|
+
"text": "View[]"
|
|
231
|
+
},
|
|
232
|
+
"default": "['table']",
|
|
233
|
+
"description": "The views are used to display the aggregated data.\nIn the table view, the data is presented in a table format where each field is a column,\nalong with the aggregated value and its proportion.\nThe proportion represents the ratio of the aggregated value to the total count of the data\n(considering the applied filter).",
|
|
234
|
+
"fieldName": "views"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "filter",
|
|
238
|
+
"type": {
|
|
239
|
+
"text": "LapisFilter"
|
|
240
|
+
},
|
|
241
|
+
"default": "{}",
|
|
242
|
+
"description": "The filter to apply to the data.",
|
|
243
|
+
"fieldName": "filter"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"superclass": {
|
|
247
|
+
"name": "PreactLitAdapterWithGridJsStyles",
|
|
248
|
+
"module": "/src/web-components/PreactLitAdapterWithGridJsStyles"
|
|
249
|
+
},
|
|
250
|
+
"tagName": "gs-aggregate-component",
|
|
251
|
+
"customElement": true
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
"exports": [
|
|
255
|
+
{
|
|
256
|
+
"kind": "js",
|
|
257
|
+
"name": "AggregateComponent",
|
|
258
|
+
"declaration": {
|
|
259
|
+
"name": "AggregateComponent",
|
|
260
|
+
"module": "src/web-components/display/aggregate-component.tsx"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"kind": "custom-element-definition",
|
|
265
|
+
"name": "gs-aggregate-component",
|
|
266
|
+
"declaration": {
|
|
267
|
+
"name": "AggregateComponent",
|
|
268
|
+
"module": "src/web-components/display/aggregate-component.tsx"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
},
|
|
131
273
|
{
|
|
132
274
|
"kind": "javascript-module",
|
|
133
275
|
"path": "src/web-components/display/index.ts",
|
|
@@ -164,6 +306,14 @@
|
|
|
164
306
|
"name": "RelativeGrowthAdvantageComponent",
|
|
165
307
|
"module": "./relative-growth-advantage-component"
|
|
166
308
|
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"kind": "js",
|
|
312
|
+
"name": "AggregateComponent",
|
|
313
|
+
"declaration": {
|
|
314
|
+
"name": "AggregateComponent",
|
|
315
|
+
"module": "./aggregate-component"
|
|
316
|
+
}
|
|
167
317
|
}
|
|
168
318
|
]
|
|
169
319
|
},
|
|
@@ -1093,7 +1243,7 @@
|
|
|
1093
1243
|
"type": {
|
|
1094
1244
|
"text": "StoryObj<LocationFilterProps>"
|
|
1095
1245
|
},
|
|
1096
|
-
"default": "{\n ...Template,\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: aggregatedEndpointMatcher,\n response: {\n status:
|
|
1246
|
+
"default": "{\n ...Template,\n parameters: {\n fetchMock: {\n mocks: [\n {\n matcher: aggregatedEndpointMatcher,\n response: {\n status: 400,\n body: { error: 'no data' },\n },\n },\n ],\n },\n },\n play: async ({ canvasElement }) => {\n const canvas = await withinShadowRoot(canvasElement, 'gs-location-filter');\n\n await waitFor(() =>\n expect(canvas.getByText('Bad Request: {\"error\":\"no data\"} ', { exact: false })).toBeInTheDocument(),\n );\n },\n}"
|
|
1097
1247
|
},
|
|
1098
1248
|
{
|
|
1099
1249
|
"kind": "variable",
|
|
@@ -448,7 +448,7 @@ async function fetchReferenceGenome(lapisUrl, signal) {
|
|
|
448
448
|
}
|
|
449
449
|
const handleErrors = async (response) => {
|
|
450
450
|
if (!response.ok) {
|
|
451
|
-
if (response.status
|
|
451
|
+
if (response.status >= 400 && response.status < 500) {
|
|
452
452
|
throw new Error(`${response.statusText}: ${JSON.stringify(await response.json())}`);
|
|
453
453
|
}
|
|
454
454
|
throw new Error(`${response.statusText}: ${response.status}`);
|
|
@@ -462,15 +462,15 @@ const substitutionsOrDeletionsEndpoint = (lapisUrl, sequenceType) => {
|
|
|
462
462
|
return sequenceType === "amino acid" ? `${lapisUrl}/sample/aminoAcidMutations` : `${lapisUrl}/sample/nucleotideMutations`;
|
|
463
463
|
};
|
|
464
464
|
const referenceGenomeEndpoint = (lapisUrl) => `${lapisUrl}/sample/referenceGenome`;
|
|
465
|
-
var __defProp$
|
|
466
|
-
var __getOwnPropDesc$
|
|
467
|
-
var __decorateClass$
|
|
468
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
465
|
+
var __defProp$a = Object.defineProperty;
|
|
466
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
467
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
468
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
469
469
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
470
470
|
if (decorator = decorators[i2])
|
|
471
471
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
472
472
|
if (kind && result)
|
|
473
|
-
__defProp$
|
|
473
|
+
__defProp$a(target, key, result);
|
|
474
474
|
return result;
|
|
475
475
|
};
|
|
476
476
|
let App = class extends LitElement {
|
|
@@ -504,14 +504,14 @@ let App = class extends LitElement {
|
|
|
504
504
|
return this;
|
|
505
505
|
}
|
|
506
506
|
};
|
|
507
|
-
__decorateClass$
|
|
507
|
+
__decorateClass$a([
|
|
508
508
|
provide({ context: lapisContext }),
|
|
509
509
|
n2()
|
|
510
510
|
], App.prototype, "lapis", 2);
|
|
511
|
-
__decorateClass$
|
|
511
|
+
__decorateClass$a([
|
|
512
512
|
provide({ context: referenceGenomeContext })
|
|
513
513
|
], App.prototype, "referenceGenome", 2);
|
|
514
|
-
App = __decorateClass$
|
|
514
|
+
App = __decorateClass$a([
|
|
515
515
|
t$2("gs-app")
|
|
516
516
|
], App);
|
|
517
517
|
var f$1 = 0;
|
|
@@ -1486,7 +1486,7 @@ const MutationComparisonTabs = ({ data, views, sequenceType }) => {
|
|
|
1486
1486
|
{
|
|
1487
1487
|
tabs,
|
|
1488
1488
|
toolbar: /* @__PURE__ */ u$1(
|
|
1489
|
-
Toolbar$
|
|
1489
|
+
Toolbar$3,
|
|
1490
1490
|
{
|
|
1491
1491
|
displayedSegments,
|
|
1492
1492
|
setDisplayedSegments,
|
|
@@ -1500,7 +1500,7 @@ const MutationComparisonTabs = ({ data, views, sequenceType }) => {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
);
|
|
1502
1502
|
};
|
|
1503
|
-
const Toolbar$
|
|
1503
|
+
const Toolbar$3 = ({
|
|
1504
1504
|
displayedSegments,
|
|
1505
1505
|
setDisplayedSegments,
|
|
1506
1506
|
displayedMutationTypes,
|
|
@@ -4080,15 +4080,15 @@ input.tab:checked + .tab-content,
|
|
|
4080
4080
|
.filter {
|
|
4081
4081
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
|
4082
4082
|
}`;
|
|
4083
|
-
var __defProp$
|
|
4084
|
-
var __getOwnPropDesc$
|
|
4085
|
-
var __decorateClass$
|
|
4086
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4083
|
+
var __defProp$9 = Object.defineProperty;
|
|
4084
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
4085
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
4086
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
4087
4087
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4088
4088
|
if (decorator = decorators[i2])
|
|
4089
4089
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4090
4090
|
if (kind && result)
|
|
4091
|
-
__defProp$
|
|
4091
|
+
__defProp$9(target, key, result);
|
|
4092
4092
|
return result;
|
|
4093
4093
|
};
|
|
4094
4094
|
const tailwindElementCss = unsafeCSS(tailwindStyle);
|
|
@@ -4111,10 +4111,10 @@ const _PreactLitAdapter = class _PreactLitAdapter extends b {
|
|
|
4111
4111
|
};
|
|
4112
4112
|
_PreactLitAdapter.styles = [tailwindElementCss, minMaxPercentSliderElementCss];
|
|
4113
4113
|
let PreactLitAdapter = _PreactLitAdapter;
|
|
4114
|
-
__decorateClass$
|
|
4114
|
+
__decorateClass$9([
|
|
4115
4115
|
consume({ context: lapisContext })
|
|
4116
4116
|
], PreactLitAdapter.prototype, "lapis", 2);
|
|
4117
|
-
__decorateClass$
|
|
4117
|
+
__decorateClass$9([
|
|
4118
4118
|
consume({ context: referenceGenomeContext, subscribe: true })
|
|
4119
4119
|
], PreactLitAdapter.prototype, "referenceGenome", 2);
|
|
4120
4120
|
const gridJsElementCss = unsafeCSS(gridJsStyle);
|
|
@@ -4122,15 +4122,15 @@ const _PreactLitAdapterWithGridJsStyles = class _PreactLitAdapterWithGridJsStyle
|
|
|
4122
4122
|
};
|
|
4123
4123
|
_PreactLitAdapterWithGridJsStyles.styles = [...PreactLitAdapter.styles, gridJsElementCss];
|
|
4124
4124
|
let PreactLitAdapterWithGridJsStyles = _PreactLitAdapterWithGridJsStyles;
|
|
4125
|
-
var __defProp$
|
|
4126
|
-
var __getOwnPropDesc$
|
|
4127
|
-
var __decorateClass$
|
|
4128
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4125
|
+
var __defProp$8 = Object.defineProperty;
|
|
4126
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
4127
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
4128
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
4129
4129
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4130
4130
|
if (decorator = decorators[i2])
|
|
4131
4131
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4132
4132
|
if (kind && result)
|
|
4133
|
-
__defProp$
|
|
4133
|
+
__defProp$8(target, key, result);
|
|
4134
4134
|
return result;
|
|
4135
4135
|
};
|
|
4136
4136
|
let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -4144,16 +4144,16 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
4144
4144
|
return /* @__PURE__ */ u$1(MutationComparison, { variants: this.variants, sequenceType: this.sequenceType, views: this.views });
|
|
4145
4145
|
}
|
|
4146
4146
|
};
|
|
4147
|
-
__decorateClass$
|
|
4147
|
+
__decorateClass$8([
|
|
4148
4148
|
n2({ type: Array })
|
|
4149
4149
|
], MutationComparisonComponent.prototype, "variants", 2);
|
|
4150
|
-
__decorateClass$
|
|
4150
|
+
__decorateClass$8([
|
|
4151
4151
|
n2({ type: String })
|
|
4152
4152
|
], MutationComparisonComponent.prototype, "sequenceType", 2);
|
|
4153
|
-
__decorateClass$
|
|
4153
|
+
__decorateClass$8([
|
|
4154
4154
|
n2({ type: Array })
|
|
4155
4155
|
], MutationComparisonComponent.prototype, "views", 2);
|
|
4156
|
-
MutationComparisonComponent = __decorateClass$
|
|
4156
|
+
MutationComparisonComponent = __decorateClass$8([
|
|
4157
4157
|
t$2("gs-mutation-comparison-component")
|
|
4158
4158
|
], MutationComparisonComponent);
|
|
4159
4159
|
function getInsertionsTableData(data) {
|
|
@@ -4474,7 +4474,7 @@ const MutationsTabs = ({ mutationsData, sequenceType, views }) => {
|
|
|
4474
4474
|
};
|
|
4475
4475
|
const tabs = views.map((view) => getTab(view));
|
|
4476
4476
|
const toolbar = (activeTab) => /* @__PURE__ */ u$1(
|
|
4477
|
-
Toolbar$
|
|
4477
|
+
Toolbar$2,
|
|
4478
4478
|
{
|
|
4479
4479
|
activeTab,
|
|
4480
4480
|
displayedSegments,
|
|
@@ -4488,7 +4488,7 @@ const MutationsTabs = ({ mutationsData, sequenceType, views }) => {
|
|
|
4488
4488
|
);
|
|
4489
4489
|
return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar });
|
|
4490
4490
|
};
|
|
4491
|
-
const Toolbar$
|
|
4491
|
+
const Toolbar$2 = ({
|
|
4492
4492
|
activeTab,
|
|
4493
4493
|
displayedSegments,
|
|
4494
4494
|
setDisplayedSegments,
|
|
@@ -4537,15 +4537,15 @@ const Toolbar$1 = ({
|
|
|
4537
4537
|
/* @__PURE__ */ u$1(Info, { className: "mx-1", content: "Info for mutations" })
|
|
4538
4538
|
] });
|
|
4539
4539
|
};
|
|
4540
|
-
var __defProp$
|
|
4541
|
-
var __getOwnPropDesc$
|
|
4542
|
-
var __decorateClass$
|
|
4543
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4540
|
+
var __defProp$7 = Object.defineProperty;
|
|
4541
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
4542
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
4543
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
4544
4544
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4545
4545
|
if (decorator = decorators[i2])
|
|
4546
4546
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4547
4547
|
if (kind && result)
|
|
4548
|
-
__defProp$
|
|
4548
|
+
__defProp$7(target, key, result);
|
|
4549
4549
|
return result;
|
|
4550
4550
|
};
|
|
4551
4551
|
let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -4559,16 +4559,16 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
|
4559
4559
|
return /* @__PURE__ */ u$1(Mutations, { variant: this.variant, sequenceType: this.sequenceType, views: this.views });
|
|
4560
4560
|
}
|
|
4561
4561
|
};
|
|
4562
|
-
__decorateClass$
|
|
4562
|
+
__decorateClass$7([
|
|
4563
4563
|
n2({ type: Object })
|
|
4564
4564
|
], MutationsComponent.prototype, "variant", 2);
|
|
4565
|
-
__decorateClass$
|
|
4565
|
+
__decorateClass$7([
|
|
4566
4566
|
n2({ type: String })
|
|
4567
4567
|
], MutationsComponent.prototype, "sequenceType", 2);
|
|
4568
|
-
__decorateClass$
|
|
4568
|
+
__decorateClass$7([
|
|
4569
4569
|
n2({ type: Array })
|
|
4570
4570
|
], MutationsComponent.prototype, "views", 2);
|
|
4571
|
-
MutationsComponent = __decorateClass$
|
|
4571
|
+
MutationsComponent = __decorateClass$7([
|
|
4572
4572
|
t$2("gs-mutations-component")
|
|
4573
4573
|
], MutationsComponent);
|
|
4574
4574
|
function getPrevalenceOverTimeTableData(data, granularity) {
|
|
@@ -6180,7 +6180,7 @@ const PrevalenceOverTimeTabs = ({
|
|
|
6180
6180
|
};
|
|
6181
6181
|
const tabs = views.map((view) => getTab(view));
|
|
6182
6182
|
const toolbar = (activeTab) => /* @__PURE__ */ u$1(
|
|
6183
|
-
Toolbar,
|
|
6183
|
+
Toolbar$1,
|
|
6184
6184
|
{
|
|
6185
6185
|
activeTab,
|
|
6186
6186
|
yAxisScaleType,
|
|
@@ -6194,7 +6194,7 @@ const PrevalenceOverTimeTabs = ({
|
|
|
6194
6194
|
);
|
|
6195
6195
|
return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar });
|
|
6196
6196
|
};
|
|
6197
|
-
const Toolbar = ({
|
|
6197
|
+
const Toolbar$1 = ({
|
|
6198
6198
|
activeTab,
|
|
6199
6199
|
yAxisScaleType,
|
|
6200
6200
|
setYAxisScaleType,
|
|
@@ -6225,15 +6225,15 @@ const Toolbar = ({
|
|
|
6225
6225
|
/* @__PURE__ */ u$1(Info, { className: "ml-1", content: "Info for prevalence over time" })
|
|
6226
6226
|
] });
|
|
6227
6227
|
};
|
|
6228
|
-
var __defProp$
|
|
6229
|
-
var __getOwnPropDesc$
|
|
6230
|
-
var __decorateClass$
|
|
6231
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6228
|
+
var __defProp$6 = Object.defineProperty;
|
|
6229
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
6230
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
6231
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
6232
6232
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
6233
6233
|
if (decorator = decorators[i2])
|
|
6234
6234
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6235
6235
|
if (kind && result)
|
|
6236
|
-
__defProp$
|
|
6236
|
+
__defProp$6(target, key, result);
|
|
6237
6237
|
return result;
|
|
6238
6238
|
};
|
|
6239
6239
|
let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -6260,25 +6260,25 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
6260
6260
|
);
|
|
6261
6261
|
}
|
|
6262
6262
|
};
|
|
6263
|
-
__decorateClass$
|
|
6263
|
+
__decorateClass$6([
|
|
6264
6264
|
n2({ type: Object })
|
|
6265
6265
|
], PrevalenceOverTimeComponent.prototype, "numerator", 2);
|
|
6266
|
-
__decorateClass$
|
|
6266
|
+
__decorateClass$6([
|
|
6267
6267
|
n2({ type: Object })
|
|
6268
6268
|
], PrevalenceOverTimeComponent.prototype, "denominator", 2);
|
|
6269
|
-
__decorateClass$
|
|
6269
|
+
__decorateClass$6([
|
|
6270
6270
|
n2({ type: String })
|
|
6271
6271
|
], PrevalenceOverTimeComponent.prototype, "granularity", 2);
|
|
6272
|
-
__decorateClass$
|
|
6272
|
+
__decorateClass$6([
|
|
6273
6273
|
n2({ type: Number })
|
|
6274
6274
|
], PrevalenceOverTimeComponent.prototype, "smoothingWindow", 2);
|
|
6275
|
-
__decorateClass$
|
|
6275
|
+
__decorateClass$6([
|
|
6276
6276
|
n2({ type: Array })
|
|
6277
6277
|
], PrevalenceOverTimeComponent.prototype, "views", 2);
|
|
6278
|
-
__decorateClass$
|
|
6278
|
+
__decorateClass$6([
|
|
6279
6279
|
n2({ type: Array })
|
|
6280
6280
|
], PrevalenceOverTimeComponent.prototype, "confidenceIntervalMethods", 2);
|
|
6281
|
-
PrevalenceOverTimeComponent = __decorateClass$
|
|
6281
|
+
PrevalenceOverTimeComponent = __decorateClass$6([
|
|
6282
6282
|
t$2("gs-prevalence-over-time")
|
|
6283
6283
|
], PrevalenceOverTimeComponent);
|
|
6284
6284
|
Chart.register(...registerables, LogitScale);
|
|
@@ -6535,15 +6535,15 @@ const RelativeGrowthAdvantageToolbar = ({
|
|
|
6535
6535
|
/* @__PURE__ */ u$1(Info, { className: "ml-1", content: "Line chart" })
|
|
6536
6536
|
] });
|
|
6537
6537
|
};
|
|
6538
|
-
var __defProp$
|
|
6539
|
-
var __getOwnPropDesc$
|
|
6540
|
-
var __decorateClass$
|
|
6541
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6538
|
+
var __defProp$5 = Object.defineProperty;
|
|
6539
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
6540
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
6541
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
6542
6542
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
6543
6543
|
if (decorator = decorators[i2])
|
|
6544
6544
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6545
6545
|
if (kind && result)
|
|
6546
|
-
__defProp$
|
|
6546
|
+
__defProp$5(target, key, result);
|
|
6547
6547
|
return result;
|
|
6548
6548
|
};
|
|
6549
6549
|
let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
|
|
@@ -6566,21 +6566,122 @@ let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
|
|
|
6566
6566
|
);
|
|
6567
6567
|
}
|
|
6568
6568
|
};
|
|
6569
|
-
__decorateClass$
|
|
6569
|
+
__decorateClass$5([
|
|
6570
6570
|
n2({ type: Object })
|
|
6571
6571
|
], RelativeGrowthAdvantageComponent.prototype, "numerator", 2);
|
|
6572
|
-
__decorateClass$
|
|
6572
|
+
__decorateClass$5([
|
|
6573
6573
|
n2({ type: Object })
|
|
6574
6574
|
], RelativeGrowthAdvantageComponent.prototype, "denominator", 2);
|
|
6575
|
-
__decorateClass$
|
|
6575
|
+
__decorateClass$5([
|
|
6576
6576
|
n2({ type: Number })
|
|
6577
6577
|
], RelativeGrowthAdvantageComponent.prototype, "generationTime", 2);
|
|
6578
|
-
__decorateClass$
|
|
6578
|
+
__decorateClass$5([
|
|
6579
6579
|
n2({ type: Array })
|
|
6580
6580
|
], RelativeGrowthAdvantageComponent.prototype, "views", 2);
|
|
6581
|
-
RelativeGrowthAdvantageComponent = __decorateClass$
|
|
6581
|
+
RelativeGrowthAdvantageComponent = __decorateClass$5([
|
|
6582
6582
|
t$2("gs-relative-growth-advantage")
|
|
6583
6583
|
], RelativeGrowthAdvantageComponent);
|
|
6584
|
+
const AggregateTable = ({ data, fields }) => {
|
|
6585
|
+
const headers = [
|
|
6586
|
+
...fields.map((field) => {
|
|
6587
|
+
return {
|
|
6588
|
+
name: field,
|
|
6589
|
+
sort: true
|
|
6590
|
+
};
|
|
6591
|
+
}),
|
|
6592
|
+
{
|
|
6593
|
+
name: "count",
|
|
6594
|
+
sort: true
|
|
6595
|
+
},
|
|
6596
|
+
{
|
|
6597
|
+
name: "proportion",
|
|
6598
|
+
sort: true,
|
|
6599
|
+
formatter: (cell) => formatProportion(cell)
|
|
6600
|
+
}
|
|
6601
|
+
];
|
|
6602
|
+
return /* @__PURE__ */ u$1(Table, { data, columns: headers, pagination: true });
|
|
6603
|
+
};
|
|
6604
|
+
async function queryAggregateData(variant, fields, lapis, signal) {
|
|
6605
|
+
const fetchData = new FetchAggregatedOperator(variant, fields);
|
|
6606
|
+
const data = (await fetchData.evaluate(lapis, signal)).content;
|
|
6607
|
+
const total = data.reduce((acc, row) => acc + row.count, 0);
|
|
6608
|
+
return data.map(
|
|
6609
|
+
(row) => ({
|
|
6610
|
+
...row,
|
|
6611
|
+
proportion: row.count / total
|
|
6612
|
+
})
|
|
6613
|
+
);
|
|
6614
|
+
}
|
|
6615
|
+
const Aggregate = ({ fields, views, filter }) => {
|
|
6616
|
+
const lapis = P(LapisUrlContext);
|
|
6617
|
+
const { data, error, isLoading } = useQuery(async () => {
|
|
6618
|
+
return queryAggregateData(filter, fields, lapis);
|
|
6619
|
+
}, [filter, fields, lapis]);
|
|
6620
|
+
const headline = "Aggregate";
|
|
6621
|
+
if (isLoading) {
|
|
6622
|
+
return /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(LoadingDisplay, {}) });
|
|
6623
|
+
}
|
|
6624
|
+
if (error !== null) {
|
|
6625
|
+
return /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(ErrorDisplay, { error }) });
|
|
6626
|
+
}
|
|
6627
|
+
if (data === null) {
|
|
6628
|
+
return /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(NoDataDisplay, {}) });
|
|
6629
|
+
}
|
|
6630
|
+
return /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(AggregatedDataTabs, { data, views, fields }) });
|
|
6631
|
+
};
|
|
6632
|
+
const AggregatedDataTabs = ({ data, views, fields }) => {
|
|
6633
|
+
const getTab = (view) => {
|
|
6634
|
+
switch (view) {
|
|
6635
|
+
case "table":
|
|
6636
|
+
return {
|
|
6637
|
+
title: "Table",
|
|
6638
|
+
content: /* @__PURE__ */ u$1(AggregateTable, { data, fields })
|
|
6639
|
+
};
|
|
6640
|
+
}
|
|
6641
|
+
};
|
|
6642
|
+
const tabs = views.map((view) => getTab(view));
|
|
6643
|
+
return /* @__PURE__ */ u$1(Tabs, { tabs, toolbar: /* @__PURE__ */ u$1(Toolbar, { data }) });
|
|
6644
|
+
};
|
|
6645
|
+
const Toolbar = ({ data }) => {
|
|
6646
|
+
return /* @__PURE__ */ u$1("div", { class: "flex flex-row", children: [
|
|
6647
|
+
/* @__PURE__ */ u$1(CsvDownloadButton, { className: "mx-1 btn btn-xs", getData: () => data, filename: "aggregate.csv" }),
|
|
6648
|
+
/* @__PURE__ */ u$1(Info, { className: "mx-1", content: "Info for aggregate" })
|
|
6649
|
+
] });
|
|
6650
|
+
};
|
|
6651
|
+
var __defProp$4 = Object.defineProperty;
|
|
6652
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
6653
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
6654
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
6655
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
6656
|
+
if (decorator = decorators[i2])
|
|
6657
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6658
|
+
if (kind && result)
|
|
6659
|
+
__defProp$4(target, key, result);
|
|
6660
|
+
return result;
|
|
6661
|
+
};
|
|
6662
|
+
let AggregateComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
6663
|
+
constructor() {
|
|
6664
|
+
super(...arguments);
|
|
6665
|
+
this.fields = [];
|
|
6666
|
+
this.views = ["table"];
|
|
6667
|
+
this.filter = {};
|
|
6668
|
+
}
|
|
6669
|
+
render() {
|
|
6670
|
+
return /* @__PURE__ */ u$1(Aggregate, { fields: this.fields, views: this.views, filter: this.filter });
|
|
6671
|
+
}
|
|
6672
|
+
};
|
|
6673
|
+
__decorateClass$4([
|
|
6674
|
+
n2({ type: Array })
|
|
6675
|
+
], AggregateComponent.prototype, "fields", 2);
|
|
6676
|
+
__decorateClass$4([
|
|
6677
|
+
n2({ type: Array })
|
|
6678
|
+
], AggregateComponent.prototype, "views", 2);
|
|
6679
|
+
__decorateClass$4([
|
|
6680
|
+
n2({ type: Object })
|
|
6681
|
+
], AggregateComponent.prototype, "filter", 2);
|
|
6682
|
+
AggregateComponent = __decorateClass$4([
|
|
6683
|
+
t$2("gs-aggregate-component")
|
|
6684
|
+
], AggregateComponent);
|
|
6584
6685
|
const toYYYYMMDD = (date) => {
|
|
6585
6686
|
if (!date) {
|
|
6586
6687
|
return void 0;
|
|
@@ -7309,6 +7410,7 @@ MutationFilterComponent = __decorateClass([
|
|
|
7309
7410
|
t$2("gs-mutation-filter")
|
|
7310
7411
|
], MutationFilterComponent);
|
|
7311
7412
|
export {
|
|
7413
|
+
AggregateComponent,
|
|
7312
7414
|
App,
|
|
7313
7415
|
DateRangeSelectorComponent,
|
|
7314
7416
|
LocationFilterComponent,
|