Search in sources :

Example 1 with LabTestResultInHPO

use of org.monarchinitiative.loinc2hpo.testresult.LabTestResultInHPO in project loinc2hpo by monarch-initiative.

the class FhirObservationAnalyzerTest method testUniversalAnnotation.

@Test
public void testUniversalAnnotation() throws Exception {
    FhirObservationAnalyzer.setObservation(observation);
    Map<LoincId, UniversalLoinc2HPOAnnotation> testmap = new HashMap<>();
    LoincId loincId = new LoincId("15074-8");
    LoincScale loincScale = LoincScale.string2enum("Qn");
    TermId low = hpoTermMap.get("Hypoglycemia").getId();
    TermId normal = hpoTermMap.get("Abnormality of blood glucose concentration").getId();
    TermId hi = hpoTermMap.get("Hyperglycemia").getId();
    Map<String, Code> internalCodes = CodeSystemConvertor.getCodeContainer().getCodeSystemMap().get(Loinc2HPOCodedValue.CODESYSTEM);
    /**
     *        UniversalLoinc2HPOAnnotation glucoseAnnotation = new UniversalLoinc2HPOAnnotation(loincId, loincScale);
     *        glucoseAnnotation.addAnnotation(internalCodes.get("L"), new HpoTermId4LoincTest(low, false))
     *                .addAnnotation(internalCodes.get("N"), new HpoTermId4LoincTest(normal, true))
     *                .addAnnotation(internalCodes.get("A"), new HpoTermId4LoincTest(normal, false))
     *                .addAnnotation(internalCodes.get("H"), new HpoTermId4LoincTest(hi, false));
     */
    UniversalLoinc2HPOAnnotation glucoseAnnotation = new UniversalLoinc2HPOAnnotation.Builder().setLoincId(loincId).setLoincScale(loincScale).setLowValueHpoTerm(hpoTermMap.get("Hypoglycemia")).setIntermediateValueHpoTerm(hpoTermMap.get("Abnormality of blood glucose concentration")).setHighValueHpoTerm(hpoTermMap.get("Hyperglycemia")).setIntermediateNegated(true).build();
    testmap.put(loincId, glucoseAnnotation);
    LabTestResultInHPO result = FhirObservationAnalyzer.getHPOFromInterpretation(FhirObservationAnalyzer.getObservation().getInterpretation(), testmap);
    System.out.println(result);
}
Also used : HashMap(java.util.HashMap) TermId(com.github.phenomics.ontolib.ontology.data.TermId) LabTestResultInHPO(org.monarchinitiative.loinc2hpo.testresult.LabTestResultInHPO) Code(org.monarchinitiative.loinc2hpo.codesystems.Code) Test(org.junit.Test)

Example 2 with LabTestResultInHPO

use of org.monarchinitiative.loinc2hpo.testresult.LabTestResultInHPO in project loinc2hpo by monarch-initiative.

the class Loinc2HpoConversionTabController method handleConvertButton.

@FXML
void handleConvertButton(ActionEvent event) {
    String path = model.getPathToJsonFhirFile();
    Observation observation = FhirResourceRetriever.parseJsonFile2Observation(path);
    FhirObservationAnalyzer.setObservation(observation);
    LabTestResultInHPO res = FhirObservationAnalyzer.getHPO4ObservationOutcome(model.getLoincIds(), model.getLoincAnnotationMap());
    ObservableList<String> items = FXCollections.observableArrayList();
    if (res == null) {
        items.add(observation.getId() + ": failed not interpret");
    } else {
        TermId id = res.getTermId();
        String name = model.termId2HpoName(id);
        String display = String.format("%s: %s [%s]", observation.getId(), name, id.getIdWithPrefix());
        if (res.isNegated()) {
            display = String.format("%s: NOT %s [%s]", observation.getId(), name, id.getIdWithPrefix());
        }
        items.add(display);
    }
    patientPhenotypeTableView.setItems(items);
}
Also used : Observation(org.hl7.fhir.dstu3.model.Observation) LabTestResultInHPO(org.monarchinitiative.loinc2hpo.testresult.LabTestResultInHPO) TermId(com.github.phenomics.ontolib.ontology.data.TermId) FXML(javafx.fxml.FXML)

Aggregations

TermId (com.github.phenomics.ontolib.ontology.data.TermId)2 LabTestResultInHPO (org.monarchinitiative.loinc2hpo.testresult.LabTestResultInHPO)2 HashMap (java.util.HashMap)1 FXML (javafx.fxml.FXML)1 Observation (org.hl7.fhir.dstu3.model.Observation)1 Test (org.junit.Test)1 Code (org.monarchinitiative.loinc2hpo.codesystems.Code)1