diff --git a/services/ui-src/src/measures/2021/globalValidations/index.ts b/services/ui-src/src/measures/2021/globalValidations/index.ts index 8600b83908..6b97e90379 100644 --- a/services/ui-src/src/measures/2021/globalValidations/index.ts +++ b/services/ui-src/src/measures/2021/globalValidations/index.ts @@ -6,7 +6,7 @@ export * from "shared/globalValidations/validateAtLeastOneDataSource"; export * from "./validateAtLeastOneDeviationFieldFilled"; export * from "shared/globalValidations/validateAtLeastOneRateComplete"; export * from "shared/globalValidations/validateBothDatesInRange"; -export * from "./validateDualPopInformation"; +export * from "shared/globalValidations/validateDualPopInformation"; export * from "shared/globalValidations/validateEqualCategoryDenominators"; export * from "shared/globalValidations/validateEqualQualifierDenominators"; export * from "./validateRateNotZero"; diff --git a/services/ui-src/src/measures/2021/globalValidations/validateDualPopInformation/index.test.ts b/services/ui-src/src/measures/2021/globalValidations/validateDualPopInformation/index.test.ts deleted file mode 100644 index a7a289a2c9..0000000000 --- a/services/ui-src/src/measures/2021/globalValidations/validateDualPopInformation/index.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as DC from "dataConstants"; -import { simpleRate, partialRate } from "utils/testUtils/validationHelpers"; -import { validateDualPopInformationPM } from "."; - -describe("Testing Dual Population Selection Validation", () => { - it("should be no errors", () => { - const errors = validateDualPopInformationPM([], undefined, 0, []); - - expect(errors.length).toBe(0); - }); - - it("should be no errors - partial data", () => { - const errors = validateDualPopInformationPM( - [[partialRate, partialRate]], - undefined, - 0, - [] - ); - - expect(errors.length).toBe(0); - }); - - it("should be no errors - OPM", () => { - const errors = validateDualPopInformationPM([], [], 0, []); - - expect(errors.length).toBe(0); - }); - - it("should be errors for no checkbox selections", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no matching checkbox selection", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - [] - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no matching checkbox selection - specified string", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - [], - "TestLabel" - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the TestLabel Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no data", () => { - const errors = validateDualPopInformationPM([], undefined, 0, [ - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE, - ]); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for Age 65 and Older` - ); - }); - - it("should be errors for no data - specified string", () => { - const errors = validateDualPopInformationPM( - [], - undefined, - 0, - [DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE], - "TestLabel" - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for TestLabel` - ); - }); - - it("Error message text should match default errorMessage", () => { - const errorArray = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined - ); - expect(errorArray.length).toBe(1); - expect(errorArray[0].errorMessage).toBe( - "Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing" - ); - }); - - it("Error message text should match provided errorMessage", () => { - const errorMessageFunc = ( - _dualEligible: boolean, - errorReplacementText: string - ) => { - return `Another ${errorReplacementText} bites the dust`; - }; - - const errorArray = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined, - undefined, - errorMessageFunc - ); - expect(errorArray.length).toBe(1); - expect(errorArray[0].errorMessage).toBe( - errorMessageFunc(true, "Age 65 and Older") - ); - }); -}); diff --git a/services/ui-src/src/measures/2021/globalValidations/validateDualPopInformation/index.ts b/services/ui-src/src/measures/2021/globalValidations/validateDualPopInformation/index.ts deleted file mode 100644 index 18a57160e9..0000000000 --- a/services/ui-src/src/measures/2021/globalValidations/validateDualPopInformation/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as DC from "dataConstants"; -import { FormRateField } from "../types"; - -const validateDualPopInformationPMErrorMessage = ( - dualEligible: boolean, - errorReplacementText: string -) => { - if (!dualEligible) { - return `Information has been included in the ${errorReplacementText} Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing`; - } else { - return `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for ${errorReplacementText}`; - } -}; - -export const validateDualPopInformationPM = ( - performanceMeasureArray: FormRateField[][], - OPM: any, - age65PlusIndex: number, - DefinitionOfDenominator: string[] | undefined, - errorReplacementText: string = "Age 65 and Older", - errorMessageFunc = validateDualPopInformationPMErrorMessage -) => { - if (OPM) { - return []; - } - - const dualEligible = DefinitionOfDenominator - ? DefinitionOfDenominator.indexOf( - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE - ) !== -1 - : false; - - const errorArray: FormError[] = []; - const filledInData: FormRateField[] = []; - performanceMeasureArray?.forEach((performanceMeasure) => { - if ( - performanceMeasure && - performanceMeasure[age65PlusIndex] && - performanceMeasure[age65PlusIndex].denominator && - performanceMeasure[age65PlusIndex].numerator && - performanceMeasure[age65PlusIndex].rate - ) { - filledInData.push(performanceMeasure[age65PlusIndex]); - } - }); - - if (!dualEligible && filledInData.length > 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: errorMessageFunc(dualEligible, errorReplacementText), - errorType: "Warning", - }); - } - if (dualEligible && filledInData.length === 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: errorMessageFunc(dualEligible, errorReplacementText), - errorType: "Warning", - }); - } - return errorArray; -}; diff --git a/services/ui-src/src/measures/2022/shared/globalValidations/index.ts b/services/ui-src/src/measures/2022/shared/globalValidations/index.ts index 8600b83908..6b97e90379 100644 --- a/services/ui-src/src/measures/2022/shared/globalValidations/index.ts +++ b/services/ui-src/src/measures/2022/shared/globalValidations/index.ts @@ -6,7 +6,7 @@ export * from "shared/globalValidations/validateAtLeastOneDataSource"; export * from "./validateAtLeastOneDeviationFieldFilled"; export * from "shared/globalValidations/validateAtLeastOneRateComplete"; export * from "shared/globalValidations/validateBothDatesInRange"; -export * from "./validateDualPopInformation"; +export * from "shared/globalValidations/validateDualPopInformation"; export * from "shared/globalValidations/validateEqualCategoryDenominators"; export * from "shared/globalValidations/validateEqualQualifierDenominators"; export * from "./validateRateNotZero"; diff --git a/services/ui-src/src/measures/2022/shared/globalValidations/validateDualPopInformation/index.test.ts b/services/ui-src/src/measures/2022/shared/globalValidations/validateDualPopInformation/index.test.ts deleted file mode 100644 index a7a289a2c9..0000000000 --- a/services/ui-src/src/measures/2022/shared/globalValidations/validateDualPopInformation/index.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as DC from "dataConstants"; -import { simpleRate, partialRate } from "utils/testUtils/validationHelpers"; -import { validateDualPopInformationPM } from "."; - -describe("Testing Dual Population Selection Validation", () => { - it("should be no errors", () => { - const errors = validateDualPopInformationPM([], undefined, 0, []); - - expect(errors.length).toBe(0); - }); - - it("should be no errors - partial data", () => { - const errors = validateDualPopInformationPM( - [[partialRate, partialRate]], - undefined, - 0, - [] - ); - - expect(errors.length).toBe(0); - }); - - it("should be no errors - OPM", () => { - const errors = validateDualPopInformationPM([], [], 0, []); - - expect(errors.length).toBe(0); - }); - - it("should be errors for no checkbox selections", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no matching checkbox selection", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - [] - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no matching checkbox selection - specified string", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - [], - "TestLabel" - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the TestLabel Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no data", () => { - const errors = validateDualPopInformationPM([], undefined, 0, [ - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE, - ]); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for Age 65 and Older` - ); - }); - - it("should be errors for no data - specified string", () => { - const errors = validateDualPopInformationPM( - [], - undefined, - 0, - [DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE], - "TestLabel" - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for TestLabel` - ); - }); - - it("Error message text should match default errorMessage", () => { - const errorArray = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined - ); - expect(errorArray.length).toBe(1); - expect(errorArray[0].errorMessage).toBe( - "Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing" - ); - }); - - it("Error message text should match provided errorMessage", () => { - const errorMessageFunc = ( - _dualEligible: boolean, - errorReplacementText: string - ) => { - return `Another ${errorReplacementText} bites the dust`; - }; - - const errorArray = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined, - undefined, - errorMessageFunc - ); - expect(errorArray.length).toBe(1); - expect(errorArray[0].errorMessage).toBe( - errorMessageFunc(true, "Age 65 and Older") - ); - }); -}); diff --git a/services/ui-src/src/measures/2022/shared/globalValidations/validateDualPopInformation/index.ts b/services/ui-src/src/measures/2022/shared/globalValidations/validateDualPopInformation/index.ts deleted file mode 100644 index 18a57160e9..0000000000 --- a/services/ui-src/src/measures/2022/shared/globalValidations/validateDualPopInformation/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as DC from "dataConstants"; -import { FormRateField } from "../types"; - -const validateDualPopInformationPMErrorMessage = ( - dualEligible: boolean, - errorReplacementText: string -) => { - if (!dualEligible) { - return `Information has been included in the ${errorReplacementText} Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing`; - } else { - return `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for ${errorReplacementText}`; - } -}; - -export const validateDualPopInformationPM = ( - performanceMeasureArray: FormRateField[][], - OPM: any, - age65PlusIndex: number, - DefinitionOfDenominator: string[] | undefined, - errorReplacementText: string = "Age 65 and Older", - errorMessageFunc = validateDualPopInformationPMErrorMessage -) => { - if (OPM) { - return []; - } - - const dualEligible = DefinitionOfDenominator - ? DefinitionOfDenominator.indexOf( - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE - ) !== -1 - : false; - - const errorArray: FormError[] = []; - const filledInData: FormRateField[] = []; - performanceMeasureArray?.forEach((performanceMeasure) => { - if ( - performanceMeasure && - performanceMeasure[age65PlusIndex] && - performanceMeasure[age65PlusIndex].denominator && - performanceMeasure[age65PlusIndex].numerator && - performanceMeasure[age65PlusIndex].rate - ) { - filledInData.push(performanceMeasure[age65PlusIndex]); - } - }); - - if (!dualEligible && filledInData.length > 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: errorMessageFunc(dualEligible, errorReplacementText), - errorType: "Warning", - }); - } - if (dualEligible && filledInData.length === 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: errorMessageFunc(dualEligible, errorReplacementText), - errorType: "Warning", - }); - } - return errorArray; -}; diff --git a/services/ui-src/src/measures/2022/shared/util/validationsMock.tsx b/services/ui-src/src/measures/2022/shared/util/validationsMock.tsx index 3069f378d3..528f1d25cb 100644 --- a/services/ui-src/src/measures/2022/shared/util/validationsMock.tsx +++ b/services/ui-src/src/measures/2022/shared/util/validationsMock.tsx @@ -2,7 +2,7 @@ import * as validateAtLeastOneDataSource from "shared/globalValidations/validate import * as validateAtLeastOneDeviationFieldFilled from "measures/2022/shared/globalValidations/validateAtLeastOneDeviationFieldFilled"; import * as validateAtLeastOneRateComplete from "shared/globalValidations/validateAtLeastOneRateComplete"; import * as validateBothDatesInRange from "shared/globalValidations/validateBothDatesInRange"; -import * as validateDualPopInformation from "measures/2022/shared/globalValidations/validateDualPopInformation"; +import * as validateDualPopInformation from "shared/globalValidations/validateDualPopInformation"; import * as validateEqualCategoryDenominators from "shared/globalValidations/validateEqualCategoryDenominators"; import * as validateEqualQualifierDenominators from "shared/globalValidations/validateEqualQualifierDenominators"; import * as validateRateNotZero from "measures/2022/shared/globalValidations/validateRateNotZero"; diff --git a/services/ui-src/src/measures/2023/shared/globalValidations/index.ts b/services/ui-src/src/measures/2023/shared/globalValidations/index.ts index 5c8eba40dd..2d750c10ed 100644 --- a/services/ui-src/src/measures/2023/shared/globalValidations/index.ts +++ b/services/ui-src/src/measures/2023/shared/globalValidations/index.ts @@ -10,7 +10,7 @@ export * from "./validateAtLeastOneDeviationFieldFilled"; export * from "shared/globalValidations/validateAtLeastOneRateComplete"; export * from "shared/globalValidations/validateBothDatesInRange"; export * from "shared/globalValidations/validateDateRangeRadioButtonCompletion"; -export * from "./validateDualPopInformation"; +export * from "shared/globalValidations/validateDualPopInformation"; export * from "shared/globalValidations/validateEqualCategoryDenominators"; export * from "shared/globalValidations/validateEqualQualifierDenominators"; export * from "shared/globalValidations/validateFfsRadioButtonCompletion"; diff --git a/services/ui-src/src/measures/2023/shared/globalValidations/validateDualPopInformation/index.test.ts b/services/ui-src/src/measures/2023/shared/globalValidations/validateDualPopInformation/index.test.ts deleted file mode 100644 index a7a289a2c9..0000000000 --- a/services/ui-src/src/measures/2023/shared/globalValidations/validateDualPopInformation/index.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as DC from "dataConstants"; -import { simpleRate, partialRate } from "utils/testUtils/validationHelpers"; -import { validateDualPopInformationPM } from "."; - -describe("Testing Dual Population Selection Validation", () => { - it("should be no errors", () => { - const errors = validateDualPopInformationPM([], undefined, 0, []); - - expect(errors.length).toBe(0); - }); - - it("should be no errors - partial data", () => { - const errors = validateDualPopInformationPM( - [[partialRate, partialRate]], - undefined, - 0, - [] - ); - - expect(errors.length).toBe(0); - }); - - it("should be no errors - OPM", () => { - const errors = validateDualPopInformationPM([], [], 0, []); - - expect(errors.length).toBe(0); - }); - - it("should be errors for no checkbox selections", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no matching checkbox selection", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - [] - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no matching checkbox selection - specified string", () => { - const errors = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - [], - "TestLabel" - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `Information has been included in the TestLabel Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing` - ); - }); - - it("should be errors for no data", () => { - const errors = validateDualPopInformationPM([], undefined, 0, [ - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE, - ]); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for Age 65 and Older` - ); - }); - - it("should be errors for no data - specified string", () => { - const errors = validateDualPopInformationPM( - [], - undefined, - 0, - [DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE], - "TestLabel" - ); - - expect(errors.length).toBe(1); - expect(errors[0].errorLocation).toBe("Performance Measure"); - expect(errors[0].errorMessage).toBe( - `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for TestLabel` - ); - }); - - it("Error message text should match default errorMessage", () => { - const errorArray = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined - ); - expect(errorArray.length).toBe(1); - expect(errorArray[0].errorMessage).toBe( - "Information has been included in the Age 65 and Older Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing" - ); - }); - - it("Error message text should match provided errorMessage", () => { - const errorMessageFunc = ( - _dualEligible: boolean, - errorReplacementText: string - ) => { - return `Another ${errorReplacementText} bites the dust`; - }; - - const errorArray = validateDualPopInformationPM( - [[simpleRate, simpleRate]], - undefined, - 0, - undefined, - undefined, - errorMessageFunc - ); - expect(errorArray.length).toBe(1); - expect(errorArray[0].errorMessage).toBe( - errorMessageFunc(true, "Age 65 and Older") - ); - }); -}); diff --git a/services/ui-src/src/measures/2023/shared/globalValidations/validateDualPopInformation/index.ts b/services/ui-src/src/measures/2023/shared/globalValidations/validateDualPopInformation/index.ts deleted file mode 100644 index 18a57160e9..0000000000 --- a/services/ui-src/src/measures/2023/shared/globalValidations/validateDualPopInformation/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as DC from "dataConstants"; -import { FormRateField } from "../types"; - -const validateDualPopInformationPMErrorMessage = ( - dualEligible: boolean, - errorReplacementText: string -) => { - if (!dualEligible) { - return `Information has been included in the ${errorReplacementText} Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing`; - } else { - return `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for ${errorReplacementText}`; - } -}; - -export const validateDualPopInformationPM = ( - performanceMeasureArray: FormRateField[][], - OPM: any, - age65PlusIndex: number, - DefinitionOfDenominator: string[] | undefined, - errorReplacementText: string = "Age 65 and Older", - errorMessageFunc = validateDualPopInformationPMErrorMessage -) => { - if (OPM) { - return []; - } - - const dualEligible = DefinitionOfDenominator - ? DefinitionOfDenominator.indexOf( - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE - ) !== -1 - : false; - - const errorArray: FormError[] = []; - const filledInData: FormRateField[] = []; - performanceMeasureArray?.forEach((performanceMeasure) => { - if ( - performanceMeasure && - performanceMeasure[age65PlusIndex] && - performanceMeasure[age65PlusIndex].denominator && - performanceMeasure[age65PlusIndex].numerator && - performanceMeasure[age65PlusIndex].rate - ) { - filledInData.push(performanceMeasure[age65PlusIndex]); - } - }); - - if (!dualEligible && filledInData.length > 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: errorMessageFunc(dualEligible, errorReplacementText), - errorType: "Warning", - }); - } - if (dualEligible && filledInData.length === 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: errorMessageFunc(dualEligible, errorReplacementText), - errorType: "Warning", - }); - } - return errorArray; -}; diff --git a/services/ui-src/src/measures/2023/shared/util/validationsMock.tsx b/services/ui-src/src/measures/2023/shared/util/validationsMock.tsx index b28e7c2294..08af6c0d91 100644 --- a/services/ui-src/src/measures/2023/shared/util/validationsMock.tsx +++ b/services/ui-src/src/measures/2023/shared/util/validationsMock.tsx @@ -5,7 +5,7 @@ import * as validateAtLeastOneDeliverySystem from "shared/globalValidations/vali import * as validateAtLeastOneDeviationFieldFilled from "measures/2023/shared/globalValidations/validateAtLeastOneDeviationFieldFilled"; import * as validateAtLeastOneRateComplete from "shared/globalValidations/validateAtLeastOneRateComplete"; import * as validateBothDatesInRange from "shared/globalValidations/validateBothDatesInRange"; -import * as validateDualPopInformation from "measures/2023/shared/globalValidations/validateDualPopInformation"; +import * as validateDualPopInformation from "shared/globalValidations/validateDualPopInformation"; import * as validateEqualCategoryDenominators from "shared/globalValidations/validateEqualCategoryDenominators"; import * as validateEqualQualifierDenominators from "shared/globalValidations/validateEqualQualifierDenominators"; import * as validateFfsRadioButtonCompletion from "shared/globalValidations/validateFfsRadioButtonCompletion"; diff --git a/services/ui-src/src/measures/2024/shared/globalValidations/index.ts b/services/ui-src/src/measures/2024/shared/globalValidations/index.ts index 0a19895558..8f04e494b3 100644 --- a/services/ui-src/src/measures/2024/shared/globalValidations/index.ts +++ b/services/ui-src/src/measures/2024/shared/globalValidations/index.ts @@ -11,7 +11,7 @@ export * from "./validateAtLeastOneDeviationFieldFilled"; export * from "shared/globalValidations/validateAtLeastOneRateComplete"; export * from "shared/globalValidations/validateBothDatesInRange"; export * from "shared/globalValidations/validateDateRangeRadioButtonCompletion"; -export * from "./validateDualPopInformation"; +export * from "shared/globalValidations/validateDualPopInformation"; export * from "shared/globalValidations/validateEqualCategoryDenominators"; export * from "shared/globalValidations/validateEqualQualifierDenominators"; export * from "shared/globalValidations/validateFfsRadioButtonCompletion"; diff --git a/services/ui-src/src/measures/2024/shared/globalValidations/validateDualPopInformation/index.ts b/services/ui-src/src/measures/2024/shared/globalValidations/validateDualPopInformation/index.ts deleted file mode 100644 index 8696045a50..0000000000 --- a/services/ui-src/src/measures/2024/shared/globalValidations/validateDualPopInformation/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import * as DC from "dataConstants"; -import { FormRateField } from "../types"; - -export const validateDualPopInformationPM = ( - performanceMeasureArray: FormRateField[][], - OPM: any, - age65PlusIndex: number, - DefinitionOfDenominator: string[] | undefined, - errorReplacementText: string = "Age 65 and Older" -) => { - if (OPM) { - return []; - } - - const dualEligible = DefinitionOfDenominator - ? DefinitionOfDenominator.indexOf( - DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE - ) !== -1 - : false; - - const errorArray: FormError[] = []; - const filledInData: FormRateField[] = []; - performanceMeasureArray?.forEach((performanceMeasure) => { - if ( - performanceMeasure && - performanceMeasure[age65PlusIndex] && - performanceMeasure[age65PlusIndex].denominator && - performanceMeasure[age65PlusIndex].numerator && - performanceMeasure[age65PlusIndex].rate - ) { - filledInData.push(performanceMeasure[age65PlusIndex]); - } - }); - - if (dualEligible && filledInData.length === 0) { - errorArray.push({ - errorLocation: "Performance Measure", - errorMessage: `"Individuals Dually Eligible for Medicare and Medicaid" is selected in the "Definition of Denominator" question but you are missing performance measure data for ${errorReplacementText}`, - errorType: "Warning", - }); - } - return errorArray; -}; diff --git a/services/ui-src/src/measures/2024/shared/util/validationsMock.tsx b/services/ui-src/src/measures/2024/shared/util/validationsMock.tsx index 0c798bdbaf..25f2d3f615 100644 --- a/services/ui-src/src/measures/2024/shared/util/validationsMock.tsx +++ b/services/ui-src/src/measures/2024/shared/util/validationsMock.tsx @@ -5,7 +5,7 @@ import * as validateAtLeastOneDeliverySystem from "shared/globalValidations/vali import * as validateAtLeastOneDeviationFieldFilled from "measures/2024/shared/globalValidations/validateAtLeastOneDeviationFieldFilled"; import * as validateAtLeastOneRateComplete from "shared/globalValidations/validateAtLeastOneRateComplete"; import * as validateBothDatesInRange from "shared/globalValidations/validateBothDatesInRange"; -import * as validateDualPopInformation from "measures/2024/shared/globalValidations/validateDualPopInformation"; +import * as validateDualPopInformation from "shared/globalValidations/validateDualPopInformation"; import * as validateEqualCategoryDenominators from "shared/globalValidations/validateEqualCategoryDenominators"; import * as validateEqualQualifierDenominators from "shared/globalValidations/validateEqualQualifierDenominators"; import * as validateFfsRadioButtonCompletion from "shared/globalValidations/validateFfsRadioButtonCompletion"; diff --git a/services/ui-src/src/measures/2024/shared/globalValidations/validateDualPopInformation/index.test.ts b/services/ui-src/src/shared/globalValidations/validateDualPopInformation/index.test.ts similarity index 100% rename from services/ui-src/src/measures/2024/shared/globalValidations/validateDualPopInformation/index.test.ts rename to services/ui-src/src/shared/globalValidations/validateDualPopInformation/index.test.ts diff --git a/services/ui-src/src/shared/globalValidations/validateDualPopInformation/index.ts b/services/ui-src/src/shared/globalValidations/validateDualPopInformation/index.ts new file mode 100644 index 0000000000..30e2d0c56f --- /dev/null +++ b/services/ui-src/src/shared/globalValidations/validateDualPopInformation/index.ts @@ -0,0 +1,70 @@ +import * as DC from "dataConstants"; +import { FormRateField } from "shared/types/TypeValidations"; +import { getMeasureYear } from "utils/getMeasureYear"; + +export const getLabels = (year: number, errorReplacementText: string) => { + switch (year) { + case 2021: + case 2022: + case 2023: + return { + checkmarkWarning: `Information has been included in the ${errorReplacementText} Performance Measure but the checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is missing`, + missingDataWarning: `The checkmark for (Denominator Includes Medicare and Medicaid Dually-Eligible population) is checked but you are missing performance measure data for ${errorReplacementText}`, + }; + default: + return { + missingDataWarning: `"Individuals Dually Eligible for Medicare and Medicaid" is selected in the "Definition of Denominator" question but you are missing performance measure data for ${errorReplacementText}`, + }; + } +}; + +export const validateDualPopInformationPM = ( + performanceMeasureArray: FormRateField[][], + OPM: any, + age65PlusIndex: number, + DefinitionOfDenominator: string[] | undefined, + errorReplacementText: string = "Age 65 and Older" +) => { + if (OPM) { + return []; + } + + const year = getMeasureYear(); + const labels = getLabels(year, errorReplacementText); + + const dualEligible = DefinitionOfDenominator + ? DefinitionOfDenominator.indexOf( + DC.DENOMINATOR_INC_MEDICAID_DUAL_ELIGIBLE + ) !== -1 + : false; + + const errorArray: FormError[] = []; + const filledInData: FormRateField[] = []; + performanceMeasureArray?.forEach((performanceMeasure) => { + if ( + performanceMeasure && + performanceMeasure[age65PlusIndex] && + performanceMeasure[age65PlusIndex].denominator && + performanceMeasure[age65PlusIndex].numerator && + performanceMeasure[age65PlusIndex].rate + ) { + filledInData.push(performanceMeasure[age65PlusIndex]); + } + }); + + if (!dualEligible && filledInData.length > 0 && labels.checkmarkWarning) { + errorArray.push({ + errorLocation: "Performance Measure", + errorMessage: labels.checkmarkWarning, + errorType: "Warning", + }); + } + if (dualEligible && filledInData.length === 0 && labels.missingDataWarning) { + errorArray.push({ + errorLocation: "Performance Measure", + errorMessage: labels.missingDataWarning, + errorType: "Warning", + }); + } + return errorArray; +};