@ovok/core 0.4.49-rc.3 → 0.4.49-rc.5

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 (421) hide show
  1. package/README.md +23 -666
  2. package/dist/client/ai-fhir/methods/AIFhirResources.d.ts +3 -1
  3. package/dist/client/ai-fhir/methods/AIFhirResources.js +3 -1
  4. package/dist/client/ai-fhir/types/AIFhirPlan.d.ts +8 -0
  5. package/dist/client/ai-fhir/types/AIFhirPlanRequest.d.ts +8 -0
  6. package/dist/client/ai-fhir/types/AIFhirRequest.d.ts +5 -0
  7. package/dist/client/ai-fhir/types/AIFhirResponse.d.ts +6 -0
  8. package/dist/client/auth/errors.d.ts +15 -2
  9. package/dist/client/auth/errors.js +12 -2
  10. package/dist/client/auth/methods/appleLogin.d.ts +1 -0
  11. package/dist/client/auth/methods/appleLogin.js +1 -0
  12. package/dist/client/auth/methods/changePassword.d.ts +1 -0
  13. package/dist/client/auth/methods/changePassword.js +1 -0
  14. package/dist/client/auth/methods/googleLogin.d.ts +1 -0
  15. package/dist/client/auth/methods/googleLogin.js +1 -0
  16. package/dist/client/auth/methods/login.d.ts +6 -0
  17. package/dist/client/auth/methods/login.js +6 -0
  18. package/dist/client/auth/methods/register.d.ts +5 -0
  19. package/dist/client/auth/methods/register.js +5 -0
  20. package/dist/client/auth/methods/registerPractitioner.d.ts +5 -0
  21. package/dist/client/auth/methods/registerPractitioner.js +5 -0
  22. package/dist/client/auth/methods/reloadSession.d.ts +3 -0
  23. package/dist/client/auth/methods/requestDeleteUser.d.ts +4 -5
  24. package/dist/client/auth/methods/requestDeleteUser.js +4 -5
  25. package/dist/client/auth/methods/setPasswordFromReset.d.ts +1 -0
  26. package/dist/client/auth/methods/setPasswordFromReset.js +1 -0
  27. package/dist/client/auth/session-fetch.d.ts +11 -0
  28. package/dist/client/auth/types/Account.d.ts +8 -1
  29. package/dist/client/auth/types/AppleLoginBody.d.ts +16 -0
  30. package/dist/client/auth/types/AppleLoginBody.js +5 -0
  31. package/dist/client/auth/types/AuthResponse.d.ts +12 -0
  32. package/dist/client/auth/types/ChangePasswordBody.d.ts +7 -0
  33. package/dist/client/auth/types/ChangePasswordResponse.d.ts +5 -0
  34. package/dist/client/auth/types/CompletePasswordResetBody.d.ts +8 -0
  35. package/dist/client/auth/types/GoogleLoginBody.d.ts +5 -0
  36. package/dist/client/auth/types/LoginBody.d.ts +15 -1
  37. package/dist/client/auth/types/LoginError.d.ts +21 -2
  38. package/dist/client/auth/types/LoginError.js +8 -2
  39. package/dist/client/auth/types/LoginResponse.d.ts +8 -1
  40. package/dist/client/auth/types/RegisterBody.d.ts +12 -0
  41. package/dist/client/auth/types/RegisterPractitionerBody.d.ts +5 -0
  42. package/dist/client/auth/types/RegisterResponse.d.ts +7 -0
  43. package/dist/client/auth/types/RequestDeleteUserBody.d.ts +7 -7
  44. package/dist/client/auth/types/RequestDeleteUserResponse.d.ts +14 -0
  45. package/dist/client/auth/types/ResetPasswordBody.d.ts +5 -0
  46. package/dist/client/auth/types/Session.d.ts +14 -2
  47. package/dist/client/change-history/methods.d.ts +6 -0
  48. package/dist/client/change-history/methods.js +6 -0
  49. package/dist/client/change-history/types.d.ts +82 -0
  50. package/dist/client/chat/ai/methods/createAiSession.d.ts +6 -0
  51. package/dist/client/chat/ai/methods/createAiSession.js +6 -0
  52. package/dist/client/chat/ai/types/CreateAiSessionResponse.d.ts +17 -0
  53. package/dist/client/chat/ai/types/SessionMessagesResponse.d.ts +9 -0
  54. package/dist/client/cms/locale.d.ts +12 -2
  55. package/dist/client/cms/locale.js +9 -2
  56. package/dist/client/cms/methods.d.ts +6 -2
  57. package/dist/client/cms/methods.js +7 -3
  58. package/dist/client/cms/types.d.ts +44 -4
  59. package/dist/client/consent/methods.d.ts +16 -0
  60. package/dist/client/consent/methods.js +16 -0
  61. package/dist/client/consent/types.d.ts +53 -1
  62. package/dist/client/consent/types.js +10 -1
  63. package/dist/client/email/methods.d.ts +3 -0
  64. package/dist/client/email/methods.js +3 -0
  65. package/dist/client/email/types.d.ts +33 -0
  66. package/dist/client/errors/field-errors.d.ts +3 -0
  67. package/dist/client/errors/field-errors.js +3 -0
  68. package/dist/client/errors/ovok-error-utils.d.ts +6 -0
  69. package/dist/client/errors/ovok-error-utils.js +6 -0
  70. package/dist/client/errors/ovok-error.d.ts +36 -4
  71. package/dist/client/errors/ovok-error.js +15 -4
  72. package/dist/client/errors/rate-limit-error.d.ts +11 -2
  73. package/dist/client/errors/rate-limit-error.js +10 -2
  74. package/dist/client/errors/sign-in-required-error.d.ts +5 -2
  75. package/dist/client/errors/sign-in-required-error.js +5 -2
  76. package/dist/client/experience/methods.d.ts +38 -0
  77. package/dist/client/experience/methods.js +35 -0
  78. package/dist/client/experience/types.d.ts +316 -0
  79. package/dist/client/experience/types.js +1 -0
  80. package/dist/client/invites/methods.d.ts +27 -9
  81. package/dist/client/invites/methods.js +27 -9
  82. package/dist/client/invites/parse-accept-invite-link.d.ts +3 -1
  83. package/dist/client/invites/parse-accept-invite-link.js +3 -1
  84. package/dist/client/invites/types.d.ts +55 -0
  85. package/dist/client/invites/types.js +12 -0
  86. package/dist/client/notifications/methods.d.ts +15 -0
  87. package/dist/client/notifications/methods.js +15 -0
  88. package/dist/client/notifications/types.d.ts +249 -2
  89. package/dist/client/observation/bundle-entry-status.d.ts +3 -0
  90. package/dist/client/observation/bundle-entry-status.js +13 -0
  91. package/dist/client/observation/fhir-systems.d.ts +7 -0
  92. package/dist/client/observation/fhir-systems.js +8 -1
  93. package/dist/client/observation/methods/generateObservationBodiesByMeasurement.d.ts +3 -0
  94. package/dist/client/observation/methods/generateObservationBodiesByMeasurement.js +10 -65
  95. package/dist/client/observation/methods/getLatestObservationsByCodes.d.ts +3 -0
  96. package/dist/client/observation/methods/getLatestObservationsByCodes.js +3 -0
  97. package/dist/client/observation/methods/observationsToMeasurements.d.ts +23 -1
  98. package/dist/client/observation/methods/observationsToMeasurements.js +72 -12
  99. package/dist/client/observation/methods/saveMeasurement.d.ts +3 -1
  100. package/dist/client/observation/methods/saveMeasurement.js +3 -1
  101. package/dist/client/observation/observation-bundle-utils.d.ts +11 -7
  102. package/dist/client/observation/observation-bundle-utils.js +61 -71
  103. package/dist/client/observation/observation-coding.d.ts +12 -0
  104. package/dist/client/observation/observation-coding.js +69 -0
  105. package/dist/client/observation/observation-groups.d.ts +12 -0
  106. package/dist/client/observation/observation-groups.js +51 -0
  107. package/dist/client/observation/reading-group-backfill.d.ts +13 -0
  108. package/dist/client/observation/reading-group-backfill.js +79 -0
  109. package/dist/client/observation/reading-group.d.ts +14 -0
  110. package/dist/client/observation/reading-group.js +85 -0
  111. package/dist/client/observation/series.d.ts +28 -5
  112. package/dist/client/observation/series.js +16 -6
  113. package/dist/client/observation/services/base-observation-service.d.ts +1 -1
  114. package/dist/client/observation/services/base-observation-service.js +6 -12
  115. package/dist/client/observation/services/blood-pressure.d.ts +2 -0
  116. package/dist/client/observation/services/blood-pressure.js +9 -5
  117. package/dist/client/observation/services/component-observation-services.js +2 -2
  118. package/dist/client/observation/services/creator.d.ts +5 -0
  119. package/dist/client/observation/services/creator.js +5 -0
  120. package/dist/client/observation/services/ecg-observation-fragments.d.ts +4 -0
  121. package/dist/client/observation/services/ecg-observation-fragments.js +30 -37
  122. package/dist/client/observation/services/ecg.d.ts +3 -1
  123. package/dist/client/observation/services/ecg.js +19 -19
  124. package/dist/client/observation/services/uric-acid-service.js +2 -13
  125. package/dist/client/observation/services/urine-analyte-values.d.ts +4 -0
  126. package/dist/client/observation/services/urine-analyte-values.js +27 -0
  127. package/dist/client/observation/types/GetLatestObservationsByCodeParams.d.ts +10 -0
  128. package/dist/client/observation/types/MeasurementTypeKey.d.ts +26 -0
  129. package/dist/client/observation/types/MeasurementTypeKey.js +26 -0
  130. package/dist/client/observation/types/ObservationCode.d.ts +64 -1
  131. package/dist/client/observation/types/ObservationCode.js +64 -1
  132. package/dist/client/observation/types/UrineAnalytes.d.ts +29 -0
  133. package/dist/client/observation/types/UrineAnalytes.js +18 -9
  134. package/dist/client/observation/types/generate-measurement/Sample.d.ts +33 -0
  135. package/dist/client/observation/types/generate-observation-body/GenerateObservationBodyParams.d.ts +9 -0
  136. package/dist/client/observation/types/measurement/BabySleepMeasurement.d.ts +3 -0
  137. package/dist/client/observation/types/measurement/BloodGlucoseMeasurement.d.ts +7 -0
  138. package/dist/client/observation/types/measurement/BloodPressureMeasurement.d.ts +10 -0
  139. package/dist/client/observation/types/measurement/BloodPressureStates.d.ts +10 -0
  140. package/dist/client/observation/types/measurement/BloodPressureStates.js +10 -0
  141. package/dist/client/observation/types/measurement/BodyTemperatureMeasurement.d.ts +7 -0
  142. package/dist/client/observation/types/measurement/BodyWeightMeasurmement.d.ts +8 -0
  143. package/dist/client/observation/types/measurement/EcgDiagnosticFlag.d.ts +18 -0
  144. package/dist/client/observation/types/measurement/EcgDiagnosticFlag.js +18 -0
  145. package/dist/client/observation/types/measurement/EcgMeasurement.d.ts +9 -0
  146. package/dist/client/observation/types/measurement/HeartRateMeasurement.d.ts +7 -0
  147. package/dist/client/observation/types/measurement/HeartRateVariabilityMeasurement.d.ts +7 -0
  148. package/dist/client/observation/types/measurement/LipidPanelMeasurement.d.ts +12 -0
  149. package/dist/client/observation/types/measurement/Measurement.d.ts +9 -0
  150. package/dist/client/observation/types/measurement/MeasurementDevice.d.ts +10 -0
  151. package/dist/client/observation/types/measurement/MeasurementSeries.d.ts +2 -0
  152. package/dist/client/observation/types/measurement/PulseOximeterMeasurement.d.ts +10 -0
  153. package/dist/client/observation/types/measurement/RespiratoryRateMeasurement.d.ts +7 -0
  154. package/dist/client/observation/types/measurement/RespiratoryTherapyMeasurement.d.ts +3 -0
  155. package/dist/client/observation/types/measurement/RestingHeartRateMeasurement.d.ts +7 -0
  156. package/dist/client/observation/types/measurement/SpirometryMeasurement.d.ts +23 -0
  157. package/dist/client/observation/types/measurement/StepCountMeasurement.d.ts +9 -0
  158. package/dist/client/observation/types/measurement/UrineAnalyzeMeasurement.d.ts +29 -0
  159. package/dist/client/observation/types/measurement/Vo2MaxMeasurement.d.ts +7 -0
  160. package/dist/client/observation/types/measurement/WalkingHeartRateAverageMeasurement.d.ts +7 -0
  161. package/dist/client/observation/types/service/MeasurementField.d.ts +5 -1
  162. package/dist/client/observation/utils/getDeviceObject.js +15 -32
  163. package/dist/client/observation/utils/getObservationValueDisplay.d.ts +2 -0
  164. package/dist/client/offline/offline-measurement-queue.d.ts +56 -1
  165. package/dist/client/offline/offline-measurement-queue.js +23 -8
  166. package/dist/client/offline/shared-measurement-queue.d.ts +16 -1
  167. package/dist/client/offline/shared-measurement-queue.js +3 -1
  168. package/dist/client/ovok-client.d.ts +28 -6
  169. package/dist/client/ovok-client.js +19 -11
  170. package/dist/client/patient/methods.d.ts +21 -0
  171. package/dist/client/patient/methods.js +21 -0
  172. package/dist/client/patient/types.d.ts +131 -0
  173. package/dist/client/patient-sharing/methods.d.ts +18 -0
  174. package/dist/client/patient-sharing/methods.js +18 -0
  175. package/dist/client/patient-sharing/types.d.ts +89 -1
  176. package/dist/client/platform/methods.d.ts +22 -0
  177. package/dist/client/platform/methods.js +20 -0
  178. package/dist/client/platform/types.d.ts +194 -1
  179. package/dist/client/platform/types.js +24 -0
  180. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts +3 -0
  181. package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +3 -0
  182. package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.d.ts +3 -0
  183. package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +3 -0
  184. package/dist/client/questionnaire-response/methods/populateQuestionnaire.d.ts +3 -0
  185. package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +3 -0
  186. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.d.ts +3 -0
  187. package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +3 -0
  188. package/dist/client/questionnaire-response/types.d.ts +6 -0
  189. package/dist/client/signals/errors.d.ts +13 -2
  190. package/dist/client/signals/errors.js +9 -2
  191. package/dist/client/signals/methods.d.ts +9 -0
  192. package/dist/client/signals/methods.js +9 -0
  193. package/dist/client/signals/types.d.ts +31 -0
  194. package/dist/client/slim/methods.d.ts +268 -21
  195. package/dist/client/slim/methods.js +264 -21
  196. package/dist/client/slim/paging.d.ts +22 -2
  197. package/dist/client/slim/paging.js +6 -2
  198. package/dist/client/slim/types.d.ts +920 -1
  199. package/dist/client/storage.d.ts +15 -1
  200. package/dist/client/storage.js +7 -1
  201. package/dist/client/wearables/methods.d.ts +24 -0
  202. package/dist/client/wearables/methods.js +24 -0
  203. package/dist/client/wearables/types.d.ts +74 -0
  204. package/dist/conformance/api-requirements.d.ts +31 -5
  205. package/dist/conformance/api-requirements.js +47 -10
  206. package/dist/conformance/capability-requirements.d.ts +4 -26
  207. package/dist/conformance/capability-requirements.js +5 -27
  208. package/dist/conformance/capability.d.ts +9 -1
  209. package/dist/conformance/capability.js +3 -1
  210. package/dist/hooks/account-hooks.d.ts +35 -0
  211. package/dist/hooks/account-hooks.js +33 -0
  212. package/dist/hooks/api-hooks.d.ts +74 -4
  213. package/dist/hooks/api-hooks.js +56 -4
  214. package/dist/hooks/cms-hooks.d.ts +9 -3
  215. package/dist/hooks/cms-hooks.js +9 -3
  216. package/dist/hooks/email-hooks.d.ts +3 -0
  217. package/dist/hooks/email-hooks.js +3 -0
  218. package/dist/hooks/experience-hooks.d.ts +26 -0
  219. package/dist/hooks/experience-hooks.js +24 -0
  220. package/dist/hooks/index.d.ts +18 -0
  221. package/dist/hooks/index.js +18 -0
  222. package/dist/hooks/invites-hooks.d.ts +21 -2
  223. package/dist/hooks/invites-hooks.js +21 -2
  224. package/dist/hooks/notification-ack-hooks.d.ts +6 -2
  225. package/dist/hooks/notification-ack-hooks.js +6 -2
  226. package/dist/hooks/notification-hooks.d.ts +27 -3
  227. package/dist/hooks/notification-hooks.js +27 -3
  228. package/dist/hooks/notification-note-hooks.d.ts +41 -0
  229. package/dist/hooks/notification-note-hooks.js +33 -0
  230. package/dist/hooks/observation-hooks.d.ts +30 -0
  231. package/dist/hooks/observation-hooks.js +26 -3
  232. package/dist/hooks/patient-hooks.d.ts +53 -0
  233. package/dist/hooks/patient-hooks.js +48 -0
  234. package/dist/hooks/patient-sharing-hooks.d.ts +18 -0
  235. package/dist/hooks/patient-sharing-hooks.js +18 -0
  236. package/dist/hooks/platform-hooks.d.ts +32 -0
  237. package/dist/hooks/platform-hooks.js +23 -0
  238. package/dist/hooks/poll-hooks.d.ts +17 -1
  239. package/dist/hooks/poll-hooks.js +3 -1
  240. package/dist/hooks/signals-hooks.d.ts +3 -0
  241. package/dist/hooks/signals-hooks.js +3 -0
  242. package/dist/hooks/wearables-hooks.d.ts +23 -0
  243. package/dist/hooks/wearables-hooks.js +21 -0
  244. package/dist/index.d.ts +1 -965
  245. package/dist/index.js +1 -71
  246. package/dist/next/auth/saved-accounts-store.d.ts +10 -0
  247. package/dist/next/auth/session.d.ts +17 -0
  248. package/dist/next/auth/user-session.d.ts +5 -0
  249. package/dist/next/config/ovok-config.d.ts +45 -0
  250. package/dist/next/errors/ovok-account-error.d.ts +14 -1
  251. package/dist/next/errors/ovok-account-error.js +8 -1
  252. package/dist/next/errors/ovok-errors.d.ts +88 -0
  253. package/dist/next/errors/ovok-errors.js +67 -0
  254. package/dist/next/http/http-client.d.ts +5 -0
  255. package/dist/next/http/transmit.d.ts +7 -0
  256. package/dist/next/http/url.d.ts +10 -0
  257. package/dist/next/ovok.d.ts +31 -1
  258. package/dist/next/ovok.js +5 -1
  259. package/dist/next/paging/page.d.ts +13 -1
  260. package/dist/next/react/context.d.ts +7 -0
  261. package/dist/next/react/context.js +7 -0
  262. package/dist/next/react/index.d.ts +24 -0
  263. package/dist/next/react/index.js +18 -0
  264. package/dist/next/react/query-hooks.d.ts +69 -0
  265. package/dist/next/react/query-hooks.js +31 -0
  266. package/dist/next/resources/accounts/accounts-resource.d.ts +6 -0
  267. package/dist/next/resources/accounts/accounts-resource.js +6 -0
  268. package/dist/next/resources/ai/ai-chat-resource.d.ts +7 -0
  269. package/dist/next/resources/ai/ai-chat-resource.js +5 -0
  270. package/dist/next/resources/ai/ai-resource.d.ts +13 -0
  271. package/dist/next/resources/ai/ai-resource.js +6 -0
  272. package/dist/next/resources/ai/chat-messages-resource.d.ts +7 -0
  273. package/dist/next/resources/ai/chat-messages-resource.js +7 -0
  274. package/dist/next/resources/ai/chat-sessions-resource.d.ts +14 -0
  275. package/dist/next/resources/ai/chat-sessions-resource.js +8 -0
  276. package/dist/next/resources/auth/auth-sessions-resource.d.ts +6 -1
  277. package/dist/next/resources/auth/auth-sessions-resource.js +6 -1
  278. package/dist/next/resources/auth/registration.d.ts +18 -1
  279. package/dist/next/resources/auth/social-login.d.ts +12 -0
  280. package/dist/next/resources/auth-resource.d.ts +54 -1
  281. package/dist/next/resources/auth-resource.js +23 -0
  282. package/dist/next/resources/bots/bots-resource.d.ts +15 -0
  283. package/dist/next/resources/bots/bots-resource.js +5 -0
  284. package/dist/next/resources/cms/cms-delivery.d.ts +14 -2
  285. package/dist/next/resources/cms/cms-documents-resource.d.ts +7 -1
  286. package/dist/next/resources/cms/cms-documents-resource.js +7 -1
  287. package/dist/next/resources/cms/cms-resource.d.ts +7 -0
  288. package/dist/next/resources/cms/cms-resource.js +5 -0
  289. package/dist/next/resources/cms/release-notes-resource.d.ts +6 -0
  290. package/dist/next/resources/cms/release-notes-resource.js +6 -0
  291. package/dist/next/resources/consent/consent-resource.d.ts +22 -0
  292. package/dist/next/resources/consent/consent-resource.js +20 -0
  293. package/dist/next/resources/content/content-resource.d.ts +18 -0
  294. package/dist/next/resources/content/content-resource.js +12 -0
  295. package/dist/next/resources/documents/documents-resource.d.ts +24 -0
  296. package/dist/next/resources/documents/documents-resource.js +10 -0
  297. package/dist/next/resources/email/email-resource.d.ts +6 -0
  298. package/dist/next/resources/email/email-resource.js +5 -0
  299. package/dist/next/resources/email/email-templates-resource.d.ts +6 -0
  300. package/dist/next/resources/email/email-templates-resource.js +6 -0
  301. package/dist/next/resources/fhir-resource.d.ts +36 -0
  302. package/dist/next/resources/fhir-resource.js +21 -0
  303. package/dist/next/resources/health-resource.d.ts +16 -0
  304. package/dist/next/resources/health-resource.js +5 -0
  305. package/dist/next/resources/invites/invite-flow-resource.d.ts +7 -1
  306. package/dist/next/resources/invites/invite-flow-resource.js +7 -1
  307. package/dist/next/resources/invites/invites-resource.d.ts +15 -0
  308. package/dist/next/resources/invites/invites-resource.js +5 -0
  309. package/dist/next/resources/localization/i18next-resource.d.ts +6 -0
  310. package/dist/next/resources/localization/i18next-resource.js +6 -0
  311. package/dist/next/resources/localization/locales-resource.d.ts +7 -0
  312. package/dist/next/resources/localization/locales-resource.js +7 -0
  313. package/dist/next/resources/localization/localizations-resource.d.ts +17 -0
  314. package/dist/next/resources/localization/localizations-resource.js +9 -0
  315. package/dist/next/resources/measurements/measurements-resource.d.ts +64 -3
  316. package/dist/next/resources/measurements/measurements-resource.js +45 -6
  317. package/dist/next/resources/measurements/observation-builder.d.ts +6 -1
  318. package/dist/next/resources/measurements/observation-builder.js +16 -7
  319. package/dist/next/resources/measurements/offline-measurement-queue-types.d.ts +32 -0
  320. package/dist/next/resources/measurements/save-error.js +3 -4
  321. package/dist/next/resources/patient/fhir-records.d.ts +19 -1
  322. package/dist/next/resources/patient/fhir-records.js +19 -1
  323. package/dist/next/resources/patient/patient-resource.d.ts +15 -0
  324. package/dist/next/resources/patient/patient-resource.js +6 -0
  325. package/dist/next/resources/projects/project-features-resource.d.ts +7 -0
  326. package/dist/next/resources/projects/project-features-resource.js +7 -0
  327. package/dist/next/resources/projects/project-members-resource.d.ts +19 -0
  328. package/dist/next/resources/projects/project-members-resource.js +9 -0
  329. package/dist/next/resources/projects/project-settings-resource.d.ts +8 -0
  330. package/dist/next/resources/projects/project-settings-resource.js +8 -0
  331. package/dist/next/resources/projects/projects-resource.d.ts +15 -0
  332. package/dist/next/resources/projects/projects-resource.js +5 -0
  333. package/dist/next/resources/questionnaires/questionnaires-resource.d.ts +13 -0
  334. package/dist/next/resources/questionnaires/questionnaires-resource.js +13 -0
  335. package/dist/next/resources/realtime/realtime-resource.d.ts +11 -0
  336. package/dist/next/resources/realtime/realtime-resource.js +11 -0
  337. package/dist/next/resources/realtime/realtime-socket.js +12 -5
  338. package/dist/next/resources/realtime/realtime-types.d.ts +19 -1
  339. package/dist/next/resources/session/saved-accounts-resource.d.ts +16 -0
  340. package/dist/next/resources/session/saved-accounts-resource.js +16 -0
  341. package/dist/next/resources/session/session-resource.d.ts +8 -0
  342. package/dist/next/resources/session/session-resource.js +7 -0
  343. package/dist/next/resources/sharing/sharing-invites-resource.d.ts +7 -0
  344. package/dist/next/resources/sharing/sharing-invites-resource.js +7 -0
  345. package/dist/next/resources/sharing/sharing-resource.d.ts +8 -0
  346. package/dist/next/resources/sharing/sharing-resource.js +5 -0
  347. package/dist/next/resources/sharing/sharing-settings-resource.d.ts +7 -0
  348. package/dist/next/resources/sharing/sharing-settings-resource.js +7 -0
  349. package/dist/next/resources/sharing/sharing-shares-resource.d.ts +7 -0
  350. package/dist/next/resources/sharing/sharing-shares-resource.js +7 -0
  351. package/dist/next/resources/signals/signals-gateway-resource.d.ts +15 -0
  352. package/dist/next/resources/signals/signals-gateway-resource.js +6 -0
  353. package/dist/next/resources/signals/signals-resource.d.ts +7 -0
  354. package/dist/next/resources/signals/signals-resource.js +5 -0
  355. package/dist/next/resources/signals/undeliverable-resource.d.ts +35 -0
  356. package/dist/next/resources/signals/undeliverable-resource.js +6 -0
  357. package/dist/next/resources/slim/slim-alarms-resource.d.ts +7 -0
  358. package/dist/next/resources/slim/slim-alarms-resource.js +7 -0
  359. package/dist/next/resources/slim/slim-change-history-resource.d.ts +6 -0
  360. package/dist/next/resources/slim/slim-change-history-resource.js +6 -0
  361. package/dist/next/resources/slim/slim-child-projects-resource.d.ts +21 -0
  362. package/dist/next/resources/slim/slim-child-projects-resource.js +8 -0
  363. package/dist/next/resources/slim/slim-devices-resource.d.ts +31 -0
  364. package/dist/next/resources/slim/slim-devices-resource.js +16 -0
  365. package/dist/next/resources/slim/slim-exports-resource.d.ts +6 -0
  366. package/dist/next/resources/slim/slim-exports-resource.js +6 -0
  367. package/dist/next/resources/slim/slim-locations-resource.d.ts +9 -0
  368. package/dist/next/resources/slim/slim-locations-resource.js +9 -0
  369. package/dist/next/resources/slim/slim-medical-notifications-resource.d.ts +6 -0
  370. package/dist/next/resources/slim/slim-medical-notifications-resource.js +6 -0
  371. package/dist/next/resources/slim/slim-notification-notes-resource.d.ts +10 -0
  372. package/dist/next/resources/slim/slim-notification-notes-resource.js +10 -0
  373. package/dist/next/resources/slim/slim-notifications-resource.d.ts +10 -0
  374. package/dist/next/resources/slim/slim-notifications-resource.js +6 -0
  375. package/dist/next/resources/slim/slim-organizations-resource.d.ts +9 -0
  376. package/dist/next/resources/slim/slim-organizations-resource.js +9 -0
  377. package/dist/next/resources/slim/slim-out-of-bed-resource.d.ts +12 -0
  378. package/dist/next/resources/slim/slim-out-of-bed-resource.js +7 -0
  379. package/dist/next/resources/slim/slim-patient-thresholds-resource.d.ts +6 -0
  380. package/dist/next/resources/slim/slim-patient-thresholds-resource.js +6 -0
  381. package/dist/next/resources/slim/slim-patients-resource.d.ts +11 -0
  382. package/dist/next/resources/slim/slim-patients-resource.js +10 -0
  383. package/dist/next/resources/slim/slim-policies-resource.d.ts +10 -0
  384. package/dist/next/resources/slim/slim-policies-resource.js +10 -0
  385. package/dist/next/resources/slim/slim-practitioners-resource.d.ts +6 -0
  386. package/dist/next/resources/slim/slim-practitioners-resource.js +6 -0
  387. package/dist/next/resources/slim/slim-projects-resource.d.ts +12 -0
  388. package/dist/next/resources/slim/slim-projects-resource.js +11 -0
  389. package/dist/next/resources/slim/slim-queries.d.ts +51 -0
  390. package/dist/next/resources/slim/slim-resource.d.ts +21 -0
  391. package/dist/next/resources/slim/slim-resource.js +6 -0
  392. package/dist/next/resources/slim/slim-sleep-resource.d.ts +6 -0
  393. package/dist/next/resources/slim/slim-sleep-resource.js +6 -0
  394. package/dist/next/resources/slim/slim-thresholds-resource.d.ts +5 -0
  395. package/dist/next/resources/slim/slim-thresholds-resource.js +5 -0
  396. package/dist/next/resources/slim/slim-trends-resource.d.ts +6 -0
  397. package/dist/next/resources/slim/slim-trends-resource.js +6 -0
  398. package/dist/next/resources/slim/slim-users-resource.d.ts +12 -0
  399. package/dist/next/resources/slim/slim-users-resource.js +6 -0
  400. package/dist/next/resources/slim/slim-zones-resource.d.ts +8 -0
  401. package/dist/next/resources/slim/slim-zones-resource.js +8 -0
  402. package/dist/next/resources/video-calls/video-call-access-resource.d.ts +13 -0
  403. package/dist/next/resources/video-calls/video-call-access-resource.js +8 -0
  404. package/dist/next/resources/video-calls/video-call-appointments-resource.d.ts +8 -0
  405. package/dist/next/resources/video-calls/video-call-appointments-resource.js +8 -0
  406. package/dist/next/resources/video-calls/video-call-emails-resource.d.ts +8 -0
  407. package/dist/next/resources/video-calls/video-call-emails-resource.js +8 -0
  408. package/dist/next/resources/video-calls/video-calls-resource.d.ts +14 -0
  409. package/dist/next/resources/video-calls/video-calls-resource.js +6 -0
  410. package/dist/next/resources/wearables/wearable-connections-resource.d.ts +8 -0
  411. package/dist/next/resources/wearables/wearable-connections-resource.js +8 -0
  412. package/dist/next/resources/wearables/wearable-providers-resource.d.ts +10 -0
  413. package/dist/next/resources/wearables/wearable-providers-resource.js +10 -0
  414. package/dist/next/resources/wearables/wearables-resource.d.ts +7 -0
  415. package/dist/next/resources/wearables/wearables-resource.js +5 -0
  416. package/dist/next/storage/ovok-storage.d.ts +16 -0
  417. package/dist/next/storage/ovok-storage.js +8 -0
  418. package/dist/types/ValidationError.d.ts +9 -0
  419. package/dist/utils/patch/getPatchOperationType.d.ts +3 -0
  420. package/dist/utils/patch/getPatchOperationType.js +3 -0
  421. package/package.json +52 -13
