@kenyaemr/esm-ward-app 8.5.4-pre.98 → 8.5.4

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 (662) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/dist/1033.js +1 -0
  3. package/dist/1033.js.map +1 -0
  4. package/dist/1364.js +1 -0
  5. package/dist/1364.js.map +1 -0
  6. package/dist/1480.js +1 -0
  7. package/dist/1480.js.map +1 -0
  8. package/dist/1613.css +1 -0
  9. package/dist/1613.css.map +1 -0
  10. package/dist/1613.js +1 -0
  11. package/dist/1613.js.map +1 -0
  12. package/dist/1646.js +1 -0
  13. package/dist/1646.js.map +1 -0
  14. package/dist/1744.js +1 -0
  15. package/dist/1744.js.map +1 -0
  16. package/dist/1869.js +1 -0
  17. package/dist/1869.js.map +1 -0
  18. package/dist/1877.js +1 -0
  19. package/dist/1877.js.map +1 -0
  20. package/dist/193.js +1 -0
  21. package/dist/193.js.map +1 -0
  22. package/dist/1992.css +1 -0
  23. package/dist/1992.css.map +1 -0
  24. package/dist/1992.js +1 -0
  25. package/dist/1992.js.map +1 -0
  26. package/dist/2007.js +1 -0
  27. package/dist/2007.js.map +1 -0
  28. package/dist/2101.css +1 -0
  29. package/dist/2101.css.map +1 -0
  30. package/dist/2101.js +1 -0
  31. package/dist/2101.js.map +1 -0
  32. package/dist/2304.js +1 -0
  33. package/dist/2304.js.map +1 -0
  34. package/dist/2317.js +1 -0
  35. package/dist/2317.js.map +1 -0
  36. package/dist/2326.css +1 -0
  37. package/dist/2326.css.map +1 -0
  38. package/dist/2326.js +1 -0
  39. package/dist/2326.js.map +1 -0
  40. package/dist/2416.js +1 -0
  41. package/dist/2416.js.map +1 -0
  42. package/dist/2446.css +1 -0
  43. package/dist/2446.css.map +1 -0
  44. package/dist/2446.js +1 -0
  45. package/dist/2446.js.map +1 -0
  46. package/dist/2724.css +1 -0
  47. package/dist/2724.css.map +1 -0
  48. package/dist/2724.js +1 -0
  49. package/dist/2724.js.map +1 -0
  50. package/dist/2764.js +1 -0
  51. package/dist/2764.js.map +1 -0
  52. package/dist/282.js +1 -0
  53. package/dist/282.js.map +1 -0
  54. package/dist/2881.js +1 -0
  55. package/dist/2881.js.map +1 -0
  56. package/dist/297.js +1 -0
  57. package/dist/297.js.map +1 -0
  58. package/dist/2988.js +1 -0
  59. package/dist/2988.js.map +1 -0
  60. package/dist/3012.css +1 -0
  61. package/dist/3012.css.map +1 -0
  62. package/dist/3012.js +43 -0
  63. package/dist/3012.js.map +1 -0
  64. package/dist/3253.css +1 -0
  65. package/dist/3253.css.map +1 -0
  66. package/dist/3253.js +1 -0
  67. package/dist/3253.js.map +1 -0
  68. package/dist/3276.css +1 -0
  69. package/dist/3276.css.map +1 -0
  70. package/dist/3276.js +1 -0
  71. package/dist/3276.js.map +1 -0
  72. package/dist/3378.js +1 -0
  73. package/dist/3378.js.map +1 -0
  74. package/dist/3428.css +1 -0
  75. package/dist/3428.css.map +1 -0
  76. package/dist/3428.js +1 -0
  77. package/dist/3428.js.map +1 -0
  78. package/dist/3446.css +1 -0
  79. package/dist/3446.css.map +1 -0
  80. package/dist/3446.js +1 -0
  81. package/dist/3446.js.map +1 -0
  82. package/dist/3720.js +1 -0
  83. package/dist/3720.js.map +1 -0
  84. package/dist/3824.js +1 -0
  85. package/dist/3824.js.map +1 -0
  86. package/dist/3877.js +1 -0
  87. package/dist/3877.js.map +1 -0
  88. package/dist/3963.js +1 -0
  89. package/dist/3963.js.map +1 -0
  90. package/dist/3989.js +1 -0
  91. package/dist/3989.js.map +1 -0
  92. package/dist/4106.js +1 -0
  93. package/dist/4106.js.map +1 -0
  94. package/dist/4111.js +1 -0
  95. package/dist/4111.js.map +1 -0
  96. package/dist/4145.js +1 -0
  97. package/dist/4145.js.map +1 -0
  98. package/dist/4162.js +1 -0
  99. package/dist/4162.js.map +1 -0
  100. package/dist/4266.css +1 -0
  101. package/dist/4266.css.map +1 -0
  102. package/dist/4266.js +1 -0
  103. package/dist/4266.js.map +1 -0
  104. package/dist/4304.js +1 -0
  105. package/dist/4304.js.map +1 -0
  106. package/dist/434.js +1 -0
  107. package/dist/434.js.map +1 -0
  108. package/dist/4348.js +1 -0
  109. package/dist/4348.js.map +1 -0
  110. package/dist/4383.js +1 -0
  111. package/dist/4383.js.map +1 -0
  112. package/dist/4658.js +1 -0
  113. package/dist/4658.js.map +1 -0
  114. package/dist/466.js +1 -0
  115. package/dist/466.js.map +1 -0
  116. package/dist/4777.js +1 -0
  117. package/dist/4777.js.map +1 -0
  118. package/dist/4847.css +1 -0
  119. package/dist/4847.css.map +1 -0
  120. package/dist/4847.js +1 -0
  121. package/dist/4847.js.map +1 -0
  122. package/dist/4883.css +1 -0
  123. package/dist/4883.css.map +1 -0
  124. package/dist/4883.js +1 -0
  125. package/dist/4883.js.map +1 -0
  126. package/dist/502.js +1 -0
  127. package/dist/502.js.map +1 -0
  128. package/dist/5050.css +1 -0
  129. package/dist/5050.css.map +1 -0
  130. package/dist/5050.js +1 -0
  131. package/dist/5050.js.map +1 -0
  132. package/dist/5060.css +1 -0
  133. package/dist/5060.css.map +1 -0
  134. package/dist/5060.js +1 -0
  135. package/dist/5060.js.map +1 -0
  136. package/dist/5117.js +1 -0
  137. package/dist/5117.js.map +1 -0
  138. package/dist/5132.js +1 -0
  139. package/dist/5132.js.map +1 -0
  140. package/dist/5145.js +1 -0
  141. package/dist/5145.js.map +1 -0
  142. package/dist/5181.js +1 -0
  143. package/dist/5181.js.map +1 -0
  144. package/dist/5460.css +1 -0
  145. package/dist/5460.css.map +1 -0
  146. package/dist/5460.js +1 -0
  147. package/dist/5460.js.map +1 -0
  148. package/dist/5493.css +1 -0
  149. package/dist/5493.css.map +1 -0
  150. package/dist/5493.js +1 -0
  151. package/dist/5493.js.map +1 -0
  152. package/dist/5503.js +1 -0
  153. package/dist/5503.js.map +1 -0
  154. package/dist/5576.js +1 -0
  155. package/dist/5576.js.map +1 -0
  156. package/dist/5591.css +1 -0
  157. package/dist/5591.css.map +1 -0
  158. package/dist/5591.js +1 -0
  159. package/dist/5591.js.map +1 -0
  160. package/dist/5644.js +1 -0
  161. package/dist/5644.js.map +1 -0
  162. package/dist/5650.js +1 -0
  163. package/dist/5650.js.map +1 -0
  164. package/dist/5697.js +1 -0
  165. package/dist/5697.js.map +1 -0
  166. package/dist/5862.css +1 -0
  167. package/dist/5862.css.map +1 -0
  168. package/dist/5862.js +1 -0
  169. package/dist/5862.js.map +1 -0
  170. package/dist/5940.js +1 -0
  171. package/dist/5940.js.map +1 -0
  172. package/dist/5976.js +1 -0
  173. package/dist/5976.js.map +1 -0
  174. package/dist/6047.js +1 -0
  175. package/dist/6047.js.map +1 -0
  176. package/dist/6079.css +1 -0
  177. package/dist/6079.css.map +1 -0
  178. package/dist/6079.js +1 -0
  179. package/dist/6079.js.map +1 -0
  180. package/dist/6126.js +1 -0
  181. package/dist/6126.js.map +1 -0
  182. package/dist/6196.js +1 -0
  183. package/dist/6196.js.map +1 -0
  184. package/dist/6358.js +1 -0
  185. package/dist/6358.js.map +1 -0
  186. package/dist/636.js +1 -0
  187. package/dist/636.js.map +1 -0
  188. package/dist/6371.js +1 -0
  189. package/dist/6371.js.map +1 -0
  190. package/dist/6377.js +1 -0
  191. package/dist/6377.js.map +1 -0
  192. package/dist/6380.css +1 -0
  193. package/dist/6380.css.map +1 -0
  194. package/dist/6380.js +1 -0
  195. package/dist/6380.js.map +1 -0
  196. package/dist/6444.js +1 -0
  197. package/dist/6444.js.map +1 -0
  198. package/dist/6482.css +1 -0
  199. package/dist/6482.css.map +1 -0
  200. package/dist/6482.js +1 -0
  201. package/dist/6482.js.map +1 -0
  202. package/dist/6508.js +1 -0
  203. package/dist/6508.js.map +1 -0
  204. package/dist/6703.css +1 -0
  205. package/dist/6703.css.map +1 -0
  206. package/dist/6703.js +1 -0
  207. package/dist/6703.js.map +1 -0
  208. package/dist/6724.js +1 -0
  209. package/dist/6724.js.map +1 -0
  210. package/dist/689.js +1 -0
  211. package/dist/689.js.map +1 -0
  212. package/dist/6904.js +1 -0
  213. package/dist/6904.js.map +1 -0
  214. package/dist/7045.js +1 -0
  215. package/dist/7045.js.map +1 -0
  216. package/dist/7175.js +1 -0
  217. package/dist/7175.js.map +1 -0
  218. package/dist/7240.css +1 -0
  219. package/dist/7240.css.map +1 -0
  220. package/dist/7240.js +1 -0
  221. package/dist/7240.js.map +1 -0
  222. package/dist/7683.js +1 -0
  223. package/dist/7683.js.map +1 -0
  224. package/dist/7742.js +1 -0
  225. package/dist/7742.js.map +1 -0
  226. package/dist/7849.js +1 -0
  227. package/dist/7849.js.map +1 -0
  228. package/dist/7891.css +1 -0
  229. package/dist/7891.css.map +1 -0
  230. package/dist/7891.js +1 -0
  231. package/dist/7891.js.map +1 -0
  232. package/dist/7912.js +1 -0
  233. package/dist/7912.js.map +1 -0
  234. package/dist/7984.js +1 -0
  235. package/dist/7984.js.map +1 -0
  236. package/dist/8202.js +20 -0
  237. package/dist/8202.js.map +1 -0
  238. package/dist/8302.css +1 -0
  239. package/dist/8302.css.map +1 -0
  240. package/dist/8302.js +1 -0
  241. package/dist/8302.js.map +1 -0
  242. package/dist/8358.js +1 -0
  243. package/dist/8358.js.map +1 -0
  244. package/dist/8359.js +1 -0
  245. package/dist/8359.js.map +1 -0
  246. package/dist/8448.css +1 -0
  247. package/dist/8448.css.map +1 -0
  248. package/dist/8448.js +1 -0
  249. package/dist/8448.js.map +1 -0
  250. package/dist/8502.js +1 -0
  251. package/dist/8502.js.map +1 -0
  252. package/dist/8695.js +1 -0
  253. package/dist/8695.js.map +1 -0
  254. package/dist/8923.css +1 -0
  255. package/dist/8923.css.map +1 -0
  256. package/dist/8923.js +24 -0
  257. package/dist/8923.js.map +1 -0
  258. package/dist/8990.js +1 -0
  259. package/dist/8990.js.map +1 -0
  260. package/dist/9011.js +1 -0
  261. package/dist/9011.js.map +1 -0
  262. package/dist/903.js +1 -0
  263. package/dist/903.js.map +1 -0
  264. package/dist/9049.js +1 -0
  265. package/dist/9049.js.map +1 -0
  266. package/dist/9061.js +1 -0
  267. package/dist/9061.js.map +1 -0
  268. package/dist/9072.js +1 -0
  269. package/dist/9072.js.map +1 -0
  270. package/dist/9080.css +1 -0
  271. package/dist/9080.css.map +1 -0
  272. package/dist/9080.js +1 -0
  273. package/dist/9080.js.map +1 -0
  274. package/dist/9124.css +1 -0
  275. package/dist/9124.css.map +1 -0
  276. package/dist/9124.js +1 -0
  277. package/dist/9124.js.map +1 -0
  278. package/dist/9143.js +1 -0
  279. package/dist/9143.js.map +1 -0
  280. package/dist/9301.js +1 -0
  281. package/dist/9301.js.map +1 -0
  282. package/dist/9309.css +1 -0
  283. package/dist/9309.css.map +1 -0
  284. package/dist/9427.js +1 -0
  285. package/dist/9427.js.map +1 -0
  286. package/dist/9456.css +1 -0
  287. package/dist/9456.css.map +1 -0
  288. package/dist/9456.js +1 -0
  289. package/dist/9456.js.map +1 -0
  290. package/dist/9712.js +1 -0
  291. package/dist/9712.js.map +1 -0
  292. package/dist/9771.js +1 -0
  293. package/dist/9771.js.map +1 -0
  294. package/dist/9806.js +1 -0
  295. package/dist/9806.js.map +1 -0
  296. package/dist/9875.css +1 -0
  297. package/dist/9875.css.map +1 -0
  298. package/dist/9875.js +60 -0
  299. package/dist/9875.js.map +1 -0
  300. package/dist/9926.css +1 -0
  301. package/dist/9926.css.map +1 -0
  302. package/dist/9926.js +1 -0
  303. package/dist/9926.js.map +1 -0
  304. package/dist/9976.css +1 -0
  305. package/dist/9976.css.map +1 -0
  306. package/dist/9976.js +1 -0
  307. package/dist/9976.js.map +1 -0
  308. package/dist/kenyaemr-esm-ward-app.js +3 -5
  309. package/dist/kenyaemr-esm-ward-app.js.buildmanifest.json +1141 -947
  310. package/dist/kenyaemr-esm-ward-app.js.map +1 -1
  311. package/dist/routes.json +1 -1
  312. package/package.json +5 -4
  313. package/rspack.config.js +3 -1
  314. package/src/autosuggest/autosuggest.component.tsx +203 -0
  315. package/src/autosuggest/autosuggest.scss +75 -0
  316. package/src/autosuggest/patient-search-info.component.tsx +40 -0
  317. package/src/autosuggest/patient-search-info.scss +37 -0
  318. package/src/autosuggest/search-empty-state.component.tsx +27 -0
  319. package/src/autosuggest/search-empty-state.scss +18 -0
  320. package/src/billing/create-bill.resource.ts +147 -0
  321. package/src/billing/create-bill.scss +122 -0
  322. package/src/billing/create-bill.workspace.tsx +468 -0
  323. package/src/config-schema.ts +224 -5
  324. package/src/declarations.d.ts +1 -0
  325. package/src/discharge-printouts/discharge-printout.preview-modal.scss +21 -0
  326. package/src/discharge-printouts/discharge-printout.preview-modal.tsx +67 -21
  327. package/src/discharge-printouts/discharge-printout.resource.ts +100 -45
  328. package/src/discharge-printouts/discharge-printouts.scss +9 -1
  329. package/src/discharge-printouts/discharge-summary.tsx +76 -50
  330. package/src/discharge-printouts/investigations-and-procedures.scss +48 -0
  331. package/src/discharge-printouts/investigrations-and-procedures.components.tsx +134 -0
  332. package/src/discharge-printouts/lab-results.tsx +1 -2
  333. package/src/discharge-printouts/use-print-preview.ts +35 -0
  334. package/src/hooks/critical-care-ward.utils.ts +136 -0
  335. package/src/hooks/use-patient-summary.tsx +101 -0
  336. package/src/hooks/useCriticalCareWardTab.ts +94 -0
  337. package/src/hooks/useEbolaIsolationSuspects.test.ts +24 -0
  338. package/src/hooks/useEbolaIsolationSuspects.ts +51 -0
  339. package/src/hooks/useFacilityRegistry.ts +32 -0
  340. package/src/hooks/useIpdDischargeEncounter.ts +3 -0
  341. package/src/hooks/useIsIsolationWard.ts +51 -0
  342. package/src/hooks/useSelectableWards.ts +72 -0
  343. package/src/hooks/useSummaryMetrics.ts +14 -4
  344. package/src/hooks/useWardPatientGrouping.ts +4 -4
  345. package/src/in-patient/admission-request.component.tsx +1 -1
  346. package/src/in-patient/bloodTransfusion/blood-transfusion-dashboard.component.tsx +15 -0
  347. package/src/in-patient/bloodTransfusion/components/blood-transfusion-chart.component.tsx +635 -0
  348. package/src/in-patient/bloodTransfusion/components/blood-transfusion-form.component.tsx +849 -0
  349. package/src/in-patient/bloodTransfusion/components/blood-transfusion.scss +741 -0
  350. package/src/in-patient/bloodTransfusion/components/provider-search.component.tsx +111 -0
  351. package/src/in-patient/bloodTransfusion/components/provider-search.scss +49 -0
  352. package/src/in-patient/bloodTransfusion/components/transfusion-time-picker.component.tsx +231 -0
  353. package/src/in-patient/bloodTransfusion/components/transfusion-time-picker.scss +142 -0
  354. package/src/in-patient/bloodTransfusion/config/blood-transfusion.defaults.ts +164 -0
  355. package/src/in-patient/bloodTransfusion/resources/blood-transfusion.resource.ts +238 -0
  356. package/src/in-patient/bloodTransfusion/resources/openmrs-encounter-search.ts +41 -0
  357. package/src/in-patient/bloodTransfusion/resources/provider.resource.ts +30 -0
  358. package/src/in-patient/bloodTransfusion/resources/resolve-encounter-type.ts +135 -0
  359. package/src/in-patient/bloodTransfusion/types/blood-transfusion.types.ts +90 -0
  360. package/src/in-patient/bloodTransfusion/utils/blood-transfusion-obs.mapper.ts +404 -0
  361. package/src/in-patient/bloodTransfusion/utils/blood-transfusion.utils.ts +356 -0
  362. package/src/in-patient/bloodTransfusion/utils/encounter-datetime.utils.ts +27 -0
  363. package/src/in-patient/bloodTransfusion/utils/openmrs-concept-metadata.ts +512 -0
  364. package/src/in-patient/bloodTransfusion/utils/openmrs-concept.utils.ts +41 -0
  365. package/src/in-patient/bloodTransfusion/utils/openmrs-error.utils.ts +79 -0
  366. package/src/in-patient/bloodTransfusion/utils/timezone.utils.ts +159 -0
  367. package/src/in-patient/bloodTransfusion/utils/variant-class.utils.ts +11 -0
  368. package/src/in-patient/ebola/case-followup-day-picker.component.tsx +217 -0
  369. package/src/in-patient/ebola/case-followup.component.test.tsx +373 -0
  370. package/src/in-patient/ebola/case-followup.component.tsx +569 -0
  371. package/src/in-patient/ebola/case-followup.resource.test.ts +205 -0
  372. package/src/in-patient/ebola/case-followup.resource.ts +509 -0
  373. package/src/in-patient/ebola/case-followup.scss +506 -0
  374. package/src/in-patient/ebola/case-followup.utils.test.ts +414 -0
  375. package/src/in-patient/ebola/case-followup.utils.ts +725 -0
  376. package/src/in-patient/ebola/case-identification-finding/case-identification-finding.component.test.tsx +88 -0
  377. package/src/in-patient/ebola/case-identification-finding/case-identification-finding.component.tsx +208 -0
  378. package/src/in-patient/ebola/case-identification-finding/case-identification-finding.resource.ts +32 -0
  379. package/src/in-patient/ebola/case-identification-finding/case-identification-finding.scss +39 -0
  380. package/src/in-patient/ebola/contact-list/add-contact-form.workspace.tsx +465 -0
  381. package/src/in-patient/ebola/contact-list/adresshierarchy.component.tsx +32 -0
  382. package/src/in-patient/ebola/contact-list/contact-list-form.scss +29 -0
  383. package/src/in-patient/ebola/contact-list/contact-list.resource.tsx +371 -0
  384. package/src/in-patient/ebola/contact-list/contact-list.types.ts +41 -0
  385. package/src/in-patient/ebola/contact-list/contact-listing.component.tsx +179 -0
  386. package/src/in-patient/ebola/contact-list/contact-listing.scss +15 -0
  387. package/src/in-patient/ebola/contact-list/contact-tracing-history.component.tsx +159 -0
  388. package/src/in-patient/ebola/contact-list/contact-tracing.resource.tsx +125 -0
  389. package/src/in-patient/ebola/contact-list/relationship-type.component.tsx +31 -0
  390. package/src/in-patient/ebola/contact-list/use-contact-mapping.ts +247 -0
  391. package/src/in-patient/ebola/index.ts +20 -0
  392. package/src/in-patient/in-patient.resource.tsx +0 -32
  393. package/src/in-patient/inpatient-detail-view.component.tsx +20 -5
  394. package/src/in-patient/inpatient-forms.component.tsx +2 -2
  395. package/src/in-patient/inpatient-tabs.component.tsx +29 -79
  396. package/src/in-patient/inpatient.scss +5 -0
  397. package/src/in-patient/labourCareGuide/alert-rules.ts +4 -5
  398. package/src/in-patient/labourCareGuide/constants/admission-form.constants.ts +3 -0
  399. package/src/in-patient/labourCareGuide/forms/admission-details-form.component.tsx +58 -7
  400. package/src/in-patient/labourCareGuide/forms/baby-form.component.tsx +18 -3
  401. package/src/in-patient/labourCareGuide/forms/labour-care-guide-forms.component.tsx +15 -1
  402. package/src/in-patient/labourCareGuide/forms/time-picker-dropdown.component.tsx +47 -62
  403. package/src/in-patient/labourCareGuide/forms/time-picker-dropdown.scss +3 -2
  404. package/src/in-patient/labourCareGuide/forms/vital-range-limits.test.tsx +140 -0
  405. package/src/in-patient/labourCareGuide/forms/woman-form.component.tsx +23 -3
  406. package/src/in-patient/labourCareGuide/graphs/baby.component.tsx +1 -1
  407. package/src/in-patient/labourCareGuide/hooks/use-lcg-data.ts +23 -2
  408. package/src/in-patient/labourCareGuide/labour-care-guide-header.component.tsx +17 -3
  409. package/src/in-patient/labourCareGuide/labour-care-guide.component.tsx +27 -59
  410. package/src/in-patient/labourCareGuide/maternity-inpatient-form.workspace.tsx +75 -0
  411. package/src/in-patient/labourCareGuide/partography-data-form.scss +36 -40
  412. package/src/in-patient/labourCareGuide/partography.resource.ts +21 -88
  413. package/src/in-patient/labourCareGuide/resources/admission-details.resource.ts +10 -10
  414. package/src/in-patient/labourCareGuide/resources/baby.resource.ts +35 -12
  415. package/src/in-patient/labourCareGuide/resources/labour-progress.resource.ts +9 -6
  416. package/src/in-patient/labourCareGuide/resources/labour-time-set-select-setup.resource.ts +7 -6
  417. package/src/in-patient/labourCareGuide/resources/lcg-encounter-fetch.ts +98 -0
  418. package/src/in-patient/labourCareGuide/resources/lcg-session-correction.resource.ts +24 -13
  419. package/src/in-patient/labourCareGuide/resources/medication.resource.ts +6 -5
  420. package/src/in-patient/labourCareGuide/resources/shared-decision-making.resource.ts +6 -4
  421. package/src/in-patient/labourCareGuide/resources/supportive-care.resource.ts +13 -9
  422. package/src/in-patient/labourCareGuide/time-slot-utils.ts +33 -4
  423. package/src/in-patient/labourCareGuide/types/concept-uuids.constants.ts +1 -0
  424. package/src/in-patient/labourCareGuide/types/index.ts +21 -6
  425. package/src/in-patient/partograph.component.tsx +1 -13
  426. package/src/in-patient/time-ago.ts +34 -0
  427. package/src/in-patient/treatmentChart/nursing-cardex-plan.resource.ts +111 -20
  428. package/src/in-patient/treatmentChart/nursing-cardex-plan.workspace.scss +30 -0
  429. package/src/in-patient/treatmentChart/nursing-cardex-plan.workspace.tsx +223 -25
  430. package/src/in-patient/treatmentChart/nursing-treatment-sheet.resource.ts +90 -0
  431. package/src/in-patient/treatmentChart/nursing-treatment-sheet.utils.test.ts +272 -0
  432. package/src/in-patient/treatmentChart/nursing-treatment-sheet.utils.ts +169 -0
  433. package/src/in-patient/treatmentChart/use-nursing-cardex-form-schema.ts +2 -14
  434. package/src/index.ts +17 -0
  435. package/src/routes.json +78 -2
  436. package/src/types/index.ts +3 -3
  437. package/src/ward-patients/admitted-patients.tsx +61 -56
  438. package/src/ward-patients/awaiting-admission-patients.tsx +70 -52
  439. package/src/ward-patients/discharge-in-patients.tsx +102 -48
  440. package/src/ward-patients/discharge-patient-action.component.tsx +80 -0
  441. package/src/ward-patients/discharge-patients.tsx +73 -62
  442. package/src/ward-patients/ebola-awaiting-admission-patients.tsx +213 -0
  443. package/src/ward-patients/patient-cells.scss +13 -0
  444. package/src/ward-patients/patient-cells.tsx +75 -19
  445. package/src/ward-patients/table-state-components.tsx +48 -3
  446. package/src/ward-patients/unassigned-patient.scss +9 -0
  447. package/src/ward-patients/unassigned-patients.tsx +215 -0
  448. package/src/ward-patients/ward-patient.scss +121 -15
  449. package/src/ward-patients/ward-patients-slots.ts +12 -0
  450. package/src/ward-patients/ward-patients-table.test.tsx +65 -17
  451. package/src/ward-patients/ward-patients-table.tsx +90 -23
  452. package/src/ward-view/_ward-theme.scss +16 -0
  453. package/src/ward-view/default-ward/default-ward-view.component.tsx +40 -8
  454. package/src/ward-view/linelist-wards/Filters.tsx +27 -13
  455. package/src/ward-view/linelist-wards/Header.tsx +28 -14
  456. package/src/ward-view/linelist-wards/Metrics.tsx +52 -11
  457. package/src/ward-view/linelist-wards/linelist-wards.scss +169 -17
  458. package/src/ward-view/materal-ward/ward-switch.scss +66 -0
  459. package/src/ward-view/ward-switch.modal.tsx +74 -35
  460. package/src/ward-view/ward-view-content-wrapper.tsx +46 -18
  461. package/src/ward-view/ward-view-ui.store.ts +53 -0
  462. package/src/ward-view/ward-view.resource.ts +5 -5
  463. package/src/ward-view/ward-view.scss +96 -8
  464. package/src/ward-workspace/admission-request-workspace/admission-requests-workspace.test.tsx +3 -1
  465. package/src/ward-workspace/admit-patient-button.component.tsx +24 -2
  466. package/src/ward-workspace/admit-patient-button.test.tsx +131 -0
  467. package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.test.tsx +34 -0
  468. package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.workspace.tsx +7 -187
  469. package/src/ward-workspace/admit-patient-form-workspace/facility-bed-capacity-notification.component.tsx +41 -0
  470. package/src/ward-workspace/admit-patient-form-workspace/patient-admission.resources.ts +0 -49
  471. package/src/ward-workspace/create-admission-encounter/create-admission-encounter.test.tsx +3 -1
  472. package/src/ward-workspace/kenya-emr-patient-discharge/patient-discharge.resource.tsx +25 -23
  473. package/src/ward-workspace/kenya-emr-patient-discharge/patient-discharge.workspace.tsx +24 -10
  474. package/translations/am.json +7 -1
  475. package/translations/en.json +158 -25
  476. package/translations/fr.json +103 -26
  477. package/translations/sw.json +7 -1
  478. package/dist/1084.js +0 -1
  479. package/dist/1084.js.map +0 -1
  480. package/dist/1189.js +0 -1
  481. package/dist/1189.js.map +0 -1
  482. package/dist/12.js +0 -17
  483. package/dist/12.js.map +0 -1
  484. package/dist/126.js +0 -1
  485. package/dist/1308.js +0 -1
  486. package/dist/1308.js.map +0 -1
  487. package/dist/1374.js +0 -1
  488. package/dist/1374.js.map +0 -1
  489. package/dist/1387.js +0 -1
  490. package/dist/1387.js.map +0 -1
  491. package/dist/15.js +0 -1
  492. package/dist/1564.js +0 -1
  493. package/dist/1567.js +0 -1
  494. package/dist/1567.js.map +0 -1
  495. package/dist/1739.js +0 -1
  496. package/dist/1739.js.map +0 -1
  497. package/dist/1845.js +0 -1
  498. package/dist/1972.js +0 -1
  499. package/dist/1972.js.map +0 -1
  500. package/dist/2016.js +0 -1
  501. package/dist/2016.js.map +0 -1
  502. package/dist/2089.js +0 -1
  503. package/dist/2089.js.map +0 -1
  504. package/dist/2117.js +0 -1
  505. package/dist/2117.js.map +0 -1
  506. package/dist/215.js +0 -1
  507. package/dist/2178.js +0 -1
  508. package/dist/239.js +0 -1
  509. package/dist/239.js.map +0 -1
  510. package/dist/2486.js +0 -1
  511. package/dist/2486.js.map +0 -1
  512. package/dist/2512.js +0 -1
  513. package/dist/2512.js.map +0 -1
  514. package/dist/2566.js +0 -1
  515. package/dist/2710.js +0 -1
  516. package/dist/2710.js.map +0 -1
  517. package/dist/2759.js +0 -1
  518. package/dist/2823.js +0 -15
  519. package/dist/2823.js.map +0 -1
  520. package/dist/3089.js +0 -1
  521. package/dist/3089.js.map +0 -1
  522. package/dist/3230.js +0 -1
  523. package/dist/3261.js +0 -1
  524. package/dist/3261.js.map +0 -1
  525. package/dist/3321.js +0 -1
  526. package/dist/3321.js.map +0 -1
  527. package/dist/3350.js +0 -1
  528. package/dist/3399.js +0 -1
  529. package/dist/3399.js.map +0 -1
  530. package/dist/3441.js +0 -1
  531. package/dist/3547.js +0 -1
  532. package/dist/3547.js.map +0 -1
  533. package/dist/3548.js +0 -1
  534. package/dist/3548.js.map +0 -1
  535. package/dist/3565.js +0 -1
  536. package/dist/3571.js +0 -1
  537. package/dist/3571.js.map +0 -1
  538. package/dist/364.js +0 -1
  539. package/dist/364.js.map +0 -1
  540. package/dist/3746.js +0 -1
  541. package/dist/3925.js +0 -1
  542. package/dist/3946.js +0 -1
  543. package/dist/400.js +0 -1
  544. package/dist/400.js.map +0 -1
  545. package/dist/401.js +0 -1
  546. package/dist/401.js.map +0 -1
  547. package/dist/4206.js +0 -1
  548. package/dist/4206.js.map +0 -1
  549. package/dist/4480.js +0 -1
  550. package/dist/4480.js.map +0 -1
  551. package/dist/4635.js +0 -1
  552. package/dist/4635.js.map +0 -1
  553. package/dist/4684.js +0 -1
  554. package/dist/4684.js.map +0 -1
  555. package/dist/4735.js +0 -1
  556. package/dist/4735.js.map +0 -1
  557. package/dist/4744.js +0 -1
  558. package/dist/4744.js.map +0 -1
  559. package/dist/4894.js +0 -1
  560. package/dist/4970.js +0 -1
  561. package/dist/4970.js.map +0 -1
  562. package/dist/5069.js +0 -1
  563. package/dist/5069.js.map +0 -1
  564. package/dist/5090.js +0 -1
  565. package/dist/5090.js.map +0 -1
  566. package/dist/5130.js +0 -1
  567. package/dist/5187.js +0 -1
  568. package/dist/5411.js +0 -1
  569. package/dist/5411.js.map +0 -1
  570. package/dist/5441.js +0 -1
  571. package/dist/5441.js.map +0 -1
  572. package/dist/5463.js +0 -1
  573. package/dist/5463.js.map +0 -1
  574. package/dist/5491.js +0 -1
  575. package/dist/5491.js.map +0 -1
  576. package/dist/5496.js +0 -1
  577. package/dist/5496.js.map +0 -1
  578. package/dist/5595.js +0 -1
  579. package/dist/5659.js +0 -1
  580. package/dist/5659.js.map +0 -1
  581. package/dist/5706.js +0 -1
  582. package/dist/5706.js.map +0 -1
  583. package/dist/5930.js +0 -1
  584. package/dist/5930.js.map +0 -1
  585. package/dist/5961.js +0 -1
  586. package/dist/6061.js +0 -1
  587. package/dist/6061.js.map +0 -1
  588. package/dist/6133.js +0 -1
  589. package/dist/6180.js +0 -1
  590. package/dist/6180.js.map +0 -1
  591. package/dist/6296.js +0 -1
  592. package/dist/6296.js.map +0 -1
  593. package/dist/6322.js +0 -1
  594. package/dist/6322.js.map +0 -1
  595. package/dist/6455.js +0 -1
  596. package/dist/6455.js.map +0 -1
  597. package/dist/6456.js +0 -1
  598. package/dist/6466.js +0 -1
  599. package/dist/6613.js +0 -1
  600. package/dist/6783.js +0 -1
  601. package/dist/6925.js +0 -1
  602. package/dist/6925.js.map +0 -1
  603. package/dist/7091.js +0 -1
  604. package/dist/7091.js.map +0 -1
  605. package/dist/7263.js +0 -1
  606. package/dist/7263.js.map +0 -1
  607. package/dist/7348.js +0 -1
  608. package/dist/7431.js +0 -1
  609. package/dist/7431.js.map +0 -1
  610. package/dist/7543.js +0 -1
  611. package/dist/7607.js +0 -1
  612. package/dist/772.js +0 -1
  613. package/dist/775.js +0 -1
  614. package/dist/775.js.map +0 -1
  615. package/dist/7783.js +0 -1
  616. package/dist/7783.js.map +0 -1
  617. package/dist/7844.js +0 -1
  618. package/dist/7844.js.map +0 -1
  619. package/dist/7965.js +0 -1
  620. package/dist/7965.js.map +0 -1
  621. package/dist/8171.js +0 -1
  622. package/dist/8171.js.map +0 -1
  623. package/dist/8488.js +0 -1
  624. package/dist/8488.js.map +0 -1
  625. package/dist/8660.js +0 -1
  626. package/dist/8660.js.map +0 -1
  627. package/dist/8727.js +0 -1
  628. package/dist/8736.js +0 -1
  629. package/dist/8736.js.map +0 -1
  630. package/dist/8847.js +0 -1
  631. package/dist/9009.js +0 -1
  632. package/dist/9009.js.map +0 -1
  633. package/dist/9015.js +0 -1
  634. package/dist/906.js +0 -1
  635. package/dist/9065.js +0 -1
  636. package/dist/9182.js +0 -1
  637. package/dist/9314.js +0 -1
  638. package/dist/9314.js.map +0 -1
  639. package/dist/9339.js +0 -1
  640. package/dist/9361.js +0 -1
  641. package/dist/9361.js.map +0 -1
  642. package/dist/9453.js +0 -1
  643. package/dist/9535.js +0 -22
  644. package/dist/9535.js.map +0 -1
  645. package/dist/9610.js +0 -1
  646. package/dist/9610.js.map +0 -1
  647. package/dist/9668.js +0 -1
  648. package/dist/9668.js.map +0 -1
  649. package/dist/9727.js +0 -1
  650. package/dist/9727.js.map +0 -1
  651. package/dist/9734.js +0 -1
  652. package/dist/9734.js.map +0 -1
  653. package/dist/9833.js +0 -1
  654. package/dist/9833.js.map +0 -1
  655. package/dist/9848.js +0 -1
  656. package/dist/9848.js.map +0 -1
  657. package/dist/9876.js +0 -1
  658. package/dist/9876.js.map +0 -1
  659. package/dist/9920.js +0 -1
  660. package/dist/9938.js +0 -1
  661. package/dist/main.js +0 -5
  662. package/dist/main.js.map +0 -1
