Search in sources :

Example 21 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class ClinicalDocumentDecoderTest method decodeClinicalDocumentInternalDecodeMIPSIndividual.

@Test
void decodeClinicalDocumentInternalDecodeMIPSIndividual() {
    Element clinicalDocument = makeClinicalDocument("MIPS_INDIV");
    Node testParentNode = new Node();
    ClinicalDocumentDecoder objectUnderTest = new ClinicalDocumentDecoder(new Context());
    objectUnderTest.setNamespace(clinicalDocument.getNamespace());
    objectUnderTest.decode(clinicalDocument, testParentNode);
    assertWithMessage("Clinical Document doesn't contain program name").that(testParentNode.getValue(ClinicalDocumentDecoder.PROGRAM_NAME)).isEqualTo(ClinicalDocumentDecoder.MIPS_PROGRAM_NAME);
    assertWithMessage("Clinical Document doesn't contain entity type").that(testParentNode.getValue(ClinicalDocumentDecoder.ENTITY_TYPE)).isEqualTo(ClinicalDocumentDecoder.ENTITY_INDIVIDUAL);
    assertWithMessage("Clinical Document doesn't contain national provider").that(testParentNode.getValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER)).isEqualTo("2567891421");
    assertWithMessage("Clinical Document doesn't contain taxpayer id number").that(testParentNode.getValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER)).isEqualTo("123456789");
}
Also used : Context(gov.cms.qpp.conversion.Context) Element(org.jdom2.Element) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 22 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class IaMeasureDecoderTest method internalDecode.

@Test
void internalDecode() throws Exception {
    IaMeasureDecoder decoder = new IaMeasureDecoder(new Context());
    QrdaDecoderEngine engine = new QrdaDecoderEngine(new Context());
    Node root = engine.decode(XmlUtils.stringToDom(xmlFragment));
    Node iaMeasure = root.findFirstNode(TemplateId.IA_MEASURE);
    Node measurePerformed = root.findFirstNode(TemplateId.MEASURE_PERFORMED);
    String value = measurePerformed.getValue("measurePerformed");
    assertThat(iaMeasure.getValue("measureId")).isEqualTo("IA_EPA_1");
    assertThat(measurePerformed.getType()).isEqualTo(TemplateId.MEASURE_PERFORMED);
    assertThat(value).isEqualTo("Y");
}
Also used : Context(gov.cms.qpp.conversion.Context) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 23 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class QualitySectionDecoderTest method testInternalDecodeValidXml.

/**
 * This tests the QualitySectionDecoder
 * This decoders exists as a child of Clinical Document Decoder which is not tested here.
 *
 * @throws XmlException when parsing invalid xml fragment
 */
@Test
void testInternalDecodeValidXml() throws XmlException {
    String validXML = getValidXML();
    Element element = XmlUtils.stringToDom(validXML);
    Node node = new Node();
    QualitySectionDecoder sectionDecoder = new QualitySectionDecoder(new Context());
    sectionDecoder.decode(element, node);
    assertThat(node.getValue("category")).isEqualTo("quality");
// Performance start and Performance end are parsed by ReportParameters decoder and are not children of this decoder
}
Also used : Context(gov.cms.qpp.conversion.Context) Element(org.jdom2.Element) Node(gov.cms.qpp.conversion.model.Node) Test(org.junit.jupiter.api.Test)

Example 24 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class SupplementalDataEthnicityDecoderTest method decodeNodeFromFile.

private void decodeNodeFromFile(String filename) throws XmlException {
    context = new Context();
    SupplementalDataEthnicityDecoder decoder = new SupplementalDataEthnicityDecoder(context);
    QrdaDecoderEngine engine = new QrdaDecoderEngine(context);
    root = engine.decode(XmlUtils.stringToDom(filename));
}
Also used : Context(gov.cms.qpp.conversion.Context)

Example 25 with Context

use of gov.cms.qpp.conversion.Context in project qpp-conversion-tool by CMSgov.

the class SupplementalDataSexDecoderTest method decodeNodeFromFile.

private void decodeNodeFromFile(String filename) throws XmlException {
    context = new Context();
    SupplementalDataSexDecoder decoder = new SupplementalDataSexDecoder(context);
    QrdaDecoderEngine engine = new QrdaDecoderEngine(context);
    root = engine.decode(XmlUtils.stringToDom(filename));
}
Also used : Context(gov.cms.qpp.conversion.Context)

Aggregations

Context (gov.cms.qpp.conversion.Context)114 Test (org.junit.jupiter.api.Test)92 Node (gov.cms.qpp.conversion.model.Node)63 BufferedWriter (java.io.BufferedWriter)17 StringWriter (java.io.StringWriter)17 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)14 Element (org.jdom2.Element)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 QppOutputEncoder (gov.cms.qpp.conversion.encode.QppOutputEncoder)8 ArrayList (java.util.ArrayList)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 TemplateId (gov.cms.qpp.conversion.model.TemplateId)4 Detail (gov.cms.qpp.conversion.model.error.Detail)4 InputStream (java.io.InputStream)4 Namespace (org.jdom2.Namespace)4 Map (java.util.Map)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 Converter (gov.cms.qpp.conversion.Converter)2 PathSource (gov.cms.qpp.conversion.PathSource)2 ComponentKey (gov.cms.qpp.conversion.model.ComponentKey)2