use of gov.cms.qpp.conversion.model.error.LocalizedError 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.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class MipsQualityMeasureIdValidator method addPerformanceRateValidationMessage.
/**
* Adds a validation error message for a specified Performance Rate
*
* @param node The current parent node of performance rate
* @param performanceUuid The current performance rate uuid
*/
private void addPerformanceRateValidationMessage(Node node, String electronicMeasureId, String performanceUuid) {
LocalizedError error = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format(electronicMeasureId, PERFORMANCE_RATE_ID, performanceUuid);
addValidationError(Detail.forErrorAndNode(error, node));
}
use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class QualityMeasureIdValidator method validateChildTypeCount.
/**
* Validates that given subpopulations have the correct number of a given type
*
* @param subPopulations The subpopulations to test against
* @param key The type to check
* @param node The node in which the child nodes live
*/
private void validateChildTypeCount(List<SubPopulation> subPopulations, SubPopulationLabel key, Node node) {
long expectedChildTypeCount = subPopulations.stream().map(subPopulation -> SubPopulations.getUniqueIdForKey(key.name(), subPopulation)).filter(Objects::nonNull).count();
Predicate<Node> childTypeFinder = makeTypeChildFinder(key.getAliases());
long actualChildTypeCount = node.getChildNodes(TemplateId.MEASURE_DATA_CMS_V2).filter(childTypeFinder).count();
if (expectedChildTypeCount != actualChildTypeCount) {
LocalizedError error = ErrorCode.POPULATION_CRITERIA_COUNT_INCORRECT.format(MeasureConfigHelper.getMeasureConfig(node).getElectronicMeasureId(), expectedChildTypeCount, StringHelper.join(key.getAliases(), ",", "or"), actualChildTypeCount);
Detail detail = Detail.forErrorAndNode(error, node);
addValidationError(detail);
}
}
Aggregations