use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class QedDecoderTest method decodeQEDAsNode.
@Test
void decodeQEDAsNode() throws Exception {
String xmlFragment = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\">\n" + " <qed resultName=\"result\" resultValue=\"mytestvalue\">\n" + " <templateId root=\"Q.E.D\"/>\n" + " </qed>" + "</root>";
// Get the root wrapper node
Node root = new QrdaDecoderEngine(new Context()).decode(XmlUtils.stringToDom(xmlFragment));
assertThat(root.getChildNodes()).hasSize(1);
Node target = root.getChildNodes().get(0);
assertThat(target.getValue("result")).isEqualTo("mytestvalue");
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AciSectionEncoderTest method aboutMetadataHolder.
@Test
void aboutMetadataHolder() {
JsonWrapper jsonWrapper = new JsonWrapper();
AciSectionEncoder aciSectionEncoder = new AciSectionEncoder(new Context());
aciSectionEncoder.internalEncode(jsonWrapper, aciSectionNode);
Map<?, ?> testMapObject = (Map<?, ?>) jsonWrapper.getObject();
Stream failed = ((Set) testMapObject.get("metadata_holder")).stream().filter(entry -> ((Map) entry).get("template").equals(TemplateId.REPORTING_PARAMETERS_ACT.name())).filter(entry -> ((Map) entry).get("encodeLabel").equals(""));
assertThat(failed.count()).isEqualTo(0);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AggregateCountEncoderTest method testEncoder.
/**
* Test Function for the AggregateCountEncode
*/
@Test
void testEncoder() {
AggregateCountEncoder encoder = new AggregateCountEncoder(new Context());
encoder.setNodes(nodes);
JsonWrapper json = new JsonWrapper();
try {
encoder.internalEncode(json, numeratorDenominatorNode);
} catch (EncodeException e) {
Assertions.fail("Failure to encode: " + e.getMessage());
}
assertThat(json.getInteger("value")).isEqualTo(600);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class AggregateCountEncoderTest method testEncoderWithFramework.
/**
* Test Function for the QppOutputEncoder
*/
@Test
void testEncoderWithFramework() {
QppOutputEncoder encoder = new QppOutputEncoder(new Context());
encoder.setNodes(nodes);
StringWriter sw = new StringWriter();
try {
encoder.encode(new BufferedWriter(sw));
} catch (EncodeException e) {
Assertions.fail("Failure to encode: " + e.getMessage());
}
// NOTE: This test is only relevant in that it finds the deep value but it is not actually a result
String expected = "{\n \"value\" : 600\n}";
assertThat(sw.toString()).isEqualTo(expected);
}
use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.
the class ClinicalDocumentEncoderTest method testClinicalDocumentEncoderIgnoresInvalidMeasurementSection.
@Test
void testClinicalDocumentEncoderIgnoresInvalidMeasurementSection() {
Node reportingParamNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT, clinicalDocumentNode);
reportingParamNode.putValue(ReportingParametersActEncoder.PERFORMANCE_START, "20170101");
reportingParamNode.putValue(ReportingParametersActEncoder.PERFORMANCE_END, "20171231");
JsonWrapper testJsonWrapper = new JsonWrapper();
String expectedSection = "aci";
ClinicalDocumentEncoder clinicalDocumentEncoder = new ClinicalDocumentEncoder(new Context());
clinicalDocumentEncoder.internalEncode(testJsonWrapper, clinicalDocumentNode);
Map<?, ?> clinicalDocMap = ((Map<?, ?>) testJsonWrapper.getObject());
List<LinkedHashMap<String, Object>> measurementSets = getMeasurementSets(clinicalDocMap);
String value = (String) measurementSets.get(0).get("category");
assertThat(measurementSets).hasSize(1);
assertThat(value).isEqualTo(expectedSection);
}
Aggregations