Skip to content

Commit

Permalink
CMDCT-4050: Allow "NR" Values for Number Fields (#11877)
Browse files Browse the repository at this point in the history
  • Loading branch information
karla-vm authored Oct 18, 2024
1 parent 1c7f1d1 commit 198ebca
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
32 changes: 21 additions & 11 deletions services/app-api/forms/mcpar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4415,7 +4415,8 @@
"props": {
"label": "D1.XIII.4 Percentage of standard PA requests that were approved",
"hint": "Enter the percentage of the total standard PA requests, as reported in D1.XIII.1, that were approved. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"mask": "percentage"
"mask": "percentage",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4425,7 +4426,8 @@
"props": {
"label": "D1.XIII.5 Percentage of standard PA requests that were denied",
"hint": "Enter the percentage of the total standard PA requests, as reported in D1.XIII.1, that were denied. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"mask": "percentage"
"mask": "percentage",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4435,7 +4437,8 @@
"props": {
"label": "D1.XIII.6 Percentage of standard PA requests that were approved after appeal",
"hint": "Enter the percentage of the total standard PA requests, as reported in D1.XIII.1, that were approved after appeal, aggregated for all items and services as defined in § 438.210(f)(4). If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"mask": "percentage"
"mask": "percentage",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4444,7 +4447,8 @@
"validation": "number",
"props": {
"label": "D1.XIII.7 Average time to decision for standard PAs",
"hint": "For standard PAs, as reported in D1.XIII.1, enter the average number of days that elapsed between submission of request and determination by the MCO, PIHP or PAHP. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting."
"hint": "For standard PAs, as reported in D1.XIII.1, enter the average number of days that elapsed between submission of request and determination by the MCO, PIHP or PAHP. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4453,7 +4457,8 @@
"validation": "number",
"props": {
"label": "D1.XIII.8 Median time that elapsed for decision on standard PAs",
"hint": "For standard PAs, as reported in D1.XIII.1, enter the median number of days that elapsed between submission of request and decision by the MCO, PIHP or PAHP. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting."
"hint": "For standard PAs, as reported in D1.XIII.1, enter the median number of days that elapsed between submission of request and decision by the MCO, PIHP or PAHP. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4471,7 +4476,8 @@
"props": {
"label": "D1.XIII.9 Percentage of expedited PA requests that were approved",
"hint": "Of the total expedited PA requests, as reported in D1.XIII.2, enter the percentage that were approved. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"mask": "percentage"
"mask": "percentage",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4481,7 +4487,8 @@
"props": {
"label": "D1.XIII.10 Percentage of expedited PA requests that were denied",
"hint": "Of the total expedited PA requests, as reported in D1.XIII.2, enter the percentage that were denied. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"mask": "percentage"
"mask": "percentage",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4490,7 +4497,8 @@
"validation": "number",
"props": {
"label": "D1.XIII.11 Average time to decision for expedited PAs",
"hint": "Of the total expedited PA requests, as reported in D1.XIII.2, enter the average number of hours elapsed between submission of request and decision by MCO, PIHP or PAHP. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting."
"hint": "Of the total expedited PA requests, as reported in D1.XIII.2, enter the average number of hours elapsed between submission of request and decision by MCO, PIHP or PAHP. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4499,7 +4507,8 @@
"validation": "number",
"props": {
"label": "D1.XIII.12 Median time that elapsed for decision on expedited PAs",
"hint": "Of the total expedited PA requests, as reported in D1.XIII.2, enter the median number of hours elapsed between submission of request and decision bt MCO, PIHP or PAHP, as defined in § 438.210(f)(9). If you choose not to respond prior to June 2026, enter \"NR\" for not reporting."
"hint": "Of the total expedited PA requests, as reported in D1.XIII.2, enter the median number of hours elapsed between submission of request and decision by MCO, PIHP or PAHP, as defined in § 438.210(f)(9). If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"decimalPlacesToRoundTo": 2
}
},
{
Expand All @@ -4513,11 +4522,12 @@
{
"id": "plan_percentageOfTotalPARequestsApprovedWithExtendedTimeframe",
"type": "number",
"validation": "number",
"validation": "numberNotLessThanZero",
"props": {
"label": "D1.XIII.13 Percentage of total PA requests approved with extended timeframe",
"hint": "Of the total PA requests, as reported in D1.XIII.3, enter the percentage of requests for which the timeframe for review was extended and the request was approved. If you choose not to respond prior to June 2026, enter \"NR\" for not reporting.",
"mask": "percentage"
"mask": "percentage",
"decimalPlacesToRoundTo": 2
}
}
]
Expand Down
4 changes: 3 additions & 1 deletion services/app-api/utils/validation/completionSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const error = {
NUMBER_LESS_THAN_ZERO: "Response must be greater than or equal to zero",
NUMBER_LESS_THAN_ONE: "Response must be greater than or equal to one",
INVALID_NUMBER: "Response must be a valid number",
INVALID_NUMBER_OR_NA: 'Response must be a valid number or "N/A"',
INVALID_NUMBER_OR_NA: 'Response must be a valid number, "N/A" or "NR"',
INVALID_RATIO: "Response must be a valid ratio",
};

Expand All @@ -46,6 +46,8 @@ export const validNAValues = [
"n/a",
"N/a",
"Data not available",
"NR",
"nr",
];

/** This regex must be at least as permissive as the one in ui-src */
Expand Down
5 changes: 3 additions & 2 deletions services/app-api/utils/validation/schemaMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const error = {
NUMBER_LESS_THAN_ONE: "Response must be greater than or equal to one",
NUMBER_LESS_THAN_ZERO: "Response must be greater than or equal to zero",
INVALID_NUMBER: "Response must be a valid number",
INVALID_NUMBER_OR_NA: 'Response must be a valid number or "N/A"',
INVALID_NUMBER_OR_NA: 'Response must be a valid number, "N/A" or "NR"',
INVALID_RATIO: "Response must be a valid ratio",
};

Expand All @@ -35,6 +35,8 @@ export const validNAValues = [
"n/a",
"N/a",
"Data not available",
"NR",
"nr",
];

const valueCleaningNumberSchema = (value: string, charsToReplace: RegExp) => {
Expand All @@ -47,7 +49,6 @@ const valueCleaningNumberSchema = (value: string, charsToReplace: RegExp) => {
const validNumberRegex = /^\.$|[0-9]/;

// NUMBER - Number or Valid Strings

export const number = () =>
string().test({
message: error.INVALID_NUMBER_OR_NA,
Expand Down
2 changes: 2 additions & 0 deletions services/ui-src/src/utils/validation/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const validNAValues = [
"n/a",
"N/a",
"Data not available",
"NR",
"nr",
];

// NUMBER - Number or Valid Strings
Expand Down
2 changes: 1 addition & 1 deletion services/ui-src/src/verbiage/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const validationErrors = {
NUMBER_LESS_THAN_ONE: "Response must be greater than or equal to one",
NUMBER_LESS_THAN_ZERO: "Response must be greater than or equal to zero",
INVALID_NUMBER: "Response must be a valid number",
INVALID_NUMBER_OR_NA: 'Response must be a valid number or "N/A"',
INVALID_NUMBER_OR_NA: 'Response must be a valid number, "N/A" or "NR"',
INVALID_RATIO: "Response must be a valid ratio",
};

Expand Down

0 comments on commit 198ebca

Please sign in to comment.