@@ -1,173 +1,420 @@
1
1
  import { SlimNotification } from "../slim/types";
2
+ /**
3
+ * The kind of notification a note is attached to.
4
+ *
5
+ * @category slim
6
+ */
2
7
  export type NotificationTargetKind = "oob" | "alarm" | "medical" | "alert";
8
+ /**
9
+ * A note attached to a notification.
10
+ *
11
+ * @category slim
12
+ */
3
13
  export type NotificationNote = {
14
+ /** Note id. */
4
15
  id: string;
16
+ /** The notification the note belongs to. */
5
17
  target: {
18
+ /** The kind of notification. */
6
19
  kind: NotificationTargetKind;
20
+ /** Id of the notification. */
7
21
  id: string;
8
22
  };
23
+ /** Patient the notification concerns, or null. */
9
24
  patientId: string | null;
25
+ /** Note text. */
10
26
  text: string;
27
+ /** Who wrote the note. */
11
28
  author: {
29
+ /** Practitioner id of the author, or null. */
12
30
  practitionerId: string | null;
31
+ /** Display name of the author, or null. */
13
32
  name: string | null;
14
33
  };
34
+ /** ISO 8601 creation time, or null. */
15
35
  createdAt: string | null;
36
+ /** ISO 8601 time of the last edit, or null. */
16
37
  updatedAt: string | null;
17
38
  };
