Skip to content

Commit

Permalink
Refactor: Additional Notes (#2064)
Browse files Browse the repository at this point in the history
  • Loading branch information
ailZhou authored Feb 28, 2024
1 parent 3972dc2 commit 38179e1
Show file tree
Hide file tree
Showing 35 changed files with 174 additions and 304 deletions.
34 changes: 23 additions & 11 deletions services/ui-src/src/components/MeasureWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ import {
import { v4 as uuidv4 } from "uuid";
import * as QMR from "components";
import { useEditCoreSet, useGetMeasure, useUpdateMeasure } from "hooks/api";
import { AutoCompletedMeasures, CoreSetAbbr, MeasureStatus } from "types";
import {
AnyObject,
AutoCompletedMeasures,
CoreSetAbbr,
MeasureStatus,
} from "types";
import { areSomeRatesCompleted } from "utils/form";
import * as DC from "dataConstants";
import { CoreSetTableItem } from "components/Table/types";
import { useUser } from "hooks/authHooks";
import { measureDescriptions } from "measures/measureDescriptions";
import { CompleteCoreSets } from "./complete";
import SharedContext from "shared/SharedContext";
import * as Labels from "labels/Labels";

const LastModifiedBy = ({ user }: { user: string | undefined }) => {
if (!user) return null;
Expand Down Expand Up @@ -142,6 +149,10 @@ export const MeasureWrapper = ({
[]
);

//WIP: this code will be replaced with a dynamic import onces we refactored enough files
const shared: AnyObject =
Labels[`CQ${year}` as "CQ2021" | "CQ2022" | "CQ2023" | "CQ2024"];

// setup default values for core set, as delivery system uses this to pregen the labeled portion of the table
const coreSet = (params.coreSetId?.split("_")?.[0] ??
params.coreSetId ??
Expand Down Expand Up @@ -451,16 +462,17 @@ export const MeasureWrapper = ({
to [email protected].
</CUI.Text>
)}
<Measure
measure={measure}
name={name}
detailedDescription={detailedDescription}
year={year}
measureId={measureId}
setValidationFunctions={setValidationFunctions}
handleSave={handleSave}
/>

<SharedContext.Provider value={shared}>
<Measure
measure={measure}
name={name}
detailedDescription={detailedDescription}
year={year}
measureId={measureId}
setValidationFunctions={setValidationFunctions}
handleSave={handleSave}
/>
</SharedContext.Provider>
{/* Core set qualifiers use a slightly different submission button layout */}
{!!(!autocompleteOnCreation && !defaultData) && (
<QMR.CompleteMeasureFooter
Expand Down
11 changes: 11 additions & 0 deletions services/ui-src/src/labels/2021/commonQuestionsLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const commonQuestionsLabel = {
AdditonalNotes: {
header: "Additional Notes/Comments on the measure (optional)",
section:
"Please add any additional notes or comments on the measure not otherwise captured above:",
upload:
"If you need additional space to include comments or supplemental information, please attach further documentation below.",
},
};

export default commonQuestionsLabel;
11 changes: 11 additions & 0 deletions services/ui-src/src/labels/2022/commonQuestionsLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const commonQuestionsLabel = {
AdditonalNotes: {
header: "Additional Notes/Comments on the measure (optional)",
section:
"Please add any additional notes or comments on the measure not otherwise captured above:",
upload:
"If you need additional space to include comments or supplemental information, please attach further documentation below.",
},
};

export default commonQuestionsLabel;
11 changes: 11 additions & 0 deletions services/ui-src/src/labels/2023/commonQuestionsLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const commonQuestionsLabel = {
AdditonalNotes: {
header: "Additional Notes/Comments on the measure (optional)",
section:
"Please add any additional notes or comments on the measure not otherwise captured above (<em>text in this field is included in publicly-reported state-specific comments</em>):",
upload:
"If you need additional space to include comments or supplemental information, please attach further documentation below.",
},
};

export default commonQuestionsLabel;
11 changes: 11 additions & 0 deletions services/ui-src/src/labels/2024/commonQuestionsLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const commonQuestionsLabel = {
AdditonalNotes: {
header: "Additional Notes/Comments on the measure (optional)",
section:
"Please add any additional notes or comments on the measure not otherwise captured above (<em>text in this field is included in publicly-reported state-specific comments</em>):",
upload:
"If you need additional space to include comments or supplemental information, please attach further documentation below.",
},
};

export default commonQuestionsLabel;
4 changes: 4 additions & 0 deletions services/ui-src/src/labels/Labels.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { commonQuestionsLabel as CQ2021 } from "labels/2021/commonQuestionsLabel";
export { commonQuestionsLabel as CQ2022 } from "labels/2022/commonQuestionsLabel";
export { commonQuestionsLabel as CQ2023 } from "labels/2023/commonQuestionsLabel";
export { commonQuestionsLabel as CQ2024 } from "labels/2024/commonQuestionsLabel";
5 changes: 3 additions & 2 deletions services/ui-src/src/measures/2021/AMMAD/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import * as PMD from "./data";
import { validationFunctions } from "./validation";
import { getPerfMeasureRateArray } from "measures/2021/globalValidations";
import * as QMR from "components";
import { DefaultFormData } from "measures/2021/CommonQuestions/types";
//form type
import { DefaultFormData as FormData } from "measures/2021/CommonQuestions/types";

export const AMMAD = ({
name,
Expand All @@ -17,7 +18,7 @@ export const AMMAD = ({
showOptionalMeasureStrat,
isOtherMeasureSpecSelected,
}: QMR.MeasureWrapperProps) => {
const { watch } = useFormContext<DefaultFormData>();
const { watch } = useFormContext<FormData>();
const data = watch();

useEffect(() => {
Expand Down
5 changes: 3 additions & 2 deletions services/ui-src/src/measures/2021/AMMAD/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import * as DC from "dataConstants";
import * as GV from "measures/2021/globalValidations";
import * as PMD from "./data";
import { cleanString } from "utils/cleanString";
import { DefaultFormData } from "measures/2021/CommonQuestions/types";
import { OMSData } from "measures/2021/CommonQuestions/OptionalMeasureStrat/data";
//form type
import { DefaultFormData as FormData } from "measures/2021/CommonQuestions/types";

const sameDenominatorSets: GV.Types.OmsValidationCallback = ({
rateData,
Expand Down Expand Up @@ -44,7 +45,7 @@ const sameDenominatorSets: GV.Types.OmsValidationCallback = ({
return errorArray;
};

const AMMADValidation = (data: DefaultFormData) => {
const AMMADValidation = (data: FormData) => {
const ageGroups = PMD.qualifiers;
const age65PlusIndex = 1;
const whyNotReporting = data[DC.WHY_ARE_YOU_NOT_REPORTING];
Expand Down
4 changes: 3 additions & 1 deletion services/ui-src/src/measures/2021/AMRAD/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import * as CMQ from "measures/2021/CommonQuestions";
import * as QMR from "components";
import * as PMD from "./data";
import { useFormContext, useWatch } from "react-hook-form";
import { FormData, Measure } from "./types";
import { Measure } from "./types";
import { getPerfMeasureRateArray } from "measures/2021/globalValidations";
import { useEffect } from "react";
import { validationFunctions } from "./validation";
//form type
import { DefaultFormData as FormData } from "measures/2021/CommonQuestions/types";

export const AMRAD = ({
name,
Expand Down
2 changes: 0 additions & 2 deletions services/ui-src/src/measures/2021/AMRAD/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,3 @@ export namespace Measure {
ACAGroupRate: AggregateRate;
}
}

export type FormData = Types.DefaultFormData;
3 changes: 2 additions & 1 deletion services/ui-src/src/measures/2021/AMRAD/validation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as DC from "dataConstants";
import * as GV from "measures/2021/globalValidations";
import * as PMD from "./data";
import { FormData } from "./types";
import { OMSData } from "measures/2021/CommonQuestions/OptionalMeasureStrat/data";
//form type
import { DefaultFormData as FormData } from "measures/2021/CommonQuestions/types";

const AMRADValidation = (data: FormData) => {
const ageGroups = PMD.qualifiers;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export * from "./DateRange";
export * from "./DefinitionsOfPopulation";
export * from "./DataSource";
export * from "./DataSourceCahps";
export * from "./AdditionalNotes";
export * from "shared/commonQuestions/AdditionalNotes";
export * from "./OtherPerformanceMeasure";
export * from "./Reporting";
export * from "./StatusOfData";
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export * from "./DateRange";
export * from "./DefinitionsOfPopulation";
export * from "./DataSource";
export * from "./DataSourceCahps";
export * from "./AdditionalNotes";
export * from "shared/commonQuestions/AdditionalNotes";
export * from "./OtherPerformanceMeasure";
export * from "./Reporting";
export * from "./StatusOfData";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export * from "./DateRange";
export * from "./DefinitionsOfPopulation";
export * from "./DataSource";
export * from "./DataSourceCahps";
export * from "./AdditionalNotes";
export * from "shared/commonQuestions/AdditionalNotes";
export * from "./OtherPerformanceMeasure";
export * from "./Reporting";
export * from "./StatusOfData";
Expand Down
Loading

0 comments on commit 38179e1

Please sign in to comment.