use of gov.cms.qpp.conversion.model.validation.SupplementalData in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidator method validateAllSupplementalNodesOfSpecifiedType.
/**
* Validates all of the nodes under one specified Supplemental Type
*
* @param node Parent node of the nodes to be validated
* @param currSupplementalDataTemplateId Template Id of the nodes to be validated
* @param supplementalDataType current data type to be validated
*/
private void validateAllSupplementalNodesOfSpecifiedType(Node node, TemplateId currSupplementalDataTemplateId, SupplementalType supplementalDataType) {
Set<Node> supplementalDataNodes = node.getChildNodes(currSupplementalDataTemplateId).collect(Collectors.toSet());
EnumSet<SupplementalData> codes = EnumSet.copyOf(SupplementalData.getSupplementalDataSetByType(supplementalDataType));
MeasureConfig measureConfig = MeasureConfigHelper.getMeasureConfig(node.getParent());
if (measureConfig != null) {
String electronicMeasureId = measureConfig.getElectronicMeasureId();
for (SupplementalData supplementalData : codes) {
Node validatedSupplementalNode = filterCorrectNode(supplementalDataNodes, supplementalData);
if (validatedSupplementalNode == null) {
addSupplementalValidationError(node, supplementalData, electronicMeasureId);
} else {
LocalizedError error = makeIncorrectCountSizeLocalizedError(node, supplementalData.getCode(), electronicMeasureId);
check(validatedSupplementalNode).childExact(error, 1, TemplateId.ACI_AGGREGATE_COUNT);
}
}
}
}
Aggregations