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.
Files changed (284) hide show
  1. package/README.md +5 -0
  2. package/dist/examples/vintasend-medplum-example/.env.example +11 -0
  3. package/dist/examples/vintasend-medplum-example/IMPLEMENTATION_PLAN_FILE_ATTACHMENTS.md +597 -0
  4. package/dist/examples/vintasend-medplum-example/README.md +190 -0
  5. package/dist/examples/vintasend-medplum-example/TUTORIAL_EMAIL_NOTIFICATIONS.md +2596 -0
  6. package/dist/examples/vintasend-medplum-example/bots/handlers/send-pending-notifications-bot.ts +39 -0
  7. package/dist/examples/vintasend-medplum-example/bots/handlers/send-task-assignment-email.ts +41 -0
  8. package/dist/examples/vintasend-medplum-example/bots/handlers/task-due-soon-notification-bot.ts +86 -0
  9. package/dist/examples/vintasend-medplum-example/bots/index.ts +53 -0
  10. package/dist/examples/vintasend-medplum-example/bots/services/emails/schedule-task-due-soon-email.ts +84 -0
  11. package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.test.ts +388 -0
  12. package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.ts +113 -0
  13. package/dist/examples/vintasend-medplum-example/bots/shared/task-due-soon-helpers.ts +115 -0
  14. package/dist/examples/vintasend-medplum-example/bots/task-assignment-bot.ts +41 -0
  15. package/dist/examples/vintasend-medplum-example/compiled-notification-templates.json +6 -0
  16. package/dist/examples/vintasend-medplum-example/esbuild-script.mjs +71 -0
  17. package/dist/examples/vintasend-medplum-example/index.html +14 -0
  18. package/dist/examples/vintasend-medplum-example/lib/constants.ts +32 -0
  19. package/dist/examples/vintasend-medplum-example/lib/extensions.ts +1 -0
  20. package/dist/examples/vintasend-medplum-example/lib/file-upload.test.ts +389 -0
  21. package/dist/examples/vintasend-medplum-example/lib/file-upload.ts +222 -0
  22. package/dist/examples/vintasend-medplum-example/lib/medplum-singleton.ts +18 -0
  23. package/dist/examples/vintasend-medplum-example/lib/notification-service.test.ts +293 -0
  24. package/dist/examples/vintasend-medplum-example/lib/notification-service.ts +284 -0
  25. package/dist/examples/vintasend-medplum-example/lib/patients.ts +20 -0
  26. package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/body.html.pug +37 -0
  27. package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/subject.txt.pug +4 -0
  28. package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/body.html.pug +34 -0
  29. package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/subject.txt.pug +4 -0
  30. package/dist/examples/vintasend-medplum-example/package.json +75 -0
  31. package/dist/examples/vintasend-medplum-example/plugins/gql-plugin.mjs +31 -0
  32. package/dist/examples/vintasend-medplum-example/postcss.config.mjs +21 -0
  33. package/dist/examples/vintasend-medplum-example/public/favicon.ico +0 -0
  34. package/dist/examples/vintasend-medplum-example/public/img/integrations/acuity.png +0 -0
  35. package/dist/examples/vintasend-medplum-example/public/img/integrations/auth0.png +0 -0
  36. package/dist/examples/vintasend-medplum-example/public/img/integrations/azure.png +0 -0
  37. package/dist/examples/vintasend-medplum-example/public/img/integrations/calcom.png +0 -0
  38. package/dist/examples/vintasend-medplum-example/public/img/integrations/candid.png +0 -0
  39. package/dist/examples/vintasend-medplum-example/public/img/integrations/claude.png +0 -0
  40. package/dist/examples/vintasend-medplum-example/public/img/integrations/datadog.png +0 -0
  41. package/dist/examples/vintasend-medplum-example/public/img/integrations/deepseek.png +0 -0
  42. package/dist/examples/vintasend-medplum-example/public/img/integrations/entra.png +0 -0
  43. package/dist/examples/vintasend-medplum-example/public/img/integrations/epic.png +0 -0
  44. package/dist/examples/vintasend-medplum-example/public/img/integrations/google.png +0 -0
  45. package/dist/examples/vintasend-medplum-example/public/img/integrations/healthgorilla.png +0 -0
  46. package/dist/examples/vintasend-medplum-example/public/img/integrations/healthie.png +0 -0
  47. package/dist/examples/vintasend-medplum-example/public/img/integrations/labcorp.png +0 -0
  48. package/dist/examples/vintasend-medplum-example/public/img/integrations/okta.png +0 -0
  49. package/dist/examples/vintasend-medplum-example/public/img/integrations/openai.png +0 -0
  50. package/dist/examples/vintasend-medplum-example/public/img/integrations/particle.png +0 -0
  51. package/dist/examples/vintasend-medplum-example/public/img/integrations/quest.png +0 -0
  52. package/dist/examples/vintasend-medplum-example/public/img/integrations/recaptcha.png +0 -0
  53. package/dist/examples/vintasend-medplum-example/public/img/integrations/snowflake.png +0 -0
  54. package/dist/examples/vintasend-medplum-example/public/img/integrations/stedi.png +0 -0
  55. package/dist/examples/vintasend-medplum-example/public/img/integrations/stripe.png +0 -0
  56. package/dist/examples/vintasend-medplum-example/public/img/integrations/sumo.png +0 -0
  57. package/dist/examples/vintasend-medplum-example/scripts/README.md +162 -0
  58. package/dist/examples/vintasend-medplum-example/scripts/client.ts +18 -0
  59. package/dist/examples/vintasend-medplum-example/scripts/deploy-bots.ts +171 -0
  60. package/dist/examples/vintasend-medplum-example/src/App.tsx +185 -0
  61. package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.test.tsx +350 -0
  62. package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.tsx +241 -0
  63. package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.test.tsx +616 -0
  64. package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.tsx +138 -0
  65. package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.test.tsx +92 -0
  66. package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.tsx +47 -0
  67. package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.test.tsx +464 -0
  68. package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.tsx +186 -0
  69. package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.test.tsx +80 -0
  70. package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.tsx +82 -0
  71. package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.test.tsx +100 -0
  72. package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.tsx +20 -0
  73. package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.module.css +3 -0
  74. package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.tsx +62 -0
  75. package/dist/examples/vintasend-medplum-example/src/components/MessageWithLinks.tsx +47 -0
  76. package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.test.tsx +299 -0
  77. package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.tsx +52 -0
  78. package/dist/examples/vintasend-medplum-example/src/components/ResourceFormWithRequiredProfile.tsx +82 -0
  79. package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.test.tsx +1016 -0
  80. package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.tsx +298 -0
  81. package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.test.tsx +732 -0
  82. package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.tsx +282 -0
  83. package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.test.tsx +268 -0
  84. package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.tsx +224 -0
  85. package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.test.tsx +255 -0
  86. package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.tsx +212 -0
  87. package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.test.tsx +120 -0
  88. package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.tsx +57 -0
  89. package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.test.tsx +224 -0
  90. package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.tsx +100 -0
  91. package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.test.tsx +431 -0
  92. package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.tsx +130 -0
  93. package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.module.css +31 -0
  94. package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.test.tsx +234 -0
  95. package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.tsx +143 -0
  96. package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.module.css +11 -0
  97. package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.test.tsx +875 -0
  98. package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.tsx +943 -0
  99. package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.test.tsx +413 -0
  100. package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.tsx +203 -0
  101. package/dist/examples/vintasend-medplum-example/src/components/labs/LabSelectEmpty.tsx +22 -0
  102. package/dist/examples/vintasend-medplum-example/src/components/labs/README.md +104 -0
  103. package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.test.tsx +318 -0
  104. package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.tsx +87 -0
  105. package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.test.tsx +126 -0
  106. package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.tsx +38 -0
  107. package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.module.css +23 -0
  108. package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.test.tsx +167 -0
  109. package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.tsx +53 -0
  110. package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.test.tsx +94 -0
  111. package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.tsx +165 -0
  112. package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.module.css +8 -0
  113. package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.test.tsx +523 -0
  114. package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.tsx +230 -0
  115. package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.module.css +23 -0
  116. package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.test.tsx +567 -0
  117. package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.tsx +358 -0
  118. package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.module.css +40 -0
  119. package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.tsx +257 -0
  120. package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.module.css +7 -0
  121. package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.test.tsx +279 -0
  122. package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.tsx +156 -0
  123. package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.module.css +45 -0
  124. package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.test.tsx +90 -0
  125. package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.tsx +84 -0
  126. package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.module.css +26 -0
  127. package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.tsx +90 -0
  128. package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.test.tsx +305 -0
  129. package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.tsx +46 -0
  130. package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.module.css +262 -0
  131. package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.test.tsx +622 -0
  132. package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.tsx +286 -0
  133. package/dist/examples/vintasend-medplum-example/src/components/tasks/NewTaskModal.tsx +275 -0
  134. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskAttachmentList.tsx +132 -0
  135. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.module.css +45 -0
  136. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.test.tsx +749 -0
  137. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.tsx +416 -0
  138. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.test.tsx +278 -0
  139. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.tsx +133 -0
  140. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.module.css +16 -0
  141. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.test.tsx +255 -0
  142. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.tsx +203 -0
  143. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFileUpload.tsx +129 -0
  144. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.test.tsx +156 -0
  145. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.tsx +142 -0
  146. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.utils.ts +28 -0
  147. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.test.tsx +134 -0
  148. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.tsx +250 -0
  149. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.module.css +23 -0
  150. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.test.tsx +149 -0
  151. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.tsx +53 -0
  152. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.test.tsx +68 -0
  153. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.tsx +46 -0
  154. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.test.tsx +555 -0
  155. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.tsx +170 -0
  156. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.test.tsx +32 -0
  157. package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.tsx +34 -0
  158. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.test.tsx +47 -0
  159. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.tsx +29 -0
  160. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.test.tsx +285 -0
  161. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.tsx +129 -0
  162. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.test.tsx +455 -0
  163. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.tsx +167 -0
  164. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.test.tsx +435 -0
  165. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.tsx +116 -0
  166. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.module.css +38 -0
  167. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.test.tsx +200 -0
  168. package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.tsx +84 -0
  169. package/dist/examples/vintasend-medplum-example/src/components/utils.test.ts +176 -0
  170. package/dist/examples/vintasend-medplum-example/src/components/utils.ts +17 -0
  171. package/dist/examples/vintasend-medplum-example/src/config/constants.ts +3 -0
  172. package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.test.tsx +166 -0
  173. package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.ts +28 -0
  174. package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.test.tsx +94 -0
  175. package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.ts +11 -0
  176. package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.test.tsx +477 -0
  177. package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.ts +191 -0
  178. package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.test.tsx +100 -0
  179. package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.ts +18 -0
  180. package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.test.tsx +379 -0
  181. package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.ts +194 -0
  182. package/dist/examples/vintasend-medplum-example/src/index.css +8 -0
  183. package/dist/examples/vintasend-medplum-example/src/main.tsx +57 -0
  184. package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.module.css +6 -0
  185. package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.test.tsx +295 -0
  186. package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.tsx +124 -0
  187. package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.test.tsx +77 -0
  188. package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.tsx +22 -0
  189. package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.test.tsx +87 -0
  190. package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.tsx +27 -0
  191. package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.module.css +16 -0
  192. package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.test.tsx +287 -0
  193. package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.tsx +151 -0
  194. package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.test.tsx +519 -0
  195. package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.tsx +179 -0
  196. package/dist/examples/vintasend-medplum-example/src/pages/integrations/FavoriteMedicationsTable.tsx +76 -0
  197. package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.test.tsx +234 -0
  198. package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.tsx +222 -0
  199. package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.test.tsx +356 -0
  200. package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.tsx +275 -0
  201. package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.module.css +8 -0
  202. package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.test.tsx +103 -0
  203. package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.tsx +78 -0
  204. package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.test.tsx +84 -0
  205. package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.tsx +82 -0
  206. package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.test.tsx +364 -0
  207. package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.tsx +149 -0
  208. package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.test.tsx +159 -0
  209. package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.tsx +37 -0
  210. package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.test.tsx +140 -0
  211. package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.tsx +72 -0
  212. package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.test.tsx +57 -0
  213. package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.tsx +14 -0
  214. package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.test.tsx +241 -0
  215. package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.tsx +710 -0
  216. package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.module.css +37 -0
  217. package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.test.tsx +428 -0
  218. package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.tsx +334 -0
  219. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.module.css +24 -0
  220. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.test.tsx +154 -0
  221. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.tsx +115 -0
  222. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.test.ts +223 -0
  223. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.ts +89 -0
  224. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.test.tsx +147 -0
  225. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.tsx +79 -0
  226. package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientTabsNavigation.tsx +35 -0
  227. package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.test.tsx +185 -0
  228. package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.tsx +115 -0
  229. package/dist/examples/vintasend-medplum-example/src/pages/patient/TimelineTab.tsx +14 -0
  230. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.test.tsx +170 -0
  231. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.tsx +117 -0
  232. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceDetailPage.tsx +28 -0
  233. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.test.tsx +131 -0
  234. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.tsx +65 -0
  235. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.test.tsx +108 -0
  236. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.tsx +16 -0
  237. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.module.css +7 -0
  238. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.test.tsx +37 -0
  239. package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.tsx +44 -0
  240. package/dist/examples/vintasend-medplum-example/src/pages/resource/useResourceType.ts +44 -0
  241. package/dist/examples/vintasend-medplum-example/src/pages/resource/utils.ts +9 -0
  242. package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.test.tsx +302 -0
  243. package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.tsx +416 -0
  244. package/dist/examples/vintasend-medplum-example/src/pages/spaces/ChatInput.tsx +91 -0
  245. package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.module.css +6 -0
  246. package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.test.tsx +102 -0
  247. package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.tsx +44 -0
  248. package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.module.css +7 -0
  249. package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.test.tsx +133 -0
  250. package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.tsx +91 -0
  251. package/dist/examples/vintasend-medplum-example/src/test-utils/render.tsx +20 -0
  252. package/dist/examples/vintasend-medplum-example/src/test.setup.ts +49 -0
  253. package/dist/examples/vintasend-medplum-example/src/types/encounter.ts +8 -0
  254. package/dist/examples/vintasend-medplum-example/src/types/spaces.ts +10 -0
  255. package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.test.ts +141 -0
  256. package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.ts +59 -0
  257. package/dist/examples/vintasend-medplum-example/src/utils/claims.test.ts +153 -0
  258. package/dist/examples/vintasend-medplum-example/src/utils/claims.ts +65 -0
  259. package/dist/examples/vintasend-medplum-example/src/utils/communication-search.ts +47 -0
  260. package/dist/examples/vintasend-medplum-example/src/utils/coverage.test.ts +48 -0
  261. package/dist/examples/vintasend-medplum-example/src/utils/coverage.ts +33 -0
  262. package/dist/examples/vintasend-medplum-example/src/utils/documentReference.test.ts +102 -0
  263. package/dist/examples/vintasend-medplum-example/src/utils/documentReference.ts +55 -0
  264. package/dist/examples/vintasend-medplum-example/src/utils/encounter.test.ts +169 -0
  265. package/dist/examples/vintasend-medplum-example/src/utils/encounter.ts +261 -0
  266. package/dist/examples/vintasend-medplum-example/src/utils/intake-form.test.ts +154 -0
  267. package/dist/examples/vintasend-medplum-example/src/utils/intake-form.ts +272 -0
  268. package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.test.ts +1137 -0
  269. package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.ts +827 -0
  270. package/dist/examples/vintasend-medplum-example/src/utils/notifications.test.ts +27 -0
  271. package/dist/examples/vintasend-medplum-example/src/utils/notifications.ts +15 -0
  272. package/dist/examples/vintasend-medplum-example/src/utils/spaceMessaging.ts +249 -0
  273. package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.test.ts +450 -0
  274. package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.ts +147 -0
  275. package/dist/examples/vintasend-medplum-example/src/utils/task-search.ts +63 -0
  276. package/dist/examples/vintasend-medplum-example/src/vite-env.d.ts +3 -0
  277. package/dist/examples/vintasend-medplum-example/tsconfig.bots.json +4 -0
  278. package/dist/examples/vintasend-medplum-example/tsconfig.json +19 -0
  279. package/dist/examples/vintasend-medplum-example/vercel.json +3 -0
  280. package/dist/examples/vintasend-medplum-example/vite.config.ts +44 -0
  281. package/dist/services/notification-backends/base-notification-backend.d.ts +5 -0
  282. package/dist/services/notification-service.js +11 -1
  283. package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +5 -0
  284. package/package.json +1 -1
@@ -0,0 +1,234 @@
1
+ // SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { MantineProvider } from '@mantine/core';
4
+ import { MockClient } from '@medplum/mock';
5
+ import type { Practitioner, ServiceRequest } from '@medplum/fhirtypes';
6
+ import { MedplumProvider } from '@medplum/react';
7
+ import { render, screen } from '@testing-library/react';
8
+ import { MemoryRouter } from 'react-router';
9
+ import { describe, expect, test, vi, beforeEach } from 'vitest';
10
+ import { LabListItem } from './LabListItem';
11
+
12
+ describe('LabListItem', () => {
13
+ let medplum: MockClient;
14
+
15
+ beforeEach(() => {
16
+ medplum = new MockClient();
17
+ vi.clearAllMocks();
18
+ });
19
+
20
+ const setup = (
21
+ item: ServiceRequest,
22
+ selectedItem: ServiceRequest | undefined,
23
+ activeTab: 'open' | 'completed',
24
+ onItemSelect: (item: ServiceRequest) => string = (i) => `/lab/${i.id}`
25
+ ): ReturnType<typeof render> => {
26
+ return render(
27
+ <MemoryRouter>
28
+ <MedplumProvider medplum={medplum}>
29
+ <MantineProvider>
30
+ <LabListItem item={item} selectedItem={selectedItem} activeTab={activeTab} onItemSelect={onItemSelect} />
31
+ </MantineProvider>
32
+ </MedplumProvider>
33
+ </MemoryRouter>
34
+ );
35
+ };
36
+
37
+ const baseServiceRequest: ServiceRequest = {
38
+ resourceType: 'ServiceRequest',
39
+ id: 'sr-1',
40
+ status: 'active',
41
+ intent: 'order',
42
+ subject: { reference: 'Patient/123' },
43
+ code: { text: 'CBC Panel' },
44
+ authoredOn: '2024-01-15T10:00:00Z',
45
+ };
46
+
47
+ describe('Display text', () => {
48
+ test('renders code text when available', () => {
49
+ setup(baseServiceRequest, undefined, 'open');
50
+ expect(screen.getByText('CBC Panel')).toBeInTheDocument();
51
+ });
52
+
53
+ test('renders multiple codes joined by comma', () => {
54
+ const item: ServiceRequest = {
55
+ ...baseServiceRequest,
56
+ code: {
57
+ coding: [{ display: 'Test A' }, { display: 'Test B' }],
58
+ },
59
+ };
60
+ setup(item, undefined, 'open');
61
+ expect(screen.getByText('Test A, Test B')).toBeInTheDocument();
62
+ });
63
+
64
+ test('renders first coding display when only one code', () => {
65
+ const item: ServiceRequest = {
66
+ ...baseServiceRequest,
67
+ code: {
68
+ coding: [{ display: 'Single Test' }],
69
+ },
70
+ };
71
+ setup(item, undefined, 'open');
72
+ expect(screen.getByText('Single Test')).toBeInTheDocument();
73
+ });
74
+
75
+ test('renders fallback text when no code available', () => {
76
+ const item: ServiceRequest = {
77
+ ...baseServiceRequest,
78
+ code: undefined,
79
+ };
80
+ setup(item, undefined, 'open');
81
+ expect(screen.getByText('Lab Order')).toBeInTheDocument();
82
+ });
83
+ });
84
+
85
+ describe('Status badge', () => {
86
+ test('shows active status badge', () => {
87
+ setup(baseServiceRequest, undefined, 'open');
88
+ expect(screen.getByText('Active')).toBeInTheDocument();
89
+ });
90
+
91
+ test('shows draft status badge', () => {
92
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'draft' };
93
+ setup(item, undefined, 'open');
94
+ expect(screen.getByText('Draft')).toBeInTheDocument();
95
+ });
96
+
97
+ test('shows requested status badge', () => {
98
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'requested' as ServiceRequest['status'] };
99
+ setup(item, undefined, 'open');
100
+ expect(screen.getByText('Requested')).toBeInTheDocument();
101
+ });
102
+
103
+ test('shows on-hold status badge', () => {
104
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'on-hold' };
105
+ setup(item, undefined, 'open');
106
+ expect(screen.getByText('On Hold')).toBeInTheDocument();
107
+ });
108
+
109
+ test('shows revoked status badge', () => {
110
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'revoked' };
111
+ setup(item, undefined, 'open');
112
+ expect(screen.getByText('Revoked')).toBeInTheDocument();
113
+ });
114
+
115
+ test('shows cancelled status badge', () => {
116
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'cancelled' as ServiceRequest['status'] };
117
+ setup(item, undefined, 'open');
118
+ expect(screen.getByText('Cancelled')).toBeInTheDocument();
119
+ });
120
+
121
+ test('shows error status badge for entered-in-error', () => {
122
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'entered-in-error' };
123
+ setup(item, undefined, 'open');
124
+ expect(screen.getByText('Error')).toBeInTheDocument();
125
+ });
126
+
127
+ test('shows completed status badge', () => {
128
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'completed' };
129
+ setup(item, undefined, 'open');
130
+ expect(screen.getByText('Completed')).toBeInTheDocument();
131
+ });
132
+
133
+ test('shows unknown status badge', () => {
134
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'unknown' };
135
+ setup(item, undefined, 'open');
136
+ expect(screen.getByText('Unknown')).toBeInTheDocument();
137
+ });
138
+
139
+ test('shows raw status when unrecognized', () => {
140
+ const item: ServiceRequest = { ...baseServiceRequest, status: 'custom-status' as ServiceRequest['status'] };
141
+ setup(item, undefined, 'open');
142
+ expect(screen.getByText('custom-status')).toBeInTheDocument();
143
+ });
144
+
145
+ test('does not show status badge on completed tab', () => {
146
+ setup(baseServiceRequest, undefined, 'completed');
147
+ expect(screen.queryByText('Active')).not.toBeInTheDocument();
148
+ });
149
+ });
150
+
151
+ describe('Sub text', () => {
152
+ test('shows ordered date', () => {
153
+ setup(baseServiceRequest, undefined, 'open');
154
+ expect(screen.getByText(/Ordered/)).toBeInTheDocument();
155
+ });
156
+
157
+ test('shows ordered date with requester name when available', async () => {
158
+ const practitioner: Practitioner = {
159
+ resourceType: 'Practitioner',
160
+ id: 'prac-1',
161
+ name: [{ given: ['Dr.'], family: 'Smith' }],
162
+ };
163
+ await medplum.createResource(practitioner);
164
+
165
+ const item: ServiceRequest = {
166
+ ...baseServiceRequest,
167
+ requester: { reference: 'Practitioner/prac-1' },
168
+ };
169
+ setup(item, undefined, 'open');
170
+ // The requester is loaded asynchronously, we just verify the component renders
171
+ expect(screen.getByText(/Ordered/)).toBeInTheDocument();
172
+ });
173
+
174
+ test('uses lastUpdated when authoredOn not available', () => {
175
+ const item: ServiceRequest = {
176
+ ...baseServiceRequest,
177
+ authoredOn: undefined,
178
+ meta: { lastUpdated: '2024-02-20T15:00:00Z' },
179
+ };
180
+ setup(item, undefined, 'open');
181
+ expect(screen.getByText(/Ordered/)).toBeInTheDocument();
182
+ });
183
+ });
184
+
185
+ describe('Additional info', () => {
186
+ test('shows REQ number for open tab', () => {
187
+ const item: ServiceRequest = {
188
+ ...baseServiceRequest,
189
+ requisition: { value: 'REQ-12345' },
190
+ };
191
+ setup(item, undefined, 'open');
192
+ expect(screen.getByText('REQ #REQ-12345')).toBeInTheDocument();
193
+ });
194
+
195
+ test('shows completion date for completed tab', () => {
196
+ const item: ServiceRequest = {
197
+ ...baseServiceRequest,
198
+ meta: { lastUpdated: '2024-03-15T10:00:00Z' },
199
+ };
200
+ setup(item, undefined, 'completed');
201
+ expect(screen.getByText(/Completed/)).toBeInTheDocument();
202
+ });
203
+
204
+ test('shows Unknown date when no lastUpdated on completed tab', () => {
205
+ const item: ServiceRequest = {
206
+ ...baseServiceRequest,
207
+ meta: undefined,
208
+ };
209
+ setup(item, undefined, 'completed');
210
+ expect(screen.getByText(/Completed Unknown date/)).toBeInTheDocument();
211
+ });
212
+ });
213
+
214
+ describe('Selection', () => {
215
+ test('applies selected styling when item is selected', () => {
216
+ setup(baseServiceRequest, baseServiceRequest, 'open');
217
+ expect(screen.getByText('CBC Panel')).toBeInTheDocument();
218
+ });
219
+
220
+ test('does not apply selected styling when different item is selected', () => {
221
+ const otherItem: ServiceRequest = { ...baseServiceRequest, id: 'sr-2' };
222
+ setup(baseServiceRequest, otherItem, 'open');
223
+ expect(screen.getByText('CBC Panel')).toBeInTheDocument();
224
+ });
225
+ });
226
+
227
+ describe('Link', () => {
228
+ test('calls onItemSelect to generate link', () => {
229
+ const onItemSelect = vi.fn((item: ServiceRequest) => `/custom/${item.id}`);
230
+ setup(baseServiceRequest, undefined, 'open', onItemSelect);
231
+ expect(onItemSelect).toHaveBeenCalledWith(baseServiceRequest);
232
+ });
233
+ });
234
+ });
@@ -0,0 +1,143 @@
1
+ // SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { Group, Stack, Text, Badge } from '@mantine/core';
4
+ import { formatDate, formatHumanName } from '@medplum/core';
5
+ import type { HumanName, Practitioner, ServiceRequest } from '@medplum/fhirtypes';
6
+ import type { JSX } from 'react';
7
+ import { MedplumLink, useResource } from '@medplum/react';
8
+ import cx from 'clsx';
9
+ import classes from './LabListItem.module.css';
10
+
11
+ type LabTab = 'open' | 'completed';
12
+
13
+ interface LabListItemProps {
14
+ item: ServiceRequest;
15
+ selectedItem: ServiceRequest | undefined;
16
+ activeTab: LabTab;
17
+ onItemSelect: (item: ServiceRequest) => string;
18
+ }
19
+
20
+ export function LabListItem(props: LabListItemProps): JSX.Element {
21
+ const { item, selectedItem, activeTab, onItemSelect } = props;
22
+ const isSelected = selectedItem?.id === item.id;
23
+ const requester = useResource(item.requester) as Practitioner | undefined;
24
+
25
+ return (
26
+ <MedplumLink to={onItemSelect(item)}>
27
+ <Group
28
+ align="center"
29
+ wrap="nowrap"
30
+ className={cx(classes.contentContainer, {
31
+ [classes.selected]: isSelected,
32
+ })}
33
+ >
34
+ <Stack gap={0} flex={1}>
35
+ <Group justify="space-between" align="flex-start">
36
+ <Text fw={700} className={classes.title} flex={1}>
37
+ {getDisplayText(item)}
38
+ </Text>
39
+ {activeTab !== 'completed' && (
40
+ <Badge size="sm" color={getStatusColor(item.status)} variant="light">
41
+ {getStatusDisplayText(item.status)}
42
+ </Badge>
43
+ )}
44
+ </Group>
45
+ {getAdditionalInfo(item, activeTab).map((info, index) => (
46
+ <Text key={index} size="sm">
47
+ {info}
48
+ </Text>
49
+ ))}
50
+ <Text size="sm" c="dimmed">
51
+ {getSubText(item, requester)}
52
+ </Text>
53
+ </Stack>
54
+ </Group>
55
+ </MedplumLink>
56
+ );
57
+ }
58
+
59
+ const getStatusColor = (status: string | undefined): string => {
60
+ switch (status) {
61
+ case 'active':
62
+ return 'blue';
63
+ case 'draft':
64
+ case 'requested':
65
+ return 'yellow';
66
+ case 'on-hold':
67
+ return 'orange';
68
+ case 'revoked':
69
+ case 'cancelled':
70
+ case 'entered-in-error':
71
+ return 'red';
72
+ case 'completed':
73
+ return 'green';
74
+ case 'unknown':
75
+ return 'gray';
76
+ default:
77
+ return 'gray';
78
+ }
79
+ };
80
+
81
+ const getStatusDisplayText = (status: string | undefined): string => {
82
+ switch (status) {
83
+ case 'active':
84
+ return 'Active';
85
+ case 'draft':
86
+ return 'Draft';
87
+ case 'requested':
88
+ return 'Requested';
89
+ case 'on-hold':
90
+ return 'On Hold';
91
+ case 'revoked':
92
+ return 'Revoked';
93
+ case 'cancelled':
94
+ return 'Cancelled';
95
+ case 'entered-in-error':
96
+ return 'Error';
97
+ case 'completed':
98
+ return 'Completed';
99
+ case 'unknown':
100
+ return 'Unknown';
101
+ default:
102
+ return status || 'Unknown';
103
+ }
104
+ };
105
+
106
+ const getDisplayText = (item: ServiceRequest): string => {
107
+ // If there are multiple codes (2 or more), show them separated by commas
108
+ if (item.code?.coding && item.code.coding.length >= 2) {
109
+ return item.code.coding.map((coding) => coding.display).join(', ');
110
+ }
111
+
112
+ // If there's a text field and only one code, use the text field
113
+ if (item.code?.text) {
114
+ return item.code.text;
115
+ }
116
+
117
+ // Otherwise, show the first code or fallback
118
+ return item.code?.coding?.[0]?.display || 'Lab Order';
119
+ };
120
+
121
+ const getSubText = (item: ServiceRequest, requester: Practitioner | undefined): string => {
122
+ // Use authoredOn if available, otherwise fall back to meta.lastUpdated
123
+ const date = formatDate(item.authoredOn || item.meta?.lastUpdated);
124
+ if (requester?.resourceType === 'Practitioner') {
125
+ return `Ordered ${date} by ${formatHumanName(requester.name?.[0] as HumanName)}`;
126
+ }
127
+ return `Ordered ${date}`;
128
+ };
129
+
130
+ const getAdditionalInfo = (item: ServiceRequest, activeTab: LabTab): string[] => {
131
+ const info: string[] = [];
132
+
133
+ if (activeTab === 'completed') {
134
+ // For completed items, show completion date instead of REQ #
135
+ const completionDate = item.meta?.lastUpdated ? formatDate(item.meta.lastUpdated) : 'Unknown date';
136
+ info.push(`Completed ${completionDate}`);
137
+ } else if (item.requisition?.value) {
138
+ // For open items, show REQ # as before
139
+ info.push(`REQ #${item.requisition.value}`);
140
+ }
141
+
142
+ return info;
143
+ };
@@ -0,0 +1,11 @@
1
+ .button {
2
+ height: 32px;
3
+ background-color: light-dark(var(--mantine-color-gray-1), var(--mantine-color-gray-8));
4
+ color: light-dark(var(--mantine-color-black), var(--mantine-color-gray-4));
5
+ font-weight: 500;
6
+ }
7
+
8
+ .selected {
9
+ background-color: light-dark(var(--mantine-color-black), var(--mantine-color-gray-6));
10
+ color: light-dark(var(--mantine-color-white), var(--mantine-color-white));
11
+ }