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,167 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import type { Communication } from '@medplum/fhirtypes';
|
|
5
|
+
import { HomerSimpson, MockClient } from '@medplum/mock';
|
|
6
|
+
import { MedplumProvider } from '@medplum/react';
|
|
7
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
8
|
+
import { MemoryRouter } from 'react-router';
|
|
9
|
+
import { describe, expect, test, vi, beforeEach } from 'vitest';
|
|
10
|
+
import { ChatListItem } from './ChatListItem';
|
|
11
|
+
import { createReference } from '@medplum/core';
|
|
12
|
+
|
|
13
|
+
const mockTopic: Communication = {
|
|
14
|
+
resourceType: 'Communication',
|
|
15
|
+
id: 'topic-123',
|
|
16
|
+
status: 'in-progress',
|
|
17
|
+
subject: createReference(HomerSimpson),
|
|
18
|
+
topic: { text: 'Test Topic' },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const mockLastCommunication: Communication = {
|
|
22
|
+
resourceType: 'Communication',
|
|
23
|
+
id: 'last-comm-123',
|
|
24
|
+
status: 'in-progress',
|
|
25
|
+
sent: '2024-01-15T10:30:00Z',
|
|
26
|
+
sender: { display: 'Dr. Smith' },
|
|
27
|
+
payload: [
|
|
28
|
+
{
|
|
29
|
+
contentString:
|
|
30
|
+
'This is a test message that is longer than 100 characters to test the truncation functionality of the chat list item component',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const mockGetThreadUri = vi.fn((topic: Communication) => `/Message/${topic.id}`);
|
|
36
|
+
|
|
37
|
+
describe('ChatListItem', () => {
|
|
38
|
+
let medplum: MockClient;
|
|
39
|
+
|
|
40
|
+
beforeEach(async () => {
|
|
41
|
+
medplum = new MockClient();
|
|
42
|
+
vi.clearAllMocks();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const setup = (topic: Communication, lastCommunication: Communication | undefined, isSelected: boolean): void => {
|
|
46
|
+
render(
|
|
47
|
+
<MemoryRouter>
|
|
48
|
+
<MedplumProvider medplum={medplum}>
|
|
49
|
+
<MantineProvider>
|
|
50
|
+
<ChatListItem
|
|
51
|
+
topic={topic}
|
|
52
|
+
lastCommunication={lastCommunication}
|
|
53
|
+
isSelected={isSelected}
|
|
54
|
+
getThreadUri={mockGetThreadUri}
|
|
55
|
+
/>
|
|
56
|
+
</MantineProvider>
|
|
57
|
+
</MedplumProvider>
|
|
58
|
+
</MemoryRouter>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
test('renders topic with patient name', async () => {
|
|
63
|
+
setup(mockTopic, mockLastCommunication, false);
|
|
64
|
+
|
|
65
|
+
await waitFor(() => {
|
|
66
|
+
expect(screen.getByText('Homer Simpson')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('renders topic text when available', async () => {
|
|
71
|
+
setup(mockTopic, mockLastCommunication, false);
|
|
72
|
+
|
|
73
|
+
await waitFor(() => {
|
|
74
|
+
expect(screen.getByText('Test Topic')).toBeInTheDocument();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('renders last message when topic text is not available', async () => {
|
|
79
|
+
const topicWithoutText: Communication = {
|
|
80
|
+
...mockTopic,
|
|
81
|
+
topic: undefined,
|
|
82
|
+
};
|
|
83
|
+
setup(topicWithoutText, mockLastCommunication, false);
|
|
84
|
+
|
|
85
|
+
await waitFor(() => {
|
|
86
|
+
expect(screen.getByText(/Dr. Smith/)).toBeInTheDocument();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('truncates long messages when topic text is not available', async () => {
|
|
91
|
+
const longMessage =
|
|
92
|
+
'This is a very long message from Dr. Smith that is meant to exceed one hundred characters in length. It just keeps going and going beyond the limit of what is shown in the UI preview.';
|
|
93
|
+
const topicWithoutText: Communication = {
|
|
94
|
+
...mockTopic,
|
|
95
|
+
topic: undefined,
|
|
96
|
+
};
|
|
97
|
+
const lastCommunicationWithLongMessage: Communication = {
|
|
98
|
+
...mockLastCommunication,
|
|
99
|
+
payload: [{ contentString: longMessage }],
|
|
100
|
+
};
|
|
101
|
+
setup(topicWithoutText, lastCommunicationWithLongMessage, false);
|
|
102
|
+
await waitFor(() => {
|
|
103
|
+
const truncated = `Dr. Smith: ${longMessage.slice(0, 100)}...`;
|
|
104
|
+
expect(screen.getByText(truncated)).toBeInTheDocument();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('shows topic text when available, even without last communication', async () => {
|
|
109
|
+
setup(mockTopic, undefined, false);
|
|
110
|
+
|
|
111
|
+
await waitFor(() => {
|
|
112
|
+
expect(screen.getByText('Test Topic')).toBeInTheDocument();
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('displays formatted date when last communication exists', async () => {
|
|
117
|
+
setup(mockTopic, mockLastCommunication, false);
|
|
118
|
+
|
|
119
|
+
await waitFor(() => {
|
|
120
|
+
// The date should be formatted and displayed
|
|
121
|
+
const dateElement = screen.getByText(/2024/);
|
|
122
|
+
expect(dateElement).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('applies selected class when isSelected is true', async () => {
|
|
127
|
+
setup(mockTopic, mockLastCommunication, true);
|
|
128
|
+
|
|
129
|
+
await waitFor(() => {
|
|
130
|
+
const link = screen.getByRole('link');
|
|
131
|
+
expect(link).toHaveAttribute('href', '/Message/topic-123');
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('generates correct link from getThreadUri', async () => {
|
|
136
|
+
setup(mockTopic, mockLastCommunication, false);
|
|
137
|
+
|
|
138
|
+
await waitFor(() => {
|
|
139
|
+
const link = screen.getByRole('link');
|
|
140
|
+
expect(link).toHaveAttribute('href', '/Message/topic-123');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('handles message without sender display', async () => {
|
|
145
|
+
const commWithoutSender: Communication = {
|
|
146
|
+
...mockLastCommunication,
|
|
147
|
+
sender: undefined,
|
|
148
|
+
};
|
|
149
|
+
setup(mockTopic, commWithoutSender, false);
|
|
150
|
+
|
|
151
|
+
await waitFor(() => {
|
|
152
|
+
expect(screen.getByText(/Test Topic/)).toBeInTheDocument();
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('handles short messages without truncation', async () => {
|
|
157
|
+
const shortMessage: Communication = {
|
|
158
|
+
...mockLastCommunication,
|
|
159
|
+
payload: [{ contentString: 'Short message' }],
|
|
160
|
+
};
|
|
161
|
+
setup(mockTopic, shortMessage, false);
|
|
162
|
+
|
|
163
|
+
await waitFor(() => {
|
|
164
|
+
expect(screen.getByText('Test Topic')).toBeInTheDocument();
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Group, Stack, Text } from '@mantine/core';
|
|
4
|
+
import type { Communication, HumanName, Patient, Reference } from '@medplum/fhirtypes';
|
|
5
|
+
import { MedplumLink, ResourceAvatar, useResource } from '@medplum/react';
|
|
6
|
+
import type { JSX } from 'react';
|
|
7
|
+
import { formatDateTime, formatHumanName } from '@medplum/core';
|
|
8
|
+
import classes from './ChatListItem.module.css';
|
|
9
|
+
import cx from 'clsx';
|
|
10
|
+
|
|
11
|
+
interface ChatListItemProps {
|
|
12
|
+
topic: Communication;
|
|
13
|
+
lastCommunication: Communication | undefined;
|
|
14
|
+
isSelected: boolean;
|
|
15
|
+
getThreadUri: (topic: Communication) => string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ChatListItem = (props: ChatListItemProps): JSX.Element => {
|
|
19
|
+
const { topic, lastCommunication, isSelected, getThreadUri } = props;
|
|
20
|
+
const patientResource = useResource(topic.subject as Reference<Patient>);
|
|
21
|
+
const patientName = formatHumanName(patientResource?.name?.[0] as HumanName);
|
|
22
|
+
const lastMsg = lastCommunication?.payload?.[0]?.contentString;
|
|
23
|
+
const trimmedMsg = lastMsg?.length && lastMsg.length > 100 ? lastMsg.slice(0, 100) + '...' : lastMsg;
|
|
24
|
+
const senderName = lastCommunication?.sender?.display ? `${lastCommunication?.sender?.display}: ` : '';
|
|
25
|
+
const content = trimmedMsg ? `${senderName} ${trimmedMsg}` : `No messages available`;
|
|
26
|
+
const topicName = topic.topic?.text ?? content;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<MedplumLink to={getThreadUri(topic)}>
|
|
30
|
+
<Group
|
|
31
|
+
p="xs"
|
|
32
|
+
align="center"
|
|
33
|
+
wrap="nowrap"
|
|
34
|
+
className={cx(classes.contentContainer, {
|
|
35
|
+
[classes.selected]: isSelected,
|
|
36
|
+
})}
|
|
37
|
+
>
|
|
38
|
+
<ResourceAvatar value={topic.subject as Reference<Patient>} radius="xl" size={36} />
|
|
39
|
+
<Stack gap={0}>
|
|
40
|
+
<Text size="sm" fw={700} truncate="end">
|
|
41
|
+
{patientName}
|
|
42
|
+
</Text>
|
|
43
|
+
<Text size="sm" fw={400} lineClamp={2} className={classes.content}>
|
|
44
|
+
{topicName}
|
|
45
|
+
</Text>
|
|
46
|
+
<Text size="xs" style={{ marginTop: 2 }}>
|
|
47
|
+
{lastCommunication ? formatDateTime(lastCommunication.sent) : ''}
|
|
48
|
+
</Text>
|
|
49
|
+
</Stack>
|
|
50
|
+
</Group>
|
|
51
|
+
</MedplumLink>
|
|
52
|
+
);
|
|
53
|
+
};
|
package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.test.tsx
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
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 { Patient } from '@medplum/fhirtypes';
|
|
6
|
+
import { 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 } from 'react-router';
|
|
11
|
+
import { describe, expect, test, vi, beforeEach } from 'vitest';
|
|
12
|
+
import { NewTopicDialog } from './NewTopicDialog';
|
|
13
|
+
|
|
14
|
+
const mockOnSubmit = vi.fn();
|
|
15
|
+
const mockOnClose = vi.fn();
|
|
16
|
+
|
|
17
|
+
describe('NewTopicDialog', () => {
|
|
18
|
+
let medplum: MockClient;
|
|
19
|
+
|
|
20
|
+
beforeEach(async () => {
|
|
21
|
+
medplum = new MockClient();
|
|
22
|
+
vi.clearAllMocks();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const setup = (opened = true, subject?: Patient): void => {
|
|
26
|
+
render(
|
|
27
|
+
<MemoryRouter>
|
|
28
|
+
<MedplumProvider medplum={medplum}>
|
|
29
|
+
<MantineProvider>
|
|
30
|
+
<Notifications />
|
|
31
|
+
<NewTopicDialog opened={opened} onClose={mockOnClose} onSubmit={mockOnSubmit} subject={subject} />
|
|
32
|
+
</MantineProvider>
|
|
33
|
+
</MedplumProvider>
|
|
34
|
+
</MemoryRouter>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
test('renders modal when opened', () => {
|
|
39
|
+
setup(true);
|
|
40
|
+
expect(screen.getByText('New Message')).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('does not render modal when closed', () => {
|
|
44
|
+
setup(false);
|
|
45
|
+
expect(screen.queryByText('New Message')).not.toBeInTheDocument();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('displays patient input field', () => {
|
|
49
|
+
setup(true);
|
|
50
|
+
expect(screen.getByText('Patient')).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByText('Select a patient')).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('displays practitioner input field', () => {
|
|
55
|
+
setup(true);
|
|
56
|
+
expect(screen.getByText('Practitioner (optional)')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('displays topic input field', () => {
|
|
60
|
+
setup(true);
|
|
61
|
+
expect(screen.getByText('Topic (optional)')).toBeInTheDocument();
|
|
62
|
+
expect(screen.getByPlaceholderText('Enter your topic')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('displays submit button', () => {
|
|
66
|
+
setup(true);
|
|
67
|
+
expect(screen.getByRole('button', { name: 'Next' })).toBeInTheDocument();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('shows error when submitting without patient', async () => {
|
|
71
|
+
const user = userEvent.setup();
|
|
72
|
+
setup(true);
|
|
73
|
+
|
|
74
|
+
const submitButton = screen.getByRole('button', { name: 'Next' });
|
|
75
|
+
await user.click(submitButton);
|
|
76
|
+
|
|
77
|
+
await waitFor(() => {
|
|
78
|
+
expect(screen.getByText(/Please select a patient/i)).toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('calls onClose when modal is closed', async () => {
|
|
83
|
+
const user = userEvent.setup();
|
|
84
|
+
setup(true);
|
|
85
|
+
|
|
86
|
+
const closeButton = document.querySelector('.mantine-Modal-close');
|
|
87
|
+
expect(closeButton).toBeInTheDocument();
|
|
88
|
+
|
|
89
|
+
if (closeButton) {
|
|
90
|
+
await user.click(closeButton);
|
|
91
|
+
expect(mockOnClose).toHaveBeenCalled();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Button, Modal, Stack, Text, TextInput } from '@mantine/core';
|
|
4
|
+
import { showNotification } from '@mantine/notifications';
|
|
5
|
+
import { createReference } from '@medplum/core';
|
|
6
|
+
import type {
|
|
7
|
+
Communication,
|
|
8
|
+
Patient,
|
|
9
|
+
Practitioner,
|
|
10
|
+
Questionnaire,
|
|
11
|
+
QuestionnaireResponse,
|
|
12
|
+
Reference,
|
|
13
|
+
} from '@medplum/fhirtypes';
|
|
14
|
+
import { QuestionnaireForm, ResourceInput, useMedplum, useMedplumProfile } from '@medplum/react';
|
|
15
|
+
import { useMemo, useState } from 'react';
|
|
16
|
+
import type { JSX } from 'react';
|
|
17
|
+
import { showErrorNotification } from '../../utils/notifications';
|
|
18
|
+
|
|
19
|
+
interface NewTopicDialogProps {
|
|
20
|
+
subject: Reference<Patient> | Patient | undefined;
|
|
21
|
+
opened: boolean;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
onSubmit?: (communication: Communication) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const NewTopicDialog = (props: NewTopicDialogProps): JSX.Element => {
|
|
27
|
+
const { subject, opened, onClose, onSubmit } = props;
|
|
28
|
+
const medplum = useMedplum();
|
|
29
|
+
const profile = useMedplumProfile();
|
|
30
|
+
const profileRef = useMemo(() => (profile ? createReference(profile) : undefined), [profile]);
|
|
31
|
+
|
|
32
|
+
const [topic, setTopic] = useState('');
|
|
33
|
+
const [practitioners, setPractitioners] = useState<Reference<Practitioner>[]>(
|
|
34
|
+
profile?.resourceType === 'Practitioner' ? [createReference(profile) as Reference<Practitioner>] : []
|
|
35
|
+
);
|
|
36
|
+
const [patient, setPatient] = useState<Reference<Patient> | undefined>(
|
|
37
|
+
subject ? createReference(subject as Patient) : undefined
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Create initial QuestionnaireResponse with current practitioner as default
|
|
41
|
+
const initialResponse: QuestionnaireResponse | undefined = useMemo(() => {
|
|
42
|
+
if (profile?.resourceType === 'Practitioner') {
|
|
43
|
+
return {
|
|
44
|
+
resourceType: 'QuestionnaireResponse',
|
|
45
|
+
status: 'in-progress',
|
|
46
|
+
item: [
|
|
47
|
+
{
|
|
48
|
+
linkId: 'q1',
|
|
49
|
+
answer: [{ valueReference: createReference(profile) as Reference<Practitioner> }],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}, [profile]);
|
|
56
|
+
|
|
57
|
+
const handleSubmit = async (): Promise<void> => {
|
|
58
|
+
if (!patient) {
|
|
59
|
+
showNotification({
|
|
60
|
+
title: 'Error',
|
|
61
|
+
message: 'Please select a patient',
|
|
62
|
+
color: 'red',
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const communication: Communication = {
|
|
68
|
+
resourceType: 'Communication',
|
|
69
|
+
status: 'in-progress',
|
|
70
|
+
subject: patient,
|
|
71
|
+
sender: profileRef,
|
|
72
|
+
recipient: [
|
|
73
|
+
patient,
|
|
74
|
+
...practitioners.map((practitioner) => ({
|
|
75
|
+
reference: practitioner.reference,
|
|
76
|
+
})),
|
|
77
|
+
],
|
|
78
|
+
topic: {
|
|
79
|
+
text: topic,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const createdCommunication = await medplum.createResource(communication);
|
|
85
|
+
onSubmit?.(createdCommunication);
|
|
86
|
+
onClose();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
showErrorNotification(error);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Modal opened={opened} onClose={onClose} title="New Message" size="md">
|
|
94
|
+
<Stack gap="xl">
|
|
95
|
+
<Stack gap={0}>
|
|
96
|
+
<Text fw={500}>Patient</Text>
|
|
97
|
+
<Text c="dimmed">Select a patient</Text>
|
|
98
|
+
|
|
99
|
+
<ResourceInput
|
|
100
|
+
resourceType="Patient"
|
|
101
|
+
name="patient"
|
|
102
|
+
required={true}
|
|
103
|
+
defaultValue={patient}
|
|
104
|
+
onChange={(value) => {
|
|
105
|
+
setPatient(value ? (createReference(value) as Reference<Patient>) : undefined);
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
</Stack>
|
|
109
|
+
|
|
110
|
+
<Stack gap={0}>
|
|
111
|
+
<Text fw={500}>Practitioner (optional)</Text>
|
|
112
|
+
<Text c="dimmed">Select one or more practitioners</Text>
|
|
113
|
+
|
|
114
|
+
<QuestionnaireForm
|
|
115
|
+
questionnaire={questionnaire}
|
|
116
|
+
questionnaireResponse={initialResponse}
|
|
117
|
+
excludeButtons={true}
|
|
118
|
+
onChange={(value: QuestionnaireResponse) => {
|
|
119
|
+
const references =
|
|
120
|
+
value.item?.[0].answer
|
|
121
|
+
?.map((item) => item.valueReference)
|
|
122
|
+
.filter((ref): ref is Reference<Practitioner> => ref !== undefined) ?? [];
|
|
123
|
+
setPractitioners(references);
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
</Stack>
|
|
127
|
+
|
|
128
|
+
<Stack gap={0}>
|
|
129
|
+
<Text fw={500}>Topic (optional)</Text>
|
|
130
|
+
<Text c="dimmed">Enter a topic for the message</Text>
|
|
131
|
+
|
|
132
|
+
<TextInput placeholder="Enter your topic" value={topic} onChange={(e) => setTopic(e.target.value)} />
|
|
133
|
+
</Stack>
|
|
134
|
+
|
|
135
|
+
<Button onClick={handleSubmit}>Next</Button>
|
|
136
|
+
</Stack>
|
|
137
|
+
</Modal>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const questionnaire: Questionnaire = {
|
|
142
|
+
resourceType: 'Questionnaire',
|
|
143
|
+
status: 'active',
|
|
144
|
+
item: [
|
|
145
|
+
{
|
|
146
|
+
linkId: 'q1',
|
|
147
|
+
type: 'reference',
|
|
148
|
+
repeats: true,
|
|
149
|
+
extension: [
|
|
150
|
+
{
|
|
151
|
+
url: 'http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource',
|
|
152
|
+
valueCodeableConcept: {
|
|
153
|
+
coding: [
|
|
154
|
+
{
|
|
155
|
+
system: 'http://hl7.org/fhir/fhir-types',
|
|
156
|
+
display: 'Practitioner',
|
|
157
|
+
code: 'Practitioner',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
};
|