use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.
the class MeasureDataTest method inspectMeasureData.
@Test
void inspectMeasureData() {
glossaryMap.forEach((key, value) -> {
MeasureConfig config = configMap.get(key);
assertWithMessage("Missing measure configuration for: %s", key).that(config).isNotNull();
assertWithMessage("Should have the same amount of sub populations").that(config.getStrata()).hasSize(value.getStrata().size());
List<SubPopulation> pops = config.getStrata().stream().map(Strata::getElectronicMeasureUuids).collect(Collectors.toList());
value.getStrata().forEach(stratum -> {
assertWithMessage("Required sub population was not present within: %s", config.getElectronicMeasureId()).that(pops).contains(stratum.getElectronicMeasureUuids());
});
});
}
use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.
the class QualityMeasureIdValidator method validateAllSubPopulations.
/**
* Validates all the sub populations in the quality measure based on the measure configuration
*
* @param node The current parent node
* @param measureConfig The measure configuration's sub population to use
*/
void validateAllSubPopulations(final Node node, final MeasureConfig measureConfig) {
List<SubPopulation> subPopulations = measureConfig.getSubPopulation();
if (subPopulations.isEmpty()) {
return;
}
SubPopulations.getExclusiveKeys(subPopulationExclusions).forEach(subPopulationLabel -> validateChildTypeCount(subPopulations, subPopulationLabel, node));
for (SubPopulation subPopulation : subPopulations) {
validateSubPopulation(node, subPopulation);
}
}
use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.
the class QualityMeasureIdEncoder method createSubPopulationIndexMap.
/**
* Creates a map of child guids to indexes for sub population grouping
*
* @param measureConfig configurations that group the sub populations
* @return Map of Population UUID keys and index values
*/
private Map<String, Integer> createSubPopulationIndexMap(MeasureConfig measureConfig) {
Map<String, Integer> supPopMap = new HashMap<>();
int index = 0;
for (SubPopulation subPopulation : measureConfig.getSubPopulation()) {
supPopMap.put(subPopulation.getDenominatorUuid(), index);
supPopMap.put(subPopulation.getDenominatorExceptionsUuid(), index);
supPopMap.put(subPopulation.getDenominatorExclusionsUuid(), index);
supPopMap.put(subPopulation.getNumeratorUuid(), index);
supPopMap.put(subPopulation.getInitialPopulationUuid(), index);
index++;
}
return supPopMap;
}
use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.
the class CpcQualityMeasureIdValidator method followUpHook.
/**
* Validate measure strata
*
* @param node measure node
* @param sub sub population constituent ids
*/
@Override
protected void followUpHook(Node node, SubPopulation sub) {
List<Node> strataNodes = node.getChildNodes(TemplateId.REPORTING_STRATUM_CMS).collect(Collectors.toList());
if (strataNodes.size() != sub.getStrata().size()) {
LocalizedError error = ErrorCode.CPC_QUALITY_MEASURE_ID_STRATA_MISMATCH.format(strataNodes.size(), sub.getStrata().size(), node.getValue(MeasureDataDecoder.MEASURE_TYPE), node.getValue(MEASURE_POPULATION), sub.getStrata());
addValidationError(Detail.forErrorAndNode(error, node));
}
sub.getStrata().forEach(stratum -> {
Predicate<Node> seek = child -> child.getValue(StratifierDecoder.STRATIFIER_ID).equalsIgnoreCase(stratum);
if (strataNodes.stream().noneMatch(seek)) {
LocalizedError error = ErrorCode.CPC_QUALITY_MEASURE_ID_MISSING_STRATA.format(stratum, node.getValue(MeasureDataDecoder.MEASURE_TYPE), node.getValue(MEASURE_POPULATION));
addValidationError(Detail.forErrorAndNode(error, node));
}
});
}
use of gov.cms.qpp.conversion.model.validation.SubPopulation in project qpp-conversion-tool by CMSgov.
the class MipsQualityMeasureIdValidator method validatePerformanceRateUuid.
/**
* Validates an individual performance rate
*
* @param node The current parent node
* @param measureConfig Holds the current sub population and electronic measure id
* @param performanceRateNode The current performance rate node
*/
private void validatePerformanceRateUuid(Node node, MeasureConfig measureConfig, Node performanceRateNode) {
List<SubPopulation> subPopulations = measureConfig.getSubPopulation();
validatePerformanceRateUuidExists(performanceRateNode);
String performanceUuid = performanceRateNode.getValue(PERFORMANCE_RATE_ID);
if (performanceUuid != null) {
SubPopulation subPopulation = subPopulations.stream().filter(makePerformanceRateUuidFinder(performanceUuid)).findFirst().orElse(null);
if (subPopulation == null) {
Set<String> expectedPerformanceUuids = subPopulations.stream().map(SubPopulation::getNumeratorUuid).collect(Collectors.toSet());
String expectedUuidString = StringHelper.join(expectedPerformanceUuids, ",", "or");
addPerformanceRateValidationMessage(node, measureConfig.getElectronicMeasureId(), expectedUuidString);
}
}
}
Aggregations