@gen3/frontend 0.10.47 → 0.10.48
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/dist/cjs/index.js +2043 -277
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/components/Login/LoginPanel.d.ts.map +1 -1
- package/dist/dts/components/Login/LoginPanel.js +2 -1
- package/dist/dts/components/Login/LoginPanel.js.map +1 -1
- package/dist/dts/components/charts/Charts.d.ts +1 -2
- package/dist/dts/components/charts/Charts.d.ts.map +1 -1
- package/dist/dts/components/charts/Charts.js +17 -13
- package/dist/dts/components/charts/Charts.js.map +1 -1
- package/dist/dts/components/charts/echarts/ReactECharts.d.ts.map +1 -1
- package/dist/dts/components/charts/echarts/ReactECharts.js +9 -14
- package/dist/dts/components/charts/echarts/ReactECharts.js.map +1 -1
- package/dist/dts/components/charts/tests/utils.unit.test.js +2 -2
- package/dist/dts/components/charts/tests/utils.unit.test.js.map +1 -1
- package/dist/dts/components/charts/types.d.ts +3 -3
- package/dist/dts/components/charts/types.d.ts.map +1 -1
- package/dist/dts/components/charts/utils.d.ts +2 -3
- package/dist/dts/components/charts/utils.d.ts.map +1 -1
- package/dist/dts/components/charts/utils.js +2 -3
- package/dist/dts/components/charts/utils.js.map +1 -1
- package/dist/dts/components/counts/CountsValue.js +1 -1
- package/dist/dts/components/counts/CountsValue.js.map +1 -1
- package/dist/dts/components/facets/EnumFacet.d.ts +3 -3
- package/dist/dts/components/facets/EnumFacet.d.ts.map +1 -1
- package/dist/dts/components/facets/EnumFacet.js +8 -233
- package/dist/dts/components/facets/EnumFacet.js.map +1 -1
- package/dist/dts/components/facets/ExactValueFacet.js +4 -4
- package/dist/dts/components/facets/ExactValueFacet.js.map +1 -1
- package/dist/dts/components/facets/FacetControlsHeader.d.ts +24 -0
- package/dist/dts/components/facets/FacetControlsHeader.d.ts.map +1 -0
- package/dist/dts/components/facets/FacetControlsHeader.js +53 -0
- package/dist/dts/components/facets/FacetControlsHeader.js.map +1 -0
- package/dist/dts/components/facets/FacetEnumList.d.ts +16 -0
- package/dist/dts/components/facets/FacetEnumList.d.ts.map +1 -0
- package/dist/dts/components/facets/FacetEnumList.js +234 -0
- package/dist/dts/components/facets/FacetEnumList.js.map +1 -0
- package/dist/dts/components/facets/FacetExpander.d.ts.map +1 -1
- package/dist/dts/components/facets/FacetExpander.js +2 -2
- package/dist/dts/components/facets/FacetExpander.js.map +1 -1
- package/dist/dts/components/facets/FacetSelector.d.ts +13 -0
- package/dist/dts/components/facets/FacetSelector.d.ts.map +1 -0
- package/dist/dts/components/facets/FacetSelector.js +58 -0
- package/dist/dts/components/facets/FacetSelector.js.map +1 -0
- package/dist/dts/components/facets/MultiSelectValueFacet.js +5 -5
- package/dist/dts/components/facets/MultiSelectValueFacet.js.map +1 -1
- package/dist/dts/components/facets/RangeFacet.d.ts +4 -5
- package/dist/dts/components/facets/RangeFacet.d.ts.map +1 -1
- package/dist/dts/components/facets/RangeFacet.js +4 -4
- package/dist/dts/components/facets/RangeFacet.js.map +1 -1
- package/dist/dts/components/facets/components.d.ts +1 -1
- package/dist/dts/components/facets/components.d.ts.map +1 -1
- package/dist/dts/components/facets/components.js +3 -3
- package/dist/dts/components/facets/components.js.map +1 -1
- package/dist/dts/components/facets/constants.d.ts +1 -0
- package/dist/dts/components/facets/constants.d.ts.map +1 -1
- package/dist/dts/components/facets/constants.js +1 -0
- package/dist/dts/components/facets/constants.js.map +1 -1
- package/dist/dts/components/facets/createFacetCard.js +4 -4
- package/dist/dts/components/facets/createFacetCard.js.map +1 -1
- package/dist/dts/components/facets/index.d.ts +5 -0
- package/dist/dts/components/facets/index.d.ts.map +1 -0
- package/dist/dts/components/facets/index.js +5 -0
- package/dist/dts/components/facets/index.js.map +1 -0
- package/dist/dts/components/facets/types.d.ts +29 -13
- package/dist/dts/components/facets/types.d.ts.map +1 -1
- package/dist/dts/components/facets/types.js.map +1 -1
- package/dist/dts/components/facets/utils.d.ts +2 -2
- package/dist/dts/components/facets/utils.d.ts.map +1 -1
- package/dist/dts/components/facets/utils.js +11 -5
- package/dist/dts/components/facets/utils.js.map +1 -1
- package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/CohortPanel.js +4 -2
- package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
- package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/RowTableDetailsPanel.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.js +21 -9
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryRepresentation.js +2 -2
- package/dist/dts/features/CohortBuilder/QueryRepresentation.js.map +1 -1
- package/dist/dts/features/CohortBuilder/types.d.ts +6 -4
- package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/types.js.map +1 -1
- package/dist/dts/features/CohortDiscovery/ActionButtonGroup.d.ts +3 -0
- package/dist/dts/features/CohortDiscovery/ActionButtonGroup.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/ActionButtonGroup.js +13 -0
- package/dist/dts/features/CohortDiscovery/ActionButtonGroup.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts +16 -0
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js +70 -0
- package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/CohortDiscovery.d.ts +4 -0
- package/dist/dts/features/CohortDiscovery/CohortDiscovery.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/CohortDiscovery.js +17 -0
- package/dist/dts/features/CohortDiscovery/CohortDiscovery.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/FacetSelectionPanel.d.ts +12 -0
- package/dist/dts/features/CohortDiscovery/FacetSelectionPanel.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/FacetSelectionPanel.js +26 -0
- package/dist/dts/features/CohortDiscovery/FacetSelectionPanel.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterExpandSlice.d.ts +11 -0
- package/dist/dts/features/CohortDiscovery/FilterExpandSlice.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterExpandSlice.js +34 -0
- package/dist/dts/features/CohortDiscovery/FilterExpandSlice.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts +16 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.js +22 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/FacetPanelDataHeader.d.ts +8 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/FacetPanelDataHeader.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/FacetPanelDataHeader.js +8 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/FacetPanelDataHeader.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts +5 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.js +10 -0
- package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/IndexPanel.d.ts +4 -0
- package/dist/dts/features/CohortDiscovery/IndexPanel.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/IndexPanel.js +96 -0
- package/dist/dts/features/CohortDiscovery/IndexPanel.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/SelectedFacetsSlice.d.ts +14 -0
- package/dist/dts/features/CohortDiscovery/SelectedFacetsSlice.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/SelectedFacetsSlice.js +56 -0
- package/dist/dts/features/CohortDiscovery/SelectedFacetsSlice.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/appApi.d.ts +19 -0
- package/dist/dts/features/CohortDiscovery/appApi.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/appApi.js +27 -0
- package/dist/dts/features/CohortDiscovery/appApi.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/hooks.d.ts +4 -0
- package/dist/dts/features/CohortDiscovery/hooks.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/hooks.js +17 -0
- package/dist/dts/features/CohortDiscovery/hooks.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/registerApp.d.ts +3 -0
- package/dist/dts/features/CohortDiscovery/registerApp.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/registerApp.js +17 -0
- package/dist/dts/features/CohortDiscovery/registerApp.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/types.d.ts +12 -0
- package/dist/dts/features/CohortDiscovery/types.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/types.js +2 -0
- package/dist/dts/features/CohortDiscovery/types.js.map +1 -0
- package/dist/dts/features/CohortDiscovery/utils.d.ts +3 -0
- package/dist/dts/features/CohortDiscovery/utils.d.ts.map +1 -0
- package/dist/dts/features/CohortDiscovery/utils.js +10 -0
- package/dist/dts/features/CohortDiscovery/utils.js.map +1 -0
- package/dist/dts/features/CohortDiversity/CohortDiversityApp.d.ts +4 -0
- package/dist/dts/features/CohortDiversity/CohortDiversityApp.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/CohortDiversityApp.js +54 -0
- package/dist/dts/features/CohortDiversity/CohortDiversityApp.js.map +1 -0
- package/dist/dts/features/CohortDiversity/ComnparisonCard.d.ts +15 -0
- package/dist/dts/features/CohortDiversity/ComnparisonCard.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/ComnparisonCard.js +32 -0
- package/dist/dts/features/CohortDiversity/ComnparisonCard.js.map +1 -0
- package/dist/dts/features/CohortDiversity/ComparisonCards.d.ts +15 -0
- package/dist/dts/features/CohortDiversity/ComparisonCards.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/ComparisonCards.js +14 -0
- package/dist/dts/features/CohortDiversity/ComparisonCards.js.map +1 -0
- package/dist/dts/features/CohortDiversity/appApi.d.ts +8 -0
- package/dist/dts/features/CohortDiversity/appApi.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/appApi.js +4 -0
- package/dist/dts/features/CohortDiversity/appApi.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/BarComparison.d.ts +5 -0
- package/dist/dts/features/CohortDiversity/charts/BarComparison.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/BarComparison.js +70 -0
- package/dist/dts/features/CohortDiversity/charts/BarComparison.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/ChartCard.d.ts +16 -0
- package/dist/dts/features/CohortDiversity/charts/ChartCard.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/ChartCard.js +45 -0
- package/dist/dts/features/CohortDiversity/charts/ChartCard.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/ComparisonCharts.d.ts +13 -0
- package/dist/dts/features/CohortDiversity/charts/ComparisonCharts.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/ComparisonCharts.js +18 -0
- package/dist/dts/features/CohortDiversity/charts/ComparisonCharts.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/RadarComparison.d.ts +5 -0
- package/dist/dts/features/CohortDiversity/charts/RadarComparison.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/RadarComparison.js +90 -0
- package/dist/dts/features/CohortDiversity/charts/RadarComparison.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/diversityChartsFactory.d.ts +6 -0
- package/dist/dts/features/CohortDiversity/charts/diversityChartsFactory.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/diversityChartsFactory.js +24 -0
- package/dist/dts/features/CohortDiversity/charts/diversityChartsFactory.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/types.d.ts +12 -0
- package/dist/dts/features/CohortDiversity/charts/types.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/types.js +2 -0
- package/dist/dts/features/CohortDiversity/charts/types.js.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/utils.d.ts +2 -0
- package/dist/dts/features/CohortDiversity/charts/utils.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/charts/utils.js +4 -0
- package/dist/dts/features/CohortDiversity/charts/utils.js.map +1 -0
- package/dist/dts/features/CohortDiversity/diversityApi.d.ts +141 -0
- package/dist/dts/features/CohortDiversity/diversityApi.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/diversityApi.js +14 -0
- package/dist/dts/features/CohortDiversity/diversityApi.js.map +1 -0
- package/dist/dts/features/CohortDiversity/registerApp.d.ts +3 -0
- package/dist/dts/features/CohortDiversity/registerApp.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/registerApp.js +19 -0
- package/dist/dts/features/CohortDiversity/registerApp.js.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsCard.d.ts +9 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsCard.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsCard.js +68 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsCard.js.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsPanel.d.ts +13 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsPanel.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsPanel.js +16 -0
- package/dist/dts/features/CohortDiversity/statistics/StatisticsPanel.js.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/data/data.d.ts +2 -0
- package/dist/dts/features/CohortDiversity/statistics/data/data.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/data/data.js +50 -0
- package/dist/dts/features/CohortDiversity/statistics/data/data.js.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/data/tests/diversityResponse.json +228 -0
- package/dist/dts/features/CohortDiversity/statistics/data/tests/processHistogramResponse.unit.test.d.ts +2 -0
- package/dist/dts/features/CohortDiversity/statistics/data/tests/processHistogramResponse.unit.test.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/data/tests/processHistogramResponse.unit.test.js +365 -0
- package/dist/dts/features/CohortDiversity/statistics/data/tests/processHistogramResponse.unit.test.js.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/data/utils.d.ts +49 -0
- package/dist/dts/features/CohortDiversity/statistics/data/utils.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/data/utils.js +146 -0
- package/dist/dts/features/CohortDiversity/statistics/data/utils.js.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/queries.d.ts +6 -0
- package/dist/dts/features/CohortDiversity/statistics/queries.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/statistics/queries.js +24 -0
- package/dist/dts/features/CohortDiversity/statistics/queries.js.map +1 -0
- package/dist/dts/features/CohortDiversity/types.d.ts +26 -0
- package/dist/dts/features/CohortDiversity/types.d.ts.map +1 -0
- package/dist/dts/features/CohortDiversity/types.js +2 -0
- package/dist/dts/features/CohortDiversity/types.js.map +1 -0
- package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts.map +1 -1
- package/dist/dts/features/Discovery/Charts/ChartsPanel.js +44 -33
- package/dist/dts/features/Discovery/Charts/ChartsPanel.js.map +1 -1
- package/dist/dts/features/Discovery/TableRenderers/RowRendererFactory.d.ts.map +1 -1
- package/dist/dts/features/Discovery/TableRenderers/RowRendererFactory.js +1 -1
- package/dist/dts/features/Discovery/TableRenderers/RowRendererFactory.js.map +1 -1
- package/dist/dts/features/Navigation/NavigationBar.d.ts.map +1 -1
- package/dist/dts/features/Navigation/NavigationBar.js +1 -1
- package/dist/dts/features/Navigation/NavigationBar.js.map +1 -1
- package/dist/dts/features/Navigation/TopBar.d.ts.map +1 -1
- package/dist/dts/features/Navigation/TopBar.js +1 -1
- package/dist/dts/features/Navigation/TopBar.js.map +1 -1
- package/dist/dts/index.d.ts +3 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.js +3 -1
- package/dist/dts/index.js.map +1 -1
- package/dist/dts/lib/common/staticProps.js +1 -1
- package/dist/dts/lib/common/staticProps.js.map +1 -1
- package/dist/dts/lib/content/types.d.ts +6 -0
- package/dist/dts/lib/content/types.d.ts.map +1 -1
- package/dist/dts/lib/session/session.js.map +1 -1
- package/dist/dts/pages/admin/authz/data.d.ts.map +1 -1
- package/dist/dts/pages/admin/authz/data.js +5 -2
- package/dist/dts/pages/admin/authz/data.js.map +1 -1
- package/dist/dts/types/common.d.ts +5 -0
- package/dist/dts/types/common.d.ts.map +1 -0
- package/dist/dts/types/common.js +2 -0
- package/dist/dts/types/common.js.map +1 -0
- package/dist/dts/types/index.d.ts +1 -0
- package/dist/dts/types/index.d.ts.map +1 -1
- package/dist/dts/types/index.js +1 -0
- package/dist/dts/types/index.js.map +1 -1
- package/dist/dts/utils/isType.d.ts.map +1 -1
- package/dist/dts/utils/strings.d.ts +4 -0
- package/dist/dts/utils/strings.d.ts.map +1 -1
- package/dist/dts/utils/strings.js +15 -3
- package/dist/dts/utils/strings.js.map +1 -1
- package/dist/esm/index.js +2045 -283
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +36 -22
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
package/dist/cjs/index.js
CHANGED
|
@@ -48,6 +48,11 @@ var io = require('react-icons/io');
|
|
|
48
48
|
var GraphiQL = require('graphiql');
|
|
49
49
|
var fs = require('fs');
|
|
50
50
|
var path = require('path');
|
|
51
|
+
var react$1 = require('redux-persist/integration/react');
|
|
52
|
+
var reduxPersist = require('redux-persist');
|
|
53
|
+
var redux = require('redux');
|
|
54
|
+
var storage = require('redux-persist/lib/storage');
|
|
55
|
+
var toolkit = require('@reduxjs/toolkit');
|
|
51
56
|
var modals = require('@mantine/modals');
|
|
52
57
|
var dynamic = require('next/dynamic');
|
|
53
58
|
var form = require('@mantine/form');
|
|
@@ -667,7 +672,9 @@ const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, c
|
|
|
667
672
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
668
673
|
children: /*#__PURE__*/ jsxRuntime.jsx("header", {
|
|
669
674
|
className: extractClassName('root', mergedClassnames),
|
|
670
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("
|
|
675
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
676
|
+
role: "navigation",
|
|
677
|
+
"aria-label": "top most navigation",
|
|
671
678
|
className: "flex items-center align-middle",
|
|
672
679
|
children: [
|
|
673
680
|
processTopBarItems(items, loginButtonVisibility === LoginButtonVisibility.Visible),
|
|
@@ -813,6 +820,8 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
|
|
|
813
820
|
router$1.pathname
|
|
814
821
|
]);
|
|
815
822
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
823
|
+
role: "navigation",
|
|
824
|
+
"aria-label": "main site navigation",
|
|
816
825
|
className: extractClassName('root', mergedClassnames),
|
|
817
826
|
children: [
|
|
818
827
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -1268,7 +1277,7 @@ class DiscoveryRowRendererFactory {
|
|
|
1268
1277
|
}
|
|
1269
1278
|
static getRowRenderer(type, functionName) {
|
|
1270
1279
|
if (!(type in DiscoveryRowRendererFactory.getInstance().RowRendererCatalog)) {
|
|
1271
|
-
console.
|
|
1280
|
+
console.warn('No row renderer found for type: ', type);
|
|
1272
1281
|
return defaultRowRenderer;
|
|
1273
1282
|
}
|
|
1274
1283
|
return DiscoveryRowRendererFactory.getInstance().RowRendererCatalog[type][functionName] ?? defaultRowRenderer;
|
|
@@ -1488,6 +1497,15 @@ const focusStyles = 'focus-visible:outline-none focus-visible:ring-offset-2 focu
|
|
|
1488
1497
|
const stripTrailingSlash = (str)=>{
|
|
1489
1498
|
return str.endsWith('/') ? str.slice(0, -1) : str;
|
|
1490
1499
|
};
|
|
1500
|
+
const SPECIAL_CASE_FIELDS = {
|
|
1501
|
+
icd_10_code: 'ICD-10 Code'
|
|
1502
|
+
};
|
|
1503
|
+
const toDisplayName = (field)=>{
|
|
1504
|
+
const parsed = field.split('.');
|
|
1505
|
+
const fieldName = parsed.at(-1);
|
|
1506
|
+
if (!fieldName) return 'NotSet';
|
|
1507
|
+
return fieldName.split('_').map((w)=>lodash.capitalize(w)).join(' ');
|
|
1508
|
+
};
|
|
1491
1509
|
|
|
1492
1510
|
const isArrayOfString = (value)=>{
|
|
1493
1511
|
return Array.isArray(value) && value.every((element)=>typeof element === 'string');
|
|
@@ -3102,18 +3120,18 @@ const defaultStatisticRenderer = ({ value, label, ...props })=>{
|
|
|
3102
3120
|
]
|
|
3103
3121
|
});
|
|
3104
3122
|
};
|
|
3105
|
-
const DefaultRendererCatalog$
|
|
3123
|
+
const DefaultRendererCatalog$2 = {
|
|
3106
3124
|
string: {
|
|
3107
3125
|
default: defaultStatisticRenderer
|
|
3108
3126
|
}
|
|
3109
3127
|
};
|
|
3110
|
-
let instance$
|
|
3128
|
+
let instance$4;
|
|
3111
3129
|
const StatisticRendererFactory = ()=>{
|
|
3112
|
-
if (!instance$
|
|
3113
|
-
instance$
|
|
3114
|
-
instance$
|
|
3130
|
+
if (!instance$4) {
|
|
3131
|
+
instance$4 = new RenderFactoryTypedInstance();
|
|
3132
|
+
instance$4.registerRendererCatalog(DefaultRendererCatalog$2);
|
|
3115
3133
|
}
|
|
3116
|
-
return instance$
|
|
3134
|
+
return instance$4;
|
|
3117
3135
|
};
|
|
3118
3136
|
|
|
3119
3137
|
const BuildSummaryStatisticPanel = (summaries = [])=>{
|
|
@@ -3179,11 +3197,10 @@ const processRangeKeyLabel = (key)=>{
|
|
|
3179
3197
|
/**
|
|
3180
3198
|
* Computes the row span for each item in the charts object.
|
|
3181
3199
|
*
|
|
3182
|
-
* @param {
|
|
3200
|
+
* @param { number } numItems - The charts object containing summary charts.
|
|
3183
3201
|
* @param {number} [numCols=3] - The number of columns per row.
|
|
3184
3202
|
* @returns {number[]} - An array of row spans for each item in the charts object.
|
|
3185
|
-
*/ const computeRowSpan = (
|
|
3186
|
-
const numItems = Object.keys(charts).length;
|
|
3203
|
+
*/ const computeRowSpan = (numItems, numCols = 3)=>{
|
|
3187
3204
|
// compute the row span for the last row
|
|
3188
3205
|
const numLastRow = numItems % numCols;
|
|
3189
3206
|
let spans = new Array(numItems - numLastRow).fill(Math.floor(12 / numCols));
|
|
@@ -3192,24 +3209,15 @@ const processRangeKeyLabel = (key)=>{
|
|
|
3192
3209
|
};
|
|
3193
3210
|
|
|
3194
3211
|
const ReactECharts = ({ option, style, settings, loading, theme })=>{
|
|
3195
|
-
const
|
|
3212
|
+
const [chartRoot, setChartRoot] = React.useState(undefined);
|
|
3213
|
+
const [chartRef, rect] = hooks.useResizeObserver();
|
|
3196
3214
|
useDeepCompare.useDeepCompareEffect(()=>{
|
|
3197
3215
|
// Initialize chart
|
|
3198
3216
|
let chart;
|
|
3199
3217
|
if (chartRef.current !== null) {
|
|
3200
3218
|
chart = echarts.init(chartRef.current, theme);
|
|
3201
3219
|
}
|
|
3202
|
-
|
|
3203
|
-
// ResizeObserver is leading to a bit janky UX
|
|
3204
|
-
function resizeChart(event) {
|
|
3205
|
-
chart?.resize();
|
|
3206
|
-
}
|
|
3207
|
-
window.addEventListener('resize', resizeChart);
|
|
3208
|
-
// Return cleanup function
|
|
3209
|
-
return ()=>{
|
|
3210
|
-
chart?.dispose();
|
|
3211
|
-
window.removeEventListener('resize', resizeChart);
|
|
3212
|
-
};
|
|
3220
|
+
setChartRoot(chart);
|
|
3213
3221
|
}, [
|
|
3214
3222
|
theme
|
|
3215
3223
|
]);
|
|
@@ -3234,7 +3242,14 @@ const ReactECharts = ({ option, style, settings, loading, theme })=>{
|
|
|
3234
3242
|
}, [
|
|
3235
3243
|
loading
|
|
3236
3244
|
]);
|
|
3245
|
+
useDeepCompare.useDeepCompareEffect(()=>{
|
|
3246
|
+
chartRoot?.resize();
|
|
3247
|
+
}, [
|
|
3248
|
+
rect
|
|
3249
|
+
]);
|
|
3237
3250
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
3251
|
+
role: "figure",
|
|
3252
|
+
"aria-label": "Data Chart",
|
|
3238
3253
|
ref: chartRef,
|
|
3239
3254
|
style: {
|
|
3240
3255
|
width: '100%',
|
|
@@ -3490,13 +3505,13 @@ const DefaultChartCatalog = {
|
|
|
3490
3505
|
donut: DonutChart
|
|
3491
3506
|
}
|
|
3492
3507
|
};
|
|
3493
|
-
let instance$
|
|
3508
|
+
let instance$3 = undefined;
|
|
3494
3509
|
const ChartRendererFactory = ()=>{
|
|
3495
|
-
if (!instance$
|
|
3496
|
-
instance$
|
|
3497
|
-
instance$
|
|
3510
|
+
if (!instance$3) {
|
|
3511
|
+
instance$3 = new RenderFactoryTypedInstance();
|
|
3512
|
+
instance$3.registerRendererCatalog(DefaultChartCatalog);
|
|
3498
3513
|
}
|
|
3499
|
-
return instance$
|
|
3514
|
+
return instance$3;
|
|
3500
3515
|
};
|
|
3501
3516
|
|
|
3502
3517
|
/** createChart selects which type of chart element to create depending on the
|
|
@@ -3524,9 +3539,14 @@ const chartColors = [
|
|
|
3524
3539
|
'#ea7ccc'
|
|
3525
3540
|
];
|
|
3526
3541
|
//The Charts component maps the data from ChartsProps into a grid of createChart() ReactNodes
|
|
3527
|
-
const Charts = ({
|
|
3528
|
-
const spans = computeRowSpan(charts, numCols);
|
|
3542
|
+
const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style = 'tile', showLegends = false })=>{
|
|
3543
|
+
const spans = computeRowSpan(Object.keys(charts).length, numCols);
|
|
3529
3544
|
const chartCard = (field, indexNum)=>{
|
|
3545
|
+
if (!(field in data)) {
|
|
3546
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
|
|
3547
|
+
message: `${field} not found in data`
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3530
3550
|
const LegendRows = ({ data })=>{
|
|
3531
3551
|
const moreThanMaxRows = data.length > MAX_LEGEND_ROWS;
|
|
3532
3552
|
const limitedRows = moreThanMaxRows ? data.slice(0, MAX_LEGEND_ROWS) : data;
|
|
@@ -3666,7 +3686,7 @@ const Charts = ({ index, charts, data, counts, isSuccess, numCols = DEFAULT_COLS
|
|
|
3666
3686
|
td: 'p-1 leading-3',
|
|
3667
3687
|
th: 'p-1 leading-3 [text-shadow:_1px_0_#000]',
|
|
3668
3688
|
thead: 'border-b',
|
|
3669
|
-
tbody:
|
|
3689
|
+
tbody: "before:content-[''] before:block before:p-1"
|
|
3670
3690
|
},
|
|
3671
3691
|
children: [
|
|
3672
3692
|
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Thead, {
|
|
@@ -3699,7 +3719,7 @@ const Charts = ({ index, charts, data, counts, isSuccess, numCols = DEFAULT_COLS
|
|
|
3699
3719
|
})
|
|
3700
3720
|
]
|
|
3701
3721
|
})
|
|
3702
|
-
}, `${
|
|
3722
|
+
}, `${indexNum}-charts-${field}-col`);
|
|
3703
3723
|
};
|
|
3704
3724
|
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Grid, {
|
|
3705
3725
|
className: "w-full",
|
|
@@ -3951,10 +3971,11 @@ const ChartsPanel = ({ config })=>{
|
|
|
3951
3971
|
const chartDataTemp = {};
|
|
3952
3972
|
config?.charts?.forEach((chart, index)=>{
|
|
3953
3973
|
chartDataTemp[`testName${index}`] = {
|
|
3974
|
+
//TODO use from data
|
|
3954
3975
|
title: chart.title,
|
|
3955
3976
|
chartType: chart.chartType,
|
|
3956
3977
|
valueType: chart.valueType,
|
|
3957
|
-
dataLabels: chart.dataLabels
|
|
3978
|
+
dataLabels: chart.dataLabels
|
|
3958
3979
|
};
|
|
3959
3980
|
});
|
|
3960
3981
|
return chartDataTemp;
|
|
@@ -3999,10 +4020,9 @@ const ChartsPanel = ({ config })=>{
|
|
|
3999
4020
|
children: /*#__PURE__*/ jsxRuntime.jsx(Charts, {
|
|
4000
4021
|
showLegends: showLegends,
|
|
4001
4022
|
style: "box",
|
|
4002
|
-
index: 'subjectsCharts',
|
|
4003
4023
|
charts: chartsProperties(),
|
|
4004
4024
|
data: {
|
|
4005
|
-
|
|
4025
|
+
testName0: [
|
|
4006
4026
|
{
|
|
4007
4027
|
key: 'a',
|
|
4008
4028
|
count: 11
|
|
@@ -4024,7 +4044,7 @@ const ChartsPanel = ({ config })=>{
|
|
|
4024
4044
|
count: 0
|
|
4025
4045
|
}
|
|
4026
4046
|
],
|
|
4027
|
-
|
|
4047
|
+
testName1: [
|
|
4028
4048
|
{
|
|
4029
4049
|
key: 'a',
|
|
4030
4050
|
count: 11
|
|
@@ -4038,7 +4058,7 @@ const ChartsPanel = ({ config })=>{
|
|
|
4038
4058
|
count: 3
|
|
4039
4059
|
}
|
|
4040
4060
|
],
|
|
4041
|
-
|
|
4061
|
+
testName2: [
|
|
4042
4062
|
{
|
|
4043
4063
|
key: 'a',
|
|
4044
4064
|
count: 11
|
|
@@ -4052,7 +4072,7 @@ const ChartsPanel = ({ config })=>{
|
|
|
4052
4072
|
count: 3
|
|
4053
4073
|
}
|
|
4054
4074
|
],
|
|
4055
|
-
|
|
4075
|
+
testName3: [
|
|
4056
4076
|
{
|
|
4057
4077
|
key: 'a',
|
|
4058
4078
|
count: 1
|
|
@@ -5947,7 +5967,7 @@ const LoginPanel = (loginConfig)=>{
|
|
|
5947
5967
|
/*#__PURE__*/ jsxRuntime.jsx(LoginProvidersPanel, {
|
|
5948
5968
|
handleLoginSelected: handleFenceLoginSelected
|
|
5949
5969
|
}),
|
|
5950
|
-
loginConfig?.showCredentialsLogin && /*#__PURE__*/ jsxRuntime.jsx(CredentialsLogin, {
|
|
5970
|
+
loginConfig?.showCredentialsLogin && process.env.NODE_ENV === 'development' && /*#__PURE__*/ jsxRuntime.jsx(CredentialsLogin, {
|
|
5951
5971
|
handleLogin: handleCredentialsLogin
|
|
5952
5972
|
}),
|
|
5953
5973
|
bottomContent?.map((content, index)=>content?.email ? /*#__PURE__*/ React.createElement(ContactWithEmailContent, {
|
|
@@ -6429,7 +6449,7 @@ const processRangeData = (data)=>{
|
|
|
6429
6449
|
}
|
|
6430
6450
|
};
|
|
6431
6451
|
// Process facets to determine if they are enum, exact, or range
|
|
6432
|
-
const classifyFacets = (data, index, fieldMapping, facetDefinitionsFromConfig)=>{
|
|
6452
|
+
const classifyFacets = (data, index, fieldMapping = [], facetDefinitionsFromConfig = {})=>{
|
|
6433
6453
|
if (typeof data !== 'object' || data === null) return {};
|
|
6434
6454
|
// otherwise enum facet
|
|
6435
6455
|
return Object.entries(data).reduce((acc, [fieldKey, value])=>{
|
|
@@ -6437,7 +6457,7 @@ const classifyFacets = (data, index, fieldMapping, facetDefinitionsFromConfig)=>
|
|
|
6437
6457
|
const dataField = fieldKey.split('.')?.slice(-1)[0] ?? fieldKey;
|
|
6438
6458
|
// check if range facet
|
|
6439
6459
|
const type = value.length === 1 && lodash.isArray(value[0].key) ? 'range' : 'enum';
|
|
6440
|
-
const facetName = fieldMapping.find((x)=>x.field === fieldKey)?.name ??
|
|
6460
|
+
const facetName = fieldMapping.find((x)=>x.field === fieldKey)?.name ?? core.fieldNameToTitle(fieldKey);
|
|
6441
6461
|
const facetDef = facetDefinitionsFromConfig[fieldKey] ?? {};
|
|
6442
6462
|
return {
|
|
6443
6463
|
...acc,
|
|
@@ -6448,7 +6468,7 @@ const classifyFacets = (data, index, fieldMapping, facetDefinitionsFromConfig)=>
|
|
|
6448
6468
|
type: facetDef.type ?? type,
|
|
6449
6469
|
index: index,
|
|
6450
6470
|
description: facetDef.description ?? 'Not Available',
|
|
6451
|
-
label: facetDef.
|
|
6471
|
+
label: facetDef.label ?? facetName,
|
|
6452
6472
|
// assumption is that the initial data has the min and max values
|
|
6453
6473
|
range: facetDef.range ?? type === 'range' ? {
|
|
6454
6474
|
minimum: Math.floor(Number(value[0].key[0])),
|
|
@@ -6490,7 +6510,10 @@ const buildNested = (field, leafOperand)=>{
|
|
|
6490
6510
|
};
|
|
6491
6511
|
};
|
|
6492
6512
|
const useGetFacetFilters = (index, field)=>{
|
|
6493
|
-
return core.useCoreSelector((state)=>core.selectIndexedFilterByName(state, index, field)
|
|
6513
|
+
return core.useCoreSelector((state)=>core.selectIndexedFilterByName(state, index, field) ?? {
|
|
6514
|
+
operator: 'and',
|
|
6515
|
+
operands: []
|
|
6516
|
+
});
|
|
6494
6517
|
};
|
|
6495
6518
|
/**
|
|
6496
6519
|
* Given an operation, determine if range is open or closed and extract
|
|
@@ -6549,47 +6572,157 @@ inline-flex
|
|
|
6549
6572
|
items-center
|
|
6550
6573
|
hover:text-primary-lightest
|
|
6551
6574
|
`;
|
|
6552
|
-
const controlsIconStyle = 'text-
|
|
6575
|
+
const controlsIconStyle = 'text-secondary-contrast hover:text-secondary-lighter';
|
|
6553
6576
|
const FacetText = tw.div`
|
|
6554
|
-
text-secondary-contrast font-heading font-semibold text-
|
|
6577
|
+
text-secondary-contrast font-heading font-semibold text-sm break-words
|
|
6555
6578
|
`;
|
|
6556
6579
|
const FacetHeader = tw.div`
|
|
6557
|
-
flex items-start justify-between flex-nowrap bg-secondary px-1.5
|
|
6580
|
+
flex items-start justify-between items-center flex-nowrap bg-secondary px-1.5
|
|
6558
6581
|
`;
|
|
6559
6582
|
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
}
|
|
6583
|
+
/**
|
|
6584
|
+
* Component for the common controls on the header of different type facet cards
|
|
6585
|
+
* @param field - filter this FacetCard manages
|
|
6586
|
+
* @param description - describes information about the facet
|
|
6587
|
+
* @param hooks - object defining the hooks required by this facet component
|
|
6588
|
+
* @param facetName - name of the Facet in human-readable form
|
|
6589
|
+
* @param showSearch - if the search icon show be displayed
|
|
6590
|
+
* @param showFlip - if the flip icon should be displayed
|
|
6591
|
+
* @param showClearSelection - if the clear selection icon should be displayed
|
|
6592
|
+
* @param isFacetView - if the facet selection view (and not the chart view) is displayed
|
|
6593
|
+
* @param toggleFlip - function to switch the facet/chart view
|
|
6594
|
+
* @param toggleSearch - function to switch if the search bart is displayed
|
|
6595
|
+
* @param dismissCallback - if facet can be removed, supply a function which will ensure the "dismiss" control will be visible
|
|
6596
|
+
* @param header - object containing the display components to use for the header
|
|
6597
|
+
*/ const FacetControlsHeader = ({ field, description, hooks, facetName, showSearch = false, showFlip = false, showClearSelection = true, isFacetView = false, toggleFlip = undefined, toggleSearch = undefined, dismissCallback = undefined, header = {
|
|
6598
|
+
Panel: FacetHeader,
|
|
6599
|
+
Label: FacetText,
|
|
6600
|
+
iconStyle: controlsIconStyle
|
|
6601
|
+
} })=>{
|
|
6602
|
+
const clearFilters = hooks.useClearFilter();
|
|
6603
|
+
const isFilterExpanded = hooks?.useFilterExpanded && hooks.useFilterExpanded(field);
|
|
6604
|
+
const toggleExpandFilter = hooks?.useToggleExpandFilter && hooks.useToggleExpandFilter();
|
|
6605
|
+
React.useEffect(()=>{
|
|
6606
|
+
// Initialize filter as expanded
|
|
6607
|
+
if (isFilterExpanded === undefined && toggleExpandFilter) {
|
|
6608
|
+
toggleExpandFilter(field, true);
|
|
6609
|
+
}
|
|
6610
|
+
}, [
|
|
6611
|
+
field,
|
|
6612
|
+
isFilterExpanded,
|
|
6613
|
+
toggleExpandFilter
|
|
6614
|
+
]);
|
|
6615
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(header.Panel, {
|
|
6616
|
+
children: [
|
|
6617
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
6618
|
+
className: "flex flex-row items-center",
|
|
6619
|
+
children: [
|
|
6620
|
+
toggleExpandFilter && /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6621
|
+
label: isFilterExpanded ? 'Collapse card' : 'Expand card',
|
|
6622
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
|
|
6623
|
+
variant: "subtle",
|
|
6624
|
+
onClick: ()=>toggleExpandFilter(field, !isFilterExpanded),
|
|
6625
|
+
className: "mt-0.5 -ml-1.5",
|
|
6626
|
+
"aria-expanded": isFilterExpanded,
|
|
6627
|
+
"aria-label": isFilterExpanded ? 'Collapse card' : 'Expand card',
|
|
6628
|
+
children: isFilterExpanded ? /*#__PURE__*/ jsxRuntime.jsx(md.MdExpandLess, {
|
|
6629
|
+
size: "3em",
|
|
6630
|
+
color: "accent.4",
|
|
6631
|
+
"aria-hidden": "true"
|
|
6632
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(md.MdExpandMore, {
|
|
6633
|
+
size: "3em",
|
|
6634
|
+
color: "accent.4",
|
|
6635
|
+
"aria-hidden": "true"
|
|
6636
|
+
})
|
|
6637
|
+
})
|
|
6638
|
+
}),
|
|
6639
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6640
|
+
label: description,
|
|
6641
|
+
position: "bottom-start",
|
|
6642
|
+
multiline: true,
|
|
6643
|
+
w: 220,
|
|
6644
|
+
withArrow: true,
|
|
6645
|
+
transitionProps: {
|
|
6646
|
+
duration: 200,
|
|
6647
|
+
transition: 'fade'
|
|
6648
|
+
},
|
|
6649
|
+
disabled: !description,
|
|
6650
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(header.Label, {
|
|
6651
|
+
children: facetName ? facetName : core.fieldNameToTitle(field)
|
|
6652
|
+
})
|
|
6653
|
+
})
|
|
6654
|
+
]
|
|
6655
|
+
}),
|
|
6656
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
6657
|
+
className: "flex flex-row",
|
|
6658
|
+
children: [
|
|
6659
|
+
showSearch ? /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6660
|
+
label: "Search values",
|
|
6661
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6662
|
+
onClick: ()=>{
|
|
6663
|
+
if (toggleExpandFilter) toggleExpandFilter(field, true);
|
|
6664
|
+
if (toggleSearch) toggleSearch();
|
|
6665
|
+
},
|
|
6666
|
+
"aria-label": "Search",
|
|
6667
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdSearch, {
|
|
6668
|
+
size: "1.45em",
|
|
6669
|
+
className: header.iconStyle,
|
|
6670
|
+
"aria-hidden": "true"
|
|
6671
|
+
})
|
|
6672
|
+
})
|
|
6673
|
+
}) : null,
|
|
6674
|
+
showFlip ? /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6675
|
+
label: isFacetView ? 'Chart view' : 'Selection view',
|
|
6676
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6677
|
+
onClick: ()=>{
|
|
6678
|
+
if (toggleExpandFilter) toggleExpandFilter(field, true);
|
|
6679
|
+
if (toggleFlip) toggleFlip();
|
|
6680
|
+
},
|
|
6681
|
+
"aria-pressed": !isFacetView,
|
|
6682
|
+
"aria-label": isFacetView ? 'Chart view' : 'Selection view',
|
|
6683
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdFlip, {
|
|
6684
|
+
size: "1.45em",
|
|
6685
|
+
className: header.iconStyle,
|
|
6686
|
+
"aria-hidden": "true"
|
|
6687
|
+
})
|
|
6688
|
+
})
|
|
6689
|
+
}) : null,
|
|
6690
|
+
showClearSelection && /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6691
|
+
label: "Clear selection",
|
|
6692
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6693
|
+
onClick: ()=>clearFilters(field),
|
|
6694
|
+
"aria-label": "clear selection",
|
|
6695
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(fa.FaUndo, {
|
|
6696
|
+
size: "1.0em",
|
|
6697
|
+
className: header.iconStyle,
|
|
6698
|
+
"aria-hidden": "true"
|
|
6699
|
+
})
|
|
6700
|
+
})
|
|
6701
|
+
}),
|
|
6702
|
+
dismissCallback ? /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6703
|
+
label: "Remove the facet",
|
|
6704
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6705
|
+
onClick: ()=>{
|
|
6706
|
+
dismissCallback(field);
|
|
6707
|
+
},
|
|
6708
|
+
"aria-label": "Remove the facet",
|
|
6709
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
|
|
6710
|
+
size: "1.25em",
|
|
6711
|
+
className: header.iconStyle,
|
|
6712
|
+
"aria-hidden": "true"
|
|
6713
|
+
})
|
|
6714
|
+
})
|
|
6715
|
+
}) : null
|
|
6716
|
+
]
|
|
6717
|
+
})
|
|
6718
|
+
]
|
|
6587
6719
|
});
|
|
6588
6720
|
};
|
|
6589
6721
|
|
|
6590
6722
|
const DEFAULT_VISIBLE_ITEMS = 6;
|
|
6591
6723
|
const DEFAULT_MINIMUM = 0;
|
|
6592
6724
|
const DEFAULT_MAXIMUM = 100;
|
|
6725
|
+
const BAD_DATA_MESSAGE = 'No data for this field';
|
|
6593
6726
|
|
|
6594
6727
|
const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
|
|
6595
6728
|
if (sortTypeAndDirection.type === 'alpha') {
|
|
@@ -6689,13 +6822,43 @@ const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
|
|
|
6689
6822
|
});
|
|
6690
6823
|
};
|
|
6691
6824
|
|
|
6825
|
+
const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
|
|
6826
|
+
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
6827
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
6828
|
+
label: label,
|
|
6829
|
+
disabled: !showTooltip,
|
|
6830
|
+
position: "top-start",
|
|
6831
|
+
offset: 5,
|
|
6832
|
+
multiline: true,
|
|
6833
|
+
withArrow: true,
|
|
6834
|
+
arrowOffset: 20,
|
|
6835
|
+
classNames: {
|
|
6836
|
+
tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
|
|
6837
|
+
arrow: 'bg-base-min bg-opacity-90'
|
|
6838
|
+
},
|
|
6839
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
6840
|
+
className: `${className} truncate ... `,
|
|
6841
|
+
ref: (el)=>{
|
|
6842
|
+
if (el) {
|
|
6843
|
+
if (el.clientWidth < el.scrollWidth) {
|
|
6844
|
+
setShowTooltip(true);
|
|
6845
|
+
} else {
|
|
6846
|
+
setShowTooltip(false);
|
|
6847
|
+
}
|
|
6848
|
+
}
|
|
6849
|
+
},
|
|
6850
|
+
children: children
|
|
6851
|
+
})
|
|
6852
|
+
});
|
|
6853
|
+
};
|
|
6854
|
+
|
|
6692
6855
|
const ExpanderLabel = tw.div`
|
|
6693
6856
|
text-accent-content-darker
|
|
6694
6857
|
p-1
|
|
6695
6858
|
font-bold
|
|
6696
6859
|
cursor-pointer
|
|
6697
6860
|
text-xs
|
|
6698
|
-
font-content
|
|
6861
|
+
font-content
|
|
6699
6862
|
`;
|
|
6700
6863
|
/**
|
|
6701
6864
|
* Component which manages the compact/expanded state of a FacetCard
|
|
@@ -6704,7 +6867,7 @@ font-content-noto
|
|
|
6704
6867
|
* @param onShowChanged - callback to call when the expand/compact button is clicked
|
|
6705
6868
|
*/ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
|
|
6706
6869
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
6707
|
-
className:
|
|
6870
|
+
className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
|
|
6708
6871
|
children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
6709
6872
|
onClick: ()=>onShowChanged(!isGroupExpanded),
|
|
6710
6873
|
"data-testid": "plus-icon",
|
|
@@ -6713,7 +6876,7 @@ font-content-noto
|
|
|
6713
6876
|
children: [
|
|
6714
6877
|
/*#__PURE__*/ jsxRuntime.jsx(md.MdAddCircle, {
|
|
6715
6878
|
className: "text-accent",
|
|
6716
|
-
size: "
|
|
6879
|
+
size: "1rem",
|
|
6717
6880
|
"aria-hidden": "true"
|
|
6718
6881
|
}, "show-more"),
|
|
6719
6882
|
/*#__PURE__*/ jsxRuntime.jsxs(ExpanderLabel, {
|
|
@@ -6732,7 +6895,7 @@ font-content-noto
|
|
|
6732
6895
|
children: [
|
|
6733
6896
|
/*#__PURE__*/ jsxRuntime.jsx(md.MdRemoveCircle, {
|
|
6734
6897
|
className: "text-accent",
|
|
6735
|
-
size: "
|
|
6898
|
+
size: "1rem",
|
|
6736
6899
|
onClick: ()=>onShowChanged(!isGroupExpanded),
|
|
6737
6900
|
"aria-hidden": "true"
|
|
6738
6901
|
}, "show-less"),
|
|
@@ -6745,35 +6908,32 @@ font-content-noto
|
|
|
6745
6908
|
});
|
|
6746
6909
|
};
|
|
6747
6910
|
|
|
6748
|
-
const
|
|
6749
|
-
Panel: FacetHeader,
|
|
6750
|
-
Label: FacetText,
|
|
6751
|
-
iconStyle: controlsIconStyle
|
|
6752
|
-
} })=>{
|
|
6911
|
+
const FacetEnumList = ({ field, facetName, hooks, valueLabel, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true })=>{
|
|
6753
6912
|
const [isGroupExpanded, setIsGroupExpanded] = React.useState(false);
|
|
6754
|
-
const
|
|
6913
|
+
const cardRef = React.useRef(null);
|
|
6914
|
+
const searchInputRef = React.useRef(null);
|
|
6755
6915
|
const [searchTerm, setSearchTerm] = React.useState('');
|
|
6916
|
+
const { data, enumFilters, isSuccess, error } = hooks.useGetFacetData(field);
|
|
6917
|
+
const [selectedEnums, setSelectedEnums] = React.useState(enumFilters ?? []);
|
|
6918
|
+
const totalCount = hooks?.useTotalCounts ? hooks.useTotalCounts() : 1;
|
|
6919
|
+
const clearFilters = hooks.useClearFilter();
|
|
6920
|
+
const updateFacetFilters = hooks.useUpdateFacetFilters();
|
|
6921
|
+
const isFilterExpanded = hooks?.useFilterExpanded && hooks.useFilterExpanded(field);
|
|
6922
|
+
const showFilters = isFilterExpanded === undefined || isFilterExpanded;
|
|
6756
6923
|
const [sortedData, setSortedData] = React.useState({});
|
|
6757
6924
|
const [sortType, setSortType] = React.useState({
|
|
6758
6925
|
type: 'alpha',
|
|
6759
6926
|
direction: 'asc'
|
|
6760
6927
|
});
|
|
6761
|
-
const [isFacetView, setIsFacetView] = React.useState(startShowingData);
|
|
6762
|
-
const { data, enumFilters, isSuccess } = dataHooks.useGetFacetData(field);
|
|
6763
|
-
const cardRef = React.useRef(null);
|
|
6764
|
-
const [selectedEnums, setSelectedEnums] = React.useState(enumFilters ?? []);
|
|
6765
|
-
const searchInputRef = React.useRef(null);
|
|
6766
|
-
const totalCount = 1000;
|
|
6767
|
-
// TODO Determine if total count is needed
|
|
6768
|
-
// const totalCount = dataHooks.useTotalCounts();
|
|
6769
|
-
const clearFilters = dataHooks.useClearFilter();
|
|
6770
|
-
const updateFacetFilters = dataHooks.useUpdateFacetFilters();
|
|
6771
6928
|
React.useEffect(()=>{
|
|
6772
6929
|
if (isSearching) {
|
|
6773
6930
|
searchInputRef?.current?.focus();
|
|
6931
|
+
} else if (searchTerm.length > 0) {
|
|
6932
|
+
setSearchTerm('');
|
|
6774
6933
|
}
|
|
6775
6934
|
}, [
|
|
6776
|
-
isSearching
|
|
6935
|
+
isSearching,
|
|
6936
|
+
searchTerm
|
|
6777
6937
|
]);
|
|
6778
6938
|
useDeepCompare.useDeepCompareEffect(()=>{
|
|
6779
6939
|
setSelectedEnums(enumFilters ?? []);
|
|
@@ -6800,13 +6960,6 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
6800
6960
|
updateFacetEnum(field, updated ?? [], updateFacetFilters, clearFilters);
|
|
6801
6961
|
}
|
|
6802
6962
|
};
|
|
6803
|
-
const toggleSearch = ()=>{
|
|
6804
|
-
setIsSearching(!isSearching);
|
|
6805
|
-
setSearchTerm('');
|
|
6806
|
-
};
|
|
6807
|
-
const toggleFlip = ()=>{
|
|
6808
|
-
setIsFacetView(!isFacetView);
|
|
6809
|
-
};
|
|
6810
6963
|
const [facetChartData, setFacetChartData] = React.useState({
|
|
6811
6964
|
filteredData: [],
|
|
6812
6965
|
filteredDataObj: {},
|
|
@@ -6819,9 +6972,9 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
6819
6972
|
const calcCardStyle = useDeepCompare.useDeepCompareCallback((remainingValues)=>{
|
|
6820
6973
|
if (isGroupExpanded) {
|
|
6821
6974
|
const cardHeight = remainingValues > 16 ? 96 : remainingValues > 0 ? Math.min(96, remainingValues * 5 + 40) : 24;
|
|
6822
|
-
return `flex-none
|
|
6975
|
+
return `flex-none h-${cardHeight} overflow-y-scroll pl-3`;
|
|
6823
6976
|
} else {
|
|
6824
|
-
return 'overflow-hidden h-auto';
|
|
6977
|
+
return 'overflow-hidden h-auto mr-3 pl-3';
|
|
6825
6978
|
}
|
|
6826
6979
|
}, [
|
|
6827
6980
|
isGroupExpanded
|
|
@@ -6917,68 +7070,14 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
6917
7070
|
return null; // nothing to render if visibleItems == 0
|
|
6918
7071
|
}
|
|
6919
7072
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
6920
|
-
className:
|
|
6921
|
-
|
|
7073
|
+
className: showFilters ? 'h-full' : 'h-0 invisible',
|
|
7074
|
+
"aria-hidden": !showFilters,
|
|
6922
7075
|
children: [
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
position: "bottom-start",
|
|
6929
|
-
multiline: true,
|
|
6930
|
-
w: 220,
|
|
6931
|
-
withArrow: true,
|
|
6932
|
-
disabled: !description,
|
|
6933
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(header.Label, {
|
|
6934
|
-
children: facetName ? facetName : core.fieldNameToTitle(field)
|
|
6935
|
-
})
|
|
6936
|
-
}),
|
|
6937
|
-
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
6938
|
-
className: "flex flex-row",
|
|
6939
|
-
children: [
|
|
6940
|
-
showSearch ? /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6941
|
-
onClick: toggleSearch,
|
|
6942
|
-
"aria-label": "Search",
|
|
6943
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdSearch, {
|
|
6944
|
-
size: "1.45em",
|
|
6945
|
-
className: header.iconStyle
|
|
6946
|
-
})
|
|
6947
|
-
}) : null,
|
|
6948
|
-
showFlip ? /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6949
|
-
onClick: toggleFlip,
|
|
6950
|
-
"aria-label": "Flip between form and chart",
|
|
6951
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdFlip, {
|
|
6952
|
-
size: "1.45em",
|
|
6953
|
-
className: header.iconStyle
|
|
6954
|
-
})
|
|
6955
|
-
}) : null,
|
|
6956
|
-
/*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6957
|
-
onClick: ()=>clearFilters(field),
|
|
6958
|
-
"aria-label": "clear selection",
|
|
6959
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(fa.FaUndo, {
|
|
6960
|
-
size: "1.25em",
|
|
6961
|
-
className: header.iconStyle
|
|
6962
|
-
})
|
|
6963
|
-
}),
|
|
6964
|
-
dismissCallback ? /*#__PURE__*/ jsxRuntime.jsx(FacetIconButton, {
|
|
6965
|
-
onClick: ()=>{
|
|
6966
|
-
clearFilters(field);
|
|
6967
|
-
dismissCallback(field);
|
|
6968
|
-
},
|
|
6969
|
-
"aria-label": "Remove the facet",
|
|
6970
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
|
|
6971
|
-
size: "1.25em",
|
|
6972
|
-
className: header.iconStyle
|
|
6973
|
-
})
|
|
6974
|
-
}) : null
|
|
6975
|
-
]
|
|
6976
|
-
})
|
|
6977
|
-
]
|
|
6978
|
-
})
|
|
6979
|
-
}),
|
|
6980
|
-
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
6981
|
-
className: "h-full",
|
|
7076
|
+
' ',
|
|
7077
|
+
isSuccess && error ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7078
|
+
className: "m-4 font-content pb-2",
|
|
7079
|
+
children: BAD_DATA_MESSAGE
|
|
7080
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6982
7081
|
children: [
|
|
6983
7082
|
isSearching && /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
|
|
6984
7083
|
value: searchTerm,
|
|
@@ -7004,12 +7103,12 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7004
7103
|
children: [
|
|
7005
7104
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7006
7105
|
children: [
|
|
7007
|
-
/*#__PURE__*/ jsxRuntime.jsx(FacetSortPanel, {
|
|
7106
|
+
showSorting ? /*#__PURE__*/ jsxRuntime.jsx(FacetSortPanel, {
|
|
7008
7107
|
sortType: sortType,
|
|
7009
7108
|
valueLabel: valueLabel,
|
|
7010
7109
|
setSort: setSortType,
|
|
7011
7110
|
field: facetName ? facetName : core.fieldNameToTitle(field)
|
|
7012
|
-
}),
|
|
7111
|
+
}) : false,
|
|
7013
7112
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7014
7113
|
className: facetChartData.cardStyle,
|
|
7015
7114
|
role: "group",
|
|
@@ -7020,14 +7119,14 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7020
7119
|
"data-testid": "loading-spinner"
|
|
7021
7120
|
}),
|
|
7022
7121
|
facetChartData.filteredData.length == 0 ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7023
|
-
className: "mx-4 font-content",
|
|
7024
|
-
children:
|
|
7122
|
+
className: "mx-4 font-content text-sm",
|
|
7123
|
+
children: BAD_DATA_MESSAGE
|
|
7025
7124
|
}) : isSuccess ? !sortedData || Object.entries(sortedData).length === 0 ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7026
7125
|
className: "mx-4",
|
|
7027
7126
|
children: "No results found"
|
|
7028
7127
|
}) : Object.entries(sortedData ?? {}).map(([value, count])=>{
|
|
7029
7128
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7030
|
-
className: "flex flex-row items-center gap-x-1
|
|
7129
|
+
className: "flex flex-row items-center gap-x-1",
|
|
7031
7130
|
children: [
|
|
7032
7131
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7033
7132
|
className: "flex-none",
|
|
@@ -7035,11 +7134,12 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7035
7134
|
"data-testid": `checkbox-${value}`,
|
|
7036
7135
|
value: value,
|
|
7037
7136
|
size: "xs",
|
|
7038
|
-
color: "accent",
|
|
7137
|
+
color: "accent.4",
|
|
7039
7138
|
onChange: (e)=>handleChange(e.currentTarget.value, e.currentTarget.checked),
|
|
7040
7139
|
"aria-label": `${value}`,
|
|
7041
7140
|
classNames: {
|
|
7042
|
-
input: '
|
|
7141
|
+
input: 'hover:bg-accent-darker',
|
|
7142
|
+
label: 'text-xs font-normal font-content'
|
|
7043
7143
|
},
|
|
7044
7144
|
checked: selectedEnums && selectedEnums.includes(value)
|
|
7045
7145
|
})
|
|
@@ -7047,16 +7147,16 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7047
7147
|
/*#__PURE__*/ jsxRuntime.jsx(OverflowTooltippedLabel, {
|
|
7048
7148
|
label: value,
|
|
7049
7149
|
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
7050
|
-
className: "font-content",
|
|
7150
|
+
className: "text-xs font-normal font-content",
|
|
7051
7151
|
children: value
|
|
7052
7152
|
})
|
|
7053
7153
|
}),
|
|
7054
7154
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7055
|
-
className: "flex-none text-right w-14 font-content",
|
|
7155
|
+
className: "flex-none text-right w-14 text-xs font-normal font-content",
|
|
7056
7156
|
children: count.toLocaleString()
|
|
7057
7157
|
}),
|
|
7058
7158
|
showPercent ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7059
|
-
className: "flex-none text-right w-18 font-content",
|
|
7159
|
+
className: "flex-none text-right w-18 text-xs font-normal font-content",
|
|
7060
7160
|
children: [
|
|
7061
7161
|
"(",
|
|
7062
7162
|
(count / totalCount * 100).toFixed(2),
|
|
@@ -7075,6 +7175,7 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7075
7175
|
className: "flex-none",
|
|
7076
7176
|
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Checkbox, {
|
|
7077
7177
|
size: "xs",
|
|
7178
|
+
radius: "xs",
|
|
7078
7179
|
className: "bg-base-lightest text-primary-contrast-lightest hover:bg-base-darkest hover:text-base-contrast-darkest"
|
|
7079
7180
|
})
|
|
7080
7181
|
}),
|
|
@@ -7092,11 +7193,11 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7092
7193
|
})
|
|
7093
7194
|
]
|
|
7094
7195
|
}),
|
|
7095
|
-
/*#__PURE__*/ jsxRuntime.jsx(FacetExpander, {
|
|
7196
|
+
facetChartData.remainingValues > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FacetExpander, {
|
|
7096
7197
|
remainingValues: facetChartData.remainingValues,
|
|
7097
7198
|
isGroupExpanded: isGroupExpanded,
|
|
7098
7199
|
onShowChanged: setIsGroupExpanded
|
|
7099
|
-
})
|
|
7200
|
+
}) : null
|
|
7100
7201
|
]
|
|
7101
7202
|
}),
|
|
7102
7203
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -7123,6 +7224,52 @@ const EnumFacet = ({ field, dataHooks, valueLabel, description, facetName, showP
|
|
|
7123
7224
|
});
|
|
7124
7225
|
};
|
|
7125
7226
|
|
|
7227
|
+
const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPercent = true, hideIfEmpty = true, showSearch = true, showFlip = false, startShowingData = true, dismissCallback = undefined, width = undefined, header = {
|
|
7228
|
+
Panel: FacetHeader,
|
|
7229
|
+
Label: FacetText,
|
|
7230
|
+
iconStyle: controlsIconStyle
|
|
7231
|
+
} })=>{
|
|
7232
|
+
const [isSearching, setIsSearching] = React.useState(false);
|
|
7233
|
+
const [isFacetView, setIsFacetView] = React.useState(startShowingData);
|
|
7234
|
+
const toggleSearch = ()=>{
|
|
7235
|
+
setIsSearching(!isSearching);
|
|
7236
|
+
};
|
|
7237
|
+
const toggleFlip = ()=>{
|
|
7238
|
+
setIsFacetView(!isFacetView);
|
|
7239
|
+
};
|
|
7240
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7241
|
+
className: `flex flex-col ${width ? width : 'mx-1'} bg-base-max relative shadow-lg border-base-lighter border-1 rounded-b-md text-xs transition`,
|
|
7242
|
+
id: field,
|
|
7243
|
+
children: [
|
|
7244
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
7245
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetControlsHeader, {
|
|
7246
|
+
field: field,
|
|
7247
|
+
description: description,
|
|
7248
|
+
hooks: hooks,
|
|
7249
|
+
facetName: facetName,
|
|
7250
|
+
showSearch: showSearch,
|
|
7251
|
+
showFlip: showFlip,
|
|
7252
|
+
isFacetView: isFacetView,
|
|
7253
|
+
toggleFlip: toggleFlip,
|
|
7254
|
+
toggleSearch: toggleSearch,
|
|
7255
|
+
dismissCallback: dismissCallback,
|
|
7256
|
+
header: header
|
|
7257
|
+
})
|
|
7258
|
+
}),
|
|
7259
|
+
/*#__PURE__*/ jsxRuntime.jsx(FacetEnumList, {
|
|
7260
|
+
field: field,
|
|
7261
|
+
facetName: facetName,
|
|
7262
|
+
valueLabel: valueLabel,
|
|
7263
|
+
hooks: hooks,
|
|
7264
|
+
isFacetView: isFacetView,
|
|
7265
|
+
isSearching: isSearching,
|
|
7266
|
+
hideIfEmpty: hideIfEmpty,
|
|
7267
|
+
showPercent: showPercent
|
|
7268
|
+
})
|
|
7269
|
+
]
|
|
7270
|
+
});
|
|
7271
|
+
};
|
|
7272
|
+
|
|
7126
7273
|
const createBucket = (field, lower, upper)=>({
|
|
7127
7274
|
operator: 'and',
|
|
7128
7275
|
operands: [
|
|
@@ -7138,17 +7285,17 @@ const createBucket = (field, lower, upper)=>({
|
|
|
7138
7285
|
}
|
|
7139
7286
|
]
|
|
7140
7287
|
});
|
|
7141
|
-
const RangeFacet = ({ field,
|
|
7288
|
+
const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showPercent = true, hideIfEmpty = true, showSearch = true, showFlip = true, startShowingData = true, dismissCallback = undefined, width = undefined, header = {
|
|
7142
7289
|
Panel: FacetHeader,
|
|
7143
7290
|
Label: FacetText,
|
|
7144
7291
|
iconStyle: controlsIconStyle
|
|
7145
7292
|
} })=>{
|
|
7146
|
-
const { data, rangeFilters, isSuccess } =
|
|
7293
|
+
const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
|
|
7147
7294
|
const [minMaxValue, setMinMaxValue] = React.useState({
|
|
7148
7295
|
from: minimum,
|
|
7149
7296
|
to: maximum
|
|
7150
7297
|
});
|
|
7151
|
-
const clearRangeFilterFromCohort =
|
|
7298
|
+
const clearRangeFilterFromCohort = hooks.useClearFilter();
|
|
7152
7299
|
const clearFilters = React.useCallback(()=>{
|
|
7153
7300
|
setMinMaxValue({
|
|
7154
7301
|
from: minimum,
|
|
@@ -7161,7 +7308,7 @@ const RangeFacet = ({ field, dataHooks, valueLabel, description, facetName, mini
|
|
|
7161
7308
|
maximum,
|
|
7162
7309
|
minimum
|
|
7163
7310
|
]);
|
|
7164
|
-
const updateRangeFilter =
|
|
7311
|
+
const updateRangeFilter = hooks.useUpdateFacetFilters();
|
|
7165
7312
|
const updateFilters = React.useCallback((from, to)=>{
|
|
7166
7313
|
updateRangeFilter(field, createBucket(field, from, to));
|
|
7167
7314
|
setMinMaxValue({
|
|
@@ -7295,13 +7442,13 @@ const instanceOfIncludesExcludes$1 = (op)=>[
|
|
|
7295
7442
|
* @param width - width of the facet
|
|
7296
7443
|
* @param hooks - hooks to use for the facet
|
|
7297
7444
|
* @category Facets
|
|
7298
|
-
*/ const MultiSelectValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined,
|
|
7445
|
+
*/ const MultiSelectValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks })=>{
|
|
7299
7446
|
const [selectedValues, setSelectedValues] = React.useState([]); // Handle the state of the TextInput
|
|
7300
|
-
const clearFilters =
|
|
7301
|
-
const updateFacetFilters =
|
|
7447
|
+
const clearFilters = hooks.useClearFilter();
|
|
7448
|
+
const updateFacetFilters = hooks.useUpdateFacetFilters();
|
|
7302
7449
|
const facetTitle = facetName ? facetName : core.trimFirstFieldNameToTitle(field, true);
|
|
7303
|
-
const facetValue =
|
|
7304
|
-
const facetDataValues =
|
|
7450
|
+
const facetValue = hooks.useGetFacetFilters(field);
|
|
7451
|
+
const facetDataValues = hooks.useGetFacetData(field);
|
|
7305
7452
|
const dataValues = React.useMemo(()=>{
|
|
7306
7453
|
if (facetDataValues?.data) {
|
|
7307
7454
|
return Object.keys(facetDataValues.data).map((key)=>{
|
|
@@ -7446,12 +7593,12 @@ const instanceOfIncludesExcludes = (op)=>[
|
|
|
7446
7593
|
* @param width - width of the facet
|
|
7447
7594
|
* @param hooks - hooks to use for the facet
|
|
7448
7595
|
* @category Facets
|
|
7449
|
-
*/ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined,
|
|
7596
|
+
*/ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks })=>{
|
|
7450
7597
|
const [textValue, setTextValue] = React.useState(''); // Handle the state of the TextInput
|
|
7451
|
-
const clearFilters =
|
|
7452
|
-
const updateFacetFilters =
|
|
7598
|
+
const clearFilters = hooks.useClearFilter();
|
|
7599
|
+
const updateFacetFilters = hooks.useUpdateFacetFilters();
|
|
7453
7600
|
const facetTitle = facetName ? facetName : core.trimFirstFieldNameToTitle(field, true);
|
|
7454
|
-
const facetValue =
|
|
7601
|
+
const facetValue = hooks.useGetFacetFilters(field);
|
|
7455
7602
|
const textValues = React.useMemo(()=>extractValues(facetValue), [
|
|
7456
7603
|
facetValue
|
|
7457
7604
|
]);
|
|
@@ -7602,7 +7749,7 @@ const createFacetCard = (facetDefinition, valueLabel, dataFunctions, idPrefix, d
|
|
|
7602
7749
|
description: description,
|
|
7603
7750
|
hideIfEmpty: hideIfEmpty,
|
|
7604
7751
|
width: width,
|
|
7605
|
-
|
|
7752
|
+
hooks: dataFunctions,
|
|
7606
7753
|
showPercent: false
|
|
7607
7754
|
}, `${idPrefix}-enum-${field}`),
|
|
7608
7755
|
range: /*#__PURE__*/ jsxRuntime.jsx(RangeFacet, {
|
|
@@ -7612,7 +7759,7 @@ const createFacetCard = (facetDefinition, valueLabel, dataFunctions, idPrefix, d
|
|
|
7612
7759
|
description: description,
|
|
7613
7760
|
hideIfEmpty: hideIfEmpty,
|
|
7614
7761
|
width: width,
|
|
7615
|
-
|
|
7762
|
+
hooks: dataFunctions,
|
|
7616
7763
|
minimum: facetDefinition.range?.minimum,
|
|
7617
7764
|
maximum: facetDefinition.range?.maximum
|
|
7618
7765
|
}, `${idPrefix}-range-${field}`),
|
|
@@ -7622,7 +7769,7 @@ const createFacetCard = (facetDefinition, valueLabel, dataFunctions, idPrefix, d
|
|
|
7622
7769
|
description: description,
|
|
7623
7770
|
hideIfEmpty: hideIfEmpty,
|
|
7624
7771
|
width: width,
|
|
7625
|
-
|
|
7772
|
+
hooks: dataFunctions
|
|
7626
7773
|
}, `${idPrefix}-exact-${field}`),
|
|
7627
7774
|
multiselect: /*#__PURE__*/ jsxRuntime.jsx(MultiSelectValueFacet, {
|
|
7628
7775
|
field: field,
|
|
@@ -7630,7 +7777,7 @@ const createFacetCard = (facetDefinition, valueLabel, dataFunctions, idPrefix, d
|
|
|
7630
7777
|
description: description,
|
|
7631
7778
|
hideIfEmpty: hideIfEmpty,
|
|
7632
7779
|
width: width,
|
|
7633
|
-
|
|
7780
|
+
hooks: dataFunctions
|
|
7634
7781
|
}, `${idPrefix}-exact-${field}`)
|
|
7635
7782
|
}[type]
|
|
7636
7783
|
}, `${idPrefix}-enum-${field}`);
|
|
@@ -7681,7 +7828,7 @@ const QueryFieldLabel = tw.div`
|
|
|
7681
7828
|
bg-accent-cool-lightest
|
|
7682
7829
|
text-base-darkest
|
|
7683
7830
|
uppercase
|
|
7684
|
-
px-1
|
|
7831
|
+
px-2 pl-1
|
|
7685
7832
|
border-primary-darkest
|
|
7686
7833
|
border-r-[1.5px]
|
|
7687
7834
|
flex
|
|
@@ -7782,7 +7929,7 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
|
|
|
7782
7929
|
color: "accent.5",
|
|
7783
7930
|
size: "md",
|
|
7784
7931
|
pr: 0,
|
|
7785
|
-
className: "normal-case items-center max-w-[162px] cursor-pointer pl-
|
|
7932
|
+
className: "normal-case items-center max-w-[162px] cursor-pointer pl-2 pr-0 hover:bg-accent-darker",
|
|
7786
7933
|
rightSection: /*#__PURE__*/ jsxRuntime.jsx(RemoveButton, {
|
|
7787
7934
|
value: value
|
|
7788
7935
|
}),
|
|
@@ -8227,7 +8374,7 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
|
|
|
8227
8374
|
setExpandedState
|
|
8228
8375
|
],
|
|
8229
8376
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8230
|
-
className: "flex flex-col w-full bg-primary",
|
|
8377
|
+
className: "flex flex-col w-full bg-primary-lighter",
|
|
8231
8378
|
children: [
|
|
8232
8379
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
8233
8380
|
"data-testid": "text-cohort-filters-top-row",
|
|
@@ -8464,12 +8611,12 @@ const LinkCellFunctionCatalog = {
|
|
|
8464
8611
|
default: RenderLinkCell,
|
|
8465
8612
|
linkWithValueMap: RenderLinkCellUsingValueMap
|
|
8466
8613
|
};
|
|
8467
|
-
let instance$
|
|
8614
|
+
let instance$2;
|
|
8468
8615
|
const ExplorerTableCellRendererFactory = ()=>{
|
|
8469
|
-
if (!instance$
|
|
8470
|
-
instance$
|
|
8616
|
+
if (!instance$2) {
|
|
8617
|
+
instance$2 = new RenderFactoryTypedInstance();
|
|
8471
8618
|
}
|
|
8472
|
-
return instance$
|
|
8619
|
+
return instance$2;
|
|
8473
8620
|
};
|
|
8474
8621
|
// register default cell renderers
|
|
8475
8622
|
const registerExplorerDefaultCellRenderers = ()=>{
|
|
@@ -8623,21 +8770,21 @@ const RowTableDetailsPanel = ({ row })=>{
|
|
|
8623
8770
|
});
|
|
8624
8771
|
};
|
|
8625
8772
|
|
|
8626
|
-
let instance;
|
|
8627
|
-
const DefaultRendererCatalog = {
|
|
8773
|
+
let instance$1;
|
|
8774
|
+
const DefaultRendererCatalog$1 = {
|
|
8628
8775
|
tableDetails: {
|
|
8629
8776
|
default: RowTableDetailsPanel,
|
|
8630
8777
|
queryRowDetails: QueryRowDetailsPanel
|
|
8631
8778
|
}
|
|
8632
8779
|
};
|
|
8633
8780
|
const ExplorerTableDetailsPanelFactory = ()=>{
|
|
8634
|
-
if (!instance) {
|
|
8635
|
-
instance = new RenderFactoryTypedInstance();
|
|
8781
|
+
if (!instance$1) {
|
|
8782
|
+
instance$1 = new RenderFactoryTypedInstance();
|
|
8636
8783
|
}
|
|
8637
|
-
return instance;
|
|
8784
|
+
return instance$1;
|
|
8638
8785
|
};
|
|
8639
8786
|
const registerCohortBuilderDefaultPreviewRenderers = ()=>{
|
|
8640
|
-
ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog);
|
|
8787
|
+
ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog$1);
|
|
8641
8788
|
};
|
|
8642
8789
|
|
|
8643
8790
|
const DEFAULT_PROPS = {
|
|
@@ -8877,7 +9024,7 @@ const CountsValue = ({ label, isSuccess, counts })=>{
|
|
|
8877
9024
|
shadow: "xs",
|
|
8878
9025
|
p: "xs",
|
|
8879
9026
|
withBorder: true,
|
|
8880
|
-
className: "bg-primary font-heading text-md font-semibold",
|
|
9027
|
+
className: "bg-primary text-primary-contrast font-heading text-md font-semibold",
|
|
8881
9028
|
children: `${counts?.toLocaleString() ?? '...'} ${label}`
|
|
8882
9029
|
})
|
|
8883
9030
|
]
|
|
@@ -9615,7 +9762,7 @@ const SinglePanel = ({ filters, tabTitle, facetDefinitions, facetDataHooks })=>{
|
|
|
9615
9762
|
...acc
|
|
9616
9763
|
};
|
|
9617
9764
|
}, {});
|
|
9618
|
-
const facetDefs = classifyFacets(data, index, guppyConfig
|
|
9765
|
+
const facetDefs = classifyFacets(data, index, guppyConfig?.fieldMapping ?? [], configFacetDefs ?? {});
|
|
9619
9766
|
setFacetDefinitions(facetDefs);
|
|
9620
9767
|
// setup summary charts since nested fields can be listed by the split field name
|
|
9621
9768
|
const summaryCharts = Object.keys(charts).reduce((acc, field)=>{
|
|
@@ -9689,14 +9836,13 @@ const SinglePanel = ({ filters, tabTitle, facetDefinitions, facetDataHooks })=>{
|
|
|
9689
9836
|
filter: cohortFilters
|
|
9690
9837
|
}),
|
|
9691
9838
|
/*#__PURE__*/ jsxRuntime.jsx(CountsValue, {
|
|
9692
|
-
label: guppyConfig
|
|
9839
|
+
label: guppyConfig?.nodeCountTitle || toDisplayName(index),
|
|
9693
9840
|
counts: counts,
|
|
9694
9841
|
isSuccess: isCountSuccess
|
|
9695
9842
|
})
|
|
9696
9843
|
]
|
|
9697
9844
|
}),
|
|
9698
9845
|
/*#__PURE__*/ jsxRuntime.jsx(Charts, {
|
|
9699
|
-
index: index,
|
|
9700
9846
|
charts: summaryCharts,
|
|
9701
9847
|
data: data ?? EmptyData,
|
|
9702
9848
|
counts: counts,
|
|
@@ -9801,88 +9947,1701 @@ const CohortBuilder = ({ explorerConfig })=>{
|
|
|
9801
9947
|
});
|
|
9802
9948
|
};
|
|
9803
9949
|
|
|
9804
|
-
var GqlQueryEditor$2 = /*#__PURE__*/Object.freeze({
|
|
9805
|
-
__proto__: null,
|
|
9806
|
-
default: GqlQueryEditor$1
|
|
9807
|
-
});
|
|
9808
|
-
|
|
9809
|
-
const WorkspacesPanel = ()=>{
|
|
9810
|
-
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
|
|
9811
|
-
className: "m-20 w-full",
|
|
9812
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
9813
|
-
size: "2rem",
|
|
9814
|
-
children: "Coming soon."
|
|
9950
|
+
var GqlQueryEditor$2 = /*#__PURE__*/Object.freeze({
|
|
9951
|
+
__proto__: null,
|
|
9952
|
+
default: GqlQueryEditor$1
|
|
9953
|
+
});
|
|
9954
|
+
|
|
9955
|
+
const WorkspacesPanel = ()=>{
|
|
9956
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
|
|
9957
|
+
className: "m-20 w-full",
|
|
9958
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
9959
|
+
size: "2rem",
|
|
9960
|
+
children: "Coming soon."
|
|
9961
|
+
})
|
|
9962
|
+
});
|
|
9963
|
+
};
|
|
9964
|
+
|
|
9965
|
+
class FilesystemContent {
|
|
9966
|
+
constructor({ rootPath }){
|
|
9967
|
+
this.rootPath = rootPath || '';
|
|
9968
|
+
}
|
|
9969
|
+
async get(filepath) {
|
|
9970
|
+
try {
|
|
9971
|
+
return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf-8'));
|
|
9972
|
+
} catch (err) {
|
|
9973
|
+
throw new Error(`Cannot process ${filepath}`);
|
|
9974
|
+
}
|
|
9975
|
+
}
|
|
9976
|
+
}
|
|
9977
|
+
|
|
9978
|
+
class ContentDatabase {
|
|
9979
|
+
constructor(config){
|
|
9980
|
+
this.config = config;
|
|
9981
|
+
this.store = config.store;
|
|
9982
|
+
}
|
|
9983
|
+
async get(filepath) {
|
|
9984
|
+
return this.store.get(filepath);
|
|
9985
|
+
}
|
|
9986
|
+
}
|
|
9987
|
+
|
|
9988
|
+
const GEN3_FRONTEND_CONFIGURATION_ROOT = process.env.GEN3_FRONTEND_CONFIGURATION_ROOT || './';
|
|
9989
|
+
|
|
9990
|
+
const ContentRoot = GEN3_FRONTEND_CONFIGURATION_ROOT;
|
|
9991
|
+
const setup = ()=>{
|
|
9992
|
+
const config = {
|
|
9993
|
+
store: new FilesystemContent({
|
|
9994
|
+
rootPath: ContentRoot
|
|
9995
|
+
})
|
|
9996
|
+
};
|
|
9997
|
+
return new ContentDatabase(config);
|
|
9998
|
+
};
|
|
9999
|
+
const ContentSource = setup();
|
|
10000
|
+
|
|
10001
|
+
/**
|
|
10002
|
+
* Retrieves navigation page layout properties from configuration.
|
|
10003
|
+
* Note: GEN3_COMMONS_NAME depends on siteConfig.json value in the data commons package
|
|
10004
|
+
* @returns A Promise resolving to an object containing header and footer props.
|
|
10005
|
+
*/ const getNavPageLayoutPropsFromConfig = async ()=>{
|
|
10006
|
+
const navigationConfigJSON = await ContentSource.get(`config/${core.GEN3_COMMONS_NAME}/navigation.json`);
|
|
10007
|
+
let bannerConfigJSON = [];
|
|
10008
|
+
try {
|
|
10009
|
+
bannerConfigJSON = await ContentSource.get(`config/${core.GEN3_COMMONS_NAME}/banner.json`);
|
|
10010
|
+
} catch (e) {
|
|
10011
|
+
console.warn('No banner config found at: ', `config/${core.GEN3_COMMONS_NAME}/banner.json`);
|
|
10012
|
+
}
|
|
10013
|
+
const { topBar, navigation, type = 'original' } = navigationConfigJSON;
|
|
10014
|
+
const headerProps = {
|
|
10015
|
+
top: topBar,
|
|
10016
|
+
navigation: navigation,
|
|
10017
|
+
banners: bannerConfigJSON,
|
|
10018
|
+
type
|
|
10019
|
+
};
|
|
10020
|
+
const footerProps = await ContentSource.get(`config/${core.GEN3_COMMONS_NAME}/footer.json`);
|
|
10021
|
+
return {
|
|
10022
|
+
headerProps,
|
|
10023
|
+
footerProps,
|
|
10024
|
+
headerData: {
|
|
10025
|
+
title: 'Gen3 Frontend Framework Page',
|
|
10026
|
+
content: 'Gen3 Frontend Framework Page',
|
|
10027
|
+
key: 'gen3-common-page'
|
|
10028
|
+
}
|
|
10029
|
+
};
|
|
10030
|
+
};
|
|
10031
|
+
|
|
10032
|
+
const FacetSelector = ({ category, facetName, hooks, width = 'w-full', description, fields, selectedFields, updateSelectedField, showSearch = true, header = {
|
|
10033
|
+
Panel: FacetHeader,
|
|
10034
|
+
Label: FacetText,
|
|
10035
|
+
iconStyle: controlsIconStyle
|
|
10036
|
+
} })=>{
|
|
10037
|
+
const [isGroupExpanded, setIsGroupExpanded] = React.useState(false);
|
|
10038
|
+
const [isSearching, setIsSearching] = React.useState(false);
|
|
10039
|
+
const [searchTerm, setSearchTerm] = React.useState('');
|
|
10040
|
+
const cardRef = React.useRef(null);
|
|
10041
|
+
const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(category);
|
|
10042
|
+
const showFilters = isFilterExpanded === undefined || isFilterExpanded;
|
|
10043
|
+
const searchInputRef = React.useRef(null);
|
|
10044
|
+
const toggleSearch = ()=>{
|
|
10045
|
+
setIsSearching(!isSearching);
|
|
10046
|
+
setSearchTerm('');
|
|
10047
|
+
};
|
|
10048
|
+
React.useEffect(()=>{
|
|
10049
|
+
if (isSearching) {
|
|
10050
|
+
searchInputRef?.current?.focus();
|
|
10051
|
+
}
|
|
10052
|
+
}, [
|
|
10053
|
+
isSearching
|
|
10054
|
+
]);
|
|
10055
|
+
const filteredFields = useDeepCompare.useDeepCompareMemo(()=>{
|
|
10056
|
+
if (!searchTerm) return fields;
|
|
10057
|
+
return fields.filter((f)=>f.description?.toLowerCase().includes(searchTerm.toLowerCase()) || toDisplayName(f?.label ?? f.field).toLowerCase().includes(searchTerm.toLowerCase()));
|
|
10058
|
+
}, [
|
|
10059
|
+
searchTerm,
|
|
10060
|
+
fields
|
|
10061
|
+
]);
|
|
10062
|
+
const remainingValues = filteredFields.length - DEFAULT_VISIBLE_ITEMS;
|
|
10063
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
10064
|
+
className: `flex flex-col ${width ? width : 'mx-1'} bg-base-max relative border-base-light border-1 rounded-b-md transition`,
|
|
10065
|
+
id: category,
|
|
10066
|
+
children: [
|
|
10067
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10068
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetControlsHeader, {
|
|
10069
|
+
field: category,
|
|
10070
|
+
description: description,
|
|
10071
|
+
hooks: hooks,
|
|
10072
|
+
facetName: facetName,
|
|
10073
|
+
showSearch: showSearch,
|
|
10074
|
+
toggleSearch: toggleSearch,
|
|
10075
|
+
header: header
|
|
10076
|
+
})
|
|
10077
|
+
}),
|
|
10078
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10079
|
+
className: showFilters ? 'h-full' : 'h-0 invisible',
|
|
10080
|
+
"aria-hidden": !showFilters,
|
|
10081
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10082
|
+
children: [
|
|
10083
|
+
isSearching && /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
|
|
10084
|
+
"data-testid": "textbox-search-values",
|
|
10085
|
+
value: searchTerm,
|
|
10086
|
+
onChange: (e)=>setSearchTerm(e.target.value),
|
|
10087
|
+
"aria-label": `category ${facetName}`,
|
|
10088
|
+
className: 'p-2',
|
|
10089
|
+
placeholder: "Search",
|
|
10090
|
+
ref: searchInputRef,
|
|
10091
|
+
rightSection: searchTerm.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
|
|
10092
|
+
onClick: ()=>{
|
|
10093
|
+
setSearchTerm('');
|
|
10094
|
+
searchInputRef?.current?.focus();
|
|
10095
|
+
},
|
|
10096
|
+
className: "border-0",
|
|
10097
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
|
|
10098
|
+
"aria-label": "clear search"
|
|
10099
|
+
})
|
|
10100
|
+
}),
|
|
10101
|
+
role: "search"
|
|
10102
|
+
}),
|
|
10103
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
10104
|
+
className: "flip-card",
|
|
10105
|
+
ref: cardRef,
|
|
10106
|
+
children: [
|
|
10107
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10108
|
+
className: "card-face bg-base-max rounded-b-xs flex flex-col gap-y-1 justify-between",
|
|
10109
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10110
|
+
children: filteredFields.length == 0 ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10111
|
+
className: "mx-4 font-content text-sm",
|
|
10112
|
+
children: BAD_DATA_MESSAGE
|
|
10113
|
+
}) : filteredFields.map((facet)=>{
|
|
10114
|
+
const label = core.fieldNameToTitle(facet.field);
|
|
10115
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
10116
|
+
className: "flex justify-between items-center px-2 my-1",
|
|
10117
|
+
children: [
|
|
10118
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10119
|
+
size: "sm",
|
|
10120
|
+
fw: 400,
|
|
10121
|
+
children: label
|
|
10122
|
+
}),
|
|
10123
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
|
|
10124
|
+
"data-testid": `switch-${label}`,
|
|
10125
|
+
"aria-label": `select ${facet.field}`,
|
|
10126
|
+
color: "accent",
|
|
10127
|
+
checked: selectedFields && selectedFields.includes(facet.field),
|
|
10128
|
+
onChange: ()=>updateSelectedField(facet.field)
|
|
10129
|
+
})
|
|
10130
|
+
]
|
|
10131
|
+
}, facet.field);
|
|
10132
|
+
})
|
|
10133
|
+
})
|
|
10134
|
+
}),
|
|
10135
|
+
remainingValues > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FacetExpander, {
|
|
10136
|
+
remainingValues: remainingValues,
|
|
10137
|
+
isGroupExpanded: isGroupExpanded,
|
|
10138
|
+
onShowChanged: setIsGroupExpanded
|
|
10139
|
+
}) : null
|
|
10140
|
+
]
|
|
10141
|
+
})
|
|
10142
|
+
]
|
|
10143
|
+
})
|
|
10144
|
+
})
|
|
10145
|
+
]
|
|
10146
|
+
});
|
|
10147
|
+
};
|
|
10148
|
+
|
|
10149
|
+
const FacetSelectionPanel = ({ categories, hooks, selectedFields, updateSelectedField })=>{
|
|
10150
|
+
const panels = useDeepCompare.useDeepCompareMemo(()=>{
|
|
10151
|
+
return categories.map((item)=>{
|
|
10152
|
+
const fields = item.fields.map((f)=>item.fieldsConfig[f]);
|
|
10153
|
+
return /*#__PURE__*/ jsxRuntime.jsx(FacetSelector, {
|
|
10154
|
+
fields: fields,
|
|
10155
|
+
category: item.title,
|
|
10156
|
+
facetName: item.title,
|
|
10157
|
+
selectedFields: selectedFields,
|
|
10158
|
+
updateSelectedField: updateSelectedField,
|
|
10159
|
+
hooks: {
|
|
10160
|
+
...hooks
|
|
10161
|
+
}
|
|
10162
|
+
}, item.title);
|
|
10163
|
+
});
|
|
10164
|
+
}, [
|
|
10165
|
+
categories,
|
|
10166
|
+
selectedFields,
|
|
10167
|
+
updateSelectedField,
|
|
10168
|
+
hooks
|
|
10169
|
+
]);
|
|
10170
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10171
|
+
className: "w-1/3 flex flex-col p-4 gap-y-6",
|
|
10172
|
+
children: panels
|
|
10173
|
+
});
|
|
10174
|
+
};
|
|
10175
|
+
|
|
10176
|
+
const initialState$1 = {};
|
|
10177
|
+
const expandSlice = toolkit.createSlice({
|
|
10178
|
+
name: 'CohortDiscovery/filterExpand',
|
|
10179
|
+
initialState: initialState$1,
|
|
10180
|
+
reducers: {
|
|
10181
|
+
toggleCategoryFilter: (state, action)=>{
|
|
10182
|
+
return {
|
|
10183
|
+
...state,
|
|
10184
|
+
[action.payload.field]: action.payload.expanded
|
|
10185
|
+
};
|
|
10186
|
+
},
|
|
10187
|
+
toggleAllFilters: (state, action)=>{
|
|
10188
|
+
return Object.fromEntries(Object.keys(state).map((k)=>[
|
|
10189
|
+
k,
|
|
10190
|
+
action.payload
|
|
10191
|
+
]));
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
});
|
|
10195
|
+
const filtersExpandedReducer = expandSlice.reducer;
|
|
10196
|
+
const { toggleCategoryFilter, toggleAllFilters } = expandSlice.actions;
|
|
10197
|
+
const selectFilterExpanded = (state, field)=>state.filtersExpandedState?.[field];
|
|
10198
|
+
|
|
10199
|
+
const initialState = {};
|
|
10200
|
+
const selectIndexFacets = toolkit.createSlice({
|
|
10201
|
+
name: 'CohortDiscovery/filterExpand',
|
|
10202
|
+
initialState: initialState,
|
|
10203
|
+
reducers: {
|
|
10204
|
+
addFacetSelection: (state, action)=>{
|
|
10205
|
+
if (!(action.payload.index in state)) {
|
|
10206
|
+
return {
|
|
10207
|
+
...state,
|
|
10208
|
+
...{
|
|
10209
|
+
[action.payload.index]: [
|
|
10210
|
+
action.payload.field
|
|
10211
|
+
]
|
|
10212
|
+
}
|
|
10213
|
+
};
|
|
10214
|
+
} else return {
|
|
10215
|
+
...state,
|
|
10216
|
+
[action.payload.index]: [
|
|
10217
|
+
...state[action.payload.index],
|
|
10218
|
+
action.payload.field
|
|
10219
|
+
]
|
|
10220
|
+
};
|
|
10221
|
+
},
|
|
10222
|
+
removeFacetSelection: (state, action)=>{
|
|
10223
|
+
if (!(action.payload.index in state[action.payload.index])) return state;
|
|
10224
|
+
if (action.payload.field in state[action.payload.index]) {
|
|
10225
|
+
return {
|
|
10226
|
+
...state,
|
|
10227
|
+
...{
|
|
10228
|
+
[action.payload.index]: state[action.payload.index].filter((x)=>x !== action.payload.field)
|
|
10229
|
+
}
|
|
10230
|
+
};
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
}
|
|
10234
|
+
});
|
|
10235
|
+
const selectedFacetsReducer = selectIndexFacets.reducer;
|
|
10236
|
+
selectIndexFacets.actions;
|
|
10237
|
+
|
|
10238
|
+
const _APP_NAME$2 = 'CohortDiscovery';
|
|
10239
|
+
const persistConfig = {
|
|
10240
|
+
key: _APP_NAME$2,
|
|
10241
|
+
version: 1,
|
|
10242
|
+
storage,
|
|
10243
|
+
whitelist: [
|
|
10244
|
+
'filterExpandState'
|
|
10245
|
+
]
|
|
10246
|
+
};
|
|
10247
|
+
// create the store, context and selector for the ProjectsCenter
|
|
10248
|
+
// Note the project app has a local store and context which isolates
|
|
10249
|
+
// the filters and other store/cache values
|
|
10250
|
+
const reducers = redux.combineReducers({
|
|
10251
|
+
selectedIndexFacets: selectedFacetsReducer,
|
|
10252
|
+
filtersExpandedState: filtersExpandedReducer
|
|
10253
|
+
});
|
|
10254
|
+
const { id, AppStore, AppContext, useAppSelector, useAppDispatch } = core.createAppStore({
|
|
10255
|
+
reducers: reduxPersist.persistReducer(persistConfig, reducers),
|
|
10256
|
+
name: _APP_NAME$2,
|
|
10257
|
+
version: '0.0.1'
|
|
10258
|
+
});
|
|
10259
|
+
|
|
10260
|
+
const useToggleExpandFilter = ()=>{
|
|
10261
|
+
const dispatch = useAppDispatch();
|
|
10262
|
+
return (field, expanded)=>{
|
|
10263
|
+
dispatch(toggleCategoryFilter({
|
|
10264
|
+
field,
|
|
10265
|
+
expanded
|
|
10266
|
+
}));
|
|
10267
|
+
};
|
|
10268
|
+
};
|
|
10269
|
+
const useFilterExpandedState = (field)=>{
|
|
10270
|
+
return useAppSelector((state)=>selectFilterExpanded(state, field));
|
|
10271
|
+
};
|
|
10272
|
+
|
|
10273
|
+
const EnumFacetToHistogramArray = (data)=>{
|
|
10274
|
+
if (!data) return [];
|
|
10275
|
+
return Object.entries(data).reduce((acc, [key, count])=>{
|
|
10276
|
+
acc.push({
|
|
10277
|
+
key,
|
|
10278
|
+
count
|
|
10279
|
+
});
|
|
10280
|
+
return acc;
|
|
10281
|
+
}, []);
|
|
10282
|
+
};
|
|
10283
|
+
|
|
10284
|
+
const FacetPanelDataHeader = ({ label, valueLabel })=>{
|
|
10285
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
|
|
10286
|
+
justify: "space-between",
|
|
10287
|
+
className: "border-1 border-base p-2 px-4",
|
|
10288
|
+
children: [
|
|
10289
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10290
|
+
className: "flex",
|
|
10291
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10292
|
+
size: "sm",
|
|
10293
|
+
fw: 600,
|
|
10294
|
+
children: label
|
|
10295
|
+
})
|
|
10296
|
+
}),
|
|
10297
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10298
|
+
size: "sm",
|
|
10299
|
+
fw: 600,
|
|
10300
|
+
children: valueLabel
|
|
10301
|
+
})
|
|
10302
|
+
]
|
|
10303
|
+
});
|
|
10304
|
+
};
|
|
10305
|
+
|
|
10306
|
+
const EnumFacetPanel = ({ facet, hooks, valueLabel, showTotals = false, chartType = 'bar' })=>{
|
|
10307
|
+
const { field, label } = facet;
|
|
10308
|
+
const facetName = React.useMemo(()=>label ?? core.fieldNameToTitle(field), [
|
|
10309
|
+
label,
|
|
10310
|
+
field
|
|
10311
|
+
]);
|
|
10312
|
+
const { data } = hooks.useGetFacetData(field);
|
|
10313
|
+
const chart = createChart(chartType, {
|
|
10314
|
+
data: EnumFacetToHistogramArray(data),
|
|
10315
|
+
total: 1,
|
|
10316
|
+
valueType: 'count'
|
|
10317
|
+
});
|
|
10318
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
10319
|
+
className: "flex flex-col bg-base-max relative border-base border-1 rounded-b-md transition",
|
|
10320
|
+
children: [
|
|
10321
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
10322
|
+
className: "flex justify-between px-4 py-2 bg-base-lightest border-b-1 border-base",
|
|
10323
|
+
children: [
|
|
10324
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10325
|
+
size: "sm",
|
|
10326
|
+
fw: 600,
|
|
10327
|
+
children: facetName
|
|
10328
|
+
}),
|
|
10329
|
+
showTotals ? /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10330
|
+
children: "Todo"
|
|
10331
|
+
}) : null
|
|
10332
|
+
]
|
|
10333
|
+
}),
|
|
10334
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10335
|
+
className: "px-4 pb-4 pt-8",
|
|
10336
|
+
children: chart
|
|
10337
|
+
}),
|
|
10338
|
+
/*#__PURE__*/ jsxRuntime.jsx(FacetPanelDataHeader, {
|
|
10339
|
+
label: facetName,
|
|
10340
|
+
valueLabel: valueLabel
|
|
10341
|
+
}),
|
|
10342
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10343
|
+
className: "p-4 pt-2 pb-2",
|
|
10344
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FacetEnumList, {
|
|
10345
|
+
field: field,
|
|
10346
|
+
valueLabel: valueLabel,
|
|
10347
|
+
hooks: hooks,
|
|
10348
|
+
showSorting: false
|
|
10349
|
+
})
|
|
10350
|
+
})
|
|
10351
|
+
]
|
|
10352
|
+
});
|
|
10353
|
+
};
|
|
10354
|
+
|
|
10355
|
+
const createFacetPanel = (facet, chartType, valueLabel, hooks)=>{
|
|
10356
|
+
switch(facet.type){
|
|
10357
|
+
case 'enum':
|
|
10358
|
+
return /*#__PURE__*/ jsxRuntime.jsx(EnumFacetPanel, {
|
|
10359
|
+
facet: facet,
|
|
10360
|
+
chartType: chartType,
|
|
10361
|
+
valueLabel: valueLabel,
|
|
10362
|
+
hooks: hooks
|
|
10363
|
+
});
|
|
10364
|
+
}
|
|
10365
|
+
return null;
|
|
10366
|
+
};
|
|
10367
|
+
|
|
10368
|
+
/**
|
|
10369
|
+
* CartsAndFacetsPanel component
|
|
10370
|
+
*
|
|
10371
|
+
* @param {string} index - The index type used for querying data.
|
|
10372
|
+
* @param {Array} facets - The list of facets to be rendered.
|
|
10373
|
+
* @returns {JSX.Element} The rendered component showing facets.
|
|
10374
|
+
*/ const ChartsAndFacetsPanel = ({ index, facets })=>{
|
|
10375
|
+
const cohortFilters = core.useCoreSelector((state)=>core.selectIndexFilters(state, index));
|
|
10376
|
+
const { data, isSuccess, isError: isAggsQueryError } = core.useGetAggsQuery({
|
|
10377
|
+
type: index,
|
|
10378
|
+
fields: facets.map((x)=>x.field),
|
|
10379
|
+
filters: cohortFilters
|
|
10380
|
+
});
|
|
10381
|
+
const getEnumFacetData = useDeepCompare.useDeepCompareCallback((field)=>{
|
|
10382
|
+
return {
|
|
10383
|
+
data: processBucketData(data?.[field]),
|
|
10384
|
+
enumFilters: field in cohortFilters.root ? core.extractEnumFilterValue(cohortFilters.root[field]) : undefined,
|
|
10385
|
+
isSuccess: isSuccess
|
|
10386
|
+
};
|
|
10387
|
+
}, [
|
|
10388
|
+
cohortFilters,
|
|
10389
|
+
cohortFilters.root,
|
|
10390
|
+
data,
|
|
10391
|
+
isSuccess
|
|
10392
|
+
]);
|
|
10393
|
+
const getRangeFacetData = useDeepCompare.useDeepCompareCallback((field)=>{
|
|
10394
|
+
return {
|
|
10395
|
+
data: processRangeData(data?.[field]),
|
|
10396
|
+
filters: extractRangeValues(cohortFilters.root[field]),
|
|
10397
|
+
isSuccess: isSuccess
|
|
10398
|
+
};
|
|
10399
|
+
}, [
|
|
10400
|
+
data,
|
|
10401
|
+
cohortFilters.root,
|
|
10402
|
+
isSuccess
|
|
10403
|
+
]);
|
|
10404
|
+
const facetHooks = useDeepCompare.useDeepCompareMemo(()=>{
|
|
10405
|
+
return {
|
|
10406
|
+
enum: {
|
|
10407
|
+
useGetFacetData: getEnumFacetData,
|
|
10408
|
+
useUpdateFacetFilters: lodash.partial(useUpdateFilters, index),
|
|
10409
|
+
useGetFacetFilters: lodash.partial(useGetFacetFilters, index),
|
|
10410
|
+
useClearFilter: lodash.partial(useClearFilters, index),
|
|
10411
|
+
useTotalCounts: undefined
|
|
10412
|
+
}
|
|
10413
|
+
};
|
|
10414
|
+
}, [
|
|
10415
|
+
getEnumFacetData,
|
|
10416
|
+
getRangeFacetData,
|
|
10417
|
+
index
|
|
10418
|
+
]);
|
|
10419
|
+
const panels = useDeepCompare.useDeepCompareMemo(()=>{
|
|
10420
|
+
return facets.map((facet)=>createFacetPanel(facet, 'bar', core.fieldNameToTitle(index), facetHooks.enum));
|
|
10421
|
+
}, [
|
|
10422
|
+
facets,
|
|
10423
|
+
index,
|
|
10424
|
+
facetHooks.enum
|
|
10425
|
+
]);
|
|
10426
|
+
const spans = computeRowSpan(panels.length);
|
|
10427
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Grid, {
|
|
10428
|
+
className: "w-full mx-2 bg-base-max p-4",
|
|
10429
|
+
children: panels.map((panel, index)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Grid.Col, {
|
|
10430
|
+
span: spans[index],
|
|
10431
|
+
children: panel
|
|
10432
|
+
}, `${index}-charts-${facets[index].field}-col`))
|
|
10433
|
+
});
|
|
10434
|
+
};
|
|
10435
|
+
|
|
10436
|
+
const ActionButtonGroup = ()=>{
|
|
10437
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
|
|
10438
|
+
gap: "xs",
|
|
10439
|
+
className: "flex pt-4 pl-2",
|
|
10440
|
+
children: [
|
|
10441
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
|
|
10442
|
+
size: "sm",
|
|
10443
|
+
variant: "outline",
|
|
10444
|
+
color: "secondary.4",
|
|
10445
|
+
classNames: {
|
|
10446
|
+
root: 'bg-base-max'
|
|
10447
|
+
},
|
|
10448
|
+
children: "Save Cohort"
|
|
10449
|
+
}),
|
|
10450
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
|
|
10451
|
+
size: "sm",
|
|
10452
|
+
variant: "outline",
|
|
10453
|
+
color: "secondary.4",
|
|
10454
|
+
classNames: {
|
|
10455
|
+
root: 'bg-base-max'
|
|
10456
|
+
},
|
|
10457
|
+
children: "Export Cohort"
|
|
10458
|
+
}),
|
|
10459
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
|
|
10460
|
+
size: "sm",
|
|
10461
|
+
variant: "outline",
|
|
10462
|
+
color: "secondary.4",
|
|
10463
|
+
classNames: {
|
|
10464
|
+
root: 'bg-base-max'
|
|
10465
|
+
},
|
|
10466
|
+
children: "Import Cohort"
|
|
10467
|
+
})
|
|
10468
|
+
]
|
|
10469
|
+
});
|
|
10470
|
+
};
|
|
10471
|
+
|
|
10472
|
+
const IndexPanel = ({ dataConfig, tabs, tabTitle })=>{
|
|
10473
|
+
const [activeFieldDefinitions, setActiveFieldDefinitions] = React.useState([]);
|
|
10474
|
+
const index = dataConfig.dataType;
|
|
10475
|
+
const fields = React.useMemo(()=>getAllFieldsFromFilterConfigs(tabs ?? []), [
|
|
10476
|
+
tabs
|
|
10477
|
+
]);
|
|
10478
|
+
const [facetDefinitions, setFacetDefinitions] = React.useState({});
|
|
10479
|
+
const [categories, setCategories] = React.useState([]);
|
|
10480
|
+
const cohortFilters = core.useCoreSelector((state)=>core.selectIndexFilters(state, index));
|
|
10481
|
+
const queryFields = categories.length === 0 ? fields : activeFieldDefinitions.map((x)=>x.field);
|
|
10482
|
+
const { data, isSuccess, isError: isAggsQueryError } = core.useGetAggsQuery({
|
|
10483
|
+
type: index,
|
|
10484
|
+
fields: queryFields,
|
|
10485
|
+
filters: cohortFilters
|
|
10486
|
+
}, {
|
|
10487
|
+
skip: queryFields.length === 0
|
|
10488
|
+
});
|
|
10489
|
+
const updateFields = useDeepCompare.useDeepCompareCallback((field)=>{
|
|
10490
|
+
if (activeFieldDefinitions.some((facetDef)=>facetDef.field === field)) {
|
|
10491
|
+
setActiveFieldDefinitions((prevState)=>{
|
|
10492
|
+
return prevState.filter((f)=>f.field !== field);
|
|
10493
|
+
});
|
|
10494
|
+
} else {
|
|
10495
|
+
setActiveFieldDefinitions((prevState)=>[
|
|
10496
|
+
...prevState,
|
|
10497
|
+
facetDefinitions[field]
|
|
10498
|
+
]);
|
|
10499
|
+
}
|
|
10500
|
+
}, [
|
|
10501
|
+
activeFieldDefinitions,
|
|
10502
|
+
facetDefinitions
|
|
10503
|
+
]);
|
|
10504
|
+
// Set the facet definitions based on the data only the first time the data is loaded
|
|
10505
|
+
useDeepCompare.useDeepCompareEffect(()=>{
|
|
10506
|
+
if (isSuccess && Object.keys(facetDefinitions).length === 0) {
|
|
10507
|
+
const configFacetDefs = tabs.reduce((acc, tab)=>{
|
|
10508
|
+
return {
|
|
10509
|
+
...tab.fieldsConfig,
|
|
10510
|
+
...acc
|
|
10511
|
+
};
|
|
10512
|
+
}, {});
|
|
10513
|
+
const facetDefs = classifyFacets(data, index, [], configFacetDefs);
|
|
10514
|
+
setFacetDefinitions(facetDefs);
|
|
10515
|
+
// setup categories
|
|
10516
|
+
const categories = tabs.reduce((acc, tab)=>{
|
|
10517
|
+
const updatedTab = tab;
|
|
10518
|
+
if (!updatedTab?.fieldsConfig) {
|
|
10519
|
+
updatedTab.fieldsConfig = {};
|
|
10520
|
+
}
|
|
10521
|
+
updatedTab.fields.forEach((x)=>{
|
|
10522
|
+
tab.fieldsConfig[x] = {
|
|
10523
|
+
...tab.fieldsConfig[x],
|
|
10524
|
+
...x in facetDefs ? facetDefs[x] : {}
|
|
10525
|
+
};
|
|
10526
|
+
});
|
|
10527
|
+
acc.push(updatedTab);
|
|
10528
|
+
return acc;
|
|
10529
|
+
}, []);
|
|
10530
|
+
setCategories(categories);
|
|
10531
|
+
}
|
|
10532
|
+
}, [
|
|
10533
|
+
isSuccess,
|
|
10534
|
+
data,
|
|
10535
|
+
facetDefinitions,
|
|
10536
|
+
index
|
|
10537
|
+
]);
|
|
10538
|
+
if (isAggsQueryError) {
|
|
10539
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
|
|
10540
|
+
message: "Unable to fetch data from server"
|
|
10541
|
+
});
|
|
10542
|
+
}
|
|
10543
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
|
|
10544
|
+
children: [
|
|
10545
|
+
/*#__PURE__*/ jsxRuntime.jsx(CohortManager, {
|
|
10546
|
+
index: index
|
|
10547
|
+
}),
|
|
10548
|
+
/*#__PURE__*/ jsxRuntime.jsxs(core$1.Flex, {
|
|
10549
|
+
className: "w-full h-full bg-base-light",
|
|
10550
|
+
children: [
|
|
10551
|
+
/*#__PURE__*/ jsxRuntime.jsx(FacetSelectionPanel, {
|
|
10552
|
+
categories: categories,
|
|
10553
|
+
selectedFields: activeFieldDefinitions.map((x)=>x.field),
|
|
10554
|
+
updateSelectedField: updateFields,
|
|
10555
|
+
hooks: {
|
|
10556
|
+
useClearFilter: ()=>(field)=>null,
|
|
10557
|
+
useToggleExpandFilter: useToggleExpandFilter,
|
|
10558
|
+
useFilterExpanded: useFilterExpandedState
|
|
10559
|
+
}
|
|
10560
|
+
}),
|
|
10561
|
+
/*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
|
|
10562
|
+
className: "w-full",
|
|
10563
|
+
children: [
|
|
10564
|
+
/*#__PURE__*/ jsxRuntime.jsx(ActionButtonGroup, {}),
|
|
10565
|
+
/*#__PURE__*/ jsxRuntime.jsx(ChartsAndFacetsPanel, {
|
|
10566
|
+
index: index,
|
|
10567
|
+
facets: activeFieldDefinitions
|
|
10568
|
+
})
|
|
10569
|
+
]
|
|
10570
|
+
})
|
|
10571
|
+
]
|
|
10572
|
+
})
|
|
10573
|
+
]
|
|
10574
|
+
});
|
|
10575
|
+
};
|
|
10576
|
+
|
|
10577
|
+
const persistor = reduxPersist.persistStore(AppStore);
|
|
10578
|
+
const CohortDiscovery = (config)=>{
|
|
10579
|
+
const { isLoading } = core.useGetCSRFQuery(); // need for Guppy
|
|
10580
|
+
if (isLoading) {
|
|
10581
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
|
|
10582
|
+
maw: 400,
|
|
10583
|
+
h: 100,
|
|
10584
|
+
mx: "auto",
|
|
10585
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Loader, {
|
|
10586
|
+
variant: "dots"
|
|
10587
|
+
})
|
|
10588
|
+
});
|
|
10589
|
+
}
|
|
10590
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
10591
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(react$1.PersistGate, {
|
|
10592
|
+
persistor: persistor,
|
|
10593
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10594
|
+
className: "w-full h-full",
|
|
10595
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(IndexPanel, {
|
|
10596
|
+
dataConfig: config.dataIndexes[0].dataConfig,
|
|
10597
|
+
tabTitle: config.dataIndexes[0].tabTitle,
|
|
10598
|
+
tabs: config.dataIndexes[0].tabs
|
|
10599
|
+
})
|
|
10600
|
+
})
|
|
10601
|
+
})
|
|
10602
|
+
});
|
|
10603
|
+
};
|
|
10604
|
+
|
|
10605
|
+
const _APP_NAME$1 = 'CohortDiscovery'; // This wil be the route name of the app
|
|
10606
|
+
const registerCohortDiscoveryApp = ()=>core.createGen3AppWithOwnStore({
|
|
10607
|
+
App: CohortDiscovery,
|
|
10608
|
+
id: id,
|
|
10609
|
+
name: _APP_NAME$1,
|
|
10610
|
+
version: 'v1.0.0',
|
|
10611
|
+
requiredEntityTypes: [],
|
|
10612
|
+
store: AppStore,
|
|
10613
|
+
context: AppContext
|
|
10614
|
+
});
|
|
10615
|
+
|
|
10616
|
+
const roundTo2AfterDecimal = (number)=>{
|
|
10617
|
+
return Math.round((number + Number.EPSILON) * 100) / 100;
|
|
10618
|
+
};
|
|
10619
|
+
|
|
10620
|
+
const processComparisonData$1 = (baseData, comparisonData)=>{
|
|
10621
|
+
return [
|
|
10622
|
+
{
|
|
10623
|
+
name: baseData.label,
|
|
10624
|
+
type: 'bar',
|
|
10625
|
+
barGap: 0,
|
|
10626
|
+
itemStyle: {
|
|
10627
|
+
color: '#4e79a7'
|
|
10628
|
+
},
|
|
10629
|
+
data: baseData.data.map((item)=>roundTo2AfterDecimal(item.count)),
|
|
10630
|
+
emphasis: {
|
|
10631
|
+
focus: 'series'
|
|
10632
|
+
}
|
|
10633
|
+
},
|
|
10634
|
+
{
|
|
10635
|
+
name: comparisonData.label,
|
|
10636
|
+
type: 'bar',
|
|
10637
|
+
itemStyle: {
|
|
10638
|
+
color: '#f28e2c'
|
|
10639
|
+
},
|
|
10640
|
+
data: comparisonData.data.map((item)=>roundTo2AfterDecimal(item.count)),
|
|
10641
|
+
emphasis: {
|
|
10642
|
+
focus: 'series'
|
|
10643
|
+
}
|
|
10644
|
+
}
|
|
10645
|
+
];
|
|
10646
|
+
};
|
|
10647
|
+
const BarComparison = ({ baseDataset, comparisonDataset, title, yAxisLabel = 'percent' })=>{
|
|
10648
|
+
const categories = baseDataset.data.map((d)=>truncateString(processLabel$1(d.key), 35));
|
|
10649
|
+
const chartDefinition = React.useMemo(()=>{
|
|
10650
|
+
const series = processComparisonData$1(baseDataset, comparisonDataset);
|
|
10651
|
+
return {
|
|
10652
|
+
aria: {
|
|
10653
|
+
enabled: true
|
|
10654
|
+
},
|
|
10655
|
+
tooltip: {
|
|
10656
|
+
trigger: 'axis',
|
|
10657
|
+
axisPointer: {
|
|
10658
|
+
type: 'shadow'
|
|
10659
|
+
}
|
|
10660
|
+
},
|
|
10661
|
+
title: {
|
|
10662
|
+
text: title,
|
|
10663
|
+
left: 'center'
|
|
10664
|
+
},
|
|
10665
|
+
legend: {
|
|
10666
|
+
data: [
|
|
10667
|
+
baseDataset.label,
|
|
10668
|
+
comparisonDataset.label
|
|
10669
|
+
],
|
|
10670
|
+
bottom: '5%'
|
|
10671
|
+
},
|
|
10672
|
+
xAxis: {
|
|
10673
|
+
type: 'category',
|
|
10674
|
+
data: categories,
|
|
10675
|
+
axisTick: {
|
|
10676
|
+
show: false
|
|
10677
|
+
}
|
|
10678
|
+
},
|
|
10679
|
+
yAxis: {
|
|
10680
|
+
type: 'value',
|
|
10681
|
+
name: yAxisLabel
|
|
10682
|
+
},
|
|
10683
|
+
series: series
|
|
10684
|
+
};
|
|
10685
|
+
}, [
|
|
10686
|
+
baseDataset,
|
|
10687
|
+
categories,
|
|
10688
|
+
comparisonDataset,
|
|
10689
|
+
title,
|
|
10690
|
+
yAxisLabel
|
|
10691
|
+
]);
|
|
10692
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10693
|
+
role: "region",
|
|
10694
|
+
"aria-labelledby": "bar-comparison-title",
|
|
10695
|
+
className: "flex flex-col w-full h-96",
|
|
10696
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ReactECharts, {
|
|
10697
|
+
option: chartDefinition,
|
|
10698
|
+
settings: {
|
|
10699
|
+
notMerge: true
|
|
10700
|
+
}
|
|
10701
|
+
})
|
|
10702
|
+
});
|
|
10703
|
+
};
|
|
10704
|
+
|
|
10705
|
+
const processComparisonData = (baseData, comparisonData)=>{
|
|
10706
|
+
const maxB = baseData.data.reduce((acc, curr)=>{
|
|
10707
|
+
return Math.max(curr.count, acc);
|
|
10708
|
+
}, 0);
|
|
10709
|
+
const maxC = comparisonData.data.reduce((acc, curr)=>{
|
|
10710
|
+
return Math.max(curr.count, acc);
|
|
10711
|
+
}, 0);
|
|
10712
|
+
return {
|
|
10713
|
+
data: [
|
|
10714
|
+
{
|
|
10715
|
+
type: 'radar',
|
|
10716
|
+
data: [
|
|
10717
|
+
{
|
|
10718
|
+
value: baseData.data.map((item)=>roundTo2AfterDecimal(item.count)),
|
|
10719
|
+
name: baseData.label,
|
|
10720
|
+
itemStyle: {
|
|
10721
|
+
color: '#4e79a7'
|
|
10722
|
+
},
|
|
10723
|
+
areaStyle: {
|
|
10724
|
+
opacity: 0.3
|
|
10725
|
+
}
|
|
10726
|
+
},
|
|
10727
|
+
{
|
|
10728
|
+
value: comparisonData.data.map((item)=>roundTo2AfterDecimal(item.count)),
|
|
10729
|
+
name: comparisonData.label,
|
|
10730
|
+
itemStyle: {
|
|
10731
|
+
color: '#f28e2c'
|
|
10732
|
+
},
|
|
10733
|
+
areaStyle: {
|
|
10734
|
+
opacity: 0.3
|
|
10735
|
+
}
|
|
10736
|
+
}
|
|
10737
|
+
]
|
|
10738
|
+
}
|
|
10739
|
+
],
|
|
10740
|
+
maxBase: maxB,
|
|
10741
|
+
maxComparison: maxC
|
|
10742
|
+
};
|
|
10743
|
+
};
|
|
10744
|
+
const RadarComparison = ({ baseDataset, comparisonDataset, title, yAxisLabel = 'percent' })=>{
|
|
10745
|
+
const categories = baseDataset.data.map((d)=>truncateString(processLabel$1(d.key), 35));
|
|
10746
|
+
const chartDefinition = React.useMemo(()=>{
|
|
10747
|
+
const series = processComparisonData(baseDataset, comparisonDataset);
|
|
10748
|
+
const option = {
|
|
10749
|
+
aria: {
|
|
10750
|
+
enabled: true
|
|
10751
|
+
},
|
|
10752
|
+
title: {
|
|
10753
|
+
text: title,
|
|
10754
|
+
left: 'center'
|
|
10755
|
+
},
|
|
10756
|
+
legend: {
|
|
10757
|
+
data: [
|
|
10758
|
+
baseDataset.label,
|
|
10759
|
+
comparisonDataset.label
|
|
10760
|
+
],
|
|
10761
|
+
bottom: '5%'
|
|
10762
|
+
},
|
|
10763
|
+
radar: {
|
|
10764
|
+
indicator: categories.map((group)=>({
|
|
10765
|
+
name: group,
|
|
10766
|
+
max: Math.max(series.maxBase, series.maxComparison)
|
|
10767
|
+
})),
|
|
10768
|
+
axisLine: {
|
|
10769
|
+
lineStyle: {
|
|
10770
|
+
color: '#4e79a7'
|
|
10771
|
+
}
|
|
10772
|
+
},
|
|
10773
|
+
splitLine: {
|
|
10774
|
+
show: true,
|
|
10775
|
+
lineStyle: {
|
|
10776
|
+
color: [
|
|
10777
|
+
'#8c8989',
|
|
10778
|
+
'#8aa0ae'
|
|
10779
|
+
]
|
|
10780
|
+
}
|
|
10781
|
+
},
|
|
10782
|
+
center: [
|
|
10783
|
+
'50%',
|
|
10784
|
+
'50%'
|
|
10785
|
+
],
|
|
10786
|
+
radius: '65%'
|
|
10787
|
+
},
|
|
10788
|
+
series: series.data,
|
|
10789
|
+
tooltip: {
|
|
10790
|
+
trigger: 'item'
|
|
10791
|
+
}
|
|
10792
|
+
};
|
|
10793
|
+
return option;
|
|
10794
|
+
}, [
|
|
10795
|
+
baseDataset,
|
|
10796
|
+
categories,
|
|
10797
|
+
comparisonDataset,
|
|
10798
|
+
title,
|
|
10799
|
+
yAxisLabel
|
|
10800
|
+
]);
|
|
10801
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10802
|
+
role: "region",
|
|
10803
|
+
"aria-labelledby": "radar-comparison-title",
|
|
10804
|
+
className: "flex flex-col w-full h-96",
|
|
10805
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ReactECharts, {
|
|
10806
|
+
option: chartDefinition,
|
|
10807
|
+
settings: {
|
|
10808
|
+
notMerge: true
|
|
10809
|
+
}
|
|
10810
|
+
})
|
|
10811
|
+
});
|
|
10812
|
+
};
|
|
10813
|
+
|
|
10814
|
+
let instance = undefined;
|
|
10815
|
+
const DefaultComparisonChart = ()=>{
|
|
10816
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10817
|
+
children: "Chart not configured"
|
|
10818
|
+
});
|
|
10819
|
+
};
|
|
10820
|
+
const DefaultRendererCatalog = {
|
|
10821
|
+
comparison: {
|
|
10822
|
+
default: DefaultComparisonChart,
|
|
10823
|
+
barComparison: BarComparison,
|
|
10824
|
+
radarComparison: RadarComparison
|
|
10825
|
+
}
|
|
10826
|
+
};
|
|
10827
|
+
const DiversityChartsFactory = ()=>{
|
|
10828
|
+
if (!instance) {
|
|
10829
|
+
instance = new RenderFactoryTypedInstance();
|
|
10830
|
+
instance.registerRendererCatalog(DefaultRendererCatalog);
|
|
10831
|
+
}
|
|
10832
|
+
return instance;
|
|
10833
|
+
};
|
|
10834
|
+
|
|
10835
|
+
DiversityChartsFactory();
|
|
10836
|
+
const generateChart = (groundData, groundLabel, comparisonData, comparisonLabel, field, config, showTitle = true)=>{
|
|
10837
|
+
// Check if the field exists in the datasets
|
|
10838
|
+
if (!(field in groundData) || !(field in comparisonData)) {
|
|
10839
|
+
console.error(`Field ${field} does not exist in provided data.`);
|
|
10840
|
+
return /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
10841
|
+
children: "Error: Data field missing"
|
|
10842
|
+
});
|
|
10843
|
+
}
|
|
10844
|
+
const chartRenderer = DiversityChartsFactory().getRenderer('comparison', config.chartType);
|
|
10845
|
+
// Check if renderer is the DefaultItemRenderer to log a warning
|
|
10846
|
+
if (chartRenderer === DefaultComparisonChart) {
|
|
10847
|
+
console.warn(`No specific renderer found for ${config.chartType}. Using default renderer.`);
|
|
10848
|
+
}
|
|
10849
|
+
return chartRenderer({
|
|
10850
|
+
baseDataset: {
|
|
10851
|
+
data: groundData[field],
|
|
10852
|
+
label: groundLabel
|
|
10853
|
+
},
|
|
10854
|
+
comparisonDataset: {
|
|
10855
|
+
data: comparisonData[field],
|
|
10856
|
+
label: comparisonLabel
|
|
10857
|
+
},
|
|
10858
|
+
title: showTitle ? core.fieldNameToTitle(field) : ''
|
|
10859
|
+
});
|
|
10860
|
+
};
|
|
10861
|
+
|
|
10862
|
+
// Compute statistics
|
|
10863
|
+
const computeStatistics = (baseData, comparisonData)=>{
|
|
10864
|
+
const buckets = baseData.map((item)=>typeof item.key !== 'string' ? `${item.key[0]} to ${item.key[1]}` : item.key);
|
|
10865
|
+
const baseValues = baseData.map((item)=>item.count);
|
|
10866
|
+
const cmpValues = comparisonData.map((item)=>item.count);
|
|
10867
|
+
// Mean Absolute Error (MAE)
|
|
10868
|
+
const mae = baseValues.reduce((sum, value, index)=>sum + Math.abs(value - cmpValues[index]), 0) / buckets.length;
|
|
10869
|
+
// Root Mean Square Error (RMSE)
|
|
10870
|
+
const rmse = Math.sqrt(baseValues.reduce((sum, value, index)=>sum + Math.pow(value - cmpValues[index], 2), 0) / buckets.length);
|
|
10871
|
+
// Pearson Correlation Coefficient
|
|
10872
|
+
const baseAve = baseValues.reduce((sum, value)=>sum + value, 0) / buckets.length;
|
|
10873
|
+
const cmpAvg = cmpValues.reduce((sum, value)=>sum + value, 0) / buckets.length;
|
|
10874
|
+
const numerator = baseValues.reduce((sum, value, index)=>sum + (value - baseAve) * (cmpValues[index] - cmpAvg), 0);
|
|
10875
|
+
const denominator = Math.sqrt(baseValues.reduce((sum, value)=>sum + Math.pow(value - baseAve, 2), 0) * cmpValues.reduce((sum, value)=>sum + Math.pow(value - cmpAvg, 2), 0));
|
|
10876
|
+
const correlation = numerator / denominator;
|
|
10877
|
+
const robustChiSquare = baseValues.reduce((sum, expected, index)=>{
|
|
10878
|
+
const observed = cmpValues[index];
|
|
10879
|
+
if (expected === 0 && observed === 0) {
|
|
10880
|
+
return sum; // Both expected and observed are 0, no contribution to chi-square
|
|
10881
|
+
} else if (expected === 0) {
|
|
10882
|
+
return sum + observed; // Add observed value to chi-square when expected is 0
|
|
10883
|
+
} else {
|
|
10884
|
+
return sum + Math.pow(observed - expected, 2) / expected;
|
|
10885
|
+
}
|
|
10886
|
+
}, 0);
|
|
10887
|
+
// Chi-Square Contributions
|
|
10888
|
+
const chiSquareContributions = buckets.map((group, index)=>{
|
|
10889
|
+
const expected = baseValues[index];
|
|
10890
|
+
const observed = cmpValues[index];
|
|
10891
|
+
let contribution = 0;
|
|
10892
|
+
if (expected === 0 && observed === 0) {
|
|
10893
|
+
contribution = 0;
|
|
10894
|
+
} else if (expected === 0) {
|
|
10895
|
+
contribution = observed;
|
|
10896
|
+
} else {
|
|
10897
|
+
contribution = Math.pow(observed - expected, 2) / expected;
|
|
10898
|
+
}
|
|
10899
|
+
return {
|
|
10900
|
+
group,
|
|
10901
|
+
contribution
|
|
10902
|
+
};
|
|
10903
|
+
});
|
|
10904
|
+
return {
|
|
10905
|
+
mae,
|
|
10906
|
+
rmse,
|
|
10907
|
+
correlation,
|
|
10908
|
+
robustChiSquare,
|
|
10909
|
+
chiSquareContributions
|
|
10910
|
+
};
|
|
10911
|
+
};
|
|
10912
|
+
const LabeledValueRow = ({ label, value })=>{
|
|
10913
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
|
|
10914
|
+
justify: "space-between",
|
|
10915
|
+
children: [
|
|
10916
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10917
|
+
fw: 600,
|
|
10918
|
+
size: "sm",
|
|
10919
|
+
className: "uppercase",
|
|
10920
|
+
children: label
|
|
10921
|
+
}),
|
|
10922
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10923
|
+
size: "sm",
|
|
10924
|
+
c: "primary",
|
|
10925
|
+
children: value
|
|
10926
|
+
})
|
|
10927
|
+
]
|
|
10928
|
+
});
|
|
10929
|
+
};
|
|
10930
|
+
const StatisticsCard = ({ baseData, comparisonData })=>{
|
|
10931
|
+
const metrics = computeStatistics(baseData, comparisonData);
|
|
10932
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
|
|
10933
|
+
gap: "xs",
|
|
10934
|
+
children: [
|
|
10935
|
+
/*#__PURE__*/ jsxRuntime.jsx(LabeledValueRow, {
|
|
10936
|
+
label: "Mean Absolute Error (MAE)",
|
|
10937
|
+
value: metrics.mae.toFixed(4)
|
|
10938
|
+
}),
|
|
10939
|
+
/*#__PURE__*/ jsxRuntime.jsx(LabeledValueRow, {
|
|
10940
|
+
label: "Root Mean Square Error (RMSE)",
|
|
10941
|
+
value: metrics.rmse.toFixed(4)
|
|
10942
|
+
}),
|
|
10943
|
+
/*#__PURE__*/ jsxRuntime.jsx(LabeledValueRow, {
|
|
10944
|
+
label: "Pearson Correlation Coefficient",
|
|
10945
|
+
value: metrics.correlation.toFixed(4)
|
|
10946
|
+
}),
|
|
10947
|
+
/*#__PURE__*/ jsxRuntime.jsx(LabeledValueRow, {
|
|
10948
|
+
label: "Robust Chi-Square Statistic",
|
|
10949
|
+
value: metrics.robustChiSquare.toFixed(4)
|
|
10950
|
+
}),
|
|
10951
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
10952
|
+
fw: 600,
|
|
10953
|
+
size: "sm",
|
|
10954
|
+
className: "uppercase",
|
|
10955
|
+
children: "Chi-Square Contributions by Group"
|
|
10956
|
+
}),
|
|
10957
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.ScrollArea, {
|
|
10958
|
+
h: 200,
|
|
10959
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table, {
|
|
10960
|
+
striped: true,
|
|
10961
|
+
withTableBorder: true,
|
|
10962
|
+
withColumnBorders: true,
|
|
10963
|
+
stickyHeader: true,
|
|
10964
|
+
stickyHeaderOffset: 0,
|
|
10965
|
+
children: [
|
|
10966
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Thead, {
|
|
10967
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
|
|
10968
|
+
children: [
|
|
10969
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
|
|
10970
|
+
children: "Group"
|
|
10971
|
+
}),
|
|
10972
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
|
|
10973
|
+
children: "Contribution"
|
|
10974
|
+
})
|
|
10975
|
+
]
|
|
10976
|
+
})
|
|
10977
|
+
}),
|
|
10978
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Tbody, {
|
|
10979
|
+
children: metrics.chiSquareContributions.map(({ group, contribution })=>/*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
|
|
10980
|
+
children: [
|
|
10981
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
|
|
10982
|
+
children: group
|
|
10983
|
+
}),
|
|
10984
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
|
|
10985
|
+
children: contribution.toFixed(4)
|
|
10986
|
+
})
|
|
10987
|
+
]
|
|
10988
|
+
}, group))
|
|
10989
|
+
})
|
|
10990
|
+
]
|
|
10991
|
+
})
|
|
10992
|
+
})
|
|
10993
|
+
]
|
|
10994
|
+
});
|
|
10995
|
+
};
|
|
10996
|
+
|
|
10997
|
+
const ComparisonChart = ({ config, groundData, groundLabel, comparisonData, comparisonLabel, field, chartType })=>{
|
|
10998
|
+
return generateChart(groundData, groundLabel, comparisonData, comparisonLabel, field, {
|
|
10999
|
+
...config,
|
|
11000
|
+
chartType: chartType
|
|
11001
|
+
}, false);
|
|
11002
|
+
};
|
|
11003
|
+
const ComparisonCard = ({ config, groundData, groundLabel, comparisonData, comparisonLabel, field, style = 'box' })=>{
|
|
11004
|
+
const [viewType, setViewType] = React.useState(config.chartType);
|
|
11005
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Card, {
|
|
11006
|
+
shadow: "xs",
|
|
11007
|
+
withBorder: style === 'box',
|
|
11008
|
+
className: "h-full",
|
|
11009
|
+
children: [
|
|
11010
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Card.Section, {
|
|
11011
|
+
inheritPadding: true,
|
|
11012
|
+
py: "xs",
|
|
11013
|
+
withBorder: style === 'box',
|
|
11014
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
|
|
11015
|
+
justify: "space-between",
|
|
11016
|
+
children: [
|
|
11017
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
11018
|
+
fw: 600,
|
|
11019
|
+
children: core.fieldNameToTitle(field)
|
|
11020
|
+
}),
|
|
11021
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
|
|
11022
|
+
value: viewType,
|
|
11023
|
+
onChange: setViewType,
|
|
11024
|
+
data: [
|
|
11025
|
+
{
|
|
11026
|
+
label: 'Bar',
|
|
11027
|
+
value: 'barComparison'
|
|
11028
|
+
},
|
|
11029
|
+
{
|
|
11030
|
+
label: 'Radar',
|
|
11031
|
+
value: 'radarComparison'
|
|
11032
|
+
},
|
|
11033
|
+
{
|
|
11034
|
+
label: 'Statistics',
|
|
11035
|
+
value: 'statisticsComparison'
|
|
11036
|
+
}
|
|
11037
|
+
]
|
|
11038
|
+
})
|
|
11039
|
+
]
|
|
11040
|
+
})
|
|
11041
|
+
}),
|
|
11042
|
+
viewType == 'statisticsComparison' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
11043
|
+
className: "h-96 m-2",
|
|
11044
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(StatisticsCard, {
|
|
11045
|
+
baseData: groundData[field],
|
|
11046
|
+
comparisonData: comparisonData[field]
|
|
11047
|
+
})
|
|
11048
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(ComparisonChart, {
|
|
11049
|
+
config: config,
|
|
11050
|
+
groundData: groundData,
|
|
11051
|
+
groundLabel: groundLabel,
|
|
11052
|
+
comparisonData: comparisonData,
|
|
11053
|
+
comparisonLabel: comparisonLabel,
|
|
11054
|
+
field: field,
|
|
11055
|
+
chartType: viewType
|
|
11056
|
+
})
|
|
11057
|
+
]
|
|
11058
|
+
});
|
|
11059
|
+
};
|
|
11060
|
+
|
|
11061
|
+
const ComparisonCharts = ({ ground, groundLabel, comparison, comparisonLabel, comparisonChartsConfig, numberOfColumns = 2, style = 'tile' })=>{
|
|
11062
|
+
const spans = computeRowSpan(Object.keys(comparisonChartsConfig).length, numberOfColumns);
|
|
11063
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Grid, {
|
|
11064
|
+
className: "w-full p-4",
|
|
11065
|
+
children: Object.entries(comparisonChartsConfig).map(([field, config], indexNum)=>{
|
|
11066
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.Grid.Col, {
|
|
11067
|
+
span: spans[indexNum],
|
|
11068
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonCard, {
|
|
11069
|
+
config: config,
|
|
11070
|
+
groundData: ground,
|
|
11071
|
+
groundLabel: groundLabel,
|
|
11072
|
+
comparisonData: comparison,
|
|
11073
|
+
comparisonLabel: comparisonLabel,
|
|
11074
|
+
field: field
|
|
11075
|
+
})
|
|
11076
|
+
}, `${indexNum}-charts-${field}-col`);
|
|
9815
11077
|
})
|
|
9816
11078
|
});
|
|
9817
11079
|
};
|
|
9818
11080
|
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
11081
|
+
/**
|
|
11082
|
+
* Converts a deeply nested data structure of numbers into a structured aggregation data format.
|
|
11083
|
+
*
|
|
11084
|
+
* @param {Record<string, Record<string, Record<string, number>>>} data - The input data where the structure
|
|
11085
|
+
* consists of three levels of nested records:
|
|
11086
|
+
* - The outermost level is keyed by source identifiers.
|
|
11087
|
+
* - The middle level is keyed by aggregation identifiers.
|
|
11088
|
+
* - The innermost level is keyed by histogram keys with corresponding numeric counts.
|
|
11089
|
+
*
|
|
11090
|
+
* @return {Record<string, AggregationsData>} - A newly structured data object where:
|
|
11091
|
+
* - The outermost level is the same as the input.
|
|
11092
|
+
* - Each aggregation identifier now maps to an array of histogram objects with key-count pairs.
|
|
11093
|
+
*/ const convertToAggregateData = (data)=>{
|
|
11094
|
+
const result = {};
|
|
11095
|
+
for (const [sourceKey, sourceValue] of Object.entries(data)){
|
|
11096
|
+
const aggData = {};
|
|
11097
|
+
for (const [aggKey, aggValue] of Object.entries(sourceValue)){
|
|
11098
|
+
const histogramDataArray = [];
|
|
11099
|
+
for (const [key, count] of Object.entries(aggValue)){
|
|
11100
|
+
histogramDataArray.push({
|
|
11101
|
+
key,
|
|
11102
|
+
count
|
|
11103
|
+
});
|
|
11104
|
+
}
|
|
11105
|
+
aggData[aggKey] = histogramDataArray;
|
|
11106
|
+
}
|
|
11107
|
+
result[sourceKey] = aggData;
|
|
9822
11108
|
}
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
11109
|
+
return result;
|
|
11110
|
+
};
|
|
11111
|
+
/**
|
|
11112
|
+
* Converts histogram response data into percentages based on the total counts.
|
|
11113
|
+
*
|
|
11114
|
+
* @param {Record<string, any>} data - The input data containing histogram details and total counts.
|
|
11115
|
+
*
|
|
11116
|
+
* @returns {AggregationsData} The processed histogram data where counts are converted to percentages.
|
|
11117
|
+
*/ const processHistogramResponseAsPercentage = (data)=>{
|
|
11118
|
+
const pathData = jsonpathPlus.JSONPath({
|
|
11119
|
+
json: data,
|
|
11120
|
+
path: '$..histogram',
|
|
11121
|
+
resultType: 'all'
|
|
11122
|
+
});
|
|
11123
|
+
const totalData = jsonpathPlus.JSONPath({
|
|
11124
|
+
json: data,
|
|
11125
|
+
path: '$.._totalCount',
|
|
11126
|
+
resultType: 'value'
|
|
11127
|
+
});
|
|
11128
|
+
const total = totalData[0];
|
|
11129
|
+
const results = pathData.reduce((acc, element)=>{
|
|
11130
|
+
const key = element.pointer.split('/').slice(-2, -1)[0];
|
|
11131
|
+
if (lodash.isArray(element.value[0].key) && element.value[0].key.length == 2) {
|
|
11132
|
+
if (!(key in acc)) acc[key] = [];
|
|
11133
|
+
return {
|
|
11134
|
+
...acc,
|
|
11135
|
+
[key]: [
|
|
11136
|
+
{
|
|
11137
|
+
key: `${element.value[0].key[0]}-${element.value[0].key[1]}`,
|
|
11138
|
+
count: element.value[0].count / total * 100
|
|
11139
|
+
},
|
|
11140
|
+
...acc[key]
|
|
11141
|
+
]
|
|
11142
|
+
};
|
|
11143
|
+
}
|
|
11144
|
+
return {
|
|
11145
|
+
...acc,
|
|
11146
|
+
[key]: element.value.map((x)=>{
|
|
11147
|
+
return {
|
|
11148
|
+
key: x.key,
|
|
11149
|
+
count: x.count / total * 100
|
|
11150
|
+
};
|
|
11151
|
+
})
|
|
11152
|
+
};
|
|
11153
|
+
}, {});
|
|
11154
|
+
return results;
|
|
11155
|
+
};
|
|
11156
|
+
/**
|
|
11157
|
+
* Takes an object of type AggregationsData and normalizes the
|
|
11158
|
+
* 'age_at_index' property by converting the age keys to a string format.
|
|
11159
|
+
*
|
|
11160
|
+
* This function checks if the 'age_at_index' key exists in the input object.
|
|
11161
|
+
* If it does, it transforms each age entry by appending ' Years' to the age
|
|
11162
|
+
* value and returns the updated object. If the 'age_at_index' key does not exist,
|
|
11163
|
+
* it returns the original data.
|
|
11164
|
+
*
|
|
11165
|
+
* @param {AggregationsData} data - The input data object containing the age aggregations.
|
|
11166
|
+
* @returns {AggregationsData} - The transformed data object with normalized age keys.
|
|
11167
|
+
*/ const normalizeAgeOfIndex = (data)=>{
|
|
11168
|
+
if (!('age_at_index' in data)) return data;
|
|
11169
|
+
const newKeys = data['age_at_index'].map((x)=>{
|
|
11170
|
+
return {
|
|
11171
|
+
key: `${x.key} Years`,
|
|
11172
|
+
count: x.count
|
|
11173
|
+
};
|
|
11174
|
+
});
|
|
11175
|
+
return {
|
|
11176
|
+
...data,
|
|
11177
|
+
age_at_index: newKeys
|
|
11178
|
+
};
|
|
11179
|
+
};
|
|
11180
|
+
/**
|
|
11181
|
+
* Aligns the source data with the target structure by mapping items based on their keys and updating the counts.
|
|
11182
|
+
*
|
|
11183
|
+
* This function takes two sets of aggregation data, aligns them by their categories and individual keys,
|
|
11184
|
+
* and updates the counts from the source data. If a category or its items are missing in the source data,
|
|
11185
|
+
* a count of 0 is assigned to those items in the resulting aligned data structure.
|
|
11186
|
+
*
|
|
11187
|
+
* @param {AggregationsData} sourceData - The source aggregation data containing key-value pairs with the count.
|
|
11188
|
+
* @param {AggregationsData} targetStructure - The target aggregation structure used to align and structure the result.
|
|
11189
|
+
* @return {AggregationsData} The aligned data with updated counts from the source data, maintaining the target structure.
|
|
11190
|
+
*/ const alignData = (sourceData, targetStructure)=>{
|
|
11191
|
+
const result = {};
|
|
11192
|
+
for(const category in targetStructure){
|
|
11193
|
+
if (category in sourceData) {
|
|
11194
|
+
result[category] = targetStructure[category].map((targetItem)=>{
|
|
11195
|
+
const sourceItem = sourceData[category].find((item)=>item.key === targetItem.key);
|
|
11196
|
+
return sourceItem ? {
|
|
11197
|
+
...targetItem,
|
|
11198
|
+
count: sourceItem.count
|
|
11199
|
+
} : {
|
|
11200
|
+
...targetItem,
|
|
11201
|
+
count: 0
|
|
11202
|
+
};
|
|
11203
|
+
});
|
|
9828
11204
|
}
|
|
9829
11205
|
}
|
|
9830
|
-
|
|
11206
|
+
// TODO: report missing?
|
|
11207
|
+
// TODO: make this configurable
|
|
11208
|
+
return result;
|
|
11209
|
+
};
|
|
9831
11210
|
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
11211
|
+
const getStaticDiversityData = (dataset)=>{
|
|
11212
|
+
return convertToAggregateData({
|
|
11213
|
+
census: {
|
|
11214
|
+
age_at_index: {
|
|
11215
|
+
'0-4 Years': 6,
|
|
11216
|
+
'5-11 Years': 8.7,
|
|
11217
|
+
'12-15 Years': 5.1,
|
|
11218
|
+
'16-17 Years': 2.5,
|
|
11219
|
+
'18-29 Years': 16.4,
|
|
11220
|
+
'30-39 Years': 13.5,
|
|
11221
|
+
'40-49 Years': 12.3,
|
|
11222
|
+
'50-64 Years': 19.2,
|
|
11223
|
+
'65-74 Years': 9.6,
|
|
11224
|
+
'75-84 Years': 4.9,
|
|
11225
|
+
'85-89 Years': 2
|
|
11226
|
+
},
|
|
11227
|
+
race: {
|
|
11228
|
+
White: 61.6315330007,
|
|
11229
|
+
'Black or African American': 12.4013544021,
|
|
11230
|
+
Asian: 5.9997260938,
|
|
11231
|
+
Other: 18.6347237845,
|
|
11232
|
+
'American Indian or Alaska Native': 1.1244963298,
|
|
11233
|
+
'Native Hawaiian or Other Pacific Islander': 0.2081663891,
|
|
11234
|
+
'Not Reported': 0
|
|
11235
|
+
},
|
|
11236
|
+
ethnicity: {
|
|
11237
|
+
'Hispanic or Latino': 18.7298774077,
|
|
11238
|
+
'Not Hispanic or Latino': 81.2701225923,
|
|
11239
|
+
'Not Reported': 0
|
|
11240
|
+
},
|
|
11241
|
+
sex: {
|
|
11242
|
+
Female: 50.75,
|
|
11243
|
+
Male: 49.25,
|
|
11244
|
+
'Not Reported': 0
|
|
11245
|
+
},
|
|
11246
|
+
race_and_ethnicity: {
|
|
11247
|
+
'Hispanic or Latino': 18.45,
|
|
11248
|
+
'American Indian or Alaska Native, Not Hispanic or Latino': 0.74,
|
|
11249
|
+
'Asian, Not Hispanic or Latino': 5.76,
|
|
11250
|
+
'Black, Not Hispanic or Latino': 12.54,
|
|
11251
|
+
'Native Hawaiian or Other Pacific Islander, Not Hispanic or Latino': 0.182,
|
|
11252
|
+
'White, Not Hispanic or Latino': 60.11,
|
|
11253
|
+
'Multiple or Other, Not Hispanic or Latino': 2.22,
|
|
11254
|
+
'Not Reported': 0
|
|
11255
|
+
}
|
|
11256
|
+
}
|
|
11257
|
+
})[dataset];
|
|
11258
|
+
};
|
|
11259
|
+
|
|
11260
|
+
const convertToValidJSON = (inputString)=>{
|
|
11261
|
+
// Remove all newline characters and extra spaces
|
|
11262
|
+
let cleanedString = inputString.replace(/\s+/g, ' ').trim();
|
|
11263
|
+
// Add quotes around property names that aren't already quoted
|
|
11264
|
+
cleanedString = cleanedString.replace(/(\w+):/g, '"$1":');
|
|
11265
|
+
// Replace single quotes with double quotes (if any)
|
|
11266
|
+
cleanedString = cleanedString.replace(/'/g, '"');
|
|
11267
|
+
return cleanedString;
|
|
11268
|
+
};
|
|
11269
|
+
const createDiversityQuery = (fields = {
|
|
11270
|
+
age_at_index: 'age_at_index',
|
|
11271
|
+
sex: 'sex',
|
|
11272
|
+
ethnicity: 'ethnicity',
|
|
11273
|
+
race: 'race'
|
|
11274
|
+
})=>{
|
|
11275
|
+
// TODO refactor to make this usable for all facets
|
|
11276
|
+
return {
|
|
11277
|
+
query: `
|
|
11278
|
+
query ($filter_0_4: JSON, $filter_5_11: JSON, $filter_12_15: JSON, $filter_16_17: JSON, $filter_18_29: JSON, $filter_30_39: JSON, $filter_40_49: JSON, $filter_50_64: JSON, $filter_65_74: JSON, $filter_75_84: JSON, $filter_85_plus: JSON) {
|
|
11279
|
+
_aggregation {
|
|
11280
|
+
case {
|
|
11281
|
+
_totalCount
|
|
11282
|
+
${fields['sex']} {
|
|
11283
|
+
histogram {
|
|
11284
|
+
key
|
|
11285
|
+
count
|
|
11286
|
+
}
|
|
11287
|
+
}
|
|
11288
|
+
${fields['ethnicity']} {
|
|
11289
|
+
histogram {
|
|
11290
|
+
key
|
|
11291
|
+
count
|
|
11292
|
+
}
|
|
11293
|
+
},
|
|
11294
|
+
${fields['race']} {
|
|
11295
|
+
histogram {
|
|
11296
|
+
key
|
|
11297
|
+
count
|
|
11298
|
+
}
|
|
11299
|
+
}
|
|
9836
11300
|
}
|
|
9837
|
-
|
|
9838
|
-
|
|
11301
|
+
case_0_4: case(filter: $filter_0_4, filterSelf: true, accessibility: all) {
|
|
11302
|
+
${fields['age_at_index']} {
|
|
11303
|
+
histogram {
|
|
11304
|
+
key
|
|
11305
|
+
count
|
|
11306
|
+
}
|
|
11307
|
+
}
|
|
9839
11308
|
}
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
11309
|
+
case_5_11: case(filter: $filter_5_11, filterSelf: true, accessibility: all) {
|
|
11310
|
+
${fields['age_at_index']} {
|
|
11311
|
+
histogram {
|
|
11312
|
+
key
|
|
11313
|
+
count
|
|
11314
|
+
}
|
|
11315
|
+
}
|
|
11316
|
+
}
|
|
11317
|
+
case_12_15: case(filter: $filter_12_15, filterSelf: true, accessibility: all) {
|
|
11318
|
+
${fields['age_at_index']} {
|
|
11319
|
+
histogram {
|
|
11320
|
+
key
|
|
11321
|
+
count
|
|
11322
|
+
}
|
|
11323
|
+
}
|
|
11324
|
+
}
|
|
11325
|
+
case_16_17: case(filter: $filter_16_17, filterSelf: true, accessibility: all) {
|
|
11326
|
+
${fields['age_at_index']} {
|
|
11327
|
+
histogram {
|
|
11328
|
+
key
|
|
11329
|
+
count
|
|
11330
|
+
}
|
|
11331
|
+
}
|
|
11332
|
+
}
|
|
11333
|
+
case_18_29: case(filter: $filter_18_29, filterSelf: true, accessibility: all) {
|
|
11334
|
+
${fields['age_at_index']} {
|
|
11335
|
+
histogram {
|
|
11336
|
+
key
|
|
11337
|
+
count
|
|
11338
|
+
}
|
|
11339
|
+
}
|
|
11340
|
+
}
|
|
11341
|
+
case_30_39: case(filter: $filter_30_39, filterSelf: true, accessibility: all) {
|
|
11342
|
+
${fields['age_at_index']} {
|
|
11343
|
+
histogram {
|
|
11344
|
+
key
|
|
11345
|
+
count
|
|
11346
|
+
}
|
|
11347
|
+
}
|
|
11348
|
+
}
|
|
11349
|
+
case_40_49: case(filter: $filter_40_49, filterSelf: true, accessibility: all) {
|
|
11350
|
+
${fields['age_at_index']} {
|
|
11351
|
+
histogram {
|
|
11352
|
+
key
|
|
11353
|
+
count
|
|
11354
|
+
}
|
|
11355
|
+
}
|
|
11356
|
+
}
|
|
11357
|
+
case_50_64: case(filter: $filter_50_64, filterSelf: true, accessibility: all) {
|
|
11358
|
+
${fields['age_at_index']} {
|
|
11359
|
+
histogram {
|
|
11360
|
+
key
|
|
11361
|
+
count
|
|
11362
|
+
}
|
|
11363
|
+
}
|
|
11364
|
+
}
|
|
11365
|
+
case_65_74: case(filter: $filter_65_74, filterSelf: true, accessibility: all) {
|
|
11366
|
+
${fields['age_at_index']} {
|
|
11367
|
+
histogram {
|
|
11368
|
+
key
|
|
11369
|
+
count
|
|
11370
|
+
}
|
|
11371
|
+
}
|
|
11372
|
+
}
|
|
11373
|
+
case_75_84: case(filter: $filter_75_84, filterSelf: true, accessibility: all) {
|
|
11374
|
+
${fields['age_at_index']} {
|
|
11375
|
+
histogram {
|
|
11376
|
+
key
|
|
11377
|
+
count
|
|
11378
|
+
}
|
|
11379
|
+
}
|
|
11380
|
+
}
|
|
11381
|
+
case_85_plus: case(filter: $filter_85_plus, filterSelf: true, accessibility: all) {
|
|
11382
|
+
${fields['age_at_index']} {
|
|
11383
|
+
histogram {
|
|
11384
|
+
key
|
|
11385
|
+
count
|
|
11386
|
+
}
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
}
|
|
11390
|
+
}`,
|
|
11391
|
+
variables: convertToValidJSON(`{ "filter_0_4": {
|
|
11392
|
+
"AND": [
|
|
11393
|
+
{
|
|
11394
|
+
">=": {
|
|
11395
|
+
${fields['age_at_index']}: 0
|
|
11396
|
+
}
|
|
11397
|
+
},
|
|
11398
|
+
{
|
|
11399
|
+
"<=": {
|
|
11400
|
+
${fields['age_at_index']}: 4
|
|
11401
|
+
}
|
|
11402
|
+
}
|
|
11403
|
+
]
|
|
11404
|
+
},
|
|
11405
|
+
"filter_5_11": {
|
|
11406
|
+
"AND": [
|
|
11407
|
+
{
|
|
11408
|
+
">=": {
|
|
11409
|
+
${fields['age_at_index']}: 5
|
|
11410
|
+
}
|
|
11411
|
+
},
|
|
11412
|
+
{
|
|
11413
|
+
"<=": {
|
|
11414
|
+
${fields['age_at_index']}: 11
|
|
11415
|
+
}
|
|
11416
|
+
}
|
|
11417
|
+
]
|
|
11418
|
+
},
|
|
11419
|
+
"filter_12_15": {
|
|
11420
|
+
"AND": [
|
|
11421
|
+
{
|
|
11422
|
+
">=": {
|
|
11423
|
+
${fields['age_at_index']}: 12
|
|
11424
|
+
}
|
|
11425
|
+
},
|
|
11426
|
+
{
|
|
11427
|
+
"<=": {
|
|
11428
|
+
${fields['age_at_index']}: 15
|
|
11429
|
+
}
|
|
11430
|
+
}
|
|
11431
|
+
]
|
|
11432
|
+
},
|
|
11433
|
+
"filter_16_17": {
|
|
11434
|
+
"AND": [
|
|
11435
|
+
{
|
|
11436
|
+
">=": {
|
|
11437
|
+
${fields['age_at_index']}: 16
|
|
11438
|
+
}
|
|
11439
|
+
},
|
|
11440
|
+
{
|
|
11441
|
+
"<=": {
|
|
11442
|
+
${fields['age_at_index']}: 17
|
|
11443
|
+
}
|
|
11444
|
+
}
|
|
11445
|
+
]
|
|
11446
|
+
},
|
|
11447
|
+
"filter_18_29": {
|
|
11448
|
+
"AND": [
|
|
11449
|
+
{
|
|
11450
|
+
">=": {
|
|
11451
|
+
${fields['age_at_index']}: 18
|
|
11452
|
+
}
|
|
11453
|
+
},
|
|
11454
|
+
{
|
|
11455
|
+
"<=": {
|
|
11456
|
+
${fields['age_at_index']}: 29
|
|
11457
|
+
}
|
|
11458
|
+
}
|
|
11459
|
+
]
|
|
11460
|
+
},
|
|
11461
|
+
"filter_30_39": {
|
|
11462
|
+
"AND": [
|
|
11463
|
+
{
|
|
11464
|
+
">=": {
|
|
11465
|
+
${fields['age_at_index']}: 30
|
|
11466
|
+
}
|
|
11467
|
+
},
|
|
11468
|
+
{
|
|
11469
|
+
"<=": {
|
|
11470
|
+
${fields['age_at_index']}: 39
|
|
11471
|
+
}
|
|
11472
|
+
}
|
|
11473
|
+
]
|
|
11474
|
+
},
|
|
11475
|
+
"filter_40_49": {
|
|
11476
|
+
"AND": [
|
|
11477
|
+
{
|
|
11478
|
+
">=": {
|
|
11479
|
+
${fields['age_at_index']}: 40
|
|
11480
|
+
}
|
|
11481
|
+
},
|
|
11482
|
+
{
|
|
11483
|
+
"<=": {
|
|
11484
|
+
${fields['age_at_index']}: 49
|
|
11485
|
+
}
|
|
11486
|
+
}
|
|
11487
|
+
]
|
|
11488
|
+
},
|
|
11489
|
+
"filter_50_64": {
|
|
11490
|
+
"AND": [
|
|
11491
|
+
{
|
|
11492
|
+
">=": {
|
|
11493
|
+
${fields['age_at_index']}: 50
|
|
11494
|
+
}
|
|
11495
|
+
},
|
|
11496
|
+
{
|
|
11497
|
+
"<=": {
|
|
11498
|
+
${fields['age_at_index']}: 64
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
]
|
|
11502
|
+
},
|
|
11503
|
+
"filter_65_74": {
|
|
11504
|
+
"AND": [
|
|
11505
|
+
{
|
|
11506
|
+
">=": {
|
|
11507
|
+
${fields['age_at_index']}: 65
|
|
11508
|
+
}
|
|
11509
|
+
},
|
|
11510
|
+
{
|
|
11511
|
+
"<=": {
|
|
11512
|
+
${fields['age_at_index']}: 74
|
|
11513
|
+
}
|
|
11514
|
+
}
|
|
11515
|
+
]
|
|
11516
|
+
},
|
|
11517
|
+
"filter_75_84": {
|
|
11518
|
+
"AND": [
|
|
11519
|
+
{
|
|
11520
|
+
">=": {
|
|
11521
|
+
${fields['age_at_index']}: 75
|
|
11522
|
+
}
|
|
11523
|
+
},
|
|
11524
|
+
{
|
|
11525
|
+
"<=": {
|
|
11526
|
+
${fields['age_at_index']}: 84
|
|
11527
|
+
}
|
|
11528
|
+
}
|
|
11529
|
+
]
|
|
11530
|
+
},
|
|
11531
|
+
"filter_85_plus": {
|
|
11532
|
+
"AND": [
|
|
11533
|
+
{
|
|
11534
|
+
">=": {
|
|
11535
|
+
${fields['age_at_index']}: 85
|
|
11536
|
+
}
|
|
11537
|
+
}
|
|
11538
|
+
]
|
|
11539
|
+
}
|
|
11540
|
+
}`)
|
|
9850
11541
|
};
|
|
9851
|
-
return new ContentDatabase(config);
|
|
9852
11542
|
};
|
|
9853
|
-
const ContentSource = setup();
|
|
9854
11543
|
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
}
|
|
9867
|
-
const { topBar, navigation, type = 'original' } = navigationConfigJSON;
|
|
9868
|
-
const headerProps = {
|
|
9869
|
-
top: topBar,
|
|
9870
|
-
navigation: navigation,
|
|
9871
|
-
banners: bannerConfigJSON,
|
|
9872
|
-
type
|
|
9873
|
-
};
|
|
9874
|
-
const footerProps = await ContentSource.get(`config/${core.GEN3_COMMONS_NAME}/footer.json`);
|
|
9875
|
-
return {
|
|
9876
|
-
headerProps,
|
|
9877
|
-
footerProps,
|
|
9878
|
-
headerData: {
|
|
9879
|
-
title: 'Gen3 Frontend Framework Page',
|
|
9880
|
-
content: 'Gen3 Frontend Framework Page',
|
|
9881
|
-
key: 'gen3-common-page'
|
|
11544
|
+
const CohortDiversityApp = (config)=>{
|
|
11545
|
+
const groundDataset = getStaticDiversityData(config.datasets.ground.dataset);
|
|
11546
|
+
const gqlQuery = createDiversityQuery(); // TODO: add field mapping
|
|
11547
|
+
const { data: rawComparisonDataset, isLoading: isComparisonLoading, isError: isComparisonError } = core.useGeneralGQLQuery({
|
|
11548
|
+
query: gqlQuery.query,
|
|
11549
|
+
variables: JSON.parse(gqlQuery.variables)
|
|
11550
|
+
});
|
|
11551
|
+
const comparisonDataset = React.useMemo(()=>{
|
|
11552
|
+
if (rawComparisonDataset) {
|
|
11553
|
+
const results = processHistogramResponseAsPercentage(rawComparisonDataset.data);
|
|
11554
|
+
return alignData(normalizeAgeOfIndex(results), groundDataset);
|
|
9882
11555
|
}
|
|
9883
|
-
|
|
11556
|
+
return undefined;
|
|
11557
|
+
}, [
|
|
11558
|
+
groundDataset,
|
|
11559
|
+
rawComparisonDataset
|
|
11560
|
+
]);
|
|
11561
|
+
if (isComparisonError) {
|
|
11562
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
|
|
11563
|
+
message: 'Unable to get data need for Cohort Diversity'
|
|
11564
|
+
});
|
|
11565
|
+
}
|
|
11566
|
+
if (isComparisonLoading) {
|
|
11567
|
+
return /*#__PURE__*/ jsxRuntime.jsx(core$1.LoadingOverlay, {
|
|
11568
|
+
visible: true
|
|
11569
|
+
});
|
|
11570
|
+
}
|
|
11571
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
|
|
11572
|
+
classNames: {
|
|
11573
|
+
root: 'w-full m-4 mb-2'
|
|
11574
|
+
},
|
|
11575
|
+
"aria-label": "Main Content of Cohort Diversity App",
|
|
11576
|
+
children: [
|
|
11577
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Title, {
|
|
11578
|
+
order: 1,
|
|
11579
|
+
size: "h3",
|
|
11580
|
+
children: "Cohort Diversity Visualization"
|
|
11581
|
+
}),
|
|
11582
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion, {
|
|
11583
|
+
variant: "filled",
|
|
11584
|
+
chevronPosition: "left",
|
|
11585
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Accordion.Item, {
|
|
11586
|
+
value: "summaryCharts",
|
|
11587
|
+
"aria-label": "Summary Charts",
|
|
11588
|
+
children: [
|
|
11589
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Control, {
|
|
11590
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
11591
|
+
className: "flex items-center justify-start space-x-2 text-accent",
|
|
11592
|
+
children: [
|
|
11593
|
+
/*#__PURE__*/ jsxRuntime.jsx(fa.FaChartPie, {
|
|
11594
|
+
style: {
|
|
11595
|
+
color: 'secondary.4',
|
|
11596
|
+
width: core$1.rem(32),
|
|
11597
|
+
height: core$1.rem(32)
|
|
11598
|
+
}
|
|
11599
|
+
}),
|
|
11600
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
|
|
11601
|
+
fw: 600,
|
|
11602
|
+
children: "Summary Charts"
|
|
11603
|
+
})
|
|
11604
|
+
]
|
|
11605
|
+
})
|
|
11606
|
+
}),
|
|
11607
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Panel, {
|
|
11608
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Charts, {
|
|
11609
|
+
data: groundDataset ?? {},
|
|
11610
|
+
charts: config.charts,
|
|
11611
|
+
isSuccess: true,
|
|
11612
|
+
numCols: 2
|
|
11613
|
+
})
|
|
11614
|
+
})
|
|
11615
|
+
]
|
|
11616
|
+
})
|
|
11617
|
+
}),
|
|
11618
|
+
/*#__PURE__*/ jsxRuntime.jsx(ComparisonCharts, {
|
|
11619
|
+
ground: groundDataset ?? {},
|
|
11620
|
+
groundLabel: config.datasets.ground.label,
|
|
11621
|
+
comparison: comparisonDataset ?? {},
|
|
11622
|
+
comparisonLabel: config.datasets.comparison[0].label,
|
|
11623
|
+
comparisonChartsConfig: config.comparisonCharts,
|
|
11624
|
+
numberOfColumns: config?.numberOfColumns
|
|
11625
|
+
})
|
|
11626
|
+
]
|
|
11627
|
+
});
|
|
9884
11628
|
};
|
|
9885
11629
|
|
|
11630
|
+
const { appApi: diversityApi, appStore, appContext } = core.createAppApiForRTKQ('cohortDiversity');
|
|
11631
|
+
|
|
11632
|
+
const _APP_NAME = 'CohortDiversity'; // This wil be the route name of the app
|
|
11633
|
+
const _APP_VERSION = '1.0.0';
|
|
11634
|
+
const AppId = core.getGen3AppId(_APP_NAME, _APP_VERSION);
|
|
11635
|
+
const registerCohortDiversityApp = ()=>core.createGen3AppWithOwnStore({
|
|
11636
|
+
App: CohortDiversityApp,
|
|
11637
|
+
name: _APP_NAME,
|
|
11638
|
+
version: 'v1.0.0',
|
|
11639
|
+
id: AppId,
|
|
11640
|
+
requiredEntityTypes: [],
|
|
11641
|
+
store: appStore,
|
|
11642
|
+
context: appContext
|
|
11643
|
+
});
|
|
11644
|
+
|
|
9886
11645
|
// Define theme for mantine v7
|
|
9887
11646
|
const createMantineTheme = (fonts, colors)=>{
|
|
9888
11647
|
const theme = core$1.createTheme({
|
|
@@ -13061,7 +14820,10 @@ const AdminAuthZPageGetServerSideProps = async ()=>{
|
|
|
13061
14820
|
try {
|
|
13062
14821
|
const contents = fs.readFileSync(path.join(rootPath, filepath), 'utf8');
|
|
13063
14822
|
data = await YAML.parse(contents);
|
|
13064
|
-
} catch (
|
|
14823
|
+
} catch (error) {
|
|
14824
|
+
if (error instanceof Error) {
|
|
14825
|
+
console.error(error.message);
|
|
14826
|
+
}
|
|
13065
14827
|
throw new Error(`Cannot process ${rootPath}${filepath}`);
|
|
13066
14828
|
}
|
|
13067
14829
|
return {
|
|
@@ -14092,6 +15854,7 @@ exports.QueryPage = QueryPage;
|
|
|
14092
15854
|
exports.QueryPageGetServerSideProps = QueryPageGetServerSideProps;
|
|
14093
15855
|
exports.ReactECharts = ReactECharts;
|
|
14094
15856
|
exports.ResourcesFilters = ResourcesFilters;
|
|
15857
|
+
exports.SPECIAL_CASE_FIELDS = SPECIAL_CASE_FIELDS;
|
|
14095
15858
|
exports.SessionExpiredModal = SessionExpiredModal;
|
|
14096
15859
|
exports.StudyGroup = StudyGroup;
|
|
14097
15860
|
exports.SubmissionPage = SubmissionPage;
|
|
@@ -14121,6 +15884,8 @@ exports.isTextTransform = isTextTransform$1;
|
|
|
14121
15884
|
exports.processLabel = processLabel$1;
|
|
14122
15885
|
exports.processRangeKeyLabel = processRangeKeyLabel;
|
|
14123
15886
|
exports.registerCohortBuilderDefaultPreviewRenderers = registerCohortBuilderDefaultPreviewRenderers;
|
|
15887
|
+
exports.registerCohortDiscoveryApp = registerCohortDiscoveryApp;
|
|
15888
|
+
exports.registerCohortDiversityApp = registerCohortDiversityApp;
|
|
14124
15889
|
exports.registerDefaultDiscoveryDataLoaders = registerDefaultDiscoveryDataLoaders;
|
|
14125
15890
|
exports.registerDiscoveryDefaultCellRenderers = registerDiscoveryDefaultCellRenderers;
|
|
14126
15891
|
exports.registerDiscoveryDefaultStudyPreviewRenderers = registerDiscoveryDefaultStudyPreviewRenderers;
|
|
@@ -14130,6 +15895,7 @@ exports.resourcePathFromProjectID = resourcePathFromProjectID;
|
|
|
14130
15895
|
exports.sessionLogout = sessionLogout;
|
|
14131
15896
|
exports.sessionToken = sessionToken;
|
|
14132
15897
|
exports.stripTrailingSlash = stripTrailingSlash;
|
|
15898
|
+
exports.toDisplayName = toDisplayName;
|
|
14133
15899
|
exports.truncateString = truncateString;
|
|
14134
15900
|
exports.unixTimeToString = unixTimeToString;
|
|
14135
15901
|
exports.useDiscoveryContext = useDiscoveryContext;
|