use of org.hl7.fhir.r4b.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()));
}
use of org.hl7.fhir.r4b.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"));
}
use of org.hl7.fhir.r4b.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");
}
use of org.hl7.fhir.r4b.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");
}
use of org.hl7.fhir.r4b.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");
}
Aggregations