use of gov.cms.qpp.conversion.model.error.Detail in project qpp-conversion-tool by CMSgov.
the class AciSectionEncoder method encodeChildren.
/**
* Encodes the children of the given section
*
* @param children child nodes of the given section
* @param measurementsWrapper wrapper that holds the measurements of a section
*/
private void encodeChildren(List<Node> children, JsonWrapper measurementsWrapper) {
JsonWrapper childWrapper;
for (Node currentChild : children) {
childWrapper = new JsonWrapper();
TemplateId templateId = currentChild.getType();
if (TemplateId.REPORTING_PARAMETERS_ACT != templateId) {
JsonOutputEncoder childEncoder = encoders.get(templateId);
if (childEncoder != null) {
childEncoder.encode(childWrapper, currentChild);
measurementsWrapper.putObject(childWrapper);
} else {
Detail detail = Detail.forErrorCode(ErrorCode.ENCODER_MISSING);
detail.setPath(currentChild.getPath());
addValidationError(detail);
}
}
}
}
use of gov.cms.qpp.conversion.model.error.Detail in project qpp-conversion-tool by CMSgov.
the class Converter method transform.
/**
* Transform the content in a given input stream
*
* @param inStream source content
* @return a transformed representation of the source content
* @throws XmlException during transform
*/
private JsonWrapper transform(InputStream inStream) {
Element doc = XmlUtils.parseXmlStream(inStream);
decoded = XmlDecoderEngine.decodeXml(context, doc);
JsonWrapper qpp = null;
if (null != decoded) {
DEV_LOG.info("Decoded template ID {}", decoded.getType());
if (!context.isDoDefaults()) {
DefaultDecoder.removeDefaultNode(decoded.getChildNodes());
}
if (context.isDoValidation()) {
QrdaValidator validator = new QrdaValidator(context);
details.addAll(validator.validate(decoded));
}
if (details.isEmpty()) {
qpp = encode();
}
} else {
Detail detail = Detail.forErrorCode(ErrorCode.NOT_VALID_QRDA_DOCUMENT.format(Context.REPORTING_YEAR, Context.IG_URL));
details.add(detail);
}
return qpp;
}
use of gov.cms.qpp.conversion.model.error.Detail in project qpp-conversion-tool by CMSgov.
the class ReportingParametersActValidatorTest method testPerformanceStartAndEndWithDashesAndTimezone.
@Test
void testPerformanceStartAndEndWithDashesAndTimezone() {
Node reportingParametersActNode = createReportingParametersAct("2017-01-01T01:45:23.123", "2017-12-01T01:45:23.123", PERFORMANCE_YEAR);
reportingParametersActValidator.internalValidateSingleNode(reportingParametersActNode);
Set<Detail> error = reportingParametersActValidator.getDetails();
assertThat(error).isEmpty();
}
use of gov.cms.qpp.conversion.model.error.Detail in project qpp-conversion-tool by CMSgov.
the class ReportingParametersActValidatorTest method testInvalidPerformanceStartFormat.
@Test
void testInvalidPerformanceStartFormat() {
Node reportingParametersActNode = createReportingParametersAct(TIMESTAMPED_DATE, PERFORMANCE_END, PERFORMANCE_YEAR);
reportingParametersActValidator.internalValidateSingleNode(reportingParametersActNode);
Set<Detail> error = reportingParametersActValidator.getDetails();
assertThat(error).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(ErrorCode.INVALID_PERFORMANCE_PERIOD_FORMAT.format(TIMESTAMPED_DATE));
}
use of gov.cms.qpp.conversion.model.error.Detail in project qpp-conversion-tool by CMSgov.
the class CpcQualityMeasureScopedValidatonTest method validateCms137V5FailMissingMeasure.
@Test
void validateCms137V5FailMissingMeasure() {
Node result = scopedConversion(QrdaScope.MEASURE_REFERENCE_RESULTS_CMS_V2, "cms137v5_MissingMeasure.xml");
Set<Detail> details = validateNode(result);
LocalizedError message = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format("CMS137v5", "IPP,IPOP", "EC2C5F63-AF76-4D3C-85F0-5423F8C28541");
assertWithMessage("Missing CMS137v5 IPOP strata should result in errors").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(message);
}
Aggregations