Skip to content

Commit

Permalink
Merge pull request #713 from CMSgov/feat/QPPA-7749
Browse files Browse the repository at this point in the history
QPPA-7562: Update MVPs with new fields
  • Loading branch information
ckawell-sb authored Oct 16, 2023
2 parents 76d2173 + 6515d16 commit d1e4631
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
26 changes: 17 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const fs = require('fs');
const path = require('path');
const YAML = require('yamljs');
const uniq = require('lodash/uniq');
const _ = require('lodash');

const yearRegEx = /^[0-9]{4}/;
const benchmarkJsonFileRegEx = /^[0-9]{4}\.json$/;
Expand Down Expand Up @@ -194,6 +194,8 @@ exports.createMVPDataFile = function(performanceYear) {
mvp[item.enrichedMeasureKey] = [];
this.populateMeasuresforMVPs(mvp, mvpData, measuresData, item.measureIdKey, item.enrichedMeasureKey);
});

mvp.hasOutcomeAdminClaims = !_.isEmpty(mvp.administrativeClaimsMeasureIds);
});

mvpData.forEach(mvp => {
Expand All @@ -208,19 +210,25 @@ exports.createMVPDataFile = function(performanceYear) {
return mvpData;
};

exports.populateMeasuresforMVPs = function(mvpDataItem, mvpDataArray, measuresData, measureIdKey, enrichedMeasureKey) {
mvpDataItem[measureIdKey].forEach(measureId => {
const measure = measuresData.find(m => m.measureId === measureId);
exports.populateMeasuresforMVPs = function(currentMvp, allMvps, measuresData, measureIdKey, enrichedMeasureKey) {
currentMvp[measureIdKey].forEach(measureId => {
const measure = measuresData.find(measure => measure.measureId === measureId);

if (measure) {
mvpDataArray.forEach(m => {
if (m[measureIdKey].includes(measureId)) {
measure.allowedPrograms.push(m.mvpId);
allMvps.forEach(mvp => {
// update measuresData with MVP programNames.
if (mvp[measureIdKey].includes(measureId)) {
measure.allowedPrograms.push(mvp.mvpId);
}
});
measure.allowedPrograms = _.uniq(measure.allowedPrograms);

if (measure.measureId === '321') {
currentMvp.hasCahps = true;
}

measure.allowedPrograms = uniq(measure.allowedPrograms);
mvpDataItem[enrichedMeasureKey].push(measure);
// update mvp-data with measures.
currentMvp[enrichedMeasureKey].push(measure);
}
});
};
Expand Down
1 change: 1 addition & 0 deletions scripts/measures/initialize-measures
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ else
echo -e "Updating the max performance year for the shell scripts..."
sed -i '' -e "s/maxPerformanceYear=$previousPerformanceYear/maxPerformanceYear=$newPerformanceYear/" scripts/measures/update-measures
sed -i '' -e "s/maxPerformanceYear=$previousPerformanceYear/maxPerformanceYear=$newPerformanceYear/" scripts/measures/measures-json-to-csv
sed -i '' -e "s/maxPerformanceYear=$previousPerformanceYear/maxPerformanceYear=$newPerformanceYear/" scripts/mvp/update-mvp

echo -e "Cloning yearly scripts..."
cp -r scripts/measures/$previousPerformanceYear scripts/measures/$newPerformanceYear
Expand Down
16 changes: 16 additions & 0 deletions scripts/mvp/parse-mvp-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,20 @@ rawMvpData.forEach((row) => {
costMeasureIds: [] as any,
foundationPiMeasureIds: [] as any,
foundationQualityMeasureIds: [] as any,
administrativeClaimsMeasureIds: [] as any,
hasOutcomeAdminClaims: false,
};

hydrateMeasureIds(newMvp, mvpCategory, measure);

newMvp.hasOutcomeAdminClaims = !_.isEmpty(newMvp.administrativeClaimsMeasureIds);

mvpData.push(newMvp);

} else {
hydrateMeasureIds(existingMvp, mvpCategory, measure);

existingMvp.hasOutcomeAdminClaims = !_.isEmpty(existingMvp.administrativeClaimsMeasureIds);
}
});

Expand All @@ -70,6 +78,14 @@ function hydrateMeasureIds(mvp, mvpCategory, measure) {
if (mvpCategory === "Foundational") {
mvp.foundationQualityMeasureIds.push(measure.measureId);
} else if (mvpCategory === "Quality") {
// if it is an adminclaims measure, add it to that array.
if (measure?.submissionMethods.includes("administrativeClaims")) {
mvp.administrativeClaimsMeasureIds.push(measure.measureId);
break;
}
if (measure?.measureId === "321") {
mvp.hasCahps = true;
}
mvp.qualityMeasureIds.push(measure.measureId);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion scripts/mvp/update-mvp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

currentPerformanceYear=$(($1))
maxPerformanceYear=2023
maxPerformanceYear=2024

Red='\033[0;31m'
Green='\033[0;32m'
Expand Down

0 comments on commit d1e4631

Please sign in to comment.