use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidatorTest method validateSuccessfulSupplementalDataFieldsTest.
@Test
void validateSuccessfulSupplementalDataFieldsTest() throws Exception {
String successfulFile = TestHelper.getFixture("successfulSupplementalDataFile.xml");
Node placeholder = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(successfulFile));
CpcMeasureDataValidator validator = new CpcMeasureDataValidator();
Node underTest = placeholder.findFirstNode(TemplateId.MEASURE_DATA_CMS_V2);
validator.internalValidateSingleNode(underTest);
Set<Detail> errors = validator.getDetails();
assertThat(errors).isEmpty();
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciNumeratorDenominatorDecoderTest method decodeAggregateCountAsNode.
@Test
void decodeAggregateCountAsNode() 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\"/>", " <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>", "</root>");
Node aggregateCountNode = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
assertThat(aggregateCountNode.getChildNodes().get(0).getValue("aggregateCount")).isEqualTo("600");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciProportionDenominatorDecoderTest method decodeACIProportionDenominatorAsNode.
/**
* decodeACIProportionDenominatorAsNode given a well formed xml fragment
* parses out the appropriate aggregateCount This test calls
* QrdaDecoderEngine.()decode() which in turn calls the only method in this
* class. AciProportionDenominatorDecoder().decode()
*
* @throws Exception
*/
@Test
void decodeACIProportionDenominatorAsNode() 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" + "</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(1);
// 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 AggregateCountDecoderTest method testAggregateCountDecoderIgnoresInvalidElements.
@Test
void testAggregateCountDecoderIgnoresInvalidElements() throws XmlException {
Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(XML_FRAGMENT));
Node node = root.getChildNodes().get(0);
assertThat(node.getChildNodes()).hasSize(1);
assertThat(node.getChildNodes().get(0).getValue("aggregateCount")).isEqualTo("400");
assertWithMessage("Should have template id").that(node.getChildNodes().get(0).getType()).isEqualTo(TemplateId.ACI_AGGREGATE_COUNT);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AggregateCountDecoderTest method testDuplicateAggregateCountDecodesToDuplicateAggregateCount.
@Test
void testDuplicateAggregateCountDecodesToDuplicateAggregateCount() throws XmlException {
Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(DUPLICATE_AGGREGATE_COUNT));
assertThat(root.getChildNodes().get(0).getChildNodes(TemplateId.ACI_AGGREGATE_COUNT).count()).isEqualTo(2);
}
Aggregations