use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class ObservationR5 method getOutcome.
@Override
public Optional<Outcome> getOutcome() {
if (observation.hasInterpretation()) {
List<String> codes = this.observation.getInterpretation().stream().distinct().map(CodeableConcept::getCoding).flatMap(Collection::stream).map(org.hl7.fhir.r5.model.Coding::getCode).collect(Collectors.toList());
if (codes.size() > 1) {
LOGGER.error("Multiple interpretation codes returned");
return Optional.empty();
}
ShortCode code = ShortCode.fromShortCode(codes.get(0));
Outcome outcome = getOutcome(code, observation);
return Optional.of(outcome);
} else if (observation.hasValueCodeableConcept()) {
return getOutcomeFromCodedValue();
} else if (observation.hasValueQuantity()) {
return getOutcomeFromValueQuantity();
} else {
LOGGER.error("Unable to handle observation {}", observation);
return Optional.empty();
}
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class FhirOutcomeCodeTest method low.
@Test
public void low() {
ShortCode low = ShortCode.L;
String fhirOffScaleLow = "L";
assertEquals(low, FhirOutcomeCode.fhir2shortcode(fhirOffScaleLow));
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class FhirOutcomeCodeTest method notDetected.
@Test
public void notDetected() {
ShortCode neg = ShortCode.NEG;
String fhirNotDetected = "ND";
assertEquals(neg, FhirOutcomeCode.fhir2shortcode(fhirNotDetected));
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class FhirOutcomeCodeTest method high.
@Test
public void high() {
ShortCode high = ShortCode.H;
String fhirOffScaleHigh = "H";
assertEquals(high, FhirOutcomeCode.fhir2shortcode(fhirOffScaleHigh));
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class FhirOutcomeCodeTest method criticalLow.
@Test
public void criticalLow() {
ShortCode low = ShortCode.L;
String fhirOffScaleLow = "LL";
assertEquals(low, FhirOutcomeCode.fhir2shortcode(fhirOffScaleLow));
}
Aggregations