39
+ /**
40
+ * The notes on one notification.
41
+ *
42
+ * @category slim
43
+ */
18
44
  export type NotificationNotes = {
45
+ /** Number of notes. */
19
46
  total: number;
47
+ /** The notes. */
20
48
  resources: NotificationNote[];
21
49
  };
50
+ /**
51
+ * Request body for adding a note.
52
+ *
53
+ * @category slim
54
+ */
22
55
  export type CreateNotificationNote = {
56
+ /** The kind of notification to annotate. */
23
57
  kind: NotificationTargetKind;
58
+ /** Id of the notification to annotate. */
24
59
  id: string;
60
+ /** Note text. */
25
61
  text: string;
26
62
  };
63
+ /**
64
+ * Request body for editing a note.
65
+ *
66
+ * @category slim
67
+ */
27
68
  export type UpdateNotificationNote = {
69
+ /** New note text. */
28
70
  text: string;
29
71
  };
72
+ /**
73
+ * Alarm category: a device alarm or an attention alert.
74
+ *
75
+ * @category slim
76
+ */
30
77
  export type SlimAlarmType = "deviceAlarm" | "attention";
78
+ /**
79
+ * Alarm severity.
80
+ *
81
+ * @category slim
82
+ */
31
83
  export type SlimAlarmSeverity = "RED" | "YELLOW" | "ATTENTION";
