Search in sources :

Example 31 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent in project cqf-ruler by DBCG.

the class CodeSystemProviderIT method testCodeSystemUpdateValueSetDNE.

@Test
@Order(1)
public void testCodeSystemUpdateValueSetDNE() throws IOException {
    ValueSet vs = (ValueSet) readResource("org/opencds/cqf/ruler/devtools/dstu3/valueset/AntithromboticTherapy.json");
    OperationOutcome outcome = codeSystemUpdateProvider.updateCodeSystems(vs.getIdElement());
    assertEquals(1, outcome.getIssue().size());
    OperationOutcomeIssueComponent issue = outcome.getIssue().get(0);
    assertEquals(OperationOutcome.IssueSeverity.ERROR, issue.getSeverity());
    assertTrue(issue.getDetails().getText().startsWith("Unable to find Resource: " + vs.getIdElement().getIdPart()));
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) ValueSet(org.hl7.fhir.dstu3.model.ValueSet) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 32 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent in project cqf-ruler by DBCG.

the class CodeSystemProviderIT method testCodeSystemUpdateValueSetIdNull.

@Test
@Order(2)
public void testCodeSystemUpdateValueSetIdNull() {
    OperationOutcome outcome = codeSystemUpdateProvider.updateCodeSystems(new ValueSet().getIdElement());
    assertEquals(1, outcome.getIssue().size());
    OperationOutcomeIssueComponent issue = outcome.getIssue().get(0);
    assertEquals(OperationOutcome.IssueSeverity.ERROR, issue.getSeverity());
    assertTrue(issue.getDetails().getText().startsWith("Unable to find Resource: null"));
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) ValueSet(org.hl7.fhir.dstu3.model.ValueSet) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 33 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent in project cqf-ruler by DBCG.

the class CodeSystemProviderIT method testDSTU3RxNormCodeSystemUpdateById.

@Test
@Order(3)
public void testDSTU3RxNormCodeSystemUpdateById() throws IOException {
    log.info("Beginning Test DSTU3 RxNorm CodeSystemUpdate");
    ValueSet vs = (ValueSet) loadResource("org/opencds/cqf/ruler/devtools/dstu3/valueset/AntithromboticTherapy.json");
    assertEquals(0, performCodeSystemSearchByUrl(rxNormUrl).size());
    OperationOutcome outcome = codeSystemUpdateProvider.updateCodeSystems(vs.getIdElement());
    for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
        assertEquals(OperationOutcome.IssueSeverity.INFORMATION, issue.getSeverity());
        assertTrue(issue.getDetails().getText().startsWith("Successfully updated the following CodeSystems: "));
        assertTrue(issue.getDetails().getText().contains("rxnorm"));
    }
    assertEquals(1, performCodeSystemSearchByUrl(rxNormUrl).size());
    log.info("Finished Test DSTU3 RxNorm CodeSystemUpdate");
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) ValueSet(org.hl7.fhir.dstu3.model.ValueSet) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 34 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent in project cqf-ruler by DBCG.

the class CodeSystemProviderIT method testDSTU3ICD10PerformCodeSystemUpdateByList.

@Test
@Order(4)
public void testDSTU3ICD10PerformCodeSystemUpdateByList() throws IOException {
    log.info("Beginning Test DSTU3 ICD10 CodeSystemUpdate");
    BufferedReader reader = new BufferedReader(new InputStreamReader(CodeSystemProviderIT.class.getResourceAsStream("valueset" + "/" + "AllPrimaryandSecondaryCancer.json")));
    String resourceString = reader.lines().collect(Collectors.joining(System.lineSeparator()));
    reader.close();
    ValueSet vs = (ValueSet) loadResource("json", resourceString);
    assertEquals(0, performCodeSystemSearchByUrl(icd10).size());
    codeSystemUpdateProvider.performCodeSystemUpdate(Arrays.asList(vs));
    OperationOutcome outcome = codeSystemUpdateProvider.updateCodeSystems(vs.getIdElement());
    for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
        assertEquals(OperationOutcome.IssueSeverity.INFORMATION, issue.getSeverity());
        assertTrue(issue.getDetails().getText().startsWith("Successfully updated the following CodeSystems: "));
        assertTrue(issue.getDetails().getText().contains("icd-10"));
    }
    assertEquals(1, performCodeSystemSearchByUrl(icd10).size());
    log.info("Finished Test DSTU3 ICD10 CodeSystemUpdate");
}
Also used : InputStreamReader(java.io.InputStreamReader) OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) BufferedReader(java.io.BufferedReader) ValueSet(org.hl7.fhir.dstu3.model.ValueSet) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 35 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent in project cqf-ruler by DBCG.

the class CodeSystemProviderIT method testR4UpdateCodeSystems.

@Test
@Order(5)
public void testR4UpdateCodeSystems() throws IOException {
    log.info("Beginning Test R4 Update Code Systems");
    assertEquals(0, performCodeSystemSearchByUrl(cptUrl).size());
    File[] valuesets = new File(CodeSystemProviderIT.class.getResource("valueset").getPath()).listFiles();
    for (File file : valuesets) {
        if (file.isFile() && FilenameUtils.getExtension(file.getPath()).equals("json")) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
            String resourceString = reader.lines().collect(Collectors.joining(System.lineSeparator()));
            reader.close();
            loadResource("json", resourceString);
        } else if (file.isFile() && FilenameUtils.getExtension(file.getPath()).equals("xml")) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
            String resourceString = reader.lines().collect(Collectors.joining(System.lineSeparator()));
            reader.close();
            loadResource("xml", resourceString);
        }
    }
    OperationOutcome outcome = codeSystemUpdateProvider.updateCodeSystems();
    for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
        assertEquals(OperationOutcome.IssueSeverity.INFORMATION, issue.getSeverity());
        assertTrue(issue.getDetails().getText().startsWith("Successfully updated the following CodeSystems: "));
        assertTrue(issue.getDetails().getText().contains("cpt"));
        assertTrue(issue.getDetails().getText().contains("sct"));
        assertTrue(issue.getDetails().getText().contains("loinc"));
    }
    assertEquals(1, performCodeSystemSearchByUrl(loincUrl).size());
    assertEquals(1, performCodeSystemSearchByUrl(snomedSctUrl).size());
    assertEquals(1, performCodeSystemSearchByUrl(cptUrl).size());
    log.info("Finished Test R4 Update Code Systems");
}
Also used : InputStreamReader(java.io.InputStreamReader) OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) BufferedReader(java.io.BufferedReader) File(java.io.File) FileInputStream(java.io.FileInputStream) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

OperationOutcomeIssueComponent (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent)23 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)20 Test (org.junit.jupiter.api.Test)17 OperationOutcomeIssueComponent (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)10 Order (org.junit.jupiter.api.Order)10 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)10 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 OperationOutcomeIssueComponent (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent)8 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)7 OperationOutcome (org.hl7.fhir.r5.model.OperationOutcome)5 CacheVerificationLogger (org.hl7.fhir.utilities.tests.CacheVerificationLogger)5 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)5 ValidationEngine (org.hl7.fhir.validation.ValidationEngine)5 BufferedReader (java.io.BufferedReader)4 InputStreamReader (java.io.InputStreamReader)4 Nonnull (javax.annotation.Nonnull)4 ValueSet (org.hl7.fhir.dstu3.model.ValueSet)4 IBaseOperationOutcome (org.hl7.fhir.instance.model.api.IBaseOperationOutcome)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3