vintasend 0.4.0 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/examples/vintasend-medplum-example/.env.example +11 -0
- package/dist/examples/vintasend-medplum-example/IMPLEMENTATION_PLAN_FILE_ATTACHMENTS.md +597 -0
- package/dist/examples/vintasend-medplum-example/README.md +190 -0
- package/dist/examples/vintasend-medplum-example/TUTORIAL_EMAIL_NOTIFICATIONS.md +2596 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-pending-notifications-bot.ts +39 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-task-assignment-email.ts +41 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/task-due-soon-notification-bot.ts +86 -0
- package/dist/examples/vintasend-medplum-example/bots/index.ts +53 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/schedule-task-due-soon-email.ts +84 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.test.ts +388 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.ts +113 -0
- package/dist/examples/vintasend-medplum-example/bots/shared/task-due-soon-helpers.ts +115 -0
- package/dist/examples/vintasend-medplum-example/bots/task-assignment-bot.ts +41 -0
- package/dist/examples/vintasend-medplum-example/compiled-notification-templates.json +6 -0
- package/dist/examples/vintasend-medplum-example/esbuild-script.mjs +71 -0
- package/dist/examples/vintasend-medplum-example/index.html +14 -0
- package/dist/examples/vintasend-medplum-example/lib/constants.ts +32 -0
- package/dist/examples/vintasend-medplum-example/lib/extensions.ts +1 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.test.ts +389 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.ts +222 -0
- package/dist/examples/vintasend-medplum-example/lib/medplum-singleton.ts +18 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.test.ts +293 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.ts +284 -0
- package/dist/examples/vintasend-medplum-example/lib/patients.ts +20 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/body.html.pug +37 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/body.html.pug +34 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/package.json +75 -0
- package/dist/examples/vintasend-medplum-example/plugins/gql-plugin.mjs +31 -0
- package/dist/examples/vintasend-medplum-example/postcss.config.mjs +21 -0
- package/dist/examples/vintasend-medplum-example/public/favicon.ico +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/acuity.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/auth0.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/azure.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/calcom.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/candid.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/claude.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/datadog.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/deepseek.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/entra.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/epic.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/google.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthgorilla.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthie.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/labcorp.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/okta.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/openai.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/particle.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/quest.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/recaptcha.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/snowflake.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stedi.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stripe.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/sumo.png +0 -0
- package/dist/examples/vintasend-medplum-example/scripts/README.md +162 -0
- package/dist/examples/vintasend-medplum-example/scripts/client.ts +18 -0
- package/dist/examples/vintasend-medplum-example/scripts/deploy-bots.ts +171 -0
- package/dist/examples/vintasend-medplum-example/src/App.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.test.tsx +350 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.test.tsx +616 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.tsx +138 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.test.tsx +92 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.test.tsx +464 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.tsx +186 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.test.tsx +80 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.module.css +3 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.tsx +62 -0
- package/dist/examples/vintasend-medplum-example/src/components/MessageWithLinks.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.test.tsx +299 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.tsx +52 -0
- package/dist/examples/vintasend-medplum-example/src/components/ResourceFormWithRequiredProfile.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.test.tsx +1016 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.tsx +298 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.test.tsx +732 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.tsx +282 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.test.tsx +268 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.tsx +212 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.test.tsx +120 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.test.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.test.tsx +431 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.tsx +130 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.module.css +31 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.tsx +143 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.module.css +11 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.test.tsx +875 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.tsx +943 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.test.tsx +413 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabSelectEmpty.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/README.md +104 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.test.tsx +318 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.test.tsx +126 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.tsx +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.test.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.tsx +165 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.test.tsx +523 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.tsx +230 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.test.tsx +567 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.tsx +358 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.module.css +40 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.tsx +257 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.test.tsx +279 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.test.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.module.css +26 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.test.tsx +305 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.module.css +262 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.test.tsx +622 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.tsx +286 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/NewTaskModal.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskAttachmentList.tsx +132 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.test.tsx +749 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.test.tsx +278 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFileUpload.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.test.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.tsx +142 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.utils.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.test.tsx +134 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.tsx +250 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.test.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.test.tsx +68 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.test.tsx +555 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.test.tsx +32 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.tsx +34 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.test.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.tsx +29 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.test.tsx +285 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.test.tsx +455 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.test.tsx +435 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.tsx +116 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.module.css +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.test.tsx +200 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.test.ts +176 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.ts +17 -0
- package/dist/examples/vintasend-medplum-example/src/config/constants.ts +3 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.test.tsx +166 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.ts +11 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.test.tsx +477 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.ts +191 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.ts +18 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.test.tsx +379 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.ts +194 -0
- package/dist/examples/vintasend-medplum-example/src/index.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/main.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.test.tsx +295 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.tsx +124 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.test.tsx +77 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.test.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.tsx +27 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.test.tsx +287 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.tsx +151 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.test.tsx +519 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.tsx +179 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/FavoriteMedicationsTable.tsx +76 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.tsx +222 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.test.tsx +356 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.test.tsx +103 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.tsx +78 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.test.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.test.tsx +364 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.test.tsx +159 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.test.tsx +140 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.tsx +72 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.test.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.test.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.tsx +710 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.module.css +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.test.tsx +428 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.tsx +334 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.module.css +24 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.test.tsx +154 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.test.ts +223 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.ts +89 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.test.tsx +147 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.tsx +79 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientTabsNavigation.tsx +35 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.test.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TimelineTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.test.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.tsx +117 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceDetailPage.tsx +28 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.test.tsx +131 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.tsx +65 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.test.tsx +108 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.tsx +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.test.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/useResourceType.ts +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/utils.ts +9 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.test.tsx +302 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/ChatInput.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.test.tsx +102 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.test.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/test-utils/render.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/test.setup.ts +49 -0
- package/dist/examples/vintasend-medplum-example/src/types/encounter.ts +8 -0
- package/dist/examples/vintasend-medplum-example/src/types/spaces.ts +10 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.test.ts +141 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.ts +59 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.test.ts +153 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.ts +65 -0
- package/dist/examples/vintasend-medplum-example/src/utils/communication-search.ts +47 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.test.ts +48 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.ts +33 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.test.ts +102 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.ts +55 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.test.ts +169 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.ts +261 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.test.ts +154 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.ts +272 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.test.ts +1137 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.ts +827 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.test.ts +27 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.ts +15 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spaceMessaging.ts +249 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.test.ts +450 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.ts +147 -0
- package/dist/examples/vintasend-medplum-example/src/utils/task-search.ts +63 -0
- package/dist/examples/vintasend-medplum-example/src/vite-env.d.ts +3 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.bots.json +4 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.json +19 -0
- package/dist/examples/vintasend-medplum-example/vercel.json +3 -0
- package/dist/examples/vintasend-medplum-example/vite.config.ts +44 -0
- package/dist/services/notification-backends/base-notification-backend.d.ts +5 -0
- package/dist/services/notification-service.js +11 -1
- package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.borderRight {
|
|
2
|
+
border-right: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-gray-8));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.segmentedControl {
|
|
6
|
+
border-radius: var(--mantine-radius-md);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[data-mantine-color-scheme='light'] .segmentedControl {
|
|
10
|
+
background-color: var(--mantine-color-gray-1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-mantine-color-scheme='dark'] .segmentedControl {
|
|
14
|
+
background-color: var(--mantine-color-dark-6);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.segmentedControl .mantine-SegmentedControl-indicator {
|
|
18
|
+
background-color: light-dark(var(--mantine-color-white), var(--mantine-color-dark-4));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.segmentedControl .mantine-SegmentedControl-label {
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
padding: var(--mantine-spacing-xs) var(--mantine-spacing-md);
|
|
24
|
+
color: light-dark(var(--mantine-color-dark-9), var(--mantine-color-gray-0));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.button {
|
|
28
|
+
height: 32px;
|
|
29
|
+
background-color: light-dark(var(--mantine-color-gray-1), var(--mantine-color-gray-8));
|
|
30
|
+
color: light-dark(var(--mantine-color-black), var(--mantine-color-gray-4));
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.selected {
|
|
35
|
+
background-color: light-dark(var(--mantine-color-black), var(--mantine-color-gray-6));
|
|
36
|
+
color: light-dark(var(--mantine-color-white), var(--mantine-color-white));
|
|
37
|
+
}
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import { Notifications } from '@mantine/notifications';
|
|
5
|
+
import type { ServiceRequest } from '@medplum/fhirtypes';
|
|
6
|
+
import { HomerSimpson, MockClient } from '@medplum/mock';
|
|
7
|
+
import { MedplumProvider } from '@medplum/react';
|
|
8
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
9
|
+
import userEvent from '@testing-library/user-event';
|
|
10
|
+
import { MemoryRouter, Routes, Route } from 'react-router';
|
|
11
|
+
import { describe, expect, test, vi, beforeEach } from 'vitest';
|
|
12
|
+
import { LabsPage } from './LabsPage';
|
|
13
|
+
|
|
14
|
+
describe('LabsPage', () => {
|
|
15
|
+
let medplum: MockClient;
|
|
16
|
+
|
|
17
|
+
beforeEach(async () => {
|
|
18
|
+
medplum = new MockClient();
|
|
19
|
+
vi.clearAllMocks();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const setup = (initialPath = `/Patient/${HomerSimpson.id}/ServiceRequest`): ReturnType<typeof render> => {
|
|
23
|
+
return render(
|
|
24
|
+
<MemoryRouter initialEntries={[initialPath]}>
|
|
25
|
+
<MedplumProvider medplum={medplum}>
|
|
26
|
+
<MantineProvider>
|
|
27
|
+
<Notifications />
|
|
28
|
+
<Routes>
|
|
29
|
+
<Route path="/Patient/:patientId/ServiceRequest/:serviceRequestId" element={<LabsPage />} />
|
|
30
|
+
<Route path="/Patient/:patientId/ServiceRequest" element={<LabsPage />} />
|
|
31
|
+
</Routes>
|
|
32
|
+
</MantineProvider>
|
|
33
|
+
</MedplumProvider>
|
|
34
|
+
</MemoryRouter>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
test('renders tabs and new order button', async () => {
|
|
39
|
+
setup();
|
|
40
|
+
|
|
41
|
+
await waitFor(() => {
|
|
42
|
+
expect(screen.getByText('Completed')).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByText('Open')).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Find the plus button by its icon (ActionIcon with IconPlus)
|
|
47
|
+
const plusButtons = screen.getAllByRole('button', { name: '' });
|
|
48
|
+
const plusButton = plusButtons.find((btn) => btn.querySelector('.tabler-icon-plus'));
|
|
49
|
+
expect(plusButton).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('shows loading skeleton when loading', async () => {
|
|
53
|
+
// Mock searchResources to return a promise that never resolves
|
|
54
|
+
medplum.searchResources = vi.fn().mockImplementation(() => new Promise(() => {}));
|
|
55
|
+
setup();
|
|
56
|
+
|
|
57
|
+
await waitFor(() => {
|
|
58
|
+
const skeletons = document.querySelectorAll('.mantine-Skeleton-root');
|
|
59
|
+
expect(skeletons.length).toBeGreaterThan(0);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('shows empty state when no orders are found', async () => {
|
|
64
|
+
medplum.searchResources = vi.fn().mockResolvedValue([]);
|
|
65
|
+
setup();
|
|
66
|
+
|
|
67
|
+
await waitFor(() => {
|
|
68
|
+
expect(screen.getByText(/No completed labs to display/i)).toBeInTheDocument();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('displays completed orders in completed tab', async () => {
|
|
73
|
+
const completedOrder: ServiceRequest = {
|
|
74
|
+
resourceType: 'ServiceRequest',
|
|
75
|
+
id: 'completed-1',
|
|
76
|
+
status: 'completed',
|
|
77
|
+
intent: 'order',
|
|
78
|
+
code: { text: 'Complete Blood Count' },
|
|
79
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
80
|
+
requisition: { value: 'REQ-001' },
|
|
81
|
+
meta: {
|
|
82
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
await medplum.createResource(completedOrder);
|
|
87
|
+
medplum.searchResources = vi.fn().mockResolvedValue([completedOrder]);
|
|
88
|
+
setup();
|
|
89
|
+
|
|
90
|
+
await waitFor(() => {
|
|
91
|
+
expect(screen.getByText('Complete Blood Count')).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('displays open orders in open tab', async () => {
|
|
96
|
+
const openOrder: ServiceRequest = {
|
|
97
|
+
resourceType: 'ServiceRequest',
|
|
98
|
+
id: 'open-1',
|
|
99
|
+
status: 'active',
|
|
100
|
+
intent: 'order',
|
|
101
|
+
code: { text: 'Metabolic Panel' },
|
|
102
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
103
|
+
requisition: { value: 'REQ-002' },
|
|
104
|
+
meta: {
|
|
105
|
+
lastUpdated: '2024-01-02T10:00:00Z',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
await medplum.createResource(openOrder);
|
|
110
|
+
medplum.searchResources = vi.fn().mockResolvedValue([openOrder]);
|
|
111
|
+
setup();
|
|
112
|
+
|
|
113
|
+
// Switch to open tab
|
|
114
|
+
const openTab = screen.getByText('Open');
|
|
115
|
+
await userEvent.click(openTab);
|
|
116
|
+
|
|
117
|
+
await waitFor(() => {
|
|
118
|
+
expect(screen.getByText('Metabolic Panel')).toBeInTheDocument();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('switches between tabs', async () => {
|
|
123
|
+
const completedOrder: ServiceRequest = {
|
|
124
|
+
resourceType: 'ServiceRequest',
|
|
125
|
+
id: 'completed-1',
|
|
126
|
+
status: 'completed',
|
|
127
|
+
intent: 'order',
|
|
128
|
+
code: { text: 'Completed Test' },
|
|
129
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
130
|
+
requisition: { value: 'REQ-001' },
|
|
131
|
+
meta: {
|
|
132
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const openOrder: ServiceRequest = {
|
|
137
|
+
resourceType: 'ServiceRequest',
|
|
138
|
+
id: 'open-1',
|
|
139
|
+
status: 'active',
|
|
140
|
+
intent: 'order',
|
|
141
|
+
code: { text: 'Open Test' },
|
|
142
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
143
|
+
requisition: { value: 'REQ-002' },
|
|
144
|
+
meta: {
|
|
145
|
+
lastUpdated: '2024-01-02T10:00:00Z',
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
await medplum.createResource(completedOrder);
|
|
150
|
+
await medplum.createResource(openOrder);
|
|
151
|
+
medplum.searchResources = vi.fn().mockResolvedValue([completedOrder, openOrder]);
|
|
152
|
+
setup();
|
|
153
|
+
|
|
154
|
+
// Initially shows completed tab
|
|
155
|
+
await waitFor(() => {
|
|
156
|
+
expect(screen.getByText('Completed Test')).toBeInTheDocument();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Switch to open tab
|
|
160
|
+
const openTab = screen.getByText('Open');
|
|
161
|
+
await userEvent.click(openTab);
|
|
162
|
+
|
|
163
|
+
await waitFor(() => {
|
|
164
|
+
expect(screen.getByText('Open Test')).toBeInTheDocument();
|
|
165
|
+
expect(screen.queryByText('Completed Test')).not.toBeInTheDocument();
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Switch back to completed tab
|
|
169
|
+
const completedTab = screen.getByText('Completed');
|
|
170
|
+
await userEvent.click(completedTab);
|
|
171
|
+
|
|
172
|
+
await waitFor(() => {
|
|
173
|
+
expect(screen.getByText('Completed Test')).toBeInTheDocument();
|
|
174
|
+
expect(screen.queryByText('Open Test')).not.toBeInTheDocument();
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('opens new order modal when plus button is clicked', async () => {
|
|
179
|
+
medplum.searchResources = vi.fn().mockResolvedValue([]);
|
|
180
|
+
setup();
|
|
181
|
+
|
|
182
|
+
// Find the plus button by its icon (ActionIcon with IconPlus)
|
|
183
|
+
const plusButtons = screen.getAllByRole('button', { name: '' });
|
|
184
|
+
const plusButton = plusButtons.find((btn) => btn.querySelector('.tabler-icon-plus'));
|
|
185
|
+
expect(plusButton).toBeDefined();
|
|
186
|
+
if (plusButton) {
|
|
187
|
+
await userEvent.click(plusButton);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
await waitFor(() => {
|
|
191
|
+
expect(screen.getByText('Order Labs')).toBeInTheDocument();
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('closes new order modal when onClose is called', async () => {
|
|
196
|
+
medplum.searchResources = vi.fn().mockResolvedValue([]);
|
|
197
|
+
setup();
|
|
198
|
+
|
|
199
|
+
// Find the plus button by its icon (ActionIcon with IconPlus)
|
|
200
|
+
const plusButtons = screen.getAllByRole('button', { name: '' });
|
|
201
|
+
const plusButton = plusButtons.find((btn) => btn.querySelector('.tabler-icon-plus'));
|
|
202
|
+
expect(plusButton).toBeDefined();
|
|
203
|
+
if (plusButton) {
|
|
204
|
+
await userEvent.click(plusButton);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
await waitFor(() => {
|
|
208
|
+
expect(screen.getByText('Order Labs')).toBeInTheDocument();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const closeButton = document.querySelector('.mantine-Modal-close');
|
|
212
|
+
if (closeButton) {
|
|
213
|
+
await userEvent.click(closeButton);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
await waitFor(() => {
|
|
217
|
+
expect(screen.queryByText('Order Labs')).not.toBeInTheDocument();
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('filters out draft and entered-in-error orders from open tab', async () => {
|
|
222
|
+
const activeOrder: ServiceRequest = {
|
|
223
|
+
resourceType: 'ServiceRequest',
|
|
224
|
+
id: 'active-1',
|
|
225
|
+
status: 'active',
|
|
226
|
+
intent: 'order',
|
|
227
|
+
code: { text: 'Active Order' },
|
|
228
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
229
|
+
meta: {
|
|
230
|
+
lastUpdated: '2024-01-02T10:00:00Z',
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const draftOrder: ServiceRequest = {
|
|
235
|
+
resourceType: 'ServiceRequest',
|
|
236
|
+
id: 'draft-1',
|
|
237
|
+
status: 'draft',
|
|
238
|
+
intent: 'order',
|
|
239
|
+
code: { text: 'Draft Order' },
|
|
240
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
241
|
+
meta: {
|
|
242
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const errorOrder: ServiceRequest = {
|
|
247
|
+
resourceType: 'ServiceRequest',
|
|
248
|
+
id: 'error-1',
|
|
249
|
+
status: 'entered-in-error',
|
|
250
|
+
intent: 'order',
|
|
251
|
+
code: { text: 'Error Order' },
|
|
252
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
253
|
+
meta: {
|
|
254
|
+
lastUpdated: '2024-01-01T09:00:00Z',
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
await medplum.createResource(activeOrder);
|
|
259
|
+
await medplum.createResource(draftOrder);
|
|
260
|
+
await medplum.createResource(errorOrder);
|
|
261
|
+
medplum.searchResources = vi.fn().mockResolvedValue([activeOrder, draftOrder, errorOrder]);
|
|
262
|
+
setup();
|
|
263
|
+
|
|
264
|
+
// Switch to open tab
|
|
265
|
+
const openTab = screen.getByText('Open');
|
|
266
|
+
await userEvent.click(openTab);
|
|
267
|
+
|
|
268
|
+
await waitFor(() => {
|
|
269
|
+
expect(screen.getByText('Active Order')).toBeInTheDocument();
|
|
270
|
+
expect(screen.queryByText('Draft Order')).not.toBeInTheDocument();
|
|
271
|
+
expect(screen.queryByText('Error Order')).not.toBeInTheDocument();
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test('displays order details when order is selected', async () => {
|
|
276
|
+
const completedOrder: ServiceRequest = {
|
|
277
|
+
resourceType: 'ServiceRequest',
|
|
278
|
+
id: 'completed-1',
|
|
279
|
+
status: 'completed',
|
|
280
|
+
intent: 'order',
|
|
281
|
+
code: { text: 'Complete Blood Count' },
|
|
282
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
283
|
+
requisition: { value: 'REQ-001' },
|
|
284
|
+
meta: {
|
|
285
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
await medplum.createResource(completedOrder);
|
|
290
|
+
medplum.searchResources = vi.fn().mockResolvedValue([completedOrder]);
|
|
291
|
+
setup(`/Patient/${HomerSimpson.id}/ServiceRequest/${completedOrder.id}`);
|
|
292
|
+
|
|
293
|
+
await waitFor(() => {
|
|
294
|
+
// The order should be found in the search results and displayed (may appear multiple times)
|
|
295
|
+
const elements = screen.getAllByText('Complete Blood Count');
|
|
296
|
+
expect(elements.length).toBeGreaterThan(0);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test('fetches order when serviceRequestId is not in current items', async () => {
|
|
301
|
+
const completedOrder: ServiceRequest = {
|
|
302
|
+
resourceType: 'ServiceRequest',
|
|
303
|
+
id: 'completed-1',
|
|
304
|
+
status: 'completed',
|
|
305
|
+
intent: 'order',
|
|
306
|
+
code: { text: 'Complete Blood Count' },
|
|
307
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
308
|
+
requisition: { value: 'REQ-001' },
|
|
309
|
+
meta: {
|
|
310
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
await medplum.createResource(completedOrder);
|
|
315
|
+
// Return empty results so the order is not in currentItems
|
|
316
|
+
medplum.searchResources = vi.fn().mockResolvedValue([]);
|
|
317
|
+
const readResourceSpy = vi.spyOn(medplum, 'readResource').mockResolvedValue(completedOrder as any);
|
|
318
|
+
setup(`/Patient/${HomerSimpson.id}/ServiceRequest/${completedOrder.id}`);
|
|
319
|
+
|
|
320
|
+
// Wait for search to complete first
|
|
321
|
+
await waitFor(() => {
|
|
322
|
+
expect(medplum.searchResources).toHaveBeenCalled();
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// Then wait for readResource to be called
|
|
326
|
+
await waitFor(
|
|
327
|
+
() => {
|
|
328
|
+
expect(readResourceSpy).toHaveBeenCalledWith('ServiceRequest', completedOrder.id);
|
|
329
|
+
},
|
|
330
|
+
{ timeout: 3000 }
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
test('shows empty state message for open tab when no open orders', async () => {
|
|
335
|
+
medplum.searchResources = vi.fn().mockResolvedValue([]);
|
|
336
|
+
setup();
|
|
337
|
+
|
|
338
|
+
const openTab = screen.getByText('Open');
|
|
339
|
+
await userEvent.click(openTab);
|
|
340
|
+
|
|
341
|
+
await waitFor(() => {
|
|
342
|
+
expect(screen.getByText(/No open labs to display/i)).toBeInTheDocument();
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
test('filters orders based on requisition numbers', async () => {
|
|
347
|
+
const order1: ServiceRequest = {
|
|
348
|
+
resourceType: 'ServiceRequest',
|
|
349
|
+
id: 'order-1',
|
|
350
|
+
status: 'completed',
|
|
351
|
+
intent: 'order',
|
|
352
|
+
code: { text: 'Test 1' },
|
|
353
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
354
|
+
requisition: { value: 'REQ-001' },
|
|
355
|
+
meta: {
|
|
356
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const order2: ServiceRequest = {
|
|
361
|
+
resourceType: 'ServiceRequest',
|
|
362
|
+
id: 'order-2',
|
|
363
|
+
status: 'completed',
|
|
364
|
+
intent: 'order',
|
|
365
|
+
code: { text: 'Test 2' },
|
|
366
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
367
|
+
requisition: { value: 'REQ-001' }, // Same requisition number
|
|
368
|
+
meta: {
|
|
369
|
+
lastUpdated: '2024-01-01T11:00:00Z',
|
|
370
|
+
},
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
await medplum.createResource(order1);
|
|
374
|
+
await medplum.createResource(order2);
|
|
375
|
+
medplum.searchResources = vi.fn().mockResolvedValue([order1, order2]);
|
|
376
|
+
setup();
|
|
377
|
+
|
|
378
|
+
// Only one order with the same requisition number should be shown
|
|
379
|
+
await waitFor(() => {
|
|
380
|
+
const test1Elements = screen.queryAllByText('Test 1');
|
|
381
|
+
const test2Elements = screen.queryAllByText('Test 2');
|
|
382
|
+
// One should be shown, the other filtered out
|
|
383
|
+
expect(test1Elements.length + test2Elements.length).toBe(1);
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
test('filters out orders based on completed basedOn references', async () => {
|
|
388
|
+
const completedOrder: ServiceRequest = {
|
|
389
|
+
resourceType: 'ServiceRequest',
|
|
390
|
+
id: 'completed-base',
|
|
391
|
+
status: 'completed',
|
|
392
|
+
intent: 'order',
|
|
393
|
+
code: { text: 'Base Order' },
|
|
394
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
395
|
+
requisition: { value: 'REQ-BASE' },
|
|
396
|
+
meta: {
|
|
397
|
+
lastUpdated: '2024-01-01T10:00:00Z',
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const basedOnOrder: ServiceRequest = {
|
|
402
|
+
resourceType: 'ServiceRequest',
|
|
403
|
+
id: 'based-on-order',
|
|
404
|
+
status: 'active',
|
|
405
|
+
intent: 'order',
|
|
406
|
+
code: { text: 'Based On Order' },
|
|
407
|
+
subject: { reference: `Patient/${HomerSimpson.id}` },
|
|
408
|
+
basedOn: [{ reference: 'ServiceRequest/completed-base' }],
|
|
409
|
+
meta: {
|
|
410
|
+
lastUpdated: '2024-01-02T10:00:00Z',
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
await medplum.createResource(completedOrder);
|
|
415
|
+
await medplum.createResource(basedOnOrder);
|
|
416
|
+
medplum.searchResources = vi.fn().mockResolvedValue([completedOrder, basedOnOrder]);
|
|
417
|
+
setup();
|
|
418
|
+
|
|
419
|
+
// Switch to open tab
|
|
420
|
+
const openTab = screen.getByText('Open');
|
|
421
|
+
await userEvent.click(openTab);
|
|
422
|
+
|
|
423
|
+
await waitFor(() => {
|
|
424
|
+
// The basedOn order should be filtered out because its base order is completed
|
|
425
|
+
expect(screen.queryByText('Based On Order')).not.toBeInTheDocument();
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
});
|