84
+ /**
85
+ * Whether the alarm is still open.
86
+ *
87
+ * @category slim
88
+ */
32
89
  export type SlimAlarmStatus = "active" | "completed";
90
+ /**
91
+ * Alarm-specific fields of an alarm notification.
92
+ *
93
+ * @category slim
94
+ */
33
95
  export type SlimAlarmDetails = {
96
+ /** Id of the alarm episode. */
34
97
  episodeId: string;
98
+ /** Alarm severity. */
35
99
  severity: SlimAlarmSeverity;
36
100
  /** The server forwards the device's alarm type without normalizing it. */
37
101
  type: string;
102
+ /** Alarm text, or null. */
38
103
  text: string | null;
39
104
  };
105
+ /**
106
+ * A notification with its alarm details, or null when it has none.
107
+ *
108
+ * @category slim
109
+ */
40
110
  export type SlimAlarm = SlimNotification & {
111
+ /** Alarm details, or null when the notification is not an alarm. */
41
112
  alarm: SlimAlarmDetails | null;
42
113
  };
114
+ /**
115
+ * Filters, paging and sort for listing alarms.
116
+ *
117
+ * @category slim
118
+ */
43
119
  export type SlimAlarmQuery = {
120
+ /** Only these alarm types. */
44
121
  type?: SlimAlarmType | readonly SlimAlarmType[];
122
+ /** Only these severities. */
45
123
  severity?: SlimAlarmSeverity | readonly SlimAlarmSeverity[];
124
+ /** Only active or completed alarms. */
46
125
  status?: SlimAlarmStatus;
126
+ /** Only alarms for this patient id. */
47
127
  patient?: string;
128
+ /** Only alarms for this device id. */
48
129
  device?: string;
130
+ /** Only alarms at or after this ISO 8601 date. */
49
131
  startDate?: string;
132
+ /** Only alarms at or before this ISO 8601 date. */
50
133
  endDate?: string;
134
+ /** Page number to fetch. */
51
135
  page?: number;
136
+ /** Alarms per page. */
52
137
  count?: number;
138
+ /** Order by time, newest first by default. */
53
139
  sort?: "newest" | "oldest";
54
140
  };
