@gen-epix/ui-client-casedb 4.0.0 → 4.0.1
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/@types/mui.d.ts +1 -1
- package/dist/@types/{ui-casedb.d.ts → ui-client-casedb.d.ts} +1 -1
- package/dist/_chunks/AddCasesToEventDialog.js +74 -74
- package/dist/_chunks/AddCasesToEventDialog.js.map +1 -1
- package/dist/_chunks/CaseContentForm.js +2 -2
- package/dist/_chunks/CaseContentForm.js.map +1 -1
- package/dist/_chunks/CaseDbDownloadUtil.js +40 -35
- package/dist/_chunks/CaseDbDownloadUtil.js.map +1 -1
- package/dist/_chunks/CaseInfoDialog.js +195 -195
- package/dist/_chunks/CaseInfoDialog.js.map +1 -1
- package/dist/_chunks/CaseSetInfoDialog.js +131 -131
- package/dist/_chunks/CaseSetInfoDialog.js.map +1 -1
- package/dist/_chunks/CaseTypeInfoDialog.js +63 -61
- package/dist/_chunks/CaseTypeInfoDialog.js.map +1 -1
- package/dist/_chunks/CasesAlreadyInCaseSetWarning.js +6 -6
- package/dist/_chunks/CasesAlreadyInCaseSetWarning.js.map +1 -1
- package/dist/_chunks/CompletCaseTypeLoader.js +3 -3
- package/dist/_chunks/CompletCaseTypeLoader.js.map +1 -1
- package/dist/_chunks/CreateEventDialogSuccessNotificationMessage.js +1 -1
- package/dist/_chunks/CreateEventDialogSuccessNotificationMessage.js.map +1 -1
- package/dist/_chunks/CustomTabPanel.js.map +1 -1
- package/dist/_chunks/Dashboard.js +399 -386
- package/dist/_chunks/Dashboard.js.map +1 -1
- package/dist/_chunks/DashboardStoreLoader.js +5 -5
- package/dist/_chunks/DashboardStoreLoader.js.map +1 -1
- package/dist/_chunks/DataCollectionAccessInfo.js +21 -21
- package/dist/_chunks/DataCollectionAccessInfo.js.map +1 -1
- package/dist/_chunks/EpiCurveUtil.js +4 -4
- package/dist/_chunks/EpiCurveUtil.js.map +1 -1
- package/dist/_chunks/EpiCurveWidget.js +189 -183
- package/dist/_chunks/EpiCurveWidget.js.map +1 -1
- package/dist/_chunks/FilterUtil.js +103 -101
- package/dist/_chunks/FilterUtil.js.map +1 -1
- package/dist/_chunks/FindSimilarCasesDialog.js +16 -16
- package/dist/_chunks/FindSimilarCasesDialog.js.map +1 -1
- package/dist/_chunks/FindSimilarCasesUtil.js +9 -9
- package/dist/_chunks/FindSimilarCasesUtil.js.map +1 -1
- package/dist/_chunks/HomePageTrends.js +8 -8
- package/dist/_chunks/HomePageTrends.js.map +1 -1
- package/dist/_chunks/LegendaItem.js +3 -3
- package/dist/_chunks/LegendaItem.js.map +1 -1
- package/dist/_chunks/LineListWidget.js +23 -21
- package/dist/_chunks/LineListWidget.js.map +1 -1
- package/dist/_chunks/PanelSeparator.js +374 -384
- package/dist/_chunks/PanelSeparator.js.map +1 -1
- package/dist/_chunks/Upload.js +222 -207
- package/dist/_chunks/Upload.js.map +1 -1
- package/dist/_chunks/UploadUtil.js +1970 -841
- package/dist/_chunks/UploadUtil.js.map +1 -1
- package/dist/_chunks/UserRightsDialog.js +12 -12
- package/dist/_chunks/UserRightsDialog.js.map +1 -1
- package/dist/_chunks/_MapCache.js +2 -2
- package/dist/_chunks/_baseGet.js +1 -1
- package/dist/_chunks/_baseGet.js.map +1 -1
- package/dist/_chunks/_baseIteratee.js +1 -1
- package/dist/_chunks/_baseIteratee.js.map +1 -1
- package/dist/_chunks/_setToString.js.map +1 -1
- package/dist/_chunks/{chunk-KS7C4IRE.js → chunk-BV7QT456.js} +330 -495
- package/dist/_chunks/chunk-BV7QT456.js.map +1 -0
- package/dist/_chunks/cloneDeep.js +11 -9
- package/dist/_chunks/cloneDeep.js.map +1 -1
- package/dist/_chunks/dashboardStore.js +259 -261
- package/dist/_chunks/dashboardStore.js.map +1 -1
- package/dist/_chunks/esm.js +2900 -2868
- package/dist/_chunks/esm.js.map +1 -1
- package/dist/_chunks/format.js +8 -8
- package/dist/_chunks/format.js.map +1 -1
- package/dist/_chunks/index.esm.js +919 -796
- package/dist/_chunks/index.esm.js.map +1 -1
- package/dist/_chunks/index.module.js +1 -1
- package/dist/_chunks/index.module.js.map +1 -1
- package/dist/_chunks/protectedTokens.js +79 -81
- package/dist/_chunks/protectedTokens.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/round.js +1 -1
- package/dist/_chunks/round.js.map +1 -1
- package/dist/_chunks/shallow.js +2 -2
- package/dist/_chunks/shallow.js.map +1 -1
- package/dist/_chunks/sync.js +198 -161
- package/dist/_chunks/sync.js.map +1 -1
- package/dist/_chunks/toDate.js +1 -1
- package/dist/_chunks/toDate.js.map +1 -1
- package/dist/_chunks/toString.js +1 -1
- package/dist/_chunks/toString.js.map +1 -1
- package/dist/_chunks/useUnit.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +5 -5
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/filters/SelectionFilter.d.ts +2 -2
- package/dist/classes/filters/TreeFilter.d.ts +2 -2
- package/dist/classes/services/DataService/index.js +3 -3
- package/dist/classes/services/DataService/index.js.map +1 -1
- package/dist/classes/services/EventBusService/EventBusService.d.ts +1 -1
- package/dist/classes/services/EventBusService/index.js.map +1 -1
- package/dist/classes/services/LineListService/LineListServiceAbstract/index.js +1 -1
- package/dist/classes/services/LineListService/LineListServiceAbstract/index.js.map +1 -1
- package/dist/components/app/CaseDbApp/index.js +8 -5
- package/dist/components/app/CaseDbApp/index.js.map +1 -1
- package/dist/components/form/fields/ArrangementEditor/index.js +83 -83
- package/dist/components/form/fields/ArrangementEditor/index.js.map +1 -1
- package/dist/components/ui/AddCasesToEventDialog/AddCasesToEventDialog.d.ts +2 -2
- package/dist/components/ui/CaseContentFormDialog/CaseContentFormDialog.d.ts +2 -2
- package/dist/components/ui/CaseContentFormDialog/index.js +1 -1
- package/dist/components/ui/CaseContentFormDialog/index.js.map +1 -1
- package/dist/components/ui/CaseInfoDialog/CaseInfoDialog.d.ts +2 -2
- package/dist/components/ui/CaseSetInfoDialog/CaseSetInfoDialog.d.ts +2 -2
- package/dist/components/ui/CaseSummary/index.js +1 -1
- package/dist/components/ui/CaseSummary/index.js.map +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialog.d.ts +2 -2
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialogContent.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialogWithLoader.d.ts +2 -2
- package/dist/components/ui/ContextMenu/index.js.map +1 -1
- package/dist/components/ui/CreateEventDialog/CreateEventDialog.d.ts +2 -2
- package/dist/components/ui/CreateEventDialog/index.js +9 -9
- package/dist/components/ui/CreateEventDialog/index.js.map +1 -1
- package/dist/components/ui/Dashboard/DashboardDownloadSidebarItem.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardSettingsSidebarItem.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardWidget.d.ts +1 -1
- package/dist/components/ui/DashboardEditCases/index.js +1 -1
- package/dist/components/ui/DashboardEditCases/index.js.map +1 -1
- package/dist/components/ui/FileSelector/index.js +46 -46
- package/dist/components/ui/FileSelector/index.js.map +1 -1
- package/dist/components/ui/FindSimilarCasesDialog/FindSimilarCasesDialog.d.ts +2 -2
- package/dist/components/ui/Grouping/index.js +50 -50
- package/dist/components/ui/Grouping/index.js.map +1 -1
- package/dist/components/ui/HistogramWidget/index.js +1 -1
- package/dist/components/ui/HistogramWidget/index.js.map +1 -1
- package/dist/components/ui/MapWidget/index.js +7 -3
- package/dist/components/ui/MapWidget/index.js.map +1 -1
- package/dist/components/ui/RemoveCasesFromEventDialog/RemoveCasesFromEventDialog.d.ts +2 -2
- package/dist/components/ui/RemoveCasesFromEventDialog/index.js +6 -6
- package/dist/components/ui/RemoveCasesFromEventDialog/index.js.map +1 -1
- package/dist/components/ui/RemoveFindSimilarCasesResultDialog/RemoveFindSimilarCasesResultDialog.d.ts +2 -2
- package/dist/components/ui/SequenceDownloadDialog/SequenceDownloadDialog.d.ts +2 -2
- package/dist/components/ui/SequenceDownloadDialog/index.js +22 -22
- package/dist/components/ui/SequenceDownloadDialog/index.js.map +1 -1
- package/dist/components/ui/TreeDescription/index.js.map +1 -1
- package/dist/components/ui/TreeWidget/index.js +11 -11
- package/dist/components/ui/TreeWidget/index.js.map +1 -1
- package/dist/components/ui/Upload/UploadCaseResultTable.d.ts +2 -2
- package/dist/components/ui/Upload/UploadEditColumnValuesDialog.d.ts +2 -2
- package/dist/components/ui/UserRightsDialog/UserRightsDialog.d.ts +2 -2
- package/dist/components/ui/UsersEffectiveRightsDetailsDialog/UsersEffectiveRightsDetailsDialog.d.ts +2 -2
- package/dist/components/ui/UsersEffectiveRightsDetailsDialog/index.js +25 -11
- package/dist/components/ui/UsersEffectiveRightsDetailsDialog/index.js.map +1 -1
- package/dist/components/ui/Warning/index.js.map +1 -1
- package/dist/components/ui/WidgetHeaderIconButton/index.js.map +1 -1
- package/dist/components/ui/WidgetMenu/WidgetMenu.d.ts +1 -1
- package/dist/components/ui/WidgetMenu/index.js +2 -2
- package/dist/components/ui/WidgetMenu/index.js.map +1 -1
- package/dist/components/ui/WidgetUnavailable/index.js.map +1 -1
- package/dist/constants/query.d.ts +1 -1
- package/dist/constants/query.js +1 -1
- package/dist/constants/query.js.map +1 -1
- package/dist/context/caseAbac/CaseAbacContext.d.ts +1 -1
- package/dist/dataHooks/useAssemblyProtocolsQuery/index.js +3 -3
- package/dist/dataHooks/useAssemblyProtocolsQuery/index.js.map +1 -1
- package/dist/dataHooks/useAssemblyProtocolsQuery/useAssemblyProtocolsQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseRightsQuery/index.js +2 -2
- package/dist/dataHooks/useCaseRightsQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseSetCategoriesQuery/index.js +3 -3
- package/dist/dataHooks/useCaseSetCategoriesQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseSetCategoriesQuery/useCaseSetCategoriesQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseSetRightsQuery/index.js +2 -2
- package/dist/dataHooks/useCaseSetRightsQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseSetStatsQuery/index.js +3 -3
- package/dist/dataHooks/useCaseSetStatsQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseSetStatsQuery/useCaseSetStatsQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseSetStatusesQuery/index.js +3 -3
- package/dist/dataHooks/useCaseSetStatusesQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseSetStatusesQuery/useCaseSetStatusesQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseSetsQuery/index.js +3 -3
- package/dist/dataHooks/useCaseSetsQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseSetsQuery/useCaseSetsQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseTypeSetCategoriesQuery/index.js +3 -3
- package/dist/dataHooks/useCaseTypeSetCategoriesQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseTypeSetCategoriesQuery/useCaseTypeSetCategoriesQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseTypeSetCategoryPurposeQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseTypeSetCategoryPurposeQuery/useCaseTypeSetCategoryPurposeQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseTypeSetMembersQuery/index.js +2 -2
- package/dist/dataHooks/useCaseTypeSetMembersQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseTypeSetsQuery/index.js +3 -3
- package/dist/dataHooks/useCaseTypeSetsQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseTypeSetsQuery/useCaseTypeSetsQuery.d.ts +1 -1
- package/dist/dataHooks/useCaseTypeStatsQuery/index.js +2 -2
- package/dist/dataHooks/useCaseTypeStatsQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseTypesQuery/index.js +3 -3
- package/dist/dataHooks/useCaseTypesQuery/index.js.map +1 -1
- package/dist/dataHooks/useCaseTypesQuery/useCaseTypesQuery.d.ts +1 -1
- package/dist/dataHooks/useColSetMembersQuery/index.js +2 -2
- package/dist/dataHooks/useColSetMembersQuery/index.js.map +1 -1
- package/dist/dataHooks/useColSetsQuery/index.js +3 -3
- package/dist/dataHooks/useColSetsQuery/index.js.map +1 -1
- package/dist/dataHooks/useColSetsQuery/useColSetsQuery.d.ts +1 -1
- package/dist/dataHooks/useColTypesQuery/index.js.map +1 -1
- package/dist/dataHooks/useColTypesQuery/useColTypesQuery.d.ts +1 -1
- package/dist/dataHooks/useColsQuery/index.js +3 -3
- package/dist/dataHooks/useColsQuery/index.js.map +1 -1
- package/dist/dataHooks/useColsQuery/useColsQuery.d.ts +1 -1
- package/dist/dataHooks/useConceptQuery/index.js +3 -3
- package/dist/dataHooks/useConceptQuery/index.js.map +1 -1
- package/dist/dataHooks/useConceptQuery/useConceptQuery.d.ts +1 -1
- package/dist/dataHooks/useConceptRelationTypeQuery/index.js.map +1 -1
- package/dist/dataHooks/useConceptRelationTypeQuery/useConceptRelationTypeQuery.d.ts +1 -1
- package/dist/dataHooks/useConceptSetTypeQuery/index.js.map +1 -1
- package/dist/dataHooks/useConceptSetTypeQuery/useConceptSetTypeQuery.d.ts +1 -1
- package/dist/dataHooks/useConceptSetsQuery/index.js +3 -3
- package/dist/dataHooks/useConceptSetsQuery/index.js.map +1 -1
- package/dist/dataHooks/useConceptSetsQuery/useConceptSetsQuery.d.ts +1 -1
- package/dist/dataHooks/useDataCollectionSetMembersQuery/index.js +2 -2
- package/dist/dataHooks/useDataCollectionSetMembersQuery/index.js.map +1 -1
- package/dist/dataHooks/useDataCollectionsQuery/index.js +3 -3
- package/dist/dataHooks/useDataCollectionsQuery/index.js.map +1 -1
- package/dist/dataHooks/useDataCollectionsQuery/useDataCollectionsQuery.d.ts +1 -1
- package/dist/dataHooks/useDimTypesQuery/index.js.map +1 -1
- package/dist/dataHooks/useDimTypesQuery/useDimTypesQuery.d.ts +1 -1
- package/dist/dataHooks/useDimsQuery/index.js +3 -3
- package/dist/dataHooks/useDimsQuery/index.js.map +1 -1
- package/dist/dataHooks/useDimsQuery/useDimsQuery.d.ts +1 -1
- package/dist/dataHooks/useDiseasesQuery/index.js +3 -3
- package/dist/dataHooks/useDiseasesQuery/index.js.map +1 -1
- package/dist/dataHooks/useDiseasesQuery/useDiseasesQuery.d.ts +1 -1
- package/dist/dataHooks/useEtiologicalAgentsQuery/index.js +3 -3
- package/dist/dataHooks/useEtiologicalAgentsQuery/index.js.map +1 -1
- package/dist/dataHooks/useEtiologicalAgentsQuery/useEtiologicalAgentsQuery.d.ts +1 -1
- package/dist/dataHooks/useGeneticDistanceProtocolsQuery/index.js +3 -3
- package/dist/dataHooks/useGeneticDistanceProtocolsQuery/index.js.map +1 -1
- package/dist/dataHooks/useGeneticDistanceProtocolsQuery/useGeneticDistanceProtocolsQuery.d.ts +1 -1
- package/dist/dataHooks/useOrganizationAccessCasePoliciesQuery/index.js +2 -2
- package/dist/dataHooks/useOrganizationAccessCasePoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationShareCasePoliciesQuery/index.js +2 -2
- package/dist/dataHooks/useOrganizationShareCasePoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useRefColsQuery/index.js +3 -3
- package/dist/dataHooks/useRefColsQuery/index.js.map +1 -1
- package/dist/dataHooks/useRefColsQuery/useRefColsQuery.d.ts +1 -1
- package/dist/dataHooks/useRefColsValidationRulesQuery/index.js +2 -2
- package/dist/dataHooks/useRefColsValidationRulesQuery/index.js.map +1 -1
- package/dist/dataHooks/useRefDimsQuery/index.js +3 -3
- package/dist/dataHooks/useRefDimsQuery/index.js.map +1 -1
- package/dist/dataHooks/useRefDimsQuery/useRefDimsQuery.d.ts +1 -1
- package/dist/dataHooks/useRegionQuery/index.js +3 -3
- package/dist/dataHooks/useRegionQuery/index.js.map +1 -1
- package/dist/dataHooks/useRegionQuery/useRegionQuery.d.ts +1 -1
- package/dist/dataHooks/useRegionRelationTypeQuery/index.js.map +1 -1
- package/dist/dataHooks/useRegionRelationTypeQuery/useRegionRelationTypeQuery.d.ts +1 -1
- package/dist/dataHooks/useRegionSetsQuery/index.js +3 -3
- package/dist/dataHooks/useRegionSetsQuery/index.js.map +1 -1
- package/dist/dataHooks/useRegionSetsQuery/useRegionSetsQuery.d.ts +1 -1
- package/dist/dataHooks/useSequencingProtocolsQuery/index.js +3 -3
- package/dist/dataHooks/useSequencingProtocolsQuery/index.js.map +1 -1
- package/dist/dataHooks/useSequencingProtocolsQuery/useSequencingProtocolsQuery.d.ts +1 -1
- package/dist/dataHooks/useTreeAlgorithmCodesQuery/index.js.map +1 -1
- package/dist/dataHooks/useTreeAlgorithmCodesQuery/useTreeAlgorithmCodesQuery.d.ts +1 -1
- package/dist/dataHooks/useUnitQuery/useUnit.d.ts +1 -1
- package/dist/dataHooks/useUserAccessCasePoliciesQuery/index.js +2 -2
- package/dist/dataHooks/useUserAccessCasePoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useUserEffectiveRightsQuery/index.js +3 -3
- package/dist/dataHooks/useUserEffectiveRightsQuery/index.js.map +1 -1
- package/dist/dataHooks/useUserEffectiveRightsQuery/useUserEffectiveRightsQuery.d.ts +1 -1
- package/dist/dataHooks/useUserShareCasePoliciesQuery/index.js +2 -2
- package/dist/dataHooks/useUserShareCasePoliciesQuery/index.js.map +1 -1
- package/dist/hooks/useOrganizationCasePolicyNameFactory/index.js +2 -2
- package/dist/hooks/useOrganizationCasePolicyNameFactory/index.js.map +1 -1
- package/dist/hooks/useOrganizationCasePolicyNameFactory/useOrganizationCasePolicyNameFactory.d.ts +1 -1
- package/dist/hooks/useUserCasePolicyNameFactory/index.js +3 -3
- package/dist/hooks/useUserCasePolicyNameFactory/index.js.map +1 -1
- package/dist/hooks/useUserCasePolicyNameFactory/useUserCasePolicyNameFactory.d.ts +1 -1
- package/dist/locale/nl.json +1 -1
- package/dist/models/config.d.ts +1 -1
- package/dist/models/dashboard.d.ts +1 -1
- package/dist/models/dashboard.js.map +1 -1
- package/dist/models/theme.d.ts +2 -2
- package/dist/pages/CaseDbUsersAdminPage/index.js +5 -5
- package/dist/pages/CaseDbUsersAdminPage/index.js.map +1 -1
- package/dist/pages/CaseSetCategoryAdminPage/index.js +4 -4
- package/dist/pages/CaseSetCategoryAdminPage/index.js.map +1 -1
- package/dist/pages/CaseSetStatusAdminPage/index.js +4 -4
- package/dist/pages/CaseSetStatusAdminPage/index.js.map +1 -1
- package/dist/pages/CaseTypeSetCategoriesAdminPage/index.js +4 -4
- package/dist/pages/CaseTypeSetCategoriesAdminPage/index.js.map +1 -1
- package/dist/pages/CaseTypeSetsAdminPage/index.js +6 -6
- package/dist/pages/CaseTypeSetsAdminPage/index.js.map +1 -1
- package/dist/pages/CaseTypesAdminPage/index.js +5 -5
- package/dist/pages/CaseTypesAdminPage/index.js.map +1 -1
- package/dist/pages/CasesDetailPage/index.js +5 -5
- package/dist/pages/CasesDetailPage/index.js.map +1 -1
- package/dist/pages/CasesPage/index.js +10 -10
- package/dist/pages/CasesPage/index.js.map +1 -1
- package/dist/pages/ColSetsAdminPage/index.js +6 -6
- package/dist/pages/ColSetsAdminPage/index.js.map +1 -1
- package/dist/pages/ColsAdminPage/index.js +5 -5
- package/dist/pages/ColsAdminPage/index.js.map +1 -1
- package/dist/pages/ConceptRelationsAdminPage/index.js +19 -19
- package/dist/pages/ConceptRelationsAdminPage/index.js.map +1 -1
- package/dist/pages/ConceptSetsAdminPage/index.js +5 -5
- package/dist/pages/ConceptSetsAdminPage/index.js.map +1 -1
- package/dist/pages/ConceptsAdminPage/index.js +5 -5
- package/dist/pages/ConceptsAdminPage/index.js.map +1 -1
- package/dist/pages/DataCollectionSetsAdminPage/index.js +12 -12
- package/dist/pages/DataCollectionSetsAdminPage/index.js.map +1 -1
- package/dist/pages/DataCollectionVisualizationPage/index.js +4 -4
- package/dist/pages/DataCollectionVisualizationPage/index.js.map +1 -1
- package/dist/pages/DataCollectionsAdminPage/index.js +4 -4
- package/dist/pages/DataCollectionsAdminPage/index.js.map +1 -1
- package/dist/pages/DimsAdminPage/index.js +6 -6
- package/dist/pages/DimsAdminPage/index.js.map +1 -1
- package/dist/pages/DiseasesAdminPage/index.js +4 -4
- package/dist/pages/DiseasesAdminPage/index.js.map +1 -1
- package/dist/pages/EtiologicalAgentsAdminPage/index.js +4 -4
- package/dist/pages/EtiologicalAgentsAdminPage/index.js.map +1 -1
- package/dist/pages/EtiologiesAdminPage/index.js +3 -3
- package/dist/pages/EtiologiesAdminPage/index.js.map +1 -1
- package/dist/pages/EventsDetailPage/index.js +5 -5
- package/dist/pages/EventsDetailPage/index.js.map +1 -1
- package/dist/pages/EventsPage/index.js +11 -11
- package/dist/pages/EventsPage/index.js.map +1 -1
- package/dist/pages/HomePage/index.js +2 -2
- package/dist/pages/HomePage/index.js.map +1 -1
- package/dist/pages/OrganizationAccessCasePoliciesAdminPage/index.js +4 -4
- package/dist/pages/OrganizationAccessCasePoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationShareCasePoliciesAdminPage/index.js +4 -4
- package/dist/pages/OrganizationShareCasePoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/RefColsAdminPage/index.js +7 -7
- package/dist/pages/RefColsAdminPage/index.js.map +1 -1
- package/dist/pages/RefDimsAdminPage/index.js +5 -5
- package/dist/pages/RefDimsAdminPage/index.js.map +1 -1
- package/dist/pages/RegionRelationsAdminPage/index.js +3 -3
- package/dist/pages/RegionRelationsAdminPage/index.js.map +1 -1
- package/dist/pages/RegionSetShapesAdminPage/index.js +4 -4
- package/dist/pages/RegionSetShapesAdminPage/index.js.map +1 -1
- package/dist/pages/RegionSetsAdminPage/index.js +5 -5
- package/dist/pages/RegionSetsAdminPage/index.js.map +1 -1
- package/dist/pages/RegionsAdminPage/index.js +5 -5
- package/dist/pages/RegionsAdminPage/index.js.map +1 -1
- package/dist/pages/TrendsPage/index.js +1 -1
- package/dist/pages/TrendsPage/index.js.map +1 -1
- package/dist/pages/UploadPage/index.js +1 -1
- package/dist/pages/UploadPage/index.js.map +1 -1
- package/dist/pages/UserAccessCasePoliciesAdminPage/index.js +4 -4
- package/dist/pages/UserAccessCasePoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/UserEffectiveRightsAdminPage/index.js +12 -12
- package/dist/pages/UserEffectiveRightsAdminPage/index.js.map +1 -1
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js +8 -8
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js.map +1 -1
- package/dist/pages/UserShareCasePoliciesAdminPage/index.js +4 -4
- package/dist/pages/UserShareCasePoliciesAdminPage/index.js.map +1 -1
- package/dist/routes/adminRoutes.d.ts +1 -1
- package/dist/routes/index.js +11 -8
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/routes.d.ts +1 -1
- package/dist/setup/setup.js +5 -5
- package/dist/setup/setup.js.map +1 -1
- package/dist/stores/dashboardStore/dashboardStore.d.ts +1 -1
- package/dist/stores/uploadStore/index.js +2 -2
- package/dist/stores/uploadStore/index.js.map +1 -1
- package/dist/stores/uploadStore/uploadStore.d.ts +1 -1
- package/dist/stores/userProfileStore/index.js +2 -2
- package/dist/stores/userProfileStore/index.js.map +1 -1
- package/dist/theme/demoTheme/index.js +2 -2
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/CaseDbDataUtil/CaseDbDataUtil.d.ts +1 -1
- package/dist/utils/CaseDbDataUtil/index.js +1 -1
- package/dist/utils/CaseDbDataUtil/index.js.map +1 -1
- package/dist/utils/CaseDbStandardConfigUtil/index.js +2488 -1408
- package/dist/utils/CaseDbStandardConfigUtil/index.js.map +1 -1
- package/dist/utils/CaseDbTableUtil/CaseDbTableUtil.d.ts +1 -1
- package/dist/utils/CaseDbTableUtil/index.js +1 -1
- package/dist/utils/CaseDbTableUtil/index.js.map +1 -1
- package/dist/utils/CaseSelectionUtil/index.js.map +1 -1
- package/dist/utils/CaseTypeFormUtil/CaseTypeFormUtil.d.ts +1 -1
- package/dist/utils/CaseTypeFormUtil/index.js +7 -10
- package/dist/utils/CaseTypeFormUtil/index.js.map +1 -1
- package/dist/utils/CaseTypeUtil/index.js +1 -1
- package/dist/utils/CaseTypeUtil/index.js.map +1 -1
- package/dist/utils/CaseUtil/index.js +3 -3
- package/dist/utils/CaseUtil/index.js.map +1 -1
- package/dist/utils/DashboardUtil/index.js +1 -1
- package/dist/utils/DashboardUtil/index.js.map +1 -1
- package/dist/utils/DataSetUtil/index.js.map +1 -1
- package/dist/utils/FileUtil/index.js +1 -1
- package/dist/utils/FileUtil/index.js.map +1 -1
- package/dist/utils/FilterUtil/FilterUtil.d.ts +2 -2
- package/dist/utils/HistogramUtil/index.js +1 -1
- package/dist/utils/HistogramUtil/index.js.map +1 -1
- package/dist/utils/MapUtil/index.js +1 -1
- package/dist/utils/MapUtil/index.js.map +1 -1
- package/dist/utils/StratificationUtil/index.js +3 -2
- package/dist/utils/StratificationUtil/index.js.map +1 -1
- package/dist/utils/UploadUtil/UploadUtil.d.ts +1 -1
- package/package.json +11 -11
- package/dist/_chunks/chunk-KS7C4IRE.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/utils/HistogramUtil/HistogramUtil.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\nimport type { CallbackDataParams } from 'echarts/types/dist/shared';\nimport type {\n CaseDbCase,\n CaseDbCol,\n CaseDbCompleteCaseType,\n CaseDbConcept,\n} from '@gen-epix/api-casedb';\nimport { CaseDbColType } from '@gen-epix/api-casedb';\nimport type { Theme } from '@mui/material';\nimport { ConfigService } from '@gen-epix/ui/classes/services/ConfigService';\n\nimport { DataService } from '../../classes/services/DataService';\nimport type { CaseDbConfig } from '../../models/config';\nimport { CaseUtil } from '../CaseUtil';\nimport { StratificationUtil } from '../StratificationUtil';\nimport { STRATIFICATION_MODE } from '../../models/stratification';\nimport { CaseDbDataUtil } from '../CaseDbDataUtil';\n\nexport type GetChartOptionsParams = {\n aCol: CaseDbCol;\n bCol: CaseDbCol;\n colors: string[];\n conceptsA: CaseDbConcept[];\n conceptsB: CaseDbConcept[];\n series: SeriesItem[];\n t: (key: string, options?: Record<string, unknown>) => string;\n theme: Theme;\n};\n\nexport type SeriesItem = {\n data: (number | string)[];\n emphasis: {\n focus: 'self';\n };\n name: string;\n type: 'bar';\n xCaseIds: string[][];\n};\n\n// Note the typings are not exposed by echarts, so we need to define our own type here\nexport type TooltipCallbackDataParams = {\n axisDim?: string;\n axisId?: string;\n axisIndex?: number;\n axisType?: string;\n axisValue?: number | string;\n axisValueLabel?: string;\n marker?: string;\n} & CallbackDataParams;\n\nexport const HISTOGRAM_ALLOWED_COL_TYPES: CaseDbColType[] = [\n CaseDbColType.INTERVAL,\n CaseDbColType.NOMINAL,\n CaseDbColType.ORDINAL,\n];\n\nexport class HistogramUtil {\n /**\n * Returns columns of the allowed col types for the histogram,\n * excluding cols whose concept count exceeds MAX_ALLOWED_UNIQUE_VALUES.\n */\n public static getAllowedCols(\n completeCaseType: CaseDbCompleteCaseType,\n allowedColTypes: CaseDbColType[],\n ): CaseDbCol[] {\n if (!completeCaseType) {\n return [];\n }\n const { MAX_ALLOWED_UNIQUE_VALUES } =\n ConfigService.getInstance<CaseDbConfig>().config.epi.STRATIFICATION;\n return completeCaseType.ordered_col_ids.reduce<CaseDbCol[]>((acc, colId) => {\n const col = completeCaseType.cols[colId];\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n if (!allowedColTypes.includes(refCol.col_type)) {\n return acc;\n }\n const concepts = HistogramUtil.getConceptsForCol(col, completeCaseType);\n if (concepts.length <= MAX_ALLOWED_UNIQUE_VALUES) {\n acc.push(col);\n }\n return acc;\n }, []);\n }\n\n /**\n * Returns the total case count represented in the series\n */\n public static getCaseCount(series: SeriesItem[]): number {\n if (!series?.length) {\n return 0;\n }\n return series.reduce((total, item) => {\n return (\n total +\n (item.data as number[]).reduce((subTotal, value) => {\n if (typeof value === 'number') {\n return subTotal + value;\n }\n return subTotal;\n }, 0)\n );\n }, 0);\n }\n\n /**\n * Builds the ECharts options object for the histogram\n */\n public static getChartOptions({\n aCol,\n bCol,\n colors,\n conceptsA,\n conceptsB,\n series,\n t,\n theme,\n }: GetChartOptionsParams): EChartsOption {\n return {\n color: colors,\n grid: {\n bottom: theme.spacing(8),\n left: theme.spacing(25),\n right: theme.spacing(1),\n top: theme.spacing(6),\n },\n legend: {\n align: 'left',\n data: conceptsA.map(concept => concept.name),\n left: 'left',\n orient: 'vertical',\n pageIconColor: theme.palette.primary.main,\n pageIconInactiveColor: theme.palette.text.disabled,\n selectedMode: false,\n top: theme.spacing(4),\n type: 'scroll',\n },\n series,\n title: {\n left: 'left',\n text: aCol.label,\n textStyle: {\n fontSize: theme.typography.caption.fontSize,\n fontWeight: 'bold',\n },\n top: theme.spacing(1),\n },\n tooltip: {\n formatter: (item) => {\n const castedItem = item as TooltipCallbackDataParams;\n const axisValue = castedItem.name;\n const result = `${axisValue} (${bCol.label})\\n${castedItem.seriesName}: ${castedItem.value as number} (${aCol.label})`;\n return result;\n },\n renderMode: 'richText',\n show: true,\n trigger: 'item',\n valueFormatter: (value: unknown) => {\n return t('{{numCases}} case(s)', { numCases: value });\n },\n },\n xAxis: [\n {\n axisLabel: {\n height: 100,\n rotate: 45,\n },\n axisPointer: {\n type: 'shadow',\n },\n axisTick: {\n alignWithLabel: true,\n show: true,\n },\n data: conceptsB.map(concept => concept.name),\n name: bCol?.label,\n nameTextStyle: {\n fontSize: theme.typography.caption.fontSize,\n fontWeight: 'bold',\n },\n type: 'category',\n },\n ],\n yAxis: [\n {\n minInterval: 1,\n type: 'value',\n },\n ],\n } satisfies EChartsOption;\n }\n\n /**\n * Returns the colors for the series based on stratification\n */\n public static getColors(\n aCol: CaseDbCol | null,\n completeCaseType: CaseDbCompleteCaseType | null,\n sortedData: CaseDbCase[],\n ): string[] {\n const stratification = StratificationUtil.getStratification({\n col: aCol,\n completeCaseType,\n mode: STRATIFICATION_MODE.FIELD,\n sortedData,\n });\n return stratification?.legendaItems.map(l => l.color) ?? [];\n }\n\n public static getColValuesFromPayload = (payload: unknown, conceptsA: CaseDbConcept[], conceptsB: CaseDbConcept[]): { a: string; b: string } | null => {\n const { name, seriesName } = payload as { name: string; seriesName: string };\n const aConcept = conceptsA.find(concept => concept.name === seriesName);\n const bConcept = conceptsB.find(concept => concept.name === name);\n if (!aConcept || !bConcept) {\n return null;\n }\n return { a: aConcept.id, b: bConcept.id };\n };\n\n /**\n * Returns the sorted concepts for colA and colB.\n */\n public static getConcepts(\n aCol: CaseDbCol | null,\n bCol: CaseDbCol | null,\n completeCaseType: CaseDbCompleteCaseType | null,\n ): [CaseDbConcept[], CaseDbConcept[]] {\n if (!aCol || !bCol || !completeCaseType) {\n return [[], []];\n }\n return [\n HistogramUtil.getConceptsForCol(aCol, completeCaseType),\n HistogramUtil.getConceptsForCol(bCol, completeCaseType),\n ];\n }\n\n /**\n * Returns the sorted concepts for a single col.\n */\n public static getConceptsForCol(\n col: CaseDbCol,\n completeCaseType: CaseDbCompleteCaseType,\n ): CaseDbConcept[] {\n const refCol = completeCaseType.ref_cols[col.ref_col_id ?? ''];\n const conceptIds =\n DataService.getInstance().data.conceptsIdsBySetId[refCol.concept_set_id];\n return (\n conceptIds\n ?.map(conceptId => DataService.getInstance().data.conceptsById[conceptId])\n .sort(CaseDbDataUtil.conceptComparator) ?? []\n );\n }\n\n /**\n * Returns the default aCol and bCol to use when none are selected yet.\n * Picks the first col from the second dimension as aCol, and the last col\n * from the first dimension as bCol. Returns null when there are insufficient\n * dimensions or columns.\n */\n public static getDefaultCols(\n allowedCols: CaseDbCol[],\n completeCaseType: CaseDbCompleteCaseType,\n ): { newColA: CaseDbCol; newColB: CaseDbCol } | null {\n const colsPerDimId = allowedCols.reduce<{ [dimId: string]: CaseDbCol[] }>((acc, col) => {\n if (!acc[col.dim_id]) {\n acc[col.dim_id] = [];\n }\n acc[col.dim_id].push(col);\n return acc;\n }, {});\n\n const orderedDimIdsWithCols =\n completeCaseType?.ordered_dim_ids.filter(dimId => colsPerDimId[dimId]?.length > 0) ?? [];\n const firstDimensionCols = colsPerDimId[orderedDimIdsWithCols[0]] ?? [];\n const secondDimensionCols = colsPerDimId[orderedDimIdsWithCols[1]] ?? [];\n\n if (!firstDimensionCols.length || !secondDimensionCols.length) {\n return null;\n }\n\n const newColA = secondDimensionCols.at(0);\n const newColB = firstDimensionCols.at(-1);\n\n return { newColA, newColB };\n }\n\n /**\n * Builds the bar-chart series items from the sorted case data\n */\n public static getSeries(\n aCol: CaseDbCol | null,\n bCol: CaseDbCol | null,\n completeCaseType: CaseDbCompleteCaseType | null,\n sortedData: CaseDbCase[],\n conceptsA: CaseDbConcept[],\n conceptsB: CaseDbConcept[],\n ): SeriesItem[] {\n if (!aCol || !bCol || !completeCaseType) {\n return [];\n }\n\n const countMap = new Map<string, Map<string, number>>();\n const caseIdsMap = new Map<string, Map<string, string[]>>();\n\n sortedData.forEach(caseDbCase => {\n const aValue = CaseUtil.getRowValue(caseDbCase.content, aCol, completeCaseType);\n const bValue = CaseUtil.getRowValue(caseDbCase.content, bCol, completeCaseType);\n\n if (aValue.isMissing || bValue.isMissing) {\n return;\n }\n\n const aKey = aValue.raw;\n const bKey = bValue.raw;\n\n if (!countMap.has(aKey)) {\n countMap.set(aKey, new Map<string, number>());\n }\n const aMap = countMap.get(aKey);\n aMap.set(bKey, (aMap.get(bKey) ?? 0) + (caseDbCase.count ?? 1));\n\n if (!caseIdsMap.has(aKey)) {\n caseIdsMap.set(aKey, new Map<string, string[]>());\n }\n const aCaseIdsMap = caseIdsMap.get(aKey);\n aCaseIdsMap.set(bKey, [...(aCaseIdsMap.get(bKey) ?? []), caseDbCase.id]);\n });\n\n return conceptsA.map(aConcept => {\n const aCounts = countMap.get(aConcept.id) ?? new Map<string, number>();\n const aCaseIds = caseIdsMap.get(aConcept.id) ?? new Map<string, string[]>();\n return {\n data: conceptsB.map(bConcept => aCounts.get(bConcept.id) ?? 0),\n emphasis: {\n focus: 'self',\n },\n name: aConcept.name,\n type: 'bar',\n xCaseIds: conceptsB.map(bConcept => aCaseIds.get(bConcept.id) ?? []),\n };\n });\n }\n}\n"],"mappings":";;;;;;;;AAmDA,IAAa,IAA+C;CAC1D,EAAc;CACd,EAAc;CACd,EAAc;AAChB,GAEa,IAAb,MAAa,EAAc;CAKzB,OAAc,eACZ,GACA,GACa;EACb,IAAI,CAAC,GACH,OAAO,CAAC;EAEV,IAAM,EAAE,iCACN,EAAc,YAA0B,CAAC,CAAC,OAAO,IAAI;EACvD,OAAO,EAAiB,gBAAgB,QAAqB,GAAK,MAAU;GAC1E,IAAM,IAAM,EAAiB,KAAK,IAC5B,IAAS,EAAiB,SAAS,EAAI;GAQ7C,OAPK,EAAgB,SAAS,EAAO,QAAQ,KAG5B,EAAc,kBAAkB,GAAK,CAClD,CAAA,CAAS,UAAU,KACrB,EAAI,KAAK,CAAG,GAJL;EAOX,GAAG,CAAC,CAAC;CACP;CAKA,OAAc,aAAa,GAA8B;EAIvD,OAHK,GAAQ,SAGN,EAAO,QAAQ,GAAO,MAEzB,IACC,EAAK,KAAkB,QAAQ,GAAU,MACpC,OAAO,KAAU,WACZ,IAAW,IAEb,GACN,CAAC,GAEL,CAAC,IAZK;CAaX;CAKA,OAAc,gBAAgB,EAC5B,SACA,SACA,WACA,cACA,cACA,WACA,MACA,YACuC;EACvC,OAAO;GACL,OAAO;GACP,MAAM;IACJ,QAAQ,EAAM,QAAQ,CAAC;IACvB,MAAM,EAAM,QAAQ,EAAE;IACtB,OAAO,EAAM,QAAQ,CAAC;IACtB,KAAK,EAAM,QAAQ,CAAC;GACtB;GACA,QAAQ;IACN,OAAO;IACP,MAAM,EAAU,KAAI,MAAW,EAAQ,IAAI;IAC3C,MAAM;IACN,QAAQ;IACR,eAAe,EAAM,QAAQ,QAAQ;IACrC,uBAAuB,EAAM,QAAQ,KAAK;IAC1C,cAAc;IACd,KAAK,E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O,EAAO,KACd,IAAO,EAAO;GAEpB,AAAK,EAAS,IAAI,CAAI,KACpB,EAAS,IAAI,mBAAM,IAAI,IAAoB,CAAC;GAE9C,IAAM,IAAO,EAAS,IAAI,CAAI;GAG9B,AAFA,EAAK,IAAI,IAAO,EAAK,IAAI,CAAI,KAAK,MAAM,EAAW,SAAS,EAAE,GAEzD,EAAW,IAAI,CAAI,KACtB,EAAW,IAAI,mBAAM,IAAI,IAAsB,CAAC;GAElD,IAAM,IAAc,EAAW,IAAI,CAAI;GACvC,EAAY,IAAI,GAAM,CAAC,GAAI,EAAY,IAAI,CAAI,KAAK,CAAC,GAAI,EAAW,EAAE,CAAC;EACzE,CAAC,GAEM,EAAU,KAAI,MAAY;GAC/B,IAAM,IAAU,EAAS,IAAI,EAAS,EAAE,qBAAK,IAAI,IAAoB,GAC/D,IAAW,EAAW,IAAI,EAAS,EAAE,qBAAK,IAAI,IAAsB;GAC1E,OAAO;IACL,MAAM,EAAU,KAAI,MAAY,EAAQ,IAAI,EAAS,EAAE,KAAK,CAAC;IAC7D,UAAU,EACR,OAAO,OACT;IACA,MAAM,EAAS;IACf,MAAM;IACN,UAAU,EAAU,KAAI,MAAY,EAAS,IAAI,EAAS,EAAE,KAAK,CAAC,CAAC;GACrE;EACF,CAAC;CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/utils/HistogramUtil/HistogramUtil.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\nimport type { CallbackDataParams } from 'echarts/types/dist/shared';\nimport type {\n CaseDbCase,\n CaseDbCol,\n CaseDbCompleteCaseType,\n CaseDbConcept,\n} from '@gen-epix/api-casedb';\nimport { CaseDbColType } from '@gen-epix/api-casedb';\nimport type { Theme } from '@mui/material';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\n\nimport { DataService } from '../../classes/services/DataService';\nimport type { CaseDbConfig } from '../../models/config';\nimport { CaseUtil } from '../CaseUtil';\nimport { StratificationUtil } from '../StratificationUtil';\nimport { STRATIFICATION_MODE } from '../../models/stratification';\nimport { CaseDbDataUtil } from '../CaseDbDataUtil';\n\nexport type GetChartOptionsParams = {\n aCol: CaseDbCol;\n bCol: CaseDbCol;\n colors: string[];\n conceptsA: CaseDbConcept[];\n conceptsB: CaseDbConcept[];\n series: SeriesItem[];\n t: (key: string, options?: Record<string, unknown>) => string;\n theme: Theme;\n};\n\nexport type SeriesItem = {\n data: (number | string)[];\n emphasis: {\n focus: 'self';\n };\n name: string;\n type: 'bar';\n xCaseIds: string[][];\n};\n\n// Note the typings are not exposed by echarts, so we need to define our own type here\nexport type TooltipCallbackDataParams = {\n axisDim?: string;\n axisId?: string;\n axisIndex?: number;\n axisType?: string;\n axisValue?: number | string;\n axisValueLabel?: string;\n marker?: string;\n} & CallbackDataParams;\n\nexport const HISTOGRAM_ALLOWED_COL_TYPES: CaseDbColType[] = [\n CaseDbColType.INTERVAL,\n CaseDbColType.NOMINAL,\n CaseDbColType.ORDINAL,\n];\n\nexport class HistogramUtil {\n /**\n * Returns columns of the allowed col types for the histogram,\n * excluding cols whose concept count exceeds MAX_ALLOWED_UNIQUE_VALUES.\n */\n public static getAllowedCols(\n completeCaseType: CaseDbCompleteCaseType,\n allowedColTypes: CaseDbColType[],\n ): CaseDbCol[] {\n if (!completeCaseType) {\n return [];\n }\n const { MAX_ALLOWED_UNIQUE_VALUES } =\n ConfigService.getInstance<CaseDbConfig>().config.epi.STRATIFICATION;\n return completeCaseType.ordered_col_ids.reduce<CaseDbCol[]>((acc, colId) => {\n const col = completeCaseType.cols[colId];\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n if (!allowedColTypes.includes(refCol.col_type)) {\n return acc;\n }\n const concepts = HistogramUtil.getConceptsForCol(col, completeCaseType);\n if (concepts.length <= MAX_ALLOWED_UNIQUE_VALUES) {\n acc.push(col);\n }\n return acc;\n }, []);\n }\n\n /**\n * Returns the total case count represented in the series\n */\n public static getCaseCount(series: SeriesItem[]): number {\n if (!series?.length) {\n return 0;\n }\n return series.reduce((total, item) => {\n return (\n total +\n (item.data as number[]).reduce((subTotal, value) => {\n if (typeof value === 'number') {\n return subTotal + value;\n }\n return subTotal;\n }, 0)\n );\n }, 0);\n }\n\n /**\n * Builds the ECharts options object for the histogram\n */\n public static getChartOptions({\n aCol,\n bCol,\n colors,\n conceptsA,\n conceptsB,\n series,\n t,\n theme,\n }: GetChartOptionsParams): EChartsOption {\n return {\n color: colors,\n grid: {\n bottom: theme.spacing(8),\n left: theme.spacing(25),\n right: theme.spacing(1),\n top: theme.spacing(6),\n },\n legend: {\n align: 'left',\n data: conceptsA.map(concept => concept.name),\n left: 'left',\n orient: 'vertical',\n pageIconColor: theme.palette.primary.main,\n pageIconInactiveColor: theme.palette.text.disabled,\n selectedMode: false,\n top: theme.spacing(4),\n type: 'scroll',\n },\n series,\n title: {\n left: 'left',\n text: aCol.label,\n textStyle: {\n fontSize: theme.typography.caption.fontSize,\n fontWeight: 'bold',\n },\n top: theme.spacing(1),\n },\n tooltip: {\n formatter: (item) => {\n const castedItem = item as TooltipCallbackDataParams;\n const axisValue = castedItem.name;\n const result = `${axisValue} (${bCol.label})\\n${castedItem.seriesName}: ${castedItem.value as number} (${aCol.label})`;\n return result;\n },\n renderMode: 'richText',\n show: true,\n trigger: 'item',\n valueFormatter: (value: unknown) => {\n return t('{{numCases}} case(s)', { numCases: value });\n },\n },\n xAxis: [\n {\n axisLabel: {\n height: 100,\n rotate: 45,\n },\n axisPointer: {\n type: 'shadow',\n },\n axisTick: {\n alignWithLabel: true,\n show: true,\n },\n data: conceptsB.map(concept => concept.name),\n name: bCol?.label,\n nameTextStyle: {\n fontSize: theme.typography.caption.fontSize,\n fontWeight: 'bold',\n },\n type: 'category',\n },\n ],\n yAxis: [\n {\n minInterval: 1,\n type: 'value',\n },\n ],\n } satisfies EChartsOption;\n }\n\n /**\n * Returns the colors for the series based on stratification\n */\n public static getColors(\n aCol: CaseDbCol | null,\n completeCaseType: CaseDbCompleteCaseType | null,\n sortedData: CaseDbCase[],\n ): string[] {\n const stratification = StratificationUtil.getStratification({\n col: aCol,\n completeCaseType,\n mode: STRATIFICATION_MODE.FIELD,\n sortedData,\n });\n return stratification?.legendaItems.map(l => l.color) ?? [];\n }\n\n public static getColValuesFromPayload = (payload: unknown, conceptsA: CaseDbConcept[], conceptsB: CaseDbConcept[]): { a: string; b: string } | null => {\n const { name, seriesName } = payload as { name: string; seriesName: string };\n const aConcept = conceptsA.find(concept => concept.name === seriesName);\n const bConcept = conceptsB.find(concept => concept.name === name);\n if (!aConcept || !bConcept) {\n return null;\n }\n return { a: aConcept.id, b: bConcept.id };\n };\n\n /**\n * Returns the sorted concepts for colA and colB.\n */\n public static getConcepts(\n aCol: CaseDbCol | null,\n bCol: CaseDbCol | null,\n completeCaseType: CaseDbCompleteCaseType | null,\n ): [CaseDbConcept[], CaseDbConcept[]] {\n if (!aCol || !bCol || !completeCaseType) {\n return [[], []];\n }\n return [\n HistogramUtil.getConceptsForCol(aCol, completeCaseType),\n HistogramUtil.getConceptsForCol(bCol, completeCaseType),\n ];\n }\n\n /**\n * Returns the sorted concepts for a single col.\n */\n public static getConceptsForCol(\n col: CaseDbCol,\n completeCaseType: CaseDbCompleteCaseType,\n ): CaseDbConcept[] {\n const refCol = completeCaseType.ref_cols[col.ref_col_id ?? ''];\n const conceptIds =\n DataService.getInstance().data.conceptsIdsBySetId[refCol.concept_set_id];\n return (\n conceptIds\n ?.map(conceptId => DataService.getInstance().data.conceptsById[conceptId])\n .sort(CaseDbDataUtil.conceptComparator) ?? []\n );\n }\n\n /**\n * Returns the default aCol and bCol to use when none are selected yet.\n * Picks the first col from the second dimension as aCol, and the last col\n * from the first dimension as bCol. Returns null when there are insufficient\n * dimensions or columns.\n */\n public static getDefaultCols(\n allowedCols: CaseDbCol[],\n completeCaseType: CaseDbCompleteCaseType,\n ): { newColA: CaseDbCol; newColB: CaseDbCol } | null {\n const colsPerDimId = allowedCols.reduce<{ [dimId: string]: CaseDbCol[] }>((acc, col) => {\n if (!acc[col.dim_id]) {\n acc[col.dim_id] = [];\n }\n acc[col.dim_id].push(col);\n return acc;\n }, {});\n\n const orderedDimIdsWithCols =\n completeCaseType?.ordered_dim_ids.filter(dimId => colsPerDimId[dimId]?.length > 0) ?? [];\n const firstDimensionCols = colsPerDimId[orderedDimIdsWithCols[0]] ?? [];\n const secondDimensionCols = colsPerDimId[orderedDimIdsWithCols[1]] ?? [];\n\n if (!firstDimensionCols.length || !secondDimensionCols.length) {\n return null;\n }\n\n const newColA = secondDimensionCols.at(0);\n const newColB = firstDimensionCols.at(-1);\n\n return { newColA, newColB };\n }\n\n /**\n * Builds the bar-chart series items from the sorted case data\n */\n public static getSeries(\n aCol: CaseDbCol | null,\n bCol: CaseDbCol | null,\n completeCaseType: CaseDbCompleteCaseType | null,\n sortedData: CaseDbCase[],\n conceptsA: CaseDbConcept[],\n conceptsB: CaseDbConcept[],\n ): SeriesItem[] {\n if (!aCol || !bCol || !completeCaseType) {\n return [];\n }\n\n const countMap = new Map<string, Map<string, number>>();\n const caseIdsMap = new Map<string, Map<string, string[]>>();\n\n sortedData.forEach(caseDbCase => {\n const aValue = CaseUtil.getRowValue(caseDbCase.content, aCol, completeCaseType);\n const bValue = CaseUtil.getRowValue(caseDbCase.content, bCol, completeCaseType);\n\n if (aValue.isMissing || bValue.isMissing) {\n return;\n }\n\n const aKey = aValue.raw;\n const bKey = bValue.raw;\n\n if (!countMap.has(aKey)) {\n countMap.set(aKey, new Map<string, number>());\n }\n const aMap = countMap.get(aKey);\n aMap.set(bKey, (aMap.get(bKey) ?? 0) + (caseDbCase.count ?? 1));\n\n if (!caseIdsMap.has(aKey)) {\n caseIdsMap.set(aKey, new Map<string, string[]>());\n }\n const aCaseIdsMap = caseIdsMap.get(aKey);\n aCaseIdsMap.set(bKey, [...(aCaseIdsMap.get(bKey) ?? []), caseDbCase.id]);\n });\n\n return conceptsA.map(aConcept => {\n const aCounts = countMap.get(aConcept.id) ?? new Map<string, number>();\n const aCaseIds = caseIdsMap.get(aConcept.id) ?? new Map<string, string[]>();\n return {\n data: conceptsB.map(bConcept => aCounts.get(bConcept.id) ?? 0),\n emphasis: {\n focus: 'self',\n },\n name: aConcept.name,\n type: 'bar',\n xCaseIds: conceptsB.map(bConcept => aCaseIds.get(bConcept.id) ?? []),\n };\n });\n }\n}\n"],"mappings":";;;;;;;;AAmDA,IAAa,IAA+C;CAC1D,EAAc;CACd,EAAc;CACd,EAAc;AAChB,GAEa,IAAb,MAAa,EAAc;CAKzB,OAAc,eACZ,GACA,GACa;EACb,IAAI,CAAC,GACH,OAAO,CAAC;EAEV,IAAM,EAAE,iCACN,EAAc,YAA0B,CAAC,CAAC,OAAO,IAAI;EACvD,OAAO,EAAiB,gBAAgB,QAAqB,GAAK,MAAU;GAC1E,IAAM,IAAM,EAAiB,KAAK,IAC5B,IAAS,EAAiB,SAAS,EAAI;GAQ7C,OAPK,EAAgB,SAAS,EAAO,QAAQ,KAG5B,EAAc,kBAAkB,GAAK,CAClD,CAAA,CAAS,UAAU,KACrB,EAAI,KAAK,CAAG,GAJL;EAOX,GAAG,CAAC,CAAC;CACP;CAKA,OAAc,aAAa,GAA8B;EAIvD,OAHK,GAAQ,SAGN,EAAO,QAAQ,GAAO,MAEzB,IACC,EAAK,KAAkB,QAAQ,GAAU,MACpC,OAAO,KAAU,WACZ,IAAW,IAEb,GACN,CAAC,GAEL,CAAC,IAZK;CAaX;CAKA,OAAc,gBAAgB,EAC5B,SACA,SACA,WACA,cACA,cACA,WACA,MACA,YACuC;EACvC,OAAO;GACL,OAAO;GACP,MAAM;IACJ,QAAQ,EAAM,QAAQ,CAAC;IACvB,MAAM,EAAM,QAAQ,EAAE;IACtB,OAAO,EAAM,QAAQ,CAAC;IACtB,KAAK,EAAM,QAAQ,CAAC;GACtB;GACA,QAAQ;IACN,OAAO;IACP,MAAM,EAAU,KAAI,MAAW,EAAQ,IAAI;IAC3C,MAAM;IACN,QAAQ;IACR,eAAe,EAAM,QAAQ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,GAAM,CAAgB;GAE9E,IAAI,EAAO,aAAa,EAAO,WAC7B;GAGF,IAAM,IAAO,EAAO,KACd,IAAO,EAAO;GAEpB,AAAK,EAAS,IAAI,CAAI,KACpB,EAAS,IAAI,mBAAM,IAAI,IAAoB,CAAC;GAE9C,IAAM,IAAO,EAAS,IAAI,CAAI;GAG9B,AAFA,EAAK,IAAI,IAAO,EAAK,IAAI,CAAI,KAAK,MAAM,EAAW,SAAS,EAAE,GAEzD,EAAW,IAAI,CAAI,KACtB,EAAW,IAAI,mBAAM,IAAI,IAAsB,CAAC;GAElD,IAAM,IAAc,EAAW,IAAI,CAAI;GACvC,EAAY,IAAI,GAAM,CAAC,GAAI,EAAY,IAAI,CAAI,KAAK,CAAC,GAAI,EAAW,EAAE,CAAC;EACzE,CAAC,GAEM,EAAU,KAAI,MAAY;GAC/B,IAAM,IAAU,EAAS,IAAI,EAAS,EAAE,qBAAK,IAAI,IAAoB,GAC/D,IAAW,EAAW,IAAI,EAAS,EAAE,qBAAK,IAAI,IAAsB;GAC1E,OAAO;IACL,MAAM,EAAU,KAAI,MAAY,EAAQ,IAAI,EAAS,EAAE,KAAK,CAAC;IAC7D,UAAU,EACR,OAAO,OACT;IACA,MAAM,EAAS;IACf,MAAM;IACN,UAAU,EAAU,KAAI,MAAY,EAAS,IAAI,EAAS,EAAE,KAAK,CAAC,CAAC;GACrE;EACF,CAAC;CACH;AACF"}
|
|
@@ -3,7 +3,7 @@ import { r as n } from "../../_chunks/isArrayLike.js";
|
|
|
3
3
|
import { n as r } from "../../_chunks/toString.js";
|
|
4
4
|
import { t as i } from "../../_chunks/round.js";
|
|
5
5
|
import { DashboardUtil as a } from "../DashboardUtil/index.js";
|
|
6
|
-
import { ConfigService as o } from "@gen-epix/ui/classes/services/ConfigService";
|
|
6
|
+
import { ConfigService as o } from "@gen-epix/ui-client-common/classes/services/ConfigService";
|
|
7
7
|
//#region ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseExtremum.js
|
|
8
8
|
var s = /* @__PURE__ */ t(((e, t) => {
|
|
9
9
|
var n = r();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseExtremum.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseGt.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/max.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseLt.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/min.js","../../../src/utils/MapUtil/MapUtil.ts"],"sourcesContent":["var isSymbol = require('./isSymbol');\n\n/**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\nfunction baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseExtremum;\n","/**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\nfunction baseGt(value, other) {\n return value > other;\n}\n\nmodule.exports = baseGt;\n","var baseExtremum = require('./_baseExtremum'),\n baseGt = require('./_baseGt'),\n identity = require('./identity');\n\n/**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\nfunction max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined;\n}\n\nmodule.exports = max;\n","/**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\nfunction baseLt(value, other) {\n return value < other;\n}\n\nmodule.exports = baseLt;\n","var baseExtremum = require('./_baseExtremum'),\n baseLt = require('./_baseLt'),\n identity = require('./identity');\n\n/**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\nfunction min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n}\n\nmodule.exports = min;\n","import max from 'lodash/max';\nimport min from 'lodash/min';\nimport round from 'lodash/round';\nimport type { PieSeriesOption } from 'echarts';\nimport type {\n CaseDbCase,\n CaseDbCol,\n CaseDbRegion,\n} from '@gen-epix/api-casedb';\nimport { ConfigService } from '@gen-epix/ui/classes/services/ConfigService';\nimport type { UnwrapArray } from '@gen-epix/ui-core/models/generic';\n\nimport type { CaseDbConfig } from '../../models/config';\nimport type { Stratification } from '../../models/stratification';\nimport { DashboardUtil } from '../DashboardUtil';\n\n\nexport type GenEpixPieSeriesOptionEventData = {\n genEpixData?: {\n caseIds: string[];\n regionId: string;\n };\n};\n\nexport type RegionStatistics = {\n maxNumCases: number;\n minNumCases: number;\n numCases: number;\n statisticsPerRegion: Record<string, { numCases: number; region: CaseDbRegion; rows: CaseDbCase[] }>;\n};\n\ntype GenEpixPieSeriesOptionData = Array<GenEpixPieSeriesOptionEventData & UnwrapArray<PieSeriesOption['data']>>;\n\ntype GeoJsonBounds = [number, number, number, number];\ntype GeoJsonFeature = {\n bbox?: number[];\n geometry?: GeoJsonGeometry | null;\n};\ntype GeoJsonGeometry = {\n bbox?: number[];\n coordinates?: unknown;\n geometries?: GeoJsonGeometry[];\n};\ntype GeoJsonObject = {\n bbox?: number[];\n coordinates?: unknown;\n features?: GeoJsonFeature[];\n geometries?: GeoJsonGeometry[];\n geometry?: GeoJsonGeometry | null;\n};\n\nexport class MapUtil {\n public static getGeoJsonAspectScale(geoJson: string) {\n const bounds = MapUtil.getGeoJsonBounds(geoJson);\n if (!bounds) {\n return 1;\n }\n\n const centerLatitude = (bounds[1] + bounds[3]) / 2;\n if (!Number.isFinite(centerLatitude) || Math.abs(centerLatitude) > 90) {\n return 1;\n }\n\n const aspectScale = Math.cos(centerLatitude * Math.PI / 180);\n return Number.isFinite(aspectScale) && aspectScale > 0 ? aspectScale : 1;\n }\n\n public static getMapSeries(\n col: CaseDbCol | null,\n regions: CaseDbRegion[],\n sortedData: CaseDbCase[],\n stratification: null | Stratification,\n getPieChartRadius: (numCases: number) => number,\n ): { mapCaseCount: number; series: PieSeriesOption[] } {\n if (!col || !regions) {\n return {\n mapCaseCount: undefined,\n series: [],\n };\n }\n\n const pieSeriesOptions: PieSeriesOption[] = [];\n\n const { numCases: totalNumCases, statisticsPerRegion } = MapUtil.getRegionStatistics(sortedData, col.id, regions);\n\n const pieChartOptionsBase: Partial<PieSeriesOption> = {\n animation: false,\n coordinateSystem: 'geo',\n label: {\n show: false,\n silent: true,\n },\n labelLine: {\n show: true,\n smooth: true,\n },\n type: 'pie',\n };\n\n Object.entries(statisticsPerRegion).forEach(([regionId, regionData]) => {\n const data: GenEpixPieSeriesOptionData = [];\n\n if (!stratification) {\n const caseIds = regionData.rows.map(row => row.id);\n if (caseIds.length === 0) {\n return;\n }\n data.push({\n emphasis: {\n focus: 'self',\n },\n genEpixData: {\n caseIds,\n regionId,\n },\n label: {\n formatter: () => regionData.region.name,\n },\n name: 'num-cases',\n value: regionData.numCases,\n });\n } else {\n stratification.legendaItems.forEach(legendaItem => {\n const rows = regionData.rows.filter(row => legendaItem.caseIds.includes(row.id));\n const caseIds = rows.map(row => row.id);\n const numCases = DashboardUtil.getCaseCount(rows);\n data.push({\n emphasis: {\n focus: 'self',\n },\n genEpixData: {\n caseIds,\n regionId,\n },\n label: {\n formatter: () => regionData.region.name,\n },\n name: legendaItem.rowValue.full,\n value: numCases,\n });\n });\n }\n\n pieSeriesOptions.push({\n ...pieChartOptionsBase,\n center: [regionData.region.center_lon, regionData.region.center_lat],\n data,\n radius: getPieChartRadius(regionData.numCases),\n tooltip: {\n formatter: (callbackParams) => {\n const d = (callbackParams as { data: { name: string; value: number } }).data;\n if (stratification) {\n return `${regionData.region.name} - ${d.name} (n=${d.value}, ${Math.round(d.value / regionData.numCases * 100)}%)`;\n }\n return `${regionData.region.name} (n=${regionData.numCases}, ${Math.round(regionData.numCases / totalNumCases * 100)}%)`;\n },\n },\n });\n });\n\n return {\n mapCaseCount: totalNumCases,\n series: pieSeriesOptions,\n };\n }\n\n public static getMaxPieChartArea(width: number, height: number, numZones: number): number {\n if (!width || !height || !numZones) {\n return 0;\n }\n const smallestDimension = Math.min(width, height);\n const mapArea = smallestDimension ** 2;\n const zoneArea = mapArea / numZones;\n const zoneDimension = Math.sqrt(zoneArea);\n const normalizedZoneDimension = zoneDimension / 4;\n const zonePieArea = ((normalizedZoneDimension / 2) ** 2) * Math.PI;\n return zonePieArea;\n }\n\n public static getPieChartRadius(numCases: number, maxPieChartArea: number, statistics: RegionStatistics) {\n const { maxNumCases, minNumCases } = statistics;\n const { MIN_PIE_CHART_RADIUS } = ConfigService.getInstance<CaseDbConfig>().config.map;\n const MIN_PIE_CHART_AREA = MIN_PIE_CHART_RADIUS ** 2 * Math.PI;\n\n let area: number;\n\n if (maxNumCases > minNumCases) {\n const slope = Math.max(MIN_PIE_CHART_AREA, (maxPieChartArea - MIN_PIE_CHART_AREA)) / (maxNumCases - minNumCases);\n area = (slope * (numCases - minNumCases)) + MIN_PIE_CHART_AREA;\n } else {\n area = maxPieChartArea;\n }\n const radius = round(Math.sqrt(area / Math.PI), 2);\n return Math.max(MIN_PIE_CHART_RADIUS, radius);\n }\n\n public static getRegionStatistics(cases: CaseDbCase[], columnId: string, regions: CaseDbRegion[]): RegionStatistics {\n if (!cases.length || !columnId || !regions?.length) {\n return {\n maxNumCases: 0,\n minNumCases: 0,\n numCases: 0,\n statisticsPerRegion: {},\n };\n }\n\n let numCases = 0;\n const statisticsPerRegion: Record<string, {\n numCases: number;\n region: CaseDbRegion;\n rows: CaseDbCase[];\n }> = {};\n cases.forEach(row => {\n const regionId = row.content[columnId];\n if (!regionId) {\n return;\n }\n if (!statisticsPerRegion[regionId]) {\n statisticsPerRegion[regionId] = {\n numCases: 0,\n region: regions.find(region => region.id === regionId),\n rows: [],\n };\n }\n statisticsPerRegion[regionId].rows.push(row);\n // when count is null, 1 should be assumed\n statisticsPerRegion[regionId].numCases += (row.count ?? 1);\n // when count is null, 1 should be assumed\n numCases += (row.count ?? 1);\n });\n const maxNumCases = max(Object.values(statisticsPerRegion).map(region => region.numCases));\n const minNumCases = min(Object.values(statisticsPerRegion).map(region => region.numCases));\n\n return {\n maxNumCases,\n minNumCases,\n numCases,\n statisticsPerRegion,\n };\n }\n\n private static createEmptyBounds(): GeoJsonBounds {\n return [Infinity, Infinity, -Infinity, -Infinity];\n }\n\n private static expandBoundsFromCoordinates(bounds: GeoJsonBounds, coordinates: unknown) {\n if (!Array.isArray(coordinates) || !coordinates.length) {\n return;\n }\n\n if (typeof coordinates[0] === 'number' && typeof coordinates[1] === 'number') {\n const [longitude, latitude] = coordinates as [number, number];\n\n if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {\n return;\n }\n\n bounds[0] = Math.min(bounds[0], longitude);\n bounds[1] = Math.min(bounds[1], latitude);\n bounds[2] = Math.max(bounds[2], longitude);\n bounds[3] = Math.max(bounds[3], latitude);\n return;\n }\n\n coordinates.forEach(childCoordinates => MapUtil.expandBoundsFromCoordinates(bounds, childCoordinates));\n }\n\n private static expandBoundsFromFeature(bounds: GeoJsonBounds, feature?: GeoJsonFeature | null) {\n if (!feature) {\n return;\n }\n\n const bboxBounds = MapUtil.normalizeBounds(feature.bbox);\n if (bboxBounds) {\n MapUtil.mergeBounds(bounds, bboxBounds);\n return;\n }\n\n MapUtil.expandBoundsFromGeometry(bounds, feature.geometry);\n }\n\n private static expandBoundsFromGeometry(bounds: GeoJsonBounds, geometry?: GeoJsonGeometry | null) {\n if (!geometry) {\n return;\n }\n\n const bboxBounds = MapUtil.normalizeBounds(geometry.bbox);\n if (bboxBounds) {\n MapUtil.mergeBounds(bounds, bboxBounds);\n return;\n }\n\n MapUtil.expandBoundsFromCoordinates(bounds, geometry.coordinates);\n geometry.geometries?.forEach(childGeometry => MapUtil.expandBoundsFromGeometry(bounds, childGeometry));\n }\n\n private static getGeoJsonBounds(geoJson: string): GeoJsonBounds | null {\n try {\n const parsedGeoJson = JSON.parse(geoJson) as GeoJsonObject;\n return MapUtil.getGeoJsonObjectBounds(parsedGeoJson);\n } catch {\n return null;\n }\n }\n\n private static getGeoJsonObjectBounds(geoJson: GeoJsonObject): GeoJsonBounds | null {\n const bboxBounds = MapUtil.normalizeBounds(geoJson.bbox);\n if (bboxBounds) {\n return bboxBounds;\n }\n\n const bounds = MapUtil.createEmptyBounds();\n MapUtil.expandBoundsFromCoordinates(bounds, geoJson.coordinates);\n geoJson.features?.forEach(feature => MapUtil.expandBoundsFromFeature(bounds, feature));\n geoJson.geometries?.forEach(geometry => MapUtil.expandBoundsFromGeometry(bounds, geometry));\n MapUtil.expandBoundsFromGeometry(bounds, geoJson.geometry);\n\n return MapUtil.hasBounds(bounds) ? bounds : null;\n }\n\n private static hasBounds(bounds: GeoJsonBounds) {\n return bounds.every(Number.isFinite);\n }\n\n private static mergeBounds(bounds: GeoJsonBounds, otherBounds: GeoJsonBounds) {\n bounds[0] = Math.min(bounds[0], otherBounds[0]);\n bounds[1] = Math.min(bounds[1], otherBounds[1]);\n bounds[2] = Math.max(bounds[2], otherBounds[2]);\n bounds[3] = Math.max(bounds[3], otherBounds[3]);\n }\n\n private static normalizeBounds(bounds?: number[]): GeoJsonBounds | null {\n if (!bounds || bounds.length < 4) {\n return null;\n }\n\n const normalizedBounds = bounds.slice(0, 4) as GeoJsonBounds;\n return normalizedBounds.every(Number.isFinite) ? normalizedBounds : null;\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4],"mappings":";;;;;;;;CAAA,IAAI,IAAA,EAAA;CAYJ,SAAS,EAAa,GAAO,GAAU,GAAY;EAIjD,KAHA,IAAI,IAAQ,IACR,IAAS,EAAM,QAEZ,EAAE,IAAQ,IAAQ;GACvB,IAAI,IAAQ,EAAM,IACd,IAAU,EAAS,CAAK;GAE5B,IAAI,KAAW,SAAS,MAAa,KAAA,IAC5B,MAAY,KAAW,CAAC,EAAS,CAAO,IACzC,EAAW,GAAS,CAAQ,IAElC,IAAI,IAAW,GACX,IAAS;EAEjB;EACA,OAAO;CACT;CAEA,EAAO,UAAU;;CCtBjB,SAAS,EAAO,GAAO,GAAO;EAC5B,OAAO,IAAQ;CACjB;CAEA,EAAO,UAAU;;CCbjB,IAAI,IAAA,EAAA,GACA,IAAA,EAAA,GACA,IAAA,EAAA;CAoBJ,SAAS,EAAI,GAAO;EAClB,OAAQ,KAAS,EAAM,SACnB,EAAa,GAAO,GAAU,CAAM,IACpC,KAAA;CACN;CAEA,EAAO,UAAU;;CCnBjB,SAAS,EAAO,GAAO,GAAO;EAC5B,OAAO,IAAQ;CACjB;CAEA,EAAO,UAAU;;CCbjB,IAAI,IAAA,EAAA,GACA,IAAA,EAAA,GACA,IAAA,EAAA;CAoBJ,SAAS,EAAI,GAAO;EAClB,OAAQ,KAAS,EAAM,SACnB,EAAa,GAAO,GAAU,CAAM,IACpC,KAAA;CACN;CAEA,EAAO,UAAU;kGCuBJ,IAAb,MAAa,EAAQ;CACnB,OAAc,sBAAsB,GAAiB;EACnD,IAAM,IAA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;CAEA,OAAe,YAAY,GAAuB,GAA4B;EAI5E,AAHA,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE,GAC9C,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE,GAC9C,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE,GAC9C,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE;CAChD;CAEA,OAAe,gBAAgB,GAAyC;EACtE,IAAI,CAAC,KAAU,EAAO,SAAS,GAC7B,OAAO;EAGT,IAAM,IAAmB,EAAO,MAAM,GAAG,CAAC;EAC1C,OAAO,EAAiB,MAAM,OAAO,QAAQ,IAAI,IAAmB;CACtE;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseExtremum.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseGt.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/max.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseLt.js","../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/min.js","../../../src/utils/MapUtil/MapUtil.ts"],"sourcesContent":["var isSymbol = require('./isSymbol');\n\n/**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\nfunction baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseExtremum;\n","/**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\nfunction baseGt(value, other) {\n return value > other;\n}\n\nmodule.exports = baseGt;\n","var baseExtremum = require('./_baseExtremum'),\n baseGt = require('./_baseGt'),\n identity = require('./identity');\n\n/**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\nfunction max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined;\n}\n\nmodule.exports = max;\n","/**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\nfunction baseLt(value, other) {\n return value < other;\n}\n\nmodule.exports = baseLt;\n","var baseExtremum = require('./_baseExtremum'),\n baseLt = require('./_baseLt'),\n identity = require('./identity');\n\n/**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\nfunction min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n}\n\nmodule.exports = min;\n","import max from 'lodash/max';\nimport min from 'lodash/min';\nimport round from 'lodash/round';\nimport type { PieSeriesOption } from 'echarts';\nimport type {\n CaseDbCase,\n CaseDbCol,\n CaseDbRegion,\n} from '@gen-epix/api-casedb';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\nimport type { UnwrapArray } from '@gen-epix/ui-core/models/generic';\n\nimport type { CaseDbConfig } from '../../models/config';\nimport type { Stratification } from '../../models/stratification';\nimport { DashboardUtil } from '../DashboardUtil';\n\n\nexport type GenEpixPieSeriesOptionEventData = {\n genEpixData?: {\n caseIds: string[];\n regionId: string;\n };\n};\n\nexport type RegionStatistics = {\n maxNumCases: number;\n minNumCases: number;\n numCases: number;\n statisticsPerRegion: Record<string, { numCases: number; region: CaseDbRegion; rows: CaseDbCase[] }>;\n};\n\ntype GenEpixPieSeriesOptionData = Array<GenEpixPieSeriesOptionEventData & UnwrapArray<PieSeriesOption['data']>>;\n\ntype GeoJsonBounds = [number, number, number, number];\ntype GeoJsonFeature = {\n bbox?: number[];\n geometry?: GeoJsonGeometry | null;\n};\ntype GeoJsonGeometry = {\n bbox?: number[];\n coordinates?: unknown;\n geometries?: GeoJsonGeometry[];\n};\ntype GeoJsonObject = {\n bbox?: number[];\n coordinates?: unknown;\n features?: GeoJsonFeature[];\n geometries?: GeoJsonGeometry[];\n geometry?: GeoJsonGeometry | null;\n};\n\nexport class MapUtil {\n public static getGeoJsonAspectScale(geoJson: string) {\n const bounds = MapUtil.getGeoJsonBounds(geoJson);\n if (!bounds) {\n return 1;\n }\n\n const centerLatitude = (bounds[1] + bounds[3]) / 2;\n if (!Number.isFinite(centerLatitude) || Math.abs(centerLatitude) > 90) {\n return 1;\n }\n\n const aspectScale = Math.cos(centerLatitude * Math.PI / 180);\n return Number.isFinite(aspectScale) && aspectScale > 0 ? aspectScale : 1;\n }\n\n public static getMapSeries(\n col: CaseDbCol | null,\n regions: CaseDbRegion[],\n sortedData: CaseDbCase[],\n stratification: null | Stratification,\n getPieChartRadius: (numCases: number) => number,\n ): { mapCaseCount: number; series: PieSeriesOption[] } {\n if (!col || !regions) {\n return {\n mapCaseCount: undefined,\n series: [],\n };\n }\n\n const pieSeriesOptions: PieSeriesOption[] = [];\n\n const { numCases: totalNumCases, statisticsPerRegion } = MapUtil.getRegionStatistics(sortedData, col.id, regions);\n\n const pieChartOptionsBase: Partial<PieSeriesOption> = {\n animation: false,\n coordinateSystem: 'geo',\n label: {\n show: false,\n silent: true,\n },\n labelLine: {\n show: true,\n smooth: true,\n },\n type: 'pie',\n };\n\n Object.entries(statisticsPerRegion).forEach(([regionId, regionData]) => {\n const data: GenEpixPieSeriesOptionData = [];\n\n if (!stratification) {\n const caseIds = regionData.rows.map(row => row.id);\n if (caseIds.length === 0) {\n return;\n }\n data.push({\n emphasis: {\n focus: 'self',\n },\n genEpixData: {\n caseIds,\n regionId,\n },\n label: {\n formatter: () => regionData.region.name,\n },\n name: 'num-cases',\n value: regionData.numCases,\n });\n } else {\n stratification.legendaItems.forEach(legendaItem => {\n const rows = regionData.rows.filter(row => legendaItem.caseIds.includes(row.id));\n const caseIds = rows.map(row => row.id);\n const numCases = DashboardUtil.getCaseCount(rows);\n data.push({\n emphasis: {\n focus: 'self',\n },\n genEpixData: {\n caseIds,\n regionId,\n },\n label: {\n formatter: () => regionData.region.name,\n },\n name: legendaItem.rowValue.full,\n value: numCases,\n });\n });\n }\n\n pieSeriesOptions.push({\n ...pieChartOptionsBase,\n center: [regionData.region.center_lon, regionData.region.center_lat],\n data,\n radius: getPieChartRadius(regionData.numCases),\n tooltip: {\n formatter: (callbackParams) => {\n const d = (callbackParams as { data: { name: string; value: number } }).data;\n if (stratification) {\n return `${regionData.region.name} - ${d.name} (n=${d.value}, ${Math.round(d.value / regionData.numCases * 100)}%)`;\n }\n return `${regionData.region.name} (n=${regionData.numCases}, ${Math.round(regionData.numCases / totalNumCases * 100)}%)`;\n },\n },\n });\n });\n\n return {\n mapCaseCount: totalNumCases,\n series: pieSeriesOptions,\n };\n }\n\n public static getMaxPieChartArea(width: number, height: number, numZones: number): number {\n if (!width || !height || !numZones) {\n return 0;\n }\n const smallestDimension = Math.min(width, height);\n const mapArea = smallestDimension ** 2;\n const zoneArea = mapArea / numZones;\n const zoneDimension = Math.sqrt(zoneArea);\n const normalizedZoneDimension = zoneDimension / 4;\n const zonePieArea = ((normalizedZoneDimension / 2) ** 2) * Math.PI;\n return zonePieArea;\n }\n\n public static getPieChartRadius(numCases: number, maxPieChartArea: number, statistics: RegionStatistics) {\n const { maxNumCases, minNumCases } = statistics;\n const { MIN_PIE_CHART_RADIUS } = ConfigService.getInstance<CaseDbConfig>().config.map;\n const MIN_PIE_CHART_AREA = MIN_PIE_CHART_RADIUS ** 2 * Math.PI;\n\n let area: number;\n\n if (maxNumCases > minNumCases) {\n const slope = Math.max(MIN_PIE_CHART_AREA, (maxPieChartArea - MIN_PIE_CHART_AREA)) / (maxNumCases - minNumCases);\n area = (slope * (numCases - minNumCases)) + MIN_PIE_CHART_AREA;\n } else {\n area = maxPieChartArea;\n }\n const radius = round(Math.sqrt(area / Math.PI), 2);\n return Math.max(MIN_PIE_CHART_RADIUS, radius);\n }\n\n public static getRegionStatistics(cases: CaseDbCase[], columnId: string, regions: CaseDbRegion[]): RegionStatistics {\n if (!cases.length || !columnId || !regions?.length) {\n return {\n maxNumCases: 0,\n minNumCases: 0,\n numCases: 0,\n statisticsPerRegion: {},\n };\n }\n\n let numCases = 0;\n const statisticsPerRegion: Record<string, {\n numCases: number;\n region: CaseDbRegion;\n rows: CaseDbCase[];\n }> = {};\n cases.forEach(row => {\n const regionId = row.content[columnId];\n if (!regionId) {\n return;\n }\n if (!statisticsPerRegion[regionId]) {\n statisticsPerRegion[regionId] = {\n numCases: 0,\n region: regions.find(region => region.id === regionId),\n rows: [],\n };\n }\n statisticsPerRegion[regionId].rows.push(row);\n // when count is null, 1 should be assumed\n statisticsPerRegion[regionId].numCases += (row.count ?? 1);\n // when count is null, 1 should be assumed\n numCases += (row.count ?? 1);\n });\n const maxNumCases = max(Object.values(statisticsPerRegion).map(region => region.numCases));\n const minNumCases = min(Object.values(statisticsPerRegion).map(region => region.numCases));\n\n return {\n maxNumCases,\n minNumCases,\n numCases,\n statisticsPerRegion,\n };\n }\n\n private static createEmptyBounds(): GeoJsonBounds {\n return [Infinity, Infinity, -Infinity, -Infinity];\n }\n\n private static expandBoundsFromCoordinates(bounds: GeoJsonBounds, coordinates: unknown) {\n if (!Array.isArray(coordinates) || !coordinates.length) {\n return;\n }\n\n if (typeof coordinates[0] === 'number' && typeof coordinates[1] === 'number') {\n const [longitude, latitude] = coordinates as [number, number];\n\n if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {\n return;\n }\n\n bounds[0] = Math.min(bounds[0], longitude);\n bounds[1] = Math.min(bounds[1], latitude);\n bounds[2] = Math.max(bounds[2], longitude);\n bounds[3] = Math.max(bounds[3], latitude);\n return;\n }\n\n coordinates.forEach(childCoordinates => MapUtil.expandBoundsFromCoordinates(bounds, childCoordinates));\n }\n\n private static expandBoundsFromFeature(bounds: GeoJsonBounds, feature?: GeoJsonFeature | null) {\n if (!feature) {\n return;\n }\n\n const bboxBounds = MapUtil.normalizeBounds(feature.bbox);\n if (bboxBounds) {\n MapUtil.mergeBounds(bounds, bboxBounds);\n return;\n }\n\n MapUtil.expandBoundsFromGeometry(bounds, feature.geometry);\n }\n\n private static expandBoundsFromGeometry(bounds: GeoJsonBounds, geometry?: GeoJsonGeometry | null) {\n if (!geometry) {\n return;\n }\n\n const bboxBounds = MapUtil.normalizeBounds(geometry.bbox);\n if (bboxBounds) {\n MapUtil.mergeBounds(bounds, bboxBounds);\n return;\n }\n\n MapUtil.expandBoundsFromCoordinates(bounds, geometry.coordinates);\n geometry.geometries?.forEach(childGeometry => MapUtil.expandBoundsFromGeometry(bounds, childGeometry));\n }\n\n private static getGeoJsonBounds(geoJson: string): GeoJsonBounds | null {\n try {\n const parsedGeoJson = JSON.parse(geoJson) as GeoJsonObject;\n return MapUtil.getGeoJsonObjectBounds(parsedGeoJson);\n } catch {\n return null;\n }\n }\n\n private static getGeoJsonObjectBounds(geoJson: GeoJsonObject): GeoJsonBounds | null {\n const bboxBounds = MapUtil.normalizeBounds(geoJson.bbox);\n if (bboxBounds) {\n return bboxBounds;\n }\n\n const bounds = MapUtil.createEmptyBounds();\n MapUtil.expandBoundsFromCoordinates(bounds, geoJson.coordinates);\n geoJson.features?.forEach(feature => MapUtil.expandBoundsFromFeature(bounds, feature));\n geoJson.geometries?.forEach(geometry => MapUtil.expandBoundsFromGeometry(bounds, geometry));\n MapUtil.expandBoundsFromGeometry(bounds, geoJson.geometry);\n\n return MapUtil.hasBounds(bounds) ? bounds : null;\n }\n\n private static hasBounds(bounds: GeoJsonBounds) {\n return bounds.every(Number.isFinite);\n }\n\n private static mergeBounds(bounds: GeoJsonBounds, otherBounds: GeoJsonBounds) {\n bounds[0] = Math.min(bounds[0], otherBounds[0]);\n bounds[1] = Math.min(bounds[1], otherBounds[1]);\n bounds[2] = Math.max(bounds[2], otherBounds[2]);\n bounds[3] = Math.max(bounds[3], otherBounds[3]);\n }\n\n private static normalizeBounds(bounds?: number[]): GeoJsonBounds | null {\n if (!bounds || bounds.length < 4) {\n return null;\n }\n\n const normalizedBounds = bounds.slice(0, 4) as GeoJsonBounds;\n return normalizedBounds.every(Number.isFinite) ? normalizedBounds : null;\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4],"mappings":";;;;;;;;CAAA,IAAI,IAAA,EAAA;CAYJ,SAAS,EAAa,GAAO,GAAU,GAAY;EAIjD,KAHA,IAAI,IAAQ,IACR,IAAS,EAAM,QAEZ,EAAE,IAAQ,IAAQ;GACvB,IAAI,IAAQ,EAAM,IACd,IAAU,EAAS,CAAK;GAE5B,IAAI,KAAW,SAAS,MAAa,KAAA,IAC5B,MAAY,KAAW,CAAC,EAAS,CAAO,IACzC,EAAW,GAAS,CAAQ,IAElC,IAAI,IAAW,GACX,IAAS;EAEjB;EACA,OAAO;CACT;CAEA,EAAO,UAAU;;CCtBjB,SAAS,EAAO,GAAO,GAAO;EAC5B,OAAO,IAAQ;CACjB;CAEA,EAAO,UAAU;;CCbjB,IAAI,IAAA,EAAA,GACA,IAAA,EAAA,GACA,IAAA,EAAA;CAoBJ,SAAS,EAAI,GAAO;EAClB,OAAQ,KAAS,EAAM,SACnB,EAAa,G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O;EAGT,IAAM,IAAS,EAAQ,kBAAkB;EAMzC,OALA,EAAQ,4BAA4B,GAAQ,EAAQ,WAAW,GAC/D,EAAQ,UAAU,SAAQ,MAAW,EAAQ,wBAAwB,GAAQ,CAAO,CAAC,GACrF,EAAQ,YAAY,SAAQ,MAAY,EAAQ,yBAAyB,GAAQ,CAAQ,CAAC,GAC1F,EAAQ,yBAAyB,GAAQ,EAAQ,QAAQ,GAElD,EAAQ,UAAU,CAAM,IAAI,IAAS;CAC9C;CAEA,OAAe,UAAU,GAAuB;EAC9C,OAAO,EAAO,MAAM,OAAO,QAAQ;CACrC;CAEA,OAAe,YAAY,GAAuB,GAA4B;EAI5E,AAHA,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE,GAC9C,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE,GAC9C,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE,GAC9C,EAAO,KAAK,KAAK,IAAI,EAAO,IAAI,EAAY,EAAE;CAChD;CAEA,OAAe,gBAAgB,GAAyC;EACtE,IAAI,CAAC,KAAU,EAAO,SAAS,GAC7B,OAAO;EAGT,IAAM,IAAmB,EAAO,MAAM,GAAG,CAAC;EAC1C,OAAO,EAAiB,MAAM,OAAO,QAAQ,IAAI,IAAmB;CACtE;AACF"}
|
|
@@ -6,7 +6,7 @@ import { t as s } from "../../_chunks/_baseIteratee.js";
|
|
|
6
6
|
import { STRATIFICATION_MODE as c, STRATIFICATION_SELECTED as l, STRATIFICATION_SIMILAR_CASE as u } from "../../models/stratification.js";
|
|
7
7
|
import { CaseDbDataUtil as d } from "../CaseDbDataUtil/index.js";
|
|
8
8
|
import { t as f } from "i18next";
|
|
9
|
-
import { ConfigService as p } from "@gen-epix/ui/classes/services/ConfigService";
|
|
9
|
+
import { ConfigService as p } from "@gen-epix/ui-client-common/classes/services/ConfigService";
|
|
10
10
|
//#region ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/uniqBy.js
|
|
11
11
|
var m = /* @__PURE__ */ t(((e, t) => {
|
|
12
12
|
var n = s(), i = r();
|
|
@@ -175,7 +175,8 @@ var m = /* @__PURE__ */ t(((e, t) => {
|
|
|
175
175
|
});
|
|
176
176
|
}), e;
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
let u = s.map((e) => o.getRowValue(e.content, r, i)).filter((e) => !e.isMissing);
|
|
179
|
+
return (0, g.default)(u, ((e) => e.raw)).sort((t, n) => e.rowValueComperator(t, n));
|
|
179
180
|
}
|
|
180
181
|
static isEpiConceptBoundaryProps(e) {
|
|
181
182
|
if (typeof e != "object" || !e) return !1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/uniqBy.js","../../../src/utils/StratificationUtil/StratificationUtil.ts"],"sourcesContent":["var baseIteratee = require('./_baseIteratee'),\n baseUniq = require('./_baseUniq');\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\nfunction uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];\n}\n\nmodule.exports = uniqBy;\n","import type { Theme } from '@mui/material';\nimport uniq from 'lodash/uniq';\nimport uniqBy from 'lodash/uniqBy';\nimport type {\n CaseDbCase,\n CaseDbCol,\n CaseDbCompleteCaseType,\n} from '@gen-epix/api-casedb';\nimport { ConfigService } from '@gen-epix/ui/classes/services/ConfigService';\nimport { t } from 'i18next';\nimport type { Range } from 'colorjs.io';\n\nimport { DataService } from '../../classes/services/DataService';\nimport type { CaseDbConfig } from '../../models/config';\nimport type {\n CaseTypeRowValue,\n ConceptBoundaryProps,\n} from '../../models/caseDb';\nimport type {\n StratifiableColumn,\n Stratification,\n StratificationLegendaItem,\n} from '../../models/stratification';\nimport {\n STRATIFICATION_MODE,\n STRATIFICATION_SELECTED,\n STRATIFICATION_SIMILAR_CASE,\n} from '../../models/stratification';\nimport { CaseTypeUtil } from '../CaseTypeUtil';\nimport { CaseUtil } from '../CaseUtil';\nimport { CaseDbDataUtil } from '../CaseDbDataUtil';\n\nexport class StratificationUtil {\n public static getEchartsColors(stratification: Stratification, theme: Theme): string[] {\n if (!stratification) {\n return [theme.palette.primary.main];\n }\n return stratification.legendaItems?.map(item => item.color) ?? [];\n }\n\n\n public static getStratification(\n kwArgs: {\n col?: CaseDbCol;\n completeCaseType: CaseDbCompleteCaseType;\n mode: STRATIFICATION_MODE;\n selectedIds?: string[];\n similarCaseIds?: string[];\n sortedData: CaseDbCase[];\n useExtraGradients?: boolean;\n },\n ): Stratification {\n const { col, completeCaseType, mode, selectedIds, similarCaseIds, sortedData } = kwArgs;\n if (!mode) {\n return null;\n }\n\n if (mode === STRATIFICATION_MODE.FIELD) {\n return StratificationUtil.getFieldStratification({ col, completeCaseType, sortedData, useExtraGradients: kwArgs.useExtraGradients });\n }\n\n if (mode === STRATIFICATION_MODE.SELECTION) {\n if (!selectedIds) {\n return null;\n }\n return StratificationUtil.getSelectionStratification({ selectedIds, sortedData });\n }\n\n if (mode === STRATIFICATION_MODE.SIMILAR_CASES) {\n if (!similarCaseIds) {\n return null;\n }\n return StratificationUtil.getSimilarCasesStratification({ similarCaseIds, sortedData });\n }\n\n return null;\n }\n\n public static getStratifyableColumns(\n kwArgs: {\n completeCaseType: CaseDbCompleteCaseType;\n data: CaseDbCase[];\n },\n ): StratifiableColumn[] {\n const { completeCaseType, data } = kwArgs;\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n\n const filteredCols = CaseTypeUtil.getCols(completeCaseType).filter(col => {\n const column = completeCaseType.ref_cols[col.ref_col_id];\n return STRATIFICATION.ALLOWED_COL_TYPES.includes(column.col_type);\n });\n\n return filteredCols.map<StratifiableColumn>(col => {\n const numUniqueValues = uniq(data.map(row => CaseUtil.getRowValue(row.content, col, completeCaseType).raw).filter(x => !!x)).length;\n const enabled = numUniqueValues > 1 && numUniqueValues <= STRATIFICATION.MAX_ALLOWED_UNIQUE_VALUES;\n return {\n col,\n enabled,\n };\n }).sort((a, b) => completeCaseType.ordered_col_ids.indexOf(a.col.id) - completeCaseType.ordered_col_ids.indexOf(b.col.id));\n }\n\n private static getFieldStratification(\n kwArgs: {\n col?: CaseDbCol;\n completeCaseType: CaseDbCompleteCaseType;\n sortedData: CaseDbCase[];\n useExtraGradients?: boolean;\n },\n ): Stratification {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { col, completeCaseType, sortedData, useExtraGradients } = kwArgs;\n if (!col) {\n return null;\n }\n\n const caseIdColors: { [key: string]: string } = {};\n const legendaItems: StratificationLegendaItem[] = [];\n const legendaItemsByColor: { [key: string]: StratificationLegendaItem } = {};\n const legendaItemsByValue: { [key: string]: StratificationLegendaItem } = {};\n\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n\n const uniqueRowValues = StratificationUtil.getUniqueRowValues({ col, completeCaseType, sortedData });\n const legendaItemMissingData: StratificationLegendaItem = {\n caseIds: [],\n color: STRATIFICATION.ITEM_MISSING_COLOR,\n columnType: refCol.col_type,\n rowValue: CaseUtil.getMissingRowValue(''),\n };\n const colors: string[] = [];\n\n if (STRATIFICATION.GRADIENT_COL_TYPES.includes(refCol.col_type) || uniqueRowValues.length > STRATIFICATION.BASE_COLORS.length) {\n let gradient: Range;\n if (STRATIFICATION.GRADIENT_COL_TYPES.includes(refCol.col_type)) {\n gradient = STRATIFICATION.BASE_ORDERED_GRADIENT;\n } else {\n if (useExtraGradients) {\n const numExtraGradients = STRATIFICATION.EXTRA_GRADIENTS.length;\n const dim = completeCaseType.dims[col.dim_id];\n const dims = Object.values(completeCaseType.dims).map(d => d.id);\n const colIndexInCompleteCaseType = dims.indexOf(dim.id);\n gradient = STRATIFICATION.EXTRA_GRADIENTS[colIndexInCompleteCaseType % numExtraGradients];\n } else {\n gradient = STRATIFICATION.BASE_UNORDERED_GRADIENT;\n }\n }\n const conceptSetConceptIds = DataService.getInstance().data.conceptsIdsBySetId[refCol.concept_set_id];\n if (conceptSetConceptIds?.length) {\n const concepts = conceptSetConceptIds.map(conceptId => DataService.getInstance().data.conceptsById[conceptId]).sort(CaseDbDataUtil.conceptComparator);\n if (concepts.every(concept => StratificationUtil.isEpiConceptBoundaryProps(concept.props))) {\n const boundaryProps = concepts.map(concept => concept.props as ConceptBoundaryProps);\n const finiteLbs = boundaryProps.map(bp => bp.lb).filter(v => isFinite(v));\n const finiteUbs = boundaryProps.map(bp => bp.ub).filter(v => isFinite(v));\n const globalMin = Math.min(...finiteLbs, ...finiteUbs);\n const globalMax = Math.max(...finiteLbs, ...finiteUbs);\n if (isFinite(globalMin) && isFinite(globalMax) && globalMax > globalMin) {\n boundaryProps.forEach((bp) => {\n const lb = isFinite(bp.lb) ? bp.lb : globalMin;\n const ub = isFinite(bp.ub) ? bp.ub : globalMax;\n const midpoint = (lb + ub) / 2;\n const gradientPosition = Math.max(0, Math.min(1, (midpoint - globalMin) / (globalMax - globalMin)));\n colors.push(gradient(gradientPosition).toString({ format: 'hex' }));\n });\n }\n }\n }\n\n if (colors.length === 0) {\n uniqueRowValues.forEach((_, index) => {\n colors.push(gradient(index / uniqueRowValues.length).toString({ format: 'hex' }));\n });\n }\n } else {\n colors.push(...STRATIFICATION.BASE_COLORS);\n }\n\n uniqueRowValues.forEach((rowValue, index) => {\n const color = colors[index];\n const legendaItem: StratificationLegendaItem = {\n caseIds: [],\n color,\n columnType: refCol.col_type,\n rowValue,\n };\n legendaItemsByColor[color] = legendaItem;\n legendaItemsByValue[rowValue.raw] = legendaItem;\n legendaItems.push(legendaItem);\n });\n\n sortedData.forEach(row => {\n const rowValue = CaseUtil.getRowValue(row.content, col, completeCaseType);\n if (rowValue.isMissing) {\n legendaItemMissingData.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItemMissingData.color;\n return;\n }\n const legendaItem = legendaItemsByValue[rowValue.raw];\n legendaItem.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItem.color;\n });\n\n if (legendaItemMissingData.caseIds.length > 0) {\n legendaItemsByColor[STRATIFICATION.ITEM_MISSING_COLOR] = legendaItemMissingData;\n legendaItemsByValue[''] = legendaItemMissingData;\n legendaItems.push(legendaItemMissingData);\n }\n\n return {\n caseIdColors,\n col,\n colorForIsMissing: STRATIFICATION.ITEM_MISSING_COLOR,\n legendaItems,\n legendaItemsByColor,\n legendaItemsByValue,\n mode: STRATIFICATION_MODE.FIELD,\n };\n }\n\n private static getSelectionStratification(\n kwArgs: {\n selectedIds: string[];\n sortedData: CaseDbCase[];\n },\n ): Stratification {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { selectedIds, sortedData } = kwArgs;\n const caseIdColors: { [key: string]: string } = {};\n const legendaItems: StratificationLegendaItem[] = [];\n const legendaItemsByColor: { [key: string]: StratificationLegendaItem } = {};\n const legendaItemsByValue: { [key: string]: StratificationLegendaItem } = {};\n\n const rawValues: STRATIFICATION_SELECTED[] = [STRATIFICATION_SELECTED.SELECTED, STRATIFICATION_SELECTED.UNSELECTED];\n\n rawValues.forEach(rawValue => {\n const color = rawValue === STRATIFICATION_SELECTED.SELECTED ? STRATIFICATION.BASE_COLORS[0] : STRATIFICATION.BASE_COLORS[1];\n const presentationValue = rawValue === STRATIFICATION_SELECTED.SELECTED ? t`Selected` : t`Unselected`;\n const legendaItem: StratificationLegendaItem = {\n caseIds: [],\n color,\n rowValue: {\n full: presentationValue,\n isMissing: false,\n long: presentationValue,\n raw: rawValue,\n short: presentationValue,\n },\n };\n legendaItemsByColor[color] = legendaItem;\n legendaItemsByValue[rawValue] = legendaItem;\n legendaItems.push(legendaItem);\n });\n\n sortedData.forEach(row => {\n const legendaItem = selectedIds.includes(row.id) ? legendaItemsByValue[STRATIFICATION_SELECTED.SELECTED] : legendaItemsByValue[STRATIFICATION_SELECTED.UNSELECTED];\n legendaItem.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItem.color;\n });\n\n return {\n caseIdColors,\n colorForIsMissing: STRATIFICATION.ITEM_MISSING_COLOR,\n legendaItems,\n legendaItemsByColor,\n legendaItemsByValue,\n mode: STRATIFICATION_MODE.SELECTION,\n };\n }\n\n private static getSimilarCasesStratification(\n kwArgs: {\n similarCaseIds: string[];\n sortedData: CaseDbCase[];\n },\n ): Stratification {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { similarCaseIds, sortedData } = kwArgs;\n const caseIdColors: { [key: string]: string } = {};\n const legendaItems: StratificationLegendaItem[] = [];\n const legendaItemsByColor: { [key: string]: StratificationLegendaItem } = {};\n const legendaItemsByValue: { [key: string]: StratificationLegendaItem } = {};\n\n const rawValues: STRATIFICATION_SIMILAR_CASE[] = [STRATIFICATION_SIMILAR_CASE.NO, STRATIFICATION_SIMILAR_CASE.YES];\n\n rawValues.forEach(rawValue => {\n const color = rawValue === STRATIFICATION_SIMILAR_CASE.YES ? STRATIFICATION.BASE_COLORS[0] : STRATIFICATION.BASE_COLORS[1];\n const presentationValue = rawValue === STRATIFICATION_SIMILAR_CASE.YES ? t`Cases found by similarity` : t`Regular cases`;\n const legendaItem: StratificationLegendaItem = {\n caseIds: [],\n color,\n rowValue: {\n full: presentationValue,\n isMissing: false,\n long: presentationValue,\n raw: rawValue,\n short: presentationValue,\n },\n };\n legendaItemsByColor[color] = legendaItem;\n legendaItemsByValue[rawValue] = legendaItem;\n legendaItems.push(legendaItem);\n });\n\n sortedData.forEach(row => {\n const legendaItem = similarCaseIds.includes(row.id) ? legendaItemsByValue[STRATIFICATION_SIMILAR_CASE.YES] : legendaItemsByValue[STRATIFICATION_SIMILAR_CASE.NO];\n legendaItem.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItem.color;\n });\n\n return {\n caseIdColors,\n colorForIsMissing: STRATIFICATION.ITEM_MISSING_COLOR,\n legendaItems,\n legendaItemsByColor,\n legendaItemsByValue,\n mode: STRATIFICATION_MODE.SIMILAR_CASES,\n };\n }\n\n private static getUniqueRowValues(\n kwArgs: {\n col?: CaseDbCol;\n completeCaseType: CaseDbCompleteCaseType;\n sortedData: CaseDbCase[];\n },\n ): CaseTypeRowValue[] {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { col, completeCaseType, sortedData } = kwArgs;\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n const conceptSetConceptIds = DataService.getInstance().data.conceptsIdsBySetId[refCol.concept_set_id];\n\n if (conceptSetConceptIds) {\n const uniqueRowValues: CaseTypeRowValue[] = [];\n conceptSetConceptIds.map(conceptId => DataService.getInstance().data.conceptsById[conceptId]).sort((a, b) => {\n if (STRATIFICATION.GRADIENT_COL_TYPES.includes(refCol.col_type) && a.rank !== b.rank) {\n return a.rank - b.rank;\n }\n return a.code.localeCompare(b.code);\n }).forEach((concept) => {\n uniqueRowValues.push({\n full: `${concept.code} (${concept.name})`,\n isMissing: false,\n long: concept.name,\n raw: concept.id,\n short: concept.code,\n });\n });\n return uniqueRowValues;\n }\n const rowValues = sortedData.map(row => CaseUtil.getRowValue(row.content, col, completeCaseType)).filter(x => !x.isMissing);\n const uniqueRowValues = uniqBy(rowValues, (rowValue => rowValue.raw)).sort((a, b) => {\n return StratificationUtil.rowValueComperator(a, b);\n });\n return uniqueRowValues;\n }\n\n private static isEpiConceptBoundaryProps(prop: unknown): prop is ConceptBoundaryProps {\n if (typeof prop !== 'object' || prop === null) {\n return false;\n }\n const propAsEpiConceptBoundaryProps = prop as ConceptBoundaryProps;\n return ['lb', 'lb_in', 'ub', 'ub_in', 'unit'].every(key => key in propAsEpiConceptBoundaryProps);\n }\n\n private static rowValueComperator(a: CaseTypeRowValue, b: CaseTypeRowValue): number {\n if (a.raw === b.raw) {\n return 0;\n }\n if (a.isMissing) {\n return 1;\n }\n if (b.isMissing) {\n return -1;\n }\n return a.short.localeCompare(b.short);\n }\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;CAAA,IAAI,IAAA,EAAA,GACA,IAAA,EAAA;CAyBJ,SAAS,EAAO,GAAO,GAAU;EAC/B,OAAQ,KAAS,EAAM,SAAU,EAAS,GAAO,EAAa,GAAU,CAAC,CAAC,IAAI,CAAC;CACjF;CAEA,EAAO,UAAU;mECEJ,IAAb,MAAa,EAAmB;CAC9B,OAAc,iBAAiB,GAAgC,GAAwB;EAIrF,OAHK,IAGE,EAAe,cAAc,KAAI,MAAQ,EAAK,KAAK,KAAK,CAAC,IAFvD,CAAC,EAAM,QAAQ,QAAQ,IAAI;CAGtC;CAGA,OAAc,kBACZ,GASgB;EAChB,IAAM,EAAE,QAAK,qBAAkB,SAAM,gBAAa,mBAAgB,kBAAe;EAuBjF,OAtBK,IAID,MAAS,EAAoB,QACxB,EAAmB,uBAAuB;GAAE;GAAK;GAAkB;GAAY,mBAAmB,EAAO;EAAkB,CAAC,IAGjI,MAAS,EAAoB,YAC1B,IAGE,EAAmB,2BAA2B;GAAE;GAAa;EAAW,CAAC,IAFvE,OAKP,MAAS,EAAoB,iBAC1B,IAGE,EAAmB,8BAA8B;GAAE;GAAgB;EAAW,CAAC,IAF7E,OAhBF;CAsBX;CAEA,OAAc,uBACZ,GAIsB;EACtB,IAAM,EAAE,qBAAkB,YAAS,GAC7B,EAAE,sBAAmB,EAAc,YAA0B,CAAC,CAAC,OAAO;EAO5E,OALqB,EAAa,QAAQ,CAAgB,CAAC,CAAC,QAA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AE,MAAM,cAAc,EAAE,KAAK;CACtC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/uniqBy.js","../../../src/utils/StratificationUtil/StratificationUtil.ts"],"sourcesContent":["var baseIteratee = require('./_baseIteratee'),\n baseUniq = require('./_baseUniq');\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\nfunction uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];\n}\n\nmodule.exports = uniqBy;\n","import type { Theme } from '@mui/material';\nimport uniq from 'lodash/uniq';\nimport uniqBy from 'lodash/uniqBy';\nimport type {\n CaseDbCase,\n CaseDbCol,\n CaseDbCompleteCaseType,\n} from '@gen-epix/api-casedb';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\nimport { t } from 'i18next';\nimport type { Range } from 'colorjs.io';\n\nimport { DataService } from '../../classes/services/DataService';\nimport type { CaseDbConfig } from '../../models/config';\nimport type {\n CaseTypeRowValue,\n ConceptBoundaryProps,\n} from '../../models/caseDb';\nimport type {\n StratifiableColumn,\n Stratification,\n StratificationLegendaItem,\n} from '../../models/stratification';\nimport {\n STRATIFICATION_MODE,\n STRATIFICATION_SELECTED,\n STRATIFICATION_SIMILAR_CASE,\n} from '../../models/stratification';\nimport { CaseTypeUtil } from '../CaseTypeUtil';\nimport { CaseUtil } from '../CaseUtil';\nimport { CaseDbDataUtil } from '../CaseDbDataUtil';\n\nexport class StratificationUtil {\n public static getEchartsColors(stratification: Stratification, theme: Theme): string[] {\n if (!stratification) {\n return [theme.palette.primary.main];\n }\n return stratification.legendaItems?.map(item => item.color) ?? [];\n }\n\n\n public static getStratification(\n kwArgs: {\n col?: CaseDbCol;\n completeCaseType: CaseDbCompleteCaseType;\n mode: STRATIFICATION_MODE;\n selectedIds?: string[];\n similarCaseIds?: string[];\n sortedData: CaseDbCase[];\n useExtraGradients?: boolean;\n },\n ): Stratification {\n const { col, completeCaseType, mode, selectedIds, similarCaseIds, sortedData } = kwArgs;\n if (!mode) {\n return null;\n }\n\n if (mode === STRATIFICATION_MODE.FIELD) {\n return StratificationUtil.getFieldStratification({ col, completeCaseType, sortedData, useExtraGradients: kwArgs.useExtraGradients });\n }\n\n if (mode === STRATIFICATION_MODE.SELECTION) {\n if (!selectedIds) {\n return null;\n }\n return StratificationUtil.getSelectionStratification({ selectedIds, sortedData });\n }\n\n if (mode === STRATIFICATION_MODE.SIMILAR_CASES) {\n if (!similarCaseIds) {\n return null;\n }\n return StratificationUtil.getSimilarCasesStratification({ similarCaseIds, sortedData });\n }\n\n return null;\n }\n\n public static getStratifyableColumns(\n kwArgs: {\n completeCaseType: CaseDbCompleteCaseType;\n data: CaseDbCase[];\n },\n ): StratifiableColumn[] {\n const { completeCaseType, data } = kwArgs;\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n\n const filteredCols = CaseTypeUtil.getCols(completeCaseType).filter(col => {\n const column = completeCaseType.ref_cols[col.ref_col_id];\n return STRATIFICATION.ALLOWED_COL_TYPES.includes(column.col_type);\n });\n\n return filteredCols.map<StratifiableColumn>(col => {\n const numUniqueValues = uniq(data.map(row => CaseUtil.getRowValue(row.content, col, completeCaseType).raw).filter(x => !!x)).length;\n const enabled = numUniqueValues > 1 && numUniqueValues <= STRATIFICATION.MAX_ALLOWED_UNIQUE_VALUES;\n return {\n col,\n enabled,\n };\n }).sort((a, b) => completeCaseType.ordered_col_ids.indexOf(a.col.id) - completeCaseType.ordered_col_ids.indexOf(b.col.id));\n }\n\n private static getFieldStratification(\n kwArgs: {\n col?: CaseDbCol;\n completeCaseType: CaseDbCompleteCaseType;\n sortedData: CaseDbCase[];\n useExtraGradients?: boolean;\n },\n ): Stratification {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { col, completeCaseType, sortedData, useExtraGradients } = kwArgs;\n if (!col) {\n return null;\n }\n\n const caseIdColors: { [key: string]: string } = {};\n const legendaItems: StratificationLegendaItem[] = [];\n const legendaItemsByColor: { [key: string]: StratificationLegendaItem } = {};\n const legendaItemsByValue: { [key: string]: StratificationLegendaItem } = {};\n\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n\n const uniqueRowValues = StratificationUtil.getUniqueRowValues({ col, completeCaseType, sortedData });\n const legendaItemMissingData: StratificationLegendaItem = {\n caseIds: [],\n color: STRATIFICATION.ITEM_MISSING_COLOR,\n columnType: refCol.col_type,\n rowValue: CaseUtil.getMissingRowValue(''),\n };\n const colors: string[] = [];\n\n if (STRATIFICATION.GRADIENT_COL_TYPES.includes(refCol.col_type) || uniqueRowValues.length > STRATIFICATION.BASE_COLORS.length) {\n let gradient: Range;\n if (STRATIFICATION.GRADIENT_COL_TYPES.includes(refCol.col_type)) {\n gradient = STRATIFICATION.BASE_ORDERED_GRADIENT;\n } else {\n if (useExtraGradients) {\n const numExtraGradients = STRATIFICATION.EXTRA_GRADIENTS.length;\n const dim = completeCaseType.dims[col.dim_id];\n const dims = Object.values(completeCaseType.dims).map(d => d.id);\n const colIndexInCompleteCaseType = dims.indexOf(dim.id);\n gradient = STRATIFICATION.EXTRA_GRADIENTS[colIndexInCompleteCaseType % numExtraGradients];\n } else {\n gradient = STRATIFICATION.BASE_UNORDERED_GRADIENT;\n }\n }\n const conceptSetConceptIds = DataService.getInstance().data.conceptsIdsBySetId[refCol.concept_set_id];\n if (conceptSetConceptIds?.length) {\n const concepts = conceptSetConceptIds.map(conceptId => DataService.getInstance().data.conceptsById[conceptId]).sort(CaseDbDataUtil.conceptComparator);\n if (concepts.every(concept => StratificationUtil.isEpiConceptBoundaryProps(concept.props))) {\n const boundaryProps = concepts.map(concept => concept.props as ConceptBoundaryProps);\n const finiteLbs = boundaryProps.map(bp => bp.lb).filter(v => isFinite(v));\n const finiteUbs = boundaryProps.map(bp => bp.ub).filter(v => isFinite(v));\n const globalMin = Math.min(...finiteLbs, ...finiteUbs);\n const globalMax = Math.max(...finiteLbs, ...finiteUbs);\n if (isFinite(globalMin) && isFinite(globalMax) && globalMax > globalMin) {\n boundaryProps.forEach((bp) => {\n const lb = isFinite(bp.lb) ? bp.lb : globalMin;\n const ub = isFinite(bp.ub) ? bp.ub : globalMax;\n const midpoint = (lb + ub) / 2;\n const gradientPosition = Math.max(0, Math.min(1, (midpoint - globalMin) / (globalMax - globalMin)));\n colors.push(gradient(gradientPosition).toString({ format: 'hex' }));\n });\n }\n }\n }\n\n if (colors.length === 0) {\n uniqueRowValues.forEach((_, index) => {\n colors.push(gradient(index / uniqueRowValues.length).toString({ format: 'hex' }));\n });\n }\n } else {\n colors.push(...STRATIFICATION.BASE_COLORS);\n }\n\n uniqueRowValues.forEach((rowValue, index) => {\n const color = colors[index];\n const legendaItem: StratificationLegendaItem = {\n caseIds: [],\n color,\n columnType: refCol.col_type,\n rowValue,\n };\n legendaItemsByColor[color] = legendaItem;\n legendaItemsByValue[rowValue.raw] = legendaItem;\n legendaItems.push(legendaItem);\n });\n\n sortedData.forEach(row => {\n const rowValue = CaseUtil.getRowValue(row.content, col, completeCaseType);\n if (rowValue.isMissing) {\n legendaItemMissingData.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItemMissingData.color;\n return;\n }\n const legendaItem = legendaItemsByValue[rowValue.raw];\n legendaItem.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItem.color;\n });\n\n if (legendaItemMissingData.caseIds.length > 0) {\n legendaItemsByColor[STRATIFICATION.ITEM_MISSING_COLOR] = legendaItemMissingData;\n legendaItemsByValue[''] = legendaItemMissingData;\n legendaItems.push(legendaItemMissingData);\n }\n\n return {\n caseIdColors,\n col,\n colorForIsMissing: STRATIFICATION.ITEM_MISSING_COLOR,\n legendaItems,\n legendaItemsByColor,\n legendaItemsByValue,\n mode: STRATIFICATION_MODE.FIELD,\n };\n }\n\n private static getSelectionStratification(\n kwArgs: {\n selectedIds: string[];\n sortedData: CaseDbCase[];\n },\n ): Stratification {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { selectedIds, sortedData } = kwArgs;\n const caseIdColors: { [key: string]: string } = {};\n const legendaItems: StratificationLegendaItem[] = [];\n const legendaItemsByColor: { [key: string]: StratificationLegendaItem } = {};\n const legendaItemsByValue: { [key: string]: StratificationLegendaItem } = {};\n\n const rawValues: STRATIFICATION_SELECTED[] = [STRATIFICATION_SELECTED.SELECTED, STRATIFICATION_SELECTED.UNSELECTED];\n\n rawValues.forEach(rawValue => {\n const color = rawValue === STRATIFICATION_SELECTED.SELECTED ? STRATIFICATION.BASE_COLORS[0] : STRATIFICATION.BASE_COLORS[1];\n const presentationValue = rawValue === STRATIFICATION_SELECTED.SELECTED ? t`Selected` : t`Unselected`;\n const legendaItem: StratificationLegendaItem = {\n caseIds: [],\n color,\n rowValue: {\n full: presentationValue,\n isMissing: false,\n long: presentationValue,\n raw: rawValue,\n short: presentationValue,\n },\n };\n legendaItemsByColor[color] = legendaItem;\n legendaItemsByValue[rawValue] = legendaItem;\n legendaItems.push(legendaItem);\n });\n\n sortedData.forEach(row => {\n const legendaItem = selectedIds.includes(row.id) ? legendaItemsByValue[STRATIFICATION_SELECTED.SELECTED] : legendaItemsByValue[STRATIFICATION_SELECTED.UNSELECTED];\n legendaItem.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItem.color;\n });\n\n return {\n caseIdColors,\n colorForIsMissing: STRATIFICATION.ITEM_MISSING_COLOR,\n legendaItems,\n legendaItemsByColor,\n legendaItemsByValue,\n mode: STRATIFICATION_MODE.SELECTION,\n };\n }\n\n private static getSimilarCasesStratification(\n kwArgs: {\n similarCaseIds: string[];\n sortedData: CaseDbCase[];\n },\n ): Stratification {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { similarCaseIds, sortedData } = kwArgs;\n const caseIdColors: { [key: string]: string } = {};\n const legendaItems: StratificationLegendaItem[] = [];\n const legendaItemsByColor: { [key: string]: StratificationLegendaItem } = {};\n const legendaItemsByValue: { [key: string]: StratificationLegendaItem } = {};\n\n const rawValues: STRATIFICATION_SIMILAR_CASE[] = [STRATIFICATION_SIMILAR_CASE.NO, STRATIFICATION_SIMILAR_CASE.YES];\n\n rawValues.forEach(rawValue => {\n const color = rawValue === STRATIFICATION_SIMILAR_CASE.YES ? STRATIFICATION.BASE_COLORS[0] : STRATIFICATION.BASE_COLORS[1];\n const presentationValue = rawValue === STRATIFICATION_SIMILAR_CASE.YES ? t`Cases found by similarity` : t`Regular cases`;\n const legendaItem: StratificationLegendaItem = {\n caseIds: [],\n color,\n rowValue: {\n full: presentationValue,\n isMissing: false,\n long: presentationValue,\n raw: rawValue,\n short: presentationValue,\n },\n };\n legendaItemsByColor[color] = legendaItem;\n legendaItemsByValue[rawValue] = legendaItem;\n legendaItems.push(legendaItem);\n });\n\n sortedData.forEach(row => {\n const legendaItem = similarCaseIds.includes(row.id) ? legendaItemsByValue[STRATIFICATION_SIMILAR_CASE.YES] : legendaItemsByValue[STRATIFICATION_SIMILAR_CASE.NO];\n legendaItem.caseIds.push(row.id);\n caseIdColors[row.id] = legendaItem.color;\n });\n\n return {\n caseIdColors,\n colorForIsMissing: STRATIFICATION.ITEM_MISSING_COLOR,\n legendaItems,\n legendaItemsByColor,\n legendaItemsByValue,\n mode: STRATIFICATION_MODE.SIMILAR_CASES,\n };\n }\n\n private static getUniqueRowValues(\n kwArgs: {\n col?: CaseDbCol;\n completeCaseType: CaseDbCompleteCaseType;\n sortedData: CaseDbCase[];\n },\n ): CaseTypeRowValue[] {\n const { STRATIFICATION } = ConfigService.getInstance<CaseDbConfig>().config.epi;\n const { col, completeCaseType, sortedData } = kwArgs;\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n const conceptSetConceptIds = DataService.getInstance().data.conceptsIdsBySetId[refCol.concept_set_id];\n\n if (conceptSetConceptIds) {\n const uniqueRowValues: CaseTypeRowValue[] = [];\n conceptSetConceptIds.map(conceptId => DataService.getInstance().data.conceptsById[conceptId]).sort((a, b) => {\n if (STRATIFICATION.GRADIENT_COL_TYPES.includes(refCol.col_type) && a.rank !== b.rank) {\n return a.rank - b.rank;\n }\n return a.code.localeCompare(b.code);\n }).forEach((concept) => {\n uniqueRowValues.push({\n full: `${concept.code} (${concept.name})`,\n isMissing: false,\n long: concept.name,\n raw: concept.id,\n short: concept.code,\n });\n });\n return uniqueRowValues;\n }\n const rowValues = sortedData.map(row => CaseUtil.getRowValue(row.content, col, completeCaseType)).filter(x => !x.isMissing);\n const uniqueRowValues = uniqBy(rowValues, (rowValue => rowValue.raw)).sort((a, b) => {\n return StratificationUtil.rowValueComperator(a, b);\n });\n return uniqueRowValues;\n }\n\n private static isEpiConceptBoundaryProps(prop: unknown): prop is ConceptBoundaryProps {\n if (typeof prop !== 'object' || prop === null) {\n return false;\n }\n const propAsEpiConceptBoundaryProps = prop as ConceptBoundaryProps;\n return ['lb', 'lb_in', 'ub', 'ub_in', 'unit'].every(key => key in propAsEpiConceptBoundaryProps);\n }\n\n private static rowValueComperator(a: CaseTypeRowValue, b: CaseTypeRowValue): number {\n if (a.raw === b.raw) {\n return 0;\n }\n if (a.isMissing) {\n return 1;\n }\n if (b.isMissing) {\n return -1;\n }\n return a.short.localeCompare(b.short);\n }\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;CAAA,IAAI,IAAA,EAAA,GACA,IAAA,EA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,MACjG,EAAe,mBAAmB,SAAS,EAAO,QAAQ,KAAK,EAAE,SAAS,EAAE,OACvE,EAAE,OAAO,EAAE,OAEb,EAAE,KAAK,cAAc,EAAE,IAAI,CACnC,CAAC,CAAC,SAAS,MAAY;IACtB,EAAgB,KAAK;KACnB,MAAM,GAAG,EAAQ,KAAK,IAAI,EAAQ,KAAK;KACvC,WAAW;KACX,MAAM,EAAQ;KACd,KAAK,EAAQ;KACb,OAAO,EAAQ;IACjB,CAAC;GACH,CAAC,GACM;EACT;EACA,IAAM,IAAY,EAAW,KAAI,MAAO,EAAS,YAAY,EAAI,SAAS,GAAK,CAAgB,CAAC,CAAC,CAAC,QAAO,MAAK,CAAC,EAAE,SAAS;EAI1H,QAAA,GAHwB,EAAA,QAAA,CAAO,KAAY,MAAY,EAAS,IAAI,CAAC,CAAC,MAAM,GAAG,MACtE,EAAmB,mBAAmB,GAAG,CAAC,CAE5C;CACT;CAEA,OAAe,0BAA0B,GAA6C;EACpF,IAAI,OAAO,KAAS,aAAY,GAC9B,OAAO;EAET,IAAM,IAAgC;EACtC,OAAO;GAAC;GAAM;GAAS;GAAM;GAAS;EAAM,CAAC,CAAC,OAAM,MAAO,KAAO,CAA6B;CACjG;CAEA,OAAe,mBAAmB,GAAqB,GAA6B;EAUlF,OATI,EAAE,QAAQ,EAAE,MACP,IAEL,EAAE,YACG,IAEL,EAAE,YACG,KAEF,EAAE,MAAM,cAAc,EAAE,KAAK;CACtC;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyObject, ObjectSchema } from 'yup';
|
|
2
2
|
import { CaseDbCaseBatchUploadResult, CaseDbCaseForUpload, CaseDbCaseType, CaseDbCaseUploadResult, CaseDbCol, CaseDbCompleteCaseType } from '@gen-epix/api-casedb';
|
|
3
|
-
import { AutoCompleteOption, FormFieldDefinition, OptionBase } from '@gen-epix/ui-form/models/form';
|
|
3
|
+
import { AutoCompleteOption, FormFieldDefinition, OptionBase } from '@gen-epix/ui-core-form/models/form';
|
|
4
4
|
import { UploadCompleteColStats, UploadMappedColumn, UploadMappedColumnsFormFields, UploadSequenceMapping } from '../../models/upload';
|
|
5
5
|
export declare class UploadUtil {
|
|
6
6
|
static readonly caseDateColumnAliases: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gen-epix/ui-client-casedb",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -679,11 +679,11 @@
|
|
|
679
679
|
"@emotion/styled": "*",
|
|
680
680
|
"@gen-epix/api-casedb": "^4.0.0",
|
|
681
681
|
"@gen-epix/api-commondb": "^4.0.0",
|
|
682
|
-
"@gen-epix/ui-core": "^3.0.
|
|
683
|
-
"@gen-epix/ui-core-components": "^4.0.
|
|
684
|
-
"@gen-epix/ui-client-common": "^4.0.
|
|
685
|
-
"@gen-epix/ui-phylogenetic-tree": "^3.0.
|
|
686
|
-
"@gen-epix/ui-core-form": "^4.0.
|
|
682
|
+
"@gen-epix/ui-core": "^3.0.1",
|
|
683
|
+
"@gen-epix/ui-core-components": "^4.0.1",
|
|
684
|
+
"@gen-epix/ui-client-common": "^4.0.1",
|
|
685
|
+
"@gen-epix/ui-phylogenetic-tree": "^3.0.1",
|
|
686
|
+
"@gen-epix/ui-core-form": "^4.0.1",
|
|
687
687
|
"@mui/icons-material": "*",
|
|
688
688
|
"@mui/material": "*",
|
|
689
689
|
"@mui/styled-engine": "*",
|
|
@@ -726,13 +726,13 @@
|
|
|
726
726
|
"@emotion/styled": "11.14.1",
|
|
727
727
|
"@gen-epix/api-casedb": "^4.0.0",
|
|
728
728
|
"@gen-epix/api-commondb": "^4.0.0",
|
|
729
|
-
"@gen-epix/ui-core": "^3.0.
|
|
730
|
-
"@gen-epix/ui-core-components": "^4.0.
|
|
731
|
-
"@gen-epix/ui-phylogenetic-tree": "^3.0.
|
|
732
|
-
"@gen-epix/ui-core-form": "^4.0.
|
|
729
|
+
"@gen-epix/ui-core": "^3.0.1",
|
|
730
|
+
"@gen-epix/ui-core-components": "^4.0.1",
|
|
731
|
+
"@gen-epix/ui-phylogenetic-tree": "^3.0.1",
|
|
732
|
+
"@gen-epix/ui-core-form": "^4.0.1",
|
|
733
733
|
"@gen-epix/eslint-config": "0.5.0",
|
|
734
734
|
"@gen-epix/translation-util": "0.2.0",
|
|
735
|
-
"@gen-epix/ui-client-common": "^4.0.
|
|
735
|
+
"@gen-epix/ui-client-common": "^4.0.1",
|
|
736
736
|
"@hookform/resolvers": "5.9.1",
|
|
737
737
|
"@mui/icons-material": "9.4.0",
|
|
738
738
|
"@mui/material": "9.4.0",
|