use of org.monarchinitiative.loinc2hpo.util.LoincCodeClass in project loinc2hpo by monarch-initiative.
the class AnnotateTabController method handleManualQueryButton.
@FXML
private void handleManualQueryButton(ActionEvent e) {
e.consume();
if (SparqlQuery.model == null) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("HPO Model Undefined");
alert.setHeaderText("Create HPO model first before querying");
alert.setContentText("Click \"Initialize HPO model\" to create an" + " HPO model for Sparql query. Click and query again.");
alert.showAndWait();
return;
}
// for now, force user choose a loinc entry. TODO: user may or may not
// choose a loinc term.
LoincEntry entry = loincTableView.getSelectionModel().getSelectedItem();
if (entry == null) {
noLoincEntryAlert();
return;
}
if (model.getLoincUnderEditing() != null && !model.getLoincUnderEditing().equals(entry)) {
PopUps.showInfoMessage("You are currently editing " + model.getLoincUnderEditing().getLOINC_Number() + ". Save or cancel editing current loinc annotation before switching to others", "Under Editing mode");
return;
}
String userInput = userInputForManualQuery.getText();
if (userInput == null || userInput.trim().length() < 2) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Input Error");
alert.setHeaderText("Type in keys for manual query");
alert.setContentText("Provide comma seperated keys for query. Do " + "not use quotes(\"\"). Avoid non-specific words " + "or numbers. Synonyms are strongly recommended if " + "auto-query is not working.");
alert.showAndWait();
return;
}
String[] keys = userInput.split(",");
List<String> keysInList = new ArrayList<>();
for (String key : keys) {
if (key.length() > 0) {
keysInList.add(key);
}
}
String name = entry.getLongName();
LoincCodeClass loincCodeClass = LoincLongNameParser.parse(name);
List<HPO_Class_Found> queryResults = SparqlQuery.query_manual(keysInList, loincCodeClass);
if (queryResults.size() != 0) {
ObservableList<HPO_Class_Found> items = FXCollections.observableArrayList();
for (HPO_Class_Found candidate : queryResults) {
items.add(candidate);
}
this.hpoListView.setItems(items);
userInputForManualQuery.clear();
// items.add("0 result is found. Try manual search with synonyms.");
} else {
ObservableList<String> items = FXCollections.observableArrayList();
items.add("0 HPO class is found. Try manual search with " + "alternative keys (synonyms)");
this.hpoListView.setItems(items);
}
// clear text in abnormality text fields if not currently editing a term
if (!createAnnotationButton.getText().equals("Save")) {
// Got user feedback that they do not want to clear the field when doing manual query
// clearAbnormalityTextField();
// inialize the flag field
flagForAnnotation.setIndeterminate(false);
flagForAnnotation.setSelected(false);
createAnnotationSuccess.setFill(Color.WHITE);
annotationNoteField.setText("");
}
}
use of org.monarchinitiative.loinc2hpo.util.LoincCodeClass in project loinc2hpo by monarch-initiative.
the class LoincLongNameParserTest method testString13.
@Test
public void testString13() {
String name = "pH of Urine by Test strip";
LoincCodeClass loinc = LoincLongNameParser.parse(name);
assertEquals("pH", loinc.getLoincParameter());
assertEquals("Urine", loinc.getLoincTissue());
assertEquals("", loinc.getLoincType());
assertEquals("Test strip", loinc.getLoincMethod());
}
use of org.monarchinitiative.loinc2hpo.util.LoincCodeClass in project loinc2hpo by monarch-initiative.
the class LoincLongNameParserTest method testString15.
@Test
public void testString15() {
String name = "little i Ag [Presence] on Red Blood Cells from donor";
LoincCodeClass loinc = LoincLongNameParser.parse(name);
assertEquals("little i Ag", loinc.getLoincParameter());
assertEquals("Red Blood Cells", loinc.getLoincTissue());
assertEquals("Presence", loinc.getLoincType());
assertEquals("", loinc.getLoincMethod());
}
use of org.monarchinitiative.loinc2hpo.util.LoincCodeClass in project loinc2hpo by monarch-initiative.
the class LoincLongNameParserTest method testString3.
@Test
public void testString3() {
String name = "Platelet mean volume [Entitic volume] in Blood by Automated count";
LoincCodeClass loinc = LoincLongNameParser.parse(name);
assertEquals("Platelet mean volume", loinc.getLoincParameter());
assertEquals("Blood", loinc.getLoincTissue());
assertEquals("Entitic volume", loinc.getLoincType());
assertEquals("Automated count", loinc.getLoincMethod());
}
use of org.monarchinitiative.loinc2hpo.util.LoincCodeClass in project loinc2hpo by monarch-initiative.
the class LoincLongNameParserTest method testString14.
@Test
public void testString14() {
String name = "Appearance of Cerebral spinal fluid";
LoincCodeClass loinc = LoincLongNameParser.parse(name);
assertEquals("Appearance", loinc.getLoincParameter());
assertEquals("Cerebral spinal fluid", loinc.getLoincTissue());
assertEquals("", loinc.getLoincType());
assertEquals("", loinc.getLoincMethod());
}
Aggregations