141
+ /**
142
+ * One page of alarms.
143
+ *
144
+ * @category slim
145
+ */
55
146
  export type SlimAlarmsPage = {
147
+ /** Total alarms matching the filters. */
56
148
  total: number;
149
+ /** This page's number. */
57
150
  page: number;
151
+ /** Alarms per page. */
58
152
  count: number;
153
+ /** The alarms on this page. */
59
154
  resources: SlimAlarm[];
155
+ /** Set when the server capped the result, with the reason and limit; null otherwise. */
60
156
  truncated: {
157
+ /** Which cap cut the result short. */
61
158
  reason: "result-cap" | "scan-budget";
159
+ /** The cap that applied. */
62
160
  limit: number;
63
161
  } | null;
64
162
  };
163
+ /**
164
+ * The most recent alarms, read from a cache.
165
+ *
166
+ * @category slim
167
+ */
65
168
  export type SlimRecentAlarms = {
169
+ /** The alarms; note counts are not available here. */
66
170
  recent: Array<Omit<SlimAlarm, "noteCount"> & {
171
+ /** Always null: cached alarms carry no note count. */
67
172
  noteCount: null;
68
173
  }>;
174
+ /** Number of alarms returned. */
69
175
  total: number;
176
+ /** Always `false`. */
70
177
  warm: false;
178
+ /** Where the data came from. */
71
179
  source: "redis" | "fhirStore";
72
180
  };
