Skip to content

Commit

Permalink
main merge
Browse files Browse the repository at this point in the history
  • Loading branch information
angelaco11 committed Dec 10, 2024
2 parents 11f8157 + 888ec4b commit 6492af1
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 13 deletions.
96 changes: 90 additions & 6 deletions services/app-api/forms/qm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const qmReportTemplate: ReportTemplate = {
childPageIds: [
"general-info",
"req-measure-result",
"strat-measure-result",
"optional-measure-result",
"review-submit",
],
},
Expand Down Expand Up @@ -106,14 +106,14 @@ export const qmReportTemplate: ReportTemplate = {
],
},
{
id: "strat-measure-result",
title: "Stratified Measure Results",
id: "optional-measure-result",
title: "Optional Measure Results",
type: PageType.Standard,
sidebar: true,
elements: [
{
type: ElementType.Header,
text: "Stratified Measure Results",
text: "Optional Measure Results",
},
{
type: ElementType.Accordion,
Expand All @@ -122,7 +122,7 @@ export const qmReportTemplate: ReportTemplate = {
},
{
type: ElementType.MeasureTable,
measureDisplay: "stratified",
measureDisplay: "optional",
},
],
},
Expand Down Expand Up @@ -155,8 +155,9 @@ export const qmReportTemplate: ReportTemplate = {
},
],
measureLookup: {
// TODO: wtf is default and are there any other kinds of measures?
// TODO: what is a default measure and are there any other kinds of measures?
defaultMeasures: [
// required measures
{
cmit: 960,
required: true,
Expand Down Expand Up @@ -187,6 +188,43 @@ export const qmReportTemplate: ReportTemplate = {
stratified: false,
measureTemplate: MeasureTemplateName["LTSS-8"],
},
// optional measures
{
cmit: 969,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName["FASI-1"],
},
{
cmit: 970,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName["FASI-2"],
},
{
cmit: 111,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName["HCBS-10"],
},
{
cmit: 963,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName["LTSS-3"],
},
{
cmit: 962,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName["LTSS-4"],
},
{
cmit: 1255,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName["LTSS-5"],
},
],
},
measureTemplates: {
Expand Down Expand Up @@ -309,5 +347,51 @@ export const qmReportTemplate: ReportTemplate = {
sidebar: false,
elements: [],
},
//optional
[MeasureTemplateName["FASI-1"]]: {
id: "FASI-1",
title: "FASI-1: Identification of Person-Centered Priorities",
type: PageType.Measure,
sidebar: false,
elements: [],
},
[MeasureTemplateName["FASI-2"]]: {
id: "FASI-2",
title: "FASI-2: Documentation of a Person-Centered Service Plan",
type: PageType.Measure,
sidebar: false,
elements: [],
},
[MeasureTemplateName["HCBS-10"]]: {
id: "HCBS-10",
title:
"HCBS-10: Self-direction of Services and Supports Among Medicaid Beneficiaries Receiving LTSS through Managed Care Organizations",
type: PageType.Measure,
sidebar: false,
elements: [],
},
[MeasureTemplateName["LTSS-3"]]: {
id: "LTSS-3",
title: "LTSS-3: Shared Person-Centered Plan with Primary Care Provider",
type: PageType.Measure,
sidebar: false,
elements: [],
},
[MeasureTemplateName["LTSS-4"]]: {
id: "LTSS-4",
title:
"LTSS-4: Reassessment and Person-Centered Plan Update after Inpatient Discharge",
type: PageType.Measure,
sidebar: false,
elements: [],
},
[MeasureTemplateName["LTSS-5"]]: {
id: "LTSS-5",
title:
"LTSS-5: Screening, Risk Assessment, and Plan of Care to Prevent Future Falls",
type: PageType.Measure,
sidebar: false,
elements: [],
},
} as Record<MeasureTemplateName, MeasurePageTemplate>,
};
8 changes: 8 additions & 0 deletions services/app-api/types/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ export interface MeasureOptions {
}

export enum MeasureTemplateName {
// required measures
"LTSS-1",
"LTSS-2",
"LTSS-6",
"LTSS-7",
"LTSS-8",
//optional measures
"FASI-1",
"FASI-2",
"HCBS-10",
"LTSS-3",
"LTSS-4",
"LTSS-5",
}

