use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class ObservationR4 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(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 abnormal.
@Test
public void abnormal() {
ShortCode pos = ShortCode.POS;
String fhirAbnormal = "A";
assertEquals(pos, FhirOutcomeCode.fhir2shortcode(fhirAbnormal));
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class FhirOutcomeCodeTest method criticallyAbnormal.
@Test
public void criticallyAbnormal() {
ShortCode pos = ShortCode.POS;
String fhirCriticallyAbnormal = "AA";
assertEquals(pos, FhirOutcomeCode.fhir2shortcode(fhirCriticallyAbnormal));
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class FhirOutcomeCodeTest method criticallyHigh.
@Test
public void criticallyHigh() {
ShortCode high = ShortCode.H;
String fhirOffScaleHigh = "HH";
assertEquals(high, FhirOutcomeCode.fhir2shortcode(fhirOffScaleHigh));
}
use of org.monarchinitiative.loinc2hpocore.codesystems.ShortCode in project loinc2hpo by monarch-initiative.
the class ObservationDtu3 method getOutcome.
@Override
public Optional<Outcome> getOutcome() {
if (observation.hasInterpretation()) {
List<String> codes = this.observation.getInterpretation().getCoding().stream().map(Coding::getCode).distinct().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();
}
}
Aggregations