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);
}
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);
}
Aggregations