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));
}
}
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");
}
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));
}
}
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");
}
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");
}
Aggregations