From 03dc1984dae85f92d87aa79d5ab83d0533fc644d Mon Sep 17 00:00:00 2001 From: Laurent Ouma <98098891+Omoshlawi@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:55:30 +0400 Subject: [PATCH 1/2] Using mock data for claims preauth and filtering interventions with patient gender (#549) * fix: Update use preauth hook to use mock preauth payload;mock fetch;properly rename interventions * feat: Enhance PackageInterventions component to utilize patient UUID and apply gender-based filtering * refactor: Cleanup preauth * update translations --- .../benefits-package/benefits-package.mock.ts | 6 +- .../forms/benefit-pre-auth-form.workspace.tsx | 9 +- ...sx => package-interventions.component.tsx} | 40 +- .../dashboard/form/claims-form.component.tsx | 5 +- .../pre-auth/form/pre-auth-form.component.tsx | 364 ------------------ .../pre-auth/form/pre-auth-form.resource.ts | 20 - .../claims/pre-auth/form/pre-auth-form.scss | 141 ------- .../pre-auth/form/pre-auth-mock-data.ts | 44 --- .../src/claims/pre-auth/hook/pre-auth.mock.ts | 40 -- .../pre-auth/pre-auth-dashboard.component.tsx | 79 ---- .../claims/pre-auth/pre-auth-dashboard.scss | 42 -- .../table/pre-auth-table.component.tsx | 234 ----------- .../claims/pre-auth/table/pre-auth-table.scss | 111 ------ packages/esm-billing-app/src/config-schema.ts | 2 +- .../src/hooks/use-pre-auth-requests.ts | 14 +- .../src/hooks/useInterventions.ts | 32 +- .../esm-billing-app/src/root.component.tsx | 2 - packages/esm-billing-app/src/types/index.ts | 2 +- packages/esm-billing-app/translations/en.json | 19 +- 19 files changed, 85 insertions(+), 1121 deletions(-) rename packages/esm-billing-app/src/benefits-package/forms/{package-intervensions.component.tsx => package-interventions.component.tsx} (53%) delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/form/pre-auth-form.component.tsx delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/form/pre-auth-form.resource.ts delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/form/pre-auth-form.scss delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/form/pre-auth-mock-data.ts delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/hook/pre-auth.mock.ts delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/pre-auth-dashboard.component.tsx delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/pre-auth-dashboard.scss delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/table/pre-auth-table.component.tsx delete mode 100644 packages/esm-billing-app/src/claims/pre-auth/table/pre-auth-table.scss diff --git a/packages/esm-billing-app/src/benefits-package/benefits-package.mock.ts b/packages/esm-billing-app/src/benefits-package/benefits-package.mock.ts index a1c59b684..15e7cc376 100644 --- a/packages/esm-billing-app/src/benefits-package/benefits-package.mock.ts +++ b/packages/esm-billing-app/src/benefits-package/benefits-package.mock.ts @@ -4,7 +4,7 @@ import { Diagnosis, Package, PatientBenefit, - SHAIntervension, + SHAIntervention, shifIdentifiersResponse, } from '../types'; @@ -52,10 +52,10 @@ export const packages = [ }, ] as Array; -export const intervensions = patientBenefits.map(({ interventionCode, interventionName }) => ({ +export const interventions = patientBenefits.map(({ interventionCode, interventionName }) => ({ interventionCode, interventionName, -})) as Array; +})) as Array; export const coverageEligibilityResponse = [ { diff --git a/packages/esm-billing-app/src/benefits-package/forms/benefit-pre-auth-form.workspace.tsx b/packages/esm-billing-app/src/benefits-package/forms/benefit-pre-auth-form.workspace.tsx index edf169c07..e03f3f6ad 100644 --- a/packages/esm-billing-app/src/benefits-package/forms/benefit-pre-auth-form.workspace.tsx +++ b/packages/esm-billing-app/src/benefits-package/forms/benefit-pre-auth-form.workspace.tsx @@ -28,7 +28,7 @@ import useProvider from '../../hooks/useProvider'; import { PatientBenefit } from '../../types'; import { preAuthenticateBenefit, preauthSchema } from '../benefits-package.resources'; import styles from './benefits-pre-auth-form.scss'; -import PackageIntervensions from './package-intervensions.component'; +import PackageInterventions from './package-interventions.component'; import { ErrorState } from '@openmrs/esm-patient-common-lib'; type BenefitsPreAuth = z.infer; @@ -240,8 +240,9 @@ const BenefitPreAuthForm: React.FC = ({ closeWorkspace, {selectedPackageObservable && ( - package_.uuid === selectedPackageObservable)?.packageCode ?? ''} + patientUuid={patientUuid} /> )} @@ -255,7 +256,7 @@ const BenefitPreAuthForm: React.FC = ({ closeWorkspace, invalid={form.formState.errors[field.name]?.message} invalidText={form.formState.errors[field.name]?.message} id="diagnoses" - titleText={t('diagnosis', 'Diagnosis')} + titleText={t('finalDiagnosis', 'Final Diagnosis')} selectedItems={field.value} label="Choose option" items={diagnoses.map((r) => r.id)} @@ -279,7 +280,7 @@ const BenefitPreAuthForm: React.FC = ({ closeWorkspace, -