Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional Analysis Methods #11994

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8dd887c
fix some validation that was removing fields, and only add applicable…
gmrabian Jan 2, 2025
f587295
wip analysis methods page
gmrabian Jan 2, 2025
cc8bd87
Merge branch 'main' into cmdct-4115
gmrabian Jan 3, 2025
6d1bdc4
add statusing and ensure data saves
gmrabian Jan 3, 2025
b3c7481
analysis methods without add or delete functionality
britt-mo Jan 3, 2025
db1aef0
add button and new drawer
britt-mo Jan 3, 2025
b4c14e9
remove addEntityDrawerForm
britt-mo Jan 3, 2025
4066870
Merge branch 'main' into cmdct-4115
gmrabian Jan 6, 2025
afe9e41
add tests for naaar report and drawer page
gmrabian Jan 6, 2025
84c85ab
fix typo
JonHolman Jan 6, 2025
1ca1ba7
fix typo
JonHolman Jan 6, 2025
13fd021
avoid retroactive changes to other drawer pages
gmrabian Jan 6, 2025
40916c7
Merge branch 'cmdct-4115' into cmdct-4115-cont
gmrabian Jan 6, 2025
a18b70c
include add analysis method form
gmrabian Jan 6, 2025
0217dfd
const instead of let
gmrabian Jan 6, 2025
718098d
Merge branch 'cmdct-4115' into cmdct-4115-cont
gmrabian Jan 6, 2025
7aa97ac
wip add additional methods
gmrabian Jan 6, 2025
9ca04e0
merge main
gmrabian Jan 6, 2025
b8c502a
the uggo is temporary
gmrabian Jan 7, 2025
aaefe1d
fix button text and styling
gmrabian Jan 7, 2025
018023a
fix statusing and display
gmrabian Jan 7, 2025
4fd7a7d
blob-sweats
gmrabian Jan 7, 2025
936bfd3
pr feedback
gmrabian Jan 7, 2025
d0b9605
minor nits
JonHolman Jan 7, 2025
f69cffa
update display text
gmrabian Jan 8, 2025
83e769d
add tests
gmrabian Jan 8, 2025
bc66812
fix plan display spacing
gmrabian Jan 9, 2025
30900fc
add styling to table header
gmrabian Jan 9, 2025
e5c3e28
move dashboard title styling to frontend
gmrabian Jan 9, 2025
83e2803
design feedback
gmrabian Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 117 additions & 9 deletions services/app-api/forms/naaar.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,20 +284,12 @@
}
]
},
"dashboardTitle": "",
"dashboardTitle": "<div style=\"margin-left: 3rem;\">Analysis method <br/> Frequency and plan utilization</div>",
gmrabian marked this conversation as resolved.
Show resolved Hide resolved
"addEntityButtonText": "Add other analysis method",
"editEntityButtonText": "",
"readOnlyEntityButtonText": "",
"tableHeader": "Analysis method <br/> Frequency and plan utilization",
"addEditModalAddTitle": "Analysis method: Add other",
"addEditModalEditTitle": "Analysis method: Edit other",
"deleteEntityButtonAltText": "Delete other analysis method",
"deleteModalTitle": "Are you sure you want to delete this analysis method?",
"deleteModalConfirmButtonText": "Yes, delete method",
"deleteModalWarning": "Are you sure you want to proceed? You will lose all information entered for this analysis method in the NAAAR. The method will remain in previously submitted NAAAR reports if applicable.",
"entityUnfinishedMessage": "Complete the remaining indicators for this access measure by entering details.",
"enterEntityDetailsButtonText": "Enter",
"readOnlyEntityDetailsButtonText": "View",
"drawerTitle": "Analysis method: "
},
"drawerForm": {
Expand Down Expand Up @@ -390,6 +382,15 @@
{
"id": "tvCUw5CcaGUFSIMByAopjF",
"label": "Fill in plans here"
},
{
"id": "tvCUw5CcaGUFSIMByAopjA",
"label": "Second plan"
}
,
{
"id": "tvCUw5CcaGUFSIMByAopjB",
"label": "Third plan with the absolutest most longest name you ever did see in a plan like this one"
}
]
}
Expand All @@ -400,6 +401,113 @@
}
}
]
},
"addEntityDrawerForm": {
"id": "iamnew",
"fields": [
{
"id": "custom_analysis_method_name",
"type": "text",
"validation": "text",
"props": {
"label": "Analysis method",
"hint": "Enter an analysis method utilized to assess plan compliance with the state’s 42 C.F.R. § 438.68 and 42 C.F.R. § 438.206 standards that is not already listed in the system."
}
},
{
"id": "custom_analysis_method_description",
"type": "textarea",
"validation": "textarea",
"props": {
"label": "Analysis method description",
"hint": "Describe the method."
}
},
{
"id": "analysis_method_frequency",
"type": "radio",
"validation": {
"type": "radio",
"nested": true,
"parentFieldName": "analysis_applicable"
},
"props": {
"label": "Frequency of analysis",
"choices": [
{
"id": "Sol1W6HJCixyOVxw4vDgXQ",
"label": "Weekly"
},
{
"id": "YjI3qT3Ml9cZfP4a1RV6G9",
"label": "Bi-weekly"
},
{
"id": "L8q1N1DXEYv8LsDfGkdbOe",
"label": "Monthly"
},
{
"id": "05ThR4UN7kYDGpKaTWESOB",
"label": "Bi-monthly"
},
{
"id": "Y0Rkz7e3Kkxw0T4aFDb38j",
"label": "Quarterly"
},
{
"id": "mcn99pzTOqnEmr3uXiEOYs",
"label": "Semi-annually"
},
{
"id": "r938vpeMJxkPOqk53N7qW0",
"label": "Other, specify",
"children": [
{
"id": "analysis_method_frequency-otherText",
"type": "textarea",
"validation": {
"type": "text",
"nested": true,
"parentFieldName": "analysis_method_frequency"
}
}
]
},
{
"id": "WkqIis4bGGtK8Nzzqa6rPl",
"label": "Varies by plan"
}
]
}
},
{
"id": "analysis_method_applicable_plans",
"type": "checkbox",
"validation": {
"type": "checkbox",
"nested": true,
"parentFieldName": "analysis_applicable"
},
"props": {
"label": "Plans utilizing this method",
"choices": [
{
"id": "tvCUw5CcaGUFSIMByAopjF",
"label": "Fill in plans here"
},
{
"id": "tvCUw5CcaGUFSIMByAopjA",
"label": "Second plan"
}
,
{
"id": "tvCUw5CcaGUFSIMByAopjB",
"label": "Third plan with the absolutest most longest name you ever did see in a plan like this one"
}
]
}
}
]
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions services/app-api/utils/types/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface DrawerReportPageShape extends ReportPageShapeBase {
entityType: string;
verbiage: DrawerReportPageVerbiage;
drawerForm: FormJson;
addEntityDrawerForm?: FormJson;
modalForm?: never;
overlayForm?: never;
form?: never;
Expand Down Expand Up @@ -115,6 +116,7 @@ export interface DrawerReportPageVerbiage extends ReportPageVerbiage {
dashboardTitle: string;
countEntitiesInTitle?: boolean;
drawerTitle: string;
addEntityButtonText?: string;
drawerInfo?: CustomHtmlElement[];
missingEntityMessage?: CustomHtmlElement[];
missingIlosMessage?: CustomHtmlElement[];
Expand Down
Binary file added services/ui-src/src/assets/icons/icon_add_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
162 changes: 161 additions & 1 deletion services/ui-src/src/components/reports/DrawerReportPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ import {
mockEntityStore,
mockVerbiageIntro,
mockDrawerForm,
mockNaaarReportStore,
mockNaaarReportContext,
} from "utils/testing/setupJest";
// constants
import { saveAndCloseText } from "../../constants";
import { DEFAULT_ANALYSIS_METHODS, saveAndCloseText } from "../../constants";
// types
import { McrEntityState } from "types";

const mockUseNavigate = jest.fn();
jest.mock("react-router-dom", () => ({
Expand Down Expand Up @@ -306,6 +310,162 @@ describe("Test DrawerReportPage with completed entity", () => {
});
});

describe("Test DrawerReportPage with custom entities", () => {
afterEach(() => {
jest.clearAllMocks();
});
const mockAnalysisMethodEntityStore: McrEntityState = {
entities: [],
entityType: "analysisMethods",
selectedEntity: {
id: "k9t7YoOeTOAXX3s7qF6XfN33",
name: "Geomapping",
isRequired: true,
},
// ACTIONS
setSelectedEntity: () => {},
setEntityType: () => {},
setEntities: () => {},
};
const mockAnalysisMethodsReportPageJson = {
name: "mock-route",
path: "/naaar/analysis-methods",
pageType: "drawer",
entityType: "analysisMethods",
verbiage: {
intro: mockVerbiageIntro,
dashboardTitle: "Mock dashboard title",
drawerTitle: "Mock drawer title",
addEntityButtonText: "Add other analysis method",
},
drawerForm: {
id: "am",
fields: [
{
id: "am_default_text",
type: "text",
validation: "text",
props: {
label: "Fill in info on analysis method",
},
},
],
},
addEntityDrawerForm: {
id: "am_custom",
fields: [
{
id: "am_custom_text",
type: "text",
validation: "text",
props: {
label: "Fill in info on custom analysis method",
},
},
],
},
};

const mockNaaarReportContextWithAnalysisMethods: any = mockNaaarReportContext;
mockNaaarReportContextWithAnalysisMethods.report.fieldData[
"analysisMethods"
] = [DEFAULT_ANALYSIS_METHODS[0]];

const mockCustomNaaarReportStore = {
...mockNaaarReportStore,
report: mockNaaarReportContextWithAnalysisMethods.report,
reportsByState: [mockNaaarReportContextWithAnalysisMethods.report],
};
const drawerReportPageWithCustomEntities = (
<RouterWrappedComponent>
<ReportContext.Provider value={mockNaaarReportContextWithAnalysisMethods}>
<DrawerReportPage route={mockAnalysisMethodsReportPageJson} />
</ReportContext.Provider>
</RouterWrappedComponent>
);
it("Can enter default analysis method drawer", async () => {
mockedUseStore.mockReturnValue({
...mockStateUserStore,
...mockCustomNaaarReportStore,
...mockAnalysisMethodEntityStore,
});

render(drawerReportPageWithCustomEntities);
const enterDefaultMethod = screen.getAllByText("Enter")[0];
await userEvent.click(enterDefaultMethod);
expect(screen.getByRole("dialog")).toBeVisible();
const textField = await screen.getByLabelText(
"Fill in info on analysis method"
);
expect(textField).toBeVisible();
});

it("Can enter custom analysis method drawer and fill out form", async () => {
const mockAnalysisMethodNoSelectedEntityStore =
mockAnalysisMethodEntityStore;
mockAnalysisMethodNoSelectedEntityStore.selectedEntity = undefined;
mockedUseStore.mockReturnValue({
...mockStateUserStore,
...mockCustomNaaarReportStore,
...mockAnalysisMethodNoSelectedEntityStore,
});

render(drawerReportPageWithCustomEntities);
const addCustomMethod = screen.getByText("Add other analysis method");
await userEvent.click(addCustomMethod);
expect(screen.getByRole("dialog")).toBeVisible();
const customTextField = await screen.getByLabelText(
"Fill in info on custom analysis method"
);
expect(customTextField).toBeVisible();
await userEvent.type(customTextField, "new analysis method");
const saveCustomMethod = screen.getByText("Save & close");
await userEvent.click(saveCustomMethod);
const enterDefaultMethod = screen.getAllByText("Enter")[0];
expect(enterDefaultMethod).toBeVisible();
});

it("Can shows statusing for custom analysis methods", async () => {
const mockNaaarReportContextWithCustomAnalysisMethods: any =
mockNaaarReportContext;
mockNaaarReportContextWithCustomAnalysisMethods.report.fieldData[
"analysisMethods"
] = [
DEFAULT_ANALYSIS_METHODS[0],
{
id: "custom_entity",
name: "custom entity",
},
];

const mockCustomNaaarReportStore = {
...mockNaaarReportStore,
report: mockNaaarReportContextWithCustomAnalysisMethods.report,
reportsByState: [mockNaaarReportContextWithCustomAnalysisMethods.report],
};

mockedUseStore.mockReturnValue({
...mockStateUserStore,
...mockCustomNaaarReportStore,
...mockAnalysisMethodEntityStore,
});

const drawerReportPageWithCustomEntities = (
<RouterWrappedComponent>
<ReportContext.Provider
value={mockNaaarReportContextWithCustomAnalysisMethods}
>
<DrawerReportPage route={mockAnalysisMethodsReportPageJson} />
</ReportContext.Provider>
</RouterWrappedComponent>
);

render(drawerReportPageWithCustomEntities);
const iconAltText = screen.getAllByAltText("Entity is incomplete");
expect(iconAltText.length).toBeGreaterThan(0);
});
});

describe("Test DrawerReportPage accessibility", () => {
it("Should not have basic accessibility issues", async () => {
mockedUseStore.mockReturnValue({
Expand Down
Loading
Loading