Search in sources :

Example 1 with OperationOutcomeIssueComponent

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

the class CacheValueSetsProviderIT method validateOutcome.

private void validateOutcome(Resource outcomeResource, String detailMessage) {
    assertTrue(outcomeResource instanceof OperationOutcome);
    OperationOutcome outcome = (OperationOutcome) outcomeResource;
    for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
        assertEquals(OperationOutcome.IssueSeverity.ERROR, issue.getSeverity());
        assertTrue(issue.getDetails().getCodingFirstRep().getDisplay().startsWith(detailMessage));
    }
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome)

Example 2 with OperationOutcomeIssueComponent

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

the class CodeSystemProviderIT method testDSTU3UpdateCodeSystems.

@Test
@Order(5)
public void testDSTU3UpdateCodeSystems() throws IOException {
    log.info("Beginning Test DSTU3 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("icd-10"));
        assertTrue(issue.getDetails().getText().contains("sct"));
        assertTrue(issue.getDetails().getText().contains("rxnorm"));
    }
    assertEquals(1, performCodeSystemSearchByUrl(icd10).size());
    assertEquals(1, performCodeSystemSearchByUrl(rxNormUrl).size());
    assertEquals(1, performCodeSystemSearchByUrl(snomedSctUrl).size());
    assertEquals(1, performCodeSystemSearchByUrl(cptUrl).size());
    log.info("Finished Test DSTU3 Update Code Systems");
}
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) 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)

Example 3 with OperationOutcomeIssueComponent

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

the class CacheValueSetsProviderIT method validateOutcome.

private void validateOutcome(Resource outcomeResource, String detailMessage) {
    assertTrue(outcomeResource instanceof OperationOutcome);
    OperationOutcome outcome = (OperationOutcome) outcomeResource;
    for (OperationOutcomeIssueComponent issue : outcome.getIssue()) {
        assertEquals(OperationOutcome.IssueSeverity.ERROR, issue.getSeverity());
        assertTrue(issue.getDetails().getCodingFirstRep().getDisplay().startsWith(detailMessage));
    }
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome)

Example 4 with OperationOutcomeIssueComponent

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

the class CodeSystemProviderIT method testR4ICD10PerformCodeSystemUpdateByList.

@Test
@Order(4)
public void testR4ICD10PerformCodeSystemUpdateByList() throws IOException {
    log.info("Beginning Test R4 SNOMED CodeSystemUpdate");
    BufferedReader reader = new BufferedReader(new InputStreamReader(CodeSystemProviderIT.class.getResourceAsStream("valueset" + "/" + "valueset-pdmp-review-procedure.json")));
    String resourceString = reader.lines().collect(Collectors.joining(System.lineSeparator()));
    reader.close();
    ValueSet vs = (ValueSet) loadResource("json", resourceString);
    assertEquals(0, performCodeSystemSearchByUrl(snomedSctUrl).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("sct"));
    }
    assertEquals(1, performCodeSystemSearchByUrl(snomedSctUrl).size());
    log.info("Finished Test R4 SNOMED CodeSystemUpdate");
}
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) ValueSet(org.hl7.fhir.r4.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 5 with OperationOutcomeIssueComponent

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

the class CodeSystemProviderIT method testR4RxNormCodeSystemUpdateById.

@Test
@Order(3)
public void testR4RxNormCodeSystemUpdateById() throws IOException {
    log.info("Beginning Test R4 LOINC CodeSystemUpdate");
    ValueSet vs = (ValueSet) loadResource("org/opencds/cqf/ruler/devtools/r4/valueset/valueset-pain-treatment-plan.json");
    assertEquals(0, performCodeSystemSearchByUrl(loincUrl).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("loinc"));
    }
    assertEquals(1, performCodeSystemSearchByUrl(loincUrl).size());
    log.info("Finished Test R4 LOINC CodeSystemUpdate");
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) ValueSet(org.hl7.fhir.r4.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)

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