From a17c8c4fc3a806e0bbdc6c7e643265b2fd36300e Mon Sep 17 00:00:00 2001 From: ailZhou <127151429+ailZhou@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:03:42 -0500 Subject: [PATCH] CPC-CH Set to Autocomplete + Content update (#2083) --- .../handlers/dynamoUtils/measureList.ts | 1 + .../AutocompletedMeasureTemplate/index.tsx | 17 +- .../src/measures/2024/CPCCH/index.test.tsx | 68 ------- .../ui-src/src/measures/2024/CPCCH/index.tsx | 52 ++--- .../2024/CPCCH/questions/DataSource.tsx | 86 -------- .../questions/DefinitionOfPopulation.tsx | 49 ----- .../2024/CPCCH/questions/HowDidYouReport.tsx | 38 ---- .../CPCCH/questions/PerformanceMeasure.tsx | 22 --- .../2024/CPCCH/questions/Reporting.tsx | 41 ---- .../CPCCH/questions/WhyDidYouNotCollect.tsx | 184 ------------------ .../measures/2024/CPCCH/questions/index.tsx | 6 - .../ui-src/src/measures/2024/CPCCH/types.ts | 40 ---- .../src/measures/2024/CPCCH/validation.ts | 25 --- .../cypress/e2e/a11y/CPCCHpage.spec.ts | 4 +- .../cypress/e2e/measures/child/CPCCH.spec.ts | 45 ----- .../measures/child/QUALIFIERS_child.spec.ts | 3 - 16 files changed, 29 insertions(+), 652 deletions(-) delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/DataSource.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/DefinitionOfPopulation.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/HowDidYouReport.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/PerformanceMeasure.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/Reporting.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/WhyDidYouNotCollect.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/questions/index.tsx delete mode 100644 services/ui-src/src/measures/2024/CPCCH/types.ts delete mode 100644 services/ui-src/src/measures/2024/CPCCH/validation.ts delete mode 100644 tests/cypress/cypress/e2e/measures/child/CPCCH.spec.ts diff --git a/services/app-api/handlers/dynamoUtils/measureList.ts b/services/app-api/handlers/dynamoUtils/measureList.ts index 09b3a3b16f..98d3807554 100644 --- a/services/app-api/handlers/dynamoUtils/measureList.ts +++ b/services/app-api/handlers/dynamoUtils/measureList.ts @@ -1231,6 +1231,7 @@ export const measures: Measure = { { type: "C", measure: "CPC-CH", + autocompleteOnCreation: true, }, { type: "C", diff --git a/services/ui-src/src/components/AutocompletedMeasureTemplate/index.tsx b/services/ui-src/src/components/AutocompletedMeasureTemplate/index.tsx index c7df3d939b..2aa50e434b 100644 --- a/services/ui-src/src/components/AutocompletedMeasureTemplate/index.tsx +++ b/services/ui-src/src/components/AutocompletedMeasureTemplate/index.tsx @@ -6,7 +6,7 @@ import { useParams } from "react-router-dom"; interface Props { measureTitle: string; performanceMeasureText: string; - performanceMeasureSubtext?: string; + performanceMeasureSubtext?: string | string[]; year: string; } @@ -17,6 +17,10 @@ export const AutocompletedMeasureTemplate = ({ year, }: Props) => { const { state, coreSetId } = useParams(); + const subText: string[] | undefined = + typeof performanceMeasureSubtext === "string" + ? [performanceMeasureSubtext] + : performanceMeasureSubtext; return ( <> @@ -41,12 +45,13 @@ export const AutocompletedMeasureTemplate = ({ {performanceMeasureText} - {performanceMeasureSubtext && ( - {performanceMeasureSubtext} - )} + {subText && + subText.map(() => { + return {subText}; + })} - {`States are not asked to report data for this measure for FFY ${year} Core Set - reporting.`} + {`States are not asked to report data for this measure for FFY ${year} Core Set in the online + reporting system.`} diff --git a/services/ui-src/src/measures/2024/CPCCH/index.test.tsx b/services/ui-src/src/measures/2024/CPCCH/index.test.tsx index cd3562f317..d4476e7d38 100644 --- a/services/ui-src/src/measures/2024/CPCCH/index.test.tsx +++ b/services/ui-src/src/measures/2024/CPCCH/index.test.tsx @@ -78,65 +78,6 @@ describe(`Test FFY ${year} ${measureAbbr}`, () => { }); }); - /** - * Render the measure and confirm that all expected components exist. - * */ - it("Always shows Did you collect question", async () => { - useApiMock(apiData); - renderWithHookForm(component); - expect(screen.getByText("Did you collect this measure?")); - }); - - it("shows corresponding questions if yes to reporting then ", async () => { - apiData.useGetMeasureValues.data.Item.data = completedMeasureData; - useApiMock(apiData); - renderWithHookForm(component); - expect( - screen.queryByTestId("measurement-specification") - ).toBeInTheDocument(); - expect(screen.queryByTestId("data-source")).toBeInTheDocument(); - expect( - screen.queryByTestId("definition-of-population") - ).toBeInTheDocument(); - expect( - screen.getByText( - "Which Supplemental Item Sets were included in the Survey" - ) - ).toBeInTheDocument(); - expect( - screen.getByText( - "Which administrative protocol was used to administer the survey?" - ) - ).toBeInTheDocument(); - }); - - it("does not show corresponding questions if no to reporting then ", async () => { - apiData.useGetMeasureValues.data.Item.data = notReportingData; - useApiMock(apiData); - renderWithHookForm(component); - expect(screen.queryByTestId("status-of-data")).not.toBeInTheDocument(); - expect( - screen.queryByTestId("measurement-specification") - ).not.toBeInTheDocument(); - expect(screen.queryByTestId("data-source")).not.toBeInTheDocument(); - expect( - screen.queryByTestId("definition-of-population") - ).not.toBeInTheDocument(); - expect( - screen.queryByText( - "Which Supplemental Item Sets were included in the Survey" - ) - ).not.toBeInTheDocument(); - expect( - screen.queryByText( - "Which administrative protocol was used to administer the survey?" - ) - ).not.toBeInTheDocument(); - expect( - screen.getByText("Why did you not collect this measure") - ).toBeInTheDocument(); - }); - jest.setTimeout(15000); it("should pass a11y tests", async () => { useApiMock(apiData); @@ -147,12 +88,3 @@ describe(`Test FFY ${year} ${measureAbbr}`, () => { }); }); }); - -const notReportingData = { - DidCollect: "no", -}; - -const completedMeasureData = { - MeasurementSpecification: "AHRQ-NCQA", - DidCollect: "yes", -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/index.tsx b/services/ui-src/src/measures/2024/CPCCH/index.tsx index b3e5829273..fab777b572 100644 --- a/services/ui-src/src/measures/2024/CPCCH/index.tsx +++ b/services/ui-src/src/measures/2024/CPCCH/index.tsx @@ -1,44 +1,20 @@ -import * as Q from "./questions"; import * as QMR from "components"; -import * as CMQ from "measures/2024/shared/CommonQuestions"; -import { useParams } from "react-router-dom"; -import * as Types from "measures/2024/shared/CommonQuestions/types"; -import { useFormContext } from "react-hook-form"; -import { validationFunctions } from "./validation"; -import { useEffect } from "react"; -export const CPCCH = ({ - name, - year, - setValidationFunctions, -}: QMR.MeasureWrapperProps) => { - const { watch } = useFormContext(); - const { coreSetId } = useParams(); - const data = watch(); - - useEffect(() => { - if (setValidationFunctions) { - setValidationFunctions(validationFunctions); - } - }, [setValidationFunctions]); +interface Props { + name: string; + year: string; +} +export const CPCCH = ({ name, year }: Props) => { return ( - <> - - {data["DidCollect"] !== "no" && ( - <> - - - - - - - )} - - + ); }; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/DataSource.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/DataSource.tsx deleted file mode 100644 index 733718fced..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/DataSource.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as QMR from "components"; -import * as CUI from "@chakra-ui/react"; -import { useCustomRegister } from "hooks/useCustomRegister"; -import { FormData } from "../types"; - -export const DataSource = () => { - const register = useCustomRegister(); - - return ( - - , - ], - }, - ]} - /> - - Which Supplemental Item Sets were included in the Survey - - , - ], - }, - ]} - label="Select all that apply:" - /> - , - ], - }, - ]} - /> - - ); -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/DefinitionOfPopulation.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/DefinitionOfPopulation.tsx deleted file mode 100644 index 9c8c01ad12..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/DefinitionOfPopulation.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import * as QMR from "components"; -import * as CUI from "@chakra-ui/react"; -import { useCustomRegister } from "hooks/useCustomRegister"; -import { FormData } from "../types"; - -export const DefinitionOfPopulation = () => { - const register = useCustomRegister(); - - return ( - - - Definition of population included in the survey sample - - - - - ); -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/HowDidYouReport.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/HowDidYouReport.tsx deleted file mode 100644 index afeb83a2c4..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/HowDidYouReport.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import * as QMR from "components"; -import { useCustomRegister } from "hooks/useCustomRegister"; -import { FormData } from "../types"; - -export const HowDidYouReport = () => { - const register = useCustomRegister(); - return ( - - , - ], - }, - ]} - formLabelProps={{ fontWeight: "bold" }} - /> - - ); -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/PerformanceMeasure.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/PerformanceMeasure.tsx deleted file mode 100644 index b3d4c84430..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/PerformanceMeasure.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import * as QMR from "components"; -import * as CUI from "@chakra-ui/react"; - -export const PerformanceMeasure = () => { - return ( - - - This measure provides information on parents’ experiences with their - child’s health care. Results summarize children’s experiences through - ratings, composites, and individual question summary rates. - - - The Children with Chronic Conditions Supplemental Items provides - information on parents’ experience with their child’s health care for - the population of children with chronic conditions. - - - ); -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/Reporting.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/Reporting.tsx deleted file mode 100644 index c0cea60ced..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/Reporting.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import * as QMR from "components"; -import { useCustomRegister } from "hooks/useCustomRegister"; -import { useFormContext } from "react-hook-form"; -import { WhyDidYouNotCollect } from "."; -import { FormData } from "../types"; - -interface Props { - measureName: string; - measureAbbreviation: string; - reportingYear: string; -} - -export const Reporting = ({ reportingYear }: Props) => { - const register = useCustomRegister(); - const { watch } = useFormContext(); - const watchRadioStatus = watch("DidCollect"); - - return ( - <> - - - - {watchRadioStatus?.includes("no") && } - - ); -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/WhyDidYouNotCollect.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/WhyDidYouNotCollect.tsx deleted file mode 100644 index ab32cd24c5..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/WhyDidYouNotCollect.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import * as QMR from "components"; -import { useCustomRegister } from "hooks/useCustomRegister"; -import { FormData } from "../types"; - -export const WhyDidYouNotCollect = () => { - const register = useCustomRegister(); - return ( - - , - ], - }, - ]} - />, - ], - }, - { - displayValue: `Data not available`, - value: "DataNotAvailable", - children: [ - , - ], - }, - { - displayValue: "Data source not easily accessible", - value: "DataSourceNotEasilyAccessible", - children: [ - , - ], - }, - ]} - />, - ], - }, - { - displayValue: "Information not collected", - value: "InformationNotCollected", - children: [ - , - ], - }, - ]} - />, - ], - }, - { - displayValue: "Other", - value: "Other", - children: [ - , - ], - }, - ]} - />, - ], - }, - { - displayValue: - "Limitations with data collection, reporting, or accuracy due to the COVID-19 pandemic", - value: "LimitationWithDatCollecitonReportAccuracyCovid", - children: [ - , - ], - }, - { - displayValue: "Small sample size (less than 30)", - value: "SmallSampleSizeLessThan30", - children: [ - , - ], - }, - { - displayValue: "Other", - value: "Other", - children: [ - , - ], - }, - ]} - /> - - ); -}; diff --git a/services/ui-src/src/measures/2024/CPCCH/questions/index.tsx b/services/ui-src/src/measures/2024/CPCCH/questions/index.tsx deleted file mode 100644 index 3d81873b8a..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/questions/index.tsx +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./DataSource"; -export * from "./DefinitionOfPopulation"; -export * from "./HowDidYouReport"; -export * from "./PerformanceMeasure"; -export * from "./Reporting"; -export * from "./WhyDidYouNotCollect"; diff --git a/services/ui-src/src/measures/2024/CPCCH/types.ts b/services/ui-src/src/measures/2024/CPCCH/types.ts deleted file mode 100644 index cbba4c105d..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/types.ts +++ /dev/null @@ -1,40 +0,0 @@ -import * as Types from "measures/2024/shared/CommonQuestions/types"; -import * as Type from "shared/types"; - -export interface FormData - extends Type.AdditionalNotes, - Types.MeasurementSpecification, - Types.DidCollect { - //HowDidYouReport - HowDidYouReport: string[]; - "HowDidYouReport-Explanation": string; - - //DataSource - "DataSource-Included-ItemSets": string[]; - "DataSource-Included-ItemSets-Other": string; - "DataSource-CAHPS-Version": string; - "DataSource-CAHPS-Version-Other": string; - "DataSource-Admin-Protocol": string; - "DataSource-Admin-Protocol-Other": string; - - //WhyDidYouNotCollect - WhyDidYouNotCollect: string[]; - AmountOfPopulationNotCovered: string; - PopulationNotCovered: string; - PartialPopulationNotCoveredExplanation: string; - WhyIsDataNotAvailable: string; - "WhyIsDataNotAvailable-Other": string; - DataInconsistenciesAccuracyIssues: string; - DataSourceNotEasilyAccessible: string; - "DataSourceNotEasilyAccessible-Other": string; - InformationNotCollected: string; - "InformationNotCollected-Other": string; - LimitationWithDatCollecitonReportAccuracyCovid: string; - SmallSampleSizeLessThan30: string; - "WhyDidYouNotCollect-Other": string; - - //DefinitionOfPopulation - DefinitionOfSurveySample: string[]; - "DefinitionOfSurveySample-Other": string; - "DefinitionOfSurveySample-Changes": string; -} diff --git a/services/ui-src/src/measures/2024/CPCCH/validation.ts b/services/ui-src/src/measures/2024/CPCCH/validation.ts deleted file mode 100644 index 57faa3c97f..0000000000 --- a/services/ui-src/src/measures/2024/CPCCH/validation.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { FormData } from "./types"; -import { validateReasonForNotReporting } from "measures/2024/shared/globalValidations"; -import * as DC from "dataConstants"; - -const CPCCHValidation = (data: FormData) => { - let errorArray: any[] = []; - const whyDidYouNotCollect = data["WhyDidYouNotCollect"]; - - if (data["DidCollect"] === undefined) { - errorArray.push({ - errorLocation: "Did you collect this measure", - errorMessage: - "You must select at least one option for Did you collect this measure?", - }); - } - - if (data["DidCollect"] === DC.NO) { - errorArray = [...validateReasonForNotReporting(whyDidYouNotCollect, true)]; - return errorArray; - } - - return errorArray; -}; - -export const validationFunctions = [CPCCHValidation]; diff --git a/tests/cypress/cypress/e2e/a11y/CPCCHpage.spec.ts b/tests/cypress/cypress/e2e/a11y/CPCCHpage.spec.ts index d310f83820..bfe49f1bbf 100644 --- a/tests/cypress/cypress/e2e/a11y/CPCCHpage.spec.ts +++ b/tests/cypress/cypress/e2e/a11y/CPCCHpage.spec.ts @@ -5,7 +5,9 @@ describe("CPC-CH Page 508 Compliance Test", () => { cy.login(); cy.selectYear(testingYear); cy.goToChildCoreSetMeasures(); - cy.goToMeasure("CPC-CH"); + cy.get(`[data-cy="CPC-CH"]`, { timeout: 10000 }) + .should("be.visible") + .click(); cy.checkA11yOfPage(); }); }); diff --git a/tests/cypress/cypress/e2e/measures/child/CPCCH.spec.ts b/tests/cypress/cypress/e2e/measures/child/CPCCH.spec.ts deleted file mode 100644 index 6b02dc0a64..0000000000 --- a/tests/cypress/cypress/e2e/measures/child/CPCCH.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { testingYear } from "../../../../support/constants"; - -describe("OY2 9963 CPC CH", () => { - beforeEach(() => { - cy.login(); - cy.selectYear(testingYear); - cy.goToChildCoreSetMeasures(); - cy.goToMeasure("CPC-CH"); - }); - - it("If not collecting and not why not -> show error", () => { - cy.get('[data-cy="DidCollect1"]').click(); - cy.get('[data-cy="Validate Measure"]').click(); - cy.get( - '[data-cy="Why Are You Not Collecting On This Measure Error"]' - ).should("have.text", "Why Are You Not Collecting On This Measure Error"); - }); - - it("should show correct data source options", () => { - cy.get("#DataSource-CAHPS-Version-CAHPS\\ 5\\.1H").should( - "have.text", - "CAHPS 5.1H" - ); - cy.get("#DataSource-CAHPS-Version-Other").should("have.text", "Other"); - }); - - it("should show correct sections", () => { - cy.get( - '[data-cy="DataSource-Included-ItemSets0"] > .chakra-checkbox__label > .chakra-text' - ).should("have.text", "No Supplemental Item Sets were included"); - cy.get( - '[data-cy="DataSource-Included-ItemSets1"] > .chakra-checkbox__label > .chakra-text' - ).should( - "have.text", - "CAHPS Item Set for Children with Chronic Conditions" - ); - cy.get( - '[data-cy="DataSource-Included-ItemSets2"] > .chakra-checkbox__label > .chakra-text' - ).should("have.text", "Other CAHPS Item Set"); - cy.get("#DefinitionOfSurveySample-SurveySampleiIncludesCHIPOnly").should( - "have.text", - "Survey sample includes CHIP (Title XXI) population only" - ); - }); -}); diff --git a/tests/cypress/cypress/e2e/measures/child/QUALIFIERS_child.spec.ts b/tests/cypress/cypress/e2e/measures/child/QUALIFIERS_child.spec.ts index 7da1883f42..5cb3a4a591 100644 --- a/tests/cypress/cypress/e2e/measures/child/QUALIFIERS_child.spec.ts +++ b/tests/cypress/cypress/e2e/measures/child/QUALIFIERS_child.spec.ts @@ -97,9 +97,6 @@ describe("Child Measure Qualifier: CH", () => { cy.get( '[data-cy="CoreSetMeasuresAuditedOrValidatedDetails.0.MeasuresAuditedOrValidated-CIS-CH - Childhood Immunization Status"]' ).should("be.visible"); - cy.get( - '[data-cy="CoreSetMeasuresAuditedOrValidatedDetails.0.MeasuresAuditedOrValidated-CPC-CH - Consumer Assessment of Healthcare Providers and Systems (CAHPS®) Health Plan Survey 5.1H - Child Version Including Medicaid and Children with Chronic Conditions Supplemental Items"]' - ).should("be.visible"); cy.get( '[data-cy="CoreSetMeasuresAuditedOrValidatedDetails.0.MeasuresAuditedOrValidated-DEV-CH - Developmental Screening in the First Three Years of Life"]' ).should("be.visible");