use of gov.cms.qpp.conversion.decode.MeasureDataDecoder.MEASURE_POPULATION 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));
}
});
}
Aggregations