@gen-epix/ui 1.14.4 → 1.15.0

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.
Files changed (739) hide show
  1. package/README.md +3 -3
  2. package/dist/index.js +27287 -27948
  3. package/package.json +94 -84
  4. package/src/@types/environment.d.ts +54 -0
  5. package/src/api/api.ts +43576 -0
  6. package/src/api/base.ts +111 -0
  7. package/src/api/common.ts +168 -0
  8. package/src/api/configuration.ts +118 -0
  9. package/src/api/index.ts +20 -0
  10. package/src/assets/icons/CollectionIcon.svg +1 -0
  11. package/src/assets/icons/DnaIcon.svg +1 -0
  12. package/src/assets/icons/VirusIcon.svg +1 -0
  13. package/src/assets/logo/logo-rijksoverheid.svg +42 -0
  14. package/src/assets/logo/logo-rivm.svg +6 -0
  15. package/src/classes/Subject/Subject.ts +26 -0
  16. package/src/classes/Subject/index.ts +1 -0
  17. package/src/classes/TableEventBus/TableEventBus.ts +14 -0
  18. package/src/classes/TableEventBus/index.ts +1 -0
  19. package/src/classes/abstracts/EventBusAbstract/EventBusAbstract.ts +37 -0
  20. package/src/classes/abstracts/EventBusAbstract/index.ts +1 -0
  21. package/src/classes/abstracts/FilterAbstract/FilterAbstract.ts +54 -0
  22. package/src/classes/abstracts/FilterAbstract/index.ts +1 -0
  23. package/src/classes/abstracts/SubscribableAbstract/SubscribableAbstract.ts +20 -0
  24. package/src/classes/abstracts/SubscribableAbstract/index.ts +1 -0
  25. package/src/classes/errors/UploadError.ts +11 -0
  26. package/src/classes/errors/index.ts +1 -0
  27. package/src/classes/filters/BooleanFilter.ts +31 -0
  28. package/src/classes/filters/DateFilter.ts +133 -0
  29. package/src/classes/filters/GeoFilter.ts +60 -0
  30. package/src/classes/filters/MultiSelectFilter.ts +70 -0
  31. package/src/classes/filters/NumberRangeFilter.ts +82 -0
  32. package/src/classes/filters/SelectionFilter.ts +25 -0
  33. package/src/classes/filters/TextFilter.ts +36 -0
  34. package/src/classes/filters/TreeFilter.ts +22 -0
  35. package/src/classes/managers/AuthenticationManager/AuthenticationManager.ts +94 -0
  36. package/src/classes/managers/AuthenticationManager/index.ts +1 -0
  37. package/src/classes/managers/AuthorizationManager/AuthorizationManager.ts +70 -0
  38. package/src/classes/managers/AuthorizationManager/index.ts +1 -0
  39. package/src/classes/managers/BackendVersionManager/BackendVersionManager.ts +23 -0
  40. package/src/classes/managers/BackendVersionManager/index.ts +1 -0
  41. package/src/classes/managers/BreadcrumbManager/BreadcrumbManager.ts +30 -0
  42. package/src/classes/managers/BreadcrumbManager/index.ts +1 -0
  43. package/src/classes/managers/ConfigManager/ConfigManager.ts +31 -0
  44. package/src/classes/managers/ConfigManager/index.ts +1 -0
  45. package/src/classes/managers/DevicePixelRatioManager/DevicePixelRatioManager.ts +27 -0
  46. package/src/classes/managers/DevicePixelRatioManager/index.ts +1 -0
  47. package/src/classes/managers/EmotionCacheManager/EmotionCacheManager.ts +27 -0
  48. package/src/classes/managers/EmotionCacheManager/index.ts +1 -0
  49. package/src/classes/managers/EpiDataManager/EpiDataManager.ts +196 -0
  50. package/src/classes/managers/EpiDataManager/index.ts +1 -0
  51. package/src/classes/managers/EpiEventBusManager/EpiEventBusManager.ts +61 -0
  52. package/src/classes/managers/EpiEventBusManager/index.ts +1 -0
  53. package/src/classes/managers/EpiHighlightingManager/EpiHighlightingManager.ts +32 -0
  54. package/src/classes/managers/EpiHighlightingManager/index.ts +1 -0
  55. package/src/classes/managers/EpiLineListCaseSetMembersManager/EpiListsCaseSetMembersManager.ts +118 -0
  56. package/src/classes/managers/EpiLineListCaseSetMembersManager/index.ts +1 -0
  57. package/src/classes/managers/FeatureFlagsManager/FeatureFlagsManager.ts +30 -0
  58. package/src/classes/managers/FeatureFlagsManager/index.ts +1 -0
  59. package/src/classes/managers/I18nManager/I18nManager.ts +105 -0
  60. package/src/classes/managers/I18nManager/index.ts +1 -0
  61. package/src/classes/managers/InactivityManager/InactivityManager.ts +119 -0
  62. package/src/classes/managers/InactivityManager/index.ts +1 -0
  63. package/src/classes/managers/KeyboardShortcutManager/KeyboardShortcutManager.ts +78 -0
  64. package/src/classes/managers/KeyboardShortcutManager/index.ts +1 -0
  65. package/src/classes/managers/LogManager/LogManager.ts +151 -0
  66. package/src/classes/managers/LogManager/index.ts +1 -0
  67. package/src/classes/managers/NavigationHistoryManager/NavigationHistoryManager.ts +16 -0
  68. package/src/classes/managers/NavigationHistoryManager/index.ts +1 -0
  69. package/src/classes/managers/NotificationManager/NotificationManager.ts +104 -0
  70. package/src/classes/managers/NotificationManager/index.ts +1 -0
  71. package/src/classes/managers/PageEventBusManager/PageEventBusManager.ts +116 -0
  72. package/src/classes/managers/PageEventBusManager/index.ts +1 -0
  73. package/src/classes/managers/QueryClientManager/QueryClientManager.ts +51 -0
  74. package/src/classes/managers/QueryClientManager/index.ts +1 -0
  75. package/src/classes/managers/RouterManager/RouterManager.ts +25 -0
  76. package/src/classes/managers/RouterManager/index.ts +1 -0
  77. package/src/classes/managers/UserSettingsManager/UserSettingsManager.ts +16 -0
  78. package/src/classes/managers/UserSettingsManager/index.ts +1 -0
  79. package/src/classes/managers/WindowManager/WindowManager.test.ts +23 -0
  80. package/src/classes/managers/WindowManager/WindowManager.ts +26 -0
  81. package/src/classes/managers/WindowManager/index.ts +1 -0
  82. package/src/components/app/App/App.tsx +58 -0
  83. package/src/components/app/App/index.ts +1 -0
  84. package/src/components/app/ApplicationBootstrap/ApplicationBootstrap.tsx +223 -0
  85. package/src/components/app/ApplicationBootstrap/index.ts +1 -0
  86. package/src/components/app/RouterRoot/RouterRoot.tsx +187 -0
  87. package/src/components/app/RouterRoot/index.ts +1 -0
  88. package/src/components/epi/EpiAddCasesToEventDialog/EpiAddCasesToEventDialog.tsx +347 -0
  89. package/src/components/epi/EpiAddCasesToEventDialog/EpiAddCasesToEventDialogSuccessNotificationMessage.tsx +38 -0
  90. package/src/components/epi/EpiAddCasesToEventDialog/index.ts +1 -0
  91. package/src/components/epi/EpiBulkEditCaseDialog/EpiBulkEditCaseDialog.tsx +61 -0
  92. package/src/components/epi/EpiBulkEditCaseDialog/index.ts +1 -0
  93. package/src/components/epi/EpiCaseInfoDialog/EpiCaseCaseSetInfo.tsx +137 -0
  94. package/src/components/epi/EpiCaseInfoDialog/EpiCaseContent.tsx +127 -0
  95. package/src/components/epi/EpiCaseInfoDialog/EpiCaseForm.tsx +111 -0
  96. package/src/components/epi/EpiCaseInfoDialog/EpiCaseInfoDialog.tsx +377 -0
  97. package/src/components/epi/EpiCaseInfoDialog/EpiCaseSharingForm.tsx +140 -0
  98. package/src/components/epi/EpiCaseInfoDialog/EpiCaseSharingInfo.tsx +23 -0
  99. package/src/components/epi/EpiCaseInfoDialog/EpiReadOnlyCaseContent.tsx +89 -0
  100. package/src/components/epi/EpiCaseInfoDialog/index.ts +1 -0
  101. package/src/components/epi/EpiCaseSetInfoDialog/EpiCaseSetContent.tsx +108 -0
  102. package/src/components/epi/EpiCaseSetInfoDialog/EpiCaseSetDescription.tsx +34 -0
  103. package/src/components/epi/EpiCaseSetInfoDialog/EpiCaseSetForm.tsx +151 -0
  104. package/src/components/epi/EpiCaseSetInfoDialog/EpiCaseSetInfoDialog.tsx +389 -0
  105. package/src/components/epi/EpiCaseSetInfoDialog/EpiCaseSetSharingForm.tsx +155 -0
  106. package/src/components/epi/EpiCaseSetInfoDialog/EpiCaseSetSharingInfo.tsx +23 -0
  107. package/src/components/epi/EpiCaseSetInfoDialog/index.ts +1 -0
  108. package/src/components/epi/EpiCaseSummary/EpiCaseSummary.tsx +141 -0
  109. package/src/components/epi/EpiCaseSummary/index.ts +1 -0
  110. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoAccessRights.tsx +91 -0
  111. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoColAccessRights.tsx +118 -0
  112. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoData.tsx +38 -0
  113. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoDialog.tsx +39 -0
  114. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoDialogContent.tsx +169 -0
  115. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoDialogWithLoader.tsx +42 -0
  116. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoRegions.tsx +87 -0
  117. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoTrees.tsx +73 -0
  118. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoValues.tsx +61 -0
  119. package/src/components/epi/EpiCaseTypeInfoDialog/EpiCaseTypeInfoVariableDetails.tsx +151 -0
  120. package/src/components/epi/EpiCaseTypeInfoDialog/index.ts +10 -0
  121. package/src/components/epi/EpiCasesAlreadyInCaseSetWarning/EpiCasesAlreadyInCaseSetWarning.tsx +190 -0
  122. package/src/components/epi/EpiCasesAlreadyInCaseSetWarning/EpiCasesAlreadyInCaseSetWarningCaseSetLink.tsx +62 -0
  123. package/src/components/epi/EpiCasesAlreadyInCaseSetWarning/index.ts +1 -0
  124. package/src/components/epi/EpiCompletCaseTypeLoader/EpiCompletCaseTypeLoader.tsx +87 -0
  125. package/src/components/epi/EpiCompletCaseTypeLoader/index.ts +1 -0
  126. package/src/components/epi/EpiContactDetailsDialog/EpiContactDetailsDialog.tsx +151 -0
  127. package/src/components/epi/EpiContactDetailsDialog/index.ts +1 -0
  128. package/src/components/epi/EpiContextMenu/EpiContextMenu.tsx +155 -0
  129. package/src/components/epi/EpiContextMenu/index.ts +1 -0
  130. package/src/components/epi/EpiCreateEventDialog/EpiCreateEventDialog.tsx +386 -0
  131. package/src/components/epi/EpiCreateEventDialog/EpiCreateEventDialogSuccessNotificationMessage.tsx +30 -0
  132. package/src/components/epi/EpiCreateEventDialog/index.ts +1 -0
  133. package/src/components/epi/EpiCurve/EpiCurve.tsx +525 -0
  134. package/src/components/epi/EpiCurve/index.ts +1 -0
  135. package/src/components/epi/EpiCustomTabPanel/EpiCustomTabPanel.tsx +27 -0
  136. package/src/components/epi/EpiCustomTabPanel/index.ts +1 -0
  137. package/src/components/epi/EpiDashboard/EpiDashboard.tsx +390 -0
  138. package/src/components/epi/EpiDashboard/EpiDashboardDownloadSidebarItem.tsx +154 -0
  139. package/src/components/epi/EpiDashboard/EpiDashboardGeneralSettingsForm.tsx +89 -0
  140. package/src/components/epi/EpiDashboard/EpiDashboardLayoutRenderer.tsx +248 -0
  141. package/src/components/epi/EpiDashboard/EpiDashboardLayoutSettingsForm.tsx +160 -0
  142. package/src/components/epi/EpiDashboard/EpiDashboardSettingsSidebarItem.tsx +93 -0
  143. package/src/components/epi/EpiDashboard/EpiDashboardTreeSettingsForm.tsx +90 -0
  144. package/src/components/epi/EpiDashboard/index.ts +1 -0
  145. package/src/components/epi/EpiDashboardStoreLoader/EpiDashboardStoreLoader.tsx +34 -0
  146. package/src/components/epi/EpiDashboardStoreLoader/EpiDashboardStoreLoaderContent.tsx +73 -0
  147. package/src/components/epi/EpiDashboardStoreLoader/index.ts +2 -0
  148. package/src/components/epi/EpiDashboardStoreLoader/withEpiDashboardStore.tsx +19 -0
  149. package/src/components/epi/EpiDataCollectionAccessInfo/EpiDataCollectionAccessInfo.tsx +88 -0
  150. package/src/components/epi/EpiDataCollectionAccessInfo/index.ts +1 -0
  151. package/src/components/epi/EpiFindSimilarCasesDialog/EpiFindSimilarCasesDialog.tsx +302 -0
  152. package/src/components/epi/EpiFindSimilarCasesDialog/index.ts +1 -0
  153. package/src/components/epi/EpiLegendaItem/EpiLegendaItem.tsx +106 -0
  154. package/src/components/epi/EpiLegendaItem/index.ts +1 -0
  155. package/src/components/epi/EpiLineList/EpiLineList.tsx +492 -0
  156. package/src/components/epi/EpiLineList/EpiLineListPrimaryMenu.tsx +189 -0
  157. package/src/components/epi/EpiLineList/EpiLineListSecondaryMenu.tsx +56 -0
  158. package/src/components/epi/EpiLineList/EpiLineListTitle.tsx +28 -0
  159. package/src/components/epi/EpiLineList/index.ts +1 -0
  160. package/src/components/epi/EpiLineList/useEpiLineListEmitDownloadOptions.tsx +102 -0
  161. package/src/components/epi/EpiMap/EpiMap.tsx +547 -0
  162. package/src/components/epi/EpiMap/index.ts +1 -0
  163. package/src/components/epi/EpiRemoveCasesFromEventDialog/EpiRemoveCasesFromEventDialog.tsx +169 -0
  164. package/src/components/epi/EpiRemoveCasesFromEventDialog/index.ts +1 -0
  165. package/src/components/epi/EpiRemoveFindSimilarCasesResultDialog/EpiRemoveFindSimilarCasesResultDialog.tsx +216 -0
  166. package/src/components/epi/EpiSequenceDownloadDialog/EpiSequenceDownloadDialog.tsx +151 -0
  167. package/src/components/epi/EpiSequenceDownloadDialog/index.ts +1 -0
  168. package/src/components/epi/EpiStratification/EpiStratification.tsx +241 -0
  169. package/src/components/epi/EpiStratification/index.ts +1 -0
  170. package/src/components/epi/EpiTree/EpiTree.tsx +906 -0
  171. package/src/components/epi/EpiTree/index.ts +1 -0
  172. package/src/components/epi/EpiTreeDescription/EpiTreeDescription.tsx +71 -0
  173. package/src/components/epi/EpiTreeDescription/index.ts +1 -0
  174. package/src/components/epi/EpiUpload/EpiUpload.tsx +107 -0
  175. package/src/components/epi/EpiUpload/EpiUploadCaseResultTable.tsx +383 -0
  176. package/src/components/epi/EpiUpload/EpiUploadCreateCases.tsx +266 -0
  177. package/src/components/epi/EpiUpload/EpiUploadMapColumns.tsx +261 -0
  178. package/src/components/epi/EpiUpload/EpiUploadMapSequences.tsx +332 -0
  179. package/src/components/epi/EpiUpload/EpiUploadNavigation.tsx +52 -0
  180. package/src/components/epi/EpiUpload/EpiUploadSelectFile.tsx +285 -0
  181. package/src/components/epi/EpiUpload/EpiUploadSelectSequenceFiles.tsx +375 -0
  182. package/src/components/epi/EpiUpload/EpiUploadValidate.tsx +199 -0
  183. package/src/components/epi/EpiUpload/EpiUploadValidateNavigation.tsx +34 -0
  184. package/src/components/epi/EpiUpload/index.ts +1 -0
  185. package/src/components/epi/EpiUserRightsDialog/EpiUserRightsDialog.tsx +101 -0
  186. package/src/components/epi/EpiUserRightsDialog/EpiUserRightsDialogCaseAccessPolicy.tsx +160 -0
  187. package/src/components/epi/EpiUserRightsDialog/index.ts +1 -0
  188. package/src/components/epi/EpiWarning/EpiWarning.tsx +39 -0
  189. package/src/components/epi/EpiWarning/index.ts +1 -0
  190. package/src/components/epi/EpiWidget/EpiWidget.tsx +255 -0
  191. package/src/components/epi/EpiWidget/index.ts +1 -0
  192. package/src/components/epi/EpiWidgetHeaderIconButton/EpiWidgetHeaderIconButton.tsx +40 -0
  193. package/src/components/epi/EpiWidgetHeaderIconButton/index.ts +1 -0
  194. package/src/components/epi/EpiWidgetMenu/EpiWidgetMenu.tsx +56 -0
  195. package/src/components/epi/EpiWidgetMenu/index.ts +1 -0
  196. package/src/components/epi/EpiWidgetUnavailable/EpiWidgetUnavailable.tsx +51 -0
  197. package/src/components/epi/EpiWidgetUnavailable/index.ts +1 -0
  198. package/src/components/filters/BooleanFilterField/BooleanFilterField.tsx +26 -0
  199. package/src/components/filters/BooleanFilterField/index.ts +1 -0
  200. package/src/components/filters/DateFilterField/DateFilterField.tsx +23 -0
  201. package/src/components/filters/DateFilterField/index.ts +1 -0
  202. package/src/components/filters/GeoFilterField/GeoFilterField.tsx +32 -0
  203. package/src/components/filters/GeoFilterField/index.ts +1 -0
  204. package/src/components/filters/MultiSelectFilterField/MultiSelectFilterField.tsx +31 -0
  205. package/src/components/filters/MultiSelectFilterField/index.ts +1 -0
  206. package/src/components/filters/NumberRangeFilterField/NumberRangeFilterField.tsx +20 -0
  207. package/src/components/filters/NumberRangeFilterField/index.ts +1 -0
  208. package/src/components/filters/TextFilterField/TextFilterField.tsx +18 -0
  209. package/src/components/filters/TextFilterField/index.ts +1 -0
  210. package/src/components/form/fields/Autocomplete/Autocomplete.tsx +270 -0
  211. package/src/components/form/fields/Autocomplete/index.ts +1 -0
  212. package/src/components/form/fields/CheckboxGroup/CheckboxGroup.tsx +192 -0
  213. package/src/components/form/fields/CheckboxGroup/index.ts +1 -0
  214. package/src/components/form/fields/DatePicker/DatePicker.tsx +167 -0
  215. package/src/components/form/fields/DatePicker/index.ts +1 -0
  216. package/src/components/form/fields/DateRangePicker/DateRangePicker.tsx +359 -0
  217. package/src/components/form/fields/DateRangePicker/index.ts +1 -0
  218. package/src/components/form/fields/NumberField/NumberField.tsx +277 -0
  219. package/src/components/form/fields/NumberField/index.ts +1 -0
  220. package/src/components/form/fields/NumberRangeInput/NumberRangeInput.tsx +297 -0
  221. package/src/components/form/fields/NumberRangeInput/index.ts +1 -0
  222. package/src/components/form/fields/RadioGroup/RadioGroup.tsx +130 -0
  223. package/src/components/form/fields/RadioGroup/index.ts +1 -0
  224. package/src/components/form/fields/RichTextEditor/RichTextEditor.tsx +321 -0
  225. package/src/components/form/fields/RichTextEditor/RichTextEditorContent.tsx +34 -0
  226. package/src/components/form/fields/RichTextEditor/index.ts +2 -0
  227. package/src/components/form/fields/RichTextEditor/useRichTextEditorExtensions.ts +174 -0
  228. package/src/components/form/fields/Select/Select.tsx +219 -0
  229. package/src/components/form/fields/Select/index.ts +1 -0
  230. package/src/components/form/fields/Switch/Switch.tsx +116 -0
  231. package/src/components/form/fields/Switch/index.ts +1 -0
  232. package/src/components/form/fields/TextField/TextField.tsx +170 -0
  233. package/src/components/form/fields/TextField/index.ts +1 -0
  234. package/src/components/form/fields/ToggleButtonGroup/ToggleButtonGroup.tsx +118 -0
  235. package/src/components/form/fields/ToggleButtonGroup/index.ts +1 -0
  236. package/src/components/form/fields/TransferList/TransferList.tsx +360 -0
  237. package/src/components/form/fields/TransferList/index.ts +1 -0
  238. package/src/components/form/fields/UploadButton/UploadButton.tsx +157 -0
  239. package/src/components/form/helpers/FormFieldHelperText/FormFieldHelperText.tsx +68 -0
  240. package/src/components/form/helpers/FormFieldHelperText/index.ts +1 -0
  241. package/src/components/form/helpers/FormFieldLoadingIndicator/FormFieldLoadingIndicator.tsx +22 -0
  242. package/src/components/form/helpers/FormFieldLoadingIndicator/index.ts +1 -0
  243. package/src/components/form/helpers/GenericForm/GenericForm.tsx +187 -0
  244. package/src/components/form/helpers/GenericForm/index.ts +1 -0
  245. package/src/components/ui/ApplicationBar/ApplicationBar.tsx +74 -0
  246. package/src/components/ui/ApplicationBar/ApplicationBarActions.tsx +124 -0
  247. package/src/components/ui/ApplicationBar/ApplicationBarActionsFeedbackItem.tsx +102 -0
  248. package/src/components/ui/ApplicationBar/ApplicationBarActionsInfotem.tsx +60 -0
  249. package/src/components/ui/ApplicationBar/ApplicationBarActionsNotificationsItem.tsx +82 -0
  250. package/src/components/ui/ApplicationBar/ApplicationBarActionsOrganizationSwitcherItem.tsx +58 -0
  251. package/src/components/ui/ApplicationBar/ApplicationBarActionsOutagesItem.tsx +75 -0
  252. package/src/components/ui/ApplicationBar/ApplicationBarActionsUserItem.tsx +60 -0
  253. package/src/components/ui/ApplicationBar/ApplicationBarNavigationMenu.tsx +159 -0
  254. package/src/components/ui/ApplicationBar/InfoMenu.tsx +120 -0
  255. package/src/components/ui/ApplicationBar/UserMenu.tsx +208 -0
  256. package/src/components/ui/ApplicationBar/UserOrganizationAdminMenuItem.tsx +69 -0
  257. package/src/components/ui/ApplicationBar/UserOwnOrganizationMenuItem.tsx +54 -0
  258. package/src/components/ui/ApplicationBar/index.ts +1 -0
  259. package/src/components/ui/ApplicationFooter/ApplicationFooter.tsx +121 -0
  260. package/src/components/ui/ApplicationFooter/ApplicationFooterLink.tsx +48 -0
  261. package/src/components/ui/ApplicationFooter/ApplicationFooterLinkSection.tsx +56 -0
  262. package/src/components/ui/ApplicationFooter/index.ts +1 -0
  263. package/src/components/ui/AuthenticationWrapper/AuthenticationWrapper.tsx +208 -0
  264. package/src/components/ui/AuthenticationWrapper/index.ts +1 -0
  265. package/src/components/ui/AuthorizationWrapper/AuthorizationWrapper.tsx +75 -0
  266. package/src/components/ui/AuthorizationWrapper/index.ts +1 -0
  267. package/src/components/ui/Breadcrumbs/Breadcrumbs.tsx +92 -0
  268. package/src/components/ui/Breadcrumbs/index.ts +1 -0
  269. package/src/components/ui/Confirmation/Confirmation.tsx +10 -0
  270. package/src/components/ui/Confirmation/ConfirmationRender.tsx +81 -0
  271. package/src/components/ui/Confirmation/index.ts +2 -0
  272. package/src/components/ui/ConsentDialog/ConsentDialog.tsx +57 -0
  273. package/src/components/ui/ConsentDialog/index.ts +1 -0
  274. package/src/components/ui/CopyToClipboardButton/CopyToClipboardButton.tsx +94 -0
  275. package/src/components/ui/CopyToClipboardButton/index.ts +1 -0
  276. package/src/components/ui/Dialog/Dialog.tsx +196 -0
  277. package/src/components/ui/Dialog/index.ts +1 -0
  278. package/src/components/ui/FileSelector/FileSelector.tsx +358 -0
  279. package/src/components/ui/FileSelector/index.ts +1 -0
  280. package/src/components/ui/GenericErrorMessage/GenericErrorMessage.tsx +168 -0
  281. package/src/components/ui/GenericErrorMessage/index.ts +1 -0
  282. package/src/components/ui/HomePageTrends/HomePageTrendCard.tsx +132 -0
  283. package/src/components/ui/HomePageTrends/HomePageTrends.tsx +312 -0
  284. package/src/components/ui/HomePageTrends/index.ts +1 -0
  285. package/src/components/ui/LicensesDialog/LicensesDialog.tsx +231 -0
  286. package/src/components/ui/LicensesDialog/index.ts +1 -0
  287. package/src/components/ui/LinearProgressWithLabel/LinearProgressWithLabel.tsx +31 -0
  288. package/src/components/ui/LinearProgressWithLabel/index.ts +1 -0
  289. package/src/components/ui/LoadingIndicator/LoadingIndicator.tsx +11 -0
  290. package/src/components/ui/LoadingIndicator/index.ts +1 -0
  291. package/src/components/ui/MyPermissionsDialog/MyPermissionsDialog.tsx +95 -0
  292. package/src/components/ui/MyPermissionsDialog/index.ts +1 -0
  293. package/src/components/ui/NavLink/NavLink.tsx +47 -0
  294. package/src/components/ui/NavLink/index.ts +1 -0
  295. package/src/components/ui/NestedMenu/IconMenuItem.tsx +64 -0
  296. package/src/components/ui/NestedMenu/NestedDropdown.tsx +133 -0
  297. package/src/components/ui/NestedMenu/NestedMenuItem.tsx +250 -0
  298. package/src/components/ui/NestedMenu/index.ts +4 -0
  299. package/src/components/ui/NestedMenu/nestedMenuItemsFromObject.tsx +98 -0
  300. package/src/components/ui/Notifications/NotificationItem.tsx +70 -0
  301. package/src/components/ui/Notifications/NotificationsDrawer.tsx +161 -0
  302. package/src/components/ui/Notifications/NotificationsStack.tsx +45 -0
  303. package/src/components/ui/Notifications/index.ts +2 -0
  304. package/src/components/ui/OrganizationSwitcherDialog/OrganizationSwitcherDialog.tsx +204 -0
  305. package/src/components/ui/OrganizationSwitcherDialog/index.ts +1 -0
  306. package/src/components/ui/OutageList/OutageItem.tsx +48 -0
  307. package/src/components/ui/OutageList/OutageList.tsx +54 -0
  308. package/src/components/ui/OutageList/OutageSection.tsx +39 -0
  309. package/src/components/ui/OutageList/index.ts +1 -0
  310. package/src/components/ui/OutagesDialog/OutagesDialog.tsx +71 -0
  311. package/src/components/ui/OutagesDialog/index.ts +1 -0
  312. package/src/components/ui/PageContainer/PageContainer.tsx +207 -0
  313. package/src/components/ui/PageContainer/index.ts +1 -0
  314. package/src/components/ui/PanelSeparator/PanelResizeHandle.tsx +67 -0
  315. package/src/components/ui/PanelSeparator/index.ts +1 -0
  316. package/src/components/ui/ResponseHandler/ResponseHandler.tsx +79 -0
  317. package/src/components/ui/ResponseHandler/index.ts +1 -0
  318. package/src/components/ui/Sidebar/SidebarItem.tsx +138 -0
  319. package/src/components/ui/Sidebar/SidebarMenu.tsx +33 -0
  320. package/src/components/ui/Sidebar/SidebarMenuItem.tsx +61 -0
  321. package/src/components/ui/Sidebar/index.ts +3 -0
  322. package/src/components/ui/SortableList/SortableList.tsx +172 -0
  323. package/src/components/ui/SortableList/SortableListItem.tsx +73 -0
  324. package/src/components/ui/SortableList/SortableListItemDragHandle.tsx +53 -0
  325. package/src/components/ui/SortableList/SortableOverlay.tsx +35 -0
  326. package/src/components/ui/SortableList/context/SortableListItemContext.tsx +17 -0
  327. package/src/components/ui/SortableList/context/SortableListItemContextProvider.tsx +19 -0
  328. package/src/components/ui/SortableList/context/useSortableListItemContext.tsx +5 -0
  329. package/src/components/ui/Spinner/Spinner.tsx +84 -0
  330. package/src/components/ui/Spinner/index.ts +1 -0
  331. package/src/components/ui/Stepper/Stepper.tsx +194 -0
  332. package/src/components/ui/Stepper/index.ts +2 -0
  333. package/src/components/ui/Stepper/stepperModel.ts +4 -0
  334. package/src/components/ui/Table/Table.tsx +812 -0
  335. package/src/components/ui/Table/TableActionsCell.tsx +81 -0
  336. package/src/components/ui/Table/TableCaption.tsx +33 -0
  337. package/src/components/ui/Table/TableCell.tsx +162 -0
  338. package/src/components/ui/Table/TableCellAsyncContent.tsx +28 -0
  339. package/src/components/ui/Table/TableCheckboxCell.tsx +65 -0
  340. package/src/components/ui/Table/TableCheckboxHeader.tsx +72 -0
  341. package/src/components/ui/Table/TableColumnsEditorDialog.tsx +241 -0
  342. package/src/components/ui/Table/TableFilter.tsx +31 -0
  343. package/src/components/ui/Table/TableFiltersSidebarItem.tsx +398 -0
  344. package/src/components/ui/Table/TableHeader.tsx +40 -0
  345. package/src/components/ui/Table/TableHeaderCell.tsx +434 -0
  346. package/src/components/ui/Table/TableHeaderFilter.tsx +104 -0
  347. package/src/components/ui/Table/TableMenu.tsx +26 -0
  348. package/src/components/ui/Table/TableReadableIndexCell.tsx +65 -0
  349. package/src/components/ui/Table/TableSidebarMenu.tsx +59 -0
  350. package/src/components/ui/Table/classNames.ts +7 -0
  351. package/src/components/ui/Table/index.ts +12 -0
  352. package/src/components/ui/UserFeedbackDialog/UserFeedbackDialog.tsx +168 -0
  353. package/src/components/ui/UserFeedbackDialog/index.ts +1 -0
  354. package/src/components/ui/UserInactivityConfirmation/UserInactivityConfirmation.tsx +59 -0
  355. package/src/components/ui/UserInactivityConfirmation/index.ts +1 -0
  356. package/src/components/ui/UsersEffectiveRightsDetailsDialog/UsersEffectiveRightsDetailsDialog.tsx +584 -0
  357. package/src/components/ui/UsersEffectiveRightsDetailsDialog/index.ts +1 -0
  358. package/src/context/caseAbac/CaseAbacContext.tsx +24 -0
  359. package/src/context/caseAbac/CaseAbacContextProvider.tsx +69 -0
  360. package/src/context/caseAbac/index.ts +3 -0
  361. package/src/context/caseAbac/useCaseAbacContext.tsx +6 -0
  362. package/src/context/caseTypeAbac/CaseTypeAbacContext.tsx +16 -0
  363. package/src/context/caseTypeAbac/CaseTypeAbacContextProvider.tsx +40 -0
  364. package/src/context/caseTypeAbac/index.ts +3 -0
  365. package/src/context/caseTypeAbac/useCaseTypeAbacContext.tsx +6 -0
  366. package/src/data/date.ts +8 -0
  367. package/src/data/queryDependencies.ts +166 -0
  368. package/src/dataHooks/useAssemblyProtocolsQuery/index.ts +1 -0
  369. package/src/dataHooks/useAssemblyProtocolsQuery/useAssemblyProtocolsQuery.ts +39 -0
  370. package/src/dataHooks/useCaseRightsQuery/index.ts +1 -0
  371. package/src/dataHooks/useCaseRightsQuery/useCaseRightsQuery.ts +21 -0
  372. package/src/dataHooks/useCaseSetCategoriesQuery/index.ts +1 -0
  373. package/src/dataHooks/useCaseSetCategoriesQuery/useCaseSetCategoriesQuery.ts +39 -0
  374. package/src/dataHooks/useCaseSetRightsQuery/index.ts +1 -0
  375. package/src/dataHooks/useCaseSetRightsQuery/useCaseSetRightsQuery.ts +17 -0
  376. package/src/dataHooks/useCaseSetStatsQuery/index.ts +1 -0
  377. package/src/dataHooks/useCaseSetStatsQuery/useCaseSetStatsQuery.ts +31 -0
  378. package/src/dataHooks/useCaseSetStatusesQuery/index.ts +1 -0
  379. package/src/dataHooks/useCaseSetStatusesQuery/useCaseSetStatusesQuery.ts +39 -0
  380. package/src/dataHooks/useCaseSetsQuery/index.ts +1 -0
  381. package/src/dataHooks/useCaseSetsQuery/useCaseSetsQuery.ts +41 -0
  382. package/src/dataHooks/useCaseTypeSetCategoriesQuery/index.ts +1 -0
  383. package/src/dataHooks/useCaseTypeSetCategoriesQuery/useCaseTypeSetCategoriesQuery.ts +41 -0
  384. package/src/dataHooks/useCaseTypeSetMembersQuery/index.ts +1 -0
  385. package/src/dataHooks/useCaseTypeSetMembersQuery/useCaseTypeSetMembersQuery.ts +17 -0
  386. package/src/dataHooks/useCaseTypeSetsQuery/index.ts +1 -0
  387. package/src/dataHooks/useCaseTypeSetsQuery/useCaseTypeSetsQuery.ts +58 -0
  388. package/src/dataHooks/useCaseTypeStatsQuery/index.ts +1 -0
  389. package/src/dataHooks/useCaseTypeStatsQuery/useCaseTypeStatsQuery.ts +20 -0
  390. package/src/dataHooks/useCaseTypesQuery/index.ts +1 -0
  391. package/src/dataHooks/useCaseTypesQuery/useCaseTypesQuery.ts +43 -0
  392. package/src/dataHooks/useColSetMembersQuery/index.ts +1 -0
  393. package/src/dataHooks/useColSetMembersQuery/useColSetMembersQuery.ts +17 -0
  394. package/src/dataHooks/useColSetsQuery/index.ts +1 -0
  395. package/src/dataHooks/useColSetsQuery/useColSetsQuery.ts +39 -0
  396. package/src/dataHooks/useColTypesQuery/index.ts +1 -0
  397. package/src/dataHooks/useColTypesQuery/useColTypesQuery.ts +51 -0
  398. package/src/dataHooks/useColsQuery/index.ts +1 -0
  399. package/src/dataHooks/useColsQuery/useColsQuery.ts +60 -0
  400. package/src/dataHooks/useConceptQuery/index.ts +1 -0
  401. package/src/dataHooks/useConceptQuery/useConceptQuery.ts +52 -0
  402. package/src/dataHooks/useConceptRelationTypeQuery/index.ts +1 -0
  403. package/src/dataHooks/useConceptRelationTypeQuery/useConceptRelationTypeQuery.ts +21 -0
  404. package/src/dataHooks/useConceptSetTypeQuery/index.ts +1 -0
  405. package/src/dataHooks/useConceptSetTypeQuery/useConceptSetTypeQuery.ts +27 -0
  406. package/src/dataHooks/useConceptSetsQuery/index.ts +1 -0
  407. package/src/dataHooks/useConceptSetsQuery/useConceptSetsQuery.ts +38 -0
  408. package/src/dataHooks/useDataCollectionSetMembersQuery/index.ts +1 -0
  409. package/src/dataHooks/useDataCollectionSetMembersQuery/useDataCollectionSetMembersQuery.ts +17 -0
  410. package/src/dataHooks/useDataCollectionsQuery/index.ts +1 -0
  411. package/src/dataHooks/useDataCollectionsQuery/useDataCollectionsQuery.ts +45 -0
  412. package/src/dataHooks/useDimTypesQuery/index.ts +1 -0
  413. package/src/dataHooks/useDimTypesQuery/useDimTypesQuery.ts +26 -0
  414. package/src/dataHooks/useDimsQuery/index.ts +1 -0
  415. package/src/dataHooks/useDimsQuery/useDimsQuery.ts +55 -0
  416. package/src/dataHooks/useDiseasesQuery/index.ts +1 -0
  417. package/src/dataHooks/useDiseasesQuery/useDiseasesQuery.ts +39 -0
  418. package/src/dataHooks/useEtiologicalAgentsQuery/index.ts +1 -0
  419. package/src/dataHooks/useEtiologicalAgentsQuery/useEtiologicalAgentsQuery.ts +39 -0
  420. package/src/dataHooks/useGeneticDistanceProtocolsQuery/index.ts +1 -0
  421. package/src/dataHooks/useGeneticDistanceProtocolsQuery/useGeneticDistanceProtocolsQuery.ts +29 -0
  422. package/src/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.ts +1 -0
  423. package/src/dataHooks/useIdentifierIssuerOwnOrganizationQuery/useIdentifierIssuerOwnOrganizationQuery.ts +34 -0
  424. package/src/dataHooks/useIdentifierIssuerQuery/index.ts +1 -0
  425. package/src/dataHooks/useIdentifierIssuerQuery/useIdentifierIssuerQuery.ts +42 -0
  426. package/src/dataHooks/useInviteUserConstraintsQuery/index.ts +1 -0
  427. package/src/dataHooks/useInviteUserConstraintsQuery/useInviteUserConstraintsQuery.ts +32 -0
  428. package/src/dataHooks/useOrganizationAccessCasePoliciesQuery/index.ts +1 -0
  429. package/src/dataHooks/useOrganizationAccessCasePoliciesQuery/useOrganizationAccessCasePoliciesQuery.ts +20 -0
  430. package/src/dataHooks/useOrganizationAdminPoliciesQuery/index.ts +1 -0
  431. package/src/dataHooks/useOrganizationAdminPoliciesQuery/useOrganizationAdminPoliciesQuery.ts +60 -0
  432. package/src/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.ts +1 -0
  433. package/src/dataHooks/useOrganizationIdentifierIssuerLinksQuery/useOrganizationIdentifierIssuerLinksQuery.ts +18 -0
  434. package/src/dataHooks/useOrganizationShareCasePoliciesQuery/index.ts +1 -0
  435. package/src/dataHooks/useOrganizationShareCasePoliciesQuery/useOrganizationShareCasePoliciesQuery.ts +18 -0
  436. package/src/dataHooks/useOrganizationsQuery/index.ts +1 -0
  437. package/src/dataHooks/useOrganizationsQuery/useOrganizationsQuery.ts +40 -0
  438. package/src/dataHooks/useRefColsQuery/index.ts +1 -0
  439. package/src/dataHooks/useRefColsQuery/useRefColsQuery.ts +39 -0
  440. package/src/dataHooks/useRefColsValidationRulesQuery/index.ts +1 -0
  441. package/src/dataHooks/useRefColsValidationRulesQuery/useRefColsValidationRulesQuery.ts +17 -0
  442. package/src/dataHooks/useRefDimsQuery/index.ts +1 -0
  443. package/src/dataHooks/useRefDimsQuery/useRefDimsQuery.ts +39 -0
  444. package/src/dataHooks/useRegionQuery/index.ts +1 -0
  445. package/src/dataHooks/useRegionQuery/useRegionQuery.ts +52 -0
  446. package/src/dataHooks/useRegionRelationTypeQuery/index.ts +1 -0
  447. package/src/dataHooks/useRegionRelationTypeQuery/useRegionRelationTypeQuery.ts +24 -0
  448. package/src/dataHooks/useRegionSetsQuery/index.ts +1 -0
  449. package/src/dataHooks/useRegionSetsQuery/useRegionSetsQuery.ts +39 -0
  450. package/src/dataHooks/useSequencingProtocolsQuery/index.ts +1 -0
  451. package/src/dataHooks/useSequencingProtocolsQuery/useSequencingProtocolsQuery.ts +39 -0
  452. package/src/dataHooks/useTreeAlgorithmCodesQuery/index.ts +1 -0
  453. package/src/dataHooks/useTreeAlgorithmCodesQuery/useTreeAlgorithmCodesQuery.ts +42 -0
  454. package/src/dataHooks/useUserAccessCasePoliciesQuery/index.ts +1 -0
  455. package/src/dataHooks/useUserAccessCasePoliciesQuery/useUserAccessCasePoliciesQuery.ts +18 -0
  456. package/src/dataHooks/useUserEffectiveRightsQuery/index.ts +1 -0
  457. package/src/dataHooks/useUserEffectiveRightsQuery/useUserEffectiveRightsQuery.ts +125 -0
  458. package/src/dataHooks/useUserShareCasePoliciesQuery/index.ts +1 -0
  459. package/src/dataHooks/useUserShareCasePoliciesQuery/useUserShareCasePoliciesQuery.ts +18 -0
  460. package/src/dataHooks/useUsersQuery/index.ts +1 -0
  461. package/src/dataHooks/useUsersQuery/useUsersQuery.ts +43 -0
  462. package/src/hoc/withDialog/index.ts +1 -0
  463. package/src/hoc/withDialog/withDialog.tsx +132 -0
  464. package/src/hoc/withPermissions/index.ts +1 -0
  465. package/src/hoc/withPermissions/withPermissions.tsx +34 -0
  466. package/src/hooks/useArray/index.ts +1 -0
  467. package/src/hooks/useArray/useArray.ts +5 -0
  468. package/src/hooks/useColumnsMenu/index.ts +1 -0
  469. package/src/hooks/useColumnsMenu/useColumnsMenu.tsx +152 -0
  470. package/src/hooks/useCreateMutation/index.ts +1 -0
  471. package/src/hooks/useCreateMutation/useCreateMutation.ts +103 -0
  472. package/src/hooks/useDeleteMutation/index.ts +1 -0
  473. package/src/hooks/useDeleteMutation/useDeleteMutation.ts +92 -0
  474. package/src/hooks/useDimensions/index.ts +1 -0
  475. package/src/hooks/useDimensions/useDimensions.ts +82 -0
  476. package/src/hooks/useEditMutation/index.ts +1 -0
  477. package/src/hooks/useEditMutation/useEditMutation.ts +112 -0
  478. package/src/hooks/useInitializeTableStore/index.ts +1 -0
  479. package/src/hooks/useInitializeTableStore/useInitializeTableStore.ts +41 -0
  480. package/src/hooks/useIsFormFieldRequiredFromSchema/index.ts +1 -0
  481. package/src/hooks/useIsFormFieldRequiredFromSchema/useIsFormFieldRequiredFromSchema.ts +32 -0
  482. package/src/hooks/useItemQuery/index.ts +1 -0
  483. package/src/hooks/useItemQuery/useItemQuery.ts +82 -0
  484. package/src/hooks/useOrganizationCasePolicyNameFactory/index.ts +1 -0
  485. package/src/hooks/useOrganizationCasePolicyNameFactory/useOrganizationCasePolicyNameFactory.ts +31 -0
  486. package/src/hooks/useQueryMemo/index.ts +1 -0
  487. package/src/hooks/useQueryMemo/useQueryMemo.ts +24 -0
  488. package/src/hooks/useScrollbarSize/index.ts +1 -0
  489. package/src/hooks/useScrollbarSize/useScrollbarSize.ts +23 -0
  490. package/src/hooks/useSubscribable/index.ts +1 -0
  491. package/src/hooks/useSubscribable/useSubscribable.ts +30 -0
  492. package/src/hooks/useUpdateBreadcrumb/index.ts +1 -0
  493. package/src/hooks/useUpdateBreadcrumb/useUpdateBreadcrumb.ts +21 -0
  494. package/src/hooks/useUpdateDocumentTitle/index.ts +1 -0
  495. package/src/hooks/useUpdateDocumentTitle/useUpdateDocumentTitle.ts +10 -0
  496. package/src/hooks/useUserCasePolicyNameFactory/index.ts +1 -0
  497. package/src/hooks/useUserCasePolicyNameFactory/useUserCasePolicyNameFactory.ts +37 -0
  498. package/src/index.ts +301 -0
  499. package/src/models/admin.ts +7 -0
  500. package/src/models/auth.ts +14 -0
  501. package/src/models/caseAccess.ts +21 -0
  502. package/src/models/config.ts +153 -0
  503. package/src/models/data.ts +11 -0
  504. package/src/models/dataHooks.ts +18 -0
  505. package/src/models/environment.ts +10 -0
  506. package/src/models/epi.ts +188 -0
  507. package/src/models/filter.ts +39 -0
  508. package/src/models/form.ts +74 -0
  509. package/src/models/generic.ts +4 -0
  510. package/src/models/nestedMenu.ts +21 -0
  511. package/src/models/notification.ts +12 -0
  512. package/src/models/outage.ts +7 -0
  513. package/src/models/query.ts +75 -0
  514. package/src/models/reactRouter.ts +36 -0
  515. package/src/models/table.ts +191 -0
  516. package/src/models/testId.ts +1 -0
  517. package/src/models/tree.ts +32 -0
  518. package/src/pages/AcceptInvitationPage/AcceptInvitationPage.tsx +96 -0
  519. package/src/pages/AcceptInvitationPage/index.ts +1 -0
  520. package/src/pages/AdminPage/AdminPage.tsx +164 -0
  521. package/src/pages/AdminPage/index.ts +1 -0
  522. package/src/pages/CaseSetStatusAdminPage/CaseSetStatusAdminPage.tsx +98 -0
  523. package/src/pages/CaseSetStatusAdminPage/index.ts +1 -0
  524. package/src/pages/CaseTypeSetCategoriesAdminPage/CaseTypeSetCategoriesAdminPage.tsx +108 -0
  525. package/src/pages/CaseTypeSetCategoriesAdminPage/index.ts +1 -0
  526. package/src/pages/CaseTypeSetsAdminPage/CaseTypeSetsAdminPage.tsx +200 -0
  527. package/src/pages/CaseTypeSetsAdminPage/index.ts +1 -0
  528. package/src/pages/CaseTypesAdminPage/CaseTypesAdminPage.tsx +204 -0
  529. package/src/pages/CaseTypesAdminPage/index.ts +1 -0
  530. package/src/pages/CasesDetailPage/CasesDetailPage.tsx +57 -0
  531. package/src/pages/CasesDetailPage/index.ts +1 -0
  532. package/src/pages/CasesPage/CasesPage.tsx +338 -0
  533. package/src/pages/CasesPage/index.ts +1 -0
  534. package/src/pages/ChooseIdentityProviderPage/ChooseIdentityProviderPage.tsx +166 -0
  535. package/src/pages/ChooseIdentityProviderPage/index.ts +1 -0
  536. package/src/pages/ColSetsAdminPage/ColSetsAdminPage.tsx +175 -0
  537. package/src/pages/ColSetsAdminPage/index.ts +1 -0
  538. package/src/pages/ColsAdminPage/ColsAdminPage.tsx +400 -0
  539. package/src/pages/ColsAdminPage/index.ts +1 -0
  540. package/src/pages/ConceptRelationsAdminPage/ConceptRelationsAdminPage.tsx +134 -0
  541. package/src/pages/ConceptRelationsAdminPage/index.ts +1 -0
  542. package/src/pages/ConceptSetsAdminPage/ConceptSetsAdminPage.tsx +167 -0
  543. package/src/pages/ConceptSetsAdminPage/index.ts +1 -0
  544. package/src/pages/ConceptsAdminPage/ConceptsAdminPage.tsx +138 -0
  545. package/src/pages/ConceptsAdminPage/index.ts +1 -0
  546. package/src/pages/CrudPage/CrudPage.tsx +646 -0
  547. package/src/pages/CrudPage/CrudPageDeleteDialog.tsx +85 -0
  548. package/src/pages/CrudPage/CrudPageEditDialog.tsx +165 -0
  549. package/src/pages/CrudPage/index.ts +1 -0
  550. package/src/pages/DataCollectionSetsAdminPage/DataCollectionSetsAdminPage.tsx +156 -0
  551. package/src/pages/DataCollectionSetsAdminPage/index.ts +1 -0
  552. package/src/pages/DataCollectionVisualizationPage/DataCollectionVisualizationPage.tsx +238 -0
  553. package/src/pages/DataCollectionVisualizationPage/index.ts +1 -0
  554. package/src/pages/DataCollectionsAdminPage/DataCollectionsAdminPage.tsx +96 -0
  555. package/src/pages/DataCollectionsAdminPage/index.ts +1 -0
  556. package/src/pages/DimsAdminPage/DimsAdminPage.tsx +208 -0
  557. package/src/pages/DimsAdminPage/index.ts +1 -0
  558. package/src/pages/DiseasesAdminPage/DiseasesAdminPage.tsx +97 -0
  559. package/src/pages/DiseasesAdminPage/index.ts +1 -0
  560. package/src/pages/ErrorPage/ErrorPage.tsx +25 -0
  561. package/src/pages/ErrorPage/index.ts +1 -0
  562. package/src/pages/EtiologicalAgentsAdminPage/EtiologicalAgentsAdminPage.tsx +96 -0
  563. package/src/pages/EtiologicalAgentsAdminPage/index.ts +1 -0
  564. package/src/pages/EtiologiesAdminPage/EtiologiesAdminPage.tsx +110 -0
  565. package/src/pages/EtiologiesAdminPage/index.ts +1 -0
  566. package/src/pages/EventsDetailPage/EventsDetailPage.tsx +67 -0
  567. package/src/pages/EventsDetailPage/index.ts +1 -0
  568. package/src/pages/EventsPage/EventsPage.tsx +262 -0
  569. package/src/pages/EventsPage/index.ts +1 -0
  570. package/src/pages/HomePage/HomePage.tsx +47 -0
  571. package/src/pages/HomePage/index.ts +1 -0
  572. package/src/pages/IdentifierIssuersAdminPage/IdentifierIssuersAdminPage.tsx +106 -0
  573. package/src/pages/IdentifierIssuersAdminPage/index.ts +1 -0
  574. package/src/pages/OrganizationAccessCasePoliciesAdminPage/OrganizationAccessCasePoliciesAdminPage.tsx +217 -0
  575. package/src/pages/OrganizationAccessCasePoliciesAdminPage/index.ts +1 -0
  576. package/src/pages/OrganizationAdminPoliciesAdminPage/OrganizationAdminPoliciesAdminPage.tsx +119 -0
  577. package/src/pages/OrganizationAdminPoliciesAdminPage/index.ts +1 -0
  578. package/src/pages/OrganizationContactsAdminPage/OrganizationContactsAdminPage.tsx +127 -0
  579. package/src/pages/OrganizationContactsAdminPage/index.ts +1 -0
  580. package/src/pages/OrganizationShareCasePoliciesAdminPage/OrganizationShareCasePoliciesAdminPage.tsx +183 -0
  581. package/src/pages/OrganizationShareCasePoliciesAdminPage/index.ts +1 -0
  582. package/src/pages/OrganizationSitesAdminPage/OrganizationSitesAdminPage.tsx +132 -0
  583. package/src/pages/OrganizationSitesAdminPage/index.ts +1 -0
  584. package/src/pages/OrganizationsAdminPage/OrganizationsAdminPage.tsx +188 -0
  585. package/src/pages/OrganizationsAdminPage/index.ts +1 -0
  586. package/src/pages/OutagesAdminPage/OutagesAdminPage.tsx +158 -0
  587. package/src/pages/OutagesAdminPage/index.ts +1 -0
  588. package/src/pages/PostLoginPage/PostLoginPage.tsx +39 -0
  589. package/src/pages/PostLoginPage/index.ts +1 -0
  590. package/src/pages/PostLogoutPage/PostLogoutPage.tsx +44 -0
  591. package/src/pages/PostLogoutPage/index.ts +1 -0
  592. package/src/pages/RefColsAdminPage/RefColsAdminPage.tsx +286 -0
  593. package/src/pages/RefColsAdminPage/index.ts +1 -0
  594. package/src/pages/RefDimsAdminPage/RefDimsAdminPage.tsx +152 -0
  595. package/src/pages/RefDimsAdminPage/index.ts +1 -0
  596. package/src/pages/RegionRelationsAdminPage/RegionRelationsAdminPage.tsx +132 -0
  597. package/src/pages/RegionRelationsAdminPage/index.ts +1 -0
  598. package/src/pages/RegionSetShapesAdminPage/RegionSetShapesAdminPage.tsx +132 -0
  599. package/src/pages/RegionSetShapesAdminPage/index.ts +1 -0
  600. package/src/pages/RegionSetsAdminPage/RegionSetsAdminPage.tsx +147 -0
  601. package/src/pages/RegionSetsAdminPage/index.ts +1 -0
  602. package/src/pages/RegionsAdminPage/RegionsAdminPage.tsx +150 -0
  603. package/src/pages/RegionsAdminPage/index.ts +1 -0
  604. package/src/pages/RouterErrorPage/RouterErrorPage.tsx +23 -0
  605. package/src/pages/RouterErrorPage/index.ts +1 -0
  606. package/src/pages/TrendsPage/TrendsPage.tsx +17 -0
  607. package/src/pages/TrendsPage/index.ts +1 -0
  608. package/src/pages/UploadPage/UploadPage.tsx +40 -0
  609. package/src/pages/UploadPage/index.ts +1 -0
  610. package/src/pages/UserAccessCasePoliciesAdminPage/UserAccessCasePoliciesAdminPage.tsx +209 -0
  611. package/src/pages/UserAccessCasePoliciesAdminPage/index.ts +1 -0
  612. package/src/pages/UserEffectiveRightsAdminPage/UserEffectiveRightsAdminPage.tsx +331 -0
  613. package/src/pages/UserEffectiveRightsAdminPage/index.ts +1 -0
  614. package/src/pages/UserEffectiveRightsTesterAdminPage/UserEffectiveRightsTesterAdminPage.tsx +283 -0
  615. package/src/pages/UserEffectiveRightsTesterAdminPage/index.ts +1 -0
  616. package/src/pages/UserInvitationsAdminPage/UserInvitationConsumeDialog.tsx +143 -0
  617. package/src/pages/UserInvitationsAdminPage/UserInvitationShareDialog.tsx +100 -0
  618. package/src/pages/UserInvitationsAdminPage/UserInvitationsAdminPage.tsx +218 -0
  619. package/src/pages/UserInvitationsAdminPage/index.ts +1 -0
  620. package/src/pages/UserShareCasePoliciesAdminPage/UserShareCasePoliciesAdminPage.tsx +183 -0
  621. package/src/pages/UserShareCasePoliciesAdminPage/index.ts +1 -0
  622. package/src/pages/UsersAdminPage/UsersAdminPage.tsx +240 -0
  623. package/src/pages/UsersAdminPage/index.ts +1 -0
  624. package/src/routes/adminRoutes.tsx +801 -0
  625. package/src/routes/index.ts +2 -0
  626. package/src/routes/routes.tsx +235 -0
  627. package/src/setup/index.ts +1 -0
  628. package/src/setup/setup.ts +5 -0
  629. package/src/setup/yup.ts +203 -0
  630. package/src/stores/epiDashboardStore/epiDashboardStore.ts +750 -0
  631. package/src/stores/epiDashboardStore/epiDashboardStoreContext.tsx +6 -0
  632. package/src/stores/epiDashboardStore/index.ts +2 -0
  633. package/src/stores/epiUploadStore/epiUploadStore.ts +351 -0
  634. package/src/stores/epiUploadStore/epiUploadStoreContext.tsx +6 -0
  635. package/src/stores/epiUploadStore/index.ts +2 -0
  636. package/src/stores/oidcStore/index.ts +1 -0
  637. package/src/stores/oidcStore/oidcStore.ts +43 -0
  638. package/src/stores/outagesStore/index.ts +1 -0
  639. package/src/stores/outagesStore/outagesStore.ts +31 -0
  640. package/src/stores/tableStore/TableStoreContext.tsx +6 -0
  641. package/src/stores/tableStore/TableStoreContextProvider.tsx +20 -0
  642. package/src/stores/tableStore/index.ts +4 -0
  643. package/src/stores/tableStore/tableStore.ts +547 -0
  644. package/src/stores/tableStore/useTableStoreContext.tsx +7 -0
  645. package/src/stores/userProfileStore/index.ts +1 -0
  646. package/src/stores/userProfileStore/userProfileStore.ts +112 -0
  647. package/src/test/integration/lib/render.tsx +33 -0
  648. package/src/test/integration/tests/integration-example/HelloWorld.test.tsx +14 -0
  649. package/src/test/integration/tests/integration-example/HelloWorld.tsx +9 -0
  650. package/src/test/setup-browser.ts +3 -0
  651. package/src/test/setup-jsdom.ts +6 -0
  652. package/src/test/setup.ts +9 -0
  653. package/src/utils/AbacUtil/AbacUtil.ts +21 -0
  654. package/src/utils/AbacUtil/index.ts +1 -0
  655. package/src/utils/AxiosUtil/AxiosUtil.test.ts +66 -0
  656. package/src/utils/AxiosUtil/AxiosUtil.ts +47 -0
  657. package/src/utils/AxiosUtil/index.ts +1 -0
  658. package/src/utils/CaseSelectionUtil/CaseSelectionUtil.ts +32 -0
  659. package/src/utils/CaseSelectionUtil/index.ts +1 -0
  660. package/src/utils/CaseSetUtil/CaseSetUtil.ts +13 -0
  661. package/src/utils/CaseSetUtil/index.ts +1 -0
  662. package/src/utils/CaseTypeUtil/CaseTypeUtil.ts +178 -0
  663. package/src/utils/CaseTypeUtil/index.ts +1 -0
  664. package/src/utils/CaseUtil/CaseUtil.ts +401 -0
  665. package/src/utils/CaseUtil/index.ts +1 -0
  666. package/src/utils/DashboardUtil/DashboardUtil.ts +46 -0
  667. package/src/utils/DashboardUtil/index.ts +1 -0
  668. package/src/utils/DataHookUtil/DataHookUtil.ts +137 -0
  669. package/src/utils/DataHookUtil/index.ts +1 -0
  670. package/src/utils/DataSetUtil/DataSetUtil.ts +70 -0
  671. package/src/utils/DataSetUtil/index.ts +1 -0
  672. package/src/utils/DataUtil/DataUtil.ts +84 -0
  673. package/src/utils/DataUtil/index.ts +1 -0
  674. package/src/utils/DownloadUtil/DownloadUtil.ts +237 -0
  675. package/src/utils/DownloadUtil/index.ts +1 -0
  676. package/src/utils/EffectiveRightsUtil/EffectiveRightsUtil.ts +142 -0
  677. package/src/utils/EffectiveRightsUtil/index.ts +1 -0
  678. package/src/utils/EpiCurveUtil/EpiCurveUtil.ts +180 -0
  679. package/src/utils/EpiCurveUtil/index.ts +1 -0
  680. package/src/utils/EpiFilterUtil/EpiFilterUtil.ts +232 -0
  681. package/src/utils/EpiFilterUtil/index.ts +1 -0
  682. package/src/utils/EpiLineListUtil/EpiLineListUtil.ts +15 -0
  683. package/src/utils/EpiLineListUtil/index.ts +1 -0
  684. package/src/utils/EpiMapUtil/EpiMapUtil.test.ts +54 -0
  685. package/src/utils/EpiMapUtil/EpiMapUtil.ts +80 -0
  686. package/src/utils/EpiMapUtil/index.ts +1 -0
  687. package/src/utils/EpiTreeUtil/EpiTreeUtil.test.ts +2467 -0
  688. package/src/utils/EpiTreeUtil/EpiTreeUtil.ts +1055 -0
  689. package/src/utils/EpiTreeUtil/index.ts +1 -0
  690. package/src/utils/EpiUploadUtil/EpiUploadUtil.ts +857 -0
  691. package/src/utils/EpiUploadUtil/index.ts +1 -0
  692. package/src/utils/FileUtil/FileUtil.ts +22 -0
  693. package/src/utils/FileUtil/index.ts +1 -0
  694. package/src/utils/FormUtil/FormUtil.test.ts +36 -0
  695. package/src/utils/FormUtil/FormUtil.ts +63 -0
  696. package/src/utils/FormUtil/index.ts +1 -0
  697. package/src/utils/MenuDataUtil/MenuDataUtil.ts +54 -0
  698. package/src/utils/MenuDataUtil/index.ts +1 -0
  699. package/src/utils/NewickUtil/NewickUtil.test.ts +187 -0
  700. package/src/utils/NewickUtil/NewickUtil.ts +69 -0
  701. package/src/utils/NewickUtil/index.ts +1 -0
  702. package/src/utils/NotificationUtil/NotificationUtil.ts +28 -0
  703. package/src/utils/NotificationUtil/index.ts +1 -0
  704. package/src/utils/NumberUtil/NumberUtil.test.ts +113 -0
  705. package/src/utils/NumberUtil/NumberUtil.ts +67 -0
  706. package/src/utils/NumberUtil/index.ts +1 -0
  707. package/src/utils/ObjectUtil/ObjectUtil.test.ts +43 -0
  708. package/src/utils/ObjectUtil/ObjectUtil.ts +28 -0
  709. package/src/utils/ObjectUtil/index.ts +1 -0
  710. package/src/utils/OutageUtil/OutageUtil.test.ts +108 -0
  711. package/src/utils/OutageUtil/OutageUtil.ts +81 -0
  712. package/src/utils/OutageUtil/index.ts +1 -0
  713. package/src/utils/QueryUtil/QueryUtil.test.ts +42 -0
  714. package/src/utils/QueryUtil/QueryUtil.ts +105 -0
  715. package/src/utils/QueryUtil/index.ts +1 -0
  716. package/src/utils/StringUtil/StringUtil.test.ts +61 -0
  717. package/src/utils/StringUtil/StringUtil.ts +91 -0
  718. package/src/utils/StringUtil/index.ts +1 -0
  719. package/src/utils/TableUtil/TableUtil.ts +665 -0
  720. package/src/utils/TableUtil/index.ts +1 -0
  721. package/src/utils/TestIdUtil/TestIdUtil.test.ts +12 -0
  722. package/src/utils/TestIdUtil/TestIdUtil.ts +13 -0
  723. package/src/utils/TestIdUtil/index.ts +1 -0
  724. package/src/utils/TimeUtil/TimeUtil.ts +38 -0
  725. package/src/utils/TimeUtil/index.ts +1 -0
  726. package/src/utils/UserManagerUtil/UserManagerUtil.test.ts +41 -0
  727. package/src/utils/UserManagerUtil/UserManagerUtil.ts +39 -0
  728. package/src/utils/UserManagerUtil/index.ts +1 -0
  729. package/src/utils/ValidationUtil/ValidationUtil.test.ts +61 -0
  730. package/src/utils/ValidationUtil/ValidationUtil.ts +56 -0
  731. package/src/utils/ValidationUtil/index.ts +1 -0
  732. package/dist/environment.d.ts +0 -54
  733. package/dist/index.d.ts +0 -16074
  734. /package/{dist → src/@types}/mui.d.ts +0 -0
  735. /package/{dist → src/@types}/ui.d.ts +0 -0
  736. /package/{dist → src/@types}/vite-env.d.ts +0 -0
  737. /package/{dist → src/@types}/yup.d.ts +0 -0
  738. /package/{dist → src}/locale/en.json +0 -0
  739. /package/{dist → src}/locale/nl.json +0 -0
