Skip to content

Commit

Permalink
main merge
Browse files Browse the repository at this point in the history
  • Loading branch information
angelaco11 committed Dec 5, 2024
2 parents 6b9ebe5 + afb4423 commit c490524
Show file tree
Hide file tree
Showing 19 changed files with 458 additions and 74 deletions.
29 changes: 14 additions & 15 deletions services/app-api/forms/cmit.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { CMIT } from "../types/reports";
import { DataSource, DeliverySystem } from "../utils/constants";
import {
DataSource,
DeliverySystem,
MeasureSpecification,
} from "../utils/constants";

export const CMIT_LIST: CMIT[] = [
{
cmit: 111,
name: "my measure",
uid: "abc",
options: "",
deliverySystem: [DeliverySystem.FFS, DeliverySystem.MLTSS],
cmit: 960,
name: "LTSS-1: Comprehensive Assessment and Update",
uid: "960",
measureSteward: "CMS",
dataSource: DataSource.Administrative,
},
{
cmit: 222,
name: "another measure",
uid: "cde",
measureSpecification: [
MeasureSpecification.CMS,
MeasureSpecification.HEDIS,
],
deliverySystem: [DeliverySystem.FFS, DeliverySystem.MLTSS],
dataSource: DataSource.Hybrid,
options: "",
deliverySystem: [DeliverySystem.FFS],
measureSteward: "CMS",
dataSource: DataSource.Administrative,
},
];
86 changes: 61 additions & 25 deletions services/app-api/forms/qm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ElementType,
ReportType,
MeasureTemplateName,
MeasurePageTemplate,
} from "../types/reports";

