use of org.hl7.fhir.r4.model.Observation.ObservationStatus in project openmrs-module-fhir2 by openmrs.
the class ObservationStatusTranslatorImplTest method shouldMapFhirRepresentationToNull.
@Test
public void shouldMapFhirRepresentationToNull() {
Obs obs = new Obs();
Observation.ObservationStatus observationStatus = Observation.ObservationStatus.FINAL;
Obs result = observationStatusTranslator.toOpenmrsType(obs, observationStatus);
assertThat(result, notNullValue());
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus in project eCRNow by drajer-health.
the class R4ResourcesData method filterObservationByStatus.
private Bundle filterObservationByStatus(Bundle bundle, String observationStatus) {
Bundle filteredBundle = new Bundle();
int observationInError = 0;
List<BundleEntryComponent> filteredEntryComponents = new ArrayList<>();
for (BundleEntryComponent entryComp : bundle.getEntry()) {
Observation observation = (Observation) entryComp.getResource();
if (observation.hasStatus()) {
if (!observation.getStatus().toCode().equals(observationStatus)) {
filteredEntryComponents.add(new BundleEntryComponent().setResource(observation));
} else {
observationInError++;
}
}
}
logger.info("Skipped {} Observation with status entered-in-error", observationInError);
filteredBundle.setEntry(filteredEntryComponents);
return filteredBundle;
}
Aggregations