use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionRoundTripTest method parseGarbageAciSectionAsNode.
@Test
void parseGarbageAciSectionAsNode() throws XmlException {
// set-up
String xmlFragment = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<component xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\">\n" + " <section>\n" + " <!-- Measure Section -->\n" + " <templateId root=\"2.16.840.1.113883.10.20.24.2.2\"/>\n" + " <!-- Advancing Care Information Section templateId -->\n" + " <templateId root=\"2.16.840.1.113883.10.20.27.2.5\" extension=\"2017-06-01\"/>\n" + " <code code=\"55186-1\" codeSystem=\"2.16.840.1.113883.6.1\" displayName=\"Measure Section\"/>\n" + " <statusCode code=\"Death and Destruction!\" />\n" + " Utter garbage! Buahahahahaha!\n" + " <title>Measure Section</title>\n" + " <text>\n" + " </text>\n" + " <entry>\n" + " <qed resultName=\"measure\" resultValue=\"measure1\">\n" + " <templateId root=\"Q.E.D\"/>\n" + " </qed>" + " </entry>\n" + " <entry typeCode=\"DRIV\">" + " <act classCode=\"ACT\" moodCode=\"EVN\">" + " <templateId root=\"2.16.840.1.113883.10.20.17.3.8\"/>" + " <id root=\"00b669fd-fa4d-4f5c-b109-65c6bbbf73ae\"/>" + " <code code=\"252116004\" codeSystem=\"2.16.840.1.113883.6.96\"" + " displayName=\"Observation Parameters\"/>" + " <effectiveTime>" + " <low value=\"20170101\"/>" + " <high value=\"20170430\"/>" + " </effectiveTime>" + " </act>" + " </entry>" + " </section>\n" + "</component>";
// execute
Node parentNode = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
DefaultDecoder.removeDefaultNode(parentNode.getChildNodes());
// assert
Node aciSectionNode = parentNode.findFirstNode(TemplateId.ACI_SECTION);
assertAciSectionHasSingleQedNode(aciSectionNode);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionRoundTripTest method parseSparseAciSectionAsNode.
@Test
void parseSparseAciSectionAsNode() throws XmlException {
// set-up
String xmlFragment = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<component xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\">\n" + " <section>\n" + " <!-- Measure Section -->\n" + " <templateId root=\"2.16.840.1.113883.10.20.24.2.2\"/>\n" + " <!-- Advancing Care Information Section templateId -->\n" + " <templateId root=\"2.16.840.1.113883.10.20.27.2.5\" extension=\"2017-06-01\"/>\n" + " <code code=\"55186-1\" codeSystem=\"2.16.840.1.113883.6.1\" displayName=\"Measure Section\"/>\n" + " <title>Measure Section</title>\n" + " <text>\n" + " </text>\n" + " <entry>\n" + " <qed resultName=\"measure\" resultValue=\"measure1\">\n" + " <templateId root=\"Q.E.D\"/>\n" + " </qed>" + " </entry>\n" + " <entry typeCode=\"DRIV\">" + " <act classCode=\"ACT\" moodCode=\"EVN\">" + " <templateId root=\"2.16.840.1.113883.10.20.17.3.8\"/>" + " <id root=\"00b669fd-fa4d-4f5c-b109-65c6bbbf73ae\"/>" + " <code code=\"252116004\" codeSystem=\"2.16.840.1.113883.6.96\"" + " displayName=\"Observation Parameters\"/>" + " <effectiveTime>" + " <low value=\"20170101\"/>" + " <high value=\"20170430\"/>" + " </effectiveTime>" + " </act>" + " </entry>" + " </section>\n" + "</component>";
// execute
Node parentNode = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
DefaultDecoder.removeDefaultNode(parentNode.getChildNodes());
// assert
Node aciSectionNode = parentNode.findFirstNode(TemplateId.ACI_SECTION);
assertAciSectionHasSingleQedNode(aciSectionNode);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AutoDetectQrdaTest method testNoClinicalDocumentElement.
@Test
void testNoClinicalDocumentElement() throws IOException, XmlException {
// set-up
String xmlFragment = IOUtils.toString(getStream("bogus-QDRA-III-root"), StandardCharsets.UTF_8);
// execute
clearLogs();
XmlDecoderEngine.decodeXml(new Context(), XmlUtils.stringToDom(xmlFragment));
// assert
assertThat(getLogs()).contains("The XML file is an unknown document");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentValidatorTest method testClinicalDocumentValidationParsesMultipleErrors.
@Test
void testClinicalDocumentValidationParsesMultipleErrors() {
// setup
Path path = Paths.get("src/test/resources/negative/angerClinicalDocumentValidations.xml");
// execute
Context context = new Context();
context.setDoDefaults(true);
Converter converter = new Converter(new PathSource(path), context);
AllErrors allErrors = new AllErrors();
try {
converter.transform();
} catch (TransformException exception) {
allErrors = exception.getDetails();
}
List<Detail> errors = getErrors(allErrors);
assertWithMessage("Must have 4 errors").that(errors).hasSize(4);
assertWithMessage("Must contain the correct errors").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsAllOf(ErrorCode.CLINICAL_DOCUMENT_MISSING_PROGRAM_NAME, ErrorCode.REPORTING_PARAMETERS_MUST_CONTAIN_SINGLE_PERFORMANCE_START);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidatorTest method validateFailureSupplementalDataMissingCountTest.
@Test
void validateFailureSupplementalDataMissingCountTest() throws Exception {
String failurePayerFile = TestHelper.getFixture("failureSupplementalDataCountFile.xml");
Node placeholder = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(failurePayerFile));
CpcMeasureDataValidator validator = new CpcMeasureDataValidator();
Node underTest = placeholder.findFirstNode(TemplateId.MEASURE_DATA_CMS_V2);
validator.internalValidateSingleNode(underTest);
LocalizedError expectedError = ErrorCode.CPC_PLUS_SUPPLEMENTAL_DATA_MISSING_COUNT.format(SupplementalData.MALE.getCode(), SubPopulationLabel.IPOP.name(), MEASURE_ID);
Set<Detail> errors = validator.getDetails();
assertThat(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(expectedError);
}
Aggregations