Search in sources :

Example 11 with Outcome

use of org.monarchinitiative.loinc2hpocore.codesystems.Outcome in project loinc2hpo by monarch-initiative.

the class Dstu3ObservationTest method testGlucoseLow.

@Test
void testGlucoseLow() throws IOException {
    String jsonPath = "json/glucoseLow.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.LOW(), opt2.get());
    assertNotEquals(Outcome.NORMAL(), opt2.get());
    assertNotEquals(Outcome.HIGH(), opt2.get());
}
Also used : ObservationDtu3(org.monarchinitiative.loinc2hpofhir.fhir2hpo.ObservationDtu3) Outcome(org.monarchinitiative.loinc2hpocore.codesystems.Outcome) Observation(org.hl7.fhir.dstu3.model.Observation) TestBase.importDstu3Observation(fhir.TestBase.importDstu3Observation) LoincId(org.monarchinitiative.loinc2hpocore.loinc.LoincId) Uberobservation(org.monarchinitiative.loinc2hpofhir.fhir2hpo.Uberobservation) Test(org.junit.jupiter.api.Test)

Example 12 with Outcome

use of org.monarchinitiative.loinc2hpocore.codesystems.Outcome in project loinc2hpo by monarch-initiative.

the class ObservationR4 method getOutcomeFromCodedValue.

Optional<Outcome> getOutcomeFromCodedValue() {
    CodeableConcept codeableConcept = this.observation.getValueCodeableConcept();
    if (codeableConcept == null) {
        // should never happen
        LOGGER.error("Codable concept null in getOutcomeFromCodedValue");
    }
    List<Coding> codings = codeableConcept != null ? codeableConcept.getCoding() : List.of();
    for (Coding coding : codings) {
        String code = coding.getCode();
        String system = coding.getSystem();
        String display = coding.getDisplay();
        String outcomeString = code + ":" + system + ":" + display;
        Outcome outcome = Outcome.nominal(outcomeString);
        return Optional.of(outcome);
    }
    return Optional.empty();
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) Outcome(org.monarchinitiative.loinc2hpocore.codesystems.Outcome) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 13 with Outcome

use of org.monarchinitiative.loinc2hpocore.codesystems.Outcome in project loinc2hpo by monarch-initiative.

the class ObservationWithCodedValueTest method testEcoliBloodCulture.

@Test
public void testEcoliBloodCulture() {
    Observation ecoliObservation = ecoliNoInterpretationBloodCulture();
    Uberobservation uberobservation = new ObservationDtu3(ecoliObservation);
    LoincId loincId = new LoincId("600-7");
    Optional<LoincId> loincOpt = uberobservation.getLoincId();
    assertTrue(loincOpt.isPresent());
    assertEquals(loincId, loincOpt.get());
    Optional<Outcome> outcomeOpt = uberobservation.getOutcome();
    assertTrue(outcomeOpt.isPresent());
    Outcome outcome = outcomeOpt.get();
    assertTrue(outcome.isNominal());
    assertEquals("112283007:http://snomed.info/sct:Escherichia coli", outcome.getOutcome());
}
Also used : ObservationDtu3(org.monarchinitiative.loinc2hpofhir.fhir2hpo.ObservationDtu3) Outcome(org.monarchinitiative.loinc2hpocore.codesystems.Outcome) Observation(org.hl7.fhir.dstu3.model.Observation) LoincId(org.monarchinitiative.loinc2hpocore.loinc.LoincId) Uberobservation(org.monarchinitiative.loinc2hpofhir.fhir2hpo.Uberobservation) Test(org.junit.jupiter.api.Test)

Aggregations

Outcome (org.monarchinitiative.loinc2hpocore.codesystems.Outcome)13 LoincId (org.monarchinitiative.loinc2hpocore.loinc.LoincId)7 Observation (org.hl7.fhir.dstu3.model.Observation)6 Test (org.junit.jupiter.api.Test)6 ObservationDtu3 (org.monarchinitiative.loinc2hpofhir.fhir2hpo.ObservationDtu3)6 Uberobservation (org.monarchinitiative.loinc2hpofhir.fhir2hpo.Uberobservation)6 TestBase.importDstu3Observation (fhir.TestBase.importDstu3Observation)3 ShortCode (org.monarchinitiative.loinc2hpocore.codesystems.ShortCode)3 Collection (java.util.Collection)2 Coding (org.hl7.fhir.dstu3.model.Coding)2 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)1 Coding (org.hl7.fhir.r4.model.Coding)1 CodeableConcept (org.hl7.fhir.r5.model.CodeableConcept)1 Coding (org.hl7.fhir.r5.model.Coding)1 TermId (org.monarchinitiative.phenol.ontology.data.TermId)1