use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class Loinc2HpoAnnotationParser method loincToHpoAnnotationMap.
public Map<LoincId, LoincAnnotation> loincToHpoAnnotationMap() {
Map<LoincId, List<Loinc2HpoAnnotation>> result = entries.stream().collect(Collectors.groupingBy(Loinc2HpoAnnotation::getLoincId, Collectors.mapping(Function.identity(), Collectors.toList())));
Map<LoincId, LoincAnnotation> outcomesMap = new TreeMap<>();
for (var e : result.entrySet()) {
LoincId loincId = e.getKey();
List<Loinc2HpoAnnotation> outcomes = e.getValue();
LoincAnnotation lannot = Loinc2HpoAnnotation.outcomes2LoincAnnotation(outcomes);
outcomesMap.put(loincId, lannot);
}
return outcomesMap;
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class Dstu3ObservationTest method testGlucoseNormal.
@Test
void testGlucoseNormal() throws IOException {
String jsonPath = "json/glucoseNormal.fhir";
Observation glucoseAbnormal = importDstu3Observation(jsonPath);
Uberobservation uberobservation = new ObservationDtu3(glucoseAbnormal);
LoincId expectedLoincId = new LoincId("15074-8");
Optional<LoincId> opt = uberobservation.getLoincId();
assertTrue(opt.isPresent());
assertEquals(expectedLoincId, opt.get());
Optional<Outcome> opt2 = uberobservation.getOutcome();
assertTrue(opt2.isPresent());
assertEquals(Outcome.NORMAL(), opt2.get());
assertNotEquals(Outcome.LOW(), opt2.get());
assertNotEquals(Outcome.HIGH(), opt2.get());
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class Dstu3ObservationTest method testGlucoseHigh.
@Test
void testGlucoseHigh() throws IOException {
String jsonPath = "json/glucoseHigh.fhir";
Observation glucoseHigh = importDstu3Observation(jsonPath);
Uberobservation uberobservation = new ObservationDtu3(glucoseHigh);
LoincId expectedLoincId = new LoincId("15074-8");
Optional<LoincId> opt = uberobservation.getLoincId();
assertTrue(opt.isPresent());
assertEquals(expectedLoincId, opt.get());
Optional<Outcome> opt2 = uberobservation.getOutcome();
assertTrue(opt2.isPresent());
assertEquals(Outcome.HIGH(), opt2.get());
assertNotEquals(Outcome.LOW(), opt2.get());
assertNotEquals(Outcome.NORMAL(), opt2.get());
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class ObservationWithValueRangeTest method highHbWithReferenceRange.
/**
* This observation does not have an Interpretation, but we can infer the value to be high
* based on the reference range.
*/
@Test
public void highHbWithReferenceRange() {
Observation observation = highHemoglobinWithValueRangeObservation();
Uberobservation uberobservation = new ObservationDtu3(observation);
LoincId erysInBlood = new LoincId("789-8");
Optional<LoincId> opt = uberobservation.getLoincId();
assertTrue(opt.isPresent());
assertEquals(erysInBlood, opt.get());
Optional<Outcome> outcomeOpt = uberobservation.getOutcome();
assertTrue(outcomeOpt.isPresent());
assertEquals(Outcome.HIGH(), outcomeOpt.get());
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class ObservationWithInterpretationTest method testLowHemoglobinWithoutInterpretation.
/**
* Low erythrocytes with L interpretation.
*/
@Test
public void testLowHemoglobinWithoutInterpretation() {
Observation lowHb = lowHemoglobinObservation();
Uberobservation uberobservation = new ObservationDtu3(lowHb);
LoincId erysInBlood = new LoincId("789-8");
Optional<LoincId> opt = uberobservation.getLoincId();
assertTrue(opt.isPresent());
assertEquals(erysInBlood, opt.get());
Optional<Outcome> outcomeOpt = uberobservation.getOutcome();
assertTrue(outcomeOpt.isPresent());
assertEquals(Outcome.LOW(), outcomeOpt.get());
}
Aggregations