use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciNumeratorDenominatorDecoderTest method decodeAciNumeratorDenominatorExtraneousXMLTest.
@Test
void decodeAciNumeratorDenominatorExtraneousXMLTest() throws XmlException {
String xmlFragment = getValidXmlFragment();
xmlFragment = xmlFragment.replaceAll("<statusCode ", "\n<Stuff arbitrary=\"123\"><newnode>Some extra stuff</newnode></Stuff>Unexpected stuff appears here\n\n<statusCode ");
Node aciMeasureNode = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
assertWithMessage("Decoded xml fragment should contain one child node").that(aciMeasureNode.getChildNodes()).hasSize(1);
List<Node> nodeList = aciMeasureNode.findNode(TemplateId.ACI_NUMERATOR);
assertWithMessage("Decoded xml fragment should contain %s", TemplateId.ACI_NUMERATOR.name()).that(nodeList).hasSize(1);
nodeList = nodeList.get(0).findNode(TemplateId.ACI_AGGREGATE_COUNT);
assertWithMessage("Decoded xml fragment %s should contain %s", TemplateId.ACI_NUMERATOR.name(), TemplateId.ACI_AGGREGATE_COUNT.name()).that(nodeList).hasSize(1);
nodeList = aciMeasureNode.findNode(TemplateId.ACI_DENOMINATOR);
assertWithMessage("Decoded xml fragment should contain %s", TemplateId.ACI_DENOMINATOR.name()).that(nodeList).hasSize(1);
nodeList = nodeList.get(0).findNode(TemplateId.ACI_AGGREGATE_COUNT);
assertWithMessage("Decoded xml fragment %s should contain %s", TemplateId.ACI_NUMERATOR.name(), TemplateId.ACI_AGGREGATE_COUNT.name()).that(nodeList).hasSize(1);
int numberNodes = countNodes(aciMeasureNode);
assertWithMessage("Decoded xml fragment %s should contain 6 nodes", aciMeasureNode.getType().name()).that(numberNodes).isEqualTo(6);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciNumeratorDenominatorDecoderTest method decodeAciNumeratorDenominatorNullElementAsNode.
@Test
void decodeAciNumeratorDenominatorNullElementAsNode() throws Exception {
String xmlFragment = XmlUtils.buildString("<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\">", " <observation classCode=\"OBS\" moodCode=\"EVN\">", " <templateId root=\"2.16.840.1.113883.10.20.27.3.3\"/>", " </observation>", "</root>");
Node numDenomNode = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
assertWithMessage("aci numerator/denominator value should be null").that(numDenomNode.getChildNodes().get(0).getValue("aggregateCount")).isNull();
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciProportionDenominatorDecoderTest method decodeInvalidACIProportionDenominatorAsNode.
@Test
void decodeInvalidACIProportionDenominatorAsNode() throws Exception {
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" + " <observation classCode=\"OBS\" moodCode=\"EVN\">\n" + " <!-- ACI Numerator Denominator Type Measure Denominator Data templateId -->\n" + " <templateId root=\"2.16.840.1.113883.10.20.27.3.32\" extension=\"2016-09-01\" />\n" + " <!-- Denominator Count -->\n" + " <entryRelationship typeCode=\"SUBJ\" inversionInd=\"true\">\n" + " <qed resultName=\"aggregateCount\" resultValue=\"800\">\n" + " <templateId root=\"Q.E.D\"/>\n" + " </qed>" + " </entryRelationship>\n" + " </observation>\n" + " <observation classCode=\"OBS\" moodCode=\"EVN\">" + " <templateId root=\"2.16.840.1.113883.10.20.27.3.3\"/>" + " <code code=\"MSRAGG\" codeSystem=\"2.16.840.1.113883.5.4\" codeSystemName=\"ActCode\" displayName=\"rate aggregation\"/>" + " <statusCode code=\"completed\"/>" + " <value xsi:type=\"INT\" value=\"600\"/>" + " <methodCode code=\"COUNT\" codeSystem=\"2.16.840.1.113883.5.84\" codeSystemName=\"ObservationMethod\" displayName=\"Count\"/>" + " </observation>" + " </component>";
Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
// For all decoders this should be either a value or child node
assertThat(root.getChildNodes()).hasSize(2);
// This is the child node that is produced by the intended decoder
Node aciProportionDenominatorNode = root.getChildNodes().get(0);
// Should have a aggregate count node
assertThat(aciProportionDenominatorNode.getChildNodes()).hasSize(1);
// This is stubbed node with the test value
Node target = aciProportionDenominatorNode.getChildNodes().get(0);
// Get the test value
assertThat(target.getValue("aggregateCount")).isEqualTo("800");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciProportionNumeratorDecoderTest method testInternalDecode.
@Test
void testInternalDecode() {
Element element = new Element("testElement");
Node node = new Node();
AciProportionNumeratorDecoder aciProportionNumeratorDecoder = new AciProportionNumeratorDecoder(new Context());
DecodeResult decodeResult = aciProportionNumeratorDecoder.decode(element, node);
assertThat(decodeResult).isEqualTo(DecodeResult.TREE_CONTINUE);
assertThat(node.getValue("name")).isEqualTo(NUMERATOR_NODE_NAME);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionDecoderTest method testInternalDecode.
@Test
void testInternalDecode() {
Element element = new Element("testElement");
Node node = new Node();
AciSectionDecoder aciSectionDecoder = new AciSectionDecoder(new Context());
aciSectionDecoder.decode(element, node);
assertThat(node.getValue("category")).isEqualTo("aci");
}
Aggregations