use of org.hl7.fhir.r4b.model.OperationOutcome 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");
}
use of org.hl7.fhir.r4b.model.OperationOutcome 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");
}
use of org.hl7.fhir.r4b.model.OperationOutcome 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/r4/valueset/valueset-pain-treatment-plan.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()));
}
use of org.hl7.fhir.r4b.model.OperationOutcome in project quality-measure-and-cohort-service by Alvearie.
the class FhirTestBase method mockNotFound.
protected void mockNotFound(String resource) {
OperationOutcome outcome = new OperationOutcome();
outcome.getText().setStatusAsString("generated");
outcome.getIssueFirstRep().setSeverity(IssueSeverity.ERROR).setCode(OperationOutcome.IssueType.PROCESSING).setDiagnostics(resource);
mockFhirResourceRetrieval(get(urlMatching(resource)), getFhirParser(), outcome, getFhirServerConfig(), 404);
}
use of org.hl7.fhir.r4b.model.OperationOutcome in project quality-measure-and-cohort-service by Alvearie.
the class CohortServiceExceptionMapperTest method testToResponseResourceNotFoundExceptionHAPIFormat.
@Test
public void testToResponseResourceNotFoundExceptionHAPIFormat() throws Exception {
OperationOutcome outcome = new OperationOutcome();
outcome.getText().setStatusAsString("generated");
outcome.getIssueFirstRep().setSeverity(IssueSeverity.ERROR).setCode(OperationOutcome.IssueType.PROCESSING).setDiagnostics("Resource Patient/something is not found");
ResourceNotFoundException ex = new ResourceNotFoundException("Error", outcome);
ex.setResponseBody(parser.encodeResourceToString(outcome));
Response response = new CohortServiceExceptionMapper().toResponse(ex);
ServiceErrorList actual = (ServiceErrorList) response.getEntity();
ServiceErrorList expected = new ServiceErrorList();
expected.setStatusCode(400);
expected.getErrors().add(newServiceError(404, "FHIR Resource Not Found: Error", "{\"resourceType\":\"OperationOutcome\",\"text\":{\"status\":\"generated\"},\"issue\":[{\"severity\":\"error\",\"code\":\"processing\",\"diagnostics\":\"Resource Patient/something is not found\"}]}"));
expected.setErrorSource(ErrorSource.FHIR_SERVER);
testErrorListEquality(expected, actual);
}
Aggregations