diff --git a/scripts/measures/2024/update-measures-util.spec.ts b/scripts/measures/2024/update-measures-util.spec.ts index b1c3623d..4a90f0f2 100644 --- a/scripts/measures/2024/update-measures-util.spec.ts +++ b/scripts/measures/2024/update-measures-util.spec.ts @@ -91,6 +91,15 @@ const allowedQualityChange = { overallAlgorithm: 'overallStratumOnly', }; +const allowedCostScoreQualityChange = { + measureId: '002', + firstPerformanceYear: 2020, + isInverse: false, + metricType: 'costScore', + overallAlgorithm: 'overallStratumOnly', + submissionMethods: ['administrativeClaims'], +}; + const allowedQcdrChange = { measureId: 'AQI49', title: 'testTitle', @@ -316,6 +325,25 @@ describe('#update-measures-util', () => { expect(infoSpy).toBeCalledWith(`File 'test.csv' successfully ingested into measures-data 2023`); }); + it('logs warnings when certain fields are changed', () => { + + jest.spyOn(csvConverter, 'convertCsvToJson').mockReturnValue([{ + ...allowedCostScoreQualityChange, + category: 'quality', + }]); + + const warningSpy = jest.spyOn(logger, 'warning').mockImplementation(jest.fn()); + UpdateMeasuresUtil.updateMeasuresWithChangeFile( + 'test.csv', + 'fakepath/', + '2023', + volatileMeasures, + ); + expect(addSpy).not.toBeCalled(); + expect(deleteSpy).not.toBeCalled(); + expect(warningSpy).toBeCalledWith(`'002': this measure's only submissionMethod is 'administrativeClaims'; however either the metricType is not 'costScore' and/or isInverse is 'false'. Was this deliberate?`); + }); + it('throws if eCQM but has no eMeasureId', () => { jest.spyOn(csvConverter, 'convertCsvToJson').mockReturnValue([{ diff --git a/scripts/measures/2024/update-measures-util.ts b/scripts/measures/2024/update-measures-util.ts index 81ba14fa..bf564956 100644 --- a/scripts/measures/2024/update-measures-util.ts +++ b/scripts/measures/2024/update-measures-util.ts @@ -21,6 +21,7 @@ import { COST_MEASURES_ORDER, IA_DEFAULT_VALUES, IA_MEASURES_ORDER, + METRIC_TYPES, PI_DEFAULT_VALUES, PI_MEASURES_ORDER, QCDR_MEASURES_ORDER, @@ -96,6 +97,9 @@ export function updateMeasuresWithChangeFile( if (!isOutcomeHighPriority(change, measuresJson)) { throw new DataValidationError(measureId, `'outcome' and 'intermediateOutcome' measures must always be High Priority.`); } + if (isOnlyAdminClaims(change) && (change.metricType !== 'costScore' || !change.isInverse)) warning( + `'${measureId}': this measure's only submissionMethod is 'administrativeClaims'; however either the metricType is not 'costScore' and/or isInverse is 'false'. Was this deliberate?` + ); if (isNew && change.metricType?.includes('ultiPerformanceRate')) { warning(`'${measureId}': 'New MultiPerformanceRate measures require an update to the strata file.\n Update strata file with new measure strata before merging into the repo.`); change.strata = PLACEHOLDER_STRATA; @@ -325,6 +329,7 @@ function isOutcomeHighPriority(change: MeasuresChange, measuresJson: any): boole return true; } + function isMultiPerfRateChanged(change: MeasuresChange, measuresJson: any): boolean { const currentMeasure = _.find(measuresJson, { 'measureId': change.measureId });