use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED 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");
}
use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED in project cqf-ruler by DBCG.
the class DataOperationProviderIT method testR4LibraryFhirQueryPattern.
@Test
public void testR4LibraryFhirQueryPattern() throws IOException {
String bundleAsText = stringFromResource("ExmLogicTransactionBundle.json");
Bundle bundle = (Bundle) getFhirContext().newJsonParser().parseResource(bundleAsText);
getClient().transaction().withBundle(bundle).execute();
Parameters params = new Parameters();
params.addParameter().setName("target").setValue(new StringType("dummy"));
Library returnLibrary = getClient().operation().onInstance(new IdType("Library", "EXMLogic")).named("$data-requirements").withParameters(params).returnResourceType(Library.class).execute();
assertNotNull(returnLibrary);
for (DataRequirement dr : returnLibrary.getDataRequirement()) {
switch(dr.getType()) {
case "Patient":
{
String query = dr.getExtensionByUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-fhirQueryPattern").getValueAsPrimitive().getValueAsString();
assertTrue("Patient?_id={{context.patientId}}".equals(query));
}
break;
case "Encounter":
{
String query = dr.getExtensionByUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-fhirQueryPattern").getValueAsPrimitive().getValueAsString();
if (dr.hasCodeFilter()) {
assertTrue("Encounter?status=finished&subject=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292".equals(query));
} else {
assertTrue("Encounter?subject=Patient/{{context.patientId}}".equals(query));
}
}
break;
case "Coverage":
{
String query = dr.getExtensionByUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-fhirQueryPattern").getValueAsPrimitive().getValueAsString();
assertTrue("Coverage?policy-holder=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591".equals(query));
}
break;
}
}
}
use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED in project cqf-ruler by DBCG.
the class DataOperationProviderIT method testR4MeasureFhirQueryPattern.
@Test
public void testR4MeasureFhirQueryPattern() throws IOException {
String bundleAsText = stringFromResource("ExmLogicMeasureTransactionBundle.json");
Bundle bundle = (Bundle) getFhirContext().newJsonParser().parseResource(bundleAsText);
getClient().transaction().withBundle(bundle).execute();
Parameters params = new Parameters();
params.addParameter().setName("startPeriod").setValue(new StringType("2019-01-01"));
params.addParameter().setName("endPeriod").setValue(new StringType("2020-01-01"));
Library returnLibrary = getClient().operation().onInstance(new IdType("Measure", "measure-exm")).named("$data-requirements").withParameters(params).returnResourceType(Library.class).execute();
assertNotNull(returnLibrary);
for (DataRequirement dr : returnLibrary.getDataRequirement()) {
switch(dr.getType()) {
case "Patient":
{
String query = dr.getExtensionByUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-fhirQueryPattern").getValueAsPrimitive().getValueAsString();
assertTrue("Patient?_id={{context.patientId}}".equals(query));
}
break;
case "Encounter":
{
String query = dr.getExtensionByUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-fhirQueryPattern").getValueAsPrimitive().getValueAsString();
if (dr.hasCodeFilter()) {
assertTrue("Encounter?status=finished&subject=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292".equals(query));
} else {
assertTrue("Encounter?subject=Patient/{{context.patientId}}".equals(query));
}
}
break;
case "Coverage":
{
String query = dr.getExtensionByUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-fhirQueryPattern").getValueAsPrimitive().getValueAsString();
assertTrue("Coverage?policy-holder=Patient/{{context.patientId}}&type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591".equals(query));
}
break;
}
}
}
use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED in project summary-care-record-api by NHSDigital.
the class DiagnosisMapper method mapEncounter.
private void mapEncounter(Node diagnosis, Condition condition, List<Resource> resources) {
Optional<Node> author = xmlUtils.detachOptionalNodeByXPath(diagnosis, DIAGNOSIS_AUTHOR_XPATH);
Optional<Node> informant = xmlUtils.detachOptionalNodeByXPath(diagnosis, DIAGNOSIS_INFORMANT_XPATH);
if (author.isPresent() || informant.isPresent()) {
Encounter encounter = new Encounter();
encounter.setStatus(FINISHED);
encounter.setClass_(new Coding().setCode("UNK").setSystem("http://terminology.hl7.org/CodeSystem/v3-NullFlavor").setDisplay("Unknown"));
encounter.setId(randomUUID());
author.ifPresent(authorNode -> mapAuthor(resources, encounter, authorNode));
informant.ifPresent(informantNode -> mapInformant(resources, encounter, informantNode));
condition.setEncounter(new Reference(encounter));
resources.add(encounter);
}
}
use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED in project summary-care-record-api by NHSDigital.
the class FindingMapper method mapEncounter.
private void mapEncounter(Node finding, Observation observation, List<Resource> resources) {
Optional<Node> author = xmlUtils.detachOptionalNodeByXPath(finding, FINDING_AUTHOR_XPATH);
Optional<Node> informant = xmlUtils.detachOptionalNodeByXPath(finding, FINDING_INFORMANT_XPATH);
NodeList performerNodes = xmlUtils.getNodeListByXPath(finding, FINDING_PERFORMER_XPATH);
if (author.isPresent() || informant.isPresent() || performerNodes.getLength() > 0) {
Encounter encounter = new Encounter();
encounter.setStatus(FINISHED);
encounter.setClass_(new Coding().setCode("UNK").setSystem(ENCOUNTER_CLASS_SYSTEM).setDisplay("Unknown"));
encounter.setId(randomUUID());
mapPerformers(resources, encounter, performerNodes);
author.ifPresent(authorNode -> mapAuthor(resources, encounter, authorNode));
informant.ifPresent(informantNode -> mapInformant(resources, encounter, informantNode));
observation.setEncounter(new Reference(encounter));
resources.add(encounter);
}
}
Aggregations