@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,62 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getHieBaseUrl } from '../shared/utils/get-base-url';
|
|
3
|
+
import {
|
|
4
|
+
type ClientRegistrySearchRequest,
|
|
5
|
+
type RequestCustomOtpDto,
|
|
6
|
+
type RequestCustomOtpResponse,
|
|
7
|
+
type ValidateCustomOtpResponse,
|
|
8
|
+
type ValidateHieCustomOtpDto,
|
|
9
|
+
} from './types';
|
|
10
|
+
|
|
11
|
+
export type ClientRegistrySearchResponse = any[];
|
|
12
|
+
|
|
13
|
+
export async function postJson<T>(url: string, payload: unknown): Promise<T> {
|
|
14
|
+
const response = await openmrsFetch(url, {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: { 'Content-Type': 'application/json' },
|
|
17
|
+
body: JSON.stringify(payload),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
const errorText = await response.text();
|
|
22
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return response.json() as Promise<T>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function requestCustomOtp(payload: RequestCustomOtpDto): Promise<RequestCustomOtpResponse> {
|
|
29
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
30
|
+
const url = `${hieBaseUrl}/client/send-custom-otp`;
|
|
31
|
+
const formattedPayload = {
|
|
32
|
+
identificationNumber: payload.identificationNumber,
|
|
33
|
+
identificationType: payload.identificationType,
|
|
34
|
+
locationUuid: payload.locationUuid,
|
|
35
|
+
phoneNumber: payload.phoneNumber
|
|
36
|
+
};
|
|
37
|
+
return postJson<RequestCustomOtpResponse>(url, formattedPayload);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function validateCustomOtp(payload: ValidateHieCustomOtpDto): Promise<ValidateCustomOtpResponse> {
|
|
41
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
42
|
+
const url = `${hieBaseUrl}/client/validate-custom-otp`;
|
|
43
|
+
const formattedPayload = {
|
|
44
|
+
sessionId: payload.sessionId,
|
|
45
|
+
otp: payload.otp,
|
|
46
|
+
locationUuid: payload.locationUuid,
|
|
47
|
+
};
|
|
48
|
+
return postJson<ValidateCustomOtpResponse>(url, formattedPayload);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function fetchClientRegistryData(
|
|
52
|
+
payload: ClientRegistrySearchRequest,
|
|
53
|
+
): Promise<ClientRegistrySearchResponse> {
|
|
54
|
+
const hieBaseUrl = await getHieBaseUrl();
|
|
55
|
+
const url = `${hieBaseUrl}/client/search`;
|
|
56
|
+
const formattedPayload = {
|
|
57
|
+
identificationNumber: payload.identificationNumber,
|
|
58
|
+
identificationType: payload.identificationType,
|
|
59
|
+
locationUuid: payload.locationUuid,
|
|
60
|
+
};
|
|
61
|
+
return postJson<ClientRegistrySearchResponse>(url, formattedPayload);
|
|
62
|
+
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { type Location, type Patient } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export type IdentifierType = 'National ID' | 'Alien ID' | 'Passport' | 'Mandate Number' | 'Refugee ID' | 'Birth Certificate';
|
|
4
|
+
|
|
5
|
+
export const IDENTIFIER_TYPES: IdentifierType[] = [
|
|
6
|
+
'National ID',
|
|
7
|
+
'Alien ID',
|
|
8
|
+
'Mandate Number',
|
|
9
|
+
'Refugee ID'
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export enum OtpStatus {
|
|
13
|
+
Draft = 'DRAFT',
|
|
14
|
+
Sent = 'SENT',
|
|
15
|
+
Verified = 'VERIFIED',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum OtpOptions {
|
|
19
|
+
Skip = 'SKIP',
|
|
20
|
+
NoOverride = 'NO OVERRIDE',
|
|
21
|
+
Override = 'OVERRIDE',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ValidateCustomOtpResponse {
|
|
25
|
+
message: string;
|
|
26
|
+
isValid?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ClientRegistrySearchRequest = {
|
|
30
|
+
identificationNumber: string | number;
|
|
31
|
+
identificationType: string;
|
|
32
|
+
locationUuid: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface RequestCustomOtpResponse {
|
|
36
|
+
message: string;
|
|
37
|
+
sessionId: string;
|
|
38
|
+
maskedPhone: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ValidateHieCustomOtpDto {
|
|
42
|
+
sessionId: string;
|
|
43
|
+
otp: number | string;
|
|
44
|
+
locationUuid: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ValidateCustomOtpResponse {
|
|
48
|
+
message: string;
|
|
49
|
+
isValid?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type RequestCustomOtpDto = {
|
|
53
|
+
identificationNumber: string | number;
|
|
54
|
+
identificationType: string;
|
|
55
|
+
locationUuid: string;
|
|
56
|
+
phoneNumber: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export interface RequestCustomOtpResponse {
|
|
60
|
+
message: string;
|
|
61
|
+
sessionId: string;
|
|
62
|
+
maskedPhone: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ValidateHieCustomOtpDto {
|
|
66
|
+
sessionId: string;
|
|
67
|
+
otp: number | string;
|
|
68
|
+
locationUuid: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export enum HieIdentificationType {
|
|
72
|
+
NationalID = 'National ID',
|
|
73
|
+
SHANumber = 'SHA Number',
|
|
74
|
+
HouseholdNumber = 'Household Number',
|
|
75
|
+
RefugeeID = 'Refugee ID',
|
|
76
|
+
AlienID = 'Alien ID',
|
|
77
|
+
MandateNumber = 'Mandate Number',
|
|
78
|
+
Cr = 'id',
|
|
79
|
+
TemporaryDependantID = 'Temporary Dependant ID',
|
|
80
|
+
BirthCertificate = 'Birth Certificate',
|
|
81
|
+
BirthNotification = 'Birth Notification',
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface HieIdentifications {
|
|
85
|
+
identification_number: string;
|
|
86
|
+
identification_type: HieIdentificationType;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface HieDependant {
|
|
90
|
+
date_added: string;
|
|
91
|
+
relationship: string;
|
|
92
|
+
total: number;
|
|
93
|
+
result: HieClient[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface AlternateContact {
|
|
97
|
+
contact_type: string;
|
|
98
|
+
contact_id: string;
|
|
99
|
+
contact_name: string;
|
|
100
|
+
relationship: string;
|
|
101
|
+
remarks: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface HieClient {
|
|
105
|
+
resourceType: string;
|
|
106
|
+
id: string;
|
|
107
|
+
meta: {
|
|
108
|
+
versionId: string;
|
|
109
|
+
creationTime: string;
|
|
110
|
+
lastUpdated: string;
|
|
111
|
+
source: string;
|
|
112
|
+
};
|
|
113
|
+
originSystem: {
|
|
114
|
+
system: string;
|
|
115
|
+
record_id: string;
|
|
116
|
+
};
|
|
117
|
+
title: string;
|
|
118
|
+
first_name: string;
|
|
119
|
+
middle_name: string;
|
|
120
|
+
last_name: string;
|
|
121
|
+
gender: string;
|
|
122
|
+
date_of_birth: string;
|
|
123
|
+
place_of_birth: string;
|
|
124
|
+
person_with_disability: number;
|
|
125
|
+
citizenship: string;
|
|
126
|
+
kra_pin: string;
|
|
127
|
+
preferred_primary_care_network: string;
|
|
128
|
+
employment_type: string;
|
|
129
|
+
domestic_worker_type: string;
|
|
130
|
+
civil_status: string;
|
|
131
|
+
identification_type: HieIdentificationType;
|
|
132
|
+
identification_number: string;
|
|
133
|
+
other_identifications: HieIdentifications[];
|
|
134
|
+
dependants: HieDependant[];
|
|
135
|
+
is_alive: number;
|
|
136
|
+
deceased_datetime: string;
|
|
137
|
+
phone: string;
|
|
138
|
+
biometrics_verified: number;
|
|
139
|
+
biometrics_score: number;
|
|
140
|
+
email: string;
|
|
141
|
+
country: string;
|
|
142
|
+
county: string;
|
|
143
|
+
sub_county: string;
|
|
144
|
+
ward: string;
|
|
145
|
+
village_estate: string;
|
|
146
|
+
building_house_no: string;
|
|
147
|
+
latitude: string;
|
|
148
|
+
longitude: string;
|
|
149
|
+
province_state_country: string;
|
|
150
|
+
zip_code: string;
|
|
151
|
+
identification_residence: string;
|
|
152
|
+
employer_name: string;
|
|
153
|
+
employer_pin: string;
|
|
154
|
+
disability_category: string;
|
|
155
|
+
disability_subcategory: string;
|
|
156
|
+
disability_cause: string;
|
|
157
|
+
in_lawful_custody: string;
|
|
158
|
+
admission_remand_number: string;
|
|
159
|
+
document_uploads: any[];
|
|
160
|
+
alternative_contacts: AlternateContact[];
|
|
161
|
+
gross_income: number;
|
|
162
|
+
gross_income_currency: string;
|
|
163
|
+
postal_address: string;
|
|
164
|
+
estimated_contribution: number;
|
|
165
|
+
estimated_annual_contribution: number;
|
|
166
|
+
city: string;
|
|
167
|
+
id_serial: string;
|
|
168
|
+
learning_institution_code: string;
|
|
169
|
+
learning_institution_name: string;
|
|
170
|
+
grade_level: string;
|
|
171
|
+
admission_number: string;
|
|
172
|
+
expected_year_of_graduation: string;
|
|
173
|
+
unconfirmed_dependants: HieDependant[];
|
|
174
|
+
is_agent: number;
|
|
175
|
+
agent_id: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export type PatientSearchResponse = {
|
|
179
|
+
results: Patient[];
|
|
180
|
+
totalCount: number;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type QueuePriority = {
|
|
184
|
+
uuid: string;
|
|
185
|
+
display: string;
|
|
186
|
+
};
|
|
187
|
+
export type QueueStatus = {
|
|
188
|
+
uuid: string;
|
|
189
|
+
display: string;
|
|
190
|
+
};
|
|
191
|
+
export type ServiceQueue = {
|
|
192
|
+
uuid: string;
|
|
193
|
+
display: string;
|
|
194
|
+
name: string;
|
|
195
|
+
description: string;
|
|
196
|
+
service: {
|
|
197
|
+
uuid: string;
|
|
198
|
+
display: string;
|
|
199
|
+
};
|
|
200
|
+
allowedPriorities: QueuePriority[];
|
|
201
|
+
allowedStatuses: QueueStatus[];
|
|
202
|
+
location: Location;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type ServiceQueueApiResponse = {
|
|
206
|
+
results: ServiceQueue[];
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type QueueEntryDto = {
|
|
210
|
+
visit: {
|
|
211
|
+
uuid: string;
|
|
212
|
+
};
|
|
213
|
+
queueEntry: {
|
|
214
|
+
status: {
|
|
215
|
+
uuid: string;
|
|
216
|
+
};
|
|
217
|
+
priority: {
|
|
218
|
+
uuid: string;
|
|
219
|
+
};
|
|
220
|
+
queue: {
|
|
221
|
+
uuid: string;
|
|
222
|
+
};
|
|
223
|
+
patient: {
|
|
224
|
+
uuid: string;
|
|
225
|
+
};
|
|
226
|
+
startedAt: string;
|
|
227
|
+
sortWeight: number;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export type CreateVisitDto = {
|
|
232
|
+
visitType: string;
|
|
233
|
+
location: string;
|
|
234
|
+
startDatetime: null | string;
|
|
235
|
+
stopDatetime: null | string;
|
|
236
|
+
patient: string;
|
|
237
|
+
attributes?: VisitAttribute[];
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export type VisitAttribute = {
|
|
241
|
+
attributeType: string;
|
|
242
|
+
value: string;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export type EndVisitDto = {
|
|
246
|
+
stopDatetime: string;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export interface GlobalError {
|
|
250
|
+
code: string;
|
|
251
|
+
message: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface AmrsErrorResponse {
|
|
255
|
+
message: string;
|
|
256
|
+
error: {
|
|
257
|
+
error: {
|
|
258
|
+
message: string;
|
|
259
|
+
code: string;
|
|
260
|
+
globalErrors?: GlobalError[];
|
|
261
|
+
fieldErrors?: any;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface CreatePersonDto {
|
|
267
|
+
gender?: string;
|
|
268
|
+
birthdate?: string;
|
|
269
|
+
dead?: boolean;
|
|
270
|
+
deathDate?: string;
|
|
271
|
+
names?: {
|
|
272
|
+
givenName?: string;
|
|
273
|
+
middleName?: string;
|
|
274
|
+
familyName?: string;
|
|
275
|
+
}[];
|
|
276
|
+
addresses?: {
|
|
277
|
+
country?: string;
|
|
278
|
+
address1?: string;
|
|
279
|
+
address2?: string;
|
|
280
|
+
address4?: string;
|
|
281
|
+
address7?: string;
|
|
282
|
+
address10?: string;
|
|
283
|
+
countyDistrict?: string;
|
|
284
|
+
stateProvince?: string;
|
|
285
|
+
cityVillage?: string;
|
|
286
|
+
longitude?: string;
|
|
287
|
+
latitude?: string;
|
|
288
|
+
}[];
|
|
289
|
+
attributes?: {
|
|
290
|
+
value: string | number;
|
|
291
|
+
attributeType: string;
|
|
292
|
+
}[];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export type CreatePatientDto = {
|
|
296
|
+
person: CreatePersonDto;
|
|
297
|
+
identifiers?: any;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export type QueueEntryResult = {
|
|
301
|
+
name: string;
|
|
302
|
+
queue_entry_id: number;
|
|
303
|
+
priority_comment: string;
|
|
304
|
+
wait_time_in_min: number;
|
|
305
|
+
queue_entry_uuid: string;
|
|
306
|
+
service_uuid: string;
|
|
307
|
+
location_id: number;
|
|
308
|
+
location: string;
|
|
309
|
+
service: number;
|
|
310
|
+
queue_id: number;
|
|
311
|
+
queue_room: string;
|
|
312
|
+
priority: string;
|
|
313
|
+
patient_id: number;
|
|
314
|
+
visit_id: number;
|
|
315
|
+
patient_uuid: string;
|
|
316
|
+
family_name: string;
|
|
317
|
+
given_name: string;
|
|
318
|
+
middle_name: string;
|
|
319
|
+
status: string;
|
|
320
|
+
visit_uuid: string;
|
|
321
|
+
queue_coming_from: string;
|
|
322
|
+
bill_status: string;
|
|
323
|
+
bill_item_payment_status: string;
|
|
324
|
+
price_name: string;
|
|
325
|
+
cash_unpaid_client: string;
|
|
326
|
+
hide_in_queue: number;
|
|
327
|
+
identifiers: string;
|
|
328
|
+
phone_number: string;
|
|
329
|
+
age: number;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
export enum PaymentDetail {
|
|
333
|
+
Paying = 'Paying',
|
|
334
|
+
NonPaying = 'Non-Paying',
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export type EligibilityFilterDto = {
|
|
338
|
+
requestIdType: string;
|
|
339
|
+
requestIdNumber: string;
|
|
340
|
+
locationUuid: string;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export type HieClientEligibility = {
|
|
344
|
+
requestIdType: number;
|
|
345
|
+
requestIdNumber: string;
|
|
346
|
+
memberCrNumber: string;
|
|
347
|
+
fullName: string;
|
|
348
|
+
schemes: Scheme[];
|
|
349
|
+
statusDesc: string;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export type Scheme = {
|
|
353
|
+
schemeName: string;
|
|
354
|
+
memberType: 'BENEFICIARY' | string;
|
|
355
|
+
coverageType: 'SHIF' | string;
|
|
356
|
+
policy: Policy;
|
|
357
|
+
coverage: Coverage;
|
|
358
|
+
principalContributor: PrincipalContributor;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
export type Policy = {
|
|
362
|
+
startDate: string;
|
|
363
|
+
endDate: string;
|
|
364
|
+
number: string;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export type Coverage = {
|
|
368
|
+
startDate: string;
|
|
369
|
+
endDate: string;
|
|
370
|
+
message: string;
|
|
371
|
+
reason: string;
|
|
372
|
+
possibleSolution: string | null;
|
|
373
|
+
status: string;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export type PrincipalContributor = {
|
|
377
|
+
idNumber: string;
|
|
378
|
+
name: string;
|
|
379
|
+
crNumber: string;
|
|
380
|
+
relationship: string;
|
|
381
|
+
employmentType: string;
|
|
382
|
+
employerDetails: EmployerDetails;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export type EmployerDetails = {
|
|
386
|
+
name: string;
|
|
387
|
+
jobGroup: string;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export enum RequestIdTypes {
|
|
391
|
+
BirthCertificate = 2,
|
|
392
|
+
CrId = 3,
|
|
393
|
+
NationalId = 4,
|
|
394
|
+
Refugee = 5,
|
|
395
|
+
TemporaryId = 6,
|
|
396
|
+
TempDependantId = 7,
|
|
397
|
+
MandateNo = 8,
|
|
398
|
+
Passport = 9,
|
|
399
|
+
BirthCertificate2 = 10,
|
|
400
|
+
HouseholdNumber = 11,
|
|
401
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type AmrsErrorResponse } from '../types';
|
|
2
|
+
|
|
3
|
+
export function generateErrorMessage(error: any): string[] {
|
|
4
|
+
const errors: string[] = [];
|
|
5
|
+
return errors;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function getErrorMessages(error: AmrsErrorResponse) {
|
|
9
|
+
const errors = [];
|
|
10
|
+
if (error && error.error) {
|
|
11
|
+
if (error.error.error) {
|
|
12
|
+
const globalErrors = error.error.error.globalErrors || null;
|
|
13
|
+
if (globalErrors) {
|
|
14
|
+
for (const err of globalErrors) {
|
|
15
|
+
errors.push(err.message);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
} else if (error.error) {
|
|
19
|
+
if (error.error['globalErrors']) {
|
|
20
|
+
const globalErrors = error.error['globalErrors'] || null;
|
|
21
|
+
if (globalErrors) {
|
|
22
|
+
for (const err of globalErrors) {
|
|
23
|
+
errors.push(err.message);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (error.error['message']) {
|
|
27
|
+
errors.push(error.error['message']);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
errors.push(
|
|
31
|
+
error.error.error.message ||
|
|
32
|
+
'An error occurred while creating the patient. Please try again or contact support',
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return errors;
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HieClient } from '../types';
|
|
2
|
+
import { maskExceptFirstAndLast } from './mask-data';
|
|
3
|
+
|
|
4
|
+
export function formatDependantDisplayData(dependant: HieClient, relationship: string): string {
|
|
5
|
+
const stringData = `${dependant.first_name} ${maskExceptFirstAndLast(dependant.middle_name)} (${dependant.gender}) (DOB: ${dependant.date_of_birth}) (${relationship}) (CR: ${dependant.id})`;
|
|
6
|
+
|
|
7
|
+
return stringData;
|
|
8
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type HieIdentifications, type HieClient } from '../types';
|
|
2
|
+
|
|
3
|
+
const clientDatailsFields = [
|
|
4
|
+
'id',
|
|
5
|
+
'other_identifications',
|
|
6
|
+
'first_name',
|
|
7
|
+
'middle_name',
|
|
8
|
+
'last_name',
|
|
9
|
+
'gender',
|
|
10
|
+
'date_of_birth',
|
|
11
|
+
'is_alive',
|
|
12
|
+
'deceased_datetime',
|
|
13
|
+
'phone',
|
|
14
|
+
'email',
|
|
15
|
+
'civil_status',
|
|
16
|
+
'place_of_birth',
|
|
17
|
+
'citizenship',
|
|
18
|
+
'country',
|
|
19
|
+
'county',
|
|
20
|
+
'sub_county',
|
|
21
|
+
'ward',
|
|
22
|
+
'village_estate',
|
|
23
|
+
'longitude',
|
|
24
|
+
'latitude',
|
|
25
|
+
'identification_type',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export function generateHieClientDetails(hieClient: HieClient) {
|
|
29
|
+
let data = {};
|
|
30
|
+
Object.keys(hieClient)
|
|
31
|
+
.filter((key) => {
|
|
32
|
+
return clientDatailsFields.includes(key);
|
|
33
|
+
})
|
|
34
|
+
.forEach((key) => {
|
|
35
|
+
if (key === 'other_identifications') {
|
|
36
|
+
const otherIds = generateOtherIdentifications(hieClient[key]);
|
|
37
|
+
data = {
|
|
38
|
+
...data,
|
|
39
|
+
...otherIds,
|
|
40
|
+
};
|
|
41
|
+
} else if (key === 'identification_type') {
|
|
42
|
+
data[hieClient['identification_type']] = hieClient.identification_number;
|
|
43
|
+
} else {
|
|
44
|
+
const value = hieClient[key];
|
|
45
|
+
data[key] = value;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
function generateOtherIdentifications(hieIdentifications: HieIdentifications[]) {
|
|
51
|
+
const other = {};
|
|
52
|
+
hieIdentifications.forEach((id) => {
|
|
53
|
+
other[id.identification_type] = id.identification_number;
|
|
54
|
+
});
|
|
55
|
+
return other;
|
|
56
|
+
}
|