@@ -0,0 +1,101 @@
1
+ import useSWR from 'swr';
2
+ import { openmrsFetch, restBaseUrl, type Visit } from '@openmrs/esm-framework';
3
+
4
+ export interface VitalItem {
5
+ value: number | string | null;
6
+ unit: string;
7
+ interpretation: { system: string; code: string; display: string } | null;
8
+ }
9
+
10
+ export interface VisitSummary {
11
+ visitUuid: string;
12
+ visitDate: string;
13
+ visitStopDate: string;
14
+ visitType: string;
15
+ location: string;
16
+ vitals: {
17
+ weight: VitalItem;
18
+ height: VitalItem;
19
+ temperature: VitalItem;
20
+ pulse: VitalItem;
21
+ bpSystolic: VitalItem;
22
+ bpDiastolic: VitalItem;
23
+ bloodPressure: VitalItem;
24
+ respiratoryRate: VitalItem;
25
+ oxygenSaturation: VitalItem;
26
+ muac: VitalItem;
27
+ };
28
+ complaints: Array<{ duration: string; complaint: string; onsetStatus: string }>;
29
+ conditions: Array<{ name: string; onsetDate: string; status: string }>;
30
+ allergies: Array<{ allergen: string; allergenType: string; severity: string; reactions: string[] }>;
31
+ diagnoses: Array<{ diagnosis: string; certainty: string; rank: number; date: string }>;
32
+ medications: Array<{
33
+ drug: string;
34
+ dose: string;
35
+ frequency: string;
36
+ duration: string;
37
+ route: string;
38
+ dateActivated: string;
39
+ autoExpireDate: string;
40
+ }>;
41
+ clinicalNotes: Array<{ encounterType: string; date: string; note: string }>;
42
+ procedures: Array<{
43
+ procedure: string;
44
+ procedureUuid: string;
45
+ orderNumber: string;
46
+ action: string;
47
+ urgency: string;
48
+ status: string;
49
+ orderedDate: string;
50
+ instructions: string;
51
+ orderer: string;
52
+ procedureReport: string;
53
+ results: unknown[];
54
+ }>;
55
+ imaging: Array<{
56
+ procedure: string;
57
+ procedureUuid: string;
58
+ orderNumber: string;
59
+ action: string;
60
+ urgency: string;
61
+ status: string;
62
+ orderedDate: string;
63
+ instructions: string;
64
+ orderer: string;
65
+ procedureReport: string;
66
+ impression?: string;
67
+ results: unknown[];
68
+ }>;
69
+ labResults: Array<{
70
+ panel: string | null;
71
+ panelUuid: string | null;
72
+ isPanel: boolean;
73
+ results: Array<{
74
+ test: string;
75
+ testUuid: string;
76
+ value: string;
77
+ date: string;
78
+ units: string;
79
+ lowNormal: number | null;
80
+ hiNormal: number | null;
81
+ lowCritical: number | null;
82
+ hiCritical: number | null;
83
+ interpretation: { system: string; code: string; display: string } | null;
84
+ }>;
85
+ }>;
86
+ }
87
+
88
+ export function useVisitSummary(visitUuid: string) {
89
+ const url = visitUuid ? `/ws/rest/v1/kenyaemr/visitSummary?visitUuid=${visitUuid}` : null;
90
+ const { data, error, isLoading } = useSWR<{ data: VisitSummary }>(url, openmrsFetch);
91
+ return { summary: data?.data, error, isLoading };
92
+ }
93
+
94
+ export function usePatientVisits(patientUuid: string) {
95
+ const url = patientUuid ? `${restBaseUrl}/visit?patient=${patientUuid}&v=default&includeInactive=true` : null;
96
+ const { data, error, isLoading } = useSWR<{ data: { results: Array<Visit> } }>(url, openmrsFetch);
97
+ const visits = (data?.data?.results ?? []).sort(
98
+ (a, b) => new Date(b.startDatetime).getTime() - new Date(a.startDatetime).getTime(),
99
+ );
100
+ return { visits, error, isLoading };
101
+ }
@@ -0,0 +1,94 @@
1
+ import { useConfig } from '@openmrs/esm-framework';
2
+ import { useMemo } from 'react';
3
+
4
+ import type { WardConfigObject } from '../config-schema';
5
+ import useWardLocation from '../hooks/useWardLocation';
6
+ import { useAdmissionLocationTags } from '../in-patient/in-patient.resource';
7
+
8
+ export type CriticalCareWardKind = 'icu' | 'hdu' | 'nicu' | 'picu';
9
+
10
+ export type CriticalCareWardTab = {
11
+ kind: CriticalCareWardKind;
12
+ label: string;
13
+ };
14
+
15
+ const KIND_PRIORITY: CriticalCareWardKind[] = ['nicu', 'picu', 'icu', 'hdu'];
16
+
17
+ const KIND_LABELS: Record<CriticalCareWardKind, string> = {
18
+ icu: 'ICU',
19
+ hdu: 'HDU',
20
+ nicu: 'NICU',
21
+ picu: 'PICU',
22
+ };
23
+
24
+ /**
25
+ * When the selected admissions ward is ICU / HDU / NICU / PICU, returns the tab
26
+ * label to show next to Discharged. Labour and other wards return null.
27
+ */
28
+ export function useCriticalCareWardTab(): {
29
+ tab: CriticalCareWardTab | null;
30
+ locationUuid?: string;
31
+ isLoading: boolean;
32
+ } {
33
+ const { inpatientLocationTags } = useConfig<WardConfigObject>();
34
+ const { location, isLoadingLocation } = useWardLocation();
35
+ const { tags, isLoading: isLoadingTags } = useAdmissionLocationTags(location?.uuid);
36
+
37
+ const tab = useMemo(() => {
38
+ if (!location?.uuid || !tags.length) {
39
+ return null;
40
+ }
41
+
42
+ const configured: Record<CriticalCareWardKind, string | undefined> = {
43
+ icu: inpatientLocationTags?.icuWard,
44
+ hdu: inpatientLocationTags?.hduWard,
45
+ nicu: inpatientLocationTags?.nicuWard,
46
+ picu: inpatientLocationTags?.picuWard,
47
+ };
48
+
49
+ const present = new Set(tags.map((tag) => tag.uuid?.toLowerCase()).filter(Boolean));
50
+
51
+ for (const kind of KIND_PRIORITY) {
52
+ const uuid = configured[kind]?.toLowerCase();
53
+ if (uuid && present.has(uuid)) {
54
+ return { kind, label: KIND_LABELS[kind] };
55
+ }
56
+ }
57
+
58
+ // Fallback: match display/name when tag UUIDs are missing on the location payload.
59
+ const display = tags
60
+ .map((tag) => `${tag.name || ''} ${tag.display || ''}`)
61
+ .join(' ')
62
+ .toLowerCase();
63
+ const locationDisplay = `${location.display || ''}`.toLowerCase();
64
+ const haystack = `${display} ${locationDisplay}`;
65
+
66
+ for (const kind of KIND_PRIORITY) {
67
+ if (kind === 'nicu' && (/\bnicu\b/.test(haystack) || haystack.includes('neonatal'))) {
68
+ return { kind, label: KIND_LABELS[kind] };
69
+ }
70
+ if (
71
+ kind === 'picu' &&
72
+ (/\bpicu\b/.test(haystack) ||
73
+ haystack.includes('paediatric intensive') ||
74
+ haystack.includes('pediatric intensive'))
75
+ ) {
76
+ return { kind, label: KIND_LABELS[kind] };
77
+ }
78
+ if (kind === 'hdu' && (/\bhdu\b/.test(haystack) || haystack.includes('high dependency'))) {
79
+ return { kind, label: KIND_LABELS[kind] };
80
+ }
81
+ if (kind === 'icu' && (/\bicu\b/.test(haystack) || haystack.includes('intensive care'))) {
82
+ return { kind, label: KIND_LABELS[kind] };
83
+ }
84
+ }
85
+
86
+ return null;
87
+ }, [inpatientLocationTags, location?.display, location?.uuid, tags]);
88
+
89
+ return {
90
+ tab,
91
+ locationUuid: location?.uuid,
92
+ isLoading: isLoadingLocation || isLoadingTags,
93
+ };
94
+ }
@@ -0,0 +1,24 @@
1
+ import { excludeAdmittedIsolationSuspects, type EbolaIsolationSuspect } from './useEbolaIsolationSuspects';
2
+
3
+ const suspect = (uuid: string): EbolaIsolationSuspect =>
4
+ ({
5
+ patient: { uuid },
6
+ visit: { uuid: `visit-${uuid}` },
7
+ dispositionType: 'ADMIT',
8
+ }) as EbolaIsolationSuspect;
9
+
10
+ describe('excludeAdmittedIsolationSuspects', () => {
11
+ it('keeps suspects who are not yet in a bed or unassigned', () => {
12
+ const queued = excludeAdmittedIsolationSuspects(
13
+ [suspect('a'), suspect('b'), suspect('c')],
14
+ ['b'],
15
+ [{ patient: { uuid: 'c' } }],
16
+ );
17
+
18
+ expect(queued.map((row) => row.patient.uuid)).toEqual(['a']);
19
+ });
20
+
21
+ it('returns an empty list when every suspect is already admitted', () => {
22
+ expect(excludeAdmittedIsolationSuspects([suspect('a')], ['a'], [])).toEqual([]);
23
+ });
24
+ });
@@ -0,0 +1,51 @@
1
+ import { openmrsFetch, restBaseUrl, type Patient, type Visit } from '@openmrs/esm-framework';
2
+ import useSWR from 'swr';
3
+
4
+ export type EbolaIsolationSuspect = {
5
+ patient: Patient;
6
+ visit: Visit;
7
+ dispositionType: 'ADMIT';
8
+ dateQueued?: string;
9
+ };
10
+
11
+ type SuspectsResponse = { results?: Array<EbolaIsolationSuspect> };
12
+
13
+ export function excludeAdmittedIsolationSuspects(
14
+ suspects: EbolaIsolationSuspect[],
15
+ admittedPatientUuids?: Iterable<string> | null,
16
+ unassignedAdmissions?: Array<{ patient?: { uuid?: string } }> | null,
17
+ ): EbolaIsolationSuspect[] {
18
+ const admitted = new Set<string>(admittedPatientUuids ?? []);
19
+ for (const admission of unassignedAdmissions ?? []) {
20
+ if (admission?.patient?.uuid) {
21
+ admitted.add(admission.patient.uuid);
22
+ }
23
+ }
24
+ return suspects.filter((row) => Boolean(row?.patient?.uuid) && !admitted.has(row.patient.uuid));
25
+ }
26
+
27
+ export function useEbolaIsolationSuspects(enabled: boolean) {
28
+ const url = enabled ? `${restBaseUrl}/kenyaemr/ebola-isolation-suspects` : null;
29
+ const { data, error, isLoading, mutate } = useSWR<SuspectsResponse>(url, async (requestUrl: string) => {
30
+ const response = await openmrsFetch(requestUrl);
31
+ return response.data;
32
+ });
33
+
34
+ return {
35
+ suspects: data?.results ?? [],
36
+ error,
37
+ isLoading,
38
+ mutate,
39
+ };
40
+ }
41
+
42
+ export function createIsolationAdmissionRequest(patientUuid: string, visitUuid: string, locationUuid?: string) {
43
+ const params = new URLSearchParams({ patientUuid, visitUuid });
44
+ if (locationUuid) {
45
+ params.set('locationUuid', locationUuid);
46
+ }
47
+ return openmrsFetch(`${restBaseUrl}/kenyaemr/ebola-isolation-admission-request?${params.toString()}`, {
48
+ method: 'POST',
49
+ headers: { 'Content-Type': 'application/json' },
50
+ });
51
+ }
@@ -0,0 +1,32 @@
1
+ import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
+ import useSWRImmutable from 'swr/immutable';
3
+
4
+ export interface FacilityRegistryBedOccupancy {
5
+ totalBeds?: number;
6
+ normalBeds?: number;
7
+ icuBeds?: number;
8
+ hduBeds?: number;
9
+ dialysisBeds?: number;
10
+ numberOfCots?: number;
11
+ }
12
+
13
+ export interface FacilityRegistryResponse {
14
+ fr_code?: string;
15
+ official_name?: string;
16
+ keph_level?: string;
17
+ bed_occupancy?: FacilityRegistryBedOccupancy;
18
+ last_synced_at?: string;
19
+ last_sync_status?: string;
20
+ }
21
+
22
+ export function useFacilityRegistry() {
23
+ const url = `${restBaseUrl}/virtualclaims/facility-registry`;
24
+ const { data, error, isLoading } = useSWRImmutable<FetchResponse<FacilityRegistryResponse>>(url, openmrsFetch);
25
+
26
+ return {
27
+ facility: data?.data,
28
+ bedOccupancy: data?.data?.bed_occupancy,
29
+ isLoading,
30
+ error,
31
+ };
32
+ }
@@ -106,8 +106,11 @@ export const useIpdDischargeEncounter = () => {
106
106
  return (data ?? []).map((entry) => {
107
107
  const { name, openmrsId } = parseDisplayText(entry.subject.display);
108
108
  const patientUuid = entry.subject.reference.split('/').at(-1);
109
+ // In OpenMRS FHIR, an encounter's `partOf` references its visit.
110
+ const visitUuid = entry.partOf?.reference?.split('/').at(-1);
109
111
  return {
110
112
  uuid: entry?.id,
113
+ visitUuid,
111
114
  patient: { uuid: patientUuid, openmrsId, name },
112
115
  encounterDateTime: entry.period?.start,
113
116
  };
@@ -0,0 +1,51 @@
1
+ import { useConfig } from '@openmrs/esm-framework';
2
+ import { useMemo } from 'react';
3
+
4
+ import type { WardConfigObject } from '../config-schema';
5
+ import { useAdmissionLocationTags } from '../in-patient/in-patient.resource';
6
+ import useWardLocation from './useWardLocation';
7
+
8
+ export const isIsolationLocation = (
9
+ locationUuid: string | undefined,
10
+ tags: Array<{ uuid: string }>,
11
+ isolationUuid?: string,
12
+ ) => {
13
+ if (!locationUuid || !isolationUuid) {
14
+ return false;
15
+ }
16
+ return locationUuid === isolationUuid || tags.some((tag) => tag.uuid === isolationUuid);
17
+ };
18
+
19
+ /**
20
+ * True when the selected admissions location has the configured isolation ward tag UUID.
21
+ */
22
+ export function useIsIsolationWard(overrideLocation?: string) {
23
+ const { inpatientLocationTags } = useConfig<WardConfigObject>();
24
+ const { location, isLoadingLocation } = useWardLocation(overrideLocation);
25
+ const { tags, isLoading: isLoadingTags } = useAdmissionLocationTags(location?.uuid);
26
+ const isolationUuid = inpatientLocationTags?.isolationWard;
27
+
28
+ const isIsolationWard = useMemo(
29
+ () => isIsolationLocation(location?.uuid, tags, isolationUuid),
30
+ [isolationUuid, location?.uuid, tags],
31
+ );
32
+
33
+ return {
34
+ isIsolationWard,
35
+ isolationUuid,
36
+ location,
37
+ isLoading: isLoadingLocation || isLoadingTags,
38
+ };
39
+ }
40
+
41
+ export function useIsIsolationAdmission(locationUuid?: string) {
42
+ const { inpatientLocationTags } = useConfig<WardConfigObject>();
43
+ const { tags, isLoading } = useAdmissionLocationTags(locationUuid);
44
+ const isolationUuid = inpatientLocationTags?.isolationWard;
45
+
46
+ return {
47
+ isIsolationAdmission: isIsolationLocation(locationUuid, tags, isolationUuid),
48
+ hasAdmissionLocation: Boolean(locationUuid),
49
+ isLoading,
50
+ };
51
+ }
@@ -0,0 +1,72 @@
1
+ import { openmrsFetch, restBaseUrl, useConfig, type FetchResponse } from '@openmrs/esm-framework';
2
+ import { useMemo } from 'react';
3
+ import useSWRImmutable from 'swr/immutable';
4
+ import { type Location } from '@openmrs/esm-emr-api';
5
+
6
+ import { type WardConfigObject } from '../config-schema';
7
+ import { criticalCareWardDisplay } from './critical-care-ward.utils';
8
+ import { useLocationsByTag } from './useAdmissionLocation';
9
+
10
+ const LOCATION_REP = 'custom:(uuid,display,name,tags:(uuid,display,name))';
11
+
12
+ function useLocationsForConfiguredWard(uuid: string | undefined, label: 'NICU' | 'PICU') {
13
+ const byUuidUrl = uuid ? `${restBaseUrl}/location/${uuid}?v=${LOCATION_REP}` : null;
14
+ const byTagUrl = uuid ? `${restBaseUrl}/location?tag=${encodeURIComponent(uuid)}&v=${LOCATION_REP}` : null;
15
+ const byUuid = useSWRImmutable<FetchResponse<Location>>(byUuidUrl, openmrsFetch);
16
+ const byTag = useSWRImmutable<FetchResponse<{ results: Array<Location> }>>(byTagUrl, openmrsFetch);
17
+
18
+ const locations = useMemo(() => {
19
+ const fromTag = byTag.data?.data?.results ?? [];
20
+ const direct = byUuid.data?.data?.uuid ? [byUuid.data.data] : [];
21
+ const merged = new Map<string, Location>();
22
+ for (const location of [...fromTag, ...direct]) {
23
+ if (!location?.uuid) {
24
+ continue;
25
+ }
26
+ const display = criticalCareWardDisplay(location.display || location.name, label);
27
+ const key = `${location.uuid}:${display}`;
28
+ if (!merged.has(key)) {
29
+ merged.set(key, { ...location, display });
30
+ }
31
+ }
32
+ return [...merged.values()];
33
+ }, [byTag.data, byUuid.data, label]);
34
+
35
+ return {
36
+ locations,
37
+ isLoading: Boolean(uuid) && ((byUuidUrl && byUuid.isLoading) || (byTagUrl && byTag.isLoading)),
38
+ };
39
+ }
40
+
41
+ /**
42
+ * Admission wards plus NICU and PICU.
43
+ * NICU/PICU are included even when those locations are not tagged "Admission Location".
44
+ */
45
+ export function useSelectableWards() {
46
+ const { inpatientLocationTags } = useConfig<WardConfigObject>();
47
+ const admission = useLocationsByTag('Admission Location');
48
+ const nicu = useLocationsForConfiguredWard(inpatientLocationTags?.nicuWard, 'NICU');
49
+ const picu = useLocationsForConfiguredWard(inpatientLocationTags?.picuWard, 'PICU');
50
+
51
+ const locations = useMemo(() => {
52
+ const seen = new Set<string>();
53
+ const items: Array<Location> = [];
54
+ for (const location of [...(admission.locations ?? []), ...nicu.locations, ...picu.locations]) {
55
+ const key = `${location.uuid}:${location.display}`;
56
+ if (!location.uuid || seen.has(key)) {
57
+ continue;
58
+ }
59
+ seen.add(key);
60
+ items.push(location);
61
+ }
62
+ return items;
63
+ }, [admission.locations, nicu.locations, picu.locations]);
64
+
65
+ return {
66
+ locations,
67
+ nicuLocations: nicu.locations,
68
+ picuLocations: picu.locations,
69
+ isLoading: admission.isLoading || nicu.isLoading || picu.isLoading,
70
+ error: admission.error,
71
+ };
72
+ }
@@ -2,7 +2,9 @@ import { type OpenmrsResource, restBaseUrl, useConfig, useOpenmrsFetchAll } from
2
2
  import { useMemo } from 'react';
3
3
  import type { WardConfigObject } from '../config-schema';
4
4
  import type { AdmissionLocationFetchResponse } from '../types';
5
+ import { excludeAdmittedIsolationSuspects, useEbolaIsolationSuspects } from './useEbolaIsolationSuspects';
5
6
  import { useIpdDischargeEncounter } from './useIpdDischargeEncounter';
7
+ import { useIsIsolationWard } from './useIsIsolationWard';
6
8
  import { useWardPatientGrouping } from './useWardPatientGrouping';
7
9
 
8
10
  export const useWardsSummaryMetrics = () => {
@@ -91,10 +93,18 @@ export const useWardSummaryMetrics = () => {
91
93
  });
92
94
  return { admittedPatients, dischargeInPatients };
93
95
  }, [wardPatientGroupDetails, config]);
94
- const awaitingAdmissionPatient = useMemo(
95
- () => wardPatientGroupDetails.inpatientRequestResponse?.inpatientRequests?.length ?? 0,
96
- [wardPatientGroupDetails],
97
- );
96
+ const { isIsolationWard } = useIsIsolationWard();
97
+ const { suspects } = useEbolaIsolationSuspects(isIsolationWard);
98
+ const awaitingAdmissionPatient = useMemo(() => {
99
+ if (isIsolationWard) {
100
+ return excludeAdmittedIsolationSuspects(
101
+ suspects,
102
+ wardPatientGroupDetails?.wardAdmittedPatientsWithBed?.keys(),
103
+ wardPatientGroupDetails?.wardUnassignedPatientsList,
104
+ ).length;
105
+ }
106
+ return wardPatientGroupDetails.inpatientRequestResponse?.inpatientRequests?.length ?? 0;
107
+ }, [isIsolationWard, suspects, wardPatientGroupDetails]);
98
108
  return {
99
109
  dischargedPatients,
100
110
  admittedPatients,
@@ -2,8 +2,8 @@ import { useMemo } from 'react';
2
2
  import { createAndGetWardPatientGrouping } from '../ward-view/ward-view.resource';
3
3
  import { useAdmissionLocation } from './useAdmissionLocation';
4
4
  import { useInpatientAdmission } from './useInpatientAdmission';
5
- import { useInpatientRequest } from './useInpatientRequest';
6
5
  import { useInpatientAdmissionByPatients } from './useInpatientAdmissionByPatients';
6
+ import { useInpatientRequest } from './useInpatientRequest';
7
7
  import useWardLocation from './useWardLocation';
8
8
 
9
9
  export function useWardPatientGrouping(overrideLocation?: string) {
@@ -24,8 +24,8 @@ export function useWardPatientGrouping(overrideLocation?: string) {
24
24
  if (admissionLocation && inpatientAdmissions && inpatientRequests) {
25
25
  const _patientsNotInCurrentWard = new Set<string>();
26
26
 
27
- for (const bedLayout of admissionLocation.bedLayouts) {
28
- for (const bedPatient of bedLayout.patients) {
27
+ for (const bedLayout of admissionLocation.bedLayouts ?? []) {
28
+ for (const bedPatient of bedLayout.patients ?? []) {
29
29
  _patientsNotInCurrentWard.add(bedPatient.uuid);
30
30
  }
31
31
  }
@@ -36,7 +36,7 @@ export function useWardPatientGrouping(overrideLocation?: string) {
36
36
  }
37
37
 
38
38
  for (const admission of inpatientAdmissions) {
39
- _patientsNotInCurrentWard.delete(admission.patient.uuid);
39
+ _patientsNotInCurrentWard.delete(admission?.patient?.uuid);
40
40
  }
41
41
 
42
42
  return _patientsNotInCurrentWard;
@@ -25,7 +25,7 @@ import { useTranslation } from 'react-i18next';
25
25
 
26
26
  import type { WardConfigObject } from '../config-schema';
27
27
  import useCurrentPatientAdmissionEncounter from '../hooks/useCurrentPatientAdmissionEncounter';
28
- import { usePatientChartStore } from '@openmrs/esm-patient-common-lib/src';
28
+ import { usePatientChartStore } from '@openmrs/esm-patient-common-lib';
29
29
  import { useAdmissionRequest } from './in-patient.resource';
30
30
 
31
31
  type AdmissionRequestProps = {
@@ -0,0 +1,15 @@
1
+ import React, { type FC } from 'react';
2
+ import BloodTransfusionChart from './components/blood-transfusion-chart.component';
3
+
4
+ type BloodTransfusionDashboardProps = {
5
+ patientUuid: string;
6
+ };
7
+
8
+ const BloodTransfusionDashboard: FC<BloodTransfusionDashboardProps> = ({ patientUuid }) => {
9
+ if (!patientUuid) {
10
+ return null;
11
+ }
12
+ return <BloodTransfusionChart patientUuid={patientUuid} />;
13
+ };
14
+
15
+ export default BloodTransfusionDashboard;