181
+ /**
182
+ * The most recent out-of-bed notifications, read from a cache.
183
+ *
184
+ * @category slim
185
+ */
73
186
  export type SlimRecentOutOfBed = {
187
+ /** The notifications; note counts are not available here. */
74
188
  recent: Array<SlimNotification & {
189
+ /** Always null: cached notifications carry no note count. */
75
190
  noteCount: null;
76
191
  }>;
192
+ /** Number of notifications returned. */
77
193
  total: number;
194
+ /** Whether the cache was warm. */
78
195
  warm: boolean;
196
+ /**
197
+ * Where the data came from.
198
+ *
199
+ * @hidden
200
+ */
79
201
  source: "redis" | "medplum";
80
202
  };
203
+ /**
204
+ * Filters and paging for listing medical notifications.
205
+ *
206
+ * @category slim
207
+ */
81
208
  export type SlimMedicalNotificationsQuery = {
209
+ /** Only open or closed episodes. */
82
210
  status?: "OPEN" | "CLOSED";
211
+ /** Only episodes since this ISO 8601 time. */
83
212
  since?: string;
213
+ /** Only acknowledged or only unacknowledged episodes. */
84
214
  acknowledged?: boolean;
215
+ /** Only this patient id. */
85
216
  patient?: string;
217
+ /** Only these observation codes. */
86
218
  codes?: readonly string[];
219
+ /** Maximum items to return. */
87
220
  limit?: number;
221
+ /** Cursor from the previous page's `nextCursor`. */
88
222
  cursor?: string;
89
223
  };
224
+ /**
225
+ * One page of medical notifications.
226
+ *
227
+ * @category slim
228
+ */
90
229
  export type SlimMedicalNotificationsPage = {
230
+ /** The notifications on this page. */
91
231
  items: SlimMedicalNotificationRow[];
232
+ /** Cursor for the next page, or null at the end. */
92
233
  nextCursor: string | null;
93
234
  };
235
+ /**
236
+ * A page of medical notifications with totals.
237
+ *
238
+ * @category slim
239
+ */
94
240
  export type SlimMedicalNotificationsCollection = SlimMedicalNotificationsPage & {
241
+ /** Total notifications matching the filters. */
95
242
  total: number;
243
+ /** Whether the server capped the result. */
96
244
  truncated: boolean;
97
245
  };
98
- /** Mirrors the response DTO in Ovok Core's medical-notification contract. */
246
+ /**
247
+ * Mirrors the response DTO in Ovok Core's medical-notification contract.
248
+ *
249
+ * @category slim
250
+ */
99
251
  export type SlimMedicalNotificationActor = {
252
+ /** FHIR reference of the user. */
100
253
  reference: string;
254
+ /** Display name, or null. */
101
255
  display: string | null;
102
256
  };
257
+ /**
258
+ * Who acknowledged a medical notification and when.
259
+ *
260
+ * @category slim
261
+ */
103
262
  export type SlimMedicalNotificationAcknowledgement = {
263
+ /** ISO 8601 acknowledgement time, or null. */
104
264
  acknowledgedAt: string | null;
265
+ /** Reference of the acknowledging user, or null. */
105
266
  acknowledgedBy: string | null;
267
+ /** The acknowledging user, or null. */
106
268
  acknowledgedActor: SlimMedicalNotificationActor | null;
107
269
  };
270
+ /**
271
+ * Where a medical notification occurred: patient, place and device.
272
+ *
273
+ * @category slim
274
+ */
108
275
  export type SlimMedicalNotificationContext = {
276
+ /** Patient id. */
109
277
  patientId: string | null;
278
+ /** Patient name. */
110
279
  patientName: string | null;
280
+ /** Location id. */
111
281
  locationId: string | null;
282
+ /** Location name. */
112
283
  locationName: string | null;
284
+ /** Room name. */
113
285
  room: string | null;
286
+ /** Bed name. */
114
287
  bed: string | null;
288
+ /** Floor name. */
115
289
  floor: string | null;
290
+ /** Device id. */
116
291
  deviceId: string | null;
292
+ /**
293
+ * Backend FHIR id of the device.
294
+ *
295
+ * @hidden
296
+ */
117
297
  deviceMedplumId: string | null;
298
+ /** Device name. */
118
299
  deviceName: string | null;
300
+ /** Organization id. */
119
301
  organizationId: string | null;
302
+ /** Organization name. */
120
303
  organizationName: string | null;
121
304
  };
305
+ /**
306
+ * One observation recorded within a medical episode.
307
+ *
308
+ * @category slim
309
+ */
122
310
  export type SlimMedicalEpisodeValue = {
311
+ /** Id of the observation. */
123
312
  observationId: string;
313
+ /** Numeric value, or null. */
124
314
  valueNumber: number | null;
315
+ /** Text value, or null. */
125
316
  valueString: string | null;
317
+ /** Unit of the value, or null. */
126
318
  valueUnit: string | null;
319
+ /** Note attached to the observation, or null. */
127
320
  note: string | null;
321
+ /** ISO 8601 time the value was measured, or null. */
128
322
  observedAt: string | null;
323
+ /** ISO 8601 time the value was recorded. */
129
324
  recordedAt: string;
130
325
  };
131
- /** STALE closes an out-of-bed episode that stayed open for 48 hours. */
326
+ /**
327
+ * STALE closes an out-of-bed episode that stayed open for 48 hours.
328
+ *
329
+ * @category slim
330
+ */
132
331
  export type SlimEpisodeCloseReason = "RECOVERED" | "TIMEOUT" | "ACKNOWLEDGED" | "CROSSED" | "THRESHOLD_CHANGED" | "AWAY" | "STALE" | "MANUAL";
332
+ /**
333
+ * The core fields of a medical episode.
334
+ *
335
+ * @category slim
336
+ */
133
337
  export type SlimMedicalEpisodeCore = {
338
+ /** Episode id. */
134
339
  id: string;
340
+ /** Patient id. */
135
341
  patientId: string;
342
+ /** Observation code the episode tracks. */
136
343
  code: string;
344
+ /** Code system of `code`, or null. */
137
345
  system: string | null;
346
+ /** Display text of `code`, or null. */
138
347
  display: string | null;
348
+ /** Episode status. */
139
349
  status: string;
350
+ /** ISO 8601 time the episode opened. */
140
351
  openedAt: string;
352
+ /** ISO 8601 time the episode closed, or null while open. */
141
353
  closedAt: string | null;
354
+ /** Why the episode closed, or null while open. */
142
355
  closeReason: SlimEpisodeCloseReason | (string & {}) | null;
356
+ /** ISO 8601 time of the latest sample, or null. */
143
357
  lastSampleAt: string | null;
358
+ /** Episode duration in milliseconds, or null. */
144
359
  durationMs: number | null;
360
+ /** Number of observations in the episode, or null. */
145
361
  observationCount: number | null;
362
+ /** Number of times the limit fired, or null. */
146
363
  firingCount: number | null;
364
+ /** Lowest value seen, or null. */
147
365
  minValue: number | null;
366
+ /** Highest value seen, or null. */
148
367
  maxValue: number | null;
368
+ /** Average value, or null. */
149
369
  avgValue: number | null;
370
+ /** Latest value, or null. */
150
371
  lastValue: number | null;
372
+ /** Most extreme value, or null. */
151
373
  peakValue: number | null;
374
+ /** ISO 8601 time of the peak, or null. */
152
375
  peakAt: string | null;
376
+ /** Value at the latest firing, or null. */
153
377
  lastFiringValue: number | null;
378
+ /** ISO 8601 time of the latest firing, or null. */
154
379
  lastFiringAt: string | null;
380
+ /** Id of the latest observation, or null. */
155
381
  lastObservationId: string | null;
382
+ /** The limit band that fired, or null. */
156
383
  firedBand: {
384
+ /** Lower limit of the band, or null when unbounded. */
157
385
  min: number | null;
386
+ /** Upper limit of the band, or null when unbounded. */
158
387
  max: number | null;
388
+ /** Version of the trigger that fired, or null. */
159
389
  triggerVersion: number | null;
160
390
  } | null;
161
391
  };