@@ -0,0 +1,857 @@
1
+ import readXlsxFile, { readSheetNames } from 'read-excel-file/browser';
2
+ import { parse } from 'csv/browser/esm/sync';
3
+ import type {
4
+ ObjectSchema,
5
+ AnyObject,
6
+ } from 'yup';
7
+ import {
8
+ lazy,
9
+ object,
10
+ string,
11
+ } from 'yup';
12
+ import { t } from 'i18next';
13
+ import difference from 'lodash/difference';
14
+ import uniq from 'lodash/uniq';
15
+ import { format } from 'date-fns';
16
+
17
+ import type {
18
+ Col,
19
+ CaseType,
20
+ CompleteCaseType,
21
+ CaseUploadResult,
22
+ CaseForUpload,
23
+ ReadSetForUpload,
24
+ SeqForUpload,
25
+ CaseBatchUploadResult,
26
+ } from '../../api';
27
+ import {
28
+ CaseApi,
29
+ ColType,
30
+ UploadAction,
31
+ ReadsFileFormat,
32
+ SeqFileFormat,
33
+ EtlStatus,
34
+ } from '../../api';
35
+ import { CaseTypeUtil } from '../CaseTypeUtil';
36
+ import { CaseUtil } from '../CaseUtil';
37
+ import { DATE_FORMAT } from '../../data/date';
38
+ import { QueryUtil } from '../QueryUtil';
39
+ import { QUERY_KEY } from '../../models/query';
40
+ import type {
41
+ AutoCompleteOption,
42
+ FormFieldDefinition,
43
+ OptionBase,
44
+ } from '../../models/form';
45
+ import { FORM_FIELD_DEFINITION_TYPE } from '../../models/form';
46
+ import type {
47
+ EpiUploadMappedColumn,
48
+ EpiUploadMappedColumnsFormFields,
49
+ EpiUploadCompleteColStats,
50
+ CaseUploadResultWithGeneratedId,
51
+ EpiUploadSequenceMapping,
52
+ EpiUploadSequenceMappingForCaseId,
53
+ } from '../../models/epi';
54
+ import { FileUtil } from '../FileUtil';
55
+ import { UploadError } from '../../classes/errors';
56
+ import { ValidationUtil } from '../ValidationUtil';
57
+
58
+ export class EpiUploadUtil {
59
+ public static readonly caseIdColumnAliases = ['_case_id', 'case id', 'case_id', 'caseid', 'case.id'];
60
+ public static readonly caseDateColumnAliases = ['_case_date', 'case date', 'case_date', 'casedate', 'case.date'];
61
+ public static readonly colAliases = ['_case_type', 'case type', 'case_type', 'casetype', 'case.type'];
62
+
63
+ public static isXlsxFile(fileName: string): boolean {
64
+ return fileName?.toLowerCase()?.endsWith('.xlsx');
65
+ }
66
+
67
+ public static isTextFile(fileName: string): boolean {
68
+ const lowerName = fileName?.toLowerCase();
69
+ return lowerName?.endsWith('.csv') || lowerName?.endsWith('.tsv') || lowerName?.endsWith('.txt');
70
+ }
71
+
72
+ public static async getSheetNameOptions(fileList: FileList): Promise<AutoCompleteOption<string>[]> {
73
+ const file = fileList[0];
74
+ const fileName = file.name.toLowerCase();
75
+
76
+ if (EpiUploadUtil.isXlsxFile(fileName)) {
77
+ return (await readSheetNames(file)).map(name => ({ label: name, value: name }));
78
+ }
79
+ return [];
80
+ }
81
+
82
+ public static async readRawData(fileList: FileList, sheet?: string): Promise<string[][]> {
83
+ const file = fileList[0];
84
+ const fileName = file.name.toLowerCase();
85
+ let result: string[][] = [];
86
+
87
+ if (EpiUploadUtil.isTextFile(fileName)) {
88
+ // Parse CSV file
89
+ let text = await file.text();
90
+ if (fileName.endsWith('.tsv')) {
91
+ // Convert TSV to CSV by replacing tabs with commas
92
+ text = text.replace(/\t/g, ',');
93
+ }
94
+ if (fileName.endsWith('.txt')) {
95
+ // Attempt to auto-detect delimiter (comma, tab, semicolon)
96
+ const lines = text.split(/\r?\n/).filter(line => line.trim() !== '');
97
+ if (lines.length > 0) {
98
+ const delimiters = [',', '\t', ';'];
99
+ let bestDelimiter = ',';
100
+ let maxFields = 0;
101
+ delimiters.forEach(delimiter => {
102
+ const fieldsCount = lines[0].split(delimiter).length;
103
+ if (fieldsCount > maxFields) {
104
+ maxFields = fieldsCount;
105
+ bestDelimiter = delimiter;
106
+ }
107
+ });
108
+ if (bestDelimiter !== ',') {
109
+ const regex = new RegExp(bestDelimiter.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');
110
+ text = text.replace(regex, ',');
111
+ }
112
+ }
113
+ }
114
+ result = parse(text, {
115
+ columns: false, // Keep as array of arrays
116
+ skip_empty_lines: true,
117
+ trim: true,
118
+ });
119
+ } else if (EpiUploadUtil.isXlsxFile(fileName)) {
120
+ // Parse Excel file
121
+ const excelData = await readXlsxFile(file, {
122
+ sheet,
123
+ trim: true,
124
+ });
125
+ result = excelData.map(row => row.map(cell => {
126
+ if (cell instanceof Date) {
127
+ return format(cell, DATE_FORMAT.DATE);
128
+ }
129
+ return cell?.toString() ?? undefined;
130
+ }));
131
+ } else {
132
+ throw new Error('Unsupported file format. Please select a CSV or Excel file.');
133
+ }
134
+ if (result.length < 2 || result[0].length < 2) {
135
+ throw new Error('The selected file does not contain enough data. Please ensure it has at least a header row and one data row.');
136
+ }
137
+ return result;
138
+ }
139
+
140
+ public static getSampleIdColIds(completeCaseType: CompleteCaseType): string[] {
141
+ const colsIds: string[] = [];
142
+ Object.values(Object.keys(completeCaseType.cols)).forEach(colId => {
143
+ const col = completeCaseType.cols[colId];
144
+ const refCol = completeCaseType.ref_cols[col.ref_col_id];
145
+ if (refCol?.col_type === ColType.ID_SAMPLE) {
146
+ colsIds.push(col.id);
147
+ }
148
+ });
149
+ return colsIds;
150
+ }
151
+
152
+
153
+ public static matchColumnLabel(columnLabel: string, col: Col): boolean {
154
+ if (!columnLabel || typeof columnLabel !== 'string') {
155
+ return false;
156
+ }
157
+ const labelLowerCase = columnLabel.toLocaleLowerCase();
158
+ return labelLowerCase === col.label.toLocaleLowerCase() || labelLowerCase === col.code.toLowerCase() || labelLowerCase === col.id.toLocaleLowerCase();
159
+ }
160
+
161
+ public static getCaseTypeFromColumnLabels(cols: Col[], columnLabels: string[]): CaseType {
162
+ const bestMatch = {
163
+ caseType: null as CaseType,
164
+ matchCount: 0,
165
+ };
166
+
167
+ // Group columns by case type ID to count matches per case type
168
+ const caseTypeMatches = new Map<string, { caseType: CaseType; matchCount: number }>();
169
+
170
+ cols.forEach(col => {
171
+ const matchCount = columnLabels.filter(label =>
172
+ this.matchColumnLabel(label, col)).length;
173
+
174
+ if (matchCount > 0) {
175
+ const caseTypeId = col.case_type_id;
176
+ const existing = caseTypeMatches.get(caseTypeId);
177
+
178
+ if (existing) {
179
+ existing.matchCount += matchCount;
180
+ } else {
181
+ // Note: We don't have access to the full CaseType object here,
182
+ // so we create a minimal one with the ID. In a real implementation,
183
+ // you might need to pass the complete case type data or modify the method signature.
184
+ caseTypeMatches.set(caseTypeId, {
185
+ caseType: { id: caseTypeId } as CaseType,
186
+ matchCount,
187
+ });
188
+ }
189
+ }
190
+ });
191
+
192
+ // Find the case type with the highest match count
193
+ caseTypeMatches.forEach(match => {
194
+ if (match.matchCount > bestMatch.matchCount) {
195
+ bestMatch.caseType = match.caseType;
196
+ bestMatch.matchCount = match.matchCount;
197
+ }
198
+ });
199
+
200
+ return bestMatch.caseType;
201
+ }
202
+
203
+ public static isCaseIdColumn(label: string): boolean {
204
+ return this.caseIdColumnAliases.includes(label.toLocaleLowerCase());
205
+ }
206
+
207
+ public static isCol(label: string): boolean {
208
+ return this.colAliases.includes(label.toLocaleLowerCase());
209
+ }
210
+
211
+ public static isCaseDateColumn(label: string): boolean {
212
+ return this.caseDateColumnAliases.includes(label.toLocaleLowerCase());
213
+ }
214
+
215
+ public static getInitialMappedColumns(completeCaseType: CompleteCaseType, rawData: string[][]): EpiUploadMappedColumn[] {
216
+ if (rawData.length === 0) {
217
+ return [];
218
+ }
219
+ const writableColIds = CaseTypeUtil.getWritableColIds(completeCaseType);
220
+ const filteredCols = CaseTypeUtil.getWritableImportExportColIds(completeCaseType).map(id => completeCaseType.cols[id]);
221
+ const sampleIdColIds = EpiUploadUtil.getSampleIdColIds(completeCaseType);
222
+ const mappedColumns = rawData[0].map((label, index) => {
223
+ const isCaseIdColumn = EpiUploadUtil.isCaseIdColumn(label);
224
+ const isCol = EpiUploadUtil.isCol(label);
225
+
226
+ let col: Col = null;
227
+ let isSampleIdColumn = false;
228
+
229
+ if (!isCaseIdColumn && !isCol) {
230
+ col = filteredCols.find(c => EpiUploadUtil.matchColumnLabel(label, c)) || null;
231
+ if (col && !writableColIds.includes(col.id)) {
232
+ col = null;
233
+ }
234
+ isSampleIdColumn = col ? sampleIdColIds.includes(col.id) : false;
235
+ }
236
+
237
+ return {
238
+ originalIndex: index,
239
+ originalLabel: label,
240
+ col,
241
+ isCaseIdColumn,
242
+ isCol,
243
+ isSampleIdColumn,
244
+ sampleIdentifierIssuerId: null as string,
245
+ } satisfies EpiUploadMappedColumn;
246
+ });
247
+
248
+ return mappedColumns.filter(mc => {
249
+ return mc.isCaseIdColumn || mc.col;
250
+ });
251
+ }
252
+
253
+ public static getMappedColumnsFromFormData(data: EpiUploadMappedColumnsFormFields, rawData: string[][], colMap: Map<string, Col>, completeCaseType: CompleteCaseType): EpiUploadMappedColumn[] {
254
+ const mappedColumns: EpiUploadMappedColumn[] = [];
255
+ const sampleIdColIds = EpiUploadUtil.getSampleIdColIds(completeCaseType);
256
+ Object.entries(data).forEach(([originalIndexString, formValue]) => {
257
+ if (!formValue) {
258
+ return;
259
+ }
260
+ const originalIndex = parseInt(originalIndexString, 10);
261
+ const isCaseIdColumn = formValue === 'case_id';
262
+ let col: Col = null;
263
+ if (!isCaseIdColumn) {
264
+ col = colMap.get(formValue) || null;
265
+ }
266
+ let sampleIdentifierIssuerId: string = null;
267
+ const isSampleIdColumn = col ? sampleIdColIds.includes(col.id) : false;
268
+ if (isSampleIdColumn) {
269
+ sampleIdentifierIssuerId = data[formValue] || null;
270
+ }
271
+ mappedColumns.push({
272
+ isCaseIdColumn,
273
+ isSampleIdColumn,
274
+ col,
275
+ originalIndex,
276
+ originalLabel: rawData[0][originalIndex] || '',
277
+ sampleIdentifierIssuerId,
278
+ } satisfies EpiUploadMappedColumn);
279
+ });
280
+ return mappedColumns;
281
+ }
282
+
283
+ public static areMappedColumnsEqual(a: EpiUploadMappedColumn[], b: EpiUploadMappedColumn[]): boolean {
284
+ if (a.length !== b.length) {
285
+ return false;
286
+ }
287
+
288
+ return a.every((itemA, index) => {
289
+ const itemB = b[index];
290
+ const stringifiedA = `${itemA.originalIndex}-${itemA.originalLabel}`;
291
+ const stringifiedB = `${itemB.originalIndex}-${itemB.originalLabel}`;
292
+ return stringifiedA === stringifiedB;
293
+ });
294
+ }
295
+
296
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
297
+ public static getColumnMappingSchema(rawData: string[][], completeCaseType: CompleteCaseType): ObjectSchema<{}, AnyObject, {}, ''> {
298
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
299
+ const fields: { [key: string]: any } = {};
300
+ const fieldNames: string[] = rawData[0].map((_, index) => index.toString());
301
+ const sampleIdColIds = EpiUploadUtil.getSampleIdColIds(completeCaseType);
302
+
303
+ sampleIdColIds.forEach((colId) => {
304
+ fields[colId] = lazy(() => string().nullable().when(fieldNames, (otherFieldValues, schema) => {
305
+ return schema.test('needs-identifier-issuer', t('An identifier issuer must be selected.'), (fieldValue) => {
306
+ const allFieldValues = [...otherFieldValues as string[], fieldValue];
307
+ if (allFieldValues.includes(colId)) {
308
+ return !!fieldValue;
309
+ }
310
+ return true;
311
+ });
312
+ }));
313
+ });
314
+
315
+ fieldNames.forEach((fieldName, fieldIndex) => {
316
+ const otherFieldNames = fieldNames.filter(name => name !== fieldName);
317
+ fields[fieldName] = lazy(() => string().nullable().when(otherFieldNames, (otherFieldValues, schema) => {
318
+ return schema
319
+ .test('unique', t('This column has already been mapped to another field.'), (fieldValue) => {
320
+ return !fieldValue || !otherFieldValues.includes(fieldValue);
321
+ })
322
+ .test('valid-case-id-values', t('The column mapped to the case id field must contain valid UUID\'s.'), (fieldValue) => {
323
+ if (fieldValue !== 'case_id') {
324
+ return true;
325
+ }
326
+ const values = rawData.slice(1).map(row => row[fieldIndex]);
327
+ return values.every(value => ValidationUtil.validate('UUID4', value));
328
+ });
329
+ }));
330
+ });
331
+
332
+ return object().shape(fields);
333
+ }
334
+
335
+ public static getColumnMappingFormFieldDefinitions(completeCaseType: CompleteCaseType, rawDataHeaders: string[], _fileName: string): FormFieldDefinition<EpiUploadMappedColumnsFormFields>[] {
336
+ const fields: FormFieldDefinition<EpiUploadMappedColumnsFormFields>[] = [];
337
+ const options: AutoCompleteOption<string>[] = [];
338
+
339
+ options.push({
340
+ label: 'Case ID',
341
+ value: 'case_id',
342
+ });
343
+
344
+ const allowedColIds = CaseTypeUtil.getWritableImportExportColIds(completeCaseType);
345
+ completeCaseType.ordered_col_ids.filter(x => allowedColIds.includes(x)).forEach((colId) => {
346
+ const col = completeCaseType.cols[colId];
347
+
348
+ options.push({
349
+ label: col.label,
350
+ value: col.id,
351
+ });
352
+ });
353
+
354
+ rawDataHeaders.forEach((header, index) => {
355
+ fields.push({
356
+ definition: FORM_FIELD_DEFINITION_TYPE.SELECT,
357
+ name: index.toString(),
358
+ label: header,
359
+ options,
360
+ });
361
+ });
362
+
363
+ return fields;
364
+ }
365
+
366
+ public static getDefaultColumnMappingFormValues(rawDataHeaders: string[], mappedColumns: EpiUploadMappedColumn[], identifierIssuerOptions: OptionBase<string>[]): EpiUploadMappedColumnsFormFields {
367
+ const defaultFormValues: EpiUploadMappedColumnsFormFields = Object.fromEntries(Object.keys(rawDataHeaders).map<[string, null]>(x => [x.toString(), null]));
368
+ const caseIdColumn = mappedColumns.find(mappedColumn => mappedColumn.isCaseIdColumn);
369
+
370
+ if (caseIdColumn) {
371
+ defaultFormValues[caseIdColumn.originalIndex.toString()] = 'case_id';
372
+ }
373
+
374
+ mappedColumns.forEach((mappedColumn) => {
375
+ if (mappedColumn.col) {
376
+ defaultFormValues[mappedColumn.originalIndex.toString()] = mappedColumn.col.id;
377
+ if (mappedColumn.isSampleIdColumn) {
378
+ defaultFormValues[mappedColumn.col.id] = mappedColumn.sampleIdentifierIssuerId || identifierIssuerOptions.length === 1 ? identifierIssuerOptions[0].value : null;
379
+ }
380
+ }
381
+ });
382
+ return defaultFormValues;
383
+ }
384
+
385
+ public static isGenomeFile(fileName: string): boolean {
386
+ const lowerName = fileName.toLowerCase();
387
+ return lowerName.endsWith('.fa') ||
388
+ lowerName.endsWith('.fasta') ||
389
+ lowerName.endsWith('.fa.gz') ||
390
+ lowerName.endsWith('.fasta.gz');
391
+ }
392
+
393
+ public static isReadsFile(fileName: string): boolean {
394
+ const lowerName = fileName.toLowerCase();
395
+ return lowerName.endsWith('.fq') ||
396
+ lowerName.endsWith('.fastq') ||
397
+ lowerName.endsWith('.fq.gz') ||
398
+ lowerName.endsWith('.fastq.gz');
399
+ }
400
+
401
+ public static isSupportedGeneticFile(fileName: string): boolean {
402
+ return EpiUploadUtil.isGenomeFile(fileName) || EpiUploadUtil.isReadsFile(fileName);
403
+ }
404
+
405
+ public static hasSequenceColumnMapped(mappedColumns: EpiUploadMappedColumn[], completeCaseTypeColStats: EpiUploadCompleteColStats): boolean {
406
+ return mappedColumns.some((mappedColumn) => {
407
+ return completeCaseTypeColStats.sequenceColumns.some(seqCol => mappedColumn.col?.id === seqCol.id);
408
+ });
409
+ }
410
+
411
+ public static hasReadsColumnMapped(mappedColumns: EpiUploadMappedColumn[], completeCaseTypeColStats: EpiUploadCompleteColStats): boolean {
412
+ return mappedColumns.some((mappedColumn) => {
413
+ return completeCaseTypeColStats.readsColumns.some(readCol => mappedColumn.col?.id === readCol.id);
414
+ });
415
+ }
416
+
417
+
418
+ public static getCompleteCaseTypeColStats(completeCaseType: CompleteCaseType): EpiUploadCompleteColStats {
419
+ const sampleIdColumns = CaseTypeUtil.getColsByType(completeCaseType, [ColType.ID_SAMPLE]);
420
+ const sequenceColumns = CaseTypeUtil.getColsByType(completeCaseType, [ColType.GENETIC_SEQUENCE]);
421
+ const readsColumns = CaseTypeUtil.getColsByType(completeCaseType, [ColType.GENETIC_READS]);
422
+ const writableColumns = Object.values(completeCaseType.cols).filter(col => CaseTypeUtil.getWritableColIds(completeCaseType).includes(col.id));
423
+
424
+ return { sampleIdColumns, sequenceColumns, readsColumns, writableColumns };
425
+ }
426
+
427
+ private static idToRegex(id: string): RegExp {
428
+ // Create regex that matches the id somewhere in a string
429
+ return new RegExp(id.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'));
430
+ }
431
+
432
+ public static getEpiUploadSequenceMapping(completeCaseType: CompleteCaseType, validatedCases: CaseUploadResultWithGeneratedId[], sequenceFilesDataTransfer: DataTransfer): EpiUploadSequenceMapping {
433
+ if (!sequenceFilesDataTransfer || sequenceFilesDataTransfer.files.length === 0) {
434
+ return {};
435
+ }
436
+
437
+ const stats = EpiUploadUtil.getCompleteCaseTypeColStats(completeCaseType);
438
+ const result: EpiUploadSequenceMapping = {};
439
+
440
+ validatedCases.forEach((vc) => {
441
+ const caseSequenceMapping: EpiUploadSequenceMappingForCaseId = {
442
+ sequenceFileNames: {},
443
+ readsFileNames: {},
444
+ };
445
+
446
+ // modify by reference
447
+ result[vc.generatedId] = caseSequenceMapping;
448
+
449
+ if (stats.sequenceColumns.length !== 1 && stats.readsColumns.length !== 1) {
450
+ return;
451
+ }
452
+
453
+ const sampleIdColumnIds: string[] = [];
454
+ stats.sampleIdColumns.forEach((idCol) => {
455
+ const rowValue = CaseUtil.getRowValue(vc.validated_content, idCol, completeCaseType);
456
+ if (rowValue && !rowValue.isMissing) {
457
+ sampleIdColumnIds.push(rowValue.raw);
458
+ }
459
+ });
460
+ if (!sampleIdColumnIds.length) {
461
+ return;
462
+ }
463
+
464
+ stats.sequenceColumns.forEach((seqCol) => {
465
+ caseSequenceMapping.sequenceFileNames[seqCol.id] = '';
466
+ });
467
+ stats.readsColumns.forEach((readCol) => {
468
+ caseSequenceMapping.readsFileNames[readCol.id] = {
469
+ fwd: '',
470
+ rev: '',
471
+ };
472
+ });
473
+
474
+ const sequenceFiles: string[] = [];
475
+ const readsFiles: string[] = [];
476
+ Array.from(sequenceFilesDataTransfer.files).forEach((file) => {
477
+ const fileName = file.name;
478
+ const lowerName = fileName.toLowerCase();
479
+ const matchesId = sampleIdColumnIds.some((id) => lowerName.match(EpiUploadUtil.idToRegex(id.toLowerCase())));
480
+ if (matchesId) {
481
+ if (EpiUploadUtil.isGenomeFile(fileName)) {
482
+ sequenceFiles.push(fileName);
483
+ } else if (EpiUploadUtil.isReadsFile(fileName)) {
484
+ readsFiles.push(fileName);
485
+ }
486
+ }
487
+ });
488
+
489
+ if (stats.sequenceColumns.length === 1 && sequenceFiles.length === 1) {
490
+ caseSequenceMapping.sequenceFileNames[stats.sequenceColumns[0].id] = sequenceFiles[0];
491
+ }
492
+ if (stats.readsColumns.length === 1) {
493
+ if (readsFiles.length === 1) {
494
+ caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].fwd = readsFiles[0];
495
+ }
496
+ if (readsFiles.length === 2) {
497
+ const sortedReadsFiles = readsFiles.sort((a, b) => a.localeCompare(b));
498
+ caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].fwd = sortedReadsFiles[0];
499
+ caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].rev = sortedReadsFiles[1];
500
+ }
501
+ }
502
+ });
503
+ return result;
504
+ }
505
+
506
+ public static getSequenceMappingStats(sequenceMapping: EpiUploadSequenceMapping, sequenceFilesDataTransfer: DataTransfer): {
507
+ numberOfFilesToMap: number;
508
+ mappedFiles: string[];
509
+ mappedSequenceFiles: string[];
510
+ mappedReadsFiles: string[];
511
+ unmappedFileNames: string[];
512
+ unmappedSequenceFiles: string[];
513
+ unmappedReadsFiles: string[];
514
+ } {
515
+ const sequenceFiles = Array.from(sequenceFilesDataTransfer.files).map(file => file.name).filter(fileName => EpiUploadUtil.isGenomeFile(fileName));
516
+ const readsFiles = Array.from(sequenceFilesDataTransfer.files).map(file => file.name).filter(fileName => EpiUploadUtil.isReadsFile(fileName));
517
+ const files = [...sequenceFiles, ...readsFiles];
518
+ const numberOfFilesToMap = files.length;
519
+
520
+ const mappedSequenceFiles = uniq(Object.values(sequenceMapping).flatMap(mapping => Object.values(mapping.sequenceFileNames)).filter(x => x));
521
+ const mappedReadsFiles = uniq(Object.values(sequenceMapping).flatMap(mapping => Object.values(mapping.readsFileNames).flatMap(reads => [reads.fwd, reads.rev])).filter(x => x));
522
+ const mappedFiles = [...mappedSequenceFiles, ...mappedReadsFiles];
523
+
524
+ const unmappedSequenceFiles = difference(sequenceFiles, mappedSequenceFiles);
525
+ const unmappedReadsFiles = difference(readsFiles, mappedReadsFiles);
526
+ const unmappedFileNames = difference(files, mappedFiles);
527
+
528
+ return {
529
+ numberOfFilesToMap,
530
+ mappedFiles,
531
+ mappedSequenceFiles,
532
+ mappedReadsFiles,
533
+ unmappedFileNames,
534
+ unmappedSequenceFiles,
535
+ unmappedReadsFiles,
536
+ };
537
+ }
538
+
539
+ public static async readFileAsBase64(file: File): Promise<string> {
540
+ return new Promise((resolve, reject) => {
541
+ const reader = new FileReader();
542
+ reader.onload = () => {
543
+ const result = reader.result as string;
544
+ const base64 = result.split(',')[1]; // Remove data:*/*;base64, prefix
545
+ resolve(base64);
546
+ };
547
+ reader.onerror = (_) => {
548
+ reject(Error('File read error'));
549
+ };
550
+ reader.readAsDataURL(file);
551
+ });
552
+ }
553
+
554
+ public static getCasesForVerification(kwArgs: { rawData: string[][]; mappedColumns: EpiUploadMappedColumn[]; caseTypeId: string; createdInDataCollectionId: string }): CaseForUpload[] {
555
+ const { rawData, mappedColumns, caseTypeId, createdInDataCollectionId } = kwArgs;
556
+ return rawData.slice(1).map((row) => {
557
+ const caseIdColumn = mappedColumns.find((mappedColumn) => mappedColumn.isCaseIdColumn)?.originalIndex;
558
+ const content: { [key: string]: string } = {};
559
+
560
+ mappedColumns.forEach((mappedColumn) => {
561
+ if (mappedColumn.col) {
562
+ content[mappedColumn.col.id] = row[mappedColumn.originalIndex];
563
+ }
564
+ });
565
+
566
+ const caseForCreateUpdate: CaseForUpload = {
567
+ id: caseIdColumn !== undefined ? row[caseIdColumn] : undefined,
568
+ case: {
569
+ content,
570
+ case_type_id: caseTypeId,
571
+ created_in_data_collection_id: createdInDataCollectionId,
572
+ },
573
+ };
574
+
575
+ return { ...caseForCreateUpdate, content };
576
+ });
577
+ }
578
+
579
+ public static async createCases(kwArgs: {
580
+ completeCaseType: CompleteCaseType;
581
+ assemblyProtocolId: string;
582
+ caseTypeId: string;
583
+ createdInDataCollectionId: string;
584
+ mappedColumns: EpiUploadMappedColumn[];
585
+ sampleIdColId: string;
586
+ sequenceMapping: EpiUploadSequenceMapping;
587
+ sequencingProtocolId: string;
588
+ signal: AbortSignal;
589
+ validatedCases: CaseUploadResult[];
590
+ validatedCasesWithGeneratedId: CaseUploadResultWithGeneratedId[];
591
+ }): Promise<CaseBatchUploadResult> {
592
+ const {
593
+ completeCaseType,
594
+ assemblyProtocolId,
595
+ caseTypeId,
596
+ createdInDataCollectionId,
597
+ mappedColumns,
598
+ sampleIdColId,
599
+ sequenceMapping,
600
+ sequencingProtocolId,
601
+ signal,
602
+ validatedCases,
603
+ validatedCasesWithGeneratedId,
604
+ } = kwArgs;
605
+ const { col: mappedSampleIdCol, sampleIdentifierIssuerId } = mappedColumns.find(mc => mc.col.id === sampleIdColId);
606
+
607
+ return (await CaseApi.instance.uploadCases({
608
+ case_type_id: caseTypeId,
609
+ created_in_data_collection_id: createdInDataCollectionId,
610
+ on_exists: UploadAction.UPDATE,
611
+ case_batch: {
612
+ cases: validatedCasesWithGeneratedId.map((vc, index) => {
613
+ const caseId = validatedCases[index].id ?? undefined;
614
+ const readSetsForUpload: ReadSetForUpload[] = [];
615
+ const seqsForUpload: SeqForUpload[] = [];
616
+ const externalSampleId = CaseUtil.getRowValue(
617
+ vc.validated_content,
618
+ mappedSampleIdCol,
619
+ completeCaseType,
620
+ )?.raw;
621
+
622
+ if (externalSampleId) {
623
+ if (sequenceMapping[vc.generatedId]?.sequenceFileNames) {
624
+ Object.entries(sequenceMapping[vc.generatedId].sequenceFileNames).forEach(([colId, fileName]) => {
625
+ if (fileName) {
626
+ seqsForUpload.push({
627
+ col_id: colId,
628
+ case_id: caseId,
629
+ other_sample_identifier: {
630
+ external_id: externalSampleId,
631
+ identifier_issuer_id: sampleIdentifierIssuerId,
632
+ },
633
+ assembly_protocol_id: assemblyProtocolId,
634
+ } satisfies SeqForUpload);
635
+ }
636
+ });
637
+ }
638
+ if (sequenceMapping[vc.generatedId]?.readsFileNames) {
639
+ Object.entries(sequenceMapping[vc.generatedId].readsFileNames).forEach(([colId, fileNames]) => {
640
+ if (fileNames.fwd || fileNames.rev) {
641
+ readSetsForUpload.push({
642
+ col_id: colId,
643
+ case_id: caseId,
644
+ other_sample_identifier: {
645
+ external_id: externalSampleId,
646
+ identifier_issuer_id: sampleIdentifierIssuerId,
647
+ },
648
+ sequencing_protocol_id: sequencingProtocolId,
649
+ } satisfies ReadSetForUpload);
650
+ }
651
+ });
652
+ }
653
+ }
654
+
655
+ return {
656
+ case: {
657
+ id: caseId,
658
+ case_type_id: caseTypeId,
659
+ created_in_data_collection_id: createdInDataCollectionId,
660
+ content: vc.validated_content,
661
+ },
662
+ read_sets: readSetsForUpload,
663
+ seqs: seqsForUpload,
664
+ } satisfies CaseForUpload;
665
+ }),
666
+ },
667
+ }, { signal })).data;
668
+ }
669
+
670
+ public static reportFileUploadProgress(kwArgs: {
671
+ startPercentage: number;
672
+ endPercentage: number;
673
+ onProgress: (progress: number, message: string) => void;
674
+ totalFileSizeToUpload: number;
675
+ uploadedFileSize: number;
676
+ fileSize: number;
677
+ message: string;
678
+ }): void {
679
+ const {
680
+ startPercentage,
681
+ endPercentage,
682
+ onProgress,
683
+ totalFileSizeToUpload,
684
+ uploadedFileSize,
685
+ fileSize,
686
+ message,
687
+ } = kwArgs;
688
+
689
+ const percentageRange = endPercentage - startPercentage;
690
+ const percentageRangePerByte = percentageRange / totalFileSizeToUpload;
691
+ const overallProgress = startPercentage + (uploadedFileSize * percentageRangePerByte) + (fileSize * percentageRangePerByte);
692
+
693
+ onProgress(overallProgress, message);
694
+ }
695
+
696
+ public static async uploadFilesForCases(kwArgs: {
697
+ startPercentage: number;
698
+ endPercentage: number;
699
+ assemblyProtocolId: string;
700
+ caseTypeId: string;
701
+ completeCaseType: CompleteCaseType;
702
+ caseBatchUploadResult: CaseBatchUploadResult;
703
+ createdInDataCollectionId: string;
704
+ mappedColumns: EpiUploadMappedColumn[];
705
+ onComplete: () => void;
706
+ onError: (error: Error) => void;
707
+ onProgress: (progress: number, message: string) => void;
708
+ sampleIdColId: string;
709
+ sequenceFilesDataTransfer: DataTransfer;
710
+ sequenceMapping: EpiUploadSequenceMapping;
711
+ sequencingProtocolId: string;
712
+ signal: AbortSignal;
713
+ validatedCases: CaseUploadResult[];
714
+ validatedCasesWithGeneratedId: CaseUploadResultWithGeneratedId[];
715
+ }): Promise<void> {
716
+ const {
717
+ startPercentage,
718
+ endPercentage,
719
+ caseBatchUploadResult,
720
+ onProgress,
721
+ sequenceFilesDataTransfer,
722
+ sequenceMapping,
723
+ signal,
724
+ } = kwArgs;
725
+
726
+ const seqsToBeUploaded: Array<{ caseId: string; colId: string; fileName: string }> = [];
727
+ const readSetsToBeUploaded: Array<{ caseId: string; colId: string; fileName: string; is_fwd: boolean }> = [];
728
+ let totalFileSizeToUpload = 0;
729
+
730
+ for (const [index, caseUploadResult] of caseBatchUploadResult.cases.entries()) {
731
+ const { generatedId } = kwArgs.validatedCasesWithGeneratedId[index];
732
+ if (sequenceMapping[generatedId]) {
733
+ const caseId = caseUploadResult.id;
734
+ for (const [colId, fileName] of Object.entries(sequenceMapping[generatedId].sequenceFileNames)) {
735
+ if (fileName) {
736
+ const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileName);
737
+ if (file) {
738
+ seqsToBeUploaded.push({ caseId, colId, fileName });
739
+ totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);
740
+ }
741
+ }
742
+ }
743
+ for (const [colId, fileNames] of Object.entries(sequenceMapping[generatedId].readsFileNames)) {
744
+ if (fileNames.fwd) {
745
+ const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileNames.fwd);
746
+ if (file) {
747
+ readSetsToBeUploaded.push({ caseId, colId, fileName: fileNames.fwd, is_fwd: true });
748
+ totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);
749
+ }
750
+ }
751
+ if (fileNames.rev) {
752
+ const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileNames.rev);
753
+ if (file) {
754
+ readSetsToBeUploaded.push({ caseId, colId, fileName: fileNames.rev, is_fwd: false });
755
+ totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);
756
+ }
757
+ }
758
+ }
759
+ }
760
+ }
761
+
762
+ // upload in order of cases
763
+ let uploadedFileSize = 0;
764
+ for (const caseUploadResult of caseBatchUploadResult.cases) {
765
+ const caseSeqToBeUploaded = seqsToBeUploaded.find(s => s.caseId === caseUploadResult.id);
766
+ const caseReadSetsToBeUploaded = readSetsToBeUploaded.filter(rs => rs.caseId === caseUploadResult.id);
767
+
768
+ if (caseSeqToBeUploaded) {
769
+ const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === caseSeqToBeUploaded.fileName);
770
+ if (file) {
771
+ const fileSize = file.size;
772
+ const base64Data = await EpiUploadUtil.readFileAsBase64(file);
773
+ await CaseApi.instance.createFileForSeq(caseSeqToBeUploaded.caseId, caseSeqToBeUploaded.colId, {
774
+ file_content: base64Data,
775
+ file_compression: FileUtil.getFileCompressionFromFileName(caseSeqToBeUploaded.fileName),
776
+ file_format: SeqFileFormat.FASTA,
777
+ }, { signal });
778
+ EpiUploadUtil.reportFileUploadProgress({
779
+ startPercentage,
780
+ endPercentage,
781
+ onProgress,
782
+ totalFileSizeToUpload,
783
+ uploadedFileSize,
784
+ fileSize,
785
+ message: t('Uploading sequence file "{{fileName}}" for case ID "{{caseId}}"...', { fileName: caseSeqToBeUploaded.fileName, caseId: caseSeqToBeUploaded.caseId }),
786
+ });
787
+ uploadedFileSize += fileSize;
788
+ }
789
+ }
790
+ for (const caseReadSetToBeUploaded of caseReadSetsToBeUploaded) {
791
+ const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === caseReadSetToBeUploaded.fileName);
792
+ if (file) {
793
+ const fileSize = file.size;
794
+ const base64Data = await EpiUploadUtil.readFileAsBase64(file);
795
+ await CaseApi.instance.createFileForReadSet(caseReadSetToBeUploaded.caseId, caseReadSetToBeUploaded.colId, {
796
+ file_content: base64Data,
797
+ file_compression: FileUtil.getFileCompressionFromFileName(caseReadSetToBeUploaded.fileName),
798
+ file_format: ReadsFileFormat.FASTQ,
799
+ is_fwd: caseReadSetToBeUploaded.is_fwd,
800
+ }, { signal });
801
+ EpiUploadUtil.reportFileUploadProgress({
802
+ startPercentage,
803
+ endPercentage,
804
+ onProgress,
805
+ totalFileSizeToUpload,
806
+ uploadedFileSize,
807
+ fileSize,
808
+ message: t('Uploading read set file "{{fileName}}" for case ID "{{caseId}}"...', { fileName: caseReadSetToBeUploaded.fileName, caseId: caseReadSetToBeUploaded.caseId }),
809
+ });
810
+ uploadedFileSize += fileSize;
811
+ }
812
+ }
813
+ }
814
+ }
815
+
816
+ public static async createCasesAndUploadFiles(kwArgs: {
817
+ completeCaseType: CompleteCaseType;
818
+ assemblyProtocolId: string;
819
+ caseTypeId: string;
820
+ createdInDataCollectionId: string;
821
+ mappedColumns: EpiUploadMappedColumn[];
822
+ onComplete: () => void;
823
+ sampleIdColId: string;
824
+ onError: (error: Error) => void;
825
+ onProgress: (progress: number, message: string) => void;
826
+ sequenceFilesDataTransfer: DataTransfer;
827
+ sequenceMapping: EpiUploadSequenceMapping;
828
+ sequencingProtocolId: string;
829
+ signal: AbortSignal;
830
+ validatedCases: CaseUploadResult[];
831
+ validatedCasesWithGeneratedId: CaseUploadResultWithGeneratedId[];
832
+ }): Promise<void> {
833
+ const {
834
+ onComplete,
835
+ onError,
836
+ onProgress,
837
+ } = kwArgs;
838
+
839
+ try {
840
+ onProgress(0, t('Creating cases...'));
841
+ const caseBatchUploadResult = await EpiUploadUtil.createCases(kwArgs);
842
+
843
+ if (caseBatchUploadResult.status === EtlStatus.FAILED) {
844
+ throw new UploadError(t('Failed to create cases during upload.'), caseBatchUploadResult);
845
+ }
846
+
847
+ await EpiUploadUtil.uploadFilesForCases({ ...kwArgs, caseBatchUploadResult, startPercentage: 1, endPercentage: 99 });
848
+ onProgress(100, t('Upload complete.'));
849
+
850
+ await QueryUtil.invalidateQueryKeys(QueryUtil.getQueryKeyDependencies([QUERY_KEY.CASES], true));
851
+ onComplete();
852
+ } catch (error) {
853
+ onError(error instanceof Error ? error : new Error('Unknown error occurred during upload'));
854
+ throw error;
855
+ }
856
+ }
857
+ }