Skip to content

Commit

Permalink
feat(init waiver): init waiver submission forms (#361)
Browse files Browse the repository at this point in the history
* initial commit

* fix type error in new/test form

* add additional plan type and modify test form

* conditionally run different queries

run different queries based on the authority (waiver, spa, chip, etc)

* add to the query for waivers

this should set one of the dropdown fields in seatool which is mapped to the type table in the db

* let's see

* fix sql formatting issue

* remove and comment out queries

the type and sub-type queries will be important in PI 3 when we have more understanding

* add a form

* fix type errors and add placeholder forms

* stuff for the initial form

* add breadcrumb nav for capitated waivers 1915b specifically

* add additional forms and setup breadcrumbs for contracting forms

* update waiver contracting initial form

* update waiver forms

* ammend in not a word

* update waiver renewal form

* write initial capitated waiver for to seatool

* update contracting initial

* reset to master

* change waivernumber to id cap-initial

* update ammendment

* add 1915b to allowed plan types

* add waiver renewal form for contracting

* make capitated waiver ammendment work for now

* take some things out and finish a form

* experimenting

* lay the groundwork for waiver actions

* finish look and feel of issue rai

* add contracting waiver ammendment

* Move around some components (making this more scoped to the feature of waiver package actions)

* make things make sense

* Come up with a reusable hook for package actions on waivers

* remove package action stuff and use a different branch for that

* Try/Catch for the sink... essentially ignoring malformed test records, where the key was undefined

* adding try catch for changelog...

* Condense getAvailableActions using an OR

* Re-enable existing id check on medicaid and chip spas

* Enable spa id checks for waivers

* revert back to how we were determining state, since all records should have an ID

* AC Fixes

* whoops

* Lint

* typos

* spacing

* typos and crumbs

* Correct regex for ids

* add initial intake needd to waviers

* make additional info optional

* Add Waiver Authority to the details page for waivers only

* only allow approved original numbers

* Fix typo in form causing submission failure

* Enforce the 01+ rule

* pass around actiontype

* add action type support yut

* Fix attachment labels

* Super refine

---------

Co-authored-by: Benjamin Paige <[email protected]>
Co-authored-by: Mike Dial <[email protected]>
  • Loading branch information
3 people authored Feb 8, 2024
1 parent 3406a9b commit ef8e91e
Show file tree
Hide file tree
Showing 27 changed files with 1,903 additions and 42 deletions.
1 change: 1 addition & 0 deletions src/packages/shared-types/action-types/new-submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { attachmentSchema } from "../attachments";
// This is the event schema for ne submissions from our system
export const onemacSchema = z.object({
authority: z.string(),
seaActionType: z.string().optional(), // Used by waivers.
origin: z.string(),
additionalInformation: z.string().nullable().default(null),
submitterName: z.string(),
Expand Down
10 changes: 10 additions & 0 deletions src/packages/shared-types/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ export const attachmentTitleMap: Record<string, string> = {
other: "Other",
// RAI WITHDRAW
supportingDocumentation: "Supporting Documentation",
bCapWaiverApplication:
"1915(b) Comprehensive (Capitated) Waiver Application Pre-print",
bCapCostSpreadsheets:
"1915(b) Comprehensive (Capitated) Waiver Cost Effectiveness Spreadsheets",
bCapIndependentAssessment:
"1915(b) Comprehensive (Capitated) Waiver Independent Assessment",
b4WaiverApplication:
"1915(b)(4) FFS Selective Contracting (Streamlined) Waiver Application Pre-print",
b4IndependentAssessment:
"1915(b)(4) FFS Selective Contracting (Streamlined) Independent Assessment",
};
export type AttachmentKey = keyof typeof attachmentTitleMap;
export type AttachmentTitle = typeof attachmentTitleMap[AttachmentKey];
Expand Down
3 changes: 3 additions & 0 deletions src/packages/shared-types/planType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export enum PlanType {
MED_SPA = "medicaid spa",
CHIP_SPA = "chip spa",
WAIVER = "waiver",
"1915b" = "1915(b)",
"1915c" = "1915(c)",
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export const getAvailableActions = (
result: opensearch.main.Document
) => {
const checks = PackageCheck(result);
return checks.isSpa
? rules.filter((r) => r.check(checks, user)).map((r) => r.action)
: [];
return [
...((checks.isWaiver || checks.isSpa)
? rules.filter((r) => r.check(checks, user)).map((r) => r.action)
: []),
];
};
2 changes: 1 addition & 1 deletion src/packages/shared-utils/packageCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const PackageCheck = ({
}: opensearch.main.Document) => {
const planChecks = {
isSpa: checkPlan(planType, [PlanType.MED_SPA, PlanType.CHIP_SPA]),
isWaiver: checkPlan(planType, []),
isWaiver: checkPlan(planType, [PlanType["1915b"]]),
/** Keep excess methods to a minimum with `is` **/
planTypeIs: (validPlanTypes: PlanType[]) =>
checkPlan(planType, validPlanTypes),
Expand Down
31 changes: 25 additions & 6 deletions src/services/api/handlers/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ const config = {
} as sql.config;

import { Kafka, Message } from "kafkajs";
import { PlanType, onemacSchema, transformOnemac } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "shared-utils";
import { PlanType, onemacSchema } from "shared-types";
import { getNextBusinessDayTimestamp, seaToolFriendlyTimestamp } from "shared-utils";
import { buildStatusMemoQuery } from "../libs/statusMemo";

const kafka = new Kafka({
Expand Down Expand Up @@ -55,7 +52,11 @@ export const submit = async (event: APIGatewayEvent) => {
});
}

const activeSubmissionTypes = [PlanType.CHIP_SPA, PlanType.MED_SPA];
const activeSubmissionTypes = [
PlanType.CHIP_SPA,
PlanType.MED_SPA,
PlanType["1915b"],
];
if (!activeSubmissionTypes.includes(body.authority)) {
return response({
statusCode: 400,
Expand Down Expand Up @@ -88,6 +89,24 @@ export const submit = async (event: APIGatewayEvent) => {

const result = await sql.query(query);
console.log(result);
if (body.authority == PlanType["1915b"]) {
const actionTypeQuery = `
UPDATE SEA.dbo.State_Plan
SET Action_Type = (
SELECT Action_ID
FROM SEA.dbo.Action_Types
WHERE Action_Name = '${body.seaActionType}'
AND Plan_Type_ID = (
SELECT Plan_Type_ID
FROM SEA.dbo.Plan_Types
WHERE Plan_Type_Name = '${body.authority}'
)
)
WHERE ID_Number = '${body.id}'
`;
const actionTypeQueryResult = await sql.query(actionTypeQuery);
console.log(actionTypeQueryResult);
}

const statusMemoUpdate = await sql.query(
buildStatusMemoQuery(body.id, "Package Submitted")
Expand Down
11 changes: 10 additions & 1 deletion src/services/ui/src/api/useGetItem.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
import { API } from "aws-amplify";
import { opensearch, ReactQueryApiError } from "shared-types";
import { opensearch, ReactQueryApiError, SEATOOL_STATUS } from "shared-types";

export const getItem = async (
id: string
Expand All @@ -16,6 +16,15 @@ export const idIsUnique = async (id: string) => {
}
};

export const idIsApproved = async (id: string) => {
try {
const record = await getItem(id);
return record._source.seatoolStatus == SEATOOL_STATUS.APPROVED;
} catch (e) {
return false;
}
};

export const useGetItem = (
id: string,
options?: UseQueryOptions<opensearch.main.ItemResult, ReactQueryApiError>
Expand Down
3 changes: 2 additions & 1 deletion src/services/ui/src/components/BreadCrumb/BreadCrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from "react-router-dom";
import { type ReactNode } from "react";
import { ChevronRight } from "lucide-react";
import { Route } from "../Routing/types";

type BreadCrumbsProps = {
options: BreadCrumbConfig[];
Expand Down Expand Up @@ -57,7 +58,7 @@ export const BreadCrumb = ({
children,
}: React.PropsWithChildren<BreadCrumbProps>) => {
return (
<li className="flex items-center">
<li className="flex items-center text-sm">
{showSeperator && <span>{seperator}</span>}

{active && (
Expand Down
4 changes: 2 additions & 2 deletions src/services/ui/src/components/Cards/SectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const SectionCard: FC<SectionCardProps> = ({
className,
}: SectionCardProps) => {
return (
<div className={cn("border-2 border-slate-300 w-5/6 p-4", className)}>
<div className={cn("border-2 border-slate-300 p-4", className)}>
<section>
<h1 className="font-bold text-2xl">{title}</h1>
<h2 className="font-bold text-2xl">{title}</h2>
<div className="border-t-2 border-slate-300 w-full mt-2 mb-4" />
<div className="gap-8 flex flex-col">{children}</div>
</section>
Expand Down
12 changes: 12 additions & 0 deletions src/services/ui/src/components/Routing/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ export const WAIVER_SUBMISSION_OPTIONS = "/new-submission/waiver";
export const B_WAIVER_SUBMISSION_OPTIONS = "/new-submission/waiver/b";
export const B4_WAIVER_OPTIONS = "/new-submission/waiver/b/b4";
export const BCAP_WAIVER_OPTIONS = "/new-submission/waiver/b/capitated";
export const WAIVER_1915_B_AMEND_CAP =
"/new-submission/waiver/b/capitated/amend/create";
export const WAIVER_1915_B_RENEWAL_CAP =
"/new-submission/waiver/b/capitated/renewal/create";
export const WAIVER_1915_B_INITIAL_CAP =
"/new-submission/waiver/b/capitated/initial/create";
export const WAIVER_1915_B_INITIAL_CON =
"/new-submission/waiver/b/b4/initial/create";
export const WAIVER_1915_B_AMEND_CON =
"/new-submission/waiver/b/b4/amendment/create";
export const WAIVER_1915_B_RENEWAL_CON =
"/new-submission/waiver/b/b4/renewal/create";
export const MEDICAID_ABP_LANDING =
"/new-submission/spa/medicaid/landing/medicaid-abp";
export const MEDICAID_ELIGIBILITY_LANDING =
Expand Down
12 changes: 6 additions & 6 deletions src/services/ui/src/pages/create/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,36 +107,36 @@ export const B4_WAIVER_OPTIONS: OptionData[] = [
title: "1915(b)(4) FFS Selective Contracting New Initial Waiver",
description:
"Create a new 1915(b)(4) FFS Selective Contracting Initial Waiver",
linkTo: "/dashboard",
linkTo: "/new-submission/waiver/b/b4/initial/create",
},
{
title: "1915(b)(4) FFS Selective Contracting Renewal Waiver",
description:
"Renew an existing 1915(b)(4) FFS Selective Contracting Waiver",
linkTo: "/dashboard",
linkTo: "/new-submission/waiver/b/b4/renewal/create",
},
{
title: "1915(b)(4) FFS Selective Contracting Waiver Amendment",
description:
"Amend an existing 1915(b)(4) FFS Selective Contracting Waiver",
linkTo: "/dashboard",
linkTo: "/new-submission/waiver/b/b4/amendment/create",
},
];
export const BCAP_WAIVER_OPTIONS: OptionData[] = [
{
title: "1915(b) Comprehensive (Capitated) New Initial Waiver",
description:
"Create a new 1915(b) Comprehensive (Capitated) Initial Waiver",
linkTo: "/dashboard",
linkTo: "/new-submission/waiver/b/capitated/initial/create",
},
{
title: "1915(b) Comprehensive (Capitated) Renewal Waiver",
description: "Renew an existing 1915(b) Comprehensive (Capitated) Waiver",
linkTo: "/dashboard",
linkTo: "/new-submission/waiver/b/capitated/renewal/create",
},
{
title: "1915(b) Comprehensive (Capitated) Waiver Amendment ",
description: "Amend an existing 1915(b) Comprehensive (Capitated) Waiver",
linkTo: "/dashboard",
linkTo: "/new-submission/waiver/b/capitated/amend/create",
},
];
27 changes: 22 additions & 5 deletions src/services/ui/src/pages/dashboard/Lists/waivers/consts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,28 @@ export const useWaiverTableColumns = (): OsTableColumn[] => {
{
field: props?.isCms ? "cmsStatus.keyword" : "stateStatus.keyword",
label: "Status",
cell: (data) =>
props?.isCms &&
!(props.user?.["custom:cms-roles"] === UserRoles.HELPDESK)
? data.cmsStatus
: data.stateStatus,
cell: (data) => {
const status = (() => {
if (!props?.isCms) return data.stateStatus;
if (props.user?.["custom:cms-roles"].includes(UserRoles.HELPDESK))
return data.stateStatus;
return data.cmsStatus;
})();

return (
<>
<p>{status}</p>
{data.raiWithdrawEnabled && (
<p className="text-xs opacity-60">
· Withdraw Formal RAI Response - Enabled
</p>
)}
{props?.isCms && data.initialIntakeNeeded && (
<p className="text-xs opacity-60">· Initial Intake Needed</p>
)}
</>
);
},
},
{
field: "submissionDate",
Expand Down
11 changes: 10 additions & 1 deletion src/services/ui/src/pages/detail/setup/spa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { removeUnderscoresAndCapitalize } from "@/utils";
import { isCmsUser } from "shared-utils";
import { LABELS } from "@/lib";
import { BLANK_VALUE } from "@/consts";
import { opensearch } from "shared-types";
import { PlanType, opensearch } from "shared-types";
import { ReactNode } from "react";
import { OneMacUser } from "@/api/useGetUser";
import { ReviewTeamList } from "@/components/PackageDetails/ReviewTeamList";
Expand All @@ -16,6 +16,15 @@ export type DetailSectionItem = {
export const spaDetails = (
data: opensearch.main.Document
): DetailSectionItem[] => [
{
label: "Waiver Authority",
value: data.planType,
canView: () => {
console.log(data.authority);
console.log(PlanType.WAIVER);
return data.authority?.toLowerCase() == PlanType.WAIVER;
},
},
{
label: "Submission ID",
value: data.id,
Expand Down
6 changes: 3 additions & 3 deletions src/services/ui/src/pages/form/chip-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const ChipForm = () => {
<Inputs.Form {...form}>
<form
onSubmit={handleSubmit}
className="my-6 space-y-8 mx-auto justify-center items-center flex flex-col"
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<SectionCard title="CHIP SPA Details">
<Content.FormIntroText />
Expand Down Expand Up @@ -194,7 +194,7 @@ export const ChipForm = () => {
</SectionCard>
<Content.PreSubmissionMessage />
{Object.keys(form.formState.errors).length !== 0 ? (
<Alert className="mb-6 w-5/6" variant="destructive">
<Alert className="mb-6 " variant="destructive">
Missing or malformed information. Please see errors above.
</Alert>
) : null}
Expand All @@ -203,7 +203,7 @@ export const ChipForm = () => {
<LoadingSpinner />
</div>
) : null}
<div className="flex gap-2 justify-end w-5/6">
<div className="flex gap-2 justify-end ">
<Inputs.Button
disabled={form.formState.isSubmitting}
type="submit"
Expand Down
6 changes: 3 additions & 3 deletions src/services/ui/src/pages/form/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const AttachmentsSizeTypesDesc = ({
</p>
<p>
We accept the following file formats:{" "}
<strong className="bold">.docx, .jpg, .png, .pdf, .xlsx,</strong> and a
few others. See the full list on the{" "}
<strong className="bold">.docx, .jpg, .pdf, .png, .xlsx.</strong> See the
full list on the{" "}
{
<Link
to="/faq/#acceptable-file-formats"
Expand All @@ -79,7 +79,7 @@ export const AttachmentsSizeTypesDesc = ({
);

export const PreSubmissionMessage = () => (
<Alert variant={"infoBlock"} className="my-2 w-5/6 flex-row text-sm">
<Alert variant={"infoBlock"} className="my-2 flex-row text-sm">
<Info />
<p className="ml-2">
Once you submit this form, a confirmation email is sent to you and to CMS.
Expand Down
6 changes: 6 additions & 0 deletions src/services/ui/src/pages/form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
export * from "./medicaid-form";
export * from "./chip-form";
export * from "./waiver/capitated/capitated-1915-b-waiver-renewal";
export * from "./waiver/capitated/capitated-1915-b-waiver-initial";
export * from "./waiver/capitated/capitated-1915-b-waiver-amendment";
export * from "./waiver/contracting/contracting-1915-b-waiver-amendment";
export * from "./waiver/contracting/contracting-1915-b-waiver-initial";
export * from "./waiver/contracting/contracting-1915-b-waiver-renewal";
6 changes: 3 additions & 3 deletions src/services/ui/src/pages/form/medicaid-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const MedicaidForm = () => {
<Inputs.Form {...form}>
<form
onSubmit={form.handleSubmit(handleSubmit)}
className="my-6 space-y-8 mx-auto justify-center items-center flex flex-col"
className="my-6 space-y-8 mx-auto justify-center flex flex-col"
>
<SectionCard title="Medicaid SPA Details">
<Content.FormIntroText />
Expand Down Expand Up @@ -207,7 +207,7 @@ export const MedicaidForm = () => {
</SectionCard>
<Content.PreSubmissionMessage />
{Object.keys(form.formState.errors).length !== 0 ? (
<Alert className="mb-6 w-5/6" variant="destructive">
<Alert className="mb-6" variant="destructive">
Missing or malformed information. Please see errors above.
</Alert>
) : null}
Expand All @@ -216,7 +216,7 @@ export const MedicaidForm = () => {
<LoadingSpinner />
</div>
) : null}
<div className="flex gap-2 justify-end w-5/6">
<div className="flex gap-2 justify-end">
<Inputs.Button
disabled={form.formState.isSubmitting}
type="submit"
Expand Down
Loading

0 comments on commit ef8e91e

Please sign in to comment.