@ampath/esm-dha-workflow-app 4.0.0-claim-workflows.159
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +57 -0
- package/.husky/pre-commit +7 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/LICENSE +401 -0
- package/README.md +37 -0
- package/__mocks__/react-i18next.js +50 -0
- package/dist/1197.js +1 -0
- package/dist/1277.js +1 -0
- package/dist/1277.js.map +1 -0
- package/dist/1558.js +2 -0
- package/dist/1558.js.LICENSE.txt +14 -0
- package/dist/1558.js.map +1 -0
- package/dist/1729.js +1 -0
- package/dist/1729.js.map +1 -0
- package/dist/182.js +1 -0
- package/dist/182.js.map +1 -0
- package/dist/1826.js +1 -0
- package/dist/1826.js.map +1 -0
- package/dist/1833.js +1 -0
- package/dist/1833.js.map +1 -0
- package/dist/1856.js +1 -0
- package/dist/1856.js.map +1 -0
- package/dist/1925.js +1 -0
- package/dist/1925.js.map +1 -0
- package/dist/2021.js +1 -0
- package/dist/2021.js.map +1 -0
- package/dist/2054.js +1 -0
- package/dist/2054.js.map +1 -0
- package/dist/2177.js +2 -0
- package/dist/2177.js.LICENSE.txt +9 -0
- package/dist/2177.js.map +1 -0
- package/dist/2333.js +1 -0
- package/dist/2333.js.map +1 -0
- package/dist/2801.js +1 -0
- package/dist/2801.js.map +1 -0
- package/dist/282.js +2 -0
- package/dist/282.js.LICENSE.txt +32 -0
- package/dist/282.js.map +1 -0
- package/dist/3041.js +1 -0
- package/dist/3041.js.map +1 -0
- package/dist/3099.js +1 -0
- package/dist/3184.js +2 -0
- package/dist/3184.js.LICENSE.txt +14 -0
- package/dist/3184.js.map +1 -0
- package/dist/3654.js +1 -0
- package/dist/3654.js.map +1 -0
- package/dist/4055.js +1 -0
- package/dist/4205.js +1 -0
- package/dist/4205.js.map +1 -0
- package/dist/4225.js +1 -0
- package/dist/4225.js.map +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4353.js +1 -0
- package/dist/4353.js.map +1 -0
- package/dist/4517.js +1 -0
- package/dist/4517.js.map +1 -0
- package/dist/4652.js +1 -0
- package/dist/4674.js +1 -0
- package/dist/4674.js.map +1 -0
- package/dist/4947.js +1 -0
- package/dist/4947.js.map +1 -0
- package/dist/5015.js +1 -0
- package/dist/5015.js.map +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5428.js +1 -0
- package/dist/5428.js.map +1 -0
- package/dist/5752.js +1 -0
- package/dist/5752.js.map +1 -0
- package/dist/5851.js +1 -0
- package/dist/5851.js.map +1 -0
- package/dist/6260.js +1 -0
- package/dist/6260.js.map +1 -0
- package/dist/6264.js +1 -0
- package/dist/6264.js.map +1 -0
- package/dist/6540.js +2 -0
- package/dist/6540.js.LICENSE.txt +9 -0
- package/dist/6540.js.map +1 -0
- package/dist/6606.js +1 -0
- package/dist/6606.js.map +1 -0
- package/dist/693.js +1 -0
- package/dist/693.js.map +1 -0
- package/dist/6991.js +1 -0
- package/dist/6991.js.map +1 -0
- package/dist/7199.js +1 -0
- package/dist/7199.js.map +1 -0
- package/dist/7255.js +1 -0
- package/dist/7255.js.map +1 -0
- package/dist/7258.js +1 -0
- package/dist/7258.js.map +1 -0
- package/dist/7420.js +1 -0
- package/dist/7420.js.map +1 -0
- package/dist/8114.js +1 -0
- package/dist/8114.js.map +1 -0
- package/dist/8321.js +1 -0
- package/dist/8321.js.map +1 -0
- package/dist/8339.js +1 -0
- package/dist/8339.js.map +1 -0
- package/dist/8558.js +1 -0
- package/dist/8558.js.map +1 -0
- package/dist/8778.js +1 -0
- package/dist/8778.js.map +1 -0
- package/dist/8803.js +2 -0
- package/dist/8803.js.LICENSE.txt +54 -0
- package/dist/8803.js.map +1 -0
- package/dist/8865.js +1 -0
- package/dist/8865.js.map +1 -0
- package/dist/8895.js +1 -0
- package/dist/8895.js.map +1 -0
- package/dist/9037.js +1 -0
- package/dist/9037.js.map +1 -0
- package/dist/9091.js +1 -0
- package/dist/9091.js.map +1 -0
- package/dist/9093.js +1 -0
- package/dist/9093.js.map +1 -0
- package/dist/9117.js +1 -0
- package/dist/9117.js.map +1 -0
- package/dist/961.js +2 -0
- package/dist/961.js.LICENSE.txt +19 -0
- package/dist/961.js.map +1 -0
- package/dist/9721.js +1 -0
- package/dist/9721.js.map +1 -0
- package/dist/esm-dha-workflow-app.js +1 -0
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +1594 -0
- package/dist/esm-dha-workflow-app.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/README.md +115 -0
- package/e2e/core/global-setup.ts +32 -0
- package/e2e/core/index.ts +1 -0
- package/e2e/core/test.ts +20 -0
- package/e2e/fixtures/api.ts +26 -0
- package/e2e/fixtures/index.ts +1 -0
- package/e2e/pages/index.ts +1 -0
- package/e2e/pages/root-page.ts +32 -0
- package/e2e/specs/template-app.spec.ts +23 -0
- package/e2e/support/github/Dockerfile +34 -0
- package/e2e/support/github/docker-compose.yml +24 -0
- package/e2e/support/github/run-e2e-docker-env.sh +37 -0
- package/example.env +6 -0
- package/jest.config.js +33 -0
- package/package.json +117 -0
- package/playwright.config.ts +32 -0
- package/prettier.config.js +8 -0
- package/src/accounting/accounting.component.tsx +13 -0
- package/src/admissions/admission-request-list/admission-request-list.scss +0 -0
- package/src/admissions/admission-request-list/admission-request-list.tsx +134 -0
- package/src/admissions/admissions-dashboard.component.scss +15 -0
- package/src/admissions/admissions-dashboard.component.tsx +160 -0
- package/src/admissions/admissions.resource.ts +101 -0
- package/src/admissions/admitted-list/admitted-patients-list.tsx +141 -0
- package/src/admissions/constants/index.ts +33 -0
- package/src/admissions/discharged-list/discharged-list.scss +0 -0
- package/src/admissions/discharged-list/discharged-list.tsx +58 -0
- package/src/admissions/inpatient/admission-history/patient-admission-history.tsx +76 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.scss +19 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.tsx +72 -0
- package/src/admissions/inpatient/inpatient-admissions.component.scss +7 -0
- package/src/admissions/inpatient/inpatient-admissions.component.tsx +46 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.scss +23 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.tsx +156 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.scss +0 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.tsx +109 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.scss +0 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.tsx +102 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.scss +11 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.tsx +105 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.scss +13 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.tsx +84 -0
- package/src/admissions/types/index.ts +192 -0
- package/src/appointments/appointments.component.tsx +13 -0
- package/src/billing/api/billing.api.ts +107 -0
- package/src/billing/billing-root.tsx +20 -0
- package/src/billing/dashboard/billingDashboard.component.scss +0 -0
- package/src/billing/dashboard/billingDashboard.component.tsx +25 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.scss +0 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.tsx +508 -0
- package/src/billing/invoice/bill.resource.ts +47 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.scss +17 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.tsx +21 -0
- package/src/billing/invoice/invoice.scss +113 -0
- package/src/billing/invoice/invoice.tsx +1441 -0
- package/src/billing/invoice/line-items/line-items.scss +0 -0
- package/src/billing/invoice/line-items/line-items.tsx +120 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.scss +23 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.tsx +114 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.scss +0 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.tsx +122 -0
- package/src/billing/invoice/payment-details/payment-details.scss +0 -0
- package/src/billing/invoice/payment-details/payment-details.tsx +43 -0
- package/src/billing/invoice/print-invoice/print-receipt.component.tsx +44 -0
- package/src/billing/invoice/print-invoice/print-receipt.scss +14 -0
- package/src/billing/types/index.ts +84 -0
- package/src/billing/utils/index.ts +17 -0
- package/src/billing/widgets/billingTotalsRow.component.scss +0 -0
- package/src/billing/widgets/billingTotalsRow.component.tsx +712 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.resource.ts +103 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.scss +58 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.workspace.tsx +357 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/schema.ts +11 -0
- package/src/bookings/bookings.component.scss +7 -0
- package/src/bookings/bookings.component.tsx +31 -0
- package/src/bookings/daily/daily-bookings.component.scss +38 -0
- package/src/bookings/daily/daily-bookings.component.tsx +138 -0
- package/src/bookings/daily/daily-bookings.resource.ts +28 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.scss +15 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.tsx +80 -0
- package/src/bookings/daily/patient-list/daily-bookings-patient-list.component.tsx +97 -0
- package/src/bookings/types/index.ts +68 -0
- package/src/claims/claims.component.tsx +142 -0
- package/src/claims/claims.resource.ts +168 -0
- package/src/claims/index.ts +206 -0
- package/src/claims/interventions.resource.ts +49 -0
- package/src/claims/utils.ts +59 -0
- package/src/config-schema.ts +215 -0
- package/src/createDashboardLink.tsx +9 -0
- package/src/dashboard/charts/chart.component.scss +13 -0
- package/src/dashboard/charts/chart.component.tsx +56 -0
- package/src/dashboard/dashboard.component.scss +7 -0
- package/src/dashboard/dashboard.component.tsx +51 -0
- package/src/dashboard/overview/overview.component.scss +150 -0
- package/src/dashboard/overview/overview.component.tsx +134 -0
- package/src/dashboard/patient-list/patient-list.component.tsx +41 -0
- package/src/dashboard-meta/accounting-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/admissions-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/billing-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/bookings-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/consultation-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/dha-workflow-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/inpatient-admissions.meta.ts +6 -0
- package/src/dashboard-meta/maternity-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/mch-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/pharmacy-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/queue-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registers-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registry-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/service-queue-admin.meta.ts +6 -0
- package/src/dashboard-meta/triage-dashboard.meta.ts +6 -0
- package/src/declarations.d.ts +5 -0
- package/src/hooks/useActions.ts +165 -0
- package/src/index.ts +161 -0
- package/src/laboratory/laboratory.component.tsx +13 -0
- package/src/left-panel/left-panel.component.tsx +20 -0
- package/src/left-panel/left-panel.scss +42 -0
- package/src/mnch/maternity/maternity-queues.component.scss +7 -0
- package/src/mnch/maternity/maternity-queues.component.tsx +28 -0
- package/src/mnch/maternity/queues/triage/maternity-triage.tsx +15 -0
- package/src/mnch/mch/mch-queues.component.scss +7 -0
- package/src/mnch/mch/mch-queues.component.tsx +32 -0
- package/src/mnch/mch/queues/consultation/mch-consultation.tsx +18 -0
- package/src/mnch/mch/queues/triage/mch-triage.tsx +15 -0
- package/src/mnch/mnch-root.tsx +17 -0
- package/src/modals/sign-off-modal.scss +7 -0
- package/src/modals/sign-off-modal.tsx +52 -0
- package/src/mortuary/mortuary.component.tsx +13 -0
- package/src/pharmacy/pharmacy.component.tsx +13 -0
- package/src/registers/registers.component.tsx +8 -0
- package/src/registry/client-details/client-details.tsx +40 -0
- package/src/registry/eligibility/eligibility-details/eligibility-details.scss +38 -0
- package/src/registry/eligibility/eligibility-details/eligibility-details.tsx +101 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.scss +6 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.tsx +120 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.scss +0 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.tsx +45 -0
- package/src/registry/modal/client-details-modal/client-details-modal.scss +28 -0
- package/src/registry/modal/client-details-modal/client-details-modal.tsx +119 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.scss +43 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +280 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +39 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +921 -0
- package/src/registry/payment-details/payment-options/payment-options.scss +13 -0
- package/src/registry/payment-details/payment-options/payment-options.tsx +68 -0
- package/src/registry/registry.component.scss +89 -0
- package/src/registry/registry.component.tsx +490 -0
- package/src/registry/registry.resource.ts +62 -0
- package/src/registry/types/index.ts +401 -0
- package/src/registry/utils/error-handler.ts +37 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-adapter.ts +56 -0
- package/src/registry/utils/hie-client-adapter.ts +312 -0
- package/src/registry/utils/mask-data.ts +32 -0
- package/src/registry/utils/phone-number-formatter.ts +11 -0
- package/src/resources/dashboard.resource.ts +20 -0
- package/src/resources/hie-amrs-automatic-registration.service.ts +16 -0
- package/src/resources/identifier-types.ts +29 -0
- package/src/resources/patient-resource.ts +62 -0
- package/src/resources/patient-search.resource.ts +22 -0
- package/src/resources/queue.resource.ts +60 -0
- package/src/resources/superset.resource.ts +21 -0
- package/src/resources/visit.resource.ts +38 -0
- package/src/root.component.tsx +48 -0
- package/src/root.scss +11 -0
- package/src/root.test.tsx +51 -0
- package/src/routes.json +292 -0
- package/src/service-queues/action-button.component.tsx +34 -0
- package/src/service-queues/action-overflow-menu-item.component.tsx +34 -0
- package/src/service-queues/admin/queue/modal/create-queue/create-queue.modal.scss +31 -0
- package/src/service-queues/admin/queue/modal/create-queue/create-queue.modal.tsx +143 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.scss +0 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.tsx +154 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.scss +33 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.tsx +113 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.scss +6 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.scss +31 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.scss +0 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.tsx +146 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.scss +22 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.tsx +120 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.scss +6 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.tsx +34 -0
- package/src/service-queues/consultation/consultation.component.scss +7 -0
- package/src/service-queues/consultation/consultation.component.tsx +15 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.scss +30 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.tsx +108 -0
- package/src/service-queues/metrics/metrics-cards/attended-patients.extension.tsx +38 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.component.tsx +86 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.scss +106 -0
- package/src/service-queues/metrics/metrics-cards/waiting-patients.extension.tsx +34 -0
- package/src/service-queues/metrics/metrics-container.component.tsx +23 -0
- package/src/service-queues/metrics/metrics-container.scss +36 -0
- package/src/service-queues/metrics/metrics.resource.ts +65 -0
- package/src/service-queues/modals/daily-report-patient-list/daily-report-patient-list.scss +26 -0
- package/src/service-queues/modals/daily-report-patient-list/daily-report-patient-list.tsx +110 -0
- package/src/service-queues/modals/move/move-patient.component.scss +35 -0
- package/src/service-queues/modals/move/move-patient.component.tsx +152 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.scss +0 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.tsx +80 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.scss +0 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.tsx +79 -0
- package/src/service-queues/modals/transition/transition-patient.component.scss +0 -0
- package/src/service-queues/modals/transition/transition-patient.component.tsx +122 -0
- package/src/service-queues/queue-list/check-in.service.ts +26 -0
- package/src/service-queues/queue-list/queue-list.component.scss +56 -0
- package/src/service-queues/queue-list/queue-list.component.tsx +311 -0
- package/src/service-queues/queue-room.component.tsx +39 -0
- package/src/service-queues/room/room.component.tsx +58 -0
- package/src/service-queues/service-queue/service-queue.component.scss +14 -0
- package/src/service-queues/service-queue/service-queue.component.tsx +387 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.scss +12 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.tsx +63 -0
- package/src/service-queues/service-queue.scss +27 -0
- package/src/service-queues/service-queue.tsx +37 -0
- package/src/service-queues/service-queues.resource.ts +361 -0
- package/src/service-queues/service.resource.ts +28 -0
- package/src/shared/constants/civil-status.ts +29 -0
- package/src/shared/constants/concepts.ts +35 -0
- package/src/shared/constants/index.ts +1 -0
- package/src/shared/constants/patient-category.ts +6 -0
- package/src/shared/constants/patient-type.ts +10 -0
- package/src/shared/constants/person-attributes.ts +33 -0
- package/src/shared/constants/visit-types.ts +7 -0
- package/src/shared/services/billing.resource.ts +38 -0
- package/src/shared/services/client-payment-mode.resource.ts +27 -0
- package/src/shared/services/client-payment.resource.ts +17 -0
- package/src/shared/services/eligibility.resource.ts +20 -0
- package/src/shared/services/encounters.resource.ts +27 -0
- package/src/shared/services/location.resource.ts +9 -0
- package/src/shared/types/index.ts +153 -0
- package/src/shared/ui/aggregate-stat-card/aggregate-stat-card.scss +42 -0
- package/src/shared/ui/aggregate-stat-card/aggregate-stat-card.tsx +42 -0
- package/src/shared/ui/confirm-modal/confirm.modal.scss +18 -0
- package/src/shared/ui/confirm-modal/confirm.modal.tsx +38 -0
- package/src/shared/ui/otp-input/otp-input.component.scss +14 -0
- package/src/shared/ui/otp-input/otp-input.component.tsx +90 -0
- package/src/shared/ui/stat-card/stat-card.component.scss +10 -0
- package/src/shared/ui/stat-card/stat-card.component.tsx +26 -0
- package/src/shared/ui/timer/timer.component.scss +5 -0
- package/src/shared/ui/timer/timer.component.tsx +40 -0
- package/src/shared/utils/get-base-url.ts +27 -0
- package/src/shared/utils/get-tag-type.ts +66 -0
- package/src/side-nav/side-menu.scss +38 -0
- package/src/side-nav-menu/mnch-nav-link-config.ts +16 -0
- package/src/side-nav-menu/mnch-nav-links.tsx +42 -0
- package/src/side-nav-menu/nav-link-config.ts +78 -0
- package/src/side-nav-menu/nav-links.tsx +42 -0
- package/src/triage/metrics/attended-patients.extension.tsx +42 -0
- package/src/triage/metrics/metrics.scss +36 -0
- package/src/triage/metrics/triage-metrics.component.tsx +21 -0
- package/src/triage/metrics/waiting-patients.extension.tsx +39 -0
- package/src/triage/room/room.scss +29 -0
- package/src/triage/triage.component.tsx +15 -0
- package/src/triage/triage.resource.ts +19 -0
- package/src/triage/types.ts +16 -0
- package/src/types/types.ts +180 -0
- package/src/widgets/workflow-registry-link.extension.tsx +12 -0
- package/tools/i18next-parser.config.js +89 -0
- package/tools/setup-tests.ts +1 -0
- package/tools/update-openmrs-deps.mjs +43 -0
- package/translations/am.json +24 -0
- package/translations/en.json +24 -0
- package/translations/es.json +24 -0
- package/translations/fr.json +24 -0
- package/translations/he.json +24 -0
- package/translations/km.json +24 -0
- package/tsconfig.json +24 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { IdentifierTypesUuids } from '../../resources/identifier-types';
|
|
2
|
+
import { CivilStatusUids } from '../../shared/constants/civil-status';
|
|
3
|
+
import { PersonAttributeTypeUuids } from '../../shared/constants/person-attributes';
|
|
4
|
+
import {
|
|
5
|
+
type AlternateContact,
|
|
6
|
+
type CreatePersonDto,
|
|
7
|
+
type HieClient,
|
|
8
|
+
type HieIdentifications,
|
|
9
|
+
HieIdentificationType,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
const clientDatailsFields = [
|
|
13
|
+
'id',
|
|
14
|
+
'other_identifications',
|
|
15
|
+
'first_name',
|
|
16
|
+
'middle_name',
|
|
17
|
+
'last_name',
|
|
18
|
+
'gender',
|
|
19
|
+
'date_of_birth',
|
|
20
|
+
'is_alive',
|
|
21
|
+
'deceased_datetime',
|
|
22
|
+
'phone',
|
|
23
|
+
'email',
|
|
24
|
+
'civil_status',
|
|
25
|
+
'place_of_birth',
|
|
26
|
+
'citizenship',
|
|
27
|
+
'country',
|
|
28
|
+
'county',
|
|
29
|
+
'sub_county',
|
|
30
|
+
'ward',
|
|
31
|
+
'village_estate',
|
|
32
|
+
'longitude',
|
|
33
|
+
'latitude',
|
|
34
|
+
'identification_type',
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const nameFields = ['first_name', 'middle_name', 'last_name'];
|
|
38
|
+
const otherPersonFields = ['gender', 'date_of_birth', 'is_alive', 'deceased_datetime'];
|
|
39
|
+
const attributeFields = ['phone', 'email', 'civil_status', 'place_of_birth', 'citizenship'];
|
|
40
|
+
const addressFields = ['country', 'county', 'sub_county', 'ward', 'village_estate', 'longitude', 'latitude'];
|
|
41
|
+
const otherFields = ['gender', 'date_of_birth'];
|
|
42
|
+
const identifierFields = [
|
|
43
|
+
HieIdentificationType.Cr,
|
|
44
|
+
HieIdentificationType.SHANumber,
|
|
45
|
+
HieIdentificationType.HouseholdNumber,
|
|
46
|
+
HieIdentificationType.RefugeeID,
|
|
47
|
+
HieIdentificationType.MandateNumber,
|
|
48
|
+
HieIdentificationType.AlienID,
|
|
49
|
+
HieIdentificationType.NationalID,
|
|
50
|
+
HieIdentificationType.TemporaryDependantID,
|
|
51
|
+
];
|
|
52
|
+
const hieAmrsSyncFields = [
|
|
53
|
+
...identifierFields,
|
|
54
|
+
...nameFields,
|
|
55
|
+
...otherPersonFields,
|
|
56
|
+
...attributeFields,
|
|
57
|
+
...addressFields,
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export function generateHieClientDetails(hieClient: HieClient) {
|
|
61
|
+
let data = {};
|
|
62
|
+
Object.keys(hieClient)
|
|
63
|
+
.filter((key) => {
|
|
64
|
+
return clientDatailsFields.includes(key);
|
|
65
|
+
})
|
|
66
|
+
.forEach((key) => {
|
|
67
|
+
if (key === 'other_identifications') {
|
|
68
|
+
const otherIds = generateOtherIdentifications(hieClient[key]);
|
|
69
|
+
data = {
|
|
70
|
+
...data,
|
|
71
|
+
...otherIds,
|
|
72
|
+
};
|
|
73
|
+
} else if (key === 'identification_type') {
|
|
74
|
+
data[hieClient['identification_type']] = hieClient.identification_number;
|
|
75
|
+
} else {
|
|
76
|
+
const value = hieClient[key];
|
|
77
|
+
data[key] = value;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return data;
|
|
81
|
+
}
|
|
82
|
+
function generateOtherIdentifications(hieIdentifications: HieIdentifications[]) {
|
|
83
|
+
const other = {};
|
|
84
|
+
hieIdentifications.forEach((id) => {
|
|
85
|
+
other[id.identification_type] = id.identification_number;
|
|
86
|
+
});
|
|
87
|
+
return other;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function generateAmrsPersonPayload(hieClient: HieClient): CreatePersonDto {
|
|
91
|
+
const createPersonPayload: CreatePersonDto = {};
|
|
92
|
+
const namesAttribute = {};
|
|
93
|
+
const addresses = {};
|
|
94
|
+
let attributes = [];
|
|
95
|
+
hieAmrsSyncFields.forEach((d) => {
|
|
96
|
+
if (d === 'first_name') {
|
|
97
|
+
namesAttribute['givenName'] = hieClient.first_name;
|
|
98
|
+
}
|
|
99
|
+
if (d === 'middle_name') {
|
|
100
|
+
namesAttribute['middleName'] = hieClient.middle_name;
|
|
101
|
+
}
|
|
102
|
+
if (d === 'last_name') {
|
|
103
|
+
namesAttribute['familyName'] = hieClient.last_name;
|
|
104
|
+
}
|
|
105
|
+
if (d === 'gender') {
|
|
106
|
+
createPersonPayload['gender'] = hieClient.gender === 'Male' ? 'M' : 'F';
|
|
107
|
+
}
|
|
108
|
+
if (d === 'date_of_birth') {
|
|
109
|
+
createPersonPayload['birthdate'] = hieClient.date_of_birth;
|
|
110
|
+
createPersonPayload['birthdateEstimated'] = false;
|
|
111
|
+
}
|
|
112
|
+
if (d === 'is_alive') {
|
|
113
|
+
createPersonPayload['dead'] = hieClient.is_alive === 0 ? true : false;
|
|
114
|
+
}
|
|
115
|
+
if (d === 'deceased_datetime') {
|
|
116
|
+
if (hieClient.deceased_datetime.length > 0) {
|
|
117
|
+
createPersonPayload['deathDate'] = hieClient.deceased_datetime;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (d === 'country' && hieClient.country.length > 0) {
|
|
121
|
+
addresses['country'] = hieClient.country;
|
|
122
|
+
addresses['address1'] = hieClient.country;
|
|
123
|
+
}
|
|
124
|
+
if (d === 'place_of_birth' && hieClient.place_of_birth.length > 0) {
|
|
125
|
+
addresses['address10'] = hieClient.place_of_birth;
|
|
126
|
+
}
|
|
127
|
+
if (d === 'county' && hieClient.county.length > 0) {
|
|
128
|
+
addresses['countyDistrict'] = hieClient.county;
|
|
129
|
+
}
|
|
130
|
+
if (d === 'sub_county' && hieClient.sub_county.length > 0) {
|
|
131
|
+
addresses['address2'] = hieClient.sub_county;
|
|
132
|
+
addresses['stateProvince'] = hieClient.sub_county;
|
|
133
|
+
}
|
|
134
|
+
if (d === 'ward' && hieClient.sub_county.length > 0) {
|
|
135
|
+
addresses['address7'] = hieClient.sub_county;
|
|
136
|
+
addresses['address4'] = hieClient.sub_county;
|
|
137
|
+
}
|
|
138
|
+
if (d === 'village_estate' && hieClient.village_estate.length > 0) {
|
|
139
|
+
addresses['cityVillage'] = hieClient.village_estate;
|
|
140
|
+
}
|
|
141
|
+
if (d === 'longitude' && hieClient.longitude.length > 0) {
|
|
142
|
+
addresses['longitude'] = hieClient.longitude;
|
|
143
|
+
}
|
|
144
|
+
if (d === 'latitude' && hieClient.latitude.length > 0) {
|
|
145
|
+
addresses['latitude'] = hieClient.latitude;
|
|
146
|
+
}
|
|
147
|
+
if (d === 'place_of_birth' && hieClient.place_of_birth.length > 0) {
|
|
148
|
+
attributes.push({
|
|
149
|
+
value: hieClient.place_of_birth,
|
|
150
|
+
attributeType: PersonAttributeTypeUuids.PLACE_OF_BIRTH_UUID,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (d === 'phone' && hieClient.phone.length > 0) {
|
|
154
|
+
attributes.push({
|
|
155
|
+
value: hieClient.phone,
|
|
156
|
+
attributeType: PersonAttributeTypeUuids.CONTACT_PHONE_NUMBER_UUID,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (d === 'email' && hieClient.email.length > 0) {
|
|
160
|
+
attributes.push({
|
|
161
|
+
value: hieClient.email,
|
|
162
|
+
attributeType: PersonAttributeTypeUuids.CONTACT_EMAIL_ADDRESS_UUID,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (d === 'civil_status' && hieClient.civil_status.length > 0) {
|
|
166
|
+
attributes.push({
|
|
167
|
+
value: getAmrsConceptUuidFromField(hieClient.civil_status),
|
|
168
|
+
attributeType: PersonAttributeTypeUuids.CIVIL_STATUS_UUID,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (d === 'id' && hieClient.id) {
|
|
172
|
+
attributes.push({
|
|
173
|
+
value: hieClient.id,
|
|
174
|
+
attributeType: PersonAttributeTypeUuids.CLIENT_REGISTRY_ID_UUID,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (d === 'citizenship' && hieClient.citizenship) {
|
|
178
|
+
attributes.push({
|
|
179
|
+
value: hieClient.citizenship,
|
|
180
|
+
attributeType: PersonAttributeTypeUuids.CITIZENSHIP_UUID,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
// Add next of kin details
|
|
185
|
+
const nextOfKinAndAlternativeAttributes = generateNextOfKinAndAlternateContactDetails(hieClient.alternative_contacts);
|
|
186
|
+
attributes = [...attributes, ...nextOfKinAndAlternativeAttributes];
|
|
187
|
+
if (Object.keys(namesAttribute).length > 0) {
|
|
188
|
+
createPersonPayload['names'] = [namesAttribute];
|
|
189
|
+
}
|
|
190
|
+
if (Object.keys(addresses).length > 0) {
|
|
191
|
+
createPersonPayload['addresses'] = [addresses];
|
|
192
|
+
}
|
|
193
|
+
if (attributes.length > 0) {
|
|
194
|
+
createPersonPayload['attributes'] = attributes;
|
|
195
|
+
}
|
|
196
|
+
return createPersonPayload;
|
|
197
|
+
}
|
|
198
|
+
function generateNextOfKinAndAlternateContactDetails(alternativeContacts: AlternateContact[]) {
|
|
199
|
+
const attributes = [];
|
|
200
|
+
const alterNativeClientContact = alternativeContacts.find((a) => {
|
|
201
|
+
return a.relationship === 'Alternative Phone Number';
|
|
202
|
+
});
|
|
203
|
+
const nextOfKinContact = alternativeContacts.find((a) => {
|
|
204
|
+
return a.remarks === 'Next Of Kin';
|
|
205
|
+
});
|
|
206
|
+
if (alterNativeClientContact) {
|
|
207
|
+
if (alterNativeClientContact.contact_type === 'Phone') {
|
|
208
|
+
attributes.push({
|
|
209
|
+
value: alterNativeClientContact.contact_id,
|
|
210
|
+
attributeType: PersonAttributeTypeUuids.ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (nextOfKinContact) {
|
|
215
|
+
if (nextOfKinContact.contact_type === 'Phone') {
|
|
216
|
+
attributes.push({
|
|
217
|
+
value: nextOfKinContact.contact_id,
|
|
218
|
+
attributeType: PersonAttributeTypeUuids.NEXT_OF_KIN_CONTACT_PHONE_NUMBER_UUID,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
attributes.push({
|
|
222
|
+
value: nextOfKinContact.relationship,
|
|
223
|
+
attributeType: PersonAttributeTypeUuids.NEXT_OF_KIN_RELATIONSHIP_UUID,
|
|
224
|
+
});
|
|
225
|
+
attributes.push({
|
|
226
|
+
value: nextOfKinContact.contact_name,
|
|
227
|
+
attributeType: PersonAttributeTypeUuids.NEXT_OF_KIN_NAME_UUID,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return attributes;
|
|
231
|
+
}
|
|
232
|
+
function getAmrsConceptUuidFromField(fieldName: string): string {
|
|
233
|
+
let conceptUuid = '';
|
|
234
|
+
switch (fieldName) {
|
|
235
|
+
case 'Divorced':
|
|
236
|
+
conceptUuid = CivilStatusUids.DIVORCED_UUID;
|
|
237
|
+
break;
|
|
238
|
+
case 'Married':
|
|
239
|
+
conceptUuid = CivilStatusUids.MARRIED_UUID;
|
|
240
|
+
break;
|
|
241
|
+
case 'Single':
|
|
242
|
+
conceptUuid = CivilStatusUids.SINGLE_UUID;
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
conceptUuid = CivilStatusUids.NOT_APPLICABLE_UUID;
|
|
246
|
+
}
|
|
247
|
+
return conceptUuid;
|
|
248
|
+
}
|
|
249
|
+
export function generateAmrsCreatePatientIdentifiersPayload(hieClient: HieClient, identifierLocation: string) {
|
|
250
|
+
const identifiers = [];
|
|
251
|
+
// add CR number
|
|
252
|
+
identifiers.push({
|
|
253
|
+
identifierType: getAmrsIdentifierTypeUuid(HieIdentificationType.Cr),
|
|
254
|
+
identifier: hieClient.id,
|
|
255
|
+
location: identifierLocation,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// add main identifier
|
|
259
|
+
identifiers.push({
|
|
260
|
+
identifierType: getAmrsIdentifierTypeUuid(hieClient.identification_type),
|
|
261
|
+
identifier: hieClient.identification_number,
|
|
262
|
+
location: identifierLocation,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// add other idenfications
|
|
266
|
+
hieClient.other_identifications.forEach((id) => {
|
|
267
|
+
identifiers.push({
|
|
268
|
+
identifierType: getAmrsIdentifierTypeUuid(id.identification_type),
|
|
269
|
+
identifier: id.identification_number,
|
|
270
|
+
location: identifierLocation,
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
return identifiers;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function getAmrsIdentifierTypeUuid(hieIdentifierName: string) {
|
|
278
|
+
let idTypeUuid;
|
|
279
|
+
switch (hieIdentifierName) {
|
|
280
|
+
case HieIdentificationType.NationalID:
|
|
281
|
+
idTypeUuid = IdentifierTypesUuids.NATIONAL_ID_UUID;
|
|
282
|
+
break;
|
|
283
|
+
case HieIdentificationType.HouseholdNumber:
|
|
284
|
+
idTypeUuid = IdentifierTypesUuids.HOUSE_HOLD_NUMBER_UUID;
|
|
285
|
+
break;
|
|
286
|
+
case HieIdentificationType.AlienID:
|
|
287
|
+
idTypeUuid = IdentifierTypesUuids.ALIEN_ID_UUID;
|
|
288
|
+
break;
|
|
289
|
+
case HieIdentificationType.SHANumber:
|
|
290
|
+
idTypeUuid = IdentifierTypesUuids.SHA_UUID;
|
|
291
|
+
break;
|
|
292
|
+
case HieIdentificationType.MandateNumber:
|
|
293
|
+
idTypeUuid = IdentifierTypesUuids.MANDATE_NUMBER_UUID;
|
|
294
|
+
break;
|
|
295
|
+
case HieIdentificationType.RefugeeID:
|
|
296
|
+
idTypeUuid = IdentifierTypesUuids.REFUGEE_ID_UUID;
|
|
297
|
+
break;
|
|
298
|
+
case HieIdentificationType.Cr:
|
|
299
|
+
idTypeUuid = IdentifierTypesUuids.CLIENT_REGISTRY_NO_UUID;
|
|
300
|
+
break;
|
|
301
|
+
case HieIdentificationType.BirthCertificate:
|
|
302
|
+
idTypeUuid = IdentifierTypesUuids.BIRTH_CERTIFICATE_NUMBER_UUID;
|
|
303
|
+
break;
|
|
304
|
+
case HieIdentificationType.TemporaryDependantID:
|
|
305
|
+
idTypeUuid = IdentifierTypesUuids.TEMPORARY_DEPENDANT_ID_UUID;
|
|
306
|
+
break;
|
|
307
|
+
case HieIdentificationType.BirthNotification:
|
|
308
|
+
idTypeUuid = IdentifierTypesUuids.BIRTH_NOTIFICATION_UUID;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
return idTypeUuid;
|
|
312
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const maskValue = (value: string): string => {
|
|
2
|
+
let arrValue = value.split('');
|
|
3
|
+
for (let i = 0; i < value.length; i++) {
|
|
4
|
+
if (i % 2 === 0) {
|
|
5
|
+
arrValue[i] = '*';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
const maskedValue = arrValue.join('');
|
|
9
|
+
return maskedValue;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const maskExceptFirstAndLast = (value: string): string => {
|
|
13
|
+
let arrValue = value.split('');
|
|
14
|
+
for (let i = 0; i < value.length; i++) {
|
|
15
|
+
if (!(i == 0 || i === value.length - 1)) {
|
|
16
|
+
arrValue[i] = '*';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const maskedValue = arrValue.join('');
|
|
20
|
+
return maskedValue;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const maskAllButFirstAndLastThree = (value: string): string => {
|
|
24
|
+
let arrValue = value.split('');
|
|
25
|
+
for (let i = 0; i < value.length; i++) {
|
|
26
|
+
if (i > 3 && i < value.length - 3) {
|
|
27
|
+
arrValue[i] = '*';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const maskedValue = arrValue.join('');
|
|
31
|
+
return maskedValue;
|
|
32
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function formatPhoneNumberForOTP(phone: string): string {
|
|
2
|
+
let cleaned = phone.replace(/[^\d+]/g, '');
|
|
3
|
+
|
|
4
|
+
if (cleaned.startsWith('+')) {
|
|
5
|
+
cleaned = cleaned.slice(1);
|
|
6
|
+
}
|
|
7
|
+
if (cleaned.startsWith('0')) {
|
|
8
|
+
cleaned = '254' + cleaned.slice(1);
|
|
9
|
+
}
|
|
10
|
+
return cleaned;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getEtlBaseUrl } from '../shared/utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
export async function getDashBoardSummary(locationUuid: string): Promise<any> {
|
|
5
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
6
|
+
const dashboardSummaryUrl = `${etlBaseUrl}/dashboard-summary`;
|
|
7
|
+
const params = {
|
|
8
|
+
locationUuid: locationUuid,
|
|
9
|
+
};
|
|
10
|
+
const queryString = new URLSearchParams(params).toString();
|
|
11
|
+
const response = await openmrsFetch(`${dashboardSummaryUrl}?${queryString}`);
|
|
12
|
+
|
|
13
|
+
if (!response.ok) {
|
|
14
|
+
const errorText = await response.text();
|
|
15
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const data = await response.json();
|
|
19
|
+
return data.data;
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Patient } from '@openmrs/esm-framework';
|
|
2
|
+
import { type HieClient } from '../registry/types';
|
|
3
|
+
import { generateAmrsPersonPayload } from '../registry/utils/hie-client-adapter';
|
|
4
|
+
import { createPatient, generatePatientIdentifiers } from './patient-resource';
|
|
5
|
+
|
|
6
|
+
export async function registerHieClientInAmrs(client: HieClient, identifierLocation: string): Promise<Patient> {
|
|
7
|
+
const createPersonPayload = generateAmrsPersonPayload(client);
|
|
8
|
+
const identifiers = await generatePatientIdentifiers(identifierLocation, client);
|
|
9
|
+
const resp = await createPatient({
|
|
10
|
+
person: createPersonPayload,
|
|
11
|
+
identifiers: identifiers,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const res = await resp.json();
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const HOUSE_HOLD_NUMBER_UUID = 'bb74b20e-dcee-4f59-bdf1-2dffc3abf106';
|
|
2
|
+
const SHA_UUID = 'cf5362b2-8049-4442-b3c6-36f870e320cb';
|
|
3
|
+
const CLIENT_REGISTRY_NO_UUID = 'e88dc246-3614-4ee3-8141-1f2a83054e72';
|
|
4
|
+
const NATIONAL_ID_UUID = '58a47054-1359-11df-a1f1-0026b9348838';
|
|
5
|
+
const PROVIDER_NATIONAL_ID_UUID = '4550df92-c684-4597-8ab8-d6b10eabdcfb';
|
|
6
|
+
const REFUGEE_ID_UUID = '465e81af-8d69-47e9-9127-53a94adc75fb';
|
|
7
|
+
const MANDATE_NUMBER_UUID = 'aae2d097-20ba-43ca-9b71-fd8296068f39';
|
|
8
|
+
const ALIEN_ID_UUID = '12f5b147-3403-4a73-913d-7ded9ffec094';
|
|
9
|
+
const TEMPORARY_DEPENDANT_ID_UUID = 'a3d34214-93e8-4faf-bf4d-0272eee079eb';
|
|
10
|
+
const AMRS_UNIVERSAL_ID_UUID = '58a4732e-1359-11df-a1f1-0026b9348838';
|
|
11
|
+
const UPI_NUMBER_UUID = 'cba702b9-4664-4b43-83f1-9ab473cbd64d';
|
|
12
|
+
const BIRTH_CERTIFICATE_NUMBER_UUID = '7924e13b-131a-4da8-8efa-e294184a1b0d';
|
|
13
|
+
const BIRTH_NOTIFICATION_UUID = '10a4349d-dd1b-4b0c-bd35-a00a22394266';
|
|
14
|
+
|
|
15
|
+
export const IdentifierTypesUuids = {
|
|
16
|
+
HOUSE_HOLD_NUMBER_UUID,
|
|
17
|
+
SHA_UUID,
|
|
18
|
+
CLIENT_REGISTRY_NO_UUID,
|
|
19
|
+
NATIONAL_ID_UUID,
|
|
20
|
+
PROVIDER_NATIONAL_ID_UUID,
|
|
21
|
+
REFUGEE_ID_UUID,
|
|
22
|
+
MANDATE_NUMBER_UUID,
|
|
23
|
+
ALIEN_ID_UUID,
|
|
24
|
+
TEMPORARY_DEPENDANT_ID_UUID,
|
|
25
|
+
AMRS_UNIVERSAL_ID_UUID,
|
|
26
|
+
UPI_NUMBER_UUID,
|
|
27
|
+
BIRTH_CERTIFICATE_NUMBER_UUID,
|
|
28
|
+
BIRTH_NOTIFICATION_UUID,
|
|
29
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type HieClient, type CreatePatientDto, HieIdentificationType } from '../registry/types';
|
|
3
|
+
import { IdentifierTypesUuids } from './identifier-types';
|
|
4
|
+
import { getAmrsIdentifierTypeUuid } from '../registry/utils/hie-client-adapter';
|
|
5
|
+
import { getSubDomainUrl } from '../shared/utils/get-base-url';
|
|
6
|
+
|
|
7
|
+
export async function createPatient(payload: CreatePatientDto) {
|
|
8
|
+
return await openmrsFetch(`${restBaseUrl}/patient`, {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: {
|
|
11
|
+
'Content-Type': 'application/json',
|
|
12
|
+
},
|
|
13
|
+
body: payload,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const generatePatientIdentifiers = async (identifierLocation: string, client: HieClient) => {
|
|
18
|
+
const amrsUniverSalId = await generateAmrsUniversalIdentifier();
|
|
19
|
+
const identifiers = generateAmrsCreatePatientIdentifiersPayload(client, identifierLocation);
|
|
20
|
+
identifiers.push({
|
|
21
|
+
identifierType: IdentifierTypesUuids.AMRS_UNIVERSAL_ID_UUID,
|
|
22
|
+
identifier: amrsUniverSalId,
|
|
23
|
+
location: identifierLocation,
|
|
24
|
+
preferred: true,
|
|
25
|
+
});
|
|
26
|
+
return identifiers;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function generateAmrsCreatePatientIdentifiersPayload(hieClient: HieClient, identifierLocation: string) {
|
|
30
|
+
const identifiers = [];
|
|
31
|
+
// add CR number
|
|
32
|
+
identifiers.push({
|
|
33
|
+
identifierType: getAmrsIdentifierTypeUuid(HieIdentificationType.Cr),
|
|
34
|
+
identifier: hieClient.id,
|
|
35
|
+
location: identifierLocation,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// add main identifier
|
|
39
|
+
identifiers.push({
|
|
40
|
+
identifierType: getAmrsIdentifierTypeUuid(hieClient.identification_type),
|
|
41
|
+
identifier: hieClient.identification_number,
|
|
42
|
+
location: identifierLocation,
|
|
43
|
+
});
|
|
44
|
+
return identifiers;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function generateAmrsUniversalIdentifier() {
|
|
48
|
+
const subDomainUrl = await getSubDomainUrl();
|
|
49
|
+
const abortController = new AbortController();
|
|
50
|
+
const resp = await openmrsFetch(`${subDomainUrl}/amrs-id-generator/generateidentifier`, {
|
|
51
|
+
headers: {
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
},
|
|
54
|
+
method: 'POST',
|
|
55
|
+
body: {
|
|
56
|
+
user: 1,
|
|
57
|
+
},
|
|
58
|
+
signal: abortController.signal,
|
|
59
|
+
});
|
|
60
|
+
const data = await resp.json();
|
|
61
|
+
return data['identifier'] ?? '';
|
|
62
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type PatientSearchResponse } from '../registry/types';
|
|
3
|
+
|
|
4
|
+
export async function searchPatientByCrNumber<T>(cr_id: string): Promise<PatientSearchResponse> {
|
|
5
|
+
const url = `${restBaseUrl}/patient`;
|
|
6
|
+
const params = {
|
|
7
|
+
q: cr_id,
|
|
8
|
+
v: 'full',
|
|
9
|
+
includeDead: 'true',
|
|
10
|
+
limit: '10',
|
|
11
|
+
totalCount: 'true',
|
|
12
|
+
};
|
|
13
|
+
const queryString = new URLSearchParams(params).toString();
|
|
14
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
15
|
+
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
const errorText = await response.text();
|
|
18
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return response.json();
|
|
22
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type ServiceQueue, type QueueEntryDto, type ServiceQueueApiResponse } from '../registry/types';
|
|
3
|
+
import { getLocationByUuid } from '../shared/services/location.resource';
|
|
4
|
+
|
|
5
|
+
export async function fetchServiceQueuesByLocationUuid<T>(locationUuid: string): Promise<ServiceQueueApiResponse> {
|
|
6
|
+
const url = `${restBaseUrl}/queue`;
|
|
7
|
+
const params = {
|
|
8
|
+
v: 'custom:(uuid,display,name,description,service:(uuid,display),allowedPriorities:(uuid,display),allowedStatuses:(uuid,display),location:(uuid,display))',
|
|
9
|
+
location: locationUuid,
|
|
10
|
+
};
|
|
11
|
+
const queryString = new URLSearchParams(params).toString();
|
|
12
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
13
|
+
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
const errorText = await response.text();
|
|
16
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return response.json();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function createQueueEntry(createQueueEntryDto: QueueEntryDto) {
|
|
23
|
+
const url = `${restBaseUrl}/visit-queue-entry`;
|
|
24
|
+
const response = await openmrsFetch(url, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'content-type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify(createQueueEntryDto),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const errorText = await response.text();
|
|
34
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return response.json();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function getFacilityServiceQueues(locationUuid: string): Promise<ServiceQueue[] | undefined> {
|
|
41
|
+
const currentLocation = await getLocationByUuid(locationUuid);
|
|
42
|
+
if (!currentLocation) return;
|
|
43
|
+
const parentLocation = currentLocation.parentLocation;
|
|
44
|
+
//get child locations
|
|
45
|
+
if (!parentLocation) return;
|
|
46
|
+
const parentLocationDetail = await getLocationByUuid(parentLocation.uuid);
|
|
47
|
+
const childLocations = parentLocationDetail.childLocations ?? [];
|
|
48
|
+
const childLocationUuids =
|
|
49
|
+
childLocations.map((c) => {
|
|
50
|
+
return c.uuid;
|
|
51
|
+
}) ?? [];
|
|
52
|
+
let sqs: ServiceQueue[] = [];
|
|
53
|
+
if (childLocationUuids.length > 0) {
|
|
54
|
+
for (let i = 0; i < childLocationUuids.length; i++) {
|
|
55
|
+
const s = await fetchServiceQueuesByLocationUuid(childLocationUuids[i]);
|
|
56
|
+
sqs = [...sqs, ...s.results];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return sqs;
|
|
60
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getEtlBaseUrl } from '../shared/utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
export async function fetchGuestToken(locationUuid: string, dashboardId: string): Promise<string> {
|
|
5
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
6
|
+
const supersetTokenUrl = `${etlBaseUrl}/superset-token`;
|
|
7
|
+
const params = {
|
|
8
|
+
locationUuid: locationUuid,
|
|
9
|
+
dashboardId: dashboardId,
|
|
10
|
+
};
|
|
11
|
+
const queryString = new URLSearchParams(params).toString();
|
|
12
|
+
const response = await openmrsFetch(`${supersetTokenUrl}?${queryString}`);
|
|
13
|
+
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
const errorText = await response.text();
|
|
16
|
+
throw new Error(`Failed to fetch guest token: ${response.status} - ${errorText}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const data = await response.json();
|
|
20
|
+
return data.access_token;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { type EndVisitDto, type CreateVisitDto } from '../registry/types';
|
|
3
|
+
|
|
4
|
+
export async function createVisit(createVisitDto: CreateVisitDto) {
|
|
5
|
+
const url = `${restBaseUrl}/visit`;
|
|
6
|
+
const response = await openmrsFetch(url, {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
headers: {
|
|
9
|
+
'content-type': 'application/json',
|
|
10
|
+
},
|
|
11
|
+
body: JSON.stringify(createVisitDto),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
const errorText = await response.text();
|
|
16
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return response.json();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function endVisit(visitUuid: string, endVisitDto: EndVisitDto) {
|
|
23
|
+
const url = `${restBaseUrl}/visit/${visitUuid}`;
|
|
24
|
+
const response = await openmrsFetch(url, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'content-type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify(endVisitDto),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const errorText = await response.text();
|
|
34
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return response.json();
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './root.scss';
|
|
3
|
+
import { useLeftNav, WorkspaceContainer } from '@openmrs/esm-framework';
|
|
4
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
|
5
|
+
import RegistryComponent from './registry/registry.component';
|
|
6
|
+
import LeftPanel from './left-panel/left-panel.component';
|
|
7
|
+
import Triage from './triage/triage.component';
|
|
8
|
+
import LaboratoryComponent from './laboratory/laboratory.component';
|
|
9
|
+
import AppointmentsComponent from './appointments/appointments.component';
|
|
10
|
+
import PharmacyComponent from './pharmacy/pharmacy.component';
|
|
11
|
+
import Consultation from './service-queues/consultation/consultation.component';
|
|
12
|
+
import Dashboard from './dashboard/dashboard.component';
|
|
13
|
+
import DailyBookings from './bookings/daily/daily-bookings.component';
|
|
14
|
+
import Mortuary from './mortuary/mortuary.component';
|
|
15
|
+
import ServiceQueueAdminDashboard from './service-queues/admin/service-queue-admin-dashboard.component';
|
|
16
|
+
import AdmissionsDashboard from './admissions/admissions-dashboard.component';
|
|
17
|
+
|
|
18
|
+
const Root: React.FC = () => {
|
|
19
|
+
const spaBasePath = window.spaBase;
|
|
20
|
+
useLeftNav({
|
|
21
|
+
name: 'dha-workflow-slot',
|
|
22
|
+
basePath: spaBasePath,
|
|
23
|
+
mode: 'normal',
|
|
24
|
+
});
|
|
25
|
+
return (
|
|
26
|
+
<BrowserRouter basename={`${window.spaBase}/dha-workflow`}>
|
|
27
|
+
<LeftPanel />
|
|
28
|
+
<main className={styles.container}>
|
|
29
|
+
<Routes>
|
|
30
|
+
<Route path="dashboard" element={<Dashboard />} />
|
|
31
|
+
<Route path="registry" element={<RegistryComponent />} />
|
|
32
|
+
<Route path="consultation" element={<Consultation />} />
|
|
33
|
+
<Route path="triage" element={<Triage />} />
|
|
34
|
+
<Route path="laboratory" element={<LaboratoryComponent />} />
|
|
35
|
+
<Route path="pharmacy" element={<PharmacyComponent />} />
|
|
36
|
+
<Route path="appointments" element={<AppointmentsComponent />} />
|
|
37
|
+
<Route path="bookings/daily" element={<DailyBookings />} />
|
|
38
|
+
<Route path="mortuary" element={<Mortuary />} />
|
|
39
|
+
<Route path="service-queue-admin" element={<ServiceQueueAdminDashboard />} />
|
|
40
|
+
<Route path="admissions-dashboard" element={<AdmissionsDashboard />} />
|
|
41
|
+
</Routes>
|
|
42
|
+
</main>
|
|
43
|
+
<WorkspaceContainer contextKey="home" />
|
|
44
|
+
</BrowserRouter>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default Root;
|