export const qmReportTemplate: ReportTemplate = {
Expand Down Expand Up @@ -186,24 +187,19 @@ export const qmReportTemplate: ReportTemplate = {
stratified: false,
measureTemplate: MeasureTemplateName["LTSS-8"],
},
{
cmit: 234,
required: false,
stratified: false,
measureTemplate: MeasureTemplateName.StandardMeasure,
},
],
},
measureTemplates: {
[MeasureTemplateName.StandardMeasure]: {
id: "req-measure-report",
title: "Example Measure",
[MeasureTemplateName["LTSS-1"]]: {
id: "LTSS-1",
title: "LTSS-1: Comprehensive Assessment and Update",
type: PageType.Measure,
substitutable: true,
sidebar: false,
elements: [
{
type: ElementType.ButtonLink,
label: "Return to Required Measures Results Dashboard",
label: "Return to Required Measures Dashboard",
to: "req-measure-result",
},
{
Expand All @@ -218,32 +214,72 @@ export const qmReportTemplate: ReportTemplate = {
},
{
type: ElementType.SubHeader,
text: "Measure Information",
text: "Measure Details",
},
{
type: ElementType.Textbox,
type: ElementType.Radio,
label: "Were the reported measure results audited or validated?",
value: [
{ label: "No, I am reporting on this measure", value: "no" },
{
label: "Yes, CMS is reporting on my behalf",
value: "yes",
checkedChildren: [
{
type: ElementType.Textbox,
label:
"What is the name of the agency of entity that audited or validated the report?",
},
],
},
],
},
{
type: ElementType.Radio,
label:
"What is the state performance target for this measure established by the state?",
"What Technical Specifications are you using to report this measure?",
value: [
{ label: "CMS", value: "cms" },
{ label: "HEDIS", value: "hedis" },
],
},
{
type: ElementType.Radio,
label: "Is the performance target approved by CMS?",
label:
"Did you deviate from the [reportYear] Technical Specifications?",
value: [
{ label: "Yes", value: "yes" },
{ label: "No", value: "no" },
{ label: "In process", value: "inProcess" },
{
label: "Yes",
value: "yes",
checkedChildren: [
{
type: ElementType.Textbox,
label: "Please explain the deviation.",
},
],
},
],
},
{
type: ElementType.Radio,
label: "Which delivery systems were used to report the LTSS measure?",
value: [
{ label: "Managed Care", value: "managed-care" },
{ label: "Free-For-Service", value: "fee-for-service" },
{ label: "Both", value: "both" },
],
},
{
type: ElementType.SubHeader,
text: "Quality Measures",
},
{
type: ElementType.QualityMeasureTable,
measureDisplay: "quality",
},
],
},
[MeasureTemplateName["LTSS-1"]]: {
id: "LTSS-1",
title: "LTSS-1: Comprehensive Assessment and Update",
type: PageType.Measure,
substitutable: true,
sidebar: false,
elements: [],
},
[MeasureTemplateName["LTSS-2"]]: {
id: "LTSS-2",
title: "LTSS-2: Comprehensive Person-Centered Plan and Update",
Expand Down Expand Up @@ -273,5 +309,5 @@ export const qmReportTemplate: ReportTemplate = {
sidebar: false,
elements: [],
},
},
} as Record<MeasureTemplateName, MeasurePageTemplate>,
};
18 changes: 18 additions & 0 deletions services/app-api/handlers/reports/buildReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import KSUID from "ksuid";
import { qmReportTemplate } from "../../forms/qm";
import { putReport } from "../../storage/reports";
import {
ElementType,
PageElement,
Report,
ReportStatus,
ReportOptions,
ReportType,
} from "../../types/reports";
import { User } from "../../types/types";
import { CMIT_LIST } from "../../forms/cmit";

const reportTemplates = {
[ReportType.QM]: qmReportTemplate,
Expand Down Expand Up @@ -49,6 +52,11 @@ export const buildReport = async (
page.id += measure.cmit; // TODO this will need some logic if a measure is substituted
page.stratified = measure.stratified;
page.required = measure.required;
page.elements = [
...page.elements.map((element) =>
findAndReplace(element, measure.cmit)
),
];
// TODO: let the parent know what it relates to
return page;
});
Expand All @@ -60,3 +68,13 @@ export const buildReport = async (
await putReport(report);
return report;
};

export const findAndReplace = (element: PageElement, cmit: number) => {
const cmitInfo = CMIT_LIST.find((list) => list.cmit === cmit);
if (cmitInfo) {
if (element.type === ElementType.Header) {
element.text = element.text.replace("{measureName}", cmitInfo.name);
}
}
return element;
};
18 changes: 16 additions & 2 deletions services/app-api/types/reports.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Templates

import { DataSource, DeliverySystem } from "../utils/constants";
import {
DataSource,
DeliverySystem,
MeasureSpecification,
} from "../utils/constants";

export enum ReportType {
QM = "QM",
Expand All @@ -20,6 +24,7 @@ export interface CMIT {
options: string;
deliverySystem: DeliverySystem[];
measureSteward: string;
measureSpecification: MeasureSpecification[];
dataSource: DataSource;
}

Expand All @@ -31,7 +36,6 @@ export interface MeasureOptions {
}

export enum MeasureTemplateName {
StandardMeasure,
"LTSS-1",
"LTSS-2",
"LTSS-6",
Expand Down Expand Up @@ -156,6 +160,7 @@ export enum ElementType {
Radio = "radio",
ButtonLink = "buttonLink",
MeasureTable = "measureTable",
QualityMeasureTable = "qualityMeasureTable",
StatusTable = "statusTable",
}

Expand All @@ -170,6 +175,7 @@ export type PageElement =
| RadioTemplate
| ButtonLinkTemplate
| MeasureTableTemplate
| QualityMeasureTableTemplate
| StatusTableTemplate;

export type HeaderTemplate = {
Expand Down Expand Up @@ -221,6 +227,7 @@ export const isResultRowButton = (
export type RadioTemplate = {
type: ElementType.Radio;
label: string;
helperText?: string;
value: ChoiceTemplate[];
};

Expand All @@ -233,13 +240,20 @@ export type ButtonLinkTemplate = {
export type ChoiceTemplate = {
label: string;
value: string;
checked?: boolean;
checkedChildren?: PageElement[];
};

export type MeasureTableTemplate = {
type: ElementType.MeasureTable;
measureDisplay: "required" | "stratified" | "optional";
};

export type QualityMeasureTableTemplate = {
type: ElementType.QualityMeasureTable;
measureDisplay: "quality";
};

export type StatusTableTemplate = {
type: ElementType.StatusTable;
to: PageId;
Expand Down
6 changes: 6 additions & 0 deletions services/app-api/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ export enum DeliverySystem {
export enum DataSource {
CaseRecordManagement = "CaseRecordManagement",
Administrative = "Administrative",
Hybrid = "Hybrid",
}

export enum MeasureSteward {
CMS = "CMS",
}

export enum MeasureSpecification {
CMS = "CMS",
HEDIS = "HEDIS",
}

export enum StateNames {
AL = "Alabama",
AK = "Alaska",
Expand Down
17 changes: 17 additions & 0 deletions services/ui-src/src/cmit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { CMIT, DeliverySystem, DataSource, MeasureSpecification } from "types";

export const CMIT_LIST: CMIT[] = [
{
cmit: 960,
name: "LTSS-1: Comprehensive Assessment and Update",
uid: "960",
measureSteward: "CMS",
measureSpecification: [
MeasureSpecification.CMS,
MeasureSpecification.HEDIS,
],
deliverySystem: [DeliverySystem.FFS, DeliverySystem.MLTSS],
dataSource: DataSource.Hybrid,
options: "",
},
];
19 changes: 18 additions & 1 deletion services/ui-src/src/components/fields/RadioField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { RadioField } from "components";
import { useFormContext } from "react-hook-form";
import { PageElement } from "types";
import { ElementType, PageElement } from "types";
import { testA11y } from "utils/testing/commonTests";

const mockTrigger = jest.fn();
Expand Down Expand Up @@ -37,6 +37,12 @@ const mockRadioElement = {
{
label: "Choice 2",
value: "B",
checkedChildren: [
{
type: ElementType.Textbox,
label: "mock-text-box",
},
],
checked: false,
},
{
Expand Down Expand Up @@ -75,6 +81,17 @@ describe("<RadioField />", () => {
});
});

test("RadioField displays children fields after selection", async () => {
mockGetValues(undefined);
render(RadioFieldComponent);
const firstRadio = screen.getByLabelText("Choice 2") as HTMLInputElement;
await userEvent.click(firstRadio);
expect(mockSetValue).toHaveBeenCalledWith("elements.0.answer", "B", {
shouldValidate: true,
});
expect(screen.getByLabelText("mock-text-box")).toBeInTheDocument();
});

testA11y(RadioFieldComponent, () => {
mockGetValues(undefined);
});
Expand Down
Loading

0 comments on commit c490524

Please sign in to comment.