@kenyaemr/esm-express-workflow-app 5.4.4-pre.43 → 5.4.4-pre.430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -7
- package/dist/1084.js +1 -0
- package/dist/1084.js.map +1 -0
- package/dist/1278.js +1 -0
- package/dist/1278.js.map +1 -0
- package/dist/1324.js +1 -0
- package/dist/1324.js.map +1 -0
- package/dist/1375.js +66 -0
- package/dist/1375.js.map +1 -0
- package/dist/1402.js +1 -0
- package/dist/1402.js.map +1 -0
- package/dist/1442.js +1 -0
- package/dist/1442.js.map +1 -0
- package/dist/1520.js +1 -0
- package/dist/1520.js.map +1 -0
- package/dist/1559.js +1 -0
- package/dist/1559.js.map +1 -0
- package/dist/1593.js +1 -0
- package/dist/1593.js.map +1 -0
- package/dist/162.js +1 -0
- package/dist/162.js.map +1 -0
- package/dist/1620.js +1 -0
- package/dist/1620.js.map +1 -0
- package/dist/1658.js +1 -0
- package/dist/1658.js.map +1 -0
- package/dist/1659.js +1 -0
- package/dist/1659.js.map +1 -0
- package/dist/1789.js +1 -0
- package/dist/1789.js.map +1 -0
- package/dist/1827.js +1 -0
- package/dist/1827.js.map +1 -0
- package/dist/1831.js +1 -0
- package/dist/1831.js.map +1 -0
- package/dist/1854.js +1 -0
- package/dist/1854.js.map +1 -0
- package/dist/196.js +1 -0
- package/dist/196.js.map +1 -0
- package/dist/2127.js +1 -0
- package/dist/2127.js.map +1 -0
- package/dist/2152.js +1 -0
- package/dist/2152.js.map +1 -0
- package/dist/2202.js +1 -0
- package/dist/2202.js.map +1 -0
- package/dist/221.js +1 -0
- package/dist/221.js.map +1 -0
- package/dist/2269.js +1 -0
- package/dist/2269.js.map +1 -0
- package/dist/2293.js +1 -0
- package/dist/2293.js.map +1 -0
- package/dist/234.js +1 -0
- package/dist/234.js.map +1 -0
- package/dist/2412.js +1 -1
- package/dist/2412.js.map +1 -1
- package/dist/2466.js +1 -0
- package/dist/2466.js.map +1 -0
- package/dist/2534.js +1 -1
- package/dist/2534.js.map +1 -1
- package/dist/2553.js +1 -0
- package/dist/2553.js.map +1 -0
- package/dist/2556.js +1 -0
- package/dist/2556.js.map +1 -0
- package/dist/2648.js +1 -0
- package/dist/2648.js.map +1 -0
- package/dist/274.js +1 -0
- package/dist/274.js.map +1 -0
- package/dist/2788.js +1 -0
- package/dist/2788.js.map +1 -0
- package/dist/2842.js +1 -0
- package/dist/2842.js.map +1 -0
- package/dist/2874.js +1 -0
- package/dist/2874.js.map +1 -0
- package/dist/2916.js +1 -0
- package/dist/2916.js.map +1 -0
- package/dist/2947.js +1 -1
- package/dist/2947.js.map +1 -1
- package/dist/3012.js +1 -0
- package/dist/3012.js.map +1 -0
- package/dist/3087.js +1 -0
- package/dist/3087.js.map +1 -0
- package/dist/3335.js +1 -0
- package/dist/3335.js.map +1 -0
- package/dist/3378.js +1 -0
- package/dist/3378.js.map +1 -0
- package/dist/3504.js +1 -0
- package/dist/3504.js.map +1 -0
- package/dist/3509.js +1 -1
- package/dist/3509.js.map +1 -1
- package/dist/356.js +1 -0
- package/dist/356.js.map +1 -0
- package/dist/3690.js +1 -0
- package/dist/3690.js.map +1 -0
- package/dist/371.js +1 -0
- package/dist/371.js.map +1 -0
- package/dist/3747.js +1 -0
- package/dist/3747.js.map +1 -0
- package/dist/3819.js +1 -0
- package/dist/3819.js.map +1 -0
- package/dist/3820.js +1 -0
- package/dist/3820.js.map +1 -0
- package/dist/3910.js +1 -0
- package/dist/3910.js.map +1 -0
- package/dist/393.js +6 -0
- package/dist/393.js.map +1 -0
- package/dist/3933.js +1 -0
- package/dist/3933.js.map +1 -0
- package/dist/3989.js +1 -0
- package/dist/3989.js.map +1 -0
- package/dist/3995.js +1 -0
- package/dist/3995.js.map +1 -0
- package/dist/4032.js +1 -0
- package/dist/4032.js.map +1 -0
- package/dist/4145.js +1 -1
- package/dist/4145.js.map +1 -1
- package/dist/4178.js +1 -1
- package/dist/4178.js.map +1 -1
- package/dist/4191.js +1 -0
- package/dist/4191.js.map +1 -0
- package/dist/4212.js +1 -0
- package/dist/4212.js.map +1 -0
- package/dist/4215.js +1 -0
- package/dist/4215.js.map +1 -0
- package/dist/4523.js +1 -0
- package/dist/4523.js.map +1 -0
- package/dist/4588.js +1 -0
- package/dist/4588.js.map +1 -0
- package/dist/4617.js +1 -0
- package/dist/4617.js.map +1 -0
- package/dist/466.js +1 -1
- package/dist/466.js.map +1 -1
- package/dist/4688.js +1 -0
- package/dist/{7288.js.map → 4688.js.map} +1 -1
- package/dist/470.js +1 -0
- package/dist/470.js.map +1 -0
- package/dist/4759.js +1 -0
- package/dist/4759.js.map +1 -0
- package/dist/4818.js +1 -1
- package/dist/4818.js.map +1 -1
- package/dist/5086.js +1 -1
- package/dist/5086.js.map +1 -1
- package/dist/5093.js +1 -0
- package/dist/5093.js.map +1 -0
- package/dist/5097.js +1 -0
- package/dist/5097.js.map +1 -0
- package/dist/510.js +1 -0
- package/dist/510.js.map +1 -0
- package/dist/5117.js +1 -0
- package/dist/5117.js.map +1 -0
- package/dist/5279.js +1 -0
- package/dist/5279.js.map +1 -0
- package/dist/5434.js +1 -0
- package/dist/5434.js.map +1 -0
- package/dist/5514.js +1 -0
- package/dist/5514.js.map +1 -0
- package/dist/5568.js +1 -0
- package/dist/5568.js.map +1 -0
- package/dist/5576.js +1 -1
- package/dist/5576.js.map +1 -1
- package/dist/5630.js +1 -0
- package/dist/5630.js.map +1 -0
- package/dist/5676.js +1 -1
- package/dist/5676.js.map +1 -1
- package/dist/5695.js +1 -0
- package/dist/5695.js.map +1 -0
- package/dist/5697.js +1 -1
- package/dist/5697.js.map +1 -1
- package/dist/5728.js +1 -0
- package/dist/5728.js.map +1 -0
- package/dist/5809.js +1 -1
- package/dist/5809.js.map +1 -1
- package/dist/585.js +1 -0
- package/dist/585.js.map +1 -0
- package/dist/5887.js +1 -0
- package/dist/5887.js.map +1 -0
- package/dist/5958.js +1 -0
- package/dist/5958.js.map +1 -0
- package/dist/5964.js +1 -0
- package/dist/5964.js.map +1 -0
- package/dist/6008.js +1 -0
- package/dist/602.js +1 -0
- package/dist/602.js.map +1 -0
- package/dist/6020.js +1 -0
- package/dist/6020.js.map +1 -0
- package/dist/6161.js +1 -0
- package/dist/6161.js.map +1 -0
- package/dist/6273.js +1 -0
- package/dist/6273.js.map +1 -0
- package/dist/6337.js +1 -0
- package/dist/6337.js.map +1 -0
- package/dist/6427.js +1 -1
- package/dist/6427.js.map +1 -1
- package/dist/6429.js +1 -0
- package/dist/6429.js.map +1 -0
- package/dist/6478.js +7 -0
- package/dist/6478.js.map +1 -0
- package/dist/6508.js +1 -0
- package/dist/6508.js.map +1 -0
- package/dist/6634.js +1 -0
- package/dist/6634.js.map +1 -0
- package/dist/6767.js +1 -0
- package/dist/6767.js.map +1 -0
- package/dist/6783.js +1 -0
- package/dist/6783.js.map +1 -0
- package/dist/6868.js +1 -1
- package/dist/6868.js.map +1 -1
- package/dist/688.js +1 -0
- package/dist/688.js.map +1 -0
- package/dist/689.js +1 -1
- package/dist/689.js.map +1 -1
- package/dist/694.js +1 -0
- package/dist/694.js.map +1 -0
- package/dist/6987.js +1 -0
- package/dist/6987.js.map +1 -0
- package/dist/7061.js +1 -0
- package/dist/7061.js.map +1 -0
- package/dist/7078.js +1 -0
- package/dist/7078.js.map +1 -0
- package/dist/710.js +1 -0
- package/dist/710.js.map +1 -0
- package/dist/7128.js +1 -0
- package/dist/7128.js.map +1 -0
- package/dist/7209.js +1 -0
- package/dist/7209.js.map +1 -0
- package/dist/7424.js +1 -0
- package/dist/7424.js.map +1 -0
- package/dist/770.js +1 -0
- package/dist/770.js.map +1 -0
- package/dist/7707.js +1 -0
- package/dist/7707.js.map +1 -0
- package/dist/7784.js +1 -0
- package/dist/7784.js.map +1 -0
- package/dist/781.js +1 -1
- package/dist/781.js.map +1 -1
- package/dist/7824.js +1 -0
- package/dist/7824.js.map +1 -0
- package/dist/7832.js +1 -0
- package/dist/7832.js.map +1 -0
- package/dist/8178.js +1 -0
- package/dist/8178.js.map +1 -0
- package/dist/820.js +1 -0
- package/dist/820.js.map +1 -0
- package/dist/8224.js +1 -0
- package/dist/8224.js.map +1 -0
- package/dist/8225.js +1 -0
- package/dist/8225.js.map +1 -0
- package/dist/8240.js +1 -1
- package/dist/8240.js.map +1 -1
- package/dist/8258.js +1 -0
- package/dist/8258.js.map +1 -0
- package/dist/8702.js +1 -0
- package/dist/8702.js.map +1 -0
- package/dist/8725.js +1 -0
- package/dist/8725.js.map +1 -0
- package/dist/8762.js +1 -0
- package/dist/8762.js.map +1 -0
- package/dist/8763.js +1 -0
- package/dist/8763.js.map +1 -0
- package/dist/8815.js +1 -0
- package/dist/8815.js.map +1 -0
- package/dist/8882.js +1 -0
- package/dist/8882.js.map +1 -0
- package/dist/8924.js +1 -1
- package/dist/8924.js.map +1 -1
- package/dist/8937.js +1 -0
- package/dist/8937.js.map +1 -0
- package/dist/9.js +1 -1
- package/dist/9.js.map +1 -1
- package/dist/9061.js +1 -0
- package/dist/9061.js.map +1 -0
- package/dist/9087.js +1 -0
- package/dist/9087.js.map +1 -0
- package/dist/9301.js +1 -0
- package/dist/9301.js.map +1 -0
- package/dist/9324.js +1 -0
- package/dist/9324.js.map +1 -0
- package/dist/9497.js +1 -0
- package/dist/9497.js.map +1 -0
- package/dist/9520.js +1 -1
- package/dist/9520.js.map +1 -1
- package/dist/9526.js +1 -0
- package/dist/9526.js.map +1 -0
- package/dist/9621.js +1 -0
- package/dist/9621.js.map +1 -0
- package/dist/9676.js +17 -0
- package/dist/9676.js.map +1 -0
- package/dist/977.js +1 -0
- package/dist/977.js.map +1 -0
- package/dist/9771.js +1 -0
- package/dist/9771.js.map +1 -0
- package/dist/9806.js +1 -0
- package/dist/9806.js.map +1 -0
- package/dist/989.js +1 -0
- package/dist/989.js.map +1 -0
- package/dist/kenyaemr-esm-express-workflow-app.js +6 -5
- package/dist/kenyaemr-esm-express-workflow-app.js.buildmanifest.json +1407 -809
- package/dist/kenyaemr-esm-express-workflow-app.js.map +1 -1
- package/dist/main.js +22 -5
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +4 -6
- package/src/components/admissions/admissions-dashboard.component.tsx +2 -2
- package/src/components/anaesthetic/anaesthetic-dashboard.meta.ts +8 -0
- package/src/components/anaesthetic/anaesthetic-data-form.component.tsx +442 -0
- package/src/components/anaesthetic/anaesthetic-data-form.scss +278 -0
- package/src/components/anaesthetic/anaesthetic-link.component.tsx +21 -0
- package/src/components/anaesthetic/anaesthetic.component.tsx +618 -0
- package/src/components/anaesthetic/anaesthetic.resource.ts +1503 -0
- package/src/components/anaesthetic/anaesthetic.scss +1885 -0
- package/src/components/anaesthetic/forms/anaesthetic-form.component.tsx +304 -0
- package/src/components/anaesthetic/forms/anaesthetic-record-form.component.tsx +707 -0
- package/src/components/anaesthetic/forms/icd11-diagnosis-search.component.tsx +178 -0
- package/src/components/anaesthetic/forms/icd11-diagnosis-search.scss +126 -0
- package/src/components/anaesthetic/forms/index.ts +2 -0
- package/src/components/anaesthetic/forms/interoperative-record-drug-given-form.component.tsx +231 -0
- package/src/components/anaesthetic/forms/post-operative-summary-form.component.tsx +171 -0
- package/src/components/anaesthetic/forms/time-picker-dropdown.component.tsx +202 -0
- package/src/components/anaesthetic/forms/time-picker-dropdown.scss +107 -0
- package/src/components/anaesthetic/forms/time-picker-with-clock.component.tsx +174 -0
- package/src/components/anaesthetic/forms/time-picker-with-clock.scss +178 -0
- package/src/components/anaesthetic/forms/useAnaestheticData.ts +16 -0
- package/src/components/anaesthetic/graphs/anaesthetic-graph-wrapper.component.tsx +266 -0
- package/src/components/anaesthetic/graphs/anaesthetic-graph.component.tsx +185 -0
- package/src/components/anaesthetic/graphs/index.ts +2 -0
- package/src/components/anaesthetic/graphs/interoperative-record-drug-given-graph-wrapper.component.tsx +197 -0
- package/src/components/anaesthetic/graphs/interoperative-record-drug-given-graph.component.tsx +93 -0
- package/src/components/anaesthetic/resources/anaesthetic-amniotic-fluid.resource.ts +277 -0
- package/src/components/anaesthetic/resources/anaesthetic-form.resource.ts +716 -0
- package/src/components/anaesthetic/resources/anaesthetic.resource.ts +378 -0
- package/src/components/anaesthetic/types/index.ts +1349 -0
- package/src/components/consultation/clinical-encounter/clinical-encounter.component.tsx +4 -20
- package/src/components/consultation/clinical-encounter/encounter-details.component.tsx +9 -9
- package/src/components/consultation/clinical-encounter/encounter-details.test.tsx +19 -18
- package/src/components/consultation/consultation.utils.tsx +1 -1
- package/src/components/consultation/dashboard.component.tsx +0 -2
- package/src/components/consultation/index.ts +1 -1
- package/src/components/consultation/tabs/index.ts +67 -0
- package/src/components/facility-dashboard/components/header/home-header.component.tsx +8 -13
- package/src/components/laboratory/index.ts +11 -0
- package/src/components/laboratory/lab-table.component.tsx +46 -12
- package/src/components/laboratory/laboratory-tabs.component.tsx +3 -17
- package/src/components/mch/dashboard.component.tsx +0 -2
- package/src/components/mch/mch.component.tsx +1 -3
- package/src/components/pharmacy/index.ts +1 -1
- package/src/components/pharmacy/orders/pharmacy-orders.component.tsx +44 -6
- package/src/components/pharmacy/orders/pharmacy-orders.test.tsx +8 -7
- package/src/components/pharmacy/pharmacy-tabs.component.tsx +4 -20
- package/src/components/pharmacy/tabs/index.ts +21 -0
- package/src/components/preauth/index.ts +22 -0
- package/src/components/preauth/preauth-dashboard.component.tsx +20 -0
- package/src/components/procedures/index.ts +16 -0
- package/src/components/procedures/procedure-queues/index.ts +13 -0
- package/src/components/procedures/procedure-queues/procedure-form-extras.component.tsx +33 -0
- package/src/components/procedures/procedure-queues/procedure-form-extras.scss +5 -0
- package/src/components/procedures/procedure-queues/procedure-queues.component.tsx +35 -0
- package/src/components/procedures/procedure-queues/procedure-queues.resources.ts +37 -0
- package/src/components/procedures/procedure-queues/procedure-room-tabs.component.tsx +80 -0
- package/src/components/procedures/procedure-queues/procedure-rooms.scss +13 -0
- package/src/components/procedures/procedure-queues/queue-procedure-tabs.component.tsx +34 -0
- package/src/components/procedures/procedure-queues/summary-cards.component.tsx +81 -0
- package/src/components/procedures/procedure-queues/summary-cards.scss +35 -0
- package/src/components/procedures/procedures-table.component.tsx +77 -19
- package/src/components/procedures/procedures-tabs.component.test.tsx +57 -0
- package/src/components/procedures/procedures-tabs.component.tsx +3 -18
- package/src/components/radiology-and-imaging/index.ts +11 -0
- package/src/components/radiology-and-imaging/radiology-and-imaging-table.component.tsx +73 -21
- package/src/components/radiology-and-imaging/radiology-and-imaging.component.tsx +3 -19
- package/src/components/registration/card/HIE-card/hie-card.component.tsx +32 -44
- package/src/components/registration/card/Local-card/local-card.component.tsx +22 -24
- package/src/components/registration/checkin-form-extra/checkin-form-extra.extension.tsx +8 -2
- package/src/components/registration/checkin-form-extra/queue-fields.component.tsx +18 -19
- package/src/components/registration/dependants/dependants.component.tsx +37 -60
- package/src/components/registration/dependants/dependants.resource.ts +75 -46
- package/src/components/registration/end-visit-modal/end-visit-dialog.modal.tsx +320 -0
- package/src/components/registration/end-visit-modal/end-visit-dialog.scss +12 -0
- package/src/components/registration/end-visit-modal/end-visit.resource.tsx +59 -0
- package/src/components/registration/end-visit-modal/sha-end-visit.resource.ts +285 -0
- package/src/components/registration/search-bar/search-bar.resource.ts +32 -93
- package/src/components/registration/start-visit-form/hooks/useDefaultFacilityLocation.tsx +15 -0
- package/src/components/registration/start-visit-form/hooks/useDefaultVisitLocation.tsx +24 -0
- package/src/components/registration/start-visit-form/hooks/useOfflineVisitType.tsx +18 -0
- package/src/components/registration/start-visit-form/hooks/useRecommendedVisitTypes.tsx +36 -0
- package/src/components/registration/start-visit-form/hooks/useVisitAttributeType.tsx +102 -0
- package/src/components/registration/start-visit-form/overflow-menu-extension/custom-end-active-visit.extension.tsx +44 -0
- package/src/components/registration/start-visit-form/overflow-menu-extension/overflow-menu-item.extension.tsx +67 -0
- package/src/components/registration/start-visit-form/overflow-menu-extension/overflow-menu-item.scss +3 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/base-visit-type.component.tsx +126 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/base-visit-type.scss +75 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/exported-visit-form.workspace.tsx +778 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/location-selector.component.tsx +86 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/recommended-visit-type.component.tsx +32 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-attribute-type.component.tsx +257 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-attribute-type.scss +5 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-date-time.component.tsx +193 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-form.resource.ts +390 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-form.scss +144 -0
- package/src/components/registration/start-visit-form/visit-form-workspace/visit-form.workspace.tsx +48 -0
- package/src/components/registration/type/index.ts +101 -0
- package/src/components/reports/index.ts +1 -0
- package/src/components/triage/dashboard.component.tsx +0 -2
- package/src/config-schema.ts +476 -0
- package/src/hooks/useOrders.tsx +2 -2
- package/src/hooks/useServiceQueues.tsx +1 -1
- package/src/index.ts +81 -15
- package/src/routes.json +298 -32
- package/src/shared/dashboard-link/dashboard-link.component.tsx +11 -8
- package/src/shared/orders/OrderTable.scss +7 -0
- package/src/shared/orders/OrderTable.tsx +68 -8
- package/src/shared/orders/print-order/print-order.component.tsx +158 -0
- package/src/shared/orders/print-order/print-order.scss +225 -0
- package/src/shared/orders/print-prescription/print-prescription.component.tsx +65 -0
- package/src/shared/orders/print-prescription/print-prescription.resource.ts +45 -0
- package/src/shared/orders/print-prescription/print-prescription.scss +25 -0
- package/src/shared/otp-verification/index.ts +112 -29
- package/src/shared/otp-verification/otp-verification.modal.tsx +1110 -122
- package/src/shared/otp-verification/otp-verification.scss +374 -0
- package/src/shared/patient-chart/patient-summary-dashboard/patient-summary-dashboard.component.tsx +5 -84
- package/src/shared/pin-put/pinput.component.test.tsx +7 -6
- package/src/shared/tabs/create-tab-extension.tsx +33 -0
- package/src/shared/tabs/extension-tabs.component.tsx +51 -33
- package/src/shared/utils/index.ts +140 -5
- package/src/types/index.ts +12 -0
- package/translations/am.json +443 -131
- package/translations/en.json +327 -15
- package/translations/fr.json +372 -63
- package/translations/sw.json +347 -35
- package/tsconfig.json +1 -0
- package/dist/1049.js +0 -1
- package/dist/1049.js.map +0 -1
- package/dist/1072.js +0 -1
- package/dist/1072.js.map +0 -1
- package/dist/1091.js +0 -1
- package/dist/1091.js.map +0 -1
- package/dist/1172.js +0 -1
- package/dist/1172.js.map +0 -1
- package/dist/132.js +0 -1
- package/dist/132.js.map +0 -1
- package/dist/1354.js +0 -1
- package/dist/1354.js.map +0 -1
- package/dist/1704.js +0 -1
- package/dist/1704.js.map +0 -1
- package/dist/1729.js +0 -17
- package/dist/1729.js.map +0 -1
- package/dist/1757.js +0 -1
- package/dist/1757.js.map +0 -1
- package/dist/1761.js +0 -1
- package/dist/1761.js.map +0 -1
- package/dist/1809.js +0 -7
- package/dist/1809.js.map +0 -1
- package/dist/1842.js +0 -1
- package/dist/1874.js +0 -1
- package/dist/1874.js.map +0 -1
- package/dist/1962.js +0 -1
- package/dist/1962.js.map +0 -1
- package/dist/2007.js +0 -1
- package/dist/2007.js.map +0 -1
- package/dist/2024.js +0 -1
- package/dist/2024.js.map +0 -1
- package/dist/2045.js +0 -1
- package/dist/2045.js.map +0 -1
- package/dist/2163.js +0 -1
- package/dist/2163.js.map +0 -1
- package/dist/2191.js +0 -1
- package/dist/2191.js.map +0 -1
- package/dist/2267.js +0 -1
- package/dist/2267.js.map +0 -1
- package/dist/231.js +0 -1
- package/dist/231.js.map +0 -1
- package/dist/236.js +0 -1
- package/dist/236.js.map +0 -1
- package/dist/2367.js +0 -1
- package/dist/2367.js.map +0 -1
- package/dist/2463.js +0 -1
- package/dist/2463.js.map +0 -1
- package/dist/2561.js +0 -1
- package/dist/2561.js.map +0 -1
- package/dist/2810.js +0 -2
- package/dist/2810.js.map +0 -1
- package/dist/2867.js +0 -1
- package/dist/2867.js.map +0 -1
- package/dist/2909.js +0 -1
- package/dist/2909.js.map +0 -1
- package/dist/2949.js +0 -1
- package/dist/2949.js.map +0 -1
- package/dist/3040.js +0 -1
- package/dist/3119.js +0 -1
- package/dist/3119.js.map +0 -1
- package/dist/3215.js +0 -1
- package/dist/3215.js.map +0 -1
- package/dist/322.js +0 -1
- package/dist/322.js.map +0 -1
- package/dist/3228.js +0 -1
- package/dist/3228.js.map +0 -1
- package/dist/330.js +0 -1
- package/dist/330.js.map +0 -1
- package/dist/3472.js +0 -1
- package/dist/3472.js.map +0 -1
- package/dist/351.js +0 -1
- package/dist/351.js.map +0 -1
- package/dist/3576.js +0 -1
- package/dist/3576.js.map +0 -1
- package/dist/397.js +0 -1
- package/dist/397.js.map +0 -1
- package/dist/4007.js +0 -66
- package/dist/4007.js.map +0 -1
- package/dist/4200.js +0 -1
- package/dist/4200.js.map +0 -1
- package/dist/4224.js +0 -1
- package/dist/4224.js.map +0 -1
- package/dist/43.js +0 -1
- package/dist/43.js.map +0 -1
- package/dist/4308.js +0 -1
- package/dist/4308.js.map +0 -1
- package/dist/4399.js +0 -1
- package/dist/4399.js.map +0 -1
- package/dist/4505.js +0 -1
- package/dist/4505.js.map +0 -1
- package/dist/4724.js +0 -1
- package/dist/4724.js.map +0 -1
- package/dist/498.js +0 -1
- package/dist/498.js.map +0 -1
- package/dist/509.js +0 -1
- package/dist/509.js.map +0 -1
- package/dist/5096.js +0 -1
- package/dist/5096.js.map +0 -1
- package/dist/5159.js +0 -13
- package/dist/5159.js.map +0 -1
- package/dist/5184.js +0 -1
- package/dist/5184.js.map +0 -1
- package/dist/5270.js +0 -1
- package/dist/5270.js.map +0 -1
- package/dist/5361.js +0 -1
- package/dist/5361.js.map +0 -1
- package/dist/5537.js +0 -1
- package/dist/5537.js.map +0 -1
- package/dist/566.js +0 -1
- package/dist/566.js.map +0 -1
- package/dist/5733.js +0 -1
- package/dist/5733.js.map +0 -1
- package/dist/5854.js +0 -1
- package/dist/5854.js.map +0 -1
- package/dist/5882.js +0 -1
- package/dist/6004.js +0 -1
- package/dist/6004.js.map +0 -1
- package/dist/6121.js +0 -3
- package/dist/6121.js.map +0 -1
- package/dist/6137.js +0 -1
- package/dist/6137.js.map +0 -1
- package/dist/6356.js +0 -1
- package/dist/6356.js.map +0 -1
- package/dist/6571.js +0 -1
- package/dist/6571.js.map +0 -1
- package/dist/6721.js +0 -1
- package/dist/6721.js.map +0 -1
- package/dist/6858.js +0 -1
- package/dist/6858.js.map +0 -1
- package/dist/6925.js +0 -1
- package/dist/6925.js.map +0 -1
- package/dist/6960.js +0 -1
- package/dist/6960.js.map +0 -1
- package/dist/7085.js +0 -1
- package/dist/7085.js.map +0 -1
- package/dist/7127.js +0 -1
- package/dist/7176.js +0 -1
- package/dist/7176.js.map +0 -1
- package/dist/7237.js +0 -1
- package/dist/7237.js.map +0 -1
- package/dist/725.js +0 -1
- package/dist/725.js.map +0 -1
- package/dist/7288.js +0 -1
- package/dist/7329.js +0 -1
- package/dist/7329.js.map +0 -1
- package/dist/7334.js +0 -1
- package/dist/7334.js.map +0 -1
- package/dist/7461.js +0 -1
- package/dist/7461.js.map +0 -1
- package/dist/7517.js +0 -1
- package/dist/7517.js.map +0 -1
- package/dist/7837.js +0 -1
- package/dist/7837.js.map +0 -1
- package/dist/8103.js +0 -1
- package/dist/8103.js.map +0 -1
- package/dist/8110.js +0 -1
- package/dist/8110.js.map +0 -1
- package/dist/8179.js +0 -6
- package/dist/8179.js.map +0 -1
- package/dist/8189.js +0 -1
- package/dist/8189.js.map +0 -1
- package/dist/8209.js +0 -1
- package/dist/8209.js.map +0 -1
- package/dist/8249.js +0 -1
- package/dist/8249.js.map +0 -1
- package/dist/8285.js +0 -1
- package/dist/8285.js.map +0 -1
- package/dist/8470.js +0 -1
- package/dist/8470.js.map +0 -1
- package/dist/8502.js +0 -1
- package/dist/8502.js.map +0 -1
- package/dist/866.js +0 -1
- package/dist/866.js.map +0 -1
- package/dist/8889.js +0 -11
- package/dist/8889.js.map +0 -1
- package/dist/8990.js +0 -1
- package/dist/8990.js.map +0 -1
- package/dist/8994.js +0 -1
- package/dist/8994.js.map +0 -1
- package/dist/9049.js +0 -1
- package/dist/9049.js.map +0 -1
- package/dist/9054.js +0 -1
- package/dist/9054.js.map +0 -1
- package/dist/916.js +0 -1
- package/dist/9231.js +0 -1
- package/dist/9231.js.map +0 -1
- package/dist/9408.js +0 -1
- package/dist/9408.js.map +0 -1
- package/dist/9425.js +0 -1
- package/dist/9466.js +0 -1
- package/dist/9466.js.map +0 -1
- package/dist/9919.js +0 -1
- package/dist/9919.js.map +0 -1
- package/dist/9931.js +0 -1
- package/dist/9931.js.map +0 -1
- package/jest.config.js +0 -3
- package/src/shared/orders/OrdersTabs.tsx +0 -58
- package/src/shared/patient-chart/patient-chart.component.tsx +0 -61
- package/src/shared/patient-chart/patient-chart.resources.ts +0 -180
- package/src/shared/patient-chart/patient-chart.scss +0 -15
- package/src/shared/patient-chart/useInitialize.ts +0 -24
- /package/src/shared/{patient-chart/patient-summary-dashboard → tabs}/patient-summary-dashboard.scss +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
export type UseCervixDataResult = ReturnType<typeof useCervixData>;
|
|
2
|
+
import { openmrsFetch, restBaseUrl, toOmrsIsoString } from '@openmrs/esm-framework';
|
|
3
|
+
import useSWR from 'swr';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
export { MCH_PARTOGRAPHY_ENCOUNTER_UUID } from '../types';
|
|
6
|
+
import { CERVIX_FORM_CONCEPTS, MCH_PARTOGRAPHY_ENCOUNTER_UUID, DESCENT_OF_HEAD_OPTIONS } from '../types';
|
|
7
|
+
import { ENCOUNTER_ROLE } from '../../../config-schema';
|
|
8
|
+
import type { TFunction } from 'i18next';
|
|
9
|
+
import { require } from 'ace-builds';
|
|
10
|
+
|
|
11
|
+
export interface CervixFormData {
|
|
12
|
+
hour: string;
|
|
13
|
+
time: string;
|
|
14
|
+
cervicalDilation: string;
|
|
15
|
+
descent: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface CervixObservation {
|
|
19
|
+
uuid: string;
|
|
20
|
+
concept: {
|
|
21
|
+
uuid: string;
|
|
22
|
+
display: string;
|
|
23
|
+
};
|
|
24
|
+
value: number | string;
|
|
25
|
+
obsDatetime: string;
|
|
26
|
+
display: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CervixEncounter {
|
|
30
|
+
uuid: string;
|
|
31
|
+
encounterDatetime: string;
|
|
32
|
+
obs: CervixObservation[];
|
|
33
|
+
encounterType: {
|
|
34
|
+
uuid: string;
|
|
35
|
+
display: string;
|
|
36
|
+
};
|
|
37
|
+
patient: {
|
|
38
|
+
uuid: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SaveCervixDataResponse {
|
|
43
|
+
success: boolean;
|
|
44
|
+
message: string;
|
|
45
|
+
encounter?: CervixEncounter;
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
export async function saveCervixFormData(
|
|
49
|
+
patientUuid: string,
|
|
50
|
+
formData: CervixFormData,
|
|
51
|
+
t: TFunction,
|
|
52
|
+
providerUuid?: string,
|
|
53
|
+
locationUuid?: string,
|
|
54
|
+
): Promise<SaveCervixDataResponse> {
|
|
55
|
+
try {
|
|
56
|
+
const observations = buildCervixObservations(formData);
|
|
57
|
+
const missingFields = [];
|
|
58
|
+
if (!formData.hour || isNaN(parseFloat(formData.hour))) {
|
|
59
|
+
missingFields.push(t('Hour'));
|
|
60
|
+
}
|
|
61
|
+
if (!formData.time || formData.time.trim() === '') {
|
|
62
|
+
missingFields.push(t('Time'));
|
|
63
|
+
}
|
|
64
|
+
if (!formData.cervicalDilation || isNaN(parseFloat(formData.cervicalDilation))) {
|
|
65
|
+
missingFields.push(t('Cervical Dilation'));
|
|
66
|
+
}
|
|
67
|
+
if (!formData.descent || isNaN(parseFloat(formData.descent))) {
|
|
68
|
+
missingFields.push(t('Descent of Head'));
|
|
69
|
+
}
|
|
70
|
+
if (missingFields.length > 0) {
|
|
71
|
+
return {
|
|
72
|
+
success: false,
|
|
73
|
+
message: t(`Missing or invalid fields: ${missingFields.join(', ')}`),
|
|
74
|
+
error: 'INVALID_FIELDS',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const session = await getCurrentSession();
|
|
78
|
+
const finalProviderUuid = providerUuid || session?.currentProvider?.uuid;
|
|
79
|
+
const finalLocationUuid = locationUuid || session?.sessionLocation?.uuid;
|
|
80
|
+
if (!finalProviderUuid) {
|
|
81
|
+
return { success: false, message: t('Provider information is required'), error: 'NO_PROVIDER' };
|
|
82
|
+
}
|
|
83
|
+
if (!finalLocationUuid) {
|
|
84
|
+
return { success: false, message: t('Location information is required'), error: 'NO_LOCATION' };
|
|
85
|
+
}
|
|
86
|
+
const now = new Date();
|
|
87
|
+
now.setMinutes(now.getMinutes() - 3);
|
|
88
|
+
const encounterPayload = {
|
|
89
|
+
patient: patientUuid,
|
|
90
|
+
encounterType: MCH_PARTOGRAPHY_ENCOUNTER_UUID,
|
|
91
|
+
location: finalLocationUuid,
|
|
92
|
+
encounterDatetime: toOmrsIsoString(now),
|
|
93
|
+
obs: observations,
|
|
94
|
+
encounterProviders: [
|
|
95
|
+
{
|
|
96
|
+
provider: finalProviderUuid,
|
|
97
|
+
encounterRole: ENCOUNTER_ROLE,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
const response = await openmrsFetch(`${restBaseUrl}/encounter`, {
|
|
102
|
+
method: 'POST',
|
|
103
|
+
headers: { 'Content-Type': 'application/json' },
|
|
104
|
+
body: JSON.stringify(encounterPayload),
|
|
105
|
+
});
|
|
106
|
+
if (!response.ok) {
|
|
107
|
+
const errorText = await response.text();
|
|
108
|
+
let errorMessage = t(`Failed to save cervix data: ${response.status} ${response.statusText}`);
|
|
109
|
+
try {
|
|
110
|
+
const errorData = JSON.parse(errorText);
|
|
111
|
+
if (errorData.error?.message) {
|
|
112
|
+
errorMessage = t(`Failed to save cervix data: ${errorData.error.message}`);
|
|
113
|
+
}
|
|
114
|
+
} catch (e) {}
|
|
115
|
+
return { success: false, message: errorMessage, error: 'SAVE_FAILED' };
|
|
116
|
+
}
|
|
117
|
+
const encounter = await response.json();
|
|
118
|
+
return { success: true, message: t('Cervix data saved successfully'), encounter };
|
|
119
|
+
} catch (error) {
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
message: t(`Failed to save cervix data: ${error instanceof Error ? error.message : t('Unknown error')}`),
|
|
123
|
+
error: 'EXCEPTION',
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function buildCervixObservations(formData: CervixFormData): any[] {
|
|
129
|
+
const observations = [];
|
|
130
|
+
const obsDatetime = toOmrsIsoString(new Date());
|
|
131
|
+
// Save hour as a number (not string)
|
|
132
|
+
if (formData.hour && formData.hour !== '') {
|
|
133
|
+
const hourValue = parseFloat(formData.hour);
|
|
134
|
+
if (!isNaN(hourValue)) {
|
|
135
|
+
observations.push({ concept: CERVIX_FORM_CONCEPTS.hour, value: hourValue, obsDatetime });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Always save time as 'Time: HH:mm' string
|
|
139
|
+
if (formData.time && formData.time !== '') {
|
|
140
|
+
// If already prefixed, don't double-prefix
|
|
141
|
+
const timeValue = formData.time.startsWith('Time:') ? formData.time : `Time: ${formData.time}`;
|
|
142
|
+
observations.push({ concept: CERVIX_FORM_CONCEPTS.time, value: timeValue, obsDatetime });
|
|
143
|
+
}
|
|
144
|
+
if (formData.cervicalDilation && formData.cervicalDilation !== '') {
|
|
145
|
+
const dilationValue = parseFloat(formData.cervicalDilation);
|
|
146
|
+
if (!isNaN(dilationValue)) {
|
|
147
|
+
observations.push({ concept: CERVIX_FORM_CONCEPTS.cervicalDilation, value: dilationValue, obsDatetime });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (formData.descent && formData.descent !== '') {
|
|
151
|
+
const descentValue = parseFloat(formData.descent);
|
|
152
|
+
if (!isNaN(descentValue)) {
|
|
153
|
+
const matchingOption = DESCENT_OF_HEAD_OPTIONS.find((opt) => opt.stationValue === descentValue);
|
|
154
|
+
if (matchingOption && matchingOption.value) {
|
|
155
|
+
observations.push({ concept: CERVIX_FORM_CONCEPTS.descentOfHead, value: matchingOption.value, obsDatetime });
|
|
156
|
+
} else {
|
|
157
|
+
observations.push({ concept: CERVIX_FORM_CONCEPTS.descentOfHead, value: descentValue, obsDatetime });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return observations;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function getCurrentSession() {
|
|
165
|
+
try {
|
|
166
|
+
const response = await openmrsFetch(`${restBaseUrl}/session`);
|
|
167
|
+
if (response.ok) {
|
|
168
|
+
return await response.json();
|
|
169
|
+
}
|
|
170
|
+
} catch {
|
|
171
|
+
// Swallow error
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function useCervixData(patientUuid: string) {
|
|
177
|
+
// No comments, no logs
|
|
178
|
+
const encounterRepresentation =
|
|
179
|
+
'custom:(uuid,encounterDatetime,encounterType:(uuid,display),' +
|
|
180
|
+
'obs:(uuid,concept:(uuid,display),value,obsDatetime,display),' +
|
|
181
|
+
'patient:(uuid))';
|
|
182
|
+
const url = `/ws/rest/v1/encounter?patient=${patientUuid}&encounterType=${MCH_PARTOGRAPHY_ENCOUNTER_UUID}&v=${encounterRepresentation}`;
|
|
183
|
+
const { data, error, isLoading, mutate } = useSWR<{ data: { results: CervixEncounter[] } }>(
|
|
184
|
+
patientUuid ? url : null,
|
|
185
|
+
openmrsFetch,
|
|
186
|
+
);
|
|
187
|
+
const cervixData = data?.data?.results || [];
|
|
188
|
+
|
|
189
|
+
// Filter encounters to only include those with cervix-specific concepts
|
|
190
|
+
const cervixSpecificEncounters = cervixData.filter((encounter) => {
|
|
191
|
+
if (!encounter.obs || !Array.isArray(encounter.obs)) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
// An encounter is cervix-specific if it contains cervical dilation OR descent of head concepts
|
|
195
|
+
return encounter.obs.some(
|
|
196
|
+
(obs) =>
|
|
197
|
+
obs.concept?.uuid === CERVIX_FORM_CONCEPTS.cervicalDilation ||
|
|
198
|
+
obs.concept?.uuid === CERVIX_FORM_CONCEPTS.descentOfHead,
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const sortedEncounters = cervixSpecificEncounters.sort(
|
|
203
|
+
(a, b) => new Date(b.encounterDatetime).getTime() - new Date(a.encounterDatetime).getTime(),
|
|
204
|
+
);
|
|
205
|
+
const transformedData = sortedEncounters.map((encounter) => {
|
|
206
|
+
const observations = encounter.obs || [];
|
|
207
|
+
|
|
208
|
+
// Fix: extract hour and time from all obs with the same concept UUID by value prefix
|
|
209
|
+
let hourObs = observations.find(
|
|
210
|
+
(obs) =>
|
|
211
|
+
obs.concept?.uuid === CERVIX_FORM_CONCEPTS.hour &&
|
|
212
|
+
typeof obs.value === 'string' &&
|
|
213
|
+
obs.value.startsWith('Hour:'),
|
|
214
|
+
);
|
|
215
|
+
let timeObs = observations.find(
|
|
216
|
+
(obs) =>
|
|
217
|
+
obs.concept?.uuid === CERVIX_FORM_CONCEPTS.time &&
|
|
218
|
+
typeof obs.value === 'string' &&
|
|
219
|
+
obs.value.startsWith('Time:'),
|
|
220
|
+
);
|
|
221
|
+
// fallback: if not found by prefix, just get the first for each
|
|
222
|
+
if (!hourObs) {
|
|
223
|
+
hourObs = observations.find((obs) => obs.concept?.uuid === CERVIX_FORM_CONCEPTS.hour);
|
|
224
|
+
}
|
|
225
|
+
if (!timeObs) {
|
|
226
|
+
timeObs = observations.find((obs) => obs.concept?.uuid === CERVIX_FORM_CONCEPTS.time);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let cervicalDilationObs = observations.find((obs) => obs.concept?.uuid === CERVIX_FORM_CONCEPTS.cervicalDilation);
|
|
230
|
+
let descentObs = observations.find((obs) => obs.concept?.uuid === CERVIX_FORM_CONCEPTS.descentOfHead);
|
|
231
|
+
|
|
232
|
+
let hour: number | null = null;
|
|
233
|
+
if (hourObs && hourObs.value !== undefined && hourObs.value !== null) {
|
|
234
|
+
if (typeof hourObs.value === 'string') {
|
|
235
|
+
const match = hourObs.value.match(/Hour:\s*([0-9]+(?:\.[0-9]+)?)/);
|
|
236
|
+
if (match) {
|
|
237
|
+
hour = Number(match[1]);
|
|
238
|
+
} else if (/^\d{1,2}(?:\.\d+)?$/.test(hourObs.value)) {
|
|
239
|
+
hour = Number(hourObs.value);
|
|
240
|
+
}
|
|
241
|
+
} else if (typeof hourObs.value === 'number') {
|
|
242
|
+
hour = hourObs.value;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Parse time from 'Time: HH:mm' or fallback to string
|
|
247
|
+
let time = null;
|
|
248
|
+
if (timeObs && timeObs.value !== undefined && timeObs.value !== null) {
|
|
249
|
+
if (typeof timeObs.value === 'string') {
|
|
250
|
+
const match = timeObs.value.match(/Time:\s*([0-9]{2}:[0-9]{2})/);
|
|
251
|
+
if (match) {
|
|
252
|
+
time = match[1];
|
|
253
|
+
} else if (/^\d{1,2}:\d{2}$/.test(timeObs.value)) {
|
|
254
|
+
time = timeObs.value;
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
time = String(timeObs.value);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Cervical dilation
|
|
262
|
+
let cervicalDilation = null;
|
|
263
|
+
if (cervicalDilationObs && cervicalDilationObs.value !== undefined && cervicalDilationObs.value !== null) {
|
|
264
|
+
if (typeof cervicalDilationObs.value === 'string') {
|
|
265
|
+
const parsed = Number(cervicalDilationObs.value);
|
|
266
|
+
cervicalDilation = !isNaN(parsed) ? parsed : null;
|
|
267
|
+
} else if (typeof cervicalDilationObs.value === 'number') {
|
|
268
|
+
cervicalDilation = cervicalDilationObs.value;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Descent of head (existing logic)
|
|
273
|
+
let descentOfHead = null;
|
|
274
|
+
if (descentObs?.value !== undefined && descentObs?.value !== null) {
|
|
275
|
+
const val = descentObs.value;
|
|
276
|
+
if (typeof val === 'number') {
|
|
277
|
+
descentOfHead = val;
|
|
278
|
+
} else if (typeof val === 'string') {
|
|
279
|
+
const match = DESCENT_OF_HEAD_OPTIONS.find((opt) => opt.value === val || opt.conceptUuid === val);
|
|
280
|
+
if (match && typeof match.stationValue === 'number') {
|
|
281
|
+
descentOfHead = match.stationValue;
|
|
282
|
+
} else {
|
|
283
|
+
const parsed = Number(val);
|
|
284
|
+
if (!isNaN(parsed)) {
|
|
285
|
+
descentOfHead = parsed;
|
|
286
|
+
} else {
|
|
287
|
+
descentOfHead = 5;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
} else if (typeof val === 'object' && val !== null) {
|
|
291
|
+
const uuid = (val as any).uuid || (val as any).value || null;
|
|
292
|
+
if (uuid) {
|
|
293
|
+
const match = DESCENT_OF_HEAD_OPTIONS.find((opt) => opt.value === uuid || opt.conceptUuid === uuid);
|
|
294
|
+
if (match && typeof match.stationValue === 'number') {
|
|
295
|
+
descentOfHead = match.stationValue;
|
|
296
|
+
} else {
|
|
297
|
+
descentOfHead = 5;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (descentOfHead === null || isNaN(descentOfHead)) {
|
|
303
|
+
descentOfHead = 5;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Human-friendly label for descent
|
|
307
|
+
let descentLabel: string | null = null;
|
|
308
|
+
if (descentObs && descentObs.value !== undefined && descentObs.value !== null) {
|
|
309
|
+
const val = descentObs.value;
|
|
310
|
+
if (typeof val === 'string') {
|
|
311
|
+
const match = DESCENT_OF_HEAD_OPTIONS.find((opt) => opt.value === val || opt.conceptUuid === val);
|
|
312
|
+
if (match) {
|
|
313
|
+
descentLabel = match.text;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (!descentLabel && typeof descentOfHead === 'number') {
|
|
317
|
+
descentLabel = String(descentOfHead);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return {
|
|
322
|
+
uuid: encounter.uuid,
|
|
323
|
+
encounterDatetime: encounter.encounterDatetime,
|
|
324
|
+
hour,
|
|
325
|
+
time,
|
|
326
|
+
cervicalDilation,
|
|
327
|
+
descentOfHead,
|
|
328
|
+
descentLabel,
|
|
329
|
+
timeDisplay: time ? `${hour !== null ? hour : '??'}:${time}` : null,
|
|
330
|
+
};
|
|
331
|
+
});
|
|
332
|
+
const existingTimeEntries = transformedData
|
|
333
|
+
.filter((data) => data.hour !== null && data.time !== null)
|
|
334
|
+
.map((data) => ({ hour: data.hour!, time: data.time! }));
|
|
335
|
+
const existingCervixData = transformedData
|
|
336
|
+
.filter((data) => data.cervicalDilation !== null && data.descentOfHead !== null)
|
|
337
|
+
.map((data) => ({ cervicalDilation: data.cervicalDilation!, descentOfHead: data.descentOfHead! }));
|
|
338
|
+
const selectedHours = existingTimeEntries.map((entry) => entry.hour);
|
|
339
|
+
return {
|
|
340
|
+
encounters: sortedEncounters,
|
|
341
|
+
cervixData: transformedData,
|
|
342
|
+
existingTimeEntries,
|
|
343
|
+
existingCervixData,
|
|
344
|
+
selectedHours,
|
|
345
|
+
isLoading,
|
|
346
|
+
error,
|
|
347
|
+
mutate,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export async function deleteCervixEncounter(encounterUuid: string): Promise<SaveCervixDataResponse> {
|
|
352
|
+
const { t } = require('react-i18next');
|
|
353
|
+
try {
|
|
354
|
+
const response = await openmrsFetch(`${restBaseUrl}/encounter/${encounterUuid}`, {
|
|
355
|
+
method: 'DELETE',
|
|
356
|
+
headers: { 'Content-Type': 'application/json' },
|
|
357
|
+
});
|
|
358
|
+
if (!response.ok) {
|
|
359
|
+
return {
|
|
360
|
+
success: false,
|
|
361
|
+
message: t('failedToDeleteEncounter', '{{status}} {{statusText}}', {
|
|
362
|
+
status: response.status,
|
|
363
|
+
statusText: response.statusText,
|
|
364
|
+
}),
|
|
365
|
+
error: 'DELETE_FAILED',
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
return { success: true, message: t('Encounter deleted successfully') };
|
|
369
|
+
} catch (error) {
|
|
370
|
+
return {
|
|
371
|
+
success: false,
|
|
372
|
+
message: t('failedToDeleteEncounter', 'Failed to delete encounter: {{message}}', {
|
|
373
|
+
message: error instanceof Error ? error.message : t('Unknown error'),
|
|
374
|
+
}),
|
|
375
|
+
error: 'EXCEPTION',
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|