392
+ /**
393
+ * A medical notification: its episode, context, acknowledgement and note count.
394
+ *
395
+ * @category slim
396
+ */
162
397
  export type SlimMedicalNotificationRow = {
398
+ /** The episode. */
163
399
  episode: SlimMedicalEpisodeCore;
400
+ /** Where the episode occurred. */
164
401
  carehub: SlimMedicalNotificationContext;
402
+ /** Acknowledgement, or null when unacknowledged. */
165
403
  acknowledgement: SlimMedicalNotificationAcknowledgement | null;
404
+ /** Number of notes, or null when not computed. */
166
405
  noteCount: number | null;
167
406
  };
407
+ /**
408
+ * A medical notification with the full list of episode values.
409
+ *
410
+ * @category slim
411
+ */
168
412
  export type SlimMedicalNotificationDetail = Omit<SlimMedicalNotificationRow, "episode"> & {
413
+ /** The episode, with its recorded values. */
169
414
  episode: SlimMedicalEpisodeCore & {
415
+ /** Observations recorded in the episode. */
170
416
  values: SlimMedicalEpisodeValue[];
417
+ /** Whether `values` was cut short. */
171
418
  truncated: boolean;
172
419
  };
173
420
  };
@@ -0,0 +1,3 @@
1
+ import { BundleEntry } from "@medplum/fhirtypes";
2
+ /** An entry the server refused or failed on. */
3
+ export declare const isFailedEntry: (entry: BundleEntry) => boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFailedEntry = void 0;
4
+ const MULTIPLE_MATCHES = "multiple-matches";
5
+ /** A conditional create that matched several saved copies of the observation: it is saved already. */
6
+ const matchedSeveralCopies = (entry) => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = entry.response) === null || _a === void 0 ? void 0 : _a.outcome) === null || _b === void 0 ? void 0 : _b.issue) === null || _c === void 0 ? void 0 : _c.some((issue) => issue.code === MULTIPLE_MATCHES)) !== null && _d !== void 0 ? _d : false; };
7
+ /** An entry the server refused or failed on. */
8
+ const isFailedEntry = (entry) => {
9
+ var _a, _b;
10
+ const status = (_b = (_a = entry.response) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : "";
11
+ return (status.startsWith("4") || status.startsWith("5")) && !matchedSeveralCopies(entry);
12
+ };
13
+ exports.isFailedEntry = isFailedEntry;
@@ -1,4 +1,11 @@
1
1
  export declare const LOINC_SYSTEM = "http://loinc.org";
2
2
  export declare const UCUM_SYSTEM = "http://unitsofmeasure.org";
3
+ export declare const SNOMED_SYSTEM = "http://snomed.info/sct";
4
+ /** ISO/IEEE 11073-10101 nomenclature, which codes waveforms such as MDC_ECG_ELEC_POTL. */
5
+ export declare const MDC_SYSTEM = "urn:oid:2.16.840.1.113883.6.24";
6
+ /** Ovok's own codes for a measurement type, used where no standard code fits. */
7
+ export declare const MEASUREMENT_TYPE_SYSTEM = "https://sdk.ovok.com/fhir/CodeSystem/measurement-type";
8
+ export declare const OBSERVATION_CATEGORY_SYSTEM = "http://terminology.hl7.org/CodeSystem/observation-category";
3
9
  /** Identifier system of the device-side reading id that makes a save idempotent. */
4
10
  export declare const DEVICE_READING_IDENTIFIER_SYSTEM = "https://api.ovok.com/fhir/StructureDefinition/device-reading-id";
11
+ export declare const OVOK_EXTENSION_BASE_URL = "http://ovok.com/fhir/StructureDefinition";
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEVICE_READING_IDENTIFIER_SYSTEM = exports.UCUM_SYSTEM = exports.LOINC_SYSTEM = void 0;
3
+ exports.OVOK_EXTENSION_BASE_URL = exports.DEVICE_READING_IDENTIFIER_SYSTEM = exports.OBSERVATION_CATEGORY_SYSTEM = exports.MEASUREMENT_TYPE_SYSTEM = exports.MDC_SYSTEM = exports.SNOMED_SYSTEM = exports.UCUM_SYSTEM = exports.LOINC_SYSTEM = void 0;
4
4
  exports.LOINC_SYSTEM = "http://loinc.org";
5
5
  exports.UCUM_SYSTEM = "http://unitsofmeasure.org";
6
+ exports.SNOMED_SYSTEM = "http://snomed.info/sct";
7
+ /** ISO/IEEE 11073-10101 nomenclature, which codes waveforms such as MDC_ECG_ELEC_POTL. */
8
+ exports.MDC_SYSTEM = "urn:oid:2.16.840.1.113883.6.24";
9
+ /** Ovok's own codes for a measurement type, used where no standard code fits. */
10
+ exports.MEASUREMENT_TYPE_SYSTEM = "https://sdk.ovok.com/fhir/CodeSystem/measurement-type";
11
+ exports.OBSERVATION_CATEGORY_SYSTEM = "http://terminology.hl7.org/CodeSystem/observation-category";
6
12
  /** Identifier system of the device-side reading id that makes a save idempotent. */
7
13
  exports.DEVICE_READING_IDENTIFIER_SYSTEM = "https://api.ovok.com/fhir/StructureDefinition/device-reading-id";
14
+ exports.OVOK_EXTENSION_BASE_URL = "http://ovok.com/fhir/StructureDefinition";
@@ -1,4 +1,7 @@
1
1
  import { Observation } from "@medplum/fhirtypes";
2
2
  import { OvokClient } from "../../ovok-client";
3
3
  import { GenerateObservationBodyParams } from "../types/generate-observation-body/GenerateObservationBodyParams";
4
+ /**
5
+ * Builds the FHIR Observations that represent a measurement, without saving them.
6
+ */
4
7
  export declare function generateObservationBodiesByMeasurement(this: OvokClient, params: GenerateObservationBodyParams): Promise<Observation[]>;
@@ -2,76 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateObservationBodiesByMeasurement = generateObservationBodiesByMeasurement;
4
4
  const core_1 = require("@medplum/core");
5
- const fhir_systems_1 = require("../fhir-systems");
6
- const creator_1 = require("../services/creator");
7
- const getDeviceObject_1 = require("../utils/getDeviceObject");
5
+ const observation_builder_1 = require("../../../next/resources/measurements/observation-builder");
8
6
  const getPatientReference = async (client, patientId) => {
9
7
  if (patientId) {
10
8
  return `Patient/${patientId}`;
11
9
  }
12
10
  const profile = (await client.getProfileAsync());
13
- return (0, core_1.getReferenceString)(profile);
11
+ const reference = profile && (0, core_1.getReferenceString)(profile);
12
+ if (!reference) {
13
+ throw new Error("Sign in before building observations for the signed-in profile.");
14
+ }
15
+ return reference;
14
16
  };
15
- const addSourceIdentifier = (observations, patientReference, sourceId) => patientReference && sourceId
16
- ? observations.map((observation, index) => {
17
- var _a;
18
- return ({
19
- ...observation,
20
- identifier: [
21
- ...((_a = observation.identifier) !== null && _a !== void 0 ? _a : []),
22
- {
23
- system: fhir_systems_1.DEVICE_READING_IDENTIFIER_SYSTEM,
24
- value: `${patientReference}/${sourceId}/${index}`,
25
- },
26
- ],
27
- });
28
- })
29
- : observations;
17
+ /**
18
+ * Builds the FHIR Observations that represent a measurement, without saving them.
19
+ */
30
20
  async function generateObservationBodiesByMeasurement(params) {
31
- var _a, _b;
32
- const { device, measurement } = params;
33
- const measurementTypeKey = measurement.measurementTypeKey;
34
- const patientReference = await getPatientReference(this, params.patientId);
35
- const observationService = creator_1.ObservationServiceCreator.getInstance().getService(measurementTypeKey);
36
- const deviceObject = (0, getDeviceObject_1.getDeviceObject)(device);
37
- const applyEffectiveDateTime = (observation) => params.effectiveDateTime && !observation.effectivePeriod
38
- ? {
39
- ...observation,
40
- effectiveDateTime: params.effectiveDateTime.toISOString(),
41
- }
42
- : observation;
43
- const fragments = (_b = (_a = observationService.generateObservationFragments) === null || _a === void 0 ? void 0 : _a.call(observationService, measurement)) !== null && _b !== void 0 ? _b : codeValueFragments(observationService, measurement);
44
- const observations = fragments
45
- .map((fragment) => ({
46
- resourceType: "Observation",
47
- status: "registered",
48
- subject: {
49
- reference: patientReference,
50
- },
51
- device: deviceObject,
52
- ...fragment.value,
53
- code: fragment.code,
54
- ...(fragment.additionalProperties || {}),
55
- }))
56
- .filter(hasObservationValue)
57
- .map(applyEffectiveDateTime);
58
- return addSourceIdentifier(observations, patientReference, params.sourceId);
21
+ return (0, observation_builder_1.buildObservations)(params, await getPatientReference(this, params.patientId));
59
22
  }
60
- /** Services without fragments describe their observations as parallel code, value and property lists. */
61
- const codeValueFragments = (service, measurement) => {
62
- const codes = service.getObservationCodes();
63
- const values = service.generateValues(measurement);
64
- const additionalProperties = service.getAdditionalProperties(measurement);
65
- return codes.map((code, index) => ({
66
- code,
67
- value: values[index],
68
- additionalProperties: additionalProperties[index],
69
- }));
70
- };
71
- const hasObservationValue = (observation) => {
72
- var _a, _b, _c, _d, _e, _f;
73
- return ((_a = observation.valueQuantity) === null || _a === void 0 ? void 0 : _a.value) !== undefined ||
74
- Boolean((_b = observation.valueSampledData) === null || _b === void 0 ? void 0 : _b.data) ||
75
- Boolean((_e = (_d = (_c = observation.valueCodeableConcept) === null || _c === void 0 ? void 0 : _c.coding) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.code) ||
76
- Boolean((_f = observation.component) === null || _f === void 0 ? void 0 : _f.length);
77
- };
@@ -2,4 +2,7 @@ import { Bundle, Observation } from "@medplum/fhirtypes";
2
2
  import type { MedplumRequestOptions } from "@medplum/core";
3
3
  import { OvokClient } from "../../ovok-client";
4
4
  import { GetLatestObservationsByCodeParams } from "../types/GetLatestObservationsByCodeParams";
5
+ /**
6
+ * Fetches the most recent observation per code from `GET /fhir/Observation/$lastn`.
7
+ */
5
8
  export declare function getLatestObservationsByCodes(this: OvokClient, params: GetLatestObservationsByCodeParams, requestOptions?: MedplumRequestOptions): Promise<Bundle<Observation>>;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLatestObservationsByCodes = getLatestObservationsByCodes;
4
4
  const query_string_1 = require("../../query-string");
5
+ /**
6
+ * Fetches the most recent observation per code from `GET /fhir/Observation/$lastn`.
7
+ */
5
8
  async function getLatestObservationsByCodes(params, requestOptions) {
6
9
  var _a;
7
10
  let patientId = "patientId" in params ? params.patientId : "";
@@ -1,17 +1,39 @@
1
1
  import { Observation } from "@medplum/fhirtypes";
2
2
  import { BabySleepMeasurement, BloodGlucoseMeasurement, BloodPressureMeasurement, BodyTemperatureMeasurement, BodyWeightMeasurement, EcgMeasurement, HeartRateMeasurement, HeartRateVariabilityMeasurement, LipidPanelMeasurement, Measurement, MeasurementTypeKey, PulseOximeterMeasurement, RespiratoryRateMeasurement, RespiratoryTherapyMeasurement, RestingHeartRateMeasurement, StepCountMeasurement, UrineAnalyzeMeasurement, Vo2MaxMeasurement, WalkingHeartRateAverageMeasurement } from "../../../types/MeasurementTypes";
3
+ /**
4
+ * Any measurement that `observationsToMeasurements` can return.
5
+ */
3
6
  export type SupportedMeasurement = BloodGlucoseMeasurement | BabySleepMeasurement | BloodPressureMeasurement | BodyTemperatureMeasurement | BodyWeightMeasurement | EcgMeasurement | HeartRateMeasurement | HeartRateVariabilityMeasurement | LipidPanelMeasurement | PulseOximeterMeasurement | RespiratoryRateMeasurement | RespiratoryTherapyMeasurement | RestingHeartRateMeasurement | StepCountMeasurement | UrineAnalyzeMeasurement | Vo2MaxMeasurement | WalkingHeartRateAverageMeasurement | Measurement;
7
+ /**
8
+ * Measurement types that can be built from observations.
9
+ *
10
+ * @category measurements
11
+ */
4
12
  type SupportedType = Exclude<MeasurementTypeKey, MeasurementTypeKey.symptomQuestionnaire>;
13
+ /**
14
+ * How to group observations of one measurement: by `hasMember` links, by time, or with a custom key function.
15
+ */
5
16
  export type ObservationGrouping = "hasMember" | "time" | ((observation: Observation, index: number, observations: readonly Observation[]) => string);
17
+ /**
18
+ * Options of `observationsToMeasurements`.
19
+ */
6
20
  export interface ObservationsToMeasurementsOptions {
7
21
  /** How related Observation resources should be reconstructed into measurements. */
8
22
  groupBy?: ObservationGrouping;
9
23
  /** Maximum timestamp difference used by the time-based fallback. */
10
24
  timeToleranceMs?: number;
11
25
  }
26
+ /**
27
+ * Returns the comma-separated observation codes to search for the given measurement types.
28
+ *
29
+ * @category measurements
30
+ */
12
31
  export declare const observationCodesForTypes: (types: readonly SupportedType[]) => string;
13
- /** Converts FHIR observations back into SDK measurements without patient/app assumptions. */
32
+ /**
33
+ * Converts FHIR observations back into SDK measurements without patient/app assumptions.
34
+ */
14
35
  export declare const observationsToMeasurements: <T extends readonly SupportedType[]>(observations: readonly Observation[], types: T, options?: ObservationsToMeasurementsOptions) => Array<Extract<SupportedMeasurement, {
36
+ /** One of the requested measurement types. */
15
37
  measurementTypeKey: T[number];
16
38
  }>>;
17
39
  export {};