@awell-health/awell-extensions 2.0.151 → 2.0.153

Sign up to get free protection for your applications and to get access to all the features.
Files changed (325) hide show
  1. package/dist/extensions/cerner/actions/createPatient/__testdata__/CreateFhirPatient.mock.d.ts +8 -0
  2. package/dist/extensions/cerner/actions/createPatient/__testdata__/CreateFhirPatient.mock.js +12 -0
  3. package/dist/extensions/cerner/actions/createPatient/__testdata__/CreateFhirPatient.mock.js.map +1 -0
  4. package/dist/extensions/cerner/actions/createPatient/config/datapoints.d.ts +6 -1
  5. package/dist/extensions/cerner/actions/createPatient/config/datapoints.js +6 -1
  6. package/dist/extensions/cerner/actions/createPatient/config/datapoints.js.map +1 -1
  7. package/dist/extensions/cerner/actions/createPatient/config/fields.d.ts +70 -2
  8. package/dist/extensions/cerner/actions/createPatient/config/fields.js +61 -2
  9. package/dist/extensions/cerner/actions/createPatient/config/fields.js.map +1 -1
  10. package/dist/extensions/cerner/actions/createPatient/createPatient.js +61 -1
  11. package/dist/extensions/cerner/actions/createPatient/createPatient.js.map +1 -1
  12. package/dist/extensions/cerner/actions/getPatient/__testdata__/PatientRead.mock.d.ts +37 -0
  13. package/dist/extensions/cerner/actions/getPatient/__testdata__/PatientRead.mock.js +55 -0
  14. package/dist/extensions/cerner/actions/getPatient/__testdata__/PatientRead.mock.js.map +1 -0
  15. package/dist/extensions/cerner/actions/getPatient/config/datapoints.d.ts +6 -1
  16. package/dist/extensions/cerner/actions/getPatient/config/datapoints.js +6 -1
  17. package/dist/extensions/cerner/actions/getPatient/config/datapoints.js.map +1 -1
  18. package/dist/extensions/cerner/actions/getPatient/config/fields.d.ts +17 -2
  19. package/dist/extensions/cerner/actions/getPatient/config/fields.js +13 -2
  20. package/dist/extensions/cerner/actions/getPatient/config/fields.js.map +1 -1
  21. package/dist/extensions/cerner/actions/getPatient/getPatient.js +33 -2
  22. package/dist/extensions/cerner/actions/getPatient/getPatient.js.map +1 -1
  23. package/dist/extensions/cerner/actions/index.d.ts +31 -4
  24. package/dist/extensions/cerner/actions/index.js +2 -6
  25. package/dist/extensions/cerner/actions/index.js.map +1 -1
  26. package/dist/extensions/cerner/index.js +1 -1
  27. package/dist/extensions/cerner/index.js.map +1 -1
  28. package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client-backup.d.ts +0 -0
  29. package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client-backup.js +172 -0
  30. package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client-backup.js.map +1 -0
  31. package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client.d.ts +19 -0
  32. package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client.js +45 -0
  33. package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client.js.map +1 -0
  34. package/dist/extensions/cerner/lib/api/FhirR4/cacheService.d.ts +11 -0
  35. package/dist/extensions/cerner/lib/api/FhirR4/cacheService.js +15 -0
  36. package/dist/extensions/cerner/lib/api/FhirR4/cacheService.js.map +1 -0
  37. package/dist/extensions/cerner/lib/api/FhirR4/index.d.ts +1 -0
  38. package/dist/extensions/cerner/lib/api/FhirR4/index.js +18 -0
  39. package/dist/extensions/cerner/lib/api/FhirR4/index.js.map +1 -0
  40. package/dist/extensions/cerner/lib/api/FhirR4/schema/AppointmentRead.schema.d.ts +9 -0
  41. package/dist/extensions/cerner/lib/api/FhirR4/schema/AppointmentRead.schema.js +6 -0
  42. package/dist/extensions/cerner/lib/api/FhirR4/schema/AppointmentRead.schema.js.map +1 -0
  43. package/dist/extensions/cerner/lib/api/FhirR4/schema/DocumentReferenceCreate.schema.d.ts +7 -0
  44. package/dist/extensions/cerner/lib/api/FhirR4/schema/DocumentReferenceCreate.schema.js +3 -0
  45. package/dist/extensions/cerner/lib/api/FhirR4/schema/DocumentReferenceCreate.schema.js.map +1 -0
  46. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientCreate.schema.d.ts +7 -0
  47. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientCreate.schema.js +3 -0
  48. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientCreate.schema.js.map +1 -0
  49. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientMatch.schema.d.ts +37 -0
  50. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientMatch.schema.js +3 -0
  51. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientMatch.schema.js.map +1 -0
  52. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientRead.schema.d.ts +9 -0
  53. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientRead.schema.js +6 -0
  54. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientRead.schema.js.map +1 -0
  55. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientSearch.schema.d.ts +8 -0
  56. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientSearch.schema.js +3 -0
  57. package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientSearch.schema.js.map +1 -0
  58. package/dist/extensions/cerner/lib/api/FhirR4/schema/index.d.ts +6 -0
  59. package/dist/extensions/cerner/lib/api/FhirR4/schema/index.js +23 -0
  60. package/dist/extensions/cerner/lib/api/FhirR4/schema/index.js.map +1 -0
  61. package/dist/extensions/cerner/lib/api/auth/constructCernerUrls.d.ts +4 -0
  62. package/dist/extensions/cerner/lib/api/auth/constructCernerUrls.js +11 -0
  63. package/dist/extensions/cerner/lib/api/auth/constructCernerUrls.js.map +1 -0
  64. package/dist/extensions/cerner/lib/api/auth/index.d.ts +1 -0
  65. package/dist/extensions/cerner/lib/api/auth/index.js +18 -0
  66. package/dist/extensions/cerner/lib/api/auth/index.js.map +1 -0
  67. package/dist/extensions/cerner/lib/validatePayloadAndCreateSdks.d.ts +18 -0
  68. package/dist/extensions/cerner/lib/validatePayloadAndCreateSdks.js +41 -0
  69. package/dist/extensions/cerner/lib/validatePayloadAndCreateSdks.js.map +1 -0
  70. package/dist/extensions/cerner/settings.d.ts +36 -2
  71. package/dist/extensions/cerner/settings.js +28 -2
  72. package/dist/extensions/cerner/settings.js.map +1 -1
  73. package/dist/extensions/dockHealth/lib/dock.types.d.ts +2 -2
  74. package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js +33 -113
  75. package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js.map +1 -1
  76. package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.d.ts +2 -0
  77. package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.js +15 -0
  78. package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.js.map +1 -0
  79. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.d.ts +14 -0
  80. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js +36 -0
  81. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js.map +1 -0
  82. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.d.ts +17 -0
  83. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.js +14 -0
  84. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.js.map +1 -0
  85. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.d.ts +2 -0
  86. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js +24 -0
  87. package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js.map +1 -0
  88. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.d.ts +1 -1
  89. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js +32 -90
  90. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js.map +1 -1
  91. package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.d.ts +2 -0
  92. package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js +18 -0
  93. package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js.map +1 -0
  94. package/dist/extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.d.ts +3 -0
  95. package/dist/extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.js +15 -0
  96. package/dist/extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.js.map +1 -0
  97. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.d.ts +14 -0
  98. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js +29 -0
  99. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js.map +1 -0
  100. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.d.ts +17 -0
  101. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js +16 -0
  102. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js.map +1 -0
  103. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.d.ts +2 -0
  104. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js +20 -0
  105. package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js.map +1 -0
  106. package/dist/extensions/elation/actions/index.d.ts +0 -210
  107. package/dist/extensions/elation/actions/updatePatientTags/config/types.d.ts +29 -0
  108. package/dist/extensions/elation/actions/updatePatientTags/config/types.js +21 -0
  109. package/dist/extensions/elation/actions/updatePatientTags/config/types.js.map +1 -0
  110. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.d.ts +13 -0
  111. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js +29 -0
  112. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js.map +1 -0
  113. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.d.ts +13 -0
  114. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.js +7 -0
  115. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.js.map +1 -0
  116. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.d.ts +2 -0
  117. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.js +22 -0
  118. package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.js.map +1 -0
  119. package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.d.ts +8 -0
  120. package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js +35 -77
  121. package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js.map +1 -1
  122. package/dist/extensions/elation/actions/updatePatientTags/updateTags.d.ts +2 -0
  123. package/dist/extensions/elation/actions/updatePatientTags/updateTags.js +18 -0
  124. package/dist/extensions/elation/actions/updatePatientTags/updateTags.js.map +1 -0
  125. package/dist/extensions/elation/settings.d.ts +1 -10
  126. package/dist/extensions/elation/settings.js +0 -8
  127. package/dist/extensions/elation/settings.js.map +1 -1
  128. package/dist/extensions/elation/validation/referralOrder.zod.d.ts +17 -17
  129. package/dist/extensions/epic/actions/createClinicalNote/config/fields.js +1 -1
  130. package/dist/extensions/epic/actions/createClinicalNote/config/fields.js.map +1 -1
  131. package/dist/extensions/epic/actions/createClinicalNote/createClinicalNote.js +1 -1
  132. package/dist/extensions/epic/actions/createClinicalNote/createClinicalNote.js.map +1 -1
  133. package/dist/extensions/epic/actions/createPatient/config/fields.js +1 -1
  134. package/dist/extensions/epic/actions/createPatient/config/fields.js.map +1 -1
  135. package/dist/extensions/epic/actions/matchPatient/config/fields.js +1 -1
  136. package/dist/extensions/epic/actions/matchPatient/config/fields.js.map +1 -1
  137. package/dist/extensions/epic/lib/api/customFhirSchemas/DocumentReference/Status.schema.js.map +1 -0
  138. package/dist/extensions/epic/lib/api/customFhirSchemas/DocumentReference/Type.schema.js.map +1 -0
  139. package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/index.js +1 -1
  140. package/dist/extensions/epic/lib/api/customFhirSchemas/DocumentReference/index.js.map +1 -0
  141. package/dist/extensions/markdown.json +1 -1
  142. package/dist/extensions/medplum/actions/createServiceRequest/config/fields.js +4 -6
  143. package/dist/extensions/medplum/actions/createServiceRequest/config/fields.js.map +1 -1
  144. package/dist/extensions/medplum/actions/createTask/config/fields.js +4 -6
  145. package/dist/extensions/medplum/actions/createTask/config/fields.js.map +1 -1
  146. package/dist/extensions/medplum/fhir/schemas/resources/patient.schema.js +2 -2
  147. package/dist/extensions/medplum/fhir/schemas/resources/patient.schema.js.map +1 -1
  148. package/dist/extensions/medplum/fhir/schemas/resources/serviceRequest.schema.js +5 -5
  149. package/dist/extensions/medplum/fhir/schemas/resources/serviceRequest.schema.js.map +1 -1
  150. package/dist/extensions/medplum/fhir/schemas/resources/task.schema.js +4 -4
  151. package/dist/extensions/medplum/fhir/schemas/resources/task.schema.js.map +1 -1
  152. package/dist/extensions/shelly/actions/categorizeMessage/categorizeMessage.d.ts +10 -2
  153. package/dist/extensions/shelly/actions/categorizeMessage/categorizeMessage.js +32 -24
  154. package/dist/extensions/shelly/actions/categorizeMessage/categorizeMessage.js.map +1 -1
  155. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.d.ts +22 -2
  156. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.js +22 -7
  157. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.js.map +1 -1
  158. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.d.ts +20 -0
  159. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.js +18 -0
  160. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.js.map +1 -0
  161. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.d.ts +13 -0
  162. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.js +35 -0
  163. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.js.map +1 -0
  164. package/dist/extensions/shelly/actions/generateMessage/generateMessage.d.ts +10 -2
  165. package/dist/extensions/shelly/actions/generateMessage/generateMessage.js +33 -25
  166. package/dist/extensions/shelly/actions/generateMessage/generateMessage.js.map +1 -1
  167. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.d.ts +18 -2
  168. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.js +23 -10
  169. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.js.map +1 -1
  170. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.d.ts +28 -0
  171. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.js +17 -0
  172. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.js.map +1 -0
  173. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/prompt.d.ts +10 -0
  174. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/prompt.js +121 -0
  175. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/prompt.js.map +1 -0
  176. package/dist/extensions/shelly/actions/index.d.ts +7 -63
  177. package/dist/extensions/shelly/actions/medicationFromImage/medicationFromImage.d.ts +1 -2
  178. package/dist/extensions/shelly/actions/medicationFromImage/medicationFromImage.js.map +1 -1
  179. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.d.ts +1 -2
  180. package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.js.map +1 -1
  181. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/{constants.js → prompt.js} +1 -1
  182. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/prompt.js.map +1 -0
  183. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/summarizeCareFlowWithLLM.d.ts +22 -2
  184. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/summarizeCareFlowWithLLM.js +30 -8
  185. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/summarizeCareFlowWithLLM.js.map +1 -1
  186. package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlow.d.ts +1 -2
  187. package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlow.js +24 -21
  188. package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlow.js.map +1 -1
  189. package/dist/extensions/shelly/actions/summarizeForm/summarizeForm.d.ts +10 -2
  190. package/dist/extensions/shelly/actions/summarizeForm/summarizeForm.js +42 -28
  191. package/dist/extensions/shelly/actions/summarizeForm/summarizeForm.js.map +1 -1
  192. package/dist/extensions/shelly/actions/summarizeFormsInStep/summarizeFormsInStep.d.ts +1 -2
  193. package/dist/extensions/shelly/actions/summarizeFormsInStep/summarizeFormsInStep.js +29 -26
  194. package/dist/extensions/shelly/actions/summarizeFormsInStep/summarizeFormsInStep.js.map +1 -1
  195. package/dist/extensions/shelly/index.js +2 -3
  196. package/dist/extensions/shelly/index.js.map +1 -1
  197. package/dist/extensions/shelly/lib/summarizeFormWithLLM/{constants.js → prompt.js} +1 -1
  198. package/dist/extensions/shelly/lib/summarizeFormWithLLM/prompt.js.map +1 -0
  199. package/dist/extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.d.ts +23 -2
  200. package/dist/extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.js +33 -9
  201. package/dist/extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.js.map +1 -1
  202. package/dist/extensions/shelly/lib/validatePayloadAndCreateSdk.d.ts +1 -5
  203. package/dist/extensions/shelly/lib/validatePayloadAndCreateSdk.js +5 -20
  204. package/dist/extensions/shelly/lib/validatePayloadAndCreateSdk.js.map +1 -1
  205. package/dist/extensions/zendesk/v1/actions/createTask/config/fields.d.ts +2 -2
  206. package/dist/src/lib/fhir/schemas/Appointment/Status.schema.js.map +1 -0
  207. package/dist/src/lib/fhir/schemas/Appointment/index.js.map +1 -0
  208. package/dist/src/lib/fhir/schemas/Patient/Gender.schema.js.map +1 -0
  209. package/dist/src/lib/fhir/schemas/Patient/index.js.map +1 -0
  210. package/dist/{extensions/medplum/fhir/schemas/atoms/IntentSchema.d.ts → src/lib/fhir/schemas/ServiceRequest/Intent.schema.d.ts} +0 -1
  211. package/dist/{extensions/medplum/fhir/schemas/atoms/IntentSchema.js → src/lib/fhir/schemas/ServiceRequest/Intent.schema.js} +2 -13
  212. package/dist/src/lib/fhir/schemas/ServiceRequest/Intent.schema.js.map +1 -0
  213. package/dist/{extensions/medplum/fhir/schemas/atoms/PrioritySchema.js → src/lib/fhir/schemas/ServiceRequest/Priority.schema.js} +1 -1
  214. package/dist/src/lib/fhir/schemas/ServiceRequest/Priority.schema.js.map +1 -0
  215. package/dist/src/lib/fhir/schemas/ServiceRequest/Status.schema.d.ts +2 -0
  216. package/dist/src/lib/fhir/schemas/ServiceRequest/Status.schema.js +14 -0
  217. package/dist/src/lib/fhir/schemas/ServiceRequest/Status.schema.js.map +1 -0
  218. package/dist/src/lib/fhir/schemas/ServiceRequest/index.d.ts +3 -0
  219. package/dist/src/lib/fhir/schemas/ServiceRequest/index.js +20 -0
  220. package/dist/src/lib/fhir/schemas/ServiceRequest/index.js.map +1 -0
  221. package/dist/src/lib/fhir/schemas/Shared/PeriodSchema.js.map +1 -0
  222. package/dist/src/lib/fhir/schemas/Shared/index.d.ts +1 -0
  223. package/dist/src/lib/fhir/schemas/Shared/index.js +18 -0
  224. package/dist/src/lib/fhir/schemas/Shared/index.js.map +1 -0
  225. package/dist/src/lib/fhir/schemas/Task/IntentSchema.d.ts +2 -0
  226. package/dist/src/lib/fhir/schemas/Task/IntentSchema.js +16 -0
  227. package/dist/src/lib/fhir/schemas/Task/IntentSchema.js.map +1 -0
  228. package/dist/src/lib/fhir/schemas/Task/Priority.schema.d.ts +2 -0
  229. package/dist/src/lib/fhir/schemas/Task/Priority.schema.js +6 -0
  230. package/dist/src/lib/fhir/schemas/Task/Priority.schema.js.map +1 -0
  231. package/dist/{extensions/medplum/fhir/schemas/atoms/StatusSchema.d.ts → src/lib/fhir/schemas/Task/Status.schema.d.ts} +0 -1
  232. package/dist/{extensions/medplum/fhir/schemas/atoms/StatusSchema.js → src/lib/fhir/schemas/Task/Status.schema.js} +2 -11
  233. package/dist/src/lib/fhir/schemas/Task/Status.schema.js.map +1 -0
  234. package/dist/src/lib/fhir/schemas/Task/index.d.ts +3 -0
  235. package/dist/src/lib/fhir/schemas/Task/index.js +20 -0
  236. package/dist/src/lib/fhir/schemas/Task/index.js.map +1 -0
  237. package/dist/src/lib/llm/openai/constants.d.ts +28 -0
  238. package/dist/src/lib/llm/openai/constants.js +32 -0
  239. package/dist/src/lib/llm/openai/constants.js.map +1 -0
  240. package/dist/src/lib/llm/openai/createOpenAIModel.d.ts +23 -0
  241. package/dist/src/lib/llm/openai/createOpenAIModel.js +89 -0
  242. package/dist/src/lib/llm/openai/createOpenAIModel.js.map +1 -0
  243. package/dist/src/lib/llm/openai/index.d.ts +3 -0
  244. package/dist/src/lib/llm/openai/index.js +20 -0
  245. package/dist/src/lib/llm/openai/index.js.map +1 -0
  246. package/dist/src/lib/llm/openai/types.d.ts +63 -0
  247. package/dist/src/lib/llm/openai/types.js +3 -0
  248. package/dist/src/lib/llm/openai/types.js.map +1 -0
  249. package/package.json +5 -4
  250. package/dist/extensions/cerner/actions/createClinicalNote/config/datapoints.d.ts +0 -1
  251. package/dist/extensions/cerner/actions/createClinicalNote/config/datapoints.js +0 -5
  252. package/dist/extensions/cerner/actions/createClinicalNote/config/datapoints.js.map +0 -1
  253. package/dist/extensions/cerner/actions/createClinicalNote/config/fields.d.ts +0 -3
  254. package/dist/extensions/cerner/actions/createClinicalNote/config/fields.js +0 -10
  255. package/dist/extensions/cerner/actions/createClinicalNote/config/fields.js.map +0 -1
  256. package/dist/extensions/cerner/actions/createClinicalNote/config/index.d.ts +0 -2
  257. package/dist/extensions/cerner/actions/createClinicalNote/config/index.js +0 -9
  258. package/dist/extensions/cerner/actions/createClinicalNote/config/index.js.map +0 -1
  259. package/dist/extensions/cerner/actions/createClinicalNote/createClinicalNote.d.ts +0 -4
  260. package/dist/extensions/cerner/actions/createClinicalNote/createClinicalNote.js +0 -18
  261. package/dist/extensions/cerner/actions/createClinicalNote/createClinicalNote.js.map +0 -1
  262. package/dist/extensions/cerner/actions/createClinicalNote/index.d.ts +0 -1
  263. package/dist/extensions/cerner/actions/createClinicalNote/index.js +0 -6
  264. package/dist/extensions/cerner/actions/createClinicalNote/index.js.map +0 -1
  265. package/dist/extensions/cerner/actions/getAppointment/config/datapoints.d.ts +0 -1
  266. package/dist/extensions/cerner/actions/getAppointment/config/datapoints.js +0 -5
  267. package/dist/extensions/cerner/actions/getAppointment/config/datapoints.js.map +0 -1
  268. package/dist/extensions/cerner/actions/getAppointment/config/fields.d.ts +0 -3
  269. package/dist/extensions/cerner/actions/getAppointment/config/fields.js +0 -10
  270. package/dist/extensions/cerner/actions/getAppointment/config/fields.js.map +0 -1
  271. package/dist/extensions/cerner/actions/getAppointment/config/index.d.ts +0 -2
  272. package/dist/extensions/cerner/actions/getAppointment/config/index.js +0 -9
  273. package/dist/extensions/cerner/actions/getAppointment/config/index.js.map +0 -1
  274. package/dist/extensions/cerner/actions/getAppointment/getAppointment.d.ts +0 -4
  275. package/dist/extensions/cerner/actions/getAppointment/getAppointment.js +0 -18
  276. package/dist/extensions/cerner/actions/getAppointment/getAppointment.js.map +0 -1
  277. package/dist/extensions/cerner/actions/getAppointment/index.d.ts +0 -1
  278. package/dist/extensions/cerner/actions/getAppointment/index.js +0 -6
  279. package/dist/extensions/cerner/actions/getAppointment/index.js.map +0 -1
  280. package/dist/extensions/epic/lib/api/schemas/Appointment/Status.schema.js.map +0 -1
  281. package/dist/extensions/epic/lib/api/schemas/Appointment/index.js.map +0 -1
  282. package/dist/extensions/epic/lib/api/schemas/DocumentReference/Status.schema.js.map +0 -1
  283. package/dist/extensions/epic/lib/api/schemas/DocumentReference/Type.schema.js.map +0 -1
  284. package/dist/extensions/epic/lib/api/schemas/DocumentReference/index.js.map +0 -1
  285. package/dist/extensions/epic/lib/api/schemas/Patient/Gender.schema.js.map +0 -1
  286. package/dist/extensions/epic/lib/api/schemas/Patient/index.js.map +0 -1
  287. package/dist/extensions/medplum/fhir/schemas/atoms/GenderSchema.d.ts +0 -2
  288. package/dist/extensions/medplum/fhir/schemas/atoms/GenderSchema.js +0 -6
  289. package/dist/extensions/medplum/fhir/schemas/atoms/GenderSchema.js.map +0 -1
  290. package/dist/extensions/medplum/fhir/schemas/atoms/IntentSchema.js.map +0 -1
  291. package/dist/extensions/medplum/fhir/schemas/atoms/PeriodSchema.js.map +0 -1
  292. package/dist/extensions/medplum/fhir/schemas/atoms/PrioritySchema.js.map +0 -1
  293. package/dist/extensions/medplum/fhir/schemas/atoms/StatusSchema.js.map +0 -1
  294. package/dist/extensions/medplum/fhir/schemas/atoms/index.d.ts +0 -5
  295. package/dist/extensions/medplum/fhir/schemas/atoms/index.js +0 -16
  296. package/dist/extensions/medplum/fhir/schemas/atoms/index.js.map +0 -1
  297. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.d.ts +0 -24
  298. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js +0 -33
  299. package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js.map +0 -1
  300. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.d.ts +0 -24
  301. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.js +0 -123
  302. package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.js.map +0 -1
  303. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.js.map +0 -1
  304. package/dist/extensions/shelly/lib/summarizeFormWithLLM/constants.js.map +0 -1
  305. package/dist/extensions/shelly/settings.d.ts +0 -17
  306. package/dist/extensions/shelly/settings.js +0 -17
  307. package/dist/extensions/shelly/settings.js.map +0 -1
  308. package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Status.schema.d.ts +0 -0
  309. package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Status.schema.js +0 -0
  310. package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Type.schema.d.ts +0 -0
  311. package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Type.schema.js +0 -0
  312. package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/index.d.ts +1 -1
  313. /package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/{constants.d.ts → prompt.d.ts} +0 -0
  314. /package/dist/extensions/shelly/lib/summarizeFormWithLLM/{constants.d.ts → prompt.d.ts} +0 -0
  315. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/Status.schema.d.ts +0 -0
  316. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/Status.schema.js +0 -0
  317. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/index.d.ts +0 -0
  318. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/index.js +0 -0
  319. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/Gender.schema.d.ts +0 -0
  320. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/Gender.schema.js +0 -0
  321. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/index.d.ts +0 -0
  322. /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/index.js +0 -0
  323. /package/dist/{extensions/medplum/fhir/schemas/atoms/PrioritySchema.d.ts → src/lib/fhir/schemas/ServiceRequest/Priority.schema.d.ts} +0 -0
  324. /package/dist/{extensions/medplum/fhir/schemas/atoms → src/lib/fhir/schemas/Shared}/PeriodSchema.d.ts +0 -0
  325. /package/dist/{extensions/medplum/fhir/schemas/atoms → src/lib/fhir/schemas/Shared}/PeriodSchema.js +0 -0
@@ -1,48 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findFutureAppointment = void 0;
4
+ const lodash_1 = require("lodash");
4
5
  const extensions_core_1 = require("@awell-health/extensions-core");
5
- const client_1 = require("../../client");
6
- const config_1 = require("./config");
7
- const output_parsers_1 = require("@langchain/core/output_parsers");
8
- const zod_1 = require("zod");
9
- const openai_1 = require("@langchain/openai");
10
6
  const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
11
- const lodash_1 = require("lodash");
7
+ const config_1 = require("./config");
8
+ const getFutureAppoitnments_1 = require("./getFutureAppoitnments");
9
+ const parser_1 = require("./lib/findAppointmentWithLLM/parser");
10
+ const findAppointmentWithLLM_1 = require("./lib/findAppointmentWithLLM/findAppointmentWithLLM");
11
+ const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
12
+ const constants_1 = require("../../../../src/lib/llm/openai/constants");
12
13
  exports.findFutureAppointment = {
13
14
  key: 'findFutureAppointment',
14
15
  category: extensions_core_1.Category.EHR_INTEGRATIONS,
15
- title: '🪄 Find future appointment',
16
+ title: '🪄 Find future appointment (Beta)',
16
17
  description: 'Find a future appointment in Elation.',
17
18
  fields: config_1.fields,
18
19
  previewable: false,
19
20
  dataPoints: config_1.dataPoints,
20
- onEvent: async ({ payload, onComplete, onError }) => {
21
+ onEvent: async ({ payload, onComplete, onError, helpers }) => {
22
+ // 1. Validate input
21
23
  const { prompt, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
22
- const api = (0, client_1.makeAPIClient)(payload.settings);
23
- const openAiApiKey = payload.settings.openAiApiKey;
24
- if (openAiApiKey === undefined || openAiApiKey === '') {
25
- await onError({
26
- events: [
27
- {
28
- date: new Date().toISOString(),
29
- text: { en: 'OpenAI API key is required for this action.' },
30
- error: {
31
- category: 'SERVER_ERROR',
32
- message: 'OpenAI API key is required for this action.',
33
- },
34
- },
35
- ],
36
- });
37
- return;
38
- }
39
- const appointments = await api.findAppointments({
40
- patient: patientId,
41
- from_date: new Date().toISOString(),
42
- });
43
- const scheduledOrConfirmedAppointments = appointments.filter((appointment) => appointment.status.status === 'Scheduled' ||
44
- appointment.status.status === 'Confirmed');
45
- if (scheduledOrConfirmedAppointments.length === 0) {
24
+ // 2. Get future appointments
25
+ const appointments = await (0, getFutureAppoitnments_1.getFutureAppointments)(payload.settings, patientId);
26
+ if (appointments.length === 0) {
46
27
  await onComplete({
47
28
  data_points: {
48
29
  appointmentExists: 'false',
@@ -50,74 +31,35 @@ exports.findFutureAppointment = {
50
31
  });
51
32
  return;
52
33
  }
53
- const promptAppointments = scheduledOrConfirmedAppointments
54
- .map((appointment) => {
55
- const relevantInfo = {
56
- id: appointment.id,
57
- reason: appointment.reason,
58
- duration: appointment.duration,
59
- scheduled_date: appointment.scheduled_date,
60
- };
61
- return JSON.stringify(relevantInfo);
62
- })
63
- .join('\n\n');
64
- const ChatModelGPT4o = new openai_1.ChatOpenAI({
65
- modelName: 'gpt-4o-2024-08-06',
66
- openAIApiKey: openAiApiKey,
67
- temperature: 0,
68
- maxRetries: 3,
69
- timeout: 10000,
34
+ // 3. Initialize OpenAI model with metadata and callbacks
35
+ const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
36
+ settings: payload.settings,
37
+ helpers,
38
+ payload,
39
+ modelType: constants_1.OPENAI_MODELS.GPT4o
70
40
  });
71
- const systemPrompt = `You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists. If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome. If multiple appointments exist that match the instructions, you should return the first one. In any case, there can only be one appointment returned.
72
-
73
- Important instructions:
74
- - The appointment "reason" is the appointment type.
75
- - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
76
- - Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription.
77
-
78
- ----------
79
- Input array:
80
- ${promptAppointments}
81
- ----------
82
- Instruction:
83
- ${prompt}
84
- ----------
85
-
86
- Output a JSON object with two keys:
87
- 1. appointmentId: The id of the appointment that matches the instructions, if one exists. If no appointment exists that obviously matches, you should return null.
88
- 2. explanation: A readable explanation of how the appointment was found and why. Or, if no appointment exists that matches the instructions, an explanation of why.`;
89
- const AppointmentIdSchema = zod_1.z.coerce
90
- .number()
91
- .nullable()
92
- .describe('A single appointment');
93
- const parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
94
- appointmentId: AppointmentIdSchema,
95
- explanation: zod_1.z
96
- .string()
97
- .describe('A readable explanation of how the appointment was found and why'),
98
- }));
99
- let result;
100
- try {
101
- const chain = ChatModelGPT4o.pipe(parser);
102
- result = await chain.invoke(systemPrompt);
103
- }
104
- catch (invokeError) {
105
- console.error('Error invoking ChatModelGPT4o for findFutureAppointment:', invokeError);
106
- throw new Error('Failed to find future appointment.');
107
- }
108
- const matchedAppointmentId = AppointmentIdSchema.parse(result.appointmentId);
109
- const foundAppointment = scheduledOrConfirmedAppointments.find((appointment) => appointment.id === Number(matchedAppointmentId));
41
+ // 4. Find matching appointment
42
+ const { appointmentId, explanation } = await (0, findAppointmentWithLLM_1.findAppointmentWithLLM)({
43
+ model,
44
+ appointments,
45
+ prompt,
46
+ metadata,
47
+ callbacks
48
+ });
49
+ const matchedAppointmentId = parser_1.AppointmentIdSchema.parse(appointmentId);
50
+ const foundAppointment = appointments.find((appointment) => appointment.id === Number(matchedAppointmentId));
51
+ // 5. Complete action with results
110
52
  await onComplete({
111
53
  data_points: {
112
54
  appointment: !(0, lodash_1.isNil)(matchedAppointmentId)
113
55
  ? JSON.stringify(foundAppointment)
114
56
  : undefined,
115
- explanation: result.explanation,
57
+ explanation,
116
58
  appointmentExists: !(0, lodash_1.isNil)(matchedAppointmentId) ? 'true' : 'false',
117
59
  },
118
60
  events: [
119
61
  (0, addEventLog_1.addActivityEventLog)({
120
- message: `Number of future scheduled or confirmed appointments for patient ${patientId}: ${scheduledOrConfirmedAppointments.length}\nFound appointment: ${(0, lodash_1.isNil)(foundAppointment) ? 'none' : foundAppointment === null || foundAppointment === void 0 ? void 0 : foundAppointment.id}\nExplanation: ${result.explanation}`,
62
+ message: `Number of future scheduled or confirmed appointments for patient ${patientId}: ${appointments.length}\nFound appointment: ${(0, lodash_1.isNil)(foundAppointment) ? 'none' : foundAppointment === null || foundAppointment === void 0 ? void 0 : foundAppointment.id}\nExplanation: ${explanation}`,
121
63
  }),
122
64
  ],
123
65
  });
@@ -1 +1 @@
1
- {"version":3,"file":"findFutureAppointment.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/findFutureAppointment.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,yCAA4C;AAC5C,qCAAqE;AACrE,mEAAuE;AACvE,6BAAuB;AACvB,8CAA8C;AAC9C,uEAA2E;AAC3E,mCAA8B;AAEjB,QAAA,qBAAqB,GAI9B;IACF,GAAG,EAAE,uBAAuB;IAC5B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,uCAAuC;IACpD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0D,EAC1D,WAAW,CACZ,CAAA;YACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACvD,CAAC;QAED,MAAM,oBAAoB,GAAG,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QAC5E,MAAM,gBAAgB,GAAG,gCAAgC,CAAC,IAAI,CAC5D,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC,oBAAoB,CAAC,CACjE,CAAA;QACD,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,CAAC,IAAA,cAAK,EAAC,oBAAoB,CAAC;oBACvC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;oBAClC,CAAC,CAAC,SAAS;gBACb,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,iBAAiB,EAAE,CAAC,IAAA,cAAK,EAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;aACnE;YACD,MAAM,EAAE;gBACN,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,oEAAoE,SAAS,KAAK,gCAAgC,CAAC,MAAM,wBAAwB,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,EAAE,kBAAkB,MAAM,CAAC,WAAW,EAAE;iBACxP,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"findFutureAppointment.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/findFutureAppointment.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,mEAAqE;AAErE,uEAA2E;AAE3E,qCAAqE;AACrE,mEAA+D;AAC/D,gEAAyE;AACzE,gGAA4F;AAC5F,wFAAoF;AACpF,wEAAwE;AAE3D,Q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AAE,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC,oBAAoB,CAAC,CACjE,CAAA;QAED,kCAAkC;QAClC,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW,EAAE,CAAC,IAAA,cAAK,EAAC,oBAAoB,CAAC;oBACvC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;oBAClC,CAAC,CAAC,SAAS;gBACb,WAAW;gBACX,iBAAiB,EAAE,CAAC,IAAA,cAAK,EAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;aACnE;YACD,MAAM,EAAE;gBACN,IAAA,iCAAmB,EAAC;oBAClB,OAAO,EAAE,oEAAoE,SAAS,KAAK,YAAY,CAAC,MAAM,wBAAwB,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,EAAE,kBAAkB,WAAW,EAAE;iBAC7N,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { type AppointmentResponse } from "extensions/elation/types";
2
+ export declare const formatAppointments: (appointments: AppointmentResponse[]) => string;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatAppointments = void 0;
4
+ const formatAppointments = (appointments) => {
5
+ return appointments
6
+ .map((appointment) => {
7
+ const relevantInfo = {
8
+ id: appointment.id,
9
+ reason: appointment.reason,
10
+ duration: appointment.duration,
11
+ scheduled_date: appointment.scheduled_date,
12
+ };
13
+ return JSON.stringify(relevantInfo);
14
+ })
15
+ .join('\n\n');
16
+ };
17
+ exports.formatAppointments = formatAppointments;
18
+ //# sourceMappingURL=formatAppointments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatAppointments.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/formatAppointments.ts"],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,GAAG,CAAC,YAAmC,EAAU,EAAE;IAC9E,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QACnB,MAAM,YAAY,GAAG;YACnB,EAAE,EAAE,WAAW,CAAC,EAAE;YAClB,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,cAAc,EAAE,WAAW,CAAC,cAAc;SAC3C,CAAA;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;IACrC,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAA;AACjB,CAAC,CAAA;AAZU,QAAA,kBAAkB,sBAY5B"}
@@ -0,0 +1,3 @@
1
+ import { type SettingsType } from '../../settings';
2
+ import { type AppointmentResponse } from 'extensions/elation/types';
3
+ export declare const getFutureAppointments: (elationSettings: SettingsType, patientId: number) => Promise<AppointmentResponse[]>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFutureAppointments = void 0;
4
+ const client_1 = require("../../client");
5
+ const getFutureAppointments = async (elationSettings, patientId) => {
6
+ const api = (0, client_1.makeAPIClient)(elationSettings);
7
+ const appointments = await api.findAppointments({
8
+ patient: patientId,
9
+ from_date: new Date().toISOString(),
10
+ });
11
+ return appointments.filter((appointment) => appointment.status.status === 'Scheduled' ||
12
+ appointment.status.status === 'Confirmed');
13
+ };
14
+ exports.getFutureAppointments = getFutureAppointments;
15
+ //# sourceMappingURL=getFutureAppoitnments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFutureAppoitnments.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.ts"],"names":[],"mappings":";;;AAEA,yCAA4C;AAKrC,MAAM,qBAAqB,GAAG,KAAK,EAAE,eAA6B,EAAE,SAAiB,EAAkC,EAAE;IAC9H,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,eAAe,CAAC,CAAA;IAE1C,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,gBAAgB,CAAC;QAC9C,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC,CAAA;IACF,OAAO,YAAY,CAAC,MAAM,CACxB,CAAC,WAAW,EAAE,EAAE,CACd,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW;QACzC,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAC5C,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,qBAAqB,yBAYjC"}
@@ -0,0 +1,14 @@
1
+ import { type ChatOpenAI } from '@langchain/openai';
2
+ import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
3
+ import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
4
+ import { type AppointmentFromAI } from './parser';
5
+ import { type AppointmentResponse } from '../../../../types';
6
+ interface FindAppointmentWithLLMProps {
7
+ model: ChatOpenAI;
8
+ appointments: AppointmentResponse[];
9
+ prompt: string;
10
+ metadata: AIActionMetadata;
11
+ callbacks?: BaseCallbackHandler[];
12
+ }
13
+ export declare const findAppointmentWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentWithLLMProps) => Promise<AppointmentFromAI>;
14
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAppointmentWithLLM = void 0;
4
+ const prompt_1 = require("./prompt");
5
+ const parser_1 = require("./parser");
6
+ const formatAppointments_1 = require("../../formatAppointments");
7
+ const findAppointmentWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
8
+ const chain = model.pipe(parser_1.parser);
9
+ try {
10
+ const result = await chain.invoke(await prompt_1.systemPrompt.format({
11
+ format_instructions: parser_1.parser.getFormatInstructions(),
12
+ appointments: (0, formatAppointments_1.formatAppointments)(appointments),
13
+ prompt,
14
+ }), {
15
+ metadata,
16
+ runName: 'ElationFindAppointment',
17
+ callbacks
18
+ });
19
+ return {
20
+ appointmentId: result.appointmentId,
21
+ explanation: result.explanation
22
+ };
23
+ }
24
+ catch (error) {
25
+ throw new Error('Failed to find matching appointment.');
26
+ }
27
+ };
28
+ exports.findAppointmentWithLLM = findAppointmentWithLLM;
29
+ //# sourceMappingURL=findAppointmentWithLLM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findAppointmentWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAAyD;AAEzD,iEAA6D;AAUtD,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GACmB,EAA8B,EAAE;IAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,mBAAmB,EAAE,eAAM,CAAC,qBAAqB,EAAE;YACnD,YAAY,EAAE,IAAA,uCAAkB,EAAC,YAAY,CAAC;YAC9C,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,wBAAwB;YACjC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;AACH,CAAC,CAAA;AA9BY,QAAA,sBAAsB,0BA8BlC"}
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { StructuredOutputParser } from '@langchain/core/output_parsers';
3
+ export declare const AppointmentIdSchema: z.ZodNullable<z.ZodNumber>;
4
+ export declare const parser: StructuredOutputParser<z.ZodObject<{
5
+ appointmentId: z.ZodNullable<z.ZodNumber>;
6
+ explanation: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ appointmentId: number | null;
9
+ explanation: string;
10
+ }, {
11
+ appointmentId: number | null;
12
+ explanation: string;
13
+ }>>;
14
+ export interface AppointmentFromAI {
15
+ appointmentId: number | null;
16
+ explanation: string;
17
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = exports.AppointmentIdSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const output_parsers_1 = require("@langchain/core/output_parsers");
6
+ exports.AppointmentIdSchema = zod_1.z.coerce
7
+ .number()
8
+ .nullable()
9
+ .describe('A single appointment');
10
+ exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
11
+ appointmentId: exports.AppointmentIdSchema,
12
+ explanation: zod_1.z
13
+ .string()
14
+ .describe('A readable explanation of how the appointment was found and why'),
15
+ }));
16
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM;KACxC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,sBAAsB,CAAC,CAAA;AAEtB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,aAAa,EAAE,2BAAmB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,iEAAiE,CAClE;CACJ,CAAC,CACH,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { ChatPromptTemplate } from '@langchain/core/prompts';
2
+ export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.\n \n Important instructions:\n - The appointment \"reason\" is the appointment type.\n - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.\n - Think like a clinician. In other words, \"Rx\" should match a prescription appointment or follow-up related to a prescription.\n - If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.\n - If multiple appointments exist that match the instructions, you should return the first one.\n - Return your response in the following JSON format:\n {format_instructions}\n\n Input array: {appointments}\n Instruction: {prompt}\n">, any>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.systemPrompt = void 0;
4
+ const prompts_1 = require("@langchain/core/prompts");
5
+ exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
6
+ You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.
7
+
8
+ Important instructions:
9
+ - The appointment "reason" is the appointment type.
10
+ - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
11
+ - Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription.
12
+ - If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.
13
+ - If multiple appointments exist that match the instructions, you should return the first one.
14
+ - Return your response in the following JSON format:
15
+ {format_instructions}
16
+
17
+ Input array: {appointments}
18
+ Instruction: {prompt}
19
+ `);
20
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;CAc3D,CAAC,CAAA"}