export enum ReportStatus {
Expand Down
1 change: 1 addition & 0 deletions services/ui-src/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export { Menu } from "./menus/Menu";
export { MenuOption } from "./menus/MenuOption";
// modals
export { Modal } from "./modals/Modal";
export { AddEditReportModal } from "./modals/AddEditReportModal";
// Redirects
export { PostLogoutRedirect } from "./PostLogoutRedirect/index";
// tables
Expand Down
63 changes: 63 additions & 0 deletions services/ui-src/src/components/modals/AddEditReportModal.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { render, screen } from "@testing-library/react";
import { axe } from "jest-axe";
import { AddEditReportModal } from "components";
import {
mockStateUserStore,
RouterWrappedComponent,
} from "utils/testing/setupJest";
import { useStore } from "utils";
import userEvent from "@testing-library/user-event";

const mockCloseHandler = jest.fn();
const mockReportHandler = jest.fn();

jest.mock("utils/state/useStore");
const mockedUseStore = useStore as jest.MockedFunction<typeof useStore>;

const modalComponent = (
<RouterWrappedComponent>
<AddEditReportModal
activeState="AB"
reportType={"QM"}
modalDisclosure={{
isOpen: true,
onClose: mockCloseHandler,
}}
reportHandler={mockReportHandler}
/>
</RouterWrappedComponent>
);

describe("Test AddEditProgramModal", () => {
beforeEach(() => {
mockedUseStore.mockReturnValue(mockStateUserStore);
render(modalComponent);
});

afterEach(() => {
jest.clearAllMocks();
});

test("AddEditReportModal shows the contents", () => {
expect(screen.getByText("QMS report name")).toBeInTheDocument();
expect(screen.getByText("Start new")).toBeInTheDocument();
});

test("AddEditReportModal top close button can be clicked", async () => {
await userEvent.click(screen.getByText("Close"));
expect(mockCloseHandler).toHaveBeenCalledTimes(1);
});

test("AddEditReportModal bottom cancel button can be clicked", async () => {
await userEvent.click(screen.getByText("Cancel"));
expect(mockCloseHandler).toHaveBeenCalledTimes(1);
});
});

describe("Test AddEditReportModal accessibility", () => {
it("Should not have basic accessibility issues", async () => {
const { container } = render(modalComponent);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
78 changes: 78 additions & 0 deletions services/ui-src/src/components/modals/AddEditReportModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { useState } from "react";
import { Modal, TextField } from "components";
import { Spinner, Flex } from "@chakra-ui/react";
import { AnyObject, ElementType } from "types";
import { createReport } from "utils/api/requestMethods/report";
import { FormProvider, useForm } from "react-hook-form";
import { ReportOptions } from "types/report";

export const AddEditReportModal = ({
activeState,
reportType,
modalDisclosure,
reportHandler,
}: Props) => {
const [submitting, setSubmitting] = useState<boolean>(false);

// add validation to formJson
const form = useForm();

const onSubmit = async (formData: any) => {
setSubmitting(true);

const reportOptions: ReportOptions = {
name: "",
};

if (formData.reportTitle) {
reportOptions.name = formData.reportTitle.answer;
}

await createReport(reportType, activeState, reportOptions);

await reportHandler(reportType, activeState);
setSubmitting(false);
modalDisclosure.onClose();
};

return (
<Modal
data-testid="add-edit-report-modal"
formId="addEditReportModal"
modalDisclosure={modalDisclosure}
content={{
heading: "Add new Quality Measure Set Report",
subheading: "",
actionButtonText: submitting ? <Spinner size="md" /> : "Start new",
closeButtonText: "Cancel",
}}
>
<FormProvider {...form}>
<form id="addEditReportModal" onSubmit={form.handleSubmit(onSubmit)}>
<Flex>
<TextField
element={{
type: ElementType.Textbox,
label: "QMS report name",
helperText:
"Name this QMS report so you can easily refer to it. Consider using timeframe(s).",
}}
formkey={"reportTitle"}
></TextField>
</Flex>
</form>
</FormProvider>
</Modal>
);
};

interface Props {
activeState: string;
reportType: string;
selectedReport?: AnyObject;
modalDisclosure: {
isOpen: boolean;
onClose: any;
};
reportHandler: (reportType: string, activeState: string) => void;
}
1 change: 1 addition & 0 deletions services/ui-src/src/components/modals/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const sx = {
},
modalHeader: {
padding: "0",
margin: "0 0 2rem 0",
},
modalHeaderText: {
padding: "0 4rem 0 0",
Expand Down
Loading

0 comments on commit 6492af1

